Skip to content

Conversation

@drichar
Copy link
Contributor

@drichar drichar commented Jul 8, 2025

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() and nfd.buy() directly from the main client, with automatic signer address usage.

Details

  • Added PurchasingModule with methods for purchase quotes, claiming, and buying NFDs
  • Implemented simplified API with direct client methods (claim(), buy(), getPurchaseQuote())
  • Created comprehensive test suite with 23 tests covering all purchase scenarios
  • Added claim-nfd example application demonstrating real-world usage
  • Updated documentation with purchasing examples in both root and package README files
  • Corrected claiming cost information (no longer free, calculated based on NFD pricing)
  • Integrated with existing NFDInstanceClient.purchase() method using proper contract patterns
  • Automatic signer address usage eliminates need for explicit parameter passing
  • Signer automatically resets after operations for security

drichar added 3 commits July 8, 2025 01:06
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.
@drichar drichar merged commit b3ca1eb into main Jul 8, 2025
1 check passed
@drichar drichar deleted the feat/purchase-module branch July 8, 2025 06:08
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