WDK logoWDK documentation

API Reference

Complete API documentation for @tetherto/wdk-wallet-tron-gasfree

API Reference

Table of Contents

ClassDescriptionMethods
WalletManagerTronGasfreeExtends @tetherto/wdk-wallet.Constructor, Methods, Properties
WalletAccountReadOnlyTronGasfreeExtends @tetherto/wdk-wallet.Constructor, Methods, Properties
WalletAccountTronGasfreeExtends @tetherto/wdk-wallet-tron-gasfree.Constructor, Methods, Properties

WalletManagerTronGasfree

Extends @tetherto/wdk-wallet

Constructor

new WalletManagerTronGasfree(seed, config)
Parameters
Source

src/wallet-manager-tron-gasfree.js#L36

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<WalletAccountTronGasfree>-
getAccountByPath(path)Returns the wallet account at a specific BIP-44 derivation path.Promise<WalletAccountTronGasfree>-
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<WalletAccountTronGasfree> - The account.

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

src/wallet-manager-tron-gasfree.js#L71

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<WalletAccountTronGasfree> - The account.

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

src/wallet-manager-tron-gasfree.js#L84

getFeeRates()

Returns the current fee rates.

Returns

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

Source

src/wallet-manager-tron-gasfree.js#L99

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.

WalletAccountReadOnlyTronGasfree

Extends @tetherto/wdk-wallet

Constructor

new WalletAccountReadOnlyTronGasfree(address, config)
Parameters
  • address (string): The tron account's address.
  • config (Omit<TronGasfreeWalletConfig, "transferMaxFee">): The configuration object.
Source

src/wallet-account-read-only-tron-gasfree.js#L74

Methods

MethodDescriptionReturnsThrows
_getGasfreeAccount()Returns the gasfree provider's account.Promise<TronGasfreeAccountInfo>-
_sendRequestToGasfreeProvider(method, path, body)Sends a http request to the gasfree provider.Promise<Response>-
getAddress()Returns the account's address.Promise<string>-
getBalance()Returns the account's tronix balance.Promise<bigint>-
getTokenBalance(tokenAddress)Returns the account balance for a specific token.Promise<bigint>-
getTransactionReceipt(hash)Returns a transaction's receipt.Promise<any>-
quoteSendTransaction(tx)Quotes the costs of a send transaction operation.Promise<Omit<TransactionResult, "hash">>-
quoteTransfer(options)Quotes the costs of a transfer operation.Promise<Omit<TransferResult, "hash">>-
verify(message, signature)Verifies a message's signature.Promise<boolean>-

_getGasfreeAccount()

Returns the gasfree provider's account.

Returns

Promise<TronGasfreeAccountInfo> - The gasfree provider's account.

Source

src/wallet-account-read-only-tron-gasfree.js#L198

_sendRequestToGasfreeProvider(method, path, body)

Sends a http request to the gasfree provider.

Parameters
  • method (string): The http request's method; available values: 'GET', 'POST', 'PUT', 'PATCH', 'DELETE'.
  • path (string): The http request's url's path.
  • body (any, optional): The http request's body.
Returns

Promise<Response> - The http response.

Source

src/wallet-account-read-only-tron-gasfree.js#L223

getAddress()

Returns the account's address.

Returns

Promise<string> - The account's address.

Source

src/wallet-account-read-only-tron-gasfree.js#L101

getBalance()

Returns the account's tronix balance.

Returns

Promise<bigint> - The tronix balance (in suns).

Source

src/wallet-account-read-only-tron-gasfree.js#L112

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-tron-gasfree.js#L124

getTransactionReceipt(hash)

Returns a transaction's receipt.

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

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

Source

src/wallet-account-read-only-tron-gasfree.js#L182

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-tron-gasfree.js#L136

quoteTransfer(options)

Quotes the costs of a transfer operation.

Parameters
Returns

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

Source

src/wallet-account-read-only-tron-gasfree.js#L146

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-tron-gasfree.js#L170

Properties

PropertyTypeDescription
_addressstringThe account's address.

WalletAccountTronGasfree

Extends @tetherto/wdk-wallet-tron-gasfree

Constructor

