Asset Dashboard (Prebuilt APIs)

Aggregate and visualize user transaction history, NFT holdings, and protocol interactions.

Building an Asset Dashboard with Prebuilt APIs

ZettaBlock's Asset Dashboard Prebuilt APIs are a powerful tool designed to simplify the complex task of tracking and visualizing the myriad of interactions a user has with the blockchain. This API suite is tailored to provide a comprehensive overview of user transaction history, NFT holdings, and protocol interactions in an easily digestible format.

Table of Contents

  1. Get Native Balance of an Address
  2. Get Token Balance by Address and Contract
  3. Get All Tokens' Balance and Metadata
  4. Get Token Metadata and All Holders

πŸ“˜

To run all these GraphQL endpoints, go here.

1. Get Native Balance of an Address

query {  
  native_balance(address: "0x0000000000000000000000000000000000000006")  
}

Use Case: Retrieve the native balance of a specific blockchain address.

How it Works: This API returns the native balance (in WEI) of the given address. 1 ETH = 10^18 WEI.

2. Get Token Balance by Address and Contract

query {  
	token_balance(address: "0x0000000000000000000000000000000000000000", contract_address: "0x0000000000085d4780b73119b644ae5ecd22b376")  
}

Use Case: Fetch the balance of a specific token for a given address.

How it Works: This API returns the token balance based on the wallet address and the contract address of the token.

3. Get All Tokens' Balance and Metadata

query {  
  token_balances(  
    where: {address: {eq: "0xd8da6bf26964af9d7eed9e03e53415d37aa96045"}}  
  	first:20  
    orderBy: value  
    orderDirection:desc  
  ) {  
    value  
    contract_address  
    token_metadata {  
      name  
      symbol  
    }  
  }  
}

Use Case: Retrieve all tokens, their balance, and metadata owned by an address.

How it Works: This API lists all tokens owned by an address, sorted by value, and provides metadata like name and symbol. To get the ETH value, multiply the output by the token decimal.

4. Get Token Metadata and All Holders

query token_balances{  
  token_metadata(contract_address: "0x0000000000004946c0e9f43f4dee607b0ef1fa1c") {  
    name  
    symbol  
    decimals  
  }  
  token_balances(  
    where: {contract_address: {eq: "0x0000000000004946c0e9f43f4dee607b0ef1fa1c"}}  
  	first: 5  
    orderBy: value  
    orderDirection:desc  
  ) {  
    value  
    contract_address  
  }  
}

Use Case: Get metadata of a token and its top holders.

How it Works: This API provides metadata for a specific token and lists its top holders based on the token value.

That's it! You're now equipped to handle various wallet use cases using ZettaBlock's Prebuilt APIs. πŸš€