Skip to content

feat: add wasm-ton integration to sdk-coin-ton#8350

Draft
lcovar wants to merge 1 commit intomasterfrom
wasm-ton
Draft

feat: add wasm-ton integration to sdk-coin-ton#8350
lcovar wants to merge 1 commit intomasterfrom
wasm-ton

Conversation

@lcovar
Copy link
Contributor

@lcovar lcovar commented Mar 26, 2026

Integrates @bitgo/wasm-ton into sdk-coin-ton, replacing TonWeb-based
transaction parsing, address derivation, and signing payload extraction with
offline Rust/WASM.

what changed

  • explainTransactionWasm.ts: new module with explainTonTransaction() that
    parses TON transactions via WASM and maps to the TonTransactionExplanation
    shape. handles Send, SendToken (Jetton), SingleNominatorWithdraw,
    TonWhalesDeposit, and TonWhalesWithdrawal.

  • wasmAddress.ts: synchronous getAddressFromPublicKey() using
    encodeAddress() from @bitgo/wasm-ton, replacing the async TonWeb
    wallet.getAddress() call. async signature preserved in utils.ts for
    backward compatibility.

  • wasmSigner.ts: getSignablePayload() and applySignature() wiring —
    uses Transaction.fromBase64()signablePayload()addSignature()
    toBroadcastFormat().

  • ton.ts: explainTransaction and getSignablePayload now route through
    WASM. the legacy TransactionBuilder path is preserved for unsigned
    transaction building and the recover() flow.

  • package.json: adds @bitgo/wasm-ton: "*" dependency.

  • tests: three new test suites — wasmExplainTransaction.ts,
    wasmAddress.ts, wasmSigner.ts — covering all transaction types using
    existing fixtures.

scope

explainTransaction and getSignablePayload in ton.ts now use the WASM
path for all transaction types. the legacy builder path (TransactionBuilder,
TransferBuilder, etc.) remains in place for transaction construction.

TICKET: BTC-3200

Wire @bitgo/wasm-ton into sdk-coin-ton for address derivation, transaction
parsing, and signing — replacing the TonWeb-based paths with offline Rust/WASM.

- package.json: add @bitgo/wasm-ton dependency
- explainTransactionWasm.ts: WASM-based explainTransaction using parseTransaction(),
  maps ParsedTransaction to TonTransactionExplanation shape, handles Send,
  SendToken (Jetton), SingleNominatorWithdraw, TonWhalesDeposit, TonWhalesWithdrawal
- wasmAddress.ts: synchronous getAddressFromPublicKey using encodeAddress(),
  replaces async TonWeb wallet.getAddress() call
- wasmSigner.ts: getSignablePayload() and applySignature() using
  Transaction.fromBase64() / signablePayload() / addSignature() / toBroadcastFormat()
- utils.ts: getAddressFromPublicKey delegates to wasmAddress (async signature preserved)
- ton.ts: explainTransaction uses WASM parser, getSignablePayload uses WASM
- tests: wasmExplainTransaction, wasmAddress, wasmSigner unit test suites

TICKET: BTC-3200
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