Repository navigation
Add migrate scan command - #91
Conversation
b94ef94 to
bba340b
Compare
bba340b to
37ec638
Compare
7d6da90 to
4282c5b
Compare
4282c5b to
5f90e86
Compare
6972700 to
3bedc4f
Compare
3bedc4f to
549e6d4
Compare
joncinque
left a comment
There was a problem hiding this comment.
Looks great! Just a few questions, nothing stopping this from merging though
| if amount == 0 { | ||
| continue; | ||
| } |
There was a problem hiding this comment.
As mentioned in the previous PR on token accounts, we should still report accounts with 0 balance, but this can be changed at the same time as the token command
There was a problem hiding this comment.
Agreed, added a note on the tracking issue to update scan when we change migrate token there
| } | ||
| } | ||
| } | ||
| if scanned("sol") { |
There was a problem hiding this comment.
Sorry if I'm being dense, but why is this check only done here?
There was a problem hiding this comment.
It's because all the others return a Option<Vec>, that can distinguish between "error scanning tokens" (None), and "successful scan, nothing found" (empty Vec). Sol is an Option<SolScanItem>
I think a better model would be to keep the Result types to distinguish between Error and Ok(empty) consistently in each category, I'll try refactoring this.
There was a problem hiding this comment.
Ah yeah, that probably would be better, but we don't need to block landing this if you want to do it in a follow-up
There was a problem hiding this comment.
Refactored to better use Result throughout, which I think makes this simpler. We now just check if Ok(...) for each one, which is consistent.
I also made the command on SolScanItem optional, so we give the correct SOL balance even if migrate sol can't migrate it.
549e6d4 to
0afb833
Compare
joncinque
left a comment
There was a problem hiding this comment.
Any chance you could un-force-push this so I can see the changes between the last iteration and this one?
0afb833 to
821a651
Compare
|
@joncinque Sorry about that, I've split the changes into a fixup commit |
|
Cherry-picked from #98 to avoid needing another rebase/force push |
This command allows scanning for authorities/assets belonging to an address that can be migrated using our `migrate` CLI commands We use `getAccountInfo` for the SOL balance, `getTokenAccountsByOwner` for the token balances, and `getProgramAccounts` for the authorities. Output includes the items that can be migrated, and the `migrate` commands that can be run for them. An optional `--new-authority-signing-pubkey` arg sets that arg in each migrate command. Otherwise it is left out, so each command defaults to moving to the owner's own programmatic signer, or a placeholder is used if the owner is not on curve.
956949f to
305b1b3
Compare
This command allows scanning for authorities/assets belonging to an address that can be migrated using our
migrateCLI commandsWe use
getAccountInfofor the SOL balance,getTokenAccountsByOwnerfor the token balances, andgetProgramAccountsfor the authorities.Output includes the items that can be migrated, and the
migratecommands that can be run for them. An optional--new-authority-signing-pubkeyarg sets that arg in each migrate command. Otherwise it is left out, so each command defaults to moving to the owner's own programmatic signer, or a placeholder is used if the owner is not on curve.Note that in my testing both Triton and Helius fail on scanning mints, but work for the others. I assume this is because they block GPA on the token programs. But I've included the feature to cover everything we have
migratecommands for, and I figure that some users of durable nonces/this CLI might have some custom RPC infrastructure. The command is structured to do each scan independently and display which ones errored, while providing the data for those that succeeded.