Skip to content

feat(graphql-client): add GraphQlRequestInspector#1056

Draft
Thoralf-M wants to merge 1 commit intodevelopfrom
feat/request-inspector
Draft

feat(graphql-client): add GraphQlRequestInspector#1056
Thoralf-M wants to merge 1 commit intodevelopfrom
feat/request-inspector

Conversation

@Thoralf-M
Copy link
Copy Markdown
Member

@Thoralf-M Thoralf-M commented Apr 2, 2026

Add a request inspector:

cargo run --example inspector

[inspector] ChainIdentifierQuery @ https://graphql.testnet.iota.cafe/
[inspector] query: query ChainIdentifierQuery {
  chainIdentifier
}
[inspector] variables: null
[inspector] response: {"data":{"chainIdentifier":"2304aa97"}}
[inspector] -> OK (86.0ms)
Chain ID: 2304aa97
[inspector] ObjectQuery @ https://graphql.testnet.iota.cafe/
[inspector] query: query ObjectQuery($objectId: IotaAddress!, $version: UInt53) {
  object(address: $objectId, version: $version) {
    asMoveObject {
      contents {
        type {
          repr
        }
        bcs
        json
      }
    }
    bcs
  }
}
[inspector] variables: {"objectId":"0x541b117cac18fb1c07a293db300acd12b05c01fa81232b37151b005ca7d4f755","version":null}
[inspector] response: {"data":{"object":{"asMoveObject":{"contents":{"type":{"repr":"0x7fff6e95f385349bec98d17121ab2bfa3e134f2f0b1ccefc270313415f7835ea::iota_names::AdminCap"},"bcs":"VBsRfKwY+xwHopPbMArNErBcAfqBIys3FRsAXKfU91U=","json":{"id":"0x541b117cac18fb1c07a293db300acd12b05c01fa81232b37151b005ca7d4f755"}}},"bcs":"AAB//26V84U0m+yY0XEhqyv6PhNPLwsczvwnAxNBX3g16gppb3RhX25hbWVzCEFkbWluQ2FwABkmdR4AAAAAIFQbEXysGPscB6KT2zAKzRKwXAH6gSMrNxUbAFyn1PdVAFSEdDYPl2kHfM8H/25lBg60SEcOq8GuQrntNx3b/CPSIDsQZtjrRkntm/QEmfXGuJZ+eddhSiGYf1b7G/Wo5+AJoC0UAAAAAAA="}}}
[inspector] -> OK (25.7ms)
Object ID: 0x541b117cac18fb1c07a293db300acd12b05c01fa81232b37151b005ca7d4f755

@Thoralf-M Thoralf-M force-pushed the feat/request-inspector branch from 2e314cc to 33a6c68 Compare April 2, 2026 08:40
@Thoralf-M Thoralf-M force-pushed the feat/request-inspector branch from 33a6c68 to 3ae92be Compare April 2, 2026 08:58
Copy link
Copy Markdown
Contributor

@Alex6323 Alex6323 left a comment

Choose a reason for hiding this comment

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

Interesting ... How do errors like? Can it improve debugging?

@Thoralf-M
Copy link
Copy Markdown
Member Author

Interesting ... How do errors like? Can it improve debugging?

    let json = serde_json::json!({
        "query": r#"
          query getLatestIotaSystemState {
            epoch {
              epochIdd
            }
          }
        "#,
        "variables": {}
    })
    .as_object()
    .unwrap()
    .clone();
    let response = client.run_query_from_json(json).await?;
    println!("{response:?}");
[inspector] <unnamed> @ https://graphql.testnet.iota.cafe/
[inspector] query: query getLatestIotaSystemState {
            epoch {
              epochIdd
            }
          }
[inspector] variables: {}
[inspector] response: {"data":null,"errors":[{"message":"Unknown field \"epochIdd\" on type \"Epoch\". Did you mean \"epochId\"?","locations":[{"line":4,"column":15}]}]}
[inspector] -> ERROR (22.3ms): Query error: [Unknown field "epochIdd" on type "Epoch". Did you mean "epochId"?]
GraphQlResponse { data: None, errors: Some([GraphQlError { message: "Unknown field \"epochIdd\" on type \"Epoch\". Did you mean \"epochId\"?", locations: Some([GraphQlErrorLocation { line: 4, column: 15 }]), path: None, extensions: None }]) }

Yes can help with debugging, for Rust one would probably prefer to use tracing, but that's not available in bindings

Copy link
Copy Markdown
Contributor

@Alex6323 Alex6323 left a comment

Choose a reason for hiding this comment

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

Good point. Seems useful to me then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants