feat: default unitsToFill to 1 for offers and listings, add includePrivateListings parameter #1809
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.
Summary
This PR includes two main features:
unitsToFillto"1"for both listings and offersincludePrivateListingsparameter to all listing endpoints to match backend API changesChanges
1. unitsToFill Default Behavior
Before
remaining_quantity(API-side)1(API-side)undefinedwhenunitsToFillwas not specifiedAfter
"1"whenunitsToFillis not specified2. includePrivateListings Parameter
Added support for
include_private_listingsquery parameter to all listing endpoints:getBestListing- get best listing for a specific NFTgetBestListings- get best listings for a collectiongetAllListings- get all listings for a collectiongetNFTListings- get all listings for a specific NFTThis aligns the SDK with backend API changes that add
include_private_listingssupport to:GET /api/v2/listings/collection/{slug}/bestGET /api/v2/listings/collection/{slug}/nfts/{tokenId}/bestGET /api/v2/listings/collection/{slug}/allGET /api/v2/chain/{chain}/protocol/{protocol}/ordersModified Files
unitsToFill Changes:
src/sdk.ts,src/sdk/fulfillment.ts, andsrc/api/api.tssrc/sdk/fulfillment.tsunitsToFillto"1"instead ofundefinedsrc/orders/utils.tsgetFulfillListingPayloadandgetFulfillOfferPayloadto use default parametersunits_to_fillfrom optional to required in payload typesunits_to_fillin payload (no conditional check)test/sdk/fulfillmentManager.spec.tsandtest/orders/utils.spec.tsundefinedto"1"includePrivateListings Changes:
src/api/listings.tsincludePrivateListingsparameter togetAllListings,getBestListing,getBestListings, andgetNFTListingssrc/api/api.tsincludePrivateListingsparametertest/integration/fulfillBestListing.spec.tsinclude_private_listings=trueVersion:
package.json8.0.5Test Plan
unitsToFillnow defaults to"1"Notes
BigNumberish(number, BigInt, or string) forunitsToFillfor developer convenience"1"(e.g., defaulting listings to remaining_quantity if needed)includePrivateListingsdefaults tofalsefor backward compatibility