API Reference
Complete API documentation for @tetherto/wdk-wallet-ton-gasless
Table of Contents
WalletManagerTonGasless
The main class for managing gasless TON wallets. Extends WalletManager from @tetherto/wdk-wallet.
Constructor
new WalletManagerTonGasless(seed, config)Parameters:
seed(string | Uint8Array): BIP-39 mnemonic seed phrase or seed bytesconfig(TonGaslessWalletConfig): Configuration objecttonClient(object | TonClient): TON client configuration or instanceurl(string): TON Center API URL (e.g., 'https://toncenter.com/api/v3')secretKey(string, optional): API key for TON Center
tonApiClient(object | TonApiClient): TON API client configuration or instanceurl(string): TON API URL (e.g., 'https://tonapi.io/v2')secretKey(string, optional): API key for TON API
paymasterToken(object): Paymaster token configurationaddress(string): Paymaster token contract address
transferMaxFee(number, optional): Maximum fee for transfer operations
Example:
Methods
getAccount(index)
Returns a gasless wallet account at the specified index
Promise<WalletAccountTonGasless>
getAccountByPath(path)
Returns a gasless wallet account at the specified BIP-44 derivation path
Promise<WalletAccountTonGasless>
getFeeRates()
Returns current fee rates for transactions
Promise<{normal: number, fast: number}>
dispose()
Disposes all wallet accounts, clearing private keys from memory
void
getAccount(index)
Returns a gasless wallet account at the specified index.
Parameters:
index(number, optional): The index of the account to get (default: 0)
Returns: Promise<WalletAccountTonGasless> - The wallet account
Example:
getAccountByPath(path)
Returns a gasless wallet account at the specified BIP-44 derivation path.
Parameters:
path(string): The derivation path (e.g., "0'/0/0")
Returns: Promise<WalletAccountTonGasless> - The wallet account
Example:
getFeeRates()
Returns current fee rates for transactions based on blockchain config.
Returns: Promise<{normal: number, fast: number}> - Object containing fee rates
Example:
dispose()
Disposes all wallet accounts, clearing private keys from memory.
Example:
WalletAccountTonGasless
Individual gasless TON wallet account implementation. Extends WalletAccountReadOnlyTonGasless and implements IWalletAccount.
Constructor
Parameters:
seed(string | Uint8Array): BIP-39 mnemonic seed phrase or seed bytespath(string): BIP-44 derivation path (e.g., "0'/0/0")config(TonGaslessWalletConfig): Configuration object (same as WalletManagerTonGasless)
Methods
getAddress()
Returns the account's TON address
Promise<string>
sign(message)
Signs a message using the account's private key
Promise<string>
verify(message, signature)
Verifies a message signature
Promise<boolean>
transfer(options, config?)
Transfers tokens using gasless transactions
Promise<{hash: string, fee: number}>
quoteTransfer(options, config?)
Estimates the fee for a token transfer
Promise<{fee: number}>
getBalance()
Returns the native TON balance (in nanotons)
Promise<number>
getTokenBalance(tokenAddress)
Returns the balance of a specific token
Promise<number>
getPaymasterTokenBalance()
Returns the balance of the paymaster token
Promise<number>
toReadOnlyAccount()
Returns a read-only copy of the account
Promise<WalletAccountReadOnlyTonGasless>
dispose()
Disposes the wallet account, clearing private keys from memory
void
getAddress()
Returns the account's address.
Returns: Promise<string> - The account's TON address
Example:
sign(message)
Signs a message using the account's private key.
Parameters:
message(string): The message to sign
Returns: Promise<string> - The message signature
Example:
verify(message, signature)
Verifies a message signature.
Parameters:
message(string): The original messagesignature(string): The signature to verify
Returns: Promise<boolean> - True if the signature is valid
Example:
transfer(options, config?)
Transfers tokens using gasless transactions. Note: sendTransaction() is not supported and will throw an error.
Parameters:
options(TransferOptions): Transfer optionstoken(string): Token contract addressrecipient(string): Recipient TON addressamount(number): Amount in token's base units
config(object, optional): Override configurationpaymasterToken(object, optional): Override default paymaster tokenaddress(string): Paymaster token address
transferMaxFee(number, optional): Override maximum fee
Returns: Promise<{hash: string, fee: number}> - Transfer result
Example:
quoteTransfer(options)
Estimates the fee for a Jetton (TON token) transfer.
Parameters:
options(TransferOptions): Transfer optionstoken(string): Token contract addressrecipient(string): Recipient TON addressamount(number): Amount in token's base units
config(object, optional): Override configurationpaymasterToken(object, optional): Override default paymaster token
Returns: Promise<{fee: number}> - Object containing fee estimate (in paymaster token base units)
Example:
getPaymasterTokenBalance()
Returns the balance of the paymaster Jetton (used for gasless fees).
Returns: Promise<number> - Paymaster Jetton balance in base units
Example:
getBalance()
Returns the native TON balance (in nanotons).
Returns: Promise<number> - Balance in nanotons
Example:
getTokenBalance(tokenAddress)
Returns the balance of a specific Jetton (TON token).
Parameters:
tokenAddress(string): The token contract address
Returns: Promise<number> - Token balance in base units
Example:
dispose()
Disposes the wallet account, clearing private keys from memory.
Example:
Properties
index
number
The derivation path's index of this account
path
string
The full derivation path of this account
keyPair
{publicKey: Buffer, privateKey: Buffer}
The account's public and private key pair as buffers
Example:
WalletAccountReadOnlyTonGasless
Read-only gasless TON wallet account.
Constructor
Parameters:
publicKey(string | Uint8Array): The account's public keyconfig(TonGaslessWalletConfig): Configuration object
Methods
getAddress()
Returns the account's TON address
Promise<string>
getBalance()
Returns the native TON balance
Promise<number>
getTokenBalance(tokenAddress)
Returns the balance of a specific token
Promise<number>
getPaymasterTokenBalance()
Returns the balance of the paymaster token
Promise<number>
quoteTransfer(options, config?)
Estimates the fee for a token transfer
Promise<{fee: number}>
getTransactionReceipt(hash)
Returns a transaction's receipt
Promise<TonTransactionReceipt | null>
getAddress()
Returns the account's TON address.
Returns: Promise<string> - The account's TON address
Example:
getBalance()
Returns the native TON balance (in nanotons).
Returns: Promise<number> - Balance in nanotons
Example:
getTokenBalance(tokenAddress)
Returns the balance of a specific token.
Parameters:
tokenAddress(string): The token contract address
Returns: Promise<number> - Token balance in base units
Example:
getPaymasterTokenBalance()
Returns the balance of the paymaster token (used for gasless fees).
Returns: Promise<number> - Paymaster token balance in base units
Example:
quoteTransfer(options, config?)
Estimates the fee for a token transfer.
Parameters:
options(TransferOptions): Transfer optionstoken(string): Token contract addressrecipient(string): Recipient TON addressamount(number): Amount in token's base units
config(object, optional): Override configurationpaymasterToken(object, optional): Override default paymaster token
Returns: Promise<{fee: number}> - Object containing fee estimate (in paymaster token base units)
Example:
getTransactionReceipt(hash)
Returns a transaction's receipt.
Parameters:
hash(string): The transaction's hash
Returns: Promise<TonTransactionReceipt | null> - The receipt, or null if the transaction has not been included in a block yet
Example:

