Crossmint’s wallet SDK is headless by design. This gives you full control to build a customer UX around the wallet.

The SDK provides several functions to simplify the process of embedding the wallet in your app, including fetching all the assets (both fungible and non-fungible tokens) in the wallet.

Using these endpoints allows you to have one highly reliable vendor integration while building your wallets. These APIs combine several indexers under the hood to enable the highest uptime, lowest latency experience when displaying your users assets

In the Crossmint console, create a server-side API key with scopes for wallets: wallets:nfts.read. Because these are server-side endpoints, make sure you do not expose this API key in your frontend.

Fetching NFTs

curl --request GET \
  --url 'https://staging.crossmint.com/api/2022-06-09/wallets/<chain>%:${wallet_address}/nfts?page=1&perPage=20' \
  --header 'X-API-KEY: <YOUR_API_KEY>'

You can try this endpoint from the Crossmint API reference here

A successful response will look like:

[
  {
    "chain": <chain>,
    "contractAddress": <contract_address>,
    "tokenId": <token_id>,
    "locator": "<chain>:<contract_address>:<token_id>",
    "tokenStandard": "erc-721" | "erc-1155"
  }
]

Fetching Fungible Tokens

curl -X GET "https://staging.crossmint.com/api/unstable/wallets/<chain>:${address}/tokens" \
    -H "X-API-KEY: your_api_key_here"
    -H "Content-Type: application/json"

A successful response will look like:

{
    contractAddress: token_contract_address,
    tokenBalance: <balance> //type is hexidecimal,
    tokenMetadata: { decimals: 18, logo: null, name: tokenName, symbol: tokenSymbol }
}