Conversation
OttoAllmendinger
requested changes
Mar 27, 2026
Contributor
OttoAllmendinger
left a comment
There was a problem hiding this comment.
let's get rid of the enums
not super happy about the base conversion bloat but so far it's not out of control
packages/wasm-ton/js/builder.ts
Outdated
Comment on lines
+11
to
+28
| /** Staking provider types - runtime string enum */ | ||
| export enum TonStakingType { | ||
| TonWhales = "TonWhales", | ||
| SingleNominator = "SingleNominator", | ||
| MultiNominator = "MultiNominator", | ||
| } | ||
|
|
||
| /** Transaction type enum - runtime string enum */ | ||
| export enum TonTransactionType { | ||
| Transfer = "Transfer", | ||
| TokenTransfer = "TokenTransfer", | ||
| WhalesDeposit = "WhalesDeposit", | ||
| WhalesVestingDeposit = "WhalesVestingDeposit", | ||
| WhalesWithdraw = "WhalesWithdraw", | ||
| WhalesVestingWithdraw = "WhalesVestingWithdraw", | ||
| SingleNominatorWithdraw = "SingleNominatorWithdraw", | ||
| Unknown = "Unknown", | ||
| } |
Contributor
There was a problem hiding this comment.
we had type cast issues due to enum before
this is better:
const TonStakingType = ["TonWhales", ... ] as const;
typeof TonStakingType = typeof TonStakingType[number];
let's add it to the toplevel conventions
packages/wasm-ton/js/transaction.ts
Outdated
Comment on lines
+36
to
+41
| /** | ||
| * Get the signable payload as base64 string. | ||
| */ | ||
| signablePayloadBase64(): string { | ||
| return this._wasm.signablePayloadBase64(); | ||
| } |
Comment on lines
+57
to
+62
| /** | ||
| * Serialize to base64 for broadcast. | ||
| */ | ||
| toBroadcastFormat(): string { | ||
| return this._wasm.toBroadcastFormat(); | ||
| } |
packages/wasm-ton/js/transaction.ts
Outdated
Comment on lines
+101
to
+106
| /** | ||
| * Convenience function to create a Transaction from base64. | ||
| */ | ||
| export function transactionFromBase64(b64: string): Transaction { | ||
| return Transaction.fromBase64(b64); | ||
| } |
Contributor
There was a problem hiding this comment.
I mean at least we have the fromBytes as well
7478e88 to
deb8e6e
Compare
Rust/WASM package for TON (The Open Network) transaction building, parsing, and signing. Uses toner v0.7.3 (pure Rust TON SDK) compiled to wasm32-unknown-unknown. Supports all wallet-platform intent types: - payment (native TON + jetton token transfers) - fillNonce (nonce hole filling via self-send) - consolidate (native + token, 7-day expiry) - delegate (TonWhales, SingleNominator, MultiNominator) - undelegate (TonWhales, SingleNominator, MultiNominator) - vesting contract variants for Whales deposit/withdraw Architecture follows wasm-solana/wasm-dot patterns: - Two-layer rule: core Rust logic in src/, thin WASM bindings in src/wasm/ - TypeScript wrappers in js/ with bigint for all monetary amounts - Transaction signing via signablePayload() + addSignature() - Standalone parseTransaction() for all 7 transaction shapes - Intent-based buildTransaction() with BuildContext for offline building 32 TypeScript tests + Rust unit tests. BTC-3211
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
@bitgo/wasm-tonWASM package for offline TON transaction building, parsing, and signing supporttoner(tlb-ton 0.7.3) Rust crate, compiles to wasm32-unknown-unknownsrc/, thin#[wasm_bindgen]wrappers insrc/wasm/, TypeScript wrappers injs/signablePayload()andaddSignature()for TSS integrationprivate: truein package.json until npm package is created by velocity teamTicket: BTC-3212