Open nickfrosty opened 3 days ago
Interesting.
This gives encoding
in the autocomplete:
.getAccountInfo("nick6zJc6HpW3kfBm4xS2dmbuVRyb5F3AnUvj5ymzR5", {})
This does not:
.getAccountInfo(address("nick6zJc6HpW3kfBm4xS2dmbuVRyb5F3AnUvj5ymzR5"), {})
space
is missing from AccountInfoBase
https://github.com/solana-labs/solana-web3.js/blob/a5a3690fdd63849a85b8f582f2351237cbddde9d/packages/rpc-types/src/account-info.ts#L11-L20 cc/ @lorisleiva who last touched this.
These docs say size
when presumably they mean space
, @nickfrosty?
@steveluscher Oh weird, I've checked everywhere and I can't find record of us ever using the size
or space
attribute on base account types. Doing a quick call to mainnet and I can see the attribute as space
. Should I add it?
Yeah, so long as it’s actually there, everywhere we use AccountInfoBase, I guess it’s time, @lorisleiva!
Okay I've just checked everywhere we use this AccountInfoBase
in the code and compared each one with the docs. The conclusion is: they all return a space
attribute of type u64
and some of them are mislabelled in the docs (not in the code example but in the written documentation on the left column). Here's the exhaustive list:
getAccountInfo
method (mislabelled as size
in the docs).getMultipleAccounts
methodgetProgramAccounts
method (mislabelled as size
in the docs).getTokenAccountsByDelegate
method (mislabelled as size
in the docs).getTokenAccountsByOwner
method (mislabelled as size
in the docs).accountSubscribe
notificationsprogramSubscribe
notificationsI'll now work on a PR that adds the space
attribute to AccountInfoBase
. Thank you for raising this!
These docs say
size
when presumably they meanspace
, @nickfrosty?
looks like it, I will get those docs updated today!
@lorisleiva I will get these updated in the docs. I have had it on the todo list to comb through all the rpc docs and validate the inputs and responses for too long now. https://github.com/solana-labs/solana-web3.js/issues/3569#issuecomment-2478289388 - I will get all these specific ones updated now :)
Overview
the
rpc.getAccountInfo()
function is:encoding
field in the config (see image 1)space
field in the returned value (see image 2)Steps to reproduce
use the
getAccountInfo
rpc method:Description of bug
the
rpc.getAccountInfo()
function should accept all the config settings for thegetAccountInfo
rpc methodand the response value should be typed to all response fields