Hi
I’m running the following query and I’d like to group the arguments if possible (as explained below)
{
ethereum(network: bsc) {
TransferEvents: smartContractEvents(
smartContractAddress: {is: “0x83a86adf1a7c56e77d36d585b808052e0a2aad0e”}
smartContractEvent: {is: “Transfer”}
txFrom: {is: “0xCb7027A23Fc5aB02802DeDb6224ebe8636D0d421”}
time: {since: “2010-05-09T00:00Z”}
options: {desc: “block.timestamp.unixtime”}
) {
block {
height
timestamp {
unixtime
iso8601
}
}
transaction {
hash
}
arguments {
argument
value
}
smartContract {
currency {
decimals
}
}
}
}
}
The arguments returned are a list of “from”, “to”, “value”
“arguments”: [
{
“argument”: “from”,
“value”: “0x3a2afa6ae6af7227a377203a5c83da061f5eec89”
},
{
“argument”: “to”,
“value”: “0xc52f5a65dabf20c5f47995c34c3c9fbbee66c08d”
},
{
“argument”: “value”,
“value”: “512178839744177”
},
{
“argument”: “from”,
“value”: “0x3a2afa6ae6af7227a377203a5c83da061f5eec89”
},
{
“argument”: “to”,
“value”: “0xb282ba7e94589dc3bc980b7e5759dcb791231393”
},
{
“argument”: “value”,
“value”: “512178839744177”
},
{
“argument”: “from”,
“value”: “0x3a2afa6ae6af7227a377203a5c83da061f5eec89”
},
{
“argument”: “to”,
“value”: “0xb0634c7bdb458c97976ad15481f1560b6a366fa0”
},
{
“argument”: “value”,
“value”: “1024357679488355”
},
{
“argument”: “from”,
“value”: “0x3a2afa6ae6af7227a377203a5c83da061f5eec89”
},
{
“argument”: “to”,
“value”: “0xcb7027a23fc5ab02802dedb6224ebe8636d0d421”
},
{
“argument”: “value”,
“value”: “51217883974417770”
}
]
Is there a way to group any from-to-value in a sigle object?
Thanks
gaurav
July 18, 2021, 9:00am
2
{
ethereum(network: bsc) {
TransferEvents: arguments(
smartContractAddress: {is: "0x83a86adf1a7c56e77d36d585b808052e0a2aad0e"}
smartContractEvent: {is: "Transfer"}
txFrom: {is: "0xCb7027A23Fc5aB02802DeDb6224ebe8636D0d421"}
time: {since: "2010-05-09T00:00Z"}
options: {desc: "block.timestamp.unixtime"}
) {
block {
height
timestamp {
unixtime
iso8601
}
}
transaction {
hash
}
from: any(of: argument_value, argument: {is: "from"})
to: any(of: argument_value, argument: {is: "to"})
value: any(of: argument_value, argument: {is: "value"})
smartContract {
currency {
decimals
}
}
}
}
}
Sorry but his answer is wrong, there’s loss of information with your query, as it only consider the first object (composed by from, to and value)
Please, compare my query and yours to see the information loss.
What I mean is if there is a way to go
from
{
"argument": "from",
"value": "0x3a2afa6ae6af7227a377203a5c83da061f5eec89"
},
{
"argument": "to",
"value": "0xb282ba7e94589dc3bc980b7e5759dcb791231393"
},
{
"argument": "value",
"value": "512178839744177"
}
to
{
"from": "0x3a2afa6ae6af7227a377203a5c83da061f5eec89"
"to": "0xb282ba7e94589dc3bc980b7e5759dcb791231393"
"value" : "512178839744177"
}
Furthermore, is there a way to only consider the max value between all the “values”? Instead of taking all of them?
Thanks
gaurav
July 18, 2021, 10:37am
4
Try this
{
ethereum(network: bsc) {
TransferEvents: smartContractEvents(
smartContractAddress: {is: "0x83a86adf1a7c56e77d36d585b808052e0a2aad0e"}
smartContractEvent: {is: "Transfer"}
txFrom: {is: "0xCb7027A23Fc5aB02802DeDb6224ebe8636D0d421"}
time: {since: "2010-05-09T00:00Z"}
options: {desc: "block.timestamp.unixtime"}
) {
block {
height
timestamp {
unixtime
iso8601
}
}
eventIndex
transaction {
hash
}
arguments {
argument
value
}
smartContract {
currency {
decimals
}
}
}
}
}
Also, Read this to get max value from events
https://bitquery.io/blog/conditional-aggregation