-
Notifications
You must be signed in to change notification settings - Fork 302
feat(sdk-coin-sol): add WASM-based transaction parsing via @bitgo/wasm-solana #7957
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
d32c089 to
bb885ad
Compare
f5732ce to
97c511d
Compare
c2bcda3 to
c03ea63
Compare
cfd03be to
c0e8e7f
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-0
c0e8e7f to
63284b8
Compare
OttoAllmendinger
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's avoid the internal bigint casts - why is instr.params.amount not a bigint already?
| params: { | ||
| fromAddress: instr.fromAddress, | ||
| toAddress: instr.toAddress, | ||
| amount: instr.amount.toString(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sigh I guess because we have to satisfy this type
| // 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm guessing the interface forces us to do this ugliness?
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: