Optimism Transfers API
In this section we'll have a look at some examples using the Optimism Transfers API.
Subscribe to Recent Whale Transactions of a particular currency
The subscription query below fetches the whale transactions on the Optimism network. We have used USDT address 0x94b008aA00579c1307B0EF2c499aD98a8ce58e58
You can find the query here
subscription {
EVM(network: optimism) {
Transfers(
where: {Transfer: {Currency: {SmartContract: {is: "0x94b008aA00579c1307B0EF2c499aD98a8ce58e58"}}, 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 0xEbe80f029b1c02862B9E8a70a7e5317C06F62Cae. For this subscription query we use where keyword and in that we specify {Transfer: {Sender: {is: "0xEbe80f029b1c02862B9E8a70a7e5317C06F62Cae"}}} to get the desired data. You can find the query here
subscription {
EVM(network: optimism) {
Transfers(
where: {Transfer: {Sender: {is: "0xEbe80f029b1c02862B9E8a70a7e5317C06F62Cae"}}}
) {
Transfer {
Amount
AmountInUSD
Currency {
Name
SmartContract
Native
Symbol
Fungible
}
Receiver
Sender
}
Transaction {
Hash
}
}
}
}
Subscribe to the latest NFT token transfers on Optimism
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 Optimism network. You can run the query here
subscription {
EVM(network: optimism) {
Transfers(where: {Transfer: {Currency: {Fungible: false}}}) {
Transfer {
Amount
AmountInUSD
Currency {
Name
SmartContract
Symbol
Fungible
HasURI
Decimals
}
URI
Sender
Receiver
}
Transaction {
Hash
}
}
}
}
Deterministic Pagination for Backfilling Transfers
When backfilling Optimism transfer data or building a historical index, use deterministic pagination to guarantee no records are missed or duplicated.
Try it live: Deterministic Transfer API
{
EVM(dataset: combined, network: optimism) {
Transfers(
where: { Transfer: { Success: true } }
orderBy: {
ascending: [
Block_Number,
Transaction_Index,
Call_Index,
Log_Index,
Transfer_Index,
Transfer_Type
]
}
limit: { count: 10, offset: 0 }
) {
Block {
Time
Number
}
Transaction {
Hash
From
Index
}
Transfer {
Amount
AmountInUSD
Sender
Receiver
Index
Currency {
Symbol
Name
SmartContract
Decimals
Native
}
}
Call {
Index
}
Log {
LogAfterCallIndex
Index
}
Transfer {
Type
}
}
}
}
The composite orderBy across Block_Number, Transaction_Index, Call_Index, Log_Index, Transfer_Index, and Transfer_Type uniquely positions every transfer, making offset-based pagination safe for backfilling. Increment offset by the count value on each request. You can pull up to 25,000 records in a single request by setting count: 25000.