Skip to content

Btc 0 draft example sol building#7995

Draft
lcovar wants to merge 3 commits intoBTC-0-draft-example-sol-decodingfrom
BTC-0-draft-example-sol-building
Draft

Btc 0 draft example sol building#7995
lcovar wants to merge 3 commits intoBTC-0-draft-example-sol-decodingfrom
BTC-0-draft-example-sol-building

Conversation

@lcovar
Copy link
Contributor

@lcovar lcovar commented Jan 29, 2026

No description provided.

@lcovar lcovar force-pushed the BTC-0-draft-example-sol-building branch 3 times, most recently from ff71306 to e00d9e1 Compare January 29, 2026 19:23
…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
@lcovar lcovar force-pushed the BTC-0-draft-example-sol-decoding branch from c2bcda3 to c03ea63 Compare February 3, 2026 23:10
Add ESM alias for @bitgo/wasm-solana similar to wasm-utxo to ensure
proper WASM initialization in browser bundles.

Ticket: BTC-0
Introduces WASM-based transaction building for testnet (tsol) via
@bitgo/wasm-solana, with zero @solana/web3.js runtime dependency.

## Architecture

Testnet (WASM path - no web3):
- customInstructionBuilder stores versioned data on _versionedTransactionData
- buildVersionedWithWasm() delegates to wasm/builder.ts
- Nonce injection via wasm/builder.injectNonceAdvanceInstruction()

Mainnet (legacy path - unchanged):
- customInstructionBuilder stores on Transaction class + injects nonce
- buildVersionedTransaction() reads from Transaction class
- Original behavior preserved

## Key files
- wasm/builder.ts: buildWasmTransaction(), buildVersionedWasmTransaction()
- wasm/builder.ts: injectNonceAdvanceInstruction() (pure WASM constants)
- customInstructionBuilder.ts: testnet/mainnet branching for storage

TICKET: BTC-0
@lcovar lcovar force-pushed the BTC-0-draft-example-sol-building branch from e00d9e1 to f75472d Compare February 4, 2026 01:36
@lcovar lcovar force-pushed the BTC-0-draft-example-sol-decoding branch 3 times, most recently from cfd03be to c0e8e7f Compare February 5, 2026 00:19
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.

1 participant