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

Rebase UX/tokens-rebase on top of Anchor decode changes #164

Closed
wants to merge 7 commits into from

Conversation

nathanleclaire
Copy link
Contributor

Since #123 and #152 fiddle heavily with AccountView and displaying decoded account data, it's best to reconcile them now. This PR rolls main and #154 into #152. You may want to open a third PR just in case because I squashed all of your commits into one in this one to avoid rebase hell.

#154 will need to be merged into main for this one as well.

Description of actual changes:

  • Use both useWallet (for mint creation, etc) and useAnchorWallet for decoding in AccountView
  • Move all account decoding out of component into renderAccountData

Pretty stoked about these developments cause it's starting to make peering into the accounts tons more usable . LFG 🚀

nathanleclaire and others added 7 commits July 1, 2022 19:11
@SvenDowideit
Copy link
Member

yup, gotta do some poking.

@SvenDowideit
Copy link
Member

I think I'll look into this tomorrow - thanks - will use it as a basis for figuring out where we overlap

@@ -51,20 +58,21 @@ export async function getAccount(

const solConn = new sol.Connection(netToURL(net));
const key = new sol.PublicKey(pubKey);
const solAccount = await solConn.getAccountInfo(key);
// const solAccount = await solConn.getAccountInfo(key);
const solAccount = await solConn.getParsedAccountInfo(key);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mm, i'll have to see how this plays with the new getMultipleAccountInfo method ... that RPC endpoint accepts a jsonparsed arg, so theoretically I see now reason why it wouldn't get parsed, but there's no getParsedMultipleAccountInfo in web3.js :|

Copy link
Contributor Author

@nathanleclaire nathanleclaire Jul 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/solana-labs/solana-web3.js/blob/master/src/connection.ts#L2862

hardcode to base64 and not any option for jsonParsed, gah WHY

Copy link
Contributor Author

@nathanleclaire nathanleclaire Jul 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sigh, yea, I can get parsed result from getMultipleAccountsInfo, but it blows up on some type of struct validation they do after it returns.

Screen Shot 2022-07-07 at 1 57 31 PM

Screen Shot 2022-07-07 at 1 57 41 PM

To get a parsed version of getMultipleAccounts, I'm afraid we might have to duplicate the underlying web3.js code (cringe). Which seems relatively doable by calling those underlying methods like _buildArgs fwiw. Though I can't say exactly what makes the result unsafe and if that's a type safety or a security safety concern.

Alternatively -- since for now I think we mostly want to have decoded accounts for AccountView, i.e., one at a time -- we could change the 'legacy' getAccount interval in AccountView to be a slower poll that calls getParsedAccountInfo for the specific account that's being highlighted -- that would unblock this for now

I did kinda want to display token information within a smaller embedded view in accounts list though :|

I'm gonna make an issue to track this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SvenDowideit
Copy link
Member

yup, i did it my way :)

but i need to figure out how to make the update of accounts being viewed make sense

its like a shared state cache :/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants