WDK logoWDK documentation

API Reference

API documentation for @tetherto/wdk-wallet-solana-gasless.

This page documents the published @tetherto/wdk-wallet-solana-gasless@1.0.0-beta.6 type declarations and runtime behavior.

Imports

Default import
import WalletManagerSolanaGasless from '@tetherto/wdk-wallet-solana-gasless'
Named imports
import {
  WalletAccountReadOnlySolanaGasless,
  WalletAccountSolanaGasless
} from '@tetherto/wdk-wallet-solana-gasless'

Exports

ExportKindDescription
WalletManagerSolanaGaslessClass, default exportDerives Solana gasless accounts from a seed.
WalletAccountSolanaGaslessClassOwned account with signing, sending, SPL transfer, quote, and read methods.
WalletAccountReadOnlySolanaGaslessClassRead-only account for balances, quotes, receipts, and signature verification.
KeyPairTypeRaw account key pair shape inherited from @tetherto/wdk-wallet.
SolanaGaslessWalletConfigTypeSolana wallet config plus required paymaster options.
SolanaGaslessWalletPaymasterConfigTypePaymaster endpoint, address, and token configuration.
SolanaGaslessWalletPaymasterConfigOverridesTypePer-call overrides for paymaster token and fee caps.
PaymasterTokenConfigTypePaymaster fee token configuration.
SolanaTransactionTypeSimple Solana transaction input or transaction message input inherited from the Solana wallet module.
SolanaTransactionReceiptTypeReturn type for getTransactionReceipt().
SolanaTransactionDetailsTypeSolana-specific fields on normalized transaction receipts.
Finality, TransactionReceiptTypesShared normalized transaction status types.
WaitForTransactionTarget, WaitForTransactionOptionsTypesShared finality wait options.
FullySignedTransactionTypeFully signed Solana transaction returned by signTransaction().
TransactionResultTypeResult shape for send operations.
TransferOptionsTypeSPL transfer input options.
TransferResultTypeResult shape for SPL token transfers.
AssertionError, MaximumFeeExceededError, NoSuchElementError, ProviderRequiredError, TimeoutError, ValueErrorClassesRuntime error classes re-exported from @tetherto/wdk-wallet.

WalletManagerSolanaGasless

Derives and returns owned Solana gasless accounts from a BIP-39 mnemonic or raw 16–64-byte seed for SLIP-0010 derivation. Extends WalletManager from @tetherto/wdk-wallet. The manager shares one Solana RPC client and one Kora paymaster client across derived accounts and their read-only conversions.

Constructor

new WalletManagerSolanaGasless(
  seed: string | Uint8Array,
  config?: SolanaGaslessWalletConfig
)

Parameters:

  • seed: BIP-39 mnemonic seed phrase or raw 16–64-byte seed for SLIP-0010 derivation.
  • config: Solana RPC and Kora-compatible paymaster configuration.

Methods

MethodDescriptionReturns
getAccount(index?)Returns the account at the default Solana derivation path for the given index.Promise<WalletAccountSolanaGasless>
getAccountByPath(path)Returns the account at a specific SLIP-0010 derivation path.Promise<WalletAccountSolanaGasless>

getAccount

getAccount(index?: number): Promise<WalletAccountSolanaGasless>

Returns the account for m/44'/501'/index'/0'. If index is omitted, the module uses 0.

Get the first account
const wallet = new WalletManagerSolanaGasless(seedPhrase, config)
const account = await wallet.getAccount(0)

getAccountByPath

getAccountByPath(path: string): Promise<WalletAccountSolanaGasless>

Returns the account at a specific Solana SLIP-0010 derivation path.

Get an account by path
const account = await wallet.getAccountByPath("0'/0'/1'")

WalletAccountSolanaGasless

Owned Solana gasless account. Extends WalletAccountReadOnlySolanaGasless and implements IWalletAccount from @tetherto/wdk-wallet.

Constructor

new WalletAccountSolanaGasless(
  seed: string | Uint8Array,
  path: string,
  config: SolanaGaslessWalletConfig
)

Parameters:

  • seed: BIP-39 mnemonic seed phrase or raw 16–64-byte seed for SLIP-0010 derivation.
  • path: SLIP-0010 derivation path, for example "0'/0'/0'".
  • config: Solana RPC and Kora-compatible paymaster configuration.

Properties

PropertyDescriptionType
indexDerivation path index for this account.number
pathDerivation path for this account.string
keyPairRaw Solana Ed25519 key pair bytes.KeyPair

