Skip to content

Commit 1f9f820

Browse files
authored
Add payableOverrides to the fulfillOrder method. (#363)
* add payableOverrides to the fulfillOrder method. * update documentation * type 🤦
1 parent 047888a commit 1f9f820

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

src/seaport.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -780,6 +780,7 @@ export class Seaport {
780780
* Defaults to the zero address which means the offer goes to the fulfiller
781781
* @param input.domain optional domain to be hashed and appended to calldata
782782
* @param input.exactApproval optional boolean to indicate whether the approval should be exact or not
783+
* @param input.overrides any overrides the client wants, will ignore value
783784
* @returns a use case containing the set of approval actions and fulfillment action
784785
*/
785786
public async fulfillOrder({
@@ -794,6 +795,7 @@ export class Seaport {
794795
recipientAddress = ethers.constants.AddressZero,
795796
domain,
796797
exactApproval = false,
798+
overrides,
797799
}: {
798800
order: OrderWithCounter;
799801
unitsToFill?: BigNumberish;
@@ -806,6 +808,7 @@ export class Seaport {
806808
recipientAddress?: string;
807809
domain?: string;
808810
exactApproval?: boolean;
811+
overrides?: PayableOverrides;
809812
}): Promise<
810813
OrderUseCase<
811814
ExchangeAction<
@@ -903,6 +906,7 @@ export class Seaport {
903906
signer: fulfiller,
904907
tips: tipConsiderationItems,
905908
domain,
909+
overrides,
906910
},
907911
exactApproval,
908912
);
@@ -931,6 +935,7 @@ export class Seaport {
931935
fulfillerOperator,
932936
recipientAddress,
933937
domain,
938+
overrides,
934939
},
935940
exactApproval,
936941
);

src/utils/fulfill.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {
33
BigNumberish,
44
ContractTransaction,
55
ethers,
6+
PayableOverrides,
67
Signer,
78
} from "ethers";
89
import type {
@@ -191,6 +192,7 @@ export function fulfillBasicOrder(
191192
tips = [],
192193
conduitKey = NO_CONDUIT,
193194
domain,
195+
overrides,
194196
}: {
195197
order: Order;
196198
seaportContract: Seaport;
@@ -203,6 +205,7 @@ export function fulfillBasicOrder(
203205
tips?: ConsiderationItem[];
204206
conduitKey: string;
205207
domain?: string;
208+
overrides?: PayableOverrides;
206209
},
207210
exactApproval: boolean,
208211
): OrderUseCase<
@@ -281,7 +284,7 @@ export function fulfillBasicOrder(
281284
zoneHash: order.parameters.zoneHash,
282285
};
283286

284-
const payableOverrides = { value: totalNativeAmount };
287+
const payableOverrides = { ...overrides, value: totalNativeAmount };
285288

286289
const approvalActions = getApprovalActions(
287290
insufficientApprovals,
@@ -328,6 +331,7 @@ export function fulfillStandardOrder(
328331
recipientAddress,
329332
signer,
330333
domain,
334+
overrides,
331335
}: {
332336
order: Order;
333337
unitsToFill?: BigNumberish;
@@ -347,6 +351,7 @@ export function fulfillStandardOrder(
347351
timeBasedItemParams: TimeBasedItemParams;
348352
signer: Signer;
349353
domain?: string;
354+
overrides?: PayableOverrides;
350355
},
351356
exactApproval: boolean,
352357
): OrderUseCase<
@@ -417,7 +422,7 @@ export function fulfillStandardOrder(
417422
fulfillerOperator,
418423
});
419424

420-
const payableOverrides = { value: totalNativeAmount };
425+
const payableOverrides = { ...overrides, value: totalNativeAmount };
421426

422427
const approvalActions = getApprovalActions(
423428
insufficientApprovals,

test/basic-fulfill.spec.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ describeWithFixture(
2828
const nftId = "1";
2929
const erc1155Amount = "3";
3030
const OPENSEA_DOMAIN = "opensea.io";
31+
const overrideGasLimit = 10_000_000;
3132

3233
beforeEach(async () => {
3334
fulfillBasicOrderSpy = sinon.spy(fulfill, "fulfillBasicOrder");
@@ -206,6 +207,7 @@ describeWithFixture(
206207
order,
207208
accountAddress: fulfiller.address,
208209
domain: OPENSEA_DOMAIN,
210+
overrides: { gasLimit: overrideGasLimit },
209211
});
210212

211213
const approvalAction = actions[0];
@@ -248,6 +250,7 @@ describeWithFixture(
248250
fulfillReceipt: receipt,
249251
});
250252
expect(fulfillBasicOrderSpy).calledOnce;
253+
expect(transaction.gasLimit).equal(overrideGasLimit);
251254
});
252255

253256
it("ERC721 <=> ERC20 (already validated order)", async () => {

0 commit comments

Comments
 (0)