WDK logoWDK documentation

API Reference

Complete API documentation for @tetherto/wdk-wallet-ton-gasless

API Reference

Table of Contents

ClassDescriptionMethods
WalletManagerTonGaslessExtends @tetherto/wdk-wallet.Constructor, Methods, Properties
WalletAccountReadOnlyTonGaslessExtends @tetherto/wdk-wallet.Constructor, Methods, Properties
WalletAccountTonGaslessExtends @tetherto/wdk-wallet-ton-gasless.Constructor, Methods, Properties

WalletManagerTonGasless

Extends @tetherto/wdk-wallet

Constructor

new WalletManagerTonGasless(seed, config)
Parameters
Source

src/wallet-manager-ton-gasless.js#L34

Methods

MethodDescriptionReturnsThrows
dispose()Disposes all the wallet accounts, erasing their private keys from the memory.void-
getAccount(index)Returns the wallet account at a specific index (see BIP-44).Promise<WalletAccountTonGasless>-
getAccountByPath(path)Returns the wallet account at a specific BIP-44 derivation path.Promise<WalletAccountTonGasless>-
getFeeRates()Returns the current fee rates.Promise<FeeRates>-
(static) getRandomSeedPhrase(wordCount)Returns a random BIP-39 seed phrase.string-
(static) isValidSeedPhrase(seedPhrase)Checks if a seed phrase is valid.boolean-

dispose()

Disposes all the wallet accounts, erasing their private keys from the memory.

Returns

void

getAccount(index)

Returns the wallet account at a specific index (see BIP-44).

Parameters
  • index (number, optional): The index of the account to get (default: 0).
Returns

Promise<WalletAccountTonGasless> - The account.

Example
// Returns the account with derivation path m/44'/607'/index'
const account = await wallet.getAccount(1);
Source

src/wallet-manager-ton-gasless.js#L55

getAccountByPath(path)

Returns the wallet account at a specific BIP-44 derivation path.

Parameters
  • path (string): The derivation path (e.g. "0'/0/0").
Returns

Promise<WalletAccountTonGasless> - The account.

Example
// Returns the account with derivation path m/44'/607'/0'/0/1
const account = await wallet.getAccountByPath("0'/0/1");
Source

src/wallet-manager-ton-gasless.js#L68

getFeeRates()

Returns the current fee rates.

Returns

Promise<FeeRates> - The fee rates (in nanotons).

Source

src/wallet-manager-ton-gasless.js#L83

getRandomSeedPhrase(wordCount) (static)

Returns a random BIP-39 seed phrase.

Parameters
  • wordCount (12 | unknown, optional): The number of words in the seed phrase.
Returns

string - The seed phrase.

isValidSeedPhrase(seedPhrase) (static)

Checks if a seed phrase is valid.

Parameters
  • seedPhrase (string): The seed phrase.
Returns

boolean - True if the seed phrase is valid.

Properties

PropertyTypeDescription
seedUint8ArrayThe seed phrase of the wallet.

WalletAccountReadOnlyTonGasless

Extends @tetherto/wdk-wallet

Constructor

new WalletAccountReadOnlyTonGasless(publicKey, config)
Parameters
  • publicKey (string | Uint8Array<ArrayBufferLike>): The account's public key.
  • config (Omit<TonGaslessWalletConfig, "transferMaxFee">): The configuration object.
Source

src/wallet-account-read-only-ton-gasless.js#L66

Methods

MethodDescriptionReturnsThrows
_getGaslessTokenTransferMessage(options)Creates and returns an internal message to execute the given token transfer.Promise<MessageRelaxed>-
_getGaslessTokenTransferRawParams(message, config)Creates and returns the ton api's raw parameters to execute the given message.Promise<SignRawParams>-
getAddress()Returns the account's address.Promise<string>-
getBalance()Returns the account's ton balance.Promise<bigint>-
getPaymasterTokenBalance()Returns the account's balance for the paymaster token provided in the wallet account configuration.Promise<bigint>-
getTokenBalance(tokenAddress)Returns the account balance for a specific token.Promise<bigint>-
getTransactionReceipt(hash)Returns a transaction's receipt.Promise<Transaction>-
quoteSendTransaction(tx)Quotes the costs of a send transaction operation.Promise<Omit<TransactionResult, "hash">>-
quoteTransfer(options, config)Quotes the costs of a transfer operation.Promise<Omit<TransferResult, "hash">>-
verify(message, signature)Verifies a message's signature.Promise<boolean>-

