Skip to content

Conversation

@lcovar
Copy link
Contributor

@lcovarlcovar commented Jan 21, 2026

Adds WASM-based transaction parsing using @bitgo/wasm-solana package
with no @solana/web3.js dependency in the parsing path.

New Files

src/lib/wasm/transaction.ts

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

src/lib/wasmParsedInstructionCombiner.ts

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

src/lib/wasmInstructionCombiner.ts

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

Modified Files

src/sol.ts

  • Added explainTransactionWithWasm() for WASM-based transaction explanation
  • Integration with new WASM parsing layer

src/lib/instructionParamsFactory.ts

Fixed edge cases in staking instruction parsing:

  • StakingAuthorize: support 4-key instructions (custodian optional)
  • StakingAuthorizeRaw: support 2-3 instructions (one or both authorities)

Tests

  • wasmTransaction.ts: Unit tests for WasmTransaction class
  • jitoWasmVerification.ts: Jito staking WASM verification tests

@lcovarlcovarforce-pushed the BTC-0-draft-example-sol-decoding branch 27 times, most recently from d32c089 to bb885adCompareJanuary 28, 2026 18:16
@lcovarlcovarforce-pushed the BTC-0-draft-example-sol-decoding branch 2 times, most recently from f5732ce to 97c511dCompareJanuary 28, 2026 18:36
@lcovarlcovar changed the title temp: wasm-sol examplefeat(sdk-coin-sol): add WASM-based transaction parsing via @bitgo/wasm-solanaJan 28, 2026
@lcovarlcovarforce-pushed the BTC-0-draft-example-sol-decoding branch 8 times, most recently from 1b5ecfa to 4b815c5CompareJanuary 29, 2026 08:08
…m-solana Adds WASM-based transaction parsing that eliminates @solana/web3.js dependency for the decoding/explain flow. The WASM library (@bitgo/wasm-solana) handles all instruction decoding, and a simple type mapper converts to BitGoJS format. Key changes: - Add wasmInstructionMapper.ts: Maps WASM types to BitGoJS InstructionParams - Combines CreateAccount + StakeInitialize + Delegate -> StakingActivate - Combines CreateAccount + NonceInitialize -> CreateNonceAccount - Handles Jito staking (StakePoolDepositSol, StakePoolWithdrawStake) - Handles standalone delegate for re-delegation - Add WasmTransaction class (wasm/transaction.ts) for WASM-only parsing - Update wasmInstructionCombiner.ts as clean entry point - Update sol.ts explainTransactionWithWasm to use bytes-based API - Remove wasmInstructionAdapter.ts (no longer needed) NO @solana/web3.js dependencies in the new parsing flow. TICKET: BTC-0
@lcovarlcovarforce-pushed the BTC-0-draft-example-sol-decoding branch from 4b815c5 to c2bcda3CompareJanuary 29, 2026 08:11
Sign up for freeto 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.

2 participants

@lcovar