Skip to content

Commit

Permalink
[doc] fix: using-events graphql error (#20618)
Browse files Browse the repository at this point in the history
## Description 

The GraphQL in [Query events with
GraphQL](https://docs.sui.io/guides/developer/sui-101/using-events#query-events-with-graphql)
has error

## Test plan 
1.
[crates/sui-graphql-rpc/examples/event_connection/event_connection.graphql](https://github.com/MystenLabs/sui/tree/main/crates/sui-graphql-rpc/examples/event_connection/event_connection.graphql)
and
[crates/sui-graphql-rpc/examples/event_connection/filter_by_sender.graphql](https://github.com/MystenLabs/sui/tree/main/crates/sui-graphql-rpc/examples/event_connection/filter_by_sender.graphql)

throw the error

```json
{
  "data": null,
  "errors": [
    {
      "message": "Unknown field \"type\" on type \"Event\".",
      "locations": [
        {
          "line": 18,
          "column": 7
        }
      ]
    },
    {
      "message": "Unknown field \"json\" on type \"Event\".",
      "locations": [
        {
          "line": 25,
          "column": 7
        }
      ]
    }
  ]
}
```

need to be modified to
```
contents {
  type {
    repr
  }
  json
}
```

2.
[crates/sui-graphql-rpc/examples/event_connection/filter_by_emitting_package_module_and_event_type.graphql](https://github.com/MystenLabs/sui/tree/main/crates/sui-graphql-rpc/examples/event_connection/filter_by_emitting_package_module_and_event_type.graphql)

throw the error

```json
{
  "data": null,
  "errors": [
    {
      "message": "Filtering by both emitting module and event type is not supported",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "path": [
        "events"
      ],
      "extensions": {
        "code": "BAD_USER_INPUT"
      }
    }
  ]
}
```

Read the [EventFilter.emittingModule
doc](https://docs.sui.io/references/sui-api/sui-graphql/reference/types/inputs/event-filter#eventfilteremittingmodulestring-),
it says `We currently do not support filtering by emitting module and
event type at the same time so if both are provided in one filter, the
query will error.`.

So I think the doc need to delete the example `[Filter events by
emitting package and type]`

---

## Release notes

Check each box that your changes affect. If none of the boxes relate to
your changes, release notes aren't required.

For each box you select, include information after the relevant heading
that describes the impact of your changes that a user might notice and
any actions they must take to implement updates.

- [ ] Protocol: 
- [ ] Nodes (Validators and Full nodes): 
- [ ] Indexer: 
- [ ] JSON-RPC: 
- [ ] GraphQL: 
- [ ] CLI: 
- [ ] Rust SDK:
- [ ] REST API:
  • Loading branch information
klren0312 authored Dec 13, 2024
1 parent db834d8 commit 531a6d7
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,17 @@
name
package { digest }
}
type {
repr
}
sender {
address
}
timestamp
json
contents {
type {
repr
}
json
}
bcs
}
}
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,16 @@ query ByTxSender {
sendingModule {
name
}
type {
repr
contents {
type {
repr
}
json
}
sender {
address
}
timestamp
json
bcs
}
}
Expand Down
7 changes: 0 additions & 7 deletions docs/content/guides/developer/sui-101/using-events.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -311,13 +311,6 @@ Filter events by sender
{@inject: crates/sui-graphql-rpc/examples/event_connection/filter_by_sender.graphql}
</details>

<details>
<summary>
Filter events by emitting package and type
</summary>
{@inject: crates/sui-graphql-rpc/examples/event_connection/filter_by_emitting_package_module_and_event_type.graphql}
</details>

The [TypeScript SDK](https://sdk.mystenlabs.com/typedoc/modules/_mysten_sui.graphql.html) provides functionality to interact with the Sui GraphQL service.

## Monitoring events
Expand Down

0 comments on commit 531a6d7

Please sign in to comment.