Skip to content

Commit

Permalink
sui-graphql-client: make dynamic field queries using owner (#54)
Browse files Browse the repository at this point in the history
  • Loading branch information
stefan-mysten authored Nov 1, 2024
1 parent 79a0ed6 commit 0db436f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
2 changes: 1 addition & 1 deletion crates/sui-graphql-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,7 @@ impl Client {

let result = response
.data
.and_then(|d| d.object)
.and_then(|d| d.owner)
.and_then(|o| o.dynamic_field)
.map(|df| df.try_into())
.transpose()
Expand Down
10 changes: 3 additions & 7 deletions crates/sui-graphql-client/src/query_types/dynamic_fields.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,12 @@ pub struct ObjectOwner {
#[cynic(schema = "rpc", graphql_type = "Query", variables = "DynamicFieldArgs")]
pub struct DynamicFieldQuery {
#[arguments(address: $address)]
pub object: Option<ObjectField>,
pub owner: Option<OwnerField>,
}

#[derive(cynic::QueryFragment, Debug)]
#[cynic(
schema = "rpc",
graphql_type = "Object",
variables = "DynamicFieldArgs"
)]
pub struct ObjectField {
#[cynic(schema = "rpc", graphql_type = "Owner", variables = "DynamicFieldArgs")]
pub struct OwnerField {
#[arguments(name: $name)]
pub dynamic_field: Option<DynamicField>,
}
Expand Down

0 comments on commit 0db436f

Please sign in to comment.