Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.faremeter.xyz/llms.txt

Use this file to discover all available pages before exploring further.

splToken

Interfaces

GetTokenBalanceArgs

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

Properties

account
account: string
Defined in: packages/payment-solana/src/splToken.ts:23 The wallet address to check the balance for
asset
asset: string
Defined in: packages/payment-solana/src/splToken.ts:21 The SPL token mint address
rpcClient
rpcClient: Rpc<GetTokenAccountBalanceApi>
Defined in: packages/payment-solana/src/splToken.ts:25 Solana RPC client with token balance API support
tokenProgram?
optional tokenProgram: Address
Defined in: packages/payment-solana/src/splToken.ts:27 The token program address (defaults to TOKEN_PROGRAM_ADDRESS)

Variables

TOKEN_2022_PROGRAM_ADDRESS

const TOKEN_2022_PROGRAM_ADDRESS: Address<"TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb">
Defined in: packages/payment-solana/src/splToken.ts:12

Functions

getTokenBalance()

getTokenBalance(args): Promise<null | { amount: bigint; decimals: number; }>
Defined in: packages/payment-solana/src/splToken.ts:71 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:41 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