diff --git a/package-lock.json b/package-lock.json index 54fc34e9..a338dd82 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,15 +1,15 @@ { - "name": "@paraspace/seaport-js", - "version": "1.0.10", + "name": "paraspace-seaport-js", + "version": "0.0.2", "lockfileVersion": 2, "requires": true, "packages": { "": { - "name": "@paraspace/seaport-js", - "version": "1.0.10", + "name": "paraspace-seaport-js", + "version": "0.0.2", "license": "MIT", "dependencies": { - "@0xsequence/multicall": "^0.39.6", + "@0xsequence/multicall": "^0.39.0", "ethers": "^5.6.7", "merkletreejs": "^0.2.31" }, @@ -13028,6 +13028,7 @@ }, "node_modules/ganache-core/node_modules/keccak": { "version": "3.0.1", + "dev": true, "hasInstallScript": true, "inBundle": true, "license": "MIT", @@ -13600,6 +13601,7 @@ }, "node_modules/ganache-core/node_modules/node-addon-api": { "version": "2.0.2", + "dev": true, "inBundle": true, "license": "MIT" }, @@ -13613,6 +13615,7 @@ }, "node_modules/ganache-core/node_modules/node-gyp-build": { "version": "4.2.3", + "dev": true, "inBundle": true, "license": "MIT", "bin": { @@ -35175,6 +35178,7 @@ "keccak": { "version": "3.0.1", "bundled": true, + "dev": true, "requires": { "node-addon-api": "^2.0.0", "node-gyp-build": "^4.2.0" @@ -35604,7 +35608,8 @@ }, "node-addon-api": { "version": "2.0.2", - "bundled": true + "bundled": true, + "dev": true }, "node-fetch": { "version": "2.1.2", @@ -35612,7 +35617,8 @@ }, "node-gyp-build": { "version": "4.2.3", - "bundled": true + "bundled": true, + "dev": true }, "normalize-url": { "version": "4.5.0", diff --git a/package.json b/package.json index 38e37c6d..e7bac93d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { - "name": "@paraspace/seaport-js", - "version": "1.0.11", + "name": "paraspace-seaport-js", + "version": "0.0.2", "description": "[Seaport](https://github.com/ProjectOpenSea/seaport) is a new marketplace protocol for safely and efficiently buying and selling NFTs. This is a JavaScript library intended to make interfacing with the contract reasonable and easy.", "license": "MIT", "author": "OpenSea Developers", diff --git a/src/seaport.ts b/src/seaport.ts index 3f6aaf08..8841dbb9 100644 --- a/src/seaport.ts +++ b/src/seaport.ts @@ -221,16 +221,19 @@ export class Seaport { fees, domain, salt, + offerer, }: CreateOrderInput, accountAddress?: string ): Promise> { const signer = this._getSigner(accountAddress); - const offerer = await signer.getAddress(); + const signerAddress = await signer.getAddress(); + const defaultOfferer = signerAddress; + const actualOfferer = offerer || defaultOfferer; const offerItems = offer.map(mapInputItemToOfferItem); const considerationItems = [ ...consideration.map((consideration) => ({ ...mapInputItemToOfferItem(consideration), - recipient: consideration.recipient ?? offerer, + recipient: consideration.recipient ?? actualOfferer, })), ]; @@ -254,9 +257,9 @@ export class Seaport { const operator = this.config.conduitKeyToConduit[conduitKey]; const [resolvedCounter, balancesAndApprovals] = await Promise.all([ - counter ?? this.getCounter(offerer), + counter ?? this.getCounter(actualOfferer), getBalancesAndApprovals({ - owner: offerer, + owner: actualOfferer, items: offerItems, criterias: [], multicallProvider: this.multicallProvider, @@ -288,7 +291,7 @@ export class Seaport { (domain ? generateRandomSaltWithDomain(domain) : generateRandomSalt()); const orderParameters: OrderParameters = { - offerer, + offerer: actualOfferer, zone, // TODO: Placeholder zoneHash: formatBytes32String(resolvedCounter.toString()), @@ -328,7 +331,7 @@ export class Seaport { const signature = await this.signOrder( orderParameters, resolvedCounter, - offerer + signerAddress ); return { @@ -392,15 +395,15 @@ export class Seaport { * Submits a request to your provider to sign the order. Signed orders are used for off-chain order books. * @param orderParameters standard order parameter struct * @param counter counter of the offerer - * @param accountAddress optional account address from which to sign the order with. + * @param signerAddress optional account address from which to sign the order with. * @returns the order signature */ public async signOrder( orderParameters: OrderParameters, counter: number, - accountAddress?: string + signerAddress?: string ): Promise { - const signer = this._getSigner(accountAddress); + const signer = this._getSigner(signerAddress); const domainData = await this._getDomainData(); diff --git a/src/types.ts b/src/types.ts index 3f989876..17526deb 100644 --- a/src/types.ts +++ b/src/types.ts @@ -170,6 +170,7 @@ export type CreateOrderInput = { useProxy?: boolean; domain?: string; salt?: string; + offerer?: string; }; export type InputCriteria = {