_getGaslessTokenTransferMessage(options)

Creates and returns an internal message to execute the given token transfer.

Parameters
Returns

Promise<MessageRelaxed> - The internal message.

Source

src/wallet-account-read-only-ton-gasless.js#L180

_getGaslessTokenTransferRawParams(message, config)

Creates and returns the ton api's raw parameters to execute the given message.

Parameters
  • message (MessageRelaxed): The message.
  • config (Pick<TonGaslessWalletConfig, "paymasterToken">): The configuration object.
Returns

Promise<SignRawParams> - The ton api's raw parameters.

Source

src/wallet-account-read-only-ton-gasless.js#L218

getAddress()

Returns the account's address.

Returns

Promise<string> - The account's address.

getBalance()

Returns the account's ton balance.

Returns

Promise<bigint> - The ton balance (in nanotons).

Source

src/wallet-account-read-only-ton-gasless.js#L102

getPaymasterTokenBalance()

Returns the account's balance for the paymaster token provided in the wallet account configuration.

Returns

Promise<bigint> - The paymaster token balance (in base unit).

Source

src/wallet-account-read-only-ton-gasless.js#L121

getTokenBalance(tokenAddress)

Returns the account balance for a specific token.

Parameters
  • tokenAddress (string): The smart contract address of the token.
Returns

Promise<bigint> - The token balance (in base unit).

Source

src/wallet-account-read-only-ton-gasless.js#L112

getTransactionReceipt(hash)

Returns a transaction's receipt.

Parameters
  • hash (string): The transaction's hash.
Returns

Promise<Transaction> - - The receipt, or null if the transaction has not been included in a block yet.

Source

src/wallet-account-read-only-ton-gasless.js#L169

quoteSendTransaction(tx)

Quotes the costs of a send transaction operation.

Parameters
Returns

Promise<Omit<TransactionResult, "hash">> - The transaction's quotes.

Source

src/wallet-account-read-only-ton-gasless.js#L133

quoteTransfer(options, config)

Quotes the costs of a transfer operation.

Parameters
  • options (TransferOptions): The transfer's options.
  • config (Pick<TonGaslessWalletConfig, "paymasterToken">, optional): If set, overrides the 'paymasterToken' options defined in the wallet account configuration.
Returns

Promise<Omit<TransferResult, "hash">> - The transfer's quotes.

Source

src/wallet-account-read-only-ton-gasless.js#L144

verify(message, signature)

Verifies a message's signature.

Parameters
  • message (string): The original message.
  • signature (string): The signature to verify.
Returns

Promise<boolean> - True if the signature is valid.

Source

src/wallet-account-read-only-ton-gasless.js#L159

Properties

PropertyTypeDescription
_addressstringThe account's address.

WalletAccountTonGasless

Extends @tetherto/wdk-wallet-ton-gasless

Constructor

new WalletAccountTonGasless(seed, path, config)
Parameters
  • seed (string | Uint8Array<ArrayBufferLike>): The wallet's BIP-39 seed phrase.
  • path (string): The BIP-44 derivation path (e.g. "0'/0/0").
  • config (TonGaslessWalletConfig): The configuration object.
Source

src/wallet-account-ton-gasless.js#L42

Methods

