Skip to content

Conversation

@lcovar
Copy link
Contributor

@lcovar lcovar commented Jan 14, 2026

Add WASM bindings for Solana transaction parsing and inspection:

  • Transaction.fromBase64() / fromBytes() for deserialization
  • Access to fee payer, recent blockhash, account keys
  • Instruction decoding with programId, accounts, and data
  • AccountMeta with isSigner/isWritable flags
  • Signature access by index (base58 or bytes)
  • Signable payload extraction for verification

Add parseTransaction() for semantic instruction decoding:

  • Decodes System Program: Transfer, CreateAccount, NonceAdvance
  • Decodes Stake Program: Delegate, Deactivate, Withdraw, Authorize
  • Decodes ComputeBudget: SetComputeUnitLimit, SetPriorityFee
  • Decodes Token Program: Transfer, TransferChecked, CloseAccount
  • Decodes ATA Program: CreateAssociatedTokenAccount
  • Decodes Memo Program
  • Output format matches BitGoJS TxData interface

BitGoJS compatibility tests verify identical output for:

  • Transfer with memo and durable nonce
  • Multi-transfer transactions (6 recipients)
  • Staking activate transactions
  • Token transfer transactions
  • Simple unsigned transfers

Uses official Solana crates exclusively:

  • solana-transaction for Transaction type
  • solana-system-interface for SystemInstruction
  • solana-stake-interface for StakeInstruction
  • solana-compute-budget-interface for ComputeBudgetInstruction

Removed ed25519-dalek dependency (-44KB WASM, -36KB gzipped).

Replaces @solana/web3.js Transaction.from() in BitGoJS.

Ticket: BTC-2929

@lcovar lcovar requested a review from a team as a code owner January 14, 2026 23:47
@lcovar lcovar marked this pull request as draft January 15, 2026 00:30
@lcovar lcovar force-pushed the BTC-2929 branch 2 times, most recently from 8c77915 to 500aca4 Compare January 15, 2026 00:51
@lcovar lcovar marked this pull request as ready for review January 15, 2026 00:58
Copy link
Contributor

@OttoAllmendinger OttoAllmendinger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's reduce the API surface a little bit (unless we really need compatibility)

if we really need these funcs for compatibility, a lot of them can be implemented in the TS layer and we can keep the rust/wasm layer smaller

@lcovar lcovar force-pushed the BTC-2929 branch 2 times, most recently from d0bc9ec to 05b7ad6 Compare January 15, 2026 22:46
@lcovar lcovar changed the title feat(wasm-solana): add transaction deserialization feat(wasm-solana): add transaction parsing with BitGoJS compatibility Jan 15, 2026
Add WASM bindings for Solana transaction parsing and inspection:
- Transaction.fromBase64() / fromBytes() for deserialization
- Access to fee payer, recent blockhash, account keys
- Instruction decoding with programId, accounts, and data
- AccountMeta with isSigner/isWritable flags
- Signature access by index (base58 or bytes)
- Signable payload extraction for verification

Add parseTransaction() for semantic instruction decoding:
- Decodes System Program: Transfer, CreateAccount, NonceAdvance
- Decodes Stake Program: Delegate, Deactivate, Withdraw, Authorize
- Decodes ComputeBudget: SetComputeUnitLimit, SetPriorityFee
- Decodes Token Program: Transfer, TransferChecked, CloseAccount
- Decodes ATA Program: CreateAssociatedTokenAccount
- Decodes Memo Program
- Output format matches BitGoJS TxData interface

BitGoJS compatibility tests verify identical output for:
- Transfer with memo and durable nonce
- Multi-transfer transactions (6 recipients)
- Staking activate transactions
- Token transfer transactions
- Simple unsigned transfers

Uses official Solana crates exclusively:
- solana-transaction for Transaction type
- solana-system-interface for SystemInstruction
- solana-stake-interface for StakeInstruction
- solana-compute-budget-interface for ComputeBudgetInstruction

Removed ed25519-dalek dependency (-44KB WASM, -36KB gzipped).

Replaces @solana/web3.js Transaction.from() in BitGoJS.

Ticket: BTC-2929
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants