âĢSort Results

Learn how to use Airstack to get token-bound account results sorted in ascending or descending order by the creation block timestamp.

Airstack provides easy-to-use APIs for enriching ERC6551 dapps and integrating on-chain and off-chain data.

Table Of Contents

In this guide you will learn how to use Airstack to:

Pre-requisites

Get Started

JavaScript/TypeScript/Python

If you are using JavaScript/TypeScript or Python, Install the Airstack SDK:

React

npm install @airstack/airstack-react

Node

npm install @airstack/node

Then, add the following snippets to your code:

import { init, useQuery } from "@airstack/airstack-react";

init("YOUR_AIRSTACK_API_KEY");

const query = `YOUR_QUERY`; // Replace with GraphQL Query

const Component = () => {
  const { data, loading, error } = useQuery(query);

  if (data) {
    return <p>Data: {JSON.stringify(data)}</p>;
  }

  if (loading) {
    return <p>Loading...</p>;
  }

  if (error) {
    return <p>Error: {error.message}</p>;
  }
};

Other Programming Languages

To access the Airstack APIs in other languages, you can use https://api.airstack.xyz/gql as your GraphQL endpoint.

🤖 AI Natural Language​

Airstack provides an AI solution for you to build GraphQL queries to fulfill your use case easily. You can find the AI prompt of each query in the demo's caption or title for yourself to try.

Get The Latest Token Bound Accounts Created

You can get the all the latest token-bound accounts created in descending order by createdAtBlockTimestamp by setting the value to enum DESC:

Try Demo

Code

query MyQuery {
  Accounts(
    input: {
      order: { createdAtBlockTimestamp: DESC }
      blockchain: ethereum
      limit: 200
    }
  ) {
    Account {
      id
      standard
      blockchain
      tokenAddress
      tokenId
      address {
        identity
        blockchain
      }
      registry
      implementation
      salt
      createdAtBlockNumber
      createdAtBlockTimestamp
      creationTransactionHash
      deployer
      updatedAtBlockNumber
      updatedAtBlockTimestamp
    }
  }
}

Get The Earliest Token Bound Accounts Created

You can get the all the earliest token-bound accounts created in descending order by createdAtBlockTimestamp by setting the value to enum ASC:

Try Demo

Code

query MyQuery {
  Accounts(
    input: {
      order: { createdAtBlockTimestamp: ASC }
      blockchain: ethereum
      limit: 200
    }
  ) {
    Account {
      id
      standard
      blockchain
      tokenAddress
      tokenId
      address {
        identity
        blockchain
      }
      registry
      implementation
      salt
      createdAtBlockNumber
      createdAtBlockTimestamp
      creationTransactionHash
      deployer
      updatedAtBlockNumber
      updatedAtBlockTimestamp
    }
  }
}

Developer Support

If you have any questions or need help regarding sorting ERC6551 token bound accounts data by creation block timestamp, please join our Airstack's Telegram group.

More Resources

Last updated

Was this helpful?