Skip to content
This repository has been archived by the owner on May 19, 2024. It is now read-only.

Commit

Permalink
feat: replace old nft trader related types with new types
Browse files Browse the repository at this point in the history
  • Loading branch information
kenryu42 committed Jan 31, 2023
1 parent 29188e4 commit ec7650b
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 18 deletions.
3 changes: 2 additions & 1 deletion src/types/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export {
Market,
SwapData,
Swap,
ItemType,
Recipient,
TokenData,
CustomError,
Expand Down
52 changes: 35 additions & 17 deletions src/types/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,37 @@ type SwapTokenData = {
contractAddress: string;
};

interface Swap {
[key: string]: {
name?: string;
receivedAssets: SwapTokenData[];
spentAssets?: SwapTokenData[];
receivedAmount?: string;
spentAmount?: string;
};
interface SwapData {
name?: string;
address?: string;
spentAssets: SwapTokenData[];
spentAmount?: string;
}

export type SwapData = Swap & {
id?: string;
monitorTokenId?: string;
};
export interface Swap {
maker: SwapData;
taker: SwapData;
}

export enum ItemType {
// 0: ETH on mainnet, MATIC on polygon, etc.
NATIVE,

// 1: ERC20 items (ERC777 and ERC20 analogues could also technically work)
ERC20,

// 2: ERC721 items
ERC721,

// 3: ERC1155 items
ERC1155,

// 4: ERC721 items where a number of tokenIds are supported
ERC721_WITH_CRITERIA,

// 5: ERC1155 items where a number of ids are supported
ERC1155_WITH_CRITERIA
}

export type Market = {
name: Recipient;
Expand All @@ -67,23 +84,25 @@ export type Market = {
export type DecodedLogData = { [key: string]: string };

export type OfferItem = {
itemType: string;
itemType: ItemType;
token: string;
identifier: string;
amount: BigNumberish;
};

export type ConsiderationItem = {
itemType: string;
itemType: ItemType;
token: string;
identifier: string;
amount: BigNumberish;
recipient: string;
};

export type SeaportOrder = {
offerer: string;
offer: OfferItem[];
consideration: ConsiderationItem[];
recipient: string;
};

export type Fee = {
Expand Down Expand Up @@ -139,7 +158,8 @@ export type Recipient =

export type TransactionData = {
recipient: Recipient;
swap: SwapData;
swap: Swap;
isNftTrader?: boolean;
prices: string[];
totalPrice: number;
tokens: BigNumberish[];
Expand All @@ -163,8 +183,6 @@ export type TransactionData = {
sweeperAddr?: string;
usdPrice?: string | null;
ethUsdValue?: string;
addressMaker?: string;
addressTaker?: string;
transactionHash: string;
seaportIdentifiers: string[];
};

0 comments on commit ec7650b

Please sign in to comment.