solana-web3.js icon indicating copy to clipboard operation
solana-web3.js copied to clipboard

Add support for slot-based nested GraphQL queries

Open buffalojoec opened this issue 1 year ago • 1 comments

Motivation

We could go completely bananas with the GraphQL schema, and allow block queries anywhere there's a slot in a response.

Similar to how we've replaced any address fields with a queryable account, we can do the same for any slot fields, allowing even more query-chaining!

Details

It's actually pretty easy to implement, it would just require some minor redundancy for slot other than just being a bigint. This would behave exactly like account, where we're inserting address and only requesting the RPC if any other field is queried.

query myQuery {
  slot {
    slot
  }
}

buffalojoec avatar Nov 10 '23 10:11 buffalojoec