feat(sdk): add NFD purchasing and claiming API#15
Merged
Conversation
Add comprehensive purchasing module enabling NFD claiming and secondary market purchases through the SDK. Introduces `PurchasingModule` class with methods for getting purchase quotes, claiming reserved NFDs, and buying NFDs from the secondary market. Key features: - `getPurchaseQuote()` - Get pricing and eligibility information - `claim()` - Claim NFDs reserved for specific addresses - `buy()` - Purchase NFDs from secondary market - `canClaim()`/`canBuy()` - Validation helpers for purchase eligibility - Integration with existing `NFDInstanceClient.purchase()` method Includes comprehensive test suite with 23 tests covering all purchase scenarios including validation, pricing calculations, and transaction flows. Tests use proper contract patterns with `newGroup().purchase()` and `staticFee` configuration. Add `claim-nfd` example application demonstrating real-world usage with wallet connection, reserved NFD search, and claiming workflow. Updates examples README with new claim example documentation. Export new purchasing types and integrate purchasing module into main `NfdClient` via `purchasing()` method for consistent API access patterns.
Move purchasing methods directly to `NfdClient` for cleaner API usage.
Users can now call `nfd.claim()` and `nfd.buy()` directly instead of
accessing the purchasing module. The client automatically uses the
signer's address and resets the signer after operations.
Before: `nfd.purchasing().claim(name, {claimer: address})`
After: `nfd.claim(name)`
Remove parameter interfaces `NfdClaimParams` and `NfdBuyParams` from
public exports. Update example app to demonstrate the simplified API.
Add comprehensive examples for the new simplified purchasing API (`claim` and `buy` methods) to both root and package README files. Update `claim-nfd` example documentation to correctly reflect that claiming may have costs based on NFD pricing rather than being free. Examples demonstrate the streamlined API where signer address is automatically used without requiring explicit parameter passing.
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 introduces comprehensive NFD purchasing functionality to the SDK, enabling users to claim reserved NFDs and buy NFDs from the secondary market. The implementation includes a streamlined API where users can call
nfd.claim()andnfd.buy()directly from the main client, with automatic signer address usage.Details
PurchasingModulewith methods for purchase quotes, claiming, and buying NFDsclaim(),buy(),getPurchaseQuote())claim-nfdexample application demonstrating real-world usageNFDInstanceClient.purchase()method using proper contract patterns