WDK logoWDK documentation

Wallet Aptos Configuration

Configuration options for @tetherto/wdk-wallet-aptos.

Configure the Aptos wallet module with an Aptos fullnode REST endpoint. A provider is required for balance reads, fee quotes, transaction submission, normalized transaction lookup and waiting, and legacy receipt polling.

import WalletManagerAptos from '@tetherto/wdk-wallet-aptos'

const wallet = new WalletManagerAptos(seedPhrase, {
  provider: [
    'https://fullnode.mainnet.aptoslabs.com/v1',
    process.env.APTOS_FAILOVER_FULLNODE_URL
  ].filter(Boolean),
  retries: 3,
  txnExpirationSecs: 60,
  transferMaxFee: 100000n
})

Wallet Configuration

OptionTypeDescription
providerstring | string[]Aptos fullnode REST API URL, or an ordered list for failover. Required for chain operations.
chainIdnumberOptional chain ID. If omitted, the module fetches it from ledger info on first use.
retriesnumberFailover attempts when provider is an array. Defaults to 3.
txnExpirationSecsnumberTransaction expiration window measured from the current time. Defaults to 60.
transferMaxFeenumber | bigintOptional maximum estimated fee in octas for fungible asset transfer() calls.

An empty provider array behaves like no provider. Balance reads, quotes, transaction lookup and waiting, transaction signing, and transaction submission then fail because no fullnode is available.

Account Configuration

You can construct accounts directly when you need a specific derivation path.

import { WalletAccountAptos } from '@tetherto/wdk-wallet-aptos'

const account = new WalletAccountAptos(seedPhrase, "0'/0'/0'", {
  provider: 'https://fullnode.mainnet.aptoslabs.com/v1',
  transferMaxFee: 100000n
})

An address and provider are enough for balance reads and transaction tracking:

import { WalletAccountReadOnlyAptos } from '@tetherto/wdk-wallet-aptos'

const readOnlyAccount = new WalletAccountReadOnlyAptos('0x...', {
  provider: 'https://fullnode.mainnet.aptoslabs.com/v1'
})

Validate externally supplied addresses before construction. The read-only constructor stores the address verbatim and does not reject or normalize an invalid value.

Fee quotes simulate a transaction and message verification uses Ed25519, so those operations also require the matching 32-byte public key:

const readOnlyWithPublicKey = new WalletAccountReadOnlyAptos(
  '0x...',
  { provider: 'https://fullnode.mainnet.aptoslabs.com/v1' },
  publicKey
)

The constructor rejects a public key that does not derive the supplied address. Prefer account.toReadOnlyAccount() when you already have a writable account; it carries the matching public key forward.

Network Selection

Network selection is controlled by the fullnode URL and the transaction chain ID. If you provide chainId, it must match the configured fullnode. The module does not compare a supplied chain ID with ledger info before signing.

NetworkProvider URL
Mainnethttps://fullnode.mainnet.aptoslabs.com/v1
Testnethttps://fullnode.testnet.aptoslabs.com/v1

Derivation Paths

The module uses SLIP-0010 Ed25519 derivation. getAccount(index) derives:

m/44'/637'/index'/0'/0'

Use getAccountByPath(path) to provide a relative path after m/44'/637'/.

const account = await wallet.getAccountByPath("5'/0'/0'")

Every Aptos path segment must be hardened. A path segment without an apostrophe is invalid for this module's Ed25519 derivation.

The relative path must contain exactly three hardened indexes without leading zeros, such as "5'/0'/0'".

Fee Limit

transferMaxFee caps the simulated fee for fungible asset transfer() calls. The transfer is rejected when the estimated fee is equal to or greater than the cap.

const wallet = new WalletManagerAptos(seedPhrase, {
  provider: 'https://fullnode.mainnet.aptoslabs.com/v1',
  transferMaxFee: 100000n
})

The cap does not apply to native APT sendTransaction() or signTransaction(). quoteSendTransaction() is useful for user review, but send and sign simulate again and expose no native maximum-fee argument. Beta.2 therefore cannot enforce a hard application cap for native APT operations.

Security Notes

  • Keep seed phrases and seed bytes outside logs and client-visible error reporting.
  • Use trusted fullnode endpoints for production wallets.
  • Keep a supplied chainId consistent with every configured fullnode.
  • Set a fee cap for user-facing fungible asset transfers and treat native APT quotes as advisory preflight values.
  • Call dispose() on accounts and managers when they are no longer needed, but do not treat manager disposal as seed zeroization. Beta.2 clears cached accounts and signers while retaining the manager's original seed buffer; release every manager and seed reference, and use a stronger isolation boundary when memory reclamation is required.

On this page