Skip to content

feat(sdk): add NfdManager w/ linkAddress and setMetadata #1

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

Merged
merged 5 commits into from
Mar 4, 2025

Conversation

drichar
Copy link
Contributor

@drichar drichar commented Mar 4, 2025

Description

This PR introduces the NfdManager class to the NFD SDK, providing direct management capabilities for NFDs. It adds support for linking/unlinking Algorand addresses to NFDs and managing user-defined metadata, along with two new example applications demonstrating these features.

Details

  • Added NfdManager class with methods for:
    • linkAddress: Connect Algorand addresses to an NFD
    • unlinkAddress: Remove linked addresses
    • setMetadata: Manage user-defined metadata
  • Implemented utility functions for byte array operations
  • Added transaction error parser for user-friendly error messages
  • Created two new example applications:
    • link-address: Demonstrates linking and unlinking Algorand addresses
    • set-metadata: Shows how to set, update, and delete user-defined metadata with support for multiple fields in a single transaction
  • Added comprehensive README files for both examples
  • Exposed manager functionality through the NfdClient.manage() method
  • Ensured proper fee handling to prevent transaction failures

drichar added 3 commits March 4, 2025 03:31
This utility provides user-friendly error messages for common Algorand
transaction errors:
- Adds `parseTransactionError` function that uses regex-based parsing for
  specific error types
- Extracts detailed information for errors like insufficient balance
  (including account address, available balance, and required balance)
- Provides `withErrorParsing` higher-order function to wrap async functions
  with error parsing
- Includes documentation and examples for better understanding
This commit introduces the `NfdManager` class to provide direct management
capabilities for NFDs:
- Adds `linkAddress` method to connect Algorand addresses to an NFD
- Adds `unlinkAddress` method to remove linked addresses
- Adds `setMetadata` method to manage user-defined metadata
- Implements utility functions for byte array operations
- Integrates with error parser for user-friendly error messages
- Exposes manager functionality through the `NfdClient.manage()` method
This commit adds two new example projects demonstrating core NFD SDK features:
- `link-address`: Demonstrates how to link and unlink Algorand addresses to NFDs
- `set-metadata`: Shows how to set, update, and delete user-defined metadata
  with support for multiple fields in a single transaction

Both examples include:
- Complete React-based UI with wallet connection
- Error handling using the new transaction error parser
- Comprehensive README files with setup and usage instructions
- Proper fee handling to ensure transactions succeed
@drichar drichar changed the title feat(sdk): add NfdManager with address linking and metadata management feat(sdk): add NfdManager w/ linkAddress and setMetadata Mar 4, 2025
drichar added 2 commits March 4, 2025 10:07
Update the site names in the wallet manager configuration for the
link-address and set-metadata examples to correctly reflect their
respective purposes instead of using "NFD SDK Mint Example".
Add explicit 'public' modifiers to the `linkAddress`, `unlinkAddress`, and
`setMetadata` methods in the `NfdManager` class for better code readability
and consistency with TypeScript best practices.
@drichar drichar merged commit 87ffbb0 into main Mar 4, 2025
1 check passed
@drichar drichar deleted the feat/set-metadata-and-link-addresses branch March 4, 2025 15:24
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.

1 participant