Skip to content

Conversation

@drichar
Copy link
Contributor

@drichar drichar commented Mar 8, 2025

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

  • Add setPrimaryAddress method to NfdManager for controlling which address is primary
  • Fix bug in address linking where non-owner addresses couldn't be linked
  • Update requireSigner method to return the signer for use in methods
  • Improve handling of zero addresses in lookup module
  • Add comma-delimited string representation of verified.caAlgo addresses

drichar added 5 commits March 8, 2025 01:29
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.
@drichar drichar merged commit b80aaa0 into main Mar 8, 2025
1 check passed
@drichar drichar deleted the feat/set-primary-address branch March 8, 2025 08:09
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.

2 participants