Skip to content

Conversation

D4ryl00
Copy link
Contributor

@D4ryl00 D4ryl00 commented Sep 4, 2025

This PR:

  • bumps gno to the version supporting new events StorageDepositEvent and StorageUnlockEvent (after chore: In gnokey, show storage deposit fee gno#4630)
  • handles new events and rework the GnoEvent event.
  • adds/update filters
  • adds unit tests
  • removes unused Func field and filter in GnoEvent (not present in the gno code base)

Usage

This is an example of a graphql request to get events from the transaction response:

fragment CallInfo on Transaction {
  messages {
    value {
      ... on MsgCall {
        func
        caller
        args
      }
    }
  }
  response {
    data
    events {
      ... on GnoEvent {
        type
      }
      ... on StorageDepositEvent {
        type
        bytes_delta
        fee_delta {
          amount
          denom
        }
        pkg_path
      }
      ... on StorageUnlockEvent {
        type
        bytes_delta
        fee_refund {
          amount
          denom
        }
        pkg_path
      }
    }
  }
}

query getTransactionsByStorage {
  getTransactions(
    where: {
      response: {
        events: {
          StorageDepositEvent: {
            fee_delta: {
              amount: {eq: 94800}
            }
          }
        }
      }
    }
  ) {
    ...CallInfo
  }
}

Signed-off-by: D4ryl00 <[email protected]>
Copy link
Collaborator

@ajnavarro ajnavarro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, do not add more functionality to the old query and subscription methods: blocks() and transactions(). They are going to be deprecated and removed in following releases.

@D4ryl00 D4ryl00 marked this pull request as draft September 8, 2025 12:28
@jefft0
Copy link
Contributor

jefft0 commented Sep 9, 2025

Hi @ajnavarro . This PR adds support for GnoEvent with the new getTransactions syntax. It appears that the deprecated transactions syntax doesn't support response and GnoEvent correctly. So this PR doesn't fix it. Is it OK for this PR to leave the deprecated syntax for GnoEvent a little broken?

@ajnavarro
Copy link
Collaborator

Hi @ajnavarro . This PR adds support for GnoEvent with the new getTransactions syntax. It appears that the deprecated transactions syntax doesn't support response and GnoEvent correctly. So this PR doesn't fix it. Is it OK for this PR to leave the deprecated syntax for GnoEvent a little broken?

Hi @jefft0 !

If we made a change on the Gno side that caused the transaction query endpoint to break, it is fine, but it shouldn't be a problem caused by us when modifying the indexer.

@jefft0
Copy link
Contributor

jefft0 commented Sep 11, 2025

I confirm that this PR doesn't change the behavior of querying a GnoEvent. Here is the query

query getEvents {
  getTransactions(
    where: {
      response: {
        events: {
          GnoEvent: {
            type: { eq:"ProfileFieldUpdated" }
          }
        }
      }
    }
  ) {
    response {
      events {
        ... on GnoEvent {
          type
          attrs { key value }
        }
      }
    }
  }
}

Here is the response in this PR (running with gno.land in the master branch).

{
  "data": {
    "getTransactions": [
      {
        "response": {
          "events": [
            {
              "type": "ProfileFieldUpdated",
              "attrs": [
                {
                  "key": "FieldType",
                  "value": "StringField"
                },
                {
                  "key": "Bio",
                  "value": "my bio"
                }
              ]
            },
            {}
          ]
        }
      }
    ]
  }
}

Here is the response in the main branch which is the same for ProfileFieldUpdated. (Note that it's necessary to run the main branch of tx-indexer against an older gno.land before the commit in PR gnolang/gno#4630 which changed the StorageDepositEvent.)

{
  "data": {
    "getTransactions": [
      {
        "response": {
          "events": [
            {
              "type": "ProfileFieldUpdated",
              "attrs": [
                {
                  "key": "FieldType",
                  "value": "StringField"
                },
                {
                  "key": "Bio",
                  "value": "my bio"
                }
              ]
            },
            {
              "type": "StorageDeposit",
              "attrs": [
                {
                  "key": "Deposit",
                  "value": "500ugnot"
                },
                {
                  "key": "Storage",
                  "value": "5 bytes"
                }
              ]
            }
          ]
        }
      }
    ]
  }
}

@D4ryl00 D4ryl00 requested a review from ajnavarro September 11, 2025 12:10
@D4ryl00 D4ryl00 marked this pull request as ready for review September 11, 2025 12:10
@Kouteki Kouteki requested a review from ajnavarro September 15, 2025 11:15
@ajnavarro ajnavarro merged commit f07348c into gnolang:main Sep 15, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

3 participants