From 36a39bf5282c8ff3b644790891c5f037d2ef1c3f Mon Sep 17 00:00:00 2001 From: Naveen <116692862+naveen-imtb@users.noreply.github.com> Date: Thu, 16 May 2024 16:45:51 +1000 Subject: [PATCH] TD-1359: chore: use the zone contract address in the order data and not the hardcoded config value. (#1789) --- .../orderbook/src/seaport/map-to-seaport-order.ts | 6 ++---- packages/orderbook/src/seaport/seaport.ts | 15 +++------------ 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/packages/orderbook/src/seaport/map-to-seaport-order.ts b/packages/orderbook/src/seaport/map-to-seaport-order.ts index 10a3b9816b..8d751639d5 100644 --- a/packages/orderbook/src/seaport/map-to-seaport-order.ts +++ b/packages/orderbook/src/seaport/map-to-seaport-order.ts @@ -9,8 +9,6 @@ import { ERC721Item, ERC1155Item, Order } from '../openapi/sdk'; export function mapImmutableOrderToSeaportOrderComponents( order: Order, - counter: string, - zoneAddress: string, ): { orderComponents: OrderComponents, tips: Array } { const considerationItems: ConsiderationItem[] = order.buy.map((buyItem) => { switch (buyItem.type) { @@ -85,14 +83,14 @@ export function mapImmutableOrderToSeaportOrderComponents( }; } }), - counter, + counter: order.protocol_data.counter, endTime: Math.round(new Date(order.end_at).getTime() / 1000).toString(), startTime: Math.round( new Date(order.start_at).getTime() / 1000, ).toString(), salt: order.salt, offerer: order.account_address, - zone: zoneAddress, + zone: order.protocol_data.zone_address, // this should be the fee exclusive number of items the user signed for totalOriginalConsiderationItems: considerationItems.length, orderType: order.sell[0].type === 'ERC1155' ? OrderType.PARTIAL_RESTRICTED : OrderType.FULL_RESTRICTED, diff --git a/packages/orderbook/src/seaport/seaport.ts b/packages/orderbook/src/seaport/seaport.ts index de221d19ec..5a6093c887 100644 --- a/packages/orderbook/src/seaport/seaport.ts +++ b/packages/orderbook/src/seaport/seaport.ts @@ -6,7 +6,6 @@ import { ExchangeAction, OrderComponents, OrderUseCase, - TipInputItem, } from '@opensea/seaport-js/lib/types'; import { providers } from 'ethers'; import { mapFromOpenApiOrder } from 'openapi/mapper'; @@ -108,7 +107,7 @@ export class Seaport { extraData: string, unitsToFill?: string, ): Promise { - const { orderComponents, tips } = this.mapImmutableOrderToSeaportOrderComponents(order); + const { orderComponents, tips } = mapImmutableOrderToSeaportOrderComponents(order); const seaportLib = this.getSeaportLib(order); const { actions: seaportActions } = await seaportLib.fulfillOrders({ @@ -177,7 +176,7 @@ export class Seaport { expiration: string; }> { const fulfillOrderDetails = fulfillingOrders.map((o) => { - const { orderComponents, tips } = this.mapImmutableOrderToSeaportOrderComponents(o.order); + const { orderComponents, tips } = mapImmutableOrderToSeaportOrderComponents(o.order); return { order: { @@ -241,7 +240,7 @@ export class Seaport { async cancelOrders(orders: Order[], account: string): Promise { const orderComponents = orders.map( - (order) => this.mapImmutableOrderToSeaportOrderComponents(order).orderComponents, + (order) => mapImmutableOrderToSeaportOrderComponents(order).orderComponents, ); const seaportLib = this.getSeaportLib(orders[0]); @@ -258,14 +257,6 @@ export class Seaport { }; } - private mapImmutableOrderToSeaportOrderComponents(order: Order): { - orderComponents: OrderComponents; - tips: Array; - } { - const orderCounter = order.protocol_data.counter; - return mapImmutableOrderToSeaportOrderComponents(order, orderCounter, this.zoneContractAddress); - } - private createSeaportOrder( offerer: string, listingItem: ERC721Item | ERC1155Item,