Skip to content
docs

WalletAccountTon

Defined in: wallet-ton/src/account.ts:34

Signing TON account on Wallet V5R1. It never holds a key: the V5R1 body is signed by signer.sign(signingCell.hash(), {scheme: 'ed25519', context: 'ton-external'}) — a LocalSigner for seed wallets, anything else (hardware, MPC, backend) through externalSigner().

Every send runs: hard checks → fresh seqno → preflight on the zero-signed body (estimateFee, emulation when configured, fee cap) → sign → broadcast. The preflight body carries a zero signature, so the signer is only asked once the transaction has passed.

  • IWalletAccount

new WalletAccountTon(signer, publicKey, path, config?): WalletAccountTon

Defined in: wallet-ton/src/account.ts:50

publicKey is the signer’s 32-byte ed25519 key; the V5R1 address derives from it synchronously.

Signer

Uint8Array

string

TonConfig = {}

WalletAccountTon

WalletAccountReadOnlyTon.constructor

protected readonly _address: Address

Defined in: wallet-ton/src/read-only-account.ts:42

WalletAccountReadOnlyTon._address


protected readonly _config: TonConfig

Defined in: wallet-ton/src/read-only-account.ts:39

WalletAccountReadOnlyTon._config


protected readonly _init: StateInit

Defined in: wallet-ton/src/read-only-account.ts:41

WalletAccountReadOnlyTon._init


protected readonly _rpc: TonCenter | undefined

Defined in: wallet-ton/src/read-only-account.ts:43

WalletAccountReadOnlyTon._rpc


protected readonly _walletId: bigint

Defined in: wallet-ton/src/read-only-account.ts:40

WalletAccountReadOnlyTon._walletId


readonly address: string

Defined in: wallet-ton/src/read-only-account.ts:38

User-friendly address.

WalletAccountReadOnlyTon.address


readonly chain: string

Defined in: wallet-ton/src/read-only-account.ts:34

CAIP-2 chain id, e.g. “eip155:1”, “solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp”, “ton:-239”, “tron:0x2b6653dc”, “bip122:000000000019d6689c085ae165831e93”.

IWalletAccount.chain

WalletAccountReadOnlyTon.chain


readonly needsNetwork: true = true

Defined in: wallet-ton/src/account.ts:36

seqno and fees come from the network before signing.

IWalletAccount.needsNetwork


readonly path: string

Defined in: wallet-ton/src/account.ts:38

Derivation path, ton-mnemonic, or external.


readonly publicKey: Uint8Array

Defined in: wallet-ton/src/read-only-account.ts:36

Ed25519 public key the wallet is derived from.

WalletAccountReadOnlyTon.publicKey


readonly signerKind: "external" | "seed" | "key"

Defined in: wallet-ton/src/account.ts:46

What holds the key: seed, key (one imported key) or external.

get index(): number | undefined

Defined in: wallet-ton/src/account.ts:63

Account index for the standard m/44’/607’/i’ path.

number | undefined

protected checkedAddress(to): object

Defined in: wallet-ton/src/read-only-account.ts:135

A destination address with the checks every payment gets: workchain 0 or -1, and a friendly address’s test-only flag matching the wallet’s network. Used for a native message’s to and a jetton transfer’s recipient and response destination (round 3, L8).

string

object

address: Address

bounceable: boolean

WalletAccountReadOnlyTon.checkedAddress


describe(tx): TonDescription

Defined in: wallet-ton/src/read-only-account.ts:281

Offline description of what tx does — see describeTransaction.

TonSendable

TonDescription

WalletAccountReadOnlyTon.describe


dispose(): void

Defined in: wallet-ton/src/account.ts:222

Disposes the signer: a local key is zeroized, an external one is released.

void

IWalletAccount.dispose


estimateFees(body): Promise<TonFees>

Defined in: wallet-ton/src/read-only-account.ts:234

in_fwd + storage + gas + fwd from toncenter’s estimateFee (signature ignored).

Cell

Promise<TonFees>

WalletAccountReadOnlyTon.estimateFees


getAddress(): Promise<string>

Defined in: wallet-ton/src/read-only-account.ts:70

The user-friendly address.