new WalletAccountTronGasfree(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 (TronGasfreeWalletConfig): The configuration object.
Source

src/wallet-account-tron-gasfree.js#L65

Methods

MethodDescriptionReturnsThrows
_getGasfreeAccount()Returns the gasfree provider's account.Promise<TronGasfreeAccountInfo>-
_sendRequestToGasfreeProvider(method, path, body)Sends a http request to the gasfree provider.Promise<Response>-
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 tronix balance.Promise<bigint>-
getTokenBalance(tokenAddress)Returns the account balance for a specific token.Promise<bigint>-
getTransactionReceipt(hash)Returns a transaction's receipt.Promise<any>-
quoteSendTransaction(tx)Quotes the costs of a send transaction operation.Promise<Omit<TransactionResult, "hash">>-
quoteTransfer(options)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.Promise<never>-
toReadOnlyAccount()Returns a read-only copy of the account.Promise<WalletAccountReadOnlyTronGasfree>-
transfer(options, config)Transfers a token to another address, paying gas fees with the transferred token.Promise<TransferResult>-
verify(message, signature)Verifies a message's signature.Promise<boolean>-

_getGasfreeAccount()

Returns the gasfree provider's account.

Returns

Promise<TronGasfreeAccountInfo> - The gasfree provider's account.

Source

src/wallet-account-read-only-tron-gasfree.js#L198

_sendRequestToGasfreeProvider(method, path, body)

Sends a http request to the gasfree provider.

Parameters
  • method (string): The http request's method; available values: 'GET', 'POST', 'PUT', 'PATCH', 'DELETE'.
  • path (string): The http request's url's path.
  • body (any, optional): The http request's body.
Returns

Promise<Response> - The http response.

Source

src/wallet-account-read-only-tron-gasfree.js#L223

dispose()

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

Returns

void

Source

src/wallet-account-tron-gasfree.js#L214

getAddress()

Returns the account's address.

Returns

Promise<string> - The account's address.

Source

src/wallet-account-read-only-tron-gasfree.js#L101

getBalance()

Returns the account's tronix balance.

Returns

Promise<bigint> - The tronix balance (in suns).

Source

src/wallet-account-read-only-tron-gasfree.js#L112

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-tron-gasfree.js#L124

getTransactionReceipt(hash)

Returns a transaction's receipt.

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

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

Source

src/wallet-account-read-only-tron-gasfree.js#L182

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-tron-gasfree.js#L136

quoteTransfer(options)

Quotes the costs of a transfer operation.

Parameters
Returns

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

Source

src/wallet-account-read-only-tron-gasfree.js#L146

sendTransaction(tx)

Sends a transaction.

Parameters
Returns

Promise<TransactionResult> - The transaction's result.

Source

src/wallet-account-tron-gasfree.js#L135

sign(message)

Signs a message.

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

Promise<string> - The message's signature.

Source

src/wallet-account-tron-gasfree.js#L115

signTransaction(tx)

Signs a transaction.

Parameters
Returns

Promise<never> - Never resolves; always throws.

Source

src/wallet-account-tron-gasfree.js#L125

toReadOnlyAccount()

Returns a read-only copy of the account.

Returns

Promise<WalletAccountReadOnlyTronGasfree> - The read-only account.

Source

src/wallet-account-tron-gasfree.js#L202

transfer(options, config)

Transfers a token to another address, paying gas fees with the transferred token.

Parameters
  • options (TransferOptions): The transfer's options.
  • config (object, optional): A configuration object containing additional options.
Returns

Promise<TransferResult> - The transfer's result.

Source

src/wallet-account-tron-gasfree.js#L147

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-tron-gasfree.js#L170

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

TronGasfreeAccountInfo

PropertyTypeDescription
accountAddressstringThe owner's account address.
activebooleanWhether the gasfree account is active.
allowSubmitbooleanWhether the account is allowed to submit transactions.
assetsTronGasfreeAssetInfo[]The list of supported assets and their info.
gasFreeAddressstringThe gasfree contract address for the account.
noncenumberThe account's nonce.
Source

src/wallet-account-read-only-tron-gasfree.js#L55

TronGasfreeAssetInfo

PropertyTypeDescription
activateFeenumberThe fee to activate the account for this token.
decimalnumberThe token's decimals.
frozennumberWhether the token is frozen.
tokenAddressstringThe token's smart contract address.
tokenSymbolstringThe token's symbol.
transferFeenumberThe fee for transferring this token.
Source

src/wallet-account-read-only-tron-gasfree.js#L45

TronGasfreeWalletConfig

PropertyTypeDescription
chainIdnumberThe blockchain's id.
gasFreeApiKey?stringThe gasfree provider's api key.
gasFreeApiSecret?stringThe gasfree provider's api secret.
gasFreeProviderstringThe gasfree provider's url.
provider`stringTronWeb`
serviceProviderstringThe address of the service provider.
transferMaxFee?`numberbigint`
verifyingContractstringThe address of the verifying contract.
Source

src/wallet-account-read-only-tron-gasfree.js#L33

On this page

Table of Contents
WalletManagerTronGasfree
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
WalletAccountReadOnlyTronGasfree
Constructor
Parameters
Source
Methods
_getGasfreeAccount()
Returns
Source
_sendRequestToGasfreeProvider(method, path, body)
Parameters
Returns
Source
getAddress()
Returns
Source
getBalance()
Returns
Source
getTokenBalance(tokenAddress)
Parameters
Returns
Source
getTransactionReceipt(hash)
Parameters
Returns
Source
quoteSendTransaction(tx)
Parameters
Returns
Source
quoteTransfer(options)
Parameters
Returns
Source
verify(message, signature)
Parameters
Returns
Source
Properties
WalletAccountTronGasfree
Constructor
Parameters
Source
Methods
_getGasfreeAccount()
Returns
Source
_sendRequestToGasfreeProvider(method, path, body)
Parameters
Returns
Source
dispose()
Returns
Source
getAddress()
Returns
Source
getBalance()
Returns
Source
getTokenBalance(tokenAddress)
Parameters
Returns
Source
getTransactionReceipt(hash)
Parameters
Returns
Source
quoteSendTransaction(tx)
Parameters
Returns
Source
quoteTransfer(options)
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
TronGasfreeAccountInfo
Source
TronGasfreeAssetInfo
Source
TronGasfreeWalletConfig
Source