# tokens.search

```javascript
(async() => {
    let token_search_1 = await SOLPay.tokens.search("symbol", "USDC"); // {"tokens": [...]}
    let token_search_2 = await SOLPay.tokens.search("symbol", "USDC", "equals"); // {"tokens": [...]}
    let token_search_3 = await SOLPay.tokens.search("symbol", "USDC", "equals", true); // {"tokens": [...]}
})();
```

### 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 used
* `SOL Pay SDK Fatal Error: Invalid compare type ${compare_type}.` - an invalid compare type was used
* `SOL Pay SDK Fatal Error: No connection found. Use SOLPay.connectNetwork() to connect to the Solana network.` - could not find a connection to the Solana network
* `SOL Pay SDK Fatal Error: Connection did not respond. Use SOLPay.connectNetwork() to connect to the Solana network.` - did not receive response from Solana network
