Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getBlock with jsonParsed using solana-web3.js throws error #28321

Closed
a26nine opened this issue Oct 10, 2022 · 1 comment
Closed

getBlock with jsonParsed using solana-web3.js throws error #28321

a26nine opened this issue Oct 10, 2022 · 1 comment
Labels
community Community contribution

Comments

@a26nine
Copy link
Contributor

a26nine commented Oct 10, 2022

As we know that Solana is going to activate Versioned Transactions in the upcoming epoch with the support for lookup tables.

This feature activation would affect two methods:

  1. getBlock
  2. getTransaction

With the new response structure and additional objects, the team has recommended to use jsonParsed encoding instead of json, so that all the transactions account keys including those from lookup tables are found in the accountKeys object itself.

While this is possible when making HTTP POST requests directly, it's not possible (for the getBlock method) using the solana-web3.js library. solana-web3.js has a getParsedTransaction method that is basically getTransaction with jsonParsed, but there's no similar option for getBlock. And, if we pass the encoding parameter as jsonParsed with the GetBlockConfig object of the getBlock method, it throws an error:

StructError: At path: transactions.0.transaction.message.accountKeys.0 -- Expected a string, but received: [object Object]

For e.g.,

const blockData = await solana.getBlock(latestBlock, {
    encoding: 'json',
    maxSupportedTransactionVersion: 0,
});

will throw

Screenshot 2022-10-10 at 09 19 32

Screenshot 2022-10-10 at 09 24 27

Is it possible to add something like getParsedBlock or make changes to the GetBlockConfig to accept jsonParsed encoding?

@a26nine a26nine added the community Community contribution label Oct 10, 2022
@a26nine
Copy link
Contributor Author

a26nine commented Oct 13, 2022

#28345 by @jstarry adds a dedicated parsed method getParsedBlock. 🙌🏻

@a26nine a26nine closed this as completed Oct 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community Community contribution
Projects
None yet
Development

No branches or pull requests

1 participant