tokens.search
Searches for an SPL token in the SPL token registry
Parameters:
search: string - what to use to search (
address
,name
,symbol
)param: string - the parameter/search term to use to find a token
compare_type (optional, default:
"equals"
): string - how to compare the search for tokens (equals
,startsWith
,endsWith
,includes
)skip_validation (optional, default:
false
): boolean - whether to skip validation on if a token in the SPL token registry is a valid SPL token (true for skipping validation, false for not skipping validation), it is recommended to set this field to true when a large number of tokens are being returned and you want the function to execute quickly
Returns:
object ({"tokens": [...]}
) - the list of tokens (see https://github.com/solana-labs/token-list/blob/main/src/tokens/solana.tokenlist.json for format)
Throws:
SOL Pay SDK Fatal Error: Invalid search ${search}.
- an invalid search was usedSOL Pay SDK Fatal Error: Invalid compare type ${compare_type}.
- an invalid compare type was usedSOL Pay SDK Fatal Error: No connection found. Use SOLPay.connectNetwork() to connect to the Solana network.
- could not find a connection to the Solana networkSOL Pay SDK Fatal Error: Connection did not respond. Use SOLPay.connectNetwork() to connect to the Solana network.
- did not receive response from Solana network
Last updated