Commit 97c511d
committed
feat(sdk-coin-sol): add WASM-based transaction parsing via @bitgo/wasm-solana
Adds WASM-based transaction parsing using @bitgo/wasm-solana package
with no @solana/web3.js dependency in the parsing path.
WasmTransaction class for parsing Solana transactions using WASM:
- Transaction ID extraction from signatures
- Signable payload generation
- JSON serialization with parsed instruction data
- Transaction explanation for human readability
- Token name resolution via BitGo statics
Clean instruction combiner without @solana/web3.js dependency:
- Combines raw WASM-parsed instructions into BitGoJS InstructionParams
- Pattern matching for multi-instruction combinations:
- CreateAccount + NonceInitialize → WalletInit
- CreateAccount + StakeInitialize + Delegate → StakingActivate (Native)
- CreateAccount + StakeInitialize → StakingActivate (Marinade)
- StakePoolDepositSol → StakingActivate (Jito)
- StakePoolWithdrawStake → StakingDeactivate (Jito)
- Derives transaction type from combined instructions
- Handles bigint to string conversion for amounts
Thin wrapper that orchestrates WASM instruction parsing:
1. Gets transaction bytes from WASM transaction
2. Parses with wasm-solana's parseTransaction()
3. Delegates to wasmParsedInstructionCombiner
- Added explainTransactionWithWasm() for WASM-based transaction explanation
- Integration with new WASM parsing layer
Fixed edge cases in staking instruction parsing:
- StakingAuthorize: support 4-key instructions (custodian optional)
- StakingAuthorizeRaw: support 2-3 instructions (one or both authorities)
- wasmTransaction.ts: Unit tests for WasmTransaction class
- jitoWasmVerification.ts: Jito staking WASM verification tests
TICKET: BTC-01 parent 9b284f3 commit 97c511d
12 files changed
Lines changed: 1538 additions & 114 deletions
Binary file not shown.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| 47 | + | |
47 | 48 | | |
48 | 49 | | |
49 | 50 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| 24 | + | |
Lines changed: 23 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1171 | 1171 | | |
1172 | 1172 | | |
1173 | 1173 | | |
1174 | | - | |
| 1174 | + | |
| 1175 | + | |
| 1176 | + | |
| 1177 | + | |
1175 | 1178 | | |
1176 | 1179 | | |
1177 | 1180 | | |
| |||
1181 | 1184 | | |
1182 | 1185 | | |
1183 | 1186 | | |
1184 | | - | |
1185 | | - | |
1186 | | - | |
1187 | | - | |
1188 | | - | |
1189 | | - | |
1190 | | - | |
1191 | | - | |
1192 | | - | |
1193 | | - | |
1194 | | - | |
| 1187 | + | |
| 1188 | + | |
| 1189 | + | |
| 1190 | + | |
| 1191 | + | |
| 1192 | + | |
| 1193 | + | |
| 1194 | + | |
| 1195 | + | |
| 1196 | + | |
| 1197 | + | |
| 1198 | + | |
| 1199 | + | |
| 1200 | + | |
| 1201 | + | |
| 1202 | + | |
| 1203 | + | |
| 1204 | + | |
1195 | 1205 | | |
1196 | 1206 | | |
1197 | 1207 | | |
| |||
1239 | 1249 | | |
1240 | 1250 | | |
1241 | 1251 | | |
1242 | | - | |
| 1252 | + | |
1243 | 1253 | | |
1244 | 1254 | | |
1245 | 1255 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
0 commit comments