Query for CurrencyCreated events without specifying the generic type

Hello,

Am I correct that it’s currently not possible to filter for all generic events, without specifing the generic itself?

use-case: I would like to read all 0x2::c oin::CurrencyCreated events without having to pass in the , so that I can index cointypes off-chain more efficiently.

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "sui_getEvents",
  "params": {
      "query": {
          "MoveEvent": "0x2::coin::CurrencyCreated"
      },
      "descending_order": false
  }
}

returns an emtpy list (because I did not specify T) where as

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "sui_getEvents",
  "params": {
      "query": {
          "MoveEvent": "0x2::coin::CurrencyCreated<0xe02749a56fc4b05daf0fb1c700e6450ea03ef757::btc::BTC>"
      },
      "descending_order": false
  }
}

returns one event.

Best,
Daniel

4 Likes

Currently we can only query using the exact type.

Querying for generic type is a valid use case, I think we should support this.

We are moving all event indexing to the indexer, we can add generic type query support to this.

3 Likes

gotcha!

thanks for considering a change.

I have a workaround for now to index the Coin types, but I’m happy to move to the “optimal” event-query solution once it’s available :slight_smile:

1 Like