Page cover image

Verify Solana Asset

Solana Asset Verification API

The Solana Asset Verification API allows developers to verify whether a user holds specific assets on the Solana mainnet, including Solana Fungible Tokens (SPL Tokens) and NFTs. This API is essential for integrating asset verification into decentralized applications (dApps) and services built on Solana.


Asset Verification API for Solana

Endpoint:

POST https://alpha.gr1d.network/api/ccq-svm

Headers:

  • Authorization: <GR1D_API_KEY> (Contact [email protected] to get early access)

  • Content-Type: application/json

Request Body:

{
    "owner_address": "6jm9hBqmTxb1KMHdu88YBtLZzipLLccNDadAeMYeEF5d",
    "token_mint_address": "BfGBv5n9YoJBNudqNwBZMyqMsHwNreyLTb7BWQR6SXCp"
}
  • owner_address: The Solana address of the user whose asset holdings are being verified.

  • token_mint_address: The mint address of the Solana Fungible Token or NFT.

Sample Response:

{
    "status": 200,
    "message": "Assets Fetched Successfully",
    "data": {
        "owner_address": "6jm9hBqmTxb1KMHdu88YBtLZzipLLccNDadAeMYeEF5d",
        "asset": {
            "balance": 5,
            "QueryResult": "9e621d04b95250c5c6540568987b208b7856422e704edbffe3c43846df20115d553ebfc0f7f04824ab5db898e6c8116411584c40947b632f10789ee7de02d53c0500000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
        }
    }
}
  • status: HTTP status code (200 indicates success).

  • message: A message indicating the result of the query.

  • data:

    • owner_address: The Solana address queried.

    • asset.balance: The number of tokens or NFTs the user holds.

    • asset.QueryResult: A hexadecimal string representing the encoded query result.


Error Handling

In the event of an error, the API will return a response with the appropriate HTTP status code and an error message. Common error codes include:

  • 400: Bad Request - The request parameters are invalid.

  • 401: Unauthorized - The GR1D_API_KEY is missing or invalid.

  • 404: Not Found - The specified token_mint_address or owner_address is invalid.

  • 500: Internal Server Error - An unexpected error occurred on the server.


Security Considerations

  • API Key Management: Ensure that the GR1D_API_KEY is kept secure and never exposed in client-side code or public repositories.

  • Data Integrity: The query results are verified to ensure data integrity.

  • Rate Limiting: Be aware of any rate limits imposed on the API to prevent abuse and ensure fair usage.


Examples and Edge Cases

  • Solana Fungible Token Verification:

    {
        "owner_address": "6jm9hBqmTxb1KMHdu88YBtLZzipLLccNDadAeMYeEF5d",
        "token_mint_address": "BfGBv5n9YoJBNudqNwBZMyqMsHwNreyLTb7BWQR6SXCp"
    }

    Expected response: The balance field will indicate the number of Solana Fungible Tokens held by the user.

  • Solana NFT Verification:

    {
        "owner_address": "6jm9hBqmTxb1KMHdu88YBtLZzipLLccNDadAeMYeEF5d",
        "token_mint_address": "BfGBv5n9YoJBNudqNwBZMyqMsHwNreyLTb7BWQR6SXCp"
    }

    Expected response: The balance field will indicate the number of NFTs held by the user.

  • No Asset Held:

    {
        "owner_address": "6jm9hBqmTxb1KMHdu88YBtLZzipLLccNDadAeMYeEF5d",
        "token_mint_address": "BfGBv5n9YoJBNudqNwBZMyqMsHwNreyLTb7BWQR6SXCp"
    }

    Expected response: The balance field will be 0, and the QueryResult will reflect that no assets were found.