Skip to content

Commit 7b7e994

Browse files
authored
Add tx overrides (#1229)
* bump package.json version to 6.1.12 * update to seaport-js v2.0.8 * add transaction overrides from latest seaport-js release
1 parent ccb6939 commit 7b7e994

3 files changed

Lines changed: 25 additions & 12 deletions

File tree

package-lock.json

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "opensea-js",
3-
"version": "6.1.11",
3+
"version": "6.1.12",
44
"description": "JavaScript SDK for the OpenSea marketplace helps developers build new experiences using NFTs and our marketplace data!",
55
"license": "MIT",
66
"author": "OpenSea Developers",
@@ -39,7 +39,7 @@
3939
},
4040
"types": "lib/index.d.ts",
4141
"dependencies": {
42-
"@opensea/seaport-js": "^2.0.0",
42+
"@opensea/seaport-js": "^2.0.8",
4343
"ethers": "^5.7.2"
4444
},
4545
"devDependencies": {

src/sdk.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
BigNumberish,
1313
Contract,
1414
FixedNumber,
15+
PayableOverrides,
1516
Wallet,
1617
ethers,
1718
providers,
@@ -658,16 +659,19 @@ export class OpenSeaSDK {
658659
* @param options.accountAddress Address of the wallet taking the order.
659660
* @param options.domain An optional domain to be hashed and included at the end of fulfillment calldata.
660661
* This can be used for on-chain order attribution to assist with analytics.
662+
* @param options.overrides Transaction overrides, ignored if not set.
661663
* @returns Transaction hash of the order.
662664
*/
663665
private async fulfillPrivateOrder({
664666
order,
665667
accountAddress,
666668
domain,
669+
overrides,
667670
}: {
668671
order: OrderV2;
669672
accountAddress: string;
670673
domain?: string;
674+
overrides?: PayableOverrides;
671675
}): Promise<string> {
672676
if (!order.taker?.address) {
673677
throw new Error(
@@ -684,6 +688,7 @@ export class OpenSeaSDK {
684688
orders: [order.protocolData, counterOrder],
685689
fulfillments,
686690
overrides: {
691+
...overrides,
687692
value: counterOrder.parameters.offer[0].startAmount,
688693
},
689694
accountAddress,
@@ -707,6 +712,7 @@ export class OpenSeaSDK {
707712
* @param options.accountAddress Address of the wallet taking the offer.
708713
* @param options.recipientAddress The optional address to receive the order's item(s) or curriencies. If not specified, defaults to accountAddress.
709714
* @param options.domain An optional domain to be hashed and included at the end of fulfillment calldata. This can be used for on-chain order attribution to assist with analytics.
715+
* @param options.overrides Transaction overrides, ignored if not set.
710716
* @returns Transaction hash of the order.
711717
*
712718
* @throws Error if the accountAddress is not available through wallet or provider.
@@ -718,11 +724,13 @@ export class OpenSeaSDK {
718724
accountAddress,
719725
recipientAddress,
720726
domain,
727+
overrides,
721728
}: {
722729
order: OrderV2;
723730
accountAddress: string;
724731
recipientAddress?: string;
725732
domain?: string;
733+
overrides?: PayableOverrides;
726734
}): Promise<string> {
727735
await this._requireAccountIsAvailable(accountAddress);
728736
requireValidProtocol(order.protocolAddress);
@@ -760,6 +768,7 @@ export class OpenSeaSDK {
760768
order,
761769
accountAddress,
762770
domain,
771+
overrides,
763772
});
764773
}
765774

@@ -769,6 +778,7 @@ export class OpenSeaSDK {
769778
recipientAddress,
770779
extraData,
771780
domain,
781+
overrides,
772782
});
773783
const transaction = await executeAllActions();
774784

@@ -787,18 +797,21 @@ export class OpenSeaSDK {
787797
* @param options.accountAddress The account address cancelling the orders.
788798
* @param options.domain An optional domain to be hashed and included at the end of fulfillment calldata.
789799
* This can be used for on-chain order attribution to assist with analytics.
800+
* @param options.overrides Transaction overrides, ignored if not set.
790801
* @returns Transaction hash of the order.
791802
*/
792803
private async cancelSeaportOrders({
793804
orders,
794805
accountAddress,
795806
domain,
796807
protocolAddress = DEFAULT_SEAPORT_CONTRACT_ADDRESS,
808+
overrides,
797809
}: {
798810
orders: OrderComponents[];
799811
accountAddress: string;
800812
domain?: string;
801813
protocolAddress?: string;
814+
overrides?: PayableOverrides;
802815
}): Promise<string> {
803816
const checksummedProtocolAddress = ethers.utils.getAddress(protocolAddress);
804817
if (checksummedProtocolAddress !== DEFAULT_SEAPORT_CONTRACT_ADDRESS) {
@@ -808,7 +821,7 @@ export class OpenSeaSDK {
808821
}
809822

810823
const transaction = await this.seaport_v1_5
811-
.cancelOrders(orders, accountAddress, domain)
824+
.cancelOrders(orders, accountAddress, domain, overrides)
812825
.transact();
813826

814827
return transaction.hash;

0 commit comments

Comments
 (0)