Links
💸

Token Transfers

Learn how to use Airstack to fetch all ERC20/721/1155 token transfers data, from or to user(s), across Ethereum, Polygon, Base, and Zora.
Airstack provides a TokenTransfers API for you to fetch all ERC20/721/1155 token transfers data from either a user or multiple users on Ethereum, Polygon, Base, and Zora.

Table Of Contents

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

Pre-requisites

  • An Airstack account (free)
  • Basic knowledge of GraphQL

Get Started

JavaScript/TypeScript/Python

If you are using JavaScript/TypeScript or Python, Install the Airstack SDK:
npm
yarn
pnpm
pip
React
npm install @airstack/airstack-react
Node
npm install @airstack/node
React
yarn add @airstack/airstack-react
Node
yarn add @airstack/node
React
pnpm install @airstack/airstack-react
Node
pnpm install @airstack/node
pip install airstack
Then, add the following snippets to your code:
React
Node
Python
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>;
}
};
import { init, fetchQuery } from "@airstack/node";
init("YOUR_AIRSTACK_API_KEY");
const query = `YOUR_QUERY`; // Replace with GraphQL Query
const { data, error } = await fetchQuery(query);
console.log("data:", data);
console.log("error:", error);
import asyncio
from airstack.execute_query import AirstackClient
api_client = AirstackClient(api_key="YOUR_AIRSTACK_API_KEY")
query = """YOUR_QUERY""" # Replace with GraphQL Query
async def main():
execute_query_client = api_client.create_execute_query_object(
query=query)
query_response = await execute_query_client.execute_query()
print(query_response.data)
asyncio.run(main())

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.
Airstack AI (Demo)

Get Token Transfers Sent From A User on Ethereum

You can fetch all token transfers sent from a given user, e.g. betashop.eth, on Ethereum by using the TokenTransfers API:

Try Demo

https://app.airstack.xyz/query/ZGtUdm88Lv
Show me token transfers sent from betashop.eth on Ethereum

Code

Query
Response
query GetTokenTransfers {
TokenTransfers(
input: {
filter: {
# Only get token transfers from betashop.eth
from: {_eq: "betashop.eth"},
# Remove all minting/burning + self-transfer
_nor: {
from: {_in: ["0x0000000000000000000000000000000000000000", "0x000000000000000000000000000000000000dEaD"]},
to: {_in: ["0x0000000000000000000000000000000000000000", "0x000000000000000000000000000000000000dEaD", "betashop.eth"]}
}
},
blockchain: ethereum,
limit: 50
}
) {
TokenTransfer {
formattedAmount
tokenType
token {
name
}
}
}
}
{
"data": {
"TokenTransfers": {
"TokenTransfer": [
{
"formattedAmount": 25,
"tokenType": "ERC20",
"token": {
"name": "USD Coin"
}
},
{
"formattedAmount": 25,
"tokenType": "ERC20",
"token": {
"name": "USD Coin"
}
}
// Other token transfers from betashop.eth on Ethereum
]
}
}
}

Get Token Transfers Received By A User on Ethereum

You can fetch all token transfers received by a given user, e.g. betashop.eth, on Ethereum by using the TokenTransfers API:

Try Demo

https://app.airstack.xyz/query/d0vekk7Ako
Show me token transfers received by betashop.eth on Ethereum

Code

Query
Response
query GetTokenTransfers {
TokenTransfers(
input: {
filter: {
# Only get token transfers to betashop.eth
to: {_eq: "betashop.eth"},
# Remove all minting/burning + self-transfer
_nor: {
from: {_in: ["0x0000000000000000000000000000000000000000", "0x000000000000000000000000000000000000dEaD", "betashop.eth"]},
to: {_in: ["0x0000000000000000000000000000000000000000", "0x000000000000000000000000000000000000dEaD"]}
}
},
blockchain: ethereum,
limit: 50
}
) {
TokenTransfer {
formattedAmount
tokenType
token {
name
}
}
}
}
{
"data": {
"TokenTransfers": {
"TokenTransfer": [
{
"formattedAmount": 1,
"tokenType": "ERC721",
"token": {
"name": "ETHGlobal Pragma Lisbon"
}
},
{
"formattedAmount": 0.00005,
"tokenType": "ERC20",
"token": {
"name": "Wrapped Ether"
}
}
// Other Token Transfers received by betashop.eth on Ethereum
]
}
}
}

