feat(sdk-coin-sol): add WASM-based transaction parsing via @bitgo/wasm-solana#7957
feat(sdk-coin-sol): add WASM-based transaction parsing via @bitgo/wasm-solana#7957
Conversation
d32c089 to
bb885ad
Compare
f5732ce to
97c511d
Compare
c2bcda3 to
c03ea63
Compare
c0e8e7f to
63284b8
Compare
OttoAllmendinger
left a comment
There was a problem hiding this comment.
we can move towards bigint a little bit more
where external interfaces force us to string keep it
| ]; | ||
|
|
||
| const outputs: { address: string; amount: string; memo?: string }[] = []; | ||
| let outputAmount = '0'; |
There was a problem hiding this comment.
| let outputAmount = '0'; | |
| let outputAmount = 0n; |
| address: instr.params.toAddress, | ||
| amount: instr.params.amount, | ||
| }); | ||
| outputAmount = (BigInt(outputAmount) + BigInt(instr.params.amount)).toString(); |
There was a problem hiding this comment.
let's avoid the internal bigint casts - why is instr.params.amount not a bigint already?
modules/sdk-coin-sol/src/sol.ts
Outdated
| // Derive outputs and tokenEnablements from combined instructions | ||
| const outputs: TransactionRecipient[] = []; | ||
| const tokenEnablements: ITokenEnablement[] = []; | ||
| let outputAmount = new BigNumber(0); |
There was a problem hiding this comment.
yet another way to sum up things... use bigint instead
|
|
||
| /** Transaction ID (first signature, base58 encoded) */ | ||
| get id(): string { | ||
| if (!this._wasmTransaction) return UNAVAILABLE_TEXT; |
There was a problem hiding this comment.
I'm guessing the interface forces us to do this ugliness?
There was a problem hiding this comment.
Unfortunately yes, base class forces the return type of string while _id can be string | undefined so it's a bit silly. We have to return a string, i guess we can return an empty string.
Seeing what it would take to update the base class to accept undefined as a return type. It would cause some breaking changes though but lets see. 🤖
38e4bc7 to
da3dc95
Compare
da3dc95 to
564ed1f
Compare
…m-solana This PR introduces WASM-based transaction parsing as an alternative to the legacy @solana/web3.js approach. The WASM implementation provides cleaner parsing with zero web3.js dependencies for transaction decoding. Key changes: - Add WasmTransaction class (~150 lines vs 800+ in legacy Transaction) - Add wasmInstructionMapper to convert WASM parsed instructions to SDK format - Add wasmInstructionCombiner to derive transaction types from instructions - Update sol.ts to extract transaction IDs using WASM parsing - Add comprehensive tests including Jito staking verification Dependencies: - @bitgo/wasm-solana@1.6.0 (from npm) - Webpack alias added for browser builds Ticket: BTC-3023
564ed1f to
0b3225b
Compare
This PR introduces WASM-based transaction parsing as an alternative to
the legacy @solana/web3.js approach. The WASM implementation provides
cleaner parsing with zero web3.js dependencies for transaction decoding.
Key changes:
Dependencies: