Skip to content
This repository has been archived by the owner on Jan 13, 2025. It is now read-only.

[GraphQL]: Add support for signature-based nested queries #2616

Closed
buffalojoec opened this issue May 4, 2024 · 2 comments
Closed

[GraphQL]: Add support for signature-based nested queries #2616

buffalojoec opened this issue May 4, 2024 · 2 comments
Labels
enhancement New feature or request GraphQL

Comments

@buffalojoec
Copy link
Contributor

Motivation

Throughout the GraphQL schema, fields populated by an Address have been
given the type Account, which enabled nested queries on that address. Take,
for example, a lookup table account.

"""
A lookup table account
"""
type LookupTableAccount implements Account {
    address: Address
    data(encoding: AccountEncoding!, dataSlice: DataSlice): String
    executable: Boolean
    lamports: BigInt
    ownerProgram: Account
    space: BigInt
    rentEpoch: BigInt
    addresses: [Address]
    authority: Account
    deactivationSlot: String
    lastExtendedSlot: String
    lastExtendedSlotStartIndex: Int
}

You can see fields like ownerProgram and authority are queryable as
Account types, allowing full account queries to be performed on these nested
fields.

We can enable the same types of nested queries for transaction on any fields that
are populated with Signature.

Details

This is actually quite trivial to implement, given the relationship of type definitions
and resolvers defined in this library. Here's an example.

"""
A Solana block
"""
type Block {
    blockhash: String
    blockHeight: BigInt
    blockTime: BigInt
    parentSlot: Slot
    previousBlockhash: String
    rewards: [Reward]
    signatures: [Signature]
    transactions: [Transaction]
}

If the signatures field was changed to signatures: [Transaction], we could
enable this nesting on Block, for example.

Block: {
    signatures: resolveMultipleTransactions('signatures'),
},

However, there's a few important points about this approach.

  1. There aren't many fields of type Signature.
  2. Fields with lists of signatures will need to adhere to the same limitations as solana-labs/web3.js-issue-conveyer#16.

Not to mention the fact that with the Block example here, someone could just query
the transactions field on Block directly, however something like matching on a
specific transaction signature
` could be useful here.

@buffalojoec buffalojoec added enhancement New feature or request GraphQL labels May 4, 2024
@buffalojoec buffalojoec added this to the GraphQL Debut milestone May 4, 2024
@buffalojoec
Copy link
Contributor Author

Closing for now, since there's literally none of these.

@buffalojoec buffalojoec closed this as not planned Won't fix, can't repro, duplicate, stale May 5, 2024
Copy link
Contributor

Because there has been no activity on this issue for 7 days since it was closed, it has been automatically locked. Please open a new issue if it requires a follow up.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request GraphQL
Projects
None yet
Development

No branches or pull requests

1 participant