Base Chain Token Transfers API
In this section we'll have a look at some examples using the Base Transfers API.
Subscribe to Recent Whale Transactions of a particular currency
The subscription query below fetches the whale transactions on the Base network. We have used USDC address 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913
. You can find the query here
subscription {
EVM(network: base) {
Transfers(
where: {Transfer: {Currency: {SmartContract: {is: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"}}, Amount: {ge: "10000"}}}
) {
Transaction {
From
Hash
}
Transfer {
Amount
Sender
Receiver
Currency {
SmartContract
Symbol
Name
Fungible
Native
}
Id
}
}
}
}
Sender is a particular address
This websocket retrieves transfers where the sender is a particular address 0x3304E22DDaa22bCdC5fCa2269b418046aE7b566A
. For this subscription query we use where
keyword and in that we specify {Transfer: {Sender: {is: "0x3304E22DDaa22bCdC5fCa2269b418046aE7b566A"}}}
to get the desired data. You can find the query here
subscription {
EVM(network: base) {
Transfers(
where: {Transfer: {Sender: {is: "0x3304E22DDaa22bCdC5fCa2269b418046aE7b566A"}}}
) {
Transfer {
Amount
AmountInUSD
Currency {
Name
SmartContract
Native
Symbol
Fungible
}
Receiver
Sender
}
Transaction {
Hash
}
}
}
}
Subscribe to the latest NFT token transfers on Base Chain
Let's see an example of NFT token transfers using GraphQL Subscription (Webhook). In the following NFT Token Transfers API, we will be subscribing to all NFT token transfers on Base network. You can run the query here
subscription {
EVM(network: base) {
Transfers(where: {Transfer: {Currency: {Fungible: false}}}) {
Transfer {
Amount
AmountInUSD
Currency {
Name
SmartContract
Symbol
Fungible
HasURI
Decimals
}
URI
Sender
Receiver
}
Transaction {
Hash
}
}
}
}
Get all transfers of a particular NFT
This below query will give you all the transfers of a particular NFT 0xb68CA010776B4584cf49893E75b66583eb884948
.
You can test out the query here.
query MyQuery {
EVM(network: base, dataset: realtime) {
Transfers(
where: {Transfer: {Currency: {Fungible: false, SmartContract: {is: "0xb68CA010776B4584cf49893E75b66583eb884948"}}}}
) {
Transfer {
Amount
AmountInUSD
Currency {
Name
Native
SmartContract
Symbol
}
Id
Sender
Receiver
}
Transaction {
From
Hash
}
}
}
}