Skip to content

Commit

Permalink
TD-1359: chore: use the zone contract address in the order data and n…
Browse files Browse the repository at this point in the history
…ot the hardcoded config value. (#1789)
  • Loading branch information
naveen-imtb committed May 16, 2024
1 parent fc01002 commit 36a39bf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 16 deletions.
6 changes: 2 additions & 4 deletions packages/orderbook/src/seaport/map-to-seaport-order.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import { ERC721Item, ERC1155Item, Order } from '../openapi/sdk';

export function mapImmutableOrderToSeaportOrderComponents(
order: Order,
counter: string,
zoneAddress: string,
): { orderComponents: OrderComponents, tips: Array<TipInputItem> } {
const considerationItems: ConsiderationItem[] = order.buy.map((buyItem) => {
switch (buyItem.type) {
Expand Down Expand Up @@ -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,
Expand Down
15 changes: 3 additions & 12 deletions packages/orderbook/src/seaport/seaport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
ExchangeAction,
OrderComponents,
OrderUseCase,
TipInputItem,
} from '@opensea/seaport-js/lib/types';
import { providers } from 'ethers';
import { mapFromOpenApiOrder } from 'openapi/mapper';
Expand Down Expand Up @@ -108,7 +107,7 @@ export class Seaport {
extraData: string,
unitsToFill?: string,
): Promise<FulfillOrderResponse> {
const { orderComponents, tips } = this.mapImmutableOrderToSeaportOrderComponents(order);
const { orderComponents, tips } = mapImmutableOrderToSeaportOrderComponents(order);
const seaportLib = this.getSeaportLib(order);

const { actions: seaportActions } = await seaportLib.fulfillOrders({
Expand Down Expand Up @@ -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: {
Expand Down Expand Up @@ -241,7 +240,7 @@ export class Seaport {

async cancelOrders(orders: Order[], account: string): Promise<TransactionAction> {
const orderComponents = orders.map(
(order) => this.mapImmutableOrderToSeaportOrderComponents(order).orderComponents,
(order) => mapImmutableOrderToSeaportOrderComponents(order).orderComponents,
);
const seaportLib = this.getSeaportLib(orders[0]);

Expand All @@ -258,14 +257,6 @@ export class Seaport {
};
}

private mapImmutableOrderToSeaportOrderComponents(order: Order): {
orderComponents: OrderComponents;
tips: Array<TipInputItem>;
} {
const orderCounter = order.protocol_data.counter;
return mapImmutableOrderToSeaportOrderComponents(order, orderCounter, this.zoneContractAddress);
}

private createSeaportOrder(
offerer: string,
listingItem: ERC721Item | ERC1155Item,
Expand Down

0 comments on commit 36a39bf

Please sign in to comment.