MethodDescriptionReturnsThrows
_getGaslessTokenTransferMessage(options)Creates and returns an internal message to execute the given token transfer.Promise<MessageRelaxed>-
_getGaslessTokenTransferRawParams(message, config)Creates and returns the ton api's raw parameters to execute the given message.Promise<SignRawParams>-
dispose()Disposes the wallet account, erasing the private key from the memory.void-
getAddress()Returns the account's address.Promise<string>-
getBalance()Returns the account's ton balance.Promise<bigint>-
getPaymasterTokenBalance()Returns the account's balance for the paymaster token provided in the wallet account configuration.Promise<bigint>-
getTokenBalance(tokenAddress)Returns the account balance for a specific token.Promise<bigint>-
getTransactionReceipt(hash)Returns a transaction's receipt.Promise<Transaction>-
quoteSendTransaction(tx)Quotes the costs of a send transaction operation.Promise<Omit<TransactionResult, "hash">>-
quoteTransfer(options, config)Quotes the costs of a transfer operation.Promise<Omit<TransferResult, "hash">>-
sendTransaction(tx)Sends a transaction.Promise<TransactionResult>-
sign(message)Signs a message.Promise<string>-
signTransaction(tx)Signs a transaction. Not supported on ton gasless: this module only supports gasless token transfers via the transfer method, which relays a signed internal message through the gasless provider.Promise<never>-
toReadOnlyAccount()Returns a read-only copy of the account.Promise<WalletAccountReadOnlyTonGasless>-
transfer(options, config)Transfers a token to another address.Promise<TransferResult>-
verify(message, signature)Verifies a message's signature.Promise<boolean>-

_getGaslessTokenTransferMessage(options)

Creates and returns an internal message to execute the given token transfer.

Parameters
Returns

Promise<MessageRelaxed> - The internal message.

Source

src/wallet-account-read-only-ton-gasless.js#L180

_getGaslessTokenTransferRawParams(message, config)

Creates and returns the ton api's raw parameters to execute the given message.

Parameters
  • message (MessageRelaxed): The message.
  • config (Pick<TonGaslessWalletConfig, "paymasterToken">): The configuration object.
Returns

Promise<SignRawParams> - The ton api's raw parameters.

Source

src/wallet-account-read-only-ton-gasless.js#L218

dispose()

Disposes the wallet account, erasing the private key from the memory.

Returns

void

Source

src/wallet-account-ton-gasless.js#L161

getAddress()

Returns the account's address.

Returns

Promise<string> - The account's address.

getBalance()

Returns the account's ton balance.

Returns

Promise<bigint> - The ton balance (in nanotons).

Source

src/wallet-account-read-only-ton-gasless.js#L102

getPaymasterTokenBalance()

Returns the account's balance for the paymaster token provided in the wallet account configuration.

Returns

Promise<bigint> - The paymaster token balance (in base unit).

Source

src/wallet-account-read-only-ton-gasless.js#L121

getTokenBalance(tokenAddress)

Returns the account balance for a specific token.

Parameters
  • tokenAddress (string): The smart contract address of the token.
Returns

Promise<bigint> - The token balance (in base unit).

Source

src/wallet-account-read-only-ton-gasless.js#L112

getTransactionReceipt(hash)

Returns a transaction's receipt.

Parameters
  • hash (string): The transaction's hash.
Returns

Promise<Transaction> - - The receipt, or null if the transaction has not been included in a block yet.

Source

src/wallet-account-read-only-ton-gasless.js#L169

quoteSendTransaction(tx)

Quotes the costs of a send transaction operation.

Parameters
Returns

Promise<Omit<TransactionResult, "hash">> - The transaction's quotes.

Source

src/wallet-account-read-only-ton-gasless.js#L133

quoteTransfer(options, config)

Quotes the costs of a transfer operation.

Parameters
Returns

Promise<Omit<TransferResult, "hash">> - The transfer's quotes.

Source

src/wallet-account-read-only-ton-gasless.js#L144

sendTransaction(tx)

Sends a transaction.

Parameters
Returns

Promise<TransactionResult> - The transaction's result.

Source

src/wallet-account-ton-gasless.js#L115

sign(message)

Signs a message.

Parameters
  • message (string): The message to sign.
Returns

Promise<string> - The message's signature.

Source

src/wallet-account-ton-gasless.js#L92

signTransaction(tx)

Signs a transaction.

Not supported on ton gasless: this module only supports gasless token transfers via the transfer method, which relays a signed internal message through the gasless provider.

Parameters
Returns

Promise<never> - Never resolves; always throws.

Source

src/wallet-account-ton-gasless.js#L105

