diff --git a/package-lock.json b/package-lock.json index b3fcb75bf..b0324bc81 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "opensea-js", - "version": "7.0.7", + "version": "7.0.8", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "opensea-js", - "version": "7.0.7", + "version": "7.0.8", "hasInstallScript": true, "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index e6ab7e8d7..c1452b74d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "opensea-js", - "version": "7.0.7", + "version": "7.0.8", "description": "TypeScript SDK for the OpenSea marketplace helps developers build new experiences using NFTs and our marketplace data", "license": "MIT", "author": "OpenSea Developers", @@ -76,14 +76,14 @@ "crypto", "ethereum", "javascript", - "typescript", "marketplace", "nft", "node", - "non-fungible-tokens", - "project-opensea", + "non-fungible tokens", + "opensea", "sdk", - "smart-contracts" + "smart contracts", + "typescript" ], "engines": { "node": ">=16.0.0" diff --git a/src/sdk.ts b/src/sdk.ts index 7b235ae77..653398782 100644 --- a/src/sdk.ts +++ b/src/sdk.ts @@ -256,14 +256,19 @@ export class OpenSeaSDK { paymentTokenAddress, startAmount, endAmount, + excludeOptionalCreatorFees, }: { collection: OpenSeaCollection; seller?: string; paymentTokenAddress: string; startAmount: bigint; endAmount?: bigint; + excludeOptionalCreatorFees?: boolean; }): Promise { - const collectionFees = collection.fees; + let collectionFees = collection.fees; + if (excludeOptionalCreatorFees) { + collectionFees = collectionFees.filter((fee) => fee.required); + } const collectionFeesBasisPoints = totalBasisPointsForFees(collectionFees); const sellerBasisPoints = INVERSE_BASIS_POINT - collectionFeesBasisPoints; @@ -320,6 +325,7 @@ export class OpenSeaSDK { * @param options.salt Arbitrary salt. If not passed in, a random salt will be generated with the first four bytes being the domain hash or empty. * @param options.expirationTime Expiration time for the order, in UTC seconds * @param options.paymentTokenAddress ERC20 address for the payment token in the order. If unspecified, defaults to WETH + * @param options.excludeOptionalCreatorFees If true, optional creator fees will be excluded from the offer. Default: false. * @returns The {@link OrderV2} that was created. * * @throws Error if the asset does not contain a token id. @@ -336,6 +342,7 @@ export class OpenSeaSDK { salt, expirationTime, paymentTokenAddress = getWETHAddress(this.chain), + excludeOptionalCreatorFees = false, }: { asset: AssetWithTokenId; accountAddress: string; @@ -345,6 +352,7 @@ export class OpenSeaSDK { salt?: BigNumberish; expirationTime?: BigNumberish; paymentTokenAddress?: string; + excludeOptionalCreatorFees?: boolean; }): Promise { await this._requireAccountIsAvailable(accountAddress); @@ -367,6 +375,7 @@ export class OpenSeaSDK { collection, paymentTokenAddress, startAmount: basePrice, + excludeOptionalCreatorFees, }); const { executeAllActions } = await this.seaport_v1_5.createOrder( @@ -414,6 +423,7 @@ export class OpenSeaSDK { * @param options.paymentTokenAddress ERC20 address for the payment token in the order. If unspecified, defaults to ETH * @param options.buyerAddress Optional address that's allowed to purchase this item. If specified, no other address will be able to take the order, unless its value is the null address. * @param options.englishAuction If true, the order will be listed as an English auction. + * @param options.excludeOptionalCreatorFees If true, optional creator fees will be excluded from the listing. Default: false. * @returns The {@link OrderV2} that was created. * * @throws Error if the asset does not contain a token id. @@ -434,6 +444,7 @@ export class OpenSeaSDK { paymentTokenAddress = ethers.ZeroAddress, buyerAddress, englishAuction, + excludeOptionalCreatorFees = false, }: { asset: AssetWithTokenId; accountAddress: string; @@ -447,6 +458,7 @@ export class OpenSeaSDK { paymentTokenAddress?: string; buyerAddress?: string; englishAuction?: boolean; + excludeOptionalCreatorFees?: boolean; }): Promise { await this._requireAccountIsAvailable(accountAddress); @@ -475,6 +487,7 @@ export class OpenSeaSDK { paymentTokenAddress, startAmount: basePrice, endAmount: endPrice, + excludeOptionalCreatorFees, }); if (buyerAddress) { @@ -523,6 +536,7 @@ export class OpenSeaSDK { * @param options.salt Arbitrary salt. If not passed in, a random salt will be generated with the first four bytes being the domain hash or empty. * @param options.expirationTime Expiration time for the order, in UTC seconds. * @param options.paymentTokenAddress ERC20 address for the payment token in the order. If unspecified, defaults to WETH. + * @param options.excludeOptionalCreatorFees If true, optional creator fees will be excluded from the offer. Default: false. * @returns The {@link CollectionOffer} that was created. */ public async createCollectionOffer({ @@ -533,7 +547,8 @@ export class OpenSeaSDK { domain, salt, expirationTime, - paymentTokenAddress, + paymentTokenAddress = getWETHAddress(this.chain), + excludeOptionalCreatorFees = false, }: { collectionSlug: string; accountAddress: string; @@ -543,6 +558,7 @@ export class OpenSeaSDK { salt?: BigNumberish; expirationTime?: number | string; paymentTokenAddress: string; + excludeOptionalCreatorFees?: boolean; }): Promise { await this._requireAccountIsAvailable(accountAddress); @@ -571,6 +587,7 @@ export class OpenSeaSDK { paymentTokenAddress, startAmount: basePrice, endAmount: basePrice, + excludeOptionalCreatorFees, }); const considerationItems = [