# Group arguments of smartContractEvent

**URL:** <https://community.bitquery.io/t/group-arguments-of-smartcontractevent/328>\
**Category:** GraphQL API\
**Tags:** closed\
**Created:** [July 18, 2021, 8:42am UTC](https://community.bitquery.io/t/group-arguments-of-smartcontractevent/328 "2021-07-18T08:42:16Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![marcell033](https://avatars.discourse-cdn.com/v4/letter/m/898d66/32.png) [@marcell033](https://community.bitquery.io/u/marcell033)\
**Post date:** [July 18, 2021, 8:42am UTC](https://community.bitquery.io/t/group-arguments-of-smartcontractevent/328/1 "2021-07-18T08:42:17Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![gaurav](https://avatars.discourse-cdn.com/v4/letter/g/b487fb/32.png) [@gaurav](https://community.bitquery.io/u/gaurav)\
**Post date:** [July 18, 2021, 9:00am UTC](https://community.bitquery.io/t/group-arguments-of-smartcontractevent/328/2 "2021-07-18T09:00:54Z")

</div>

```auto
{
  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
        }
      }
    }
  }
}

```

---

<div class="post-metadata">

**Author:** ![marcell033](https://avatars.discourse-cdn.com/v4/letter/m/898d66/32.png) [@marcell033](https://community.bitquery.io/u/marcell033)\
**Post date:** [July 18, 2021, 9:44am UTC](https://community.bitquery.io/t/group-arguments-of-smartcontractevent/328/3 "2021-07-18T09:44:23Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![gaurav](https://avatars.discourse-cdn.com/v4/letter/g/b487fb/32.png) [@gaurav](https://community.bitquery.io/u/gaurav)\
**Post date:** [July 18, 2021, 10:37am UTC](https://community.bitquery.io/t/group-arguments-of-smartcontractevent/328/4 "2021-07-18T10:37:45Z")

</div>

Try this

```auto
{
  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](https://bitquery.io/blog/conditional-aggregation)