toReadOnlyAccount()

Returns a read-only copy of the account.

Returns

Promise<WalletAccountReadOnlyTonGasless> - The read-only account.

Source

src/wallet-account-ton-gasless.js#L150

transfer(options, config)

Transfers a token to another address.

Parameters
  • options (TransferOptions): The transfer's options.
  • config (Pick<TonGaslessWalletConfig, "paymasterToken" | unknown>, optional): If set, overrides the 'paymasterToken' and 'transferMaxFee' options defined in the wallet account configuration.
Returns

Promise<TransferResult> - The transfer's result.

Source

src/wallet-account-ton-gasless.js#L126

verify(message, signature)

Verifies a message's signature.

Parameters
  • message (string): The original message.
  • signature (string): The signature to verify.
Returns

Promise<boolean> - True if the signature is valid.

Source

src/wallet-account-read-only-ton-gasless.js#L159

Properties

PropertyTypeDescription
_addressstringThe account's address.
indexnumberThe derivation path's index of this account.
keyPairKeyPairThe account's key pair.
pathstringThe derivation path of this account (see BIP-44).

Types

TonApiClientConfig

PropertyTypeDescription
secretKey?stringIf set, uses the api-key to authenticate on the ton api.
urlstringThe url of the ton api.
Source

src/wallet-account-read-only-ton-gasless.js#L43

TonClientConfig

PropertyTypeDescription
secretKey?stringIf set, uses the api-key to authenticate on the ton center api.
urlstringThe url of the ton center api.
Source

src/wallet-account-read-only-ton-gasless.js#L37

TonGaslessWalletConfig

PropertyTypeDescription
paymasterTokenobjectThe paymaster token configuration.
tonApiClient`TonApiClientConfigTonApiClient`
tonClient`TonClientTonClientConfig`
transferMaxFee?`numberbigint`
Source

src/wallet-account-read-only-ton-gasless.js#L49

On this page

Table of Contents
WalletManagerTonGasless
Constructor
Parameters
Source
Methods
dispose()
Returns
getAccount(index)
Parameters
Returns
Example
Source
getAccountByPath(path)
Parameters
Returns
Example
Source
getFeeRates()
Returns
Source
getRandomSeedPhrase(wordCount) (static)
Parameters
Returns
isValidSeedPhrase(seedPhrase) (static)
Parameters
Returns
Properties
WalletAccountReadOnlyTonGasless
Constructor
Parameters
Source
Methods
_getGaslessTokenTransferMessage(options)
Parameters
Returns
Source
_getGaslessTokenTransferRawParams(message, config)
Parameters
Returns
Source
getAddress()
Returns
getBalance()
Returns
Source
getPaymasterTokenBalance()
Returns
Source
getTokenBalance(tokenAddress)
Parameters
Returns
Source
getTransactionReceipt(hash)
Parameters
Returns
Source
quoteSendTransaction(tx)
Parameters
Returns
Source
quoteTransfer(options, config)
Parameters
Returns
Source
verify(message, signature)
Parameters
Returns
Source
Properties
WalletAccountTonGasless
Constructor
Parameters
Source
Methods
_getGaslessTokenTransferMessage(options)
Parameters
Returns
Source
_getGaslessTokenTransferRawParams(message, config)
Parameters
Returns
Source
dispose()
Returns
Source
getAddress()
Returns
getBalance()
Returns
Source
getPaymasterTokenBalance()
Returns
Source
getTokenBalance(tokenAddress)
Parameters
Returns
Source
getTransactionReceipt(hash)
Parameters
Returns
Source
quoteSendTransaction(tx)
Parameters
Returns
Source
quoteTransfer(options, config)
Parameters
Returns
Source
sendTransaction(tx)
Parameters
Returns
Source
sign(message)
Parameters
Returns
Source
signTransaction(tx)
Parameters
Returns
Source
toReadOnlyAccount()
Returns
Source
transfer(options, config)
Parameters
Returns
Source
verify(message, signature)
Parameters
Returns
Source
Properties
Types
TonApiClientConfig
Source
TonClientConfig
Source
TonGaslessWalletConfig
Source