From 59334007ba0466e882fe27219ee894b96dadbd3a Mon Sep 17 00:00:00 2001 From: Ryan Ghods Date: Wed, 17 Jan 2024 10:18:57 -0800 Subject: [PATCH 1/5] add param to exclude optional creator fees --- src/sdk.ts | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) 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 = [ From 406b804a3204c17632f2515b481613f7ae1caa24 Mon Sep 17 00:00:00 2001 From: Ryan Ghods Date: Wed, 17 Jan 2024 10:19:06 -0800 Subject: [PATCH 2/5] bump package.json version --- package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index e6ab7e8d7..adfc52c06 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", "sdk", - "smart-contracts" + "smart-contracts", + "typescript" ], "engines": { "node": ">=16.0.0" From 6454c395758922370bb8f2e24ff631633ae38b0f Mon Sep 17 00:00:00 2001 From: Ryan Ghods Date: Wed, 17 Jan 2024 10:21:13 -0800 Subject: [PATCH 3/5] lint:fix --- tsconfig.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tsconfig.json b/tsconfig.json index b57dfa1a9..b4c557023 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -19,6 +19,6 @@ "moduleResolution": "node", "resolveJsonModule": true, "isolatedModules": true, - "baseUrl": "." - } + "baseUrl": ".", + }, } From fa4a61c0740eec84ecd536e73e7f7ef99aeebd79 Mon Sep 17 00:00:00 2001 From: Ryan Ghods Date: Wed, 17 Jan 2024 10:22:21 -0800 Subject: [PATCH 4/5] improve keywords --- package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index adfc52c06..c1452b74d 100644 --- a/package.json +++ b/package.json @@ -79,10 +79,10 @@ "marketplace", "nft", "node", - "non-fungible-tokens", - "project-opensea", + "non-fungible tokens", + "opensea", "sdk", - "smart-contracts", + "smart contracts", "typescript" ], "engines": { From 45f53a020456e3aa08311e01ae9a79ff69ca8983 Mon Sep 17 00:00:00 2001 From: Ryan Ghods Date: Fri, 19 Jan 2024 17:49:13 -0800 Subject: [PATCH 5/5] lint --- package-lock.json | 8 ++++---- tsconfig.json | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index 1138a4bcd..1d23a7141 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": { @@ -21,7 +21,7 @@ "@types/node": "^18.0.0", "@typescript-eslint/eslint-plugin": "^6.0.0", "@typescript-eslint/parser": "^6.0.0", - "chai": "4.4.1", + "chai": "^4.4.1", "chai-as-promised": "^7.1.1", "concurrently": "^8.2.0", "confusing-browser-globals": "^1.0.11", @@ -37,7 +37,7 @@ "nyc": "^15.1.0", "prettier": "^3.0.0", "prettier-package-json": "^2.8.0", - "ts-node": "10.9.2", + "ts-node": "^10.9.2", "typechain": "^8.0.0", "typedoc": "^0.25.0", "typedoc-plugin-markdown": "^3.15.4", diff --git a/tsconfig.json b/tsconfig.json index b4c557023..b57dfa1a9 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -19,6 +19,6 @@ "moduleResolution": "node", "resolveJsonModule": true, "isolatedModules": true, - "baseUrl": ".", - }, + "baseUrl": "." + } }