Get Token Transfers Sent From A User on Polygon

You can fetch all token transfers sent from a given user, e.g. ipeciura.eth, on Polygon by using the TokenTransfers API:

Try Demo

https://app.airstack.xyz/query/FLruoqln49
Show me token transfers sent from ipeciura.eth on Polygon

Code

Query
Response
query GetTokenTransfers {
TokenTransfers(
input: {
filter: {
# Only get token transfers from ipeciura.eth
from: { _eq: "ipeciura.eth" }
# Remove all minting/burning + self-transfer
_nor: {
from: {
_in: [
"0x0000000000000000000000000000000000000000"
"0x000000000000000000000000000000000000dEaD"
]
}
to: {
_in: [
"0x0000000000000000000000000000000000000000"
"0x000000000000000000000000000000000000dEaD"
"ipeciura.eth"
]
}
}
}
blockchain: polygon
limit: 50
}
) {
TokenTransfer {
formattedAmount
tokenType
token {
name
}
}
}
}
{
"data": {
"TokenTransfers": {
"TokenTransfer": [
{
"formattedAmount": 1,
"tokenType": "ERC20",
"token": {
"name": "(PoS) Decentraland MANA"
}
},
{
"formattedAmount": 0.002048431232076552,
"tokenType": "ERC20",
"token": {
"name": "Wrapped Ether"
}
}
// Other Polygon token transfers sent by ipeciura.eth
]
}
}
}

Get Token Transfers Received By A User on Polygon

You can fetch all token transfers received by a given user, e.g. betashop.eth, on Polygon by using the TokenTransfers API:

Try Demo

https://app.airstack.xyz/query/yO5BgLYsV0
Show me token transfers received by betashop.eth on Polygon

Code

Query
Response
query GetTokenTransfers {
TokenTransfers(
input: {
filter: {
# Only get token transfers to betashop.eth
to: {_eq: "betashop.eth"},
# Remove all minting/burning + self-transfer
_nor: {
from: {_in: ["0x0000000000000000000000000000000000000000", "0x000000000000000000000000000000000000dEaD", "betashop.eth"]},
to: {_in: ["0x0000000000000000000000000000000000000000", "0x000000000000000000000000000000000000dEaD"]}
}
},
blockchain: polygon,
limit: 50
}
) {
TokenTransfer {
formattedAmount
tokenType
token {
name
}
}
}
}
{
"data": {
"TokenTransfers": {
"TokenTransfer": [
{
"formattedAmount": 520.95,
"tokenType": "ERC20",
"token": {
"name": "@SNXPool.com"
}
},
{
"formattedAmount": 1,
"tokenType": "ERC721",
"token": {
"name": "Firefly Pass"
}
}
// Other Token Transfers received by betashop.eth on Polygon
]
}
}
}

Get Token Transfers Sent From A User on Base

You can fetch all token transfers sent from a given user, e.g. jessepollak.eth, on Base by using the TokenTransfers API:

Try Demo

https://app.airstack.xyz/query/ubt2YJHZHj
Show me token transfers sent from jessepollak.eth on Base

Code

Query
Response
query GetTokenTransfers {
TokenTransfers(
input: {
filter: {
# Only get token transfers from jessepollak.eth
from: {_eq: "jessepollak.eth"},
# Remove all minting/burning + self-transfer
_nor: {
from: {_in: ["0x0000000000000000000000000000000000000000", "0x000000000000000000000000000000000000dEaD"]},
to: {_in: ["0x0000000000000000000000000000000000000000", "0x000000000000000000000000000000000000dEaD", "jessepollak.eth"]}
}
},
blockchain: base,
limit: 50
}
) {
TokenTransfer {
formattedAmount
tokenType
token {
name
}
}
}
}
{
"data": {
"TokenTransfers": {
"TokenTransfer": [
{
"formattedAmount": 100,
"tokenType": "ERC20",
"token": {
"name": "USD Coin"
}
},
{
"formattedAmount": 99,
"tokenType": "ERC20",
"token": {
"name": "USD Base Coin"
}
}
// Other Base token transfers sent by jessepollak.eth
]
}
}
}

