-
Notifications
You must be signed in to change notification settings - Fork 925
refactor(experimental-graphql): revise accounts schema (again) #1837
refactor(experimental-graphql): revise accounts schema (again) #1837
Conversation
Current dependencies on/for this PR:
This stack of pull requests is managed by Graphite. |
2576806
to
6b0007e
Compare
6b0007e
to
4bf0715
Compare
We're still going to want to sort out this comment here from the previous PR. I'm not sure if blocking the ability to specify encoding for these nested accounts is the way. |
feeCalculator { | ||
lamportsPerSignature | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tangent; this is hella deprecated right? Should we do something else here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hah, I didn't check if it was deprecated 😅
Something different, like, take it out completely?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Take it out if there's no non-deprecated way to get at it, or flatten it down to the same level as blockhash
and give it a good name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I've been digging around and I don't see any evidence this is deprecated. Do you have any links? Also threw a flare up in Discord.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I pushed up a revised version! Lmk what you think. |
4bf0715
to
9b11e3c
Compare
1781287
to
4888367
Compare
9b11e3c
to
97ae5ba
Compare
4888367
to
3348cdc
Compare
97ae5ba
to
0135a4d
Compare
0135a4d
to
f6ed442
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -304,14 +310,11 @@ describe('account', () => { | |||
const source = /* GraphQL */ ` | |||
query testQuery($address: String!) { | |||
account(address: $address, encoding: PARSED) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, here's how I think about this.
People should just straight up not be bothered with these fetch modes. It should just never surface in the GraphQL API.
I should absolutely not give a shit about specifying an encoding, I should just do this.
account(address: "123") {
... on MintAccount {
supply
}
}
…and if that requires that we ask the RPC to parse the data using the jsonParsed
mode, so be it.
To be pedantic, if we detect the presence of subselections in the query that we can't possibly fulfil except by fetching the thing in jsonParsed
mode, then we should fetch the account in jsonParsed
mode. Otherwise, we shouldn't.
If I really want the underlying buffer, then we can offer this:
account(address: "123") {
data(encoding: BASE64)
}
Then we fetch it with the base64 encoding.
What if someone does this totally legal query?
account(address: "123") {
compressedBase64Data: data(encoding: BASE64_ZSTD)
base64Data: data(encoding: BASE64)
... on MintAccount {
supply
}
}
Yep. We have to make that underlying fetch three times with the current JSON RPC API.
Except when we rewrite the RPC, we can make this more efficient, and get all of the data in one shot.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, I like this. jsonParsed
is already the default here, so you don't need to specify any encodings unless you want a buffer, but this is a much better way to handle the encoded stuff. Nice.
Will definitely roll this into a new PR.
feeCalculator { | ||
lamportsPerSignature | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Take it out if there's no non-deprecated way to get at it, or flatten it down to the same level as blockhash
and give it a good name.
... on AccountBase64Zstd { | ||
address | ||
data | ||
executable | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Much preferable to do data(encoding: AccountEncoding)
.
f6ed442
to
4f4f790
Compare
4f4f790
to
d78cf2d
Compare
Merge activity
|
Because there has been no activity on this PR for 14 days since it was merged, it has been automatically locked. Please open a new issue if it requires a follow up. |
This PR attempts to revise the accounts schema, as per #1831.