Skip to main content
Faremeter API
Faremeter API / payment-solana/src / splToken

splToken

Interfaces

GetTokenBalanceArgs

Defined in: packages/payment-solana/src/splToken.ts:13 Arguments for retrieving an SPL token balance.

Properties

account
account: string
Defined in: packages/payment-solana/src/splToken.ts:17 The wallet address to check the balance for
asset
asset: string
Defined in: packages/payment-solana/src/splToken.ts:15 The SPL token mint address
rpcClient
rpcClient: Rpc<GetTokenAccountBalanceApi>
Defined in: packages/payment-solana/src/splToken.ts:19 Solana RPC client with token balance API support

Functions

getTokenBalance()

getTokenBalance(args): Promise<null | { amount: bigint; decimals: number; }>
Defined in: packages/payment-solana/src/splToken.ts:63 Retrieves the SPL token balance for an account. Looks up the associated token account (ATA) for the given wallet and mint, then fetches the token balance. Returns null if the account does not exist.

Parameters

args
GetTokenBalanceArgs The asset, account, and RPC client

Returns

Promise<null | { amount: bigint; decimals: number; }> The balance amount and decimals, or null if the account does not exist

isAccountNotFoundError()

isAccountNotFoundError(e): boolean
Defined in: packages/payment-solana/src/splToken.ts:33 Checks if an error indicates a token account was not found. This handles various error formats from Solana RPC responses, including TokenAccountNotFoundError and AccountNotFoundError names, as well as message-based detection.

Parameters

e
unknown The error to check

Returns

boolean True if the error indicates the account does not exist