Get Token Transfers Received By A User on Base

You can fetch all token transfers received by a given user, e.g. barmstrong.eth, on Base by using the TokenTransfers API:

Try Demo

https://app.airstack.xyz/query/RIffwTnhus
Show me token transfers received by barmstrong.eth on Base

Code

Query
Response
query GetTokenTransfers {
TokenTransfers(
input: {
filter: {
# Only get token transfers to barmstrong.eth
to: {_eq: "barmstrong.eth"},
# Remove all minting/burning + self-transfer
_nor: {
from: {_in: ["0x0000000000000000000000000000000000000000", "0x000000000000000000000000000000000000dEaD", "barmstrong.eth"]},
to: {_in: ["0x0000000000000000000000000000000000000000", "0x000000000000000000000000000000000000dEaD"]}
}
},
blockchain: base,
limit: 50
}
) {
TokenTransfer {
formattedAmount
tokenType
token {
name
}
}
}
}
{
"data": {
"TokenTransfers": {
"TokenTransfer": [
{
"formattedAmount": 1,
"tokenType": "ERC721",
"token": {
"name": "BasePunks"
}
},
{
"formattedAmount": 1,
"tokenType": "ERC721",
"token": {
"name": "Bullcasso"
}
}
// Other Token Transfers received by barmstrong.eth on Base
]
}
}
}

Get Token Transfers Sent From A User on Zora

You can fetch all token transfers sent from a given user, e.g. jacob.eth, on Zora by using the TokenTransfers API:

Try Demo

https://app.airstack.xyz/query/nNTQ6Pg2h3
Show me token transfers sent from jacob.eth on Zora

Code

Query
Response
query GetTokenTransfers {
TokenTransfers(
input: {
filter: {
# Only get token transfers from jacob.eth
from: {_eq: "jacob.eth"},
# Remove all minting/burning + self-transfer
_nor: {
from: {_in: ["0x0000000000000000000000000000000000000000", "0x000000000000000000000000000000000000dEaD"]},
to: {_in: ["0x0000000000000000000000000000000000000000", "0x000000000000000000000000000000000000dEaD", "jessepollak.eth"]}
}
},
blockchain: zora,
limit: 50
}
) {
TokenTransfer {
formattedAmount
tokenType
token {
name
}
}
}
}
{
"data": {
"TokenTransfers": {
"TokenTransfer": [
{
"formattedAmount": 100,
"tokenType": "ERC20",
"token": {
"name": "USD Coin"
}
},
{
"formattedAmount": 99,
"tokenType": "ERC20",
"token": {
"name": "USD Base Coin"
}
}
// Other Base token transfers sent by jessepollak.eth
]
}
}
}

Get Token Transfers Received By A User on Zora

You can fetch all token transfers received by a given user, e.g. jacob.eth, on Zora by using the TokenTransfers API:

Try Demo

https://app.airstack.xyz/query/IN0qktFA2I
Show me token transfers received by jacob.eth on Zora

Code

Query
Response
query GetTokenTransfers {
TokenTransfers(
input: {
filter: {
# Only get token transfers to jacob.eth
to: {_eq: "jacob.eth"},
# Remove all minting/burning + self-transfer
_nor: {
from: {_in: ["0x0000000000000000000000000000000000000000", "0x000000000000000000000000000000000000dEaD", "barmstrong.eth"]},
to: {_in: ["0x0000000000000000000000000000000000000000", "0x000000000000000000000000000000000000dEaD"]}
}
},
blockchain: zora,
limit: 50
}
) {
TokenTransfer {
formattedAmount
tokenType
token {
name
}
}
}
}
{
"data": {
"TokenTransfers": {
"TokenTransfer": [
{
"formattedAmount": 1,
"tokenType": "ERC721",
"token": {
"name": "BasePunks"
}
},
{
"formattedAmount": 1,
"tokenType": "ERC721",
"token": {
"name": "Bullcasso"
}
}
// Other Token Transfers received by barmstrong.eth on Base
]
}
}
}

