refactor: move explain logic out of wasm-dot, accept metadata as hex string#182
Merged
Conversation
872b33a to
ad2bf05
Compare
OttoAllmendinger
approved these changes
Feb 27, 2026
OttoAllmendinger
left a comment
Contributor
There was a problem hiding this comment.
yeah the 0x prefixed hex strings are maybe a good exception for the no-hex rule worth documenting in the conventions
…string - remove explainTransaction and explain.ts from wasm-dot (moved to BitGoJS) - narrow parseTransaction to accept only DotTransaction (not raw bytes/hex) - add fromHex, toHex, toBroadcastFormat to DotTransaction TS wrapper - pass material at deserialization time (fromHex/fromBytes) so metadata- aware signed extension parsing can determine call_data boundaries - revert Material.metadata from Uint8Array back to string (0x-prefixed hex) to match the Substrate RPC wire format and avoid forcing callers to convert - consolidate decode_metadata into a single pub(crate) function in transaction.rs, remove duplicates from parser.rs and builder/mod.rs BTC-3093
ad2bf05 to
3ebe07d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
explainTransaction/explain.tsfrom wasm-dot — explain logic now lives in BitGoJS (sdk-coin-dot/wasmParser.ts)parseTransactionto accept onlyDotTransaction(not raw bytes/hex)fromHexandtoBroadcastFormattoDotTransactionTS wrapper, removetoHex(callers usetoBroadcastFormator converttoBytes()output)call_databoundaries correctly (needed for chains with non-standard extensions like Westend'sAuthorizeCall/StorageWeightReclaim)Material.metadatafromUint8Arrayback tostring(0x-prefixed hex):state_getMetadataRPC returns 0x-prefixed hexUint8Arrayat every boundary adds friction with no benefit — the hex-to-bytes decode happens once, internally in Rust, right before SCALE decodingBuffer.from('0x...', 'hex')silently returns an empty buffer when the input has a0xprefix, making caller-side conversion error-pronedecode_metadatainto a singlepub(crate)function (was duplicated across parser.rs, builder/mod.rs, and transaction.rs)Test plan
cargo clippy,cargo fmt,eslint,prettierall cleanBTC-3093