Add a wallet rpc endpoint to get in-use addresses for a particular wallet ID #14603
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Purpose:
Adds the ability to get in-use addresses for a particular wallet ID via the RPC.
Current Behavior:
Currently, there is not a straight forward way to get this, aside from iterating through all of the coins in the wallet and finding the unique puzzlehashes. Its another step to then determine if the address is observer or non-observer.
New Behavior:
New behavior adds an endpoint with a relatively simple query to get this data directly.
Testing Notes:
chia rpc wallet get_used_addresses
- Returns addresses for the (default) wallet_id 1chia rpc wallet get_used_addresses '{"wallet_id":3}'
- Returns addresses for wallet_id 3Example Response
Note that when testing, this worked fine for the normal XCH wallet and all my CAT wallets, but did not seem to work for NFT wallets. It doesn't appear that we store any data in
derivation_paths
for NFTs which is the joined table utilized to determine hardened or unhardened, so that would explain why no results come back for NFT wallets.