Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lfportal committed Sep 24, 2024
1 parent 4785b81 commit 321c7ad
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 16 deletions.
25 changes: 14 additions & 11 deletions packages/orderbook/src/seaport/seaport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ export class Seaport {
): Promise<FulfillOrderResponse> {
const { orderComponents, tips } = mapImmutableOrderToSeaportOrderComponents(order);
const seaportLib = this.getSeaportLib(order);
const chainID = (await this.provider.getNetwork()).chainId;

const { actions: seaportActions } = await seaportLib.fulfillOrders({
accountAddress: account,
Expand All @@ -286,19 +287,21 @@ export class Seaport {

const fulfillmentActions: TransactionAction[] = [];

const approvalAction = seaportActions.find(
const approvalActions = seaportActions.filter(
(action) => action.type === 'approval',
);

if (approvalAction) {
fulfillmentActions.push({
type: ActionType.TRANSACTION,
buildTransaction: prepareTransaction(
approvalAction.transactionMethods,
(await this.provider.getNetwork()).chainId,
account,
),
purpose: TransactionPurpose.APPROVAL,
if (approvalActions.length > 0) {
approvalActions.forEach((approvalAction) => {
fulfillmentActions.push({
type: ActionType.TRANSACTION,
buildTransaction: prepareTransaction(
approvalAction.transactionMethods,
chainID,
account,
),
purpose: TransactionPurpose.APPROVAL,
});
});
}

Expand All @@ -314,7 +317,7 @@ export class Seaport {
type: ActionType.TRANSACTION,
buildTransaction: prepareTransaction(
fulfilOrderAction.transactionMethods,
(await this.provider.getNetwork()).chainId,
chainID,
account,
),
purpose: TransactionPurpose.FULFILL_ORDER,
Expand Down
12 changes: 7 additions & 5 deletions tests/func-tests/zkevm/specs/orderbook.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ describe.skip("Orderbook", () => {
await (
await banker.sendTransaction({
to: maker.address,
value: imxForApproval,
value: `${imxForApproval}`,
...GAS_OVERRIDES,
})
).wait(1);
Expand All @@ -144,7 +144,7 @@ describe.skip("Orderbook", () => {
await (
await banker.sendTransaction({
to: taker.address,
value: imxForApproval + imxForFulfillment,
value: `${imxForApproval + imxForFulfillment}`,
...GAS_OVERRIDES,
})
).wait(1);
Expand All @@ -166,9 +166,11 @@ describe.skip("Orderbook", () => {
contractAddress: erc721Contract.address,
tokenId: erc721TokenId,
},
orderStart: new Date(2000, 1, 15),
});

const signatures = await actionAll(bidCreateActions, maker);

const { result } = await orderBookSdk.createBid({
orderComponents,
orderHash,
Expand Down Expand Up @@ -209,7 +211,7 @@ describe.skip("Orderbook", () => {
await (
await banker.sendTransaction({
to: maker.address,
value: imxForApproval,
value: `${imxForApproval}`,
...GAS_OVERRIDES,
})
).wait(1);
Expand All @@ -231,7 +233,7 @@ describe.skip("Orderbook", () => {
await (
await banker.sendTransaction({
to: taker.address,
value: imxForApproval + imxForFulfillment,
value: `${imxForApproval + imxForFulfillment}`,
...GAS_OVERRIDES,
})
).wait(1);
Expand Down Expand Up @@ -367,7 +369,7 @@ describe.skip("Orderbook", () => {
await (
await banker.sendTransaction({
to: maker.address,
value: imxForApproval * 2,
value: `${imxForApproval * 2}`,
...GAS_OVERRIDES,
})
).wait(1);
Expand Down
2 changes: 2 additions & 0 deletions tests/func-tests/zkevm/step-definitions/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ export const whenICreateAListing = (
type: 'NATIVE',
},
sell: sellItem,
orderStart: new Date(2000, 1, 15),
});

const signatures = await actionAll(listing.actions, offerer);
Expand Down Expand Up @@ -190,6 +191,7 @@ export const whenICreateABulkListing = (
},
sell: sellItem,
makerFees: [],
orderStart: new Date(2000, 1, 15),
});
}

Expand Down

0 comments on commit 321c7ad

Please sign in to comment.