Get Token Transfers Sent From A User on Multiple Chains

You can fetch all token transfers sent from a given user, e.g. betashop.eth, across multiple chains, such as Ethereum, Polygon, Base, and Zora, by using the TokenTransfers API:

Try Demo

https://app.airstack.xyz/query/NspXPukoq0
Show me all token transfers sent from betashop.eth on Ethereum, Polygon, Base, and Zora

Code

Query
Response
query GetTokenTransfers {
# first query on Ethereum
Ethereum: TokenTransfers(
input: {
filter: {
# Only get token transfers from betashop.eth
from: {_eq: "betashop.eth"},
# Remove all minting/burning + self-transfer
_nor: {
from: {_in: ["0x0000000000000000000000000000000000000000", "0x000000000000000000000000000000000000dEaD"]},
to: {_in: ["0x0000000000000000000000000000000000000000", "0x000000000000000000000000000000000000dEaD", "betashop.eth"]}
}
},
blockchain: ethereum,
limit: 50
}
) {
TokenTransfer {
formattedAmount
tokenType
token {
name
}
}
}
# second query on Polygon
Polygon: TokenTransfers(
input: {
filter: {
# Only get token transfers from betashop.eth
from: {_eq: "betashop.eth"},
# Remove all minting/burning + self-transfer
_nor: {
from: {_in: ["0x0000000000000000000000000000000000000000", "0x000000000000000000000000000000000000dEaD"]},
to: {_in: ["0x0000000000000000000000000000000000000000", "0x000000000000000000000000000000000000dEaD", "betashop.eth"]}
}
},
blockchain: polygon,
limit: 50
}
) {
TokenTransfer {
formattedAmount
tokenType
token {
name
}
}
}
# third query on Base
Base: TokenTransfers(
input: {
filter: {
# Only get token transfers from betashop.eth
from: {_eq: "betashop.eth"},
# Remove all minting/burning + self-transfer
_nor: {
from: {_in: ["0x0000000000000000000000000000000000000000", "0x000000000000000000000000000000000000dEaD"]},
to: {_in: ["0x0000000000000000000000000000000000000000", "0x000000000000000000000000000000000000dEaD", "betashop.eth"]}
}
},
blockchain: base,
limit: 50
}
) {
TokenTransfer {
formattedAmount
tokenType
token {
name
}
}
}
# fourth query on Zora
Zora: TokenTransfers(
input: {
filter: {
# Only get token transfers from betashop.eth
from: {_eq: "betashop.eth"},
# Remove all minting/burning + self-transfer
_nor: {
from: {_in: ["0x0000000000000000000000000000000000000000", "0x000000000000000000000000000000000000dEaD"]},
to: {_in: ["0x0000000000000000000000000000000000000000", "0x000000000000000000000000000000000000dEaD", "betashop.eth"]}
}
},
blockchain: zora,
limit: 50
}
) {
TokenTransfer {
formattedAmount
tokenType
token {
name
}
}
}
}
{
"data": {
"Ethereum": {
"TokenTransfer": [
{
"formattedAmount": 25,
"tokenType": "ERC20",
"token": {
"name": "USD Coin"
},
},
// Other token transfers sent by betashop.eth on Ethereum
]
},
"Polygon": {
"TokenTransfer": null // No tokens sent by betashop.eth on Polygon
},
"Base": {
"TokenTransfer": [
{
"formattedAmount": 100,
"tokenType": "ERC20",
"token": {
"name": "USD Coin"
},
},
// Other token transfers sent by betashop.eth on Base
]
},
"Zora": {
"TokenTransfer": null // No tokens sent by betashop.eth on Zora
}
}
}

Get Token Transfers Received By A User on Multiple Chains

You can fetch all token transfers received by a given user, e.g. betashop.eth, across multiple chains, such as Ethereum, Polygon, Base, and Zora, by using the TokenTransfers API:

Try Demo

https://app.airstack.xyz/query/EtO1a58dQQ
Show me token transfers received by betashop.eth on Ethereum, Polygon, and Base

Code

Query
Response
query GetTokenTransfers {
# first query on Ethereum