Commit 40b3425
committed
feat: add WASM-based DOT transaction parsing via @bitgo/wasm-dot
Integrates @bitgo/wasm-dot into sdk-coin-dot for WASM-based transaction
parsing using Rust/subxt, replacing the JS txwrapper-polkadot path for
tdot (testnet) signed transactions.
## what changed
- **wasmParser.ts**: new module with `explainDotTransaction()` and
`toJsonFromWasm()` that parse DOT extrinsics via WASM and map to
BitGoJS TransactionExplanation / TxData formats. handles transfers,
staking (bond, unbond, withdraw, chill, payout), proxy (add/remove),
batch (nested + atomic), and transferAll.
- **transaction.ts toJson()**: signed tdot transactions now use the WASM
path (`toJsonFromWasm`), which handles metadata-aware signed extension
parsing (e.g. Westend's AuthorizeCall, StorageWeightReclaim). unsigned
transactions still use the legacy txwrapper path.
- **webpack config**: added ESM alias for @bitgo/wasm-dot so browser
builds use the fetch-based WASM loader instead of fs.readFileSync.
- **tests**: 72+ new test lines in dot.ts covering WASM explain for
transfers and staking. 511-line byte comparison test suite validating
WASM builder output matches legacy txwrapper output byte-for-byte
across all transaction types (transfer, stake, unstake, withdraw,
chill, proxy, batch).
- **withdrawUnstakedBuilder test fix**: numSlashingSpans assertion
updated from string to number to match actual type.
## scope
WASM path is only active for tdot signed transactions, gated by
`this._coinConfig.name === 'tdot' && this._signedTransaction`. mainnet
dot remains on the legacy path until validation is complete.
BTC-0
TICKET: BTC-01 parent fe561c2 commit 40b3425
File tree
10 files changed
+997
-13
lines changed- modules/sdk-coin-dot
- src
- lib
- test/unit
- transactionBuilder
- webpack
10 files changed
+997
-13
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| 46 | + | |
46 | 47 | | |
47 | 48 | | |
48 | 49 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | 61 | | |
70 | 62 | | |
71 | 63 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
| 20 | + | |
19 | 21 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| 41 | + | |
41 | 42 | | |
42 | 43 | | |
43 | 44 | | |
| |||
161 | 162 | | |
162 | 163 | | |
163 | 164 | | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
164 | 179 | | |
165 | 180 | | |
166 | 181 | | |
| |||
0 commit comments