feat(sdk): add primary address control and fix address linking#9
Merged
feat(sdk): add primary address control and fix address linking#9
Conversation
Skip Algorand zero addresses (all bytes are zero) when parsing the verified `caAlgo` field in the `resolve` method. This prevents blank address slots from appearing in the `caAlgo` array when a user unlinks an address from their NFD. Added a reusable `isZeroBytes` utility function to check if a `Uint8Array` contains only zero bytes, which can be used in other parts of the codebase.
Add support for setting verified Algorand addresses as a comma-delimited string in the `verified.caAlgo` property, in addition to the existing array in the top-level `caAlgo` field.
This fixes a bug where linking non-owner addresses fails because the smart contract requires the address being linked to be the signer for verification. The previous implementation only worked when linking the owner's address, which is special-cased in the contract. - Modify `requireSigner` in base.ts to return the signer for use in methods - Update `linkAddress` and `unlinkAddress` to accept string or Address parameter - Add a signer for the address being linked if it's not the default signer - Update example app to use a dropdown of connected addresses - Improve validation to ensure only connected addresses can be linked - Enhance UI to show available addresses and handle edge cases
…amples Update the `Connect` component in other example projects to match the improvements made to the link-address example. Show full addresses in dropdown and improve the display of the active account.
Add functionality to set a specific address as the primary address for an NFD. This determines which address will resolve to the NFD in reverse lookups, giving users control over their primary identity association. The primary address is visually indicated with a blue badge in the UI for easy identification.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
This PR enhances the NFD SDK by adding primary address control and fixing address linking functionality. The primary address determines which address will resolve to the NFD in reverse lookups, giving users control over their primary identity association.
Details
setPrimaryAddressmethod to NfdManager for controlling which address is primaryrequireSignermethod to return the signer for use in methodsverified.caAlgoaddresses