Promise<string>

IWalletAccount.getAddress

WalletAccountReadOnlyTon.getAddress


getBalance(): Promise<bigint>

Defined in: wallet-ton/src/read-only-account.ts:73

Native balance in nanotons.

Promise<bigint>

IWalletAccount.getBalance

WalletAccountReadOnlyTon.getBalance


getJettonWalletAddress(token): Promise<Address>

Defined in: wallet-ton/src/read-only-account.ts:86

Resolve this wallet’s jetton wallet for a jetton master.

string

Promise<Address>

WalletAccountReadOnlyTon.getJettonWalletAddress


getSeqno(): Promise<number>

Defined in: wallet-ton/src/read-only-account.ts:78

Current seqno — 0 until the wallet contract is deployed. Always fetched fresh.

Promise<number>

WalletAccountReadOnlyTon.getSeqno


getTokenBalance(token): Promise<bigint>

Defined in: wallet-ton/src/read-only-account.ts:114

Jetton balance in base units, read from this wallet’s jetton wallet; 0 when it does not exist.

string

Promise<bigint>

IWalletAccount.getTokenBalance

WalletAccountReadOnlyTon.getTokenBalance


getTransactionReceipt(hash): Promise<TonReceipt | undefined>

Defined in: wallet-ton/src/read-only-account.ts:289

Receipt for a body hash returned by sendTransaction: toncenter v3 maps the message body hash to the account transaction, which is then fetched.

string

Promise<TonReceipt | undefined>

IWalletAccount.getTransactionReceipt

WalletAccountReadOnlyTon.getTransactionReceipt


protected initIfNeeded(): Promise<StateInit | undefined>

Defined in: wallet-ton/src/read-only-account.ts:228

StateInit to attach to an external when the wallet is not deployed yet.

Promise<StateInit | undefined>

WalletAccountReadOnlyTon.initIfNeeded


protected jettonTransferMessage(o): Promise<V5R1Message>

Defined in: wallet-ton/src/read-only-account.ts:166

TonTransferOptions

Promise<V5R1Message>

WalletAccountReadOnlyTon.jettonTransferMessage


protected jettonWalletData(token, jw): Promise<bigint>

Defined in: wallet-ton/src/read-only-account.ts:100

Read a jetton wallet and prove it is ours for token: get_wallet_data must name this wallet as owner and token as master. The master’s own get_wallet_address answer is not trusted on its own — a fake master could point at our real wallet of another jetton (e.g. USDT).

string

Address

Promise<bigint>

WalletAccountReadOnlyTon.jettonWalletData


quoteSendTransaction(tx): Promise<{ fee: bigint; }>

Defined in: wallet-ton/src/read-only-account.ts:268

Estimated fee of a transaction, in nanotons.

TonSendable

Promise<{ fee: bigint; }>

IWalletAccount.quoteSendTransaction

WalletAccountReadOnlyTon.quoteSendTransaction


quoteTransfer(o): Promise<{ fee: bigint; }>

Defined in: wallet-ton/src/read-only-account.ts:274

Estimated fee of a transfer, in nanotons.

TonTransferOptions

Promise<{ fee: bigint; }>

IWalletAccount.quoteTransfer

WalletAccountReadOnlyTon.quoteTransfer


protected requireRpc(what): TonCenter

Defined in: wallet-ton/src/read-only-account.ts:64

string

TonCenter

WalletAccountReadOnlyTon.requireRpc


sendTransaction(tx, options?): Promise<TransferResult>

Defined in: wallet-ton/src/account.ts:198

Sign and broadcast; hash is the body hash (hex) — resolve it with getTransactionReceipt.

TonSendable

WriteOptions = {}

Promise<TransferResult>

IWalletAccount.sendTransaction


sign(message): Promise<string>

Defined in: wallet-ton/src/account.ts:76

Hex ed25519 signature over the raw message bytes. A 32-byte message — string or bytes — is refused with MessageIsTransactionError: the wallet contract checks a transfer’s signature over the 32-byte hash of its signing cell, so those bytes could be one. Bytes that carry this account’s public key are refused as well: one ed25519 key (an external signer) may also be a Solana wallet, and a Solana transaction names its signer’s key. TON Connect goes through signTonProof and signTonConnectData.

string | Uint8Array<ArrayBufferLike>

Promise<string>

IWalletAccount.sign


protected signingCell(messages): Promise<{ seqno: number; signing: Cell; validUntil: number; }>

Defined in: wallet-ton/src/read-only-account.ts:219

The cell to sign for messages at the CURRENT seqno (fetched fresh every time).

V5R1Message[]

Promise<{ seqno: number; signing: Cell; validUntil: number; }>

WalletAccountReadOnlyTon.signingCell


signTonConnectData(request): Promise<TonSignedData>

Defined in: wallet-ton/src/account.ts:99

TON Connect signData (text / binary) for this wallet’s address: the reply the dApp gets.

TonSignDataRequest

Promise<TonSignedData>


signTonProof(request): Promise<TonProof>

Defined in: wallet-ton/src/account.ts:87

TON Connect ton_proof for this wallet’s address: the proof object of the connect reply. The digest is built here (0xffff ‖ “ton-connect” ‖ …), so no request can turn it into a transfer. domain is the host the wallet saw the request come from.

TonProofRequest

Promise<TonProof>


signTransaction(tx, options?): Promise<string>

Defined in: wallet-ton/src/account.ts:173

Sign without broadcasting. Returns the external-message BODY as base64 BoC (pass it back to sendTransaction as a Cell).

TonSendable

WriteOptions = {}

Promise<string>

IWalletAccount.signTransaction


simulateBody(body): Promise<TonSimulation>

Defined in: wallet-ton/src/read-only-account.ts:247

Preflight an external body: fees via estimateFee and, unless config.emulate === false, a trace emulation (tonapi by default, see TonConfig.emulate) whose compute/action phases — and the first-hop internal messages — decide ok. Never throws for a failing emulation, only for transport problems or a malformed emulator response.

Cell

Promise<TonSimulation>

WalletAccountReadOnlyTon.simulateBody


simulateTransaction(tx): Promise<TonSimulation>

Defined in: wallet-ton/src/read-only-account.ts:262

Preflight a TonSendable (unsigned body, current seqno).

TonSendable

Promise<TonSimulation>

WalletAccountReadOnlyTon.simulateTransaction


protected stateInitOf(src): StateInit | undefined

Defined in: wallet-ton/src/read-only-account.ts:123

string | Cell | StateInit | undefined

StateInit | undefined

WalletAccountReadOnlyTon.stateInitOf


protected toMessages(tx): V5R1Message[]

Defined in: wallet-ton/src/read-only-account.ts:204

TonTransaction | TonTransaction[]

V5R1Message[]

WalletAccountReadOnlyTon.toMessages


toReadOnlyAccount(): IWalletAccountReadOnly

Defined in: wallet-ton/src/account.ts:216

The same wallet as a WalletAccountReadOnlyTon.

IWalletAccountReadOnly

IWalletAccount.toReadOnlyAccount


protected transactionMessage(tx): V5R1Message

Defined in: wallet-ton/src/read-only-account.ts:156

TonTransaction

V5R1Message

WalletAccountReadOnlyTon.transactionMessage


transfer(o, writeOptions?): Promise<TransferResult>

Defined in: wallet-ton/src/account.ts:208

TON (no token) or jetton transfer.

TonTransferOptions

WriteOptions = {}

Promise<TransferResult>

IWalletAccount.transfer


protected validUntil(): number

Defined in: wallet-ton/src/read-only-account.ts:210

number

WalletAccountReadOnlyTon.validUntil


verify(message, signature): Promise<boolean>

Defined in: wallet-ton/src/read-only-account.ts:308

ed25519 over the raw message bytes; signature hex.

string | Uint8Array<ArrayBufferLike>

string

Promise<boolean>

IWalletAccount.verify

WalletAccountReadOnlyTon.verify


static fromPrivateKey(privateKey, publicKey, path, config?): WalletAccountTon

Defined in: wallet-ton/src/account.ts:58

Back-compat: wrap a raw derived key in a LocalSigner (the account takes ownership; it cannot derive).

Uint8Array

Uint8Array

string

TonConfig = {}

WalletAccountTon