API Reference
Complete API documentation for @tetherto/wdk-wallet-solana
Table of Contents
Main class for managing Solana wallets. Extends WalletManager from @tetherto/wdk-wallet.
Individual Solana wallet account implementation. Extends WalletAccountReadOnlySolana and implements IWalletAccount.
WalletManagerSolana
The main class for managing Solana wallets.
Extends WalletManager from @tetherto/wdk-wallet.
Constructor
new WalletManagerSolana(seed, config)Parameters:
seed(string | Uint8Array): BIP-39 mnemonic seed phrase or seed bytesconfig(object): Configuration objectprovider(string | Connection): RPC endpoint URL or Solana Connection instancecommitment(string, optional): Commitment level ('processed', 'confirmed', or 'finalized')transferMaxFee(number, optional): Maximum fee amount for transfer operations (in lamports)
Example:
const wallet = new WalletManagerSolana(seedPhrase, {
provider: 'https://api.mainnet-beta.solana.com',
commitment: 'confirmed',
transferMaxFee: 5000 // Maximum fee in lamports
})Methods
getAccount(index)
Returns a wallet account at the specified index
Promise<WalletAccountSolana>
getAccountByPath(path)
Returns a wallet account at the specified BIP-44 derivation path
Promise<WalletAccountSolana>
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 wallet account at the specified index.
Parameters:
index(number, optional): The index of the account to get (default: 0)
Returns: Promise<WalletAccountSolana> - The wallet account
Example:
getAccountByPath(path)
Returns a wallet account at the specified BIP-44 derivation path.
Parameters:
path(string): The derivation path (e.g., "0'/0/0")
Returns: Promise<WalletAccountSolana> - The wallet account
Example:
getFeeRates()
Returns current fee rates for transactions based on recent prioritization fees.
Returns: Promise<{normal: number, fast: number}> - Object containing fee rates in lamports
Throws: Error if wallet is not connected to a provider
Example:
dispose()
Disposes all wallet accounts, clearing private keys from memory.
Example:
WalletAccountSolana
Represents an individual Solana wallet account. Extends WalletAccountReadOnlySolana 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(SolanaWalletConfig, optional): Configuration object
Methods
getAddress()
Returns the account's Solana 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>
sendTransaction(tx)
Sends a Solana transaction
Promise<{hash: string, fee: number}>
quoteSendTransaction(tx)
Estimates the fee for a transaction
Promise<{fee: number}>
transfer(options)
Transfers SPL tokens to another address
Promise<{hash: string, fee: number}>
quoteTransfer(options)
Estimates the fee for an SPL token transfer
Promise<{fee: number}>
getBalance()
Returns the native SOL balance (in lamports)
Promise<number>
getTokenBalance(tokenMint)
Returns the balance of a specific SPL token
Promise<number>
toReadOnlyAccount()
Returns a read-only copy of the account
Promise<WalletAccountReadOnlySolana>
dispose()
Disposes the wallet account, clearing private keys from memory
void
getAddress()
Returns the account's Solana address.
Returns: Promise<string> - The account's base58-encoded Solana 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 (hex-encoded)
Example:
verify(message, signature)
Verifies a message signature.
Parameters:
message(string): The original messagesignature(string): The signature to verify (hex-encoded)
Returns: Promise<boolean> - True if the signature is valid
Example:
sendTransaction(tx)
Sends a Solana transaction.
Parameters:
tx(SolanaTransaction): The transaction objectto(string): Recipient's Solana address (base58-encoded)value(number): Amount in lamports
Returns: Promise<{hash: string, fee: number}> - Object containing transaction hash and fee (in lamports)
Throws: Error if wallet is not connected to a provider
Example:
quoteSendTransaction(tx)
Estimates the fee for a Solana transaction.
Parameters:
tx(SolanaTransaction): The transaction object (same as sendTransaction)
Returns: Promise<{fee: number}> - Object containing fee estimate (in lamports)
Example:
transfer(options)
Transfers SPL tokens to another address.
Parameters:
options(TransferOptions): Transfer optionstoken(string): Token mint address (base58-encoded)recipient(string): Recipient's Solana address (base58-encoded)amount(number): Amount in token's base units
Returns: Promise<{hash: string, fee: number}> - Object containing transaction hash and fee (in lamports)
Throws: Error if wallet is not connected to a provider or if fee exceeds maximum
Example:
quoteTransfer(options)
Estimates the fee for an SPL token transfer.
Parameters:
options(TransferOptions): Transfer options (same as transfer)
Returns: Promise<{fee: number}> - Object containing fee estimate (in lamports)
Example:
getBalance()
Returns the native SOL balance (in lamports).
Returns: Promise<number> - Balance in lamports
Example:
getTokenBalance(tokenMint)
Returns the balance of a specific SPL token.
Parameters:
tokenMint(string): Token mint address (base58-encoded)
Returns: Promise<number> - Token balance in base units
Example:
toReadOnlyAccount()
Returns a read-only copy of the account.
Returns: Promise<WalletAccountReadOnlySolana> - The read-only account
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 Ed25519 key pair
⚠️ Security Note: The keyPair property contains sensitive cryptographic material. Never log, display, or expose the private key.
WalletAccountReadOnlySolana
Represents a read-only Solana wallet account.
Constructor
Parameters:
publicKey(string): The account's public key (base58-encoded)config(SolanaWalletConfig, optional): Configuration object
Methods
getAddress()
Returns the account's Solana address
Promise<string>
getBalance()
Returns the native SOL balance (in lamports)
Promise<number>
getTokenBalance(tokenMint)
Returns the balance of a specific SPL token
Promise<number>
quoteSendTransaction(tx)
Estimates the fee for a transaction
Promise<{fee: number}>
quoteTransfer(options)
Estimates the fee for an SPL token transfer
Promise<{fee: number}>
getAddress()
Returns the account's Solana address.
Returns: Promise<string> - The account's base58-encoded Solana address
Example:
getBalance()
Returns the native SOL balance (in lamports).
Returns: Promise<number> - Balance in lamports
Example:
getTokenBalance(tokenMint)
Returns the balance of a specific SPL token.
Parameters:
tokenMint(string): Token mint address (base58-encoded)
Returns: Promise<number> - Token balance in base units
Example:
quoteSendTransaction(tx)
Estimates the fee for a transaction.
Parameters:
tx(SolanaTransaction): The transaction objectto(string): Recipient's Solana address (base58-encoded)value(number): Amount in lamports
Returns: Promise<{fee: number}> - Object containing fee estimate (in lamports)
Example:
quoteTransfer(options)
Estimates the fee for an SPL token transfer.
Parameters:
options(TransferOptions): Transfer optionstoken(string): Token mint address (base58-encoded)recipient(string): Recipient's Solana address (base58-encoded)amount(number): Amount in token's base units
Returns: Promise<{fee: number}> - Object containing fee estimate (in lamports)
Example:

