Hello everyone,
is there a way to use a logical OR when constructing a query? My use case is to find all transactions where the sender or the receiver is a specific address.
Thank you!
Hello everyone,
is there a way to use a logical OR when constructing a query? My use case is to find all transactions where the sender or the receiver is a specific address.
Thank you!
I have found a way:
query ($network: EthereumNetwork!, $wallet: String!, $limit: Int!, $offset: Int!) {
ethereum(network: $network) {
transfers(
options: {limit: $limit, offset: $offset}
any: [
{receiver: {is: $wallet}},
{sender: {is: $wallet}}
]
external: true
success: true
) {
amount
currency {
address
}
sender {
address
}
receiver {
address
}
transaction {
hash
}
}
}
}
If you have any advice how to make this request cheaper while returning the same result, I am all ears
Another follow up, the above request is cheaper when filtered by date (as answered by the Telegram community). It would be good to know if it can be improved further.
query ($network: EthereumNetwork!, $wallet: String!, $limit: Int!, $offset: Int!) {
ethereum(network: $network) {
transfers(
options: {limit: $limit, offset: $offset}
any: [{receiver: {is: $wallet}}, {sender: {is: $wallet}}]
date: {after: "2022-01-01"}
) {
amount
currency {
address
}
sender {
address
}
receiver {
address
}
external
}
}
}
This query is quite optimized, personally I don’t see any way to optimize it more, good job