feat(sdk-coin-dot): integrate @bitgo/wasm-dot for WASM-based transaction parsing#8272
Closed
bitgo-ai-agent-dev[bot] wants to merge 1 commit intomasterfrom
Closed
feat(sdk-coin-dot): integrate @bitgo/wasm-dot for WASM-based transaction parsing#8272bitgo-ai-agent-dev[bot] wants to merge 1 commit intomasterfrom
bitgo-ai-agent-dev[bot] wants to merge 1 commit intomasterfrom
Conversation
…ion parsing Replaces @polkadot/api-based transaction decoding with WASM-backed parsing for signed tdot transactions. Unsigned transactions and mainnet dot remain on the legacy txwrapper path until validation is complete. Changes: - wasmParser.ts: new module exporting explainDotTransaction() and toJsonFromWasm(); parses extrinsics via DotTransaction.fromHex() + parseTransaction(), derives transaction types, extracts inputs/outputs, handles batch stake/unstake proxy deposit cost semantics, and maps to the existing TxData / TransactionExplanation interfaces for backwards compatibility - transaction.ts: toJson() routes signed tdot transactions through the WASM path; the signed extrinsic bytes carry metadata-aware signed extension layout that the JS decoder cannot handle (Westend adds AuthorizeCall + StorageWeightReclaim) - lib/index.ts: exports explainDotTransaction and its public types - package.json: adds @bitgo/wasm-dot ^1.3.0 dependency - webpack/bitgojs.config.js: adds ESM alias for browser builds so @bitgo/wasm-dot uses the fetch-based WASM loader instead of fs - test/unit/wasmParser.ts: unit tests for transfers, staking bond, batch stake, full unstake, tip/fee handling, and display order TICKET: BTC-3068 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
|
didnt mean to open this |
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
Integrates
@bitgo/wasm-dotintosdk-coin-dotfor WASM-based extrinsic parsing, replacing@polkadot/api-based decoding for signedtdottransactions.wasmParser.ts(new): exportsexplainDotTransaction()andtoJsonFromWasm(). Parses extrinsics viaDotTransaction.fromHex()+parseTransaction(), derives transaction types, extracts inputs/outputs with BitGoJS-specific semantics (e.g. proxy deposit cost for batch stake/unstake), and maps to the existingTxData/TransactionExplanationinterfaces for backwards compatibility.transaction.ts:toJson()routes signedtdottransactions through the WASM path. Unsigned transactions and mainnetdotremain on the legacy txwrapper path until WASM validation is complete.lib/index.ts: exportsexplainDotTransactionand its public types (ExplainDotTransactionParams,DotWasmExplanation,DotInput).package.json: adds@bitgo/wasm-dot ^1.3.0dependency.webpack/bitgojs.config.js: adds ESM alias for browser builds so@bitgo/wasm-dotuses the fetch-based WASM loader instead offs.readFileSync.test/unit/wasmParser.ts: unit tests covering transfers, staking bond, batch stake/unstake, tip/fee handling, and display order.Why WASM parsing is needed for signed tdot transactions
Westend (tdot) adds non-standard signed extensions (
AuthorizeCall,StorageWeightReclaim) between the signature and call data. The JS txwrapper decoder doesn't know about these extensions and misidentifies the call data boundary. The WASM decoder reads the runtime metadata to determine the extension layout before parsing, so it handles any chain correctly.Scope
WASM path is gated by
this._coinConfig.name === 'tdot' && this._signedTransaction. Mainnetdotand all unsigned transactions continue using the existing txwrapper path.Test plan
test/unit/wasmParser.tspass — covers transfer, bond, batch stake, full unstake, fee/tip, displayOrdersdk-coin-dottests continue to pass (no changes to unsigned or mainnet paths)TICKET: BTC-3068
🤖 Generated with Claude Code