Methods

MethodDescriptionReturns
getAddress()Returns the account address.Promise<string>
sign(message)Signs a message with the account private key.Promise<string>
verify(message, signature)Verifies a message signature against the account address.Promise<boolean>
getBalance()Returns the native SOL balance in lamports.Promise<bigint>
getTokenBalance(tokenAddress)Returns one SPL token balance in base units.Promise<bigint>
getTokenBalances(tokenAddresses)Returns multiple SPL token balances in base units.Promise<Record<string, bigint>>
getPaymasterTokenBalance()Returns the configured paymaster token balance in base units.Promise<bigint>
quoteSendTransaction(tx, config?)Quotes an unsigned send, or searches a fully signed transaction for a matching embedded payment fee.Promise<Omit<TransactionResult, 'hash'>>
signTransaction(tx, config?)Returns a fully signed paymaster-funded transaction without broadcasting it.Promise<FullySignedTransaction>
sendTransaction(tx, config?)Sends an unsigned paymaster-funded transaction, or directly broadcasts a fully signed transaction through Solana RPC.Promise<TransactionResult>
quoteTransfer(options, config?)Quotes the paymaster fee for an SPL transfer.Promise<Omit<TransferResult, 'hash'>>
transfer(options, config?)Transfers SPL tokens through the configured paymaster.Promise<TransferResult>
getTransactionReceipt(hash)Reads a native Solana transaction; deprecated in favor of getTransaction().Promise<SolanaTransactionReceipt | null>
getTransaction(hash)Returns normalized finality for a Solana signature.Promise<TransactionReceipt & SolanaTransactionDetails>
waitForTransaction(hash, options?)Waits for confirmed or final finality.Promise<TransactionReceipt & SolanaTransactionDetails>
toReadOnlyAccount()Returns a read-only copy of the account.Promise<WalletAccountReadOnlySolanaGasless>
dispose()Clears private key material held by the account.void

getAddress

getAddress(): Promise<string>

Returns the account's base58-encoded Solana address.

sign

sign(message: string): Promise<string>

Signs a message and returns its signature.

signTransaction

signTransaction(
  tx: SolanaTransaction,
  config?: SolanaGaslessWalletPaymasterConfigOverrides
): Promise<FullySignedTransaction>

Signs a paymaster-funded transaction without broadcasting it. The module adds the paymaster payment instruction, checks the quoted payment against transactionMaxFee, signs with the account owner, asks the paymaster to sign, and returns the fully signed transaction.

The method throws when the quoted paymaster fee is greater than transactionMaxFee.

sendTransaction

sendTransaction(
  tx: SolanaTransaction | FullySignedTransaction,
  config?: SolanaGaslessWalletPaymasterConfigOverrides
): Promise<TransactionResult>

For an unsigned input, sends a paymaster-funded native transfer or prebuilt transaction message. For the exact FullySignedTransaction returned by signTransaction(), the module does not contact the paymaster: it searches for the embedded payment fee, applies transactionMaxFee, base64-encodes the signed wire transaction, and sends it through the configured Solana RPC with encoding: 'base64'.

Send native SOL
const result = await account.sendTransaction({
  to: 'Recipient1111111111111111111111111111111',
  value: 1000000n
}, {
  transactionMaxFee: 500000n
})

console.log(result.hash)
console.log(result.fee)

The method throws when the payment fee is greater than transactionMaxFee; a fee equal to the cap is allowed. An unsigned-flow payment above Number.MAX_SAFE_INTEGER can be rounded internally before this comparison. A signed transaction retains its existing blockhash or durable nonce lifetime, payment instruction, and signatures. The method does not refresh or re-sign it.

A signed input with no payment instruction matching the effective paymasterToken raises NoSuchElementError before broadcast. Pass the same fee token used at signing; the override selects the payment to decode and does not change the signed message. Restrict this path to this account's exact signed output, or independently validate every instruction, payment, fee payer, lifetime, and signature first.

transfer

transfer(
  options: TransferOptions,
  config?: SolanaGaslessWalletPaymasterConfigOverrides
): Promise<TransferResult>

Transfers SPL tokens through the paymaster. Native SOL transfers are handled by sendTransaction() instead. The second argument contains paymaster overrides, not standard Solana memo options. Transfer memos and Token-2022 mints remain unsupported.

Transfer an SPL token
const result = await account.transfer({
  token: 'TokenMint111111111111111111111111111111111',
  recipient: 'Recipient1111111111111111111111111111111',
  amount: 1000000n
}, {
  transferMaxFee: 500000n
})

The method throws when the quoted paymaster fee is greater than transferMaxFee.

quoteSendTransaction

quoteSendTransaction(
  tx: SolanaTransaction | FullySignedTransaction,
  config?: SolanaGaslessWalletPaymasterConfigOverrides
): Promise<Omit<TransactionResult, 'hash'>>

For an unsigned input, requests a paymaster fee quote for sendTransaction() or signTransaction() inputs. Beta.5 validates the returned SPL payment instruction but converts its u64 amount through Number; values above Number.MAX_SAFE_INTEGER can round before being returned as bigint. For a FullySignedTransaction, it does not call the paymaster or broadcast: it searches for a signed SPL token payment to the configured paymaster token account and decodes a matching u64 exactly. The effective paymasterToken, including a per-call override, selects the payment to decode. If there is no match, the method throws NoSuchElementError. Neither form enforces transactionMaxFee during the quote.

quoteTransfer

quoteTransfer(
  options: TransferOptions,
  config?: SolanaGaslessWalletPaymasterConfigOverrides
): Promise<Omit<TransferResult, 'hash'>>

Quotes the paymaster fee for transfer() inputs. Quote methods return estimates and do not enforce transferMaxFee.

getTransactionReceipt

getTransactionReceipt(hash: string): Promise<SolanaTransactionReceipt | null>

Returns the native Solana transaction for a submitted signature, or null if it has not been included yet. This method is deprecated; use getTransaction() and read its transaction field for native data.

getTransaction

getTransaction(hash: string): Promise<TransactionReceipt & SolanaTransactionDetails>

Returns normalized status for a valid base58 Solana signature. processed maps to pending, confirmed maps to confirmed, and finalized maps to final. Settled receipts expose success, the slot in block, the fee when available, confirmation count, and the native transaction when returned by the configured RPC commitment.

An invalid signature throws ValueError; a well-formed signature absent from transaction history throws NoSuchElementError.

waitForTransaction

waitForTransaction(
  hash: string,
  options?: WaitForTransactionOptions
): Promise<TransactionReceipt & SolanaTransactionDetails>

Waits for the default confirmed target or for final when requested. The default polling interval is four seconds and timeout is 60 seconds. The Solana implementation does not currently emit dropped; a never-landed or evicted signature times out. Reaching the target does not prove successful execution, so inspect success.

toReadOnlyAccount

toReadOnlyAccount(): Promise<WalletAccountReadOnlySolanaGasless>

Returns a read-only account for the same address.

WalletAccountReadOnlySolanaGasless

Read-only Solana gasless account for an address. Extends WalletAccountReadOnly from @tetherto/wdk-wallet.

Constructor

new WalletAccountReadOnlySolanaGasless(
  addr: string,
  config: Omit<SolanaGaslessWalletConfig, 'transferMaxFee' | 'transactionMaxFee'>
)

Parameters:

  • addr: Solana account address.
  • config: Solana RPC and paymaster configuration. Read-only accounts do not accept transferMaxFee or transactionMaxFee.

Methods

MethodDescriptionReturns
getBalance()Returns the native SOL balance in lamports.Promise<bigint>
getTokenBalance(tokenAddress)Returns one SPL token balance in base units.Promise<bigint>
getTokenBalances(tokenAddresses)Returns multiple SPL token balances in base units.Promise<Record<string, bigint>>
getPaymasterTokenBalance()Returns the configured paymaster token balance in base units.Promise<bigint>
quoteSendTransaction(tx, config?)Quotes the paymaster fee for a native send or transaction message.Promise<Omit<TransactionResult, 'hash'>>
quoteTransfer(options, config?)Quotes the paymaster fee for an SPL transfer.Promise<Omit<TransferResult, 'hash'>>
getTransactionReceipt(hash)Reads a native Solana transaction; deprecated in favor of getTransaction().Promise<SolanaTransactionReceipt | null>
getTransaction(hash)Returns normalized finality for a Solana signature.Promise<TransactionReceipt & SolanaTransactionDetails>
waitForTransaction(hash, options?)Waits for confirmed or final finality.Promise<TransactionReceipt & SolanaTransactionDetails>
verify(message, signature)Verifies a message signature against the account address.Promise<boolean>

Read-only and owned accounts have the same normalized transaction semantics. The package delegates these calls to the wrapped standard Solana read-only account.

Configuration Types

Normalized Transaction Types

type Finality = 'pending' | 'confirmed' | 'final' | 'dropped'
type WaitForTransactionTarget = 'confirmed' | 'final'

interface WaitForTransactionOptions {
  target?: WaitForTransactionTarget
  timeout?: number
  interval?: number
  maxPollErrors?: number
}

interface SolanaTransactionDetails {
  confirmations: number | null
  transaction: SolanaTransactionReceipt | null
}

TransactionReceipt adds hash, finality, and optional success, block, and fee fields. These types are re-exported from the package root.

SolanaGaslessWalletConfig

type SolanaGaslessWalletConfig =
  SolanaWalletConfig & SolanaGaslessWalletPaymasterConfig

Combines the base Solana wallet configuration with the required paymaster configuration.

OptionTypeRequiredDescription
providerstring | SolanaRpc | Array<string | SolanaRpc>NoSolana RPC endpoint, existing client, or mixed ordered failover list. RPC-backed reads, quotes, signing, sending, and transfers require a usable provider or rpcUrl.
rpcUrlstring | string[]NoDeprecated alias inherited from the base Solana wallet module. Use provider.
commitment'processed' | 'confirmed' | 'finalized'NoSolana commitment level for reads and receipts.
retriesnumberNoAdditional retry attempts for ordered Solana RPC or paymaster failover lists. Default: 3.
paymasterUrlstring | KoraClientOptions | KoraClient | Array<string | KoraClientOptions | KoraClient>YesKora-compatible paymaster endpoint, client options, existing client, or mixed ordered failover list. Existing clients are reused as-is.
paymasterAddressstringYesSolana address used as the transaction fee payer.
paymasterTokenPaymasterTokenConfigYesToken used by the paymaster to quote and charge fees.
transferMaxFeenumber | bigintNoFee cap for transfer() calls, in the paymaster token's base units.
transactionMaxFeenumber | bigintNoFee cap for sendTransaction() and signTransaction() calls, in the paymaster token's base units.

SolanaGaslessWalletPaymasterConfig

type SolanaGaslessWalletPaymasterConfig = {
  paymasterUrl: string | KoraClientOptions | KoraClient | (string | KoraClientOptions | KoraClient)[]
  paymasterAddress: string
  paymasterToken: PaymasterTokenConfig
}

PaymasterTokenConfig

type PaymasterTokenConfig = {
  address: string
}

SolanaGaslessWalletPaymasterConfigOverrides

type SolanaGaslessWalletPaymasterConfigOverrides = Partial<
  Pick<SolanaGaslessWalletPaymasterConfig, 'paymasterToken'> &
  Pick<SolanaWalletConfig, 'transferMaxFee' | 'transactionMaxFee'>
>

Pass overrides as the second argument to quote, sign, send, or transfer methods. Fields set to undefined retain their configured values; this is a shallow merge. For a signed transaction, retain the paymasterToken used at signing.

OverrideApplies toDescription
paymasterTokenQuotes, signing, sends, transfersSelects the fee token; for signed input it must match the embedded payment.
transactionMaxFeesendTransaction(), signTransaction()Cancels the operation when the quoted transaction fee is above the cap.
transferMaxFeetransfer()Cancels the operation when the quoted transfer fee is above the cap.

Errors

Import runtime error classes from the package root:

import {
  AssertionError,
  MaximumFeeExceededError,
  NoSuchElementError,
  ProviderRequiredError,
  TimeoutError,
  ValueError
} from '@tetherto/wdk-wallet-solana-gasless'
  • ValueError: missing required paymaster fields, an empty paymaster endpoint list, a mismatched fee payer, or an invalid returned payment instruction. ConfigurationError was removed in beta.5.
  • MaximumFeeExceededError: a sign, send, or transfer fee exceeds its applicable cap.
  • NoSuchElementError: a signed quote/send cannot find a payment for the effective fee token, or transaction status lookup finds no matching transaction.
  • ProviderRequiredError: an operation requiring Solana RPC has no configured provider.
  • TimeoutError: the requested transaction finality is not reached in time.
  • AssertionError: an inherited account precondition fails, such as using a disposed signing account.

Provider and Solana libraries may throw other errors; rethrow unfamiliar failures rather than treating every exception as a WDK error.

Next Steps


Need Help?

On this page