@opensea/seaport-js 1.0.0 → 1.0.1-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/lib/abi/ERC1155.d.ts +29 -29
  2. package/lib/abi/ERC20.d.ts +29 -29
  3. package/lib/abi/ERC721.d.ts +29 -29
  4. package/lib/abi/Seaport.d.ts +112 -112
  5. package/lib/constants.d.ts +49 -49
  6. package/lib/index.d.ts +2 -2
  7. package/lib/index.esm.mjs +2 -0
  8. package/lib/index.esm.mjs.map +1 -0
  9. package/lib/index.js +2 -6
  10. package/lib/index.js.map +1 -1
  11. package/lib/index.modern.mjs +2 -0
  12. package/lib/index.modern.mjs.map +1 -0
  13. package/lib/index.umd.js +2 -0
  14. package/lib/index.umd.js.map +1 -0
  15. package/lib/seaport.d.ts +181 -181
  16. package/lib/types.d.ts +207 -207
  17. package/lib/utils/approval.d.ts +9 -9
  18. package/lib/utils/balance.d.ts +4 -4
  19. package/lib/utils/balanceAndApprovalCheck.d.ts +108 -108
  20. package/lib/utils/criteria.d.ts +13 -14
  21. package/lib/utils/fulfill.d.ts +84 -84
  22. package/lib/utils/gcd.d.ts +3 -3
  23. package/lib/utils/item.d.ts +30 -29
  24. package/lib/utils/match.d.ts +49 -49
  25. package/lib/utils/merkletree.d.ts +11 -11
  26. package/lib/utils/order.d.ts +37 -37
  27. package/lib/utils/usecase.d.ts +4 -4
  28. package/package.json +4 -2
  29. package/lib/abi/ERC1155.js +0 -319
  30. package/lib/abi/ERC1155.js.map +0 -1
  31. package/lib/abi/ERC20.js +0 -317
  32. package/lib/abi/ERC20.js.map +0 -1
  33. package/lib/abi/ERC721.js +0 -337
  34. package/lib/abi/ERC721.js.map +0 -1
  35. package/lib/abi/Seaport.js +0 -2585
  36. package/lib/abi/Seaport.js.map +0 -1
  37. package/lib/constants.js +0 -73
  38. package/lib/constants.js.map +0 -1
  39. package/lib/seaport.js +0 -720
  40. package/lib/seaport.js.map +0 -1
  41. package/lib/typechain/ERC1155.d.ts +0 -189
  42. package/lib/typechain/ERC1155.js +0 -3
  43. package/lib/typechain/ERC1155.js.map +0 -1
  44. package/lib/typechain/ERC20.d.ts +0 -209
  45. package/lib/typechain/ERC20.js +0 -3
  46. package/lib/typechain/ERC20.js.map +0 -1
  47. package/lib/typechain/ERC721.d.ts +0 -220
  48. package/lib/typechain/ERC721.js +0 -3
  49. package/lib/typechain/ERC721.js.map +0 -1
  50. package/lib/typechain/Seaport.d.ts +0 -686
  51. package/lib/typechain/Seaport.js +0 -3
  52. package/lib/typechain/Seaport.js.map +0 -1
  53. package/lib/typechain/common.d.ts +0 -21
  54. package/lib/typechain/common.js +0 -3
  55. package/lib/typechain/common.js.map +0 -1
  56. package/lib/types.js +0 -3
  57. package/lib/types.js.map +0 -1
  58. package/lib/utils/approval.js +0 -108
  59. package/lib/utils/approval.js.map +0 -1
  60. package/lib/utils/balance.js +0 -86
  61. package/lib/utils/balance.js.map +0 -1
  62. package/lib/utils/balanceAndApprovalCheck.js +0 -322
  63. package/lib/utils/balanceAndApprovalCheck.js.map +0 -1
  64. package/lib/utils/criteria.js +0 -91
  65. package/lib/utils/criteria.js.map +0 -1
  66. package/lib/utils/fulfill.js +0 -573
  67. package/lib/utils/fulfill.js.map +0 -1
  68. package/lib/utils/gcd.js +0 -25
  69. package/lib/utils/gcd.js.map +0 -1
  70. package/lib/utils/item.js +0 -136
  71. package/lib/utils/item.js.map +0 -1
  72. package/lib/utils/match.js +0 -56
  73. package/lib/utils/match.js.map +0 -1
  74. package/lib/utils/merkletree.js +0 -32
  75. package/lib/utils/merkletree.js.map +0 -1
  76. package/lib/utils/order.js +0 -224
  77. package/lib/utils/order.js.map +0 -1
  78. package/lib/utils/usecase.js +0 -158
  79. package/lib/utils/usecase.js.map +0 -1
package/lib/types.d.ts CHANGED
@@ -1,207 +1,207 @@
1
- import type { OrderStruct, Seaport as TypeChainSeaportContract } from "./typechain/Seaport";
2
- import { BigNumber, BigNumberish, Contract, ContractTransaction, Overrides, PayableOverrides, PopulatedTransaction } from "ethers";
3
- import { ItemType, OrderType } from "./constants";
4
- import type { ERC721 } from "./typechain/ERC721";
5
- import type { ERC20 } from "./typechain/ERC20";
6
- export declare type SeaportConfig = {
7
- ascendingAmountFulfillmentBuffer?: number;
8
- balanceAndApprovalChecksOnOrderCreation?: boolean;
9
- conduitKeyToConduit?: Record<string, string>;
10
- overrides?: {
11
- contractAddress?: string;
12
- defaultConduitKey?: string;
13
- };
14
- };
15
- export declare type OfferItem = {
16
- itemType: ItemType;
17
- token: string;
18
- identifierOrCriteria: string;
19
- startAmount: string;
20
- endAmount: string;
21
- };
22
- export declare type ConsiderationItem = {
23
- itemType: ItemType;
24
- token: string;
25
- identifierOrCriteria: string;
26
- startAmount: string;
27
- endAmount: string;
28
- recipient: string;
29
- };
30
- export declare type Item = OfferItem | ConsiderationItem;
31
- export declare type OrderParameters = {
32
- offerer: string;
33
- zone: string;
34
- orderType: OrderType;
35
- startTime: BigNumberish;
36
- endTime: BigNumberish;
37
- zoneHash: string;
38
- salt: string;
39
- offer: OfferItem[];
40
- consideration: ConsiderationItem[];
41
- totalOriginalConsiderationItems: BigNumberish;
42
- conduitKey: string;
43
- };
44
- export declare type OrderComponents = OrderParameters & {
45
- counter: number;
46
- };
47
- export declare type Order = {
48
- parameters: OrderParameters;
49
- signature: string;
50
- };
51
- export declare type AdvancedOrder = Order & {
52
- numerator: BigNumber;
53
- denominator: BigNumber;
54
- extraData: string;
55
- };
56
- export declare type BasicErc721Item = {
57
- itemType: ItemType.ERC721;
58
- token: string;
59
- identifier: string;
60
- };
61
- export declare type Erc721ItemWithCriteria = {
62
- itemType: ItemType.ERC721;
63
- token: string;
64
- identifiers: string[];
65
- amount?: string;
66
- endAmount?: string;
67
- };
68
- declare type Erc721Item = BasicErc721Item | Erc721ItemWithCriteria;
69
- export declare type BasicErc1155Item = {
70
- itemType: ItemType.ERC1155;
71
- token: string;
72
- identifier: string;
73
- amount: string;
74
- endAmount?: string;
75
- };
76
- export declare type Erc1155ItemWithCriteria = {
77
- itemType: ItemType.ERC1155;
78
- token: string;
79
- identifiers: string[];
80
- amount: string;
81
- endAmount?: string;
82
- };
83
- declare type Erc1155Item = BasicErc1155Item | Erc1155ItemWithCriteria;
84
- export declare type CurrencyItem = {
85
- token?: string;
86
- amount: string;
87
- endAmount?: string;
88
- };
89
- export declare type CreateInputItem = Erc721Item | Erc1155Item | CurrencyItem;
90
- export declare type ConsiderationInputItem = CreateInputItem & {
91
- recipient?: string;
92
- };
93
- export declare type TipInputItem = CreateInputItem & {
94
- recipient: string;
95
- };
96
- export declare type Fee = {
97
- recipient: string;
98
- basisPoints: number;
99
- };
100
- export declare type CreateOrderInput = {
101
- conduitKey?: string;
102
- zone?: string;
103
- startTime?: string;
104
- endTime?: string;
105
- offer: readonly CreateInputItem[];
106
- consideration: readonly ConsiderationInputItem[];
107
- counter?: number;
108
- fees?: readonly Fee[];
109
- allowPartialFills?: boolean;
110
- restrictedByZone?: boolean;
111
- useProxy?: boolean;
112
- salt?: string;
113
- };
114
- export declare type InputCriteria = {
115
- identifier: string;
116
- proof: string[];
117
- };
118
- export declare type OrderStatus = {
119
- isValidated: boolean;
120
- isCancelled: boolean;
121
- totalFilled: BigNumber;
122
- totalSize: BigNumber;
123
- };
124
- export declare type OrderWithCounter = {
125
- parameters: OrderComponents;
126
- signature: string;
127
- };
128
- export declare type ContractMethodReturnType<T extends Contract, U extends keyof T["callStatic"]> = Awaited<ReturnType<T["callStatic"][U]>>;
129
- export declare type TransactionMethods<T = unknown> = {
130
- buildTransaction: (overrides?: Overrides) => Promise<PopulatedTransaction>;
131
- callStatic: (overrides?: Overrides) => Promise<T>;
132
- estimateGas: (overrides?: Overrides) => Promise<BigNumber>;
133
- transact: (overrides?: Overrides) => Promise<ContractTransaction>;
134
- };
135
- export declare type ApprovalAction = {
136
- type: "approval";
137
- token: string;
138
- identifierOrCriteria: string;
139
- itemType: ItemType;
140
- operator: string;
141
- transactionMethods: TransactionMethods<ContractMethodReturnType<ERC721, "setApprovalForAll">> | TransactionMethods<ContractMethodReturnType<ERC20, "approve">>;
142
- };
143
- export declare type ExchangeAction<T = unknown> = {
144
- type: "exchange";
145
- transactionMethods: TransactionMethods<T>;
146
- };
147
- export declare type CreateOrderAction = {
148
- type: "create";
149
- getMessageToSign: () => Promise<string>;
150
- createOrder: () => Promise<OrderWithCounter>;
151
- };
152
- export declare type TransactionAction = ApprovalAction | ExchangeAction;
153
- export declare type CreateOrderActions = readonly [
154
- ...ApprovalAction[],
155
- CreateOrderAction
156
- ];
157
- export declare type OrderExchangeActions<T> = readonly [
158
- ...ApprovalAction[],
159
- ExchangeAction<T>
160
- ];
161
- export declare type OrderUseCase<T extends CreateOrderAction | ExchangeAction> = {
162
- actions: T extends CreateOrderAction ? CreateOrderActions : OrderExchangeActions<T extends ExchangeAction<infer U> ? U : never>;
163
- executeAllActions: () => Promise<T extends CreateOrderAction ? OrderWithCounter : ContractTransaction>;
164
- };
165
- export declare type FulfillmentComponent = {
166
- orderIndex: number;
167
- itemIndex: number;
168
- }[];
169
- export declare type Fulfillment = {
170
- offerComponents: FulfillmentComponent[];
171
- considerationComponents: FulfillmentComponent[];
172
- };
173
- declare type MatchOrdersFulfillmentComponent = {
174
- orderIndex: number;
175
- itemIndex: number;
176
- };
177
- export declare type MatchOrdersFulfillment = {
178
- offerComponents: MatchOrdersFulfillmentComponent[];
179
- considerationComponents: MatchOrdersFulfillmentComponent[];
180
- };
181
- export declare type SeaportContract = TypeChainSeaportContract & {
182
- encodeFunctionData(functionFragment: "matchOrders", values: [OrderStruct[], MatchOrdersFulfillment[]]): string;
183
- matchOrders(orders: OrderStruct[], fulfillments: MatchOrdersFulfillment[], overrides?: PayableOverrides & {
184
- from?: string | Promise<string>;
185
- }): Promise<ContractTransaction>;
186
- functions: TypeChainSeaportContract["functions"] & {
187
- matchOrders(orders: OrderStruct[], fulfillments: MatchOrdersFulfillment[], overrides?: PayableOverrides & {
188
- from?: string | Promise<string>;
189
- }): Promise<ContractTransaction>;
190
- };
191
- callStatic: TypeChainSeaportContract["callStatic"] & {
192
- matchOrders(orders: OrderStruct[], fulfillments: MatchOrdersFulfillment[], overrides?: PayableOverrides & {
193
- from?: string | Promise<string>;
194
- }): Promise<ContractTransaction>;
195
- };
196
- estimateGas: TypeChainSeaportContract["estimateGas"] & {
197
- matchOrders(orders: OrderStruct[], fulfillments: MatchOrdersFulfillment[], overrides?: PayableOverrides & {
198
- from?: string | Promise<string>;
199
- }): Promise<BigNumber>;
200
- };
201
- populateTranscation: TypeChainSeaportContract["populateTransaction"] & {
202
- matchOrders(orders: OrderStruct[], fulfillments: MatchOrdersFulfillment[], overrides?: PayableOverrides & {
203
- from?: string | Promise<string>;
204
- }): Promise<PopulatedTransaction>;
205
- };
206
- };
207
- export {};
1
+ import type { OrderStruct, Seaport as TypeChainSeaportContract } from "./typechain/Seaport";
2
+ import { BigNumber, BigNumberish, Contract, ContractTransaction, Overrides, PayableOverrides, PopulatedTransaction } from "ethers";
3
+ import { ItemType, OrderType } from "./constants";
4
+ import type { ERC721 } from "./typechain/ERC721";
5
+ import type { ERC20 } from "./typechain/ERC20";
6
+ export declare type SeaportConfig = {
7
+ ascendingAmountFulfillmentBuffer?: number;
8
+ balanceAndApprovalChecksOnOrderCreation?: boolean;
9
+ conduitKeyToConduit?: Record<string, string>;
10
+ overrides?: {
11
+ contractAddress?: string;
12
+ defaultConduitKey?: string;
13
+ };
14
+ };
15
+ export declare type OfferItem = {
16
+ itemType: ItemType;
17
+ token: string;
18
+ identifierOrCriteria: string;
19
+ startAmount: string;
20
+ endAmount: string;
21
+ };
22
+ export declare type ConsiderationItem = {
23
+ itemType: ItemType;
24
+ token: string;
25
+ identifierOrCriteria: string;
26
+ startAmount: string;
27
+ endAmount: string;
28
+ recipient: string;
29
+ };
30
+ export declare type Item = OfferItem | ConsiderationItem;
31
+ export declare type OrderParameters = {
32
+ offerer: string;
33
+ zone: string;
34
+ orderType: OrderType;
35
+ startTime: BigNumberish;
36
+ endTime: BigNumberish;
37
+ zoneHash: string;
38
+ salt: string;
39
+ offer: OfferItem[];
40
+ consideration: ConsiderationItem[];
41
+ totalOriginalConsiderationItems: BigNumberish;
42
+ conduitKey: string;
43
+ };
44
+ export declare type OrderComponents = OrderParameters & {
45
+ counter: number;
46
+ };
47
+ export declare type Order = {
48
+ parameters: OrderParameters;
49
+ signature: string;
50
+ };
51
+ export declare type AdvancedOrder = Order & {
52
+ numerator: BigNumber;
53
+ denominator: BigNumber;
54
+ extraData: string;
55
+ };
56
+ export declare type BasicErc721Item = {
57
+ itemType: ItemType.ERC721;
58
+ token: string;
59
+ identifier: string;
60
+ };
61
+ export declare type Erc721ItemWithCriteria = {
62
+ itemType: ItemType.ERC721;
63
+ token: string;
64
+ identifiers: string[];
65
+ amount?: string;
66
+ endAmount?: string;
67
+ };
68
+ declare type Erc721Item = BasicErc721Item | Erc721ItemWithCriteria;
69
+ export declare type BasicErc1155Item = {
70
+ itemType: ItemType.ERC1155;
71
+ token: string;
72
+ identifier: string;
73
+ amount: string;
74
+ endAmount?: string;
75
+ };
76
+ export declare type Erc1155ItemWithCriteria = {
77
+ itemType: ItemType.ERC1155;
78
+ token: string;
79
+ identifiers: string[];
80
+ amount: string;
81
+ endAmount?: string;
82
+ };
83
+ declare type Erc1155Item = BasicErc1155Item | Erc1155ItemWithCriteria;
84
+ export declare type CurrencyItem = {
85
+ token?: string;
86
+ amount: string;
87
+ endAmount?: string;
88
+ };
89
+ export declare type CreateInputItem = Erc721Item | Erc1155Item | CurrencyItem;
90
+ export declare type ConsiderationInputItem = CreateInputItem & {
91
+ recipient?: string;
92
+ };
93
+ export declare type TipInputItem = CreateInputItem & {
94
+ recipient: string;
95
+ };
96
+ export declare type Fee = {
97
+ recipient: string;
98
+ basisPoints: number;
99
+ };
100
+ export declare type CreateOrderInput = {
101
+ conduitKey?: string;
102
+ zone?: string;
103
+ startTime?: string;
104
+ endTime?: string;
105
+ offer: readonly CreateInputItem[];
106
+ consideration: readonly ConsiderationInputItem[];
107
+ counter?: number;
108
+ fees?: readonly Fee[];
109
+ allowPartialFills?: boolean;
110
+ restrictedByZone?: boolean;
111
+ useProxy?: boolean;
112
+ salt?: string;
113
+ };
114
+ export declare type InputCriteria = {
115
+ identifier: string;
116
+ proof: string[];
117
+ };
118
+ export declare type OrderStatus = {
119
+ isValidated: boolean;
120
+ isCancelled: boolean;
121
+ totalFilled: BigNumber;
122
+ totalSize: BigNumber;
123
+ };
124
+ export declare type OrderWithCounter = {
125
+ parameters: OrderComponents;
126
+ signature: string;
127
+ };
128
+ export declare type ContractMethodReturnType<T extends Contract, U extends keyof T["callStatic"]> = Awaited<ReturnType<T["callStatic"][U]>>;
129
+ export declare type TransactionMethods<T = unknown> = {
130
+ buildTransaction: (overrides?: Overrides) => Promise<PopulatedTransaction>;
131
+ callStatic: (overrides?: Overrides) => Promise<T>;
132
+ estimateGas: (overrides?: Overrides) => Promise<BigNumber>;
133
+ transact: (overrides?: Overrides) => Promise<ContractTransaction>;
134
+ };
135
+ export declare type ApprovalAction = {
136
+ type: "approval";
137
+ token: string;
138
+ identifierOrCriteria: string;
139
+ itemType: ItemType;
140
+ operator: string;
141
+ transactionMethods: TransactionMethods<ContractMethodReturnType<ERC721, "setApprovalForAll">> | TransactionMethods<ContractMethodReturnType<ERC20, "approve">>;
142
+ };
143
+ export declare type ExchangeAction<T = unknown> = {
144
+ type: "exchange";
145
+ transactionMethods: TransactionMethods<T>;
146
+ };
147
+ export declare type CreateOrderAction = {
148
+ type: "create";
149
+ getMessageToSign: () => Promise<string>;
150
+ createOrder: () => Promise<OrderWithCounter>;
151
+ };
152
+ export declare type TransactionAction = ApprovalAction | ExchangeAction;
153
+ export declare type CreateOrderActions = readonly [
154
+ ...ApprovalAction[],
155
+ CreateOrderAction
156
+ ];
157
+ export declare type OrderExchangeActions<T> = readonly [
158
+ ...ApprovalAction[],
159
+ ExchangeAction<T>
160
+ ];
161
+ export declare type OrderUseCase<T extends CreateOrderAction | ExchangeAction> = {
162
+ actions: T extends CreateOrderAction ? CreateOrderActions : OrderExchangeActions<T extends ExchangeAction<infer U> ? U : never>;
163
+ executeAllActions: () => Promise<T extends CreateOrderAction ? OrderWithCounter : ContractTransaction>;
164
+ };
165
+ export declare type FulfillmentComponent = {
166
+ orderIndex: number;
167
+ itemIndex: number;
168
+ }[];
169
+ export declare type Fulfillment = {
170
+ offerComponents: FulfillmentComponent[];
171
+ considerationComponents: FulfillmentComponent[];
172
+ };
173
+ declare type MatchOrdersFulfillmentComponent = {
174
+ orderIndex: number;
175
+ itemIndex: number;
176
+ };
177
+ export declare type MatchOrdersFulfillment = {
178
+ offerComponents: MatchOrdersFulfillmentComponent[];
179
+ considerationComponents: MatchOrdersFulfillmentComponent[];
180
+ };
181
+ export declare type SeaportContract = TypeChainSeaportContract & {
182
+ encodeFunctionData(functionFragment: "matchOrders", values: [OrderStruct[], MatchOrdersFulfillment[]]): string;
183
+ matchOrders(orders: OrderStruct[], fulfillments: MatchOrdersFulfillment[], overrides?: PayableOverrides & {
184
+ from?: string | Promise<string>;
185
+ }): Promise<ContractTransaction>;
186
+ functions: TypeChainSeaportContract["functions"] & {
187
+ matchOrders(orders: OrderStruct[], fulfillments: MatchOrdersFulfillment[], overrides?: PayableOverrides & {
188
+ from?: string | Promise<string>;
189
+ }): Promise<ContractTransaction>;
190
+ };
191
+ callStatic: TypeChainSeaportContract["callStatic"] & {
192
+ matchOrders(orders: OrderStruct[], fulfillments: MatchOrdersFulfillment[], overrides?: PayableOverrides & {
193
+ from?: string | Promise<string>;
194
+ }): Promise<ContractTransaction>;
195
+ };
196
+ estimateGas: TypeChainSeaportContract["estimateGas"] & {
197
+ matchOrders(orders: OrderStruct[], fulfillments: MatchOrdersFulfillment[], overrides?: PayableOverrides & {
198
+ from?: string | Promise<string>;
199
+ }): Promise<BigNumber>;
200
+ };
201
+ populateTranscation: TypeChainSeaportContract["populateTransaction"] & {
202
+ matchOrders(orders: OrderStruct[], fulfillments: MatchOrdersFulfillment[], overrides?: PayableOverrides & {
203
+ from?: string | Promise<string>;
204
+ }): Promise<PopulatedTransaction>;
205
+ };
206
+ };
207
+ export {};
@@ -1,9 +1,9 @@
1
- import { providers as multicallProviders } from "@0xsequence/multicall";
2
- import { BigNumber, providers } from "ethers";
3
- import type { ApprovalAction, Item } from "../types";
4
- import type { InsufficientApprovals } from "./balanceAndApprovalCheck";
5
- export declare const approvedItemAmount: (owner: string, item: Item, operator: string, multicallProvider: multicallProviders.MulticallProvider) => Promise<BigNumber>;
6
- /**
7
- * Get approval actions given a list of insufficent approvals.
8
- */
9
- export declare function getApprovalActions(insufficientApprovals: InsufficientApprovals, signer: providers.JsonRpcSigner): Promise<ApprovalAction[]>;
1
+ import { providers as multicallProviders } from "@0xsequence/multicall";
2
+ import { BigNumber, providers } from "ethers";
3
+ import type { ApprovalAction, Item } from "../types";
4
+ import type { InsufficientApprovals } from "./balanceAndApprovalCheck";
5
+ export declare const approvedItemAmount: (owner: string, item: Item, operator: string, multicallProvider: multicallProviders.MulticallProvider) => Promise<BigNumber>;
6
+ /**
7
+ * Get approval actions given a list of insufficent approvals.
8
+ */
9
+ export declare function getApprovalActions(insufficientApprovals: InsufficientApprovals, signer: providers.JsonRpcSigner): Promise<ApprovalAction[]>;
@@ -1,4 +1,4 @@
1
- import { providers as multicallProviders } from "@0xsequence/multicall";
2
- import { BigNumber } from "ethers";
3
- import type { InputCriteria, Item } from "../types";
4
- export declare const balanceOf: (owner: string, item: Item, multicallProvider: multicallProviders.MulticallProvider, criteria?: InputCriteria | undefined) => Promise<BigNumber>;
1
+ import { providers as multicallProviders } from "@0xsequence/multicall";
2
+ import { BigNumber } from "ethers";
3
+ import type { InputCriteria, Item } from "../types";
4
+ export declare const balanceOf: (owner: string, item: Item, multicallProvider: multicallProviders.MulticallProvider, criteria?: InputCriteria | undefined) => Promise<BigNumber>;