@imtbl/orderbook 2.0.0-alpha.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 (119) hide show
  1. package/LICENSE.md +176 -0
  2. package/README.md +71 -0
  3. package/dist/browser/index.js +2 -0
  4. package/dist/node/index.cjs +2 -0
  5. package/dist/node/index.js +2 -0
  6. package/dist/types/api-client/api-client-factory.d.ts +8 -0
  7. package/dist/types/api-client/api-client.d.ts +29 -0
  8. package/dist/types/api-client/api-client.test.d.ts +1 -0
  9. package/dist/types/api-client/index.d.ts +2 -0
  10. package/dist/types/config/config.d.ts +20 -0
  11. package/dist/types/config/index.d.ts +1 -0
  12. package/dist/types/constants.d.ts +3 -0
  13. package/dist/types/erc721/erc721-factory.d.ts +7 -0
  14. package/dist/types/erc721/erc721.d.ts +7 -0
  15. package/dist/types/erc721/erc721.test.d.ts +1 -0
  16. package/dist/types/erc721/index.d.ts +2 -0
  17. package/dist/types/index.d.ts +4 -0
  18. package/dist/types/openapi/mapper.d.ts +10 -0
  19. package/dist/types/openapi/sdk/OrderBookClient.d.ts +10 -0
  20. package/dist/types/openapi/sdk/core/ApiError.d.ts +10 -0
  21. package/dist/types/openapi/sdk/core/ApiRequestOptions.d.ts +13 -0
  22. package/dist/types/openapi/sdk/core/ApiResult.d.ts +7 -0
  23. package/dist/types/openapi/sdk/core/AxiosHttpRequest.d.ts +14 -0
  24. package/dist/types/openapi/sdk/core/BaseHttpRequest.d.ts +8 -0
  25. package/dist/types/openapi/sdk/core/CancelablePromise.d.ts +26 -0
  26. package/dist/types/openapi/sdk/core/OpenAPI.d.ts +16 -0
  27. package/dist/types/openapi/sdk/core/request.d.ts +11 -0
  28. package/dist/types/openapi/sdk/index.d.ts +53 -0
  29. package/dist/types/openapi/sdk/models/ActiveOrderStatus.d.ts +6 -0
  30. package/dist/types/openapi/sdk/models/AssetCollectionItem.d.ts +3 -0
  31. package/dist/types/openapi/sdk/models/BidResult.d.ts +4 -0
  32. package/dist/types/openapi/sdk/models/CancelOrdersRequestBody.d.ts +14 -0
  33. package/dist/types/openapi/sdk/models/CancelOrdersResult.d.ts +4 -0
  34. package/dist/types/openapi/sdk/models/CancelOrdersResultData.d.ts +15 -0
  35. package/dist/types/openapi/sdk/models/CancelledOrderStatus.d.ts +24 -0
  36. package/dist/types/openapi/sdk/models/Chain.d.ts +13 -0
  37. package/dist/types/openapi/sdk/models/ChainName.d.ts +4 -0
  38. package/dist/types/openapi/sdk/models/CollectionBidResult.d.ts +4 -0
  39. package/dist/types/openapi/sdk/models/CreateBidRequestBody.d.ts +37 -0
  40. package/dist/types/openapi/sdk/models/CreateCollectionBidRequestBody.d.ts +37 -0
  41. package/dist/types/openapi/sdk/models/CreateListingRequestBody.d.ts +36 -0
  42. package/dist/types/openapi/sdk/models/ERC1155CollectionItem.d.ts +14 -0
  43. package/dist/types/openapi/sdk/models/ERC1155Item.d.ts +18 -0
  44. package/dist/types/openapi/sdk/models/ERC20Item.d.ts +14 -0
  45. package/dist/types/openapi/sdk/models/ERC721CollectionItem.d.ts +14 -0
  46. package/dist/types/openapi/sdk/models/ERC721Item.d.ts +14 -0
  47. package/dist/types/openapi/sdk/models/Error.d.ts +13 -0
  48. package/dist/types/openapi/sdk/models/ExpiredOrderStatus.d.ts +6 -0
  49. package/dist/types/openapi/sdk/models/FailedOrderCancellation.d.ts +18 -0
  50. package/dist/types/openapi/sdk/models/Fee.d.ts +25 -0
  51. package/dist/types/openapi/sdk/models/FillStatus.d.ts +13 -0
  52. package/dist/types/openapi/sdk/models/FilledOrderStatus.d.ts +6 -0
  53. package/dist/types/openapi/sdk/models/FulfillableOrder.d.ts +9 -0
  54. package/dist/types/openapi/sdk/models/FulfillmentDataRequest.d.ts +13 -0
  55. package/dist/types/openapi/sdk/models/InactiveOrderStatus.d.ts +14 -0
  56. package/dist/types/openapi/sdk/models/Item.d.ts +7 -0
  57. package/dist/types/openapi/sdk/models/ListBidsResult.d.ts +6 -0
  58. package/dist/types/openapi/sdk/models/ListCollectionBidsResult.d.ts +6 -0
  59. package/dist/types/openapi/sdk/models/ListListingsResult.d.ts +6 -0
  60. package/dist/types/openapi/sdk/models/ListTradeResult.d.ts +6 -0
  61. package/dist/types/openapi/sdk/models/ListingResult.d.ts +4 -0
  62. package/dist/types/openapi/sdk/models/NativeItem.d.ts +10 -0
  63. package/dist/types/openapi/sdk/models/Order.d.ts +59 -0
  64. package/dist/types/openapi/sdk/models/OrderStatus.d.ts +10 -0
  65. package/dist/types/openapi/sdk/models/OrderStatusName.d.ts +11 -0
  66. package/dist/types/openapi/sdk/models/Page.d.ts +13 -0
  67. package/dist/types/openapi/sdk/models/PageCursor.d.ts +4 -0
  68. package/dist/types/openapi/sdk/models/PageSize.d.ts +4 -0
  69. package/dist/types/openapi/sdk/models/PendingOrderStatus.d.ts +14 -0
  70. package/dist/types/openapi/sdk/models/ProtocolData.d.ts +31 -0
  71. package/dist/types/openapi/sdk/models/Trade.d.ts +40 -0
  72. package/dist/types/openapi/sdk/models/TradeBlockchainMetadata.d.ts +21 -0
  73. package/dist/types/openapi/sdk/models/TradeResult.d.ts +4 -0
  74. package/dist/types/openapi/sdk/models/UnfulfillableOrder.d.ts +14 -0
  75. package/dist/types/openapi/sdk/services/OrdersService.d.ts +319 -0
  76. package/dist/types/orderbook.d.ts +193 -0
  77. package/dist/types/seaport/components.d.ts +8 -0
  78. package/dist/types/seaport/constants.d.ts +43 -0
  79. package/dist/types/seaport/index.d.ts +2 -0
  80. package/dist/types/seaport/lib/bulk-orders.d.ts +6 -0
  81. package/dist/types/seaport/lib/defaults.d.ts +14 -0
  82. package/dist/types/seaport/lib/merkle.d.ts +33 -0
  83. package/dist/types/seaport/lib/utils.d.ts +10 -0
  84. package/dist/types/seaport/map-to-immutable-order.d.ts +7 -0
  85. package/dist/types/seaport/map-to-seaport-order.d.ts +6 -0
  86. package/dist/types/seaport/seaport-lib-factory.d.ts +10 -0
  87. package/dist/types/seaport/seaport.d.ts +38 -0
  88. package/dist/types/seaport/seaport.test.d.ts +1 -0
  89. package/dist/types/seaport/transaction.d.ts +3 -0
  90. package/dist/types/test/bulk-listings.e2e.d.ts +1 -0
  91. package/dist/types/test/cancel.e2e.d.ts +1 -0
  92. package/dist/types/test/create.e2e.d.ts +1 -0
  93. package/dist/types/test/expiry.demo.d.ts +1 -0
  94. package/dist/types/test/fulfil.e2e.d.ts +1 -0
  95. package/dist/types/test/fulfill.demo.d.ts +1 -0
  96. package/dist/types/test/fulfillBulk.demo.d.ts +1 -0
  97. package/dist/types/test/helpers/actions.d.ts +3 -0
  98. package/dist/types/test/helpers/config.d.ts +2 -0
  99. package/dist/types/test/helpers/erc721.d.ts +6 -0
  100. package/dist/types/test/helpers/gas.d.ts +4 -0
  101. package/dist/types/test/helpers/index.d.ts +8 -0
  102. package/dist/types/test/helpers/order.d.ts +3 -0
  103. package/dist/types/test/helpers/provider.d.ts +2 -0
  104. package/dist/types/test/helpers/sign-and-submit.d.ts +7 -0
  105. package/dist/types/test/helpers/signers.d.ts +3 -0
  106. package/dist/types/test/helpers/test-token/TestERC721Token.d.ts +715 -0
  107. package/dist/types/test/helpers/test-token/TestERC721Token__factory.d.ts +1043 -0
  108. package/dist/types/test/helpers/test-token/common.d.ts +50 -0
  109. package/dist/types/test/helpers/test-token/index.d.ts +2 -0
  110. package/dist/types/test/helpers/token.d.ts +1 -0
  111. package/dist/types/test/list.e2e.d.ts +1 -0
  112. package/dist/types/typechain/types/ImmutableERC721Base.d.ts +486 -0
  113. package/dist/types/typechain/types/common.d.ts +50 -0
  114. package/dist/types/typechain/types/factories/ImmutableERC721Base__factory.d.ts +688 -0
  115. package/dist/types/typechain/types/factories/index.d.ts +1 -0
  116. package/dist/types/typechain/types/index.d.ts +3 -0
  117. package/dist/types/types.d.ts +367 -0
  118. package/dist/types/utils.d.ts +1 -0
  119. package/package.json +73 -0
@@ -0,0 +1,319 @@
1
+ import type { BidResult } from '../models/BidResult';
2
+ import type { CancelOrdersRequestBody } from '../models/CancelOrdersRequestBody';
3
+ import type { CancelOrdersResult } from '../models/CancelOrdersResult';
4
+ import type { ChainName } from '../models/ChainName';
5
+ import type { CollectionBidResult } from '../models/CollectionBidResult';
6
+ import type { CreateBidRequestBody } from '../models/CreateBidRequestBody';
7
+ import type { CreateCollectionBidRequestBody } from '../models/CreateCollectionBidRequestBody';
8
+ import type { CreateListingRequestBody } from '../models/CreateListingRequestBody';
9
+ import type { FulfillableOrder } from '../models/FulfillableOrder';
10
+ import type { FulfillmentDataRequest } from '../models/FulfillmentDataRequest';
11
+ import type { ListBidsResult } from '../models/ListBidsResult';
12
+ import type { ListCollectionBidsResult } from '../models/ListCollectionBidsResult';
13
+ import type { ListingResult } from '../models/ListingResult';
14
+ import type { ListListingsResult } from '../models/ListListingsResult';
15
+ import type { ListTradeResult } from '../models/ListTradeResult';
16
+ import type { OrderStatusName } from '../models/OrderStatusName';
17
+ import type { PageCursor } from '../models/PageCursor';
18
+ import type { PageSize } from '../models/PageSize';
19
+ import type { TradeResult } from '../models/TradeResult';
20
+ import type { UnfulfillableOrder } from '../models/UnfulfillableOrder';
21
+ import type { CancelablePromise } from '../core/CancelablePromise';
22
+ import type { BaseHttpRequest } from '../core/BaseHttpRequest';
23
+ export declare class OrdersService {
24
+ readonly httpRequest: BaseHttpRequest;
25
+ constructor(httpRequest: BaseHttpRequest);
26
+ /**
27
+ * Cancel one or more orders
28
+ * Cancel one or more orders
29
+ * @returns CancelOrdersResult Orders cancellation response.
30
+ * @throws ApiError
31
+ */
32
+ cancelOrders({ chainName, requestBody, }: {
33
+ chainName: ChainName;
34
+ requestBody: CancelOrdersRequestBody;
35
+ }): CancelablePromise<CancelOrdersResult>;
36
+ /**
37
+ * List all listings
38
+ * List all listings
39
+ * @returns ListListingsResult OK response.
40
+ * @throws ApiError
41
+ */
42
+ listListings({ chainName, status, sellItemContractAddress, buyItemType, buyItemContractAddress, accountAddress, sellItemMetadataId, sellItemTokenId, fromUpdatedAt, pageSize, sortBy, sortDirection, pageCursor, }: {
43
+ chainName: ChainName;
44
+ /**
45
+ * Order status to filter by
46
+ */
47
+ status?: OrderStatusName;
48
+ /**
49
+ * Sell item contract address to filter by
50
+ */
51
+ sellItemContractAddress?: string;
52
+ /**
53
+ * Buy item type to filter by
54
+ */
55
+ buyItemType?: 'NATIVE' | 'ERC20';
56
+ /**
57
+ * Buy item contract address to filter by
58
+ */
59
+ buyItemContractAddress?: string;
60
+ /**
61
+ * The account address of the user who created the listing
62
+ */
63
+ accountAddress?: string;
64
+ /**
65
+ * The metadata_id of the sell item
66
+ */
67
+ sellItemMetadataId?: string;
68
+ /**
69
+ * Sell item token identifier to filter by
70
+ */
71
+ sellItemTokenId?: string;
72
+ /**
73
+ * From updated at including given date
74
+ */
75
+ fromUpdatedAt?: string;
76
+ /**
77
+ * Maximum number of orders to return per page
78
+ */
79
+ pageSize?: PageSize;
80
+ /**
81
+ * Order field to sort by. `buy_item_amount` sorts by per token price, for example if 5 ERC-1155s are on sale for 10eth, it’s sorted as 2eth for `buy_item_amount`.
82
+ */
83
+ sortBy?: 'created_at' | 'updated_at' | 'buy_item_amount';
84
+ /**
85
+ * Ascending or descending direction for sort
86
+ */
87
+ sortDirection?: 'asc' | 'desc';
88
+ /**
89
+ * Page cursor to retrieve previous or next page. Use the value returned in the response.
90
+ */
91
+ pageCursor?: PageCursor;
92
+ }): CancelablePromise<ListListingsResult>;
93
+ /**
94
+ * Create a listing
95
+ * Create a listing
96
+ * @returns ListingResult Created response.
97
+ * @throws ApiError
98
+ */
99
+ createListing({ chainName, requestBody, }: {
100
+ chainName: ChainName;
101
+ requestBody: CreateListingRequestBody;
102
+ }): CancelablePromise<ListingResult>;
103
+ /**
104
+ * List all bids
105
+ * List all bids
106
+ * @returns ListBidsResult OK response.
107
+ * @throws ApiError
108
+ */
109
+ listBids({ chainName, status, buyItemContractAddress, sellItemContractAddress, accountAddress, buyItemMetadataId, buyItemTokenId, fromUpdatedAt, pageSize, sortBy, sortDirection, pageCursor, }: {
110
+ chainName: ChainName;
111
+ /**
112
+ * Order status to filter by
113
+ */
114
+ status?: OrderStatusName;
115
+ /**
116
+ * Buy item contract address to filter by
117
+ */
118
+ buyItemContractAddress?: string;
119
+ /**
120
+ * Sell item contract address to filter by
121
+ */
122
+ sellItemContractAddress?: string;
123
+ /**
124
+ * The account address of the user who created the bid
125
+ */
126
+ accountAddress?: string;
127
+ /**
128
+ * The metadata_id of the buy item
129
+ */
130
+ buyItemMetadataId?: string;
131
+ /**
132
+ * buy item token identifier to filter by
133
+ */
134
+ buyItemTokenId?: string;
135
+ /**
136
+ * From updated at including given date
137
+ */
138
+ fromUpdatedAt?: string;
139
+ /**
140
+ * Maximum number of orders to return per page
141
+ */
142
+ pageSize?: PageSize;
143
+ /**
144
+ * Order field to sort by. `sell_item_amount` sorts by per token price, for example if 10eth is offered for 5 ERC1155 items, it’s sorted as 2eth for `sell_item_amount`.
145
+ */
146
+ sortBy?: 'created_at' | 'updated_at' | 'sell_item_amount';
147
+ /**
148
+ * Ascending or descending direction for sort
149
+ */
150
+ sortDirection?: 'asc' | 'desc';
151
+ /**
152
+ * Page cursor to retrieve previous or next page. Use the value returned in the response.
153
+ */
154
+ pageCursor?: PageCursor;
155
+ }): CancelablePromise<ListBidsResult>;
156
+ /**
157
+ * Create a bid
158
+ * Create a bid
159
+ * @returns BidResult Created response.
160
+ * @throws ApiError
161
+ */
162
+ createBid({ chainName, requestBody, }: {
163
+ chainName: ChainName;
164
+ requestBody: CreateBidRequestBody;
165
+ }): CancelablePromise<BidResult>;
166
+ /**
167
+ * List all collection bids
168
+ * List all collection bids
169
+ * @returns ListCollectionBidsResult OK response.
170
+ * @throws ApiError
171
+ */
172
+ listCollectionBids({ chainName, status, buyItemContractAddress, sellItemContractAddress, accountAddress, fromUpdatedAt, pageSize, sortBy, sortDirection, pageCursor, }: {
173
+ chainName: ChainName;
174
+ /**
175
+ * Order status to filter by
176
+ */
177
+ status?: OrderStatusName;
178
+ /**
179
+ * Buy item contract address to filter by
180
+ */
181
+ buyItemContractAddress?: string;
182
+ /**
183
+ * Sell item contract address to filter by
184
+ */
185
+ sellItemContractAddress?: string;
186
+ /**
187
+ * The account address of the user who created the bid
188
+ */
189
+ accountAddress?: string;
190
+ /**
191
+ * From updated at including given date
192
+ */
193
+ fromUpdatedAt?: string;
194
+ /**
195
+ * Maximum number of orders to return per page
196
+ */
197
+ pageSize?: PageSize;
198
+ /**
199
+ * Order field to sort by. `sell_item_amount` sorts by per token price, for example if 10eth is offered for 5 ERC1155 items, it’s sorted as 2eth for `sell_item_amount`.
200
+ */
201
+ sortBy?: 'created_at' | 'updated_at' | 'sell_item_amount';
202
+ /**
203
+ * Ascending or descending direction for sort
204
+ */
205
+ sortDirection?: 'asc' | 'desc';
206
+ /**
207
+ * Page cursor to retrieve previous or next page. Use the value returned in the response.
208
+ */
209
+ pageCursor?: PageCursor;
210
+ }): CancelablePromise<ListCollectionBidsResult>;
211
+ /**
212
+ * Create a collection bid
213
+ * Create a collection bid
214
+ * @returns CollectionBidResult Created response.
215
+ * @throws ApiError
216
+ */
217
+ createCollectionBid({ chainName, requestBody, }: {
218
+ chainName: ChainName;
219
+ requestBody: CreateCollectionBidRequestBody;
220
+ }): CancelablePromise<CollectionBidResult>;
221
+ /**
222
+ * Get a single listing by ID
223
+ * Get a single listing by ID
224
+ * @returns ListingResult OK response.
225
+ * @throws ApiError
226
+ */
227
+ getListing({ chainName, listingId, }: {
228
+ chainName: ChainName;
229
+ /**
230
+ * Global Order identifier
231
+ */
232
+ listingId: string;
233
+ }): CancelablePromise<ListingResult>;
234
+ /**
235
+ * Get a single bid by ID
236
+ * Get a single bid by ID
237
+ * @returns BidResult OK response.
238
+ * @throws ApiError
239
+ */
240
+ getBid({ chainName, bidId, }: {
241
+ chainName: ChainName;
242
+ /**
243
+ * Global Bid identifier
244
+ */
245
+ bidId: string;
246
+ }): CancelablePromise<BidResult>;
247
+ /**
248
+ * Get a single collection bid by ID
249
+ * Get a single collection bid by ID
250
+ * @returns CollectionBidResult OK response.
251
+ * @throws ApiError
252
+ */
253
+ getCollectionBid({ chainName, collectionBidId, }: {
254
+ chainName: ChainName;
255
+ /**
256
+ * Global Collection Bid identifier
257
+ */
258
+ collectionBidId: string;
259
+ }): CancelablePromise<CollectionBidResult>;
260
+ /**
261
+ * Retrieve fulfillment data for orders
262
+ * Retrieve signed fulfillment data based on the list of order IDs and corresponding fees.
263
+ * @returns any Successful response
264
+ * @throws ApiError
265
+ */
266
+ fulfillmentData({ chainName, requestBody, }: {
267
+ chainName: ChainName;
268
+ requestBody: Array<FulfillmentDataRequest>;
269
+ }): CancelablePromise<{
270
+ result: {
271
+ fulfillable_orders: Array<FulfillableOrder>;
272
+ unfulfillable_orders: Array<UnfulfillableOrder>;
273
+ };
274
+ }>;
275
+ /**
276
+ * List all trades
277
+ * List all trades
278
+ * @returns ListTradeResult OK response.
279
+ * @throws ApiError
280
+ */
281
+ listTrades({ chainName, accountAddress, sellItemContractAddress, fromIndexedAt, pageSize, sortBy, sortDirection, pageCursor, }: {
282
+ chainName: ChainName;
283
+ accountAddress?: string;
284
+ sellItemContractAddress?: string;
285
+ /**
286
+ * From indexed at including given date
287
+ */
288
+ fromIndexedAt?: string;
289
+ /**
290
+ * Maximum number of trades to return per page
291
+ */
292
+ pageSize?: PageSize;
293
+ /**
294
+ * Trade field to sort by
295
+ */
296
+ sortBy?: 'indexed_at';
297
+ /**
298
+ * Ascending or descending direction for sort
299
+ */
300
+ sortDirection?: 'asc' | 'desc';
301
+ /**
302
+ * Page cursor to retrieve previous or next page. Use the value returned in the response.
303
+ */
304
+ pageCursor?: PageCursor;
305
+ }): CancelablePromise<ListTradeResult>;
306
+ /**
307
+ * Get a single trade by ID
308
+ * Get a single trade by ID
309
+ * @returns TradeResult OK response.
310
+ * @throws ApiError
311
+ */
312
+ getTrade({ chainName, tradeId, }: {
313
+ chainName: ChainName;
314
+ /**
315
+ * Global Trade identifier
316
+ */
317
+ tradeId: string;
318
+ }): CancelablePromise<TradeResult>;
319
+ }
@@ -0,0 +1,193 @@
1
+ import { ModuleConfiguration } from '@imtbl/config';
2
+ import { OrderbookModuleConfiguration, OrderbookOverrides } from './config/config';
3
+ import { CancelOrdersResult } from './openapi/sdk';
4
+ import { BidResult, CancelOrdersOnChainResponse, CollectionBidResult, CreateBidParams, CreateCollectionBidParams, CreateListingParams, FeeValue, FulfillBulkOrdersResponse, FulfillmentListing, FulfillmentOrder, FulfillOrderResponse, ListBidsParams, ListBidsResult, ListCollectionBidsParams, ListCollectionBidsResult, ListingResult, ListListingsParams, ListListingsResult, ListTradesParams, ListTradesResult, PrepareBidParams, PrepareBidResponse, PrepareBulkListingsParams, PrepareBulkListingsResponse, PrepareCancelOrdersResponse, PrepareCollectionBidParams, PrepareCollectionBidResponse, PrepareListingParams, PrepareListingResponse, TradeResult } from './types';
5
+ /**
6
+ * zkEVM orderbook SDK
7
+ * @constructor
8
+ * @param {OrderbookModuleConfiguration} config - Configuration for Immutable services.
9
+ */
10
+ export declare class Orderbook {
11
+ private apiClient;
12
+ private seaport;
13
+ private orderbookConfig;
14
+ constructor(config: ModuleConfiguration<OrderbookOverrides>);
15
+ static defaultOrderExpiry(): Date;
16
+ /**
17
+ * Return the configuration for the orderbook module.
18
+ * @return {OrderbookModuleConfiguration} The configuration for the orderbook module.
19
+ */
20
+ config(): OrderbookModuleConfiguration;
21
+ /**
22
+ * Get a listing by ID
23
+ * @param {string} listingId - The listingId to find.
24
+ * @return {ListingResult} The returned listing result.
25
+ */
26
+ getListing(listingId: string): Promise<ListingResult>;
27
+ /**
28
+ * Get a bid by ID
29
+ * @param {string} bidId - The bidId to find.
30
+ * @return {BidResult} The returned bid result.
31
+ */
32
+ getBid(bidId: string): Promise<BidResult>;
33
+ /**
34
+ * Get a collection bid by ID
35
+ * @param {string} collectionBidId - The collectionBidId to find.
36
+ * @return {CollectionBidResult} The returned collection bid result.
37
+ */
38
+ getCollectionBid(collectionBidId: string): Promise<CollectionBidResult>;
39
+ /**
40
+ * Get a trade by ID
41
+ * @param {string} tradeId - The tradeId to find.
42
+ * @return {TradeResult} The returned trade result.
43
+ */
44
+ getTrade(tradeId: string): Promise<TradeResult>;
45
+ /**
46
+ * List listings. This method is used to get a list of listings filtered by conditions specified
47
+ * in the params object.
48
+ * @param {ListListingsParams} listOrderParams - Filtering, ordering and page parameters.
49
+ * @return {ListListingsResult} The paged listings.
50
+ */
51
+ listListings(listOrderParams: ListListingsParams): Promise<ListListingsResult>;
52
+ /**
53
+ * List bids. This method is used to get a list of bids filtered by conditions specified
54
+ * in the params object.
55
+ * @param {ListBidsParams} listOrderParams - Filtering, ordering and page parameters.
56
+ * @return {ListBidsResult} The paged bids.
57
+ */
58
+ listBids(listOrderParams: ListBidsParams): Promise<ListBidsResult>;
59
+ /**
60
+ * List collection bids. This method is used to get a list of collection bids filtered
61
+ * by conditions specified in the params object.
62
+ * @param {ListCollectionBidsParams} listOrderParams - Filtering, ordering and page parameters.
63
+ * @return {ListCollectionBidsResult} The paged collection bids.
64
+ */
65
+ listCollectionBids(listOrderParams: ListCollectionBidsParams): Promise<ListCollectionBidsResult>;
66
+ /**
67
+ * List trades. This method is used to get a list of trades filtered by conditions specified
68
+ * in the params object
69
+ * @param {ListTradesParams} listTradesParams - Filtering, ordering and page parameters.
70
+ * @return {ListTradesResult} The paged trades.
71
+ */
72
+ listTrades(listTradesParams: ListTradesParams): Promise<ListTradesResult>;
73
+ /**
74
+ * Get required transactions and messages for signing to facilitate creating bulk listings.
75
+ * Once the transactions are submitted and the message signed, call the
76
+ * {@linkcode PrepareBulkListingsResponse.completeListings} method provided in the return
77
+ * type with the signature. This method supports up to 20 listing creations
78
+ * at a time. It can also be used for individual listings to simplify integration code paths.
79
+ *
80
+ * Bulk listings created using an EOA (Metamask) will require a single listing confirmation
81
+ * signature.
82
+ * Bulk listings creating using a smart contract wallet will require multiple listing confirmation
83
+ * signatures (as many as the number of orders).
84
+ * @param {PrepareBulkListingsParams} prepareBulkListingsParams - Details about the listings
85
+ * to be created.
86
+ * @return {PrepareBulkListingsResponse} PrepareBulkListingsResponse includes
87
+ * any unsigned approval transactions, the typed bulk order message for signing and
88
+ * the {@linkcode PrepareBulkListingsResponse.completeListings} method that can be called with
89
+ * the signature(s) to create the listings.
90
+ */
91
+ prepareBulkListings({ makerAddress, listingParams, }: PrepareBulkListingsParams): Promise<PrepareBulkListingsResponse>;
92
+ /**
93
+ * Get required transactions and messages for signing prior to creating a listing
94
+ * through the {@linkcode createListing} method
95
+ * @param {PrepareListingParams} prepareListingParams - Details about the listing to be created.
96
+ * @return {PrepareListingResponse} PrepareListingResponse includes
97
+ * the unsigned approval transaction, the typed order message for signing and
98
+ * the order components that can be submitted to {@linkcode createListing} with a signature.
99
+ */
100
+ prepareListing({ makerAddress, sell, buy, orderStart, orderExpiry, }: PrepareListingParams): Promise<PrepareListingResponse>;
101
+ /**
102
+ * Create a listing
103
+ * @param {CreateListingParams} createListingParams - create a listing with the given params.
104
+ * @return {ListingResult} The result of the listing created in the Immutable services.
105
+ */
106
+ createListing(createListingParams: CreateListingParams): Promise<ListingResult>;
107
+ /**
108
+ * Get required transactions and messages for signing prior to creating a bid
109
+ * through the {@linkcode createBid} method
110
+ * @param {PrepareBidParams} prepareBidParams - Details about the bid to be created.
111
+ * @return {PrepareBidResponse} PrepareBidResponse includes
112
+ * the unsigned approval transaction, the typed order message for signing and
113
+ * the order components that can be submitted to {@linkcode createBid} with a signature.
114
+ */
115
+ prepareBid({ makerAddress, sell, buy, orderStart, orderExpiry, }: PrepareBidParams): Promise<PrepareBidResponse>;
116
+ /**
117
+ * Create a bid
118
+ * @param {CreateBidParams} createBidParams - create a bid with the given params.
119
+ * @return {BidResult} The result of the bid created in the Immutable services.
120
+ */
121
+ createBid(createBidParams: CreateBidParams): Promise<BidResult>;
122
+ /**
123
+ * Get required transactions and messages for signing prior to creating a collection bid
124
+ * through the {@linkcode createCollectionBid} method
125
+ * @param {PrepareCollectionBidParams} - Details about the collection bid to be created.
126
+ * @return {PrepareCollectionBidResponse} PrepareCollectionBidResponse includes
127
+ * the unsigned approval transaction, the typed order message for signing and
128
+ * the order components that can be submitted to {@linkcode createCollectionBid} with a signature.
129
+ */
130
+ prepareCollectionBid({ makerAddress, sell, buy, orderStart, orderExpiry, }: PrepareCollectionBidParams): Promise<PrepareCollectionBidResponse>;
131
+ /**
132
+ * Create a collection bid
133
+ * @param {CreateCollectionBidParams} createCollectionBidParams create a collection bid
134
+ * with the given params.
135
+ * @return {CollectionBidResult} The result of the collection bid created
136
+ * in the Immutable services.
137
+ */
138
+ createCollectionBid(createCollectionBidParams: CreateCollectionBidParams): Promise<CollectionBidResult>;
139
+ /**
140
+ * Get unsigned transactions that can be submitted to fulfil an open order. If the approval
141
+ * transaction exists it must be signed and submitted to the chain before the fulfilment
142
+ * transaction can be submitted or it will be reverted.
143
+ * @param {string} orderId - The orderId to fulfil.
144
+ * @param {string} takerAddress - The address of the account fulfilling the order.
145
+ * @param {FeeValue[]} takerFees - Taker ecosystem fees to be paid.
146
+ * @param {string} amountToFill - Amount of the order to fill, defaults to sell item amount.
147
+ * Only applies to ERC1155 orders
148
+ * @return {FulfillOrderResponse} Approval and fulfilment transactions.
149
+ */
150
+ fulfillOrder(orderId: string, takerAddress: string, takerFees: FeeValue[], amountToFill?: string, tokenId?: string): Promise<FulfillOrderResponse>;
151
+ /**
152
+ * Get unsigned transactions that can be submitted to fulfil multiple open orders. If approval
153
+ * transactions exist, they must be signed and submitted to the chain before the fulfilment
154
+ * transaction can be submitted or it will be reverted.
155
+ * @param {FulfillmentOrder[]} orders - The details of the orders to fulfil, amounts
156
+ * to fill and taker ecosystem fees to be paid.
157
+ * @param {string} takerAddress - The address of the account fulfilling the order.
158
+ * @return {FulfillBulkOrdersResponse} Approval and fulfilment transactions.
159
+ */
160
+ fulfillBulkOrders(orders: FulfillmentOrder[] | FulfillmentListing[], takerAddress: string): Promise<FulfillBulkOrdersResponse>;
161
+ /**
162
+ * Cancelling orders is a gasless alternative to on-chain cancellation exposed with
163
+ * {@linkcode cancelOrdersOnChain}. For the orderbook to authenticate the cancellation,
164
+ * the creator of the orders must sign an EIP712 message containing the orderIds.
165
+ * @param {string} orderIds - The orderIds to attempt to cancel.
166
+ * @return {PrepareCancelOrdersResponse} The signable action to cancel the orders.
167
+ */
168
+ prepareOrderCancellations(orderIds: string[]): Promise<PrepareCancelOrdersResponse>;
169
+ /**
170
+ * Cancelling orders is a gasless alternative to on-chain cancellation exposed with
171
+ * {@linkcode cancelOrdersOnChain}. Orders cancelled this way cannot be fulfilled and
172
+ * will be removed from the orderbook. If there is pending fulfillment data outstanding
173
+ * for the order, its cancellation will be pending until the fulfillment window has passed.
174
+ * {@linkcode prepareOrderCancellations} can be used to get the signable action that is signed
175
+ * to get the signature required for this call.
176
+ * @param {string[]} orderIds - The orderIds to attempt to cancel.
177
+ * @param {string} accountAddress - The address of the account cancelling the orders.
178
+ * @param {string} signature - The signature obtained by signing the
179
+ * message obtained from {@linkcode prepareOrderCancellations}.
180
+ * @return {CancelOrdersResult} The result of the off-chain cancellation request
181
+ */
182
+ cancelOrders(orderIds: string[], accountAddress: string, signature: string): Promise<CancelOrdersResult>;
183
+ /**
184
+ * Get an unsigned order cancellation transaction. Orders can only be cancelled by
185
+ * the account that created them. All of the orders must be from the same seaport contract.
186
+ * If trying to cancel orders from multiple seaport contracts, group the orderIds by seaport
187
+ * contract and call this method for each group.
188
+ * @param {string[]} orderIds - The orderIds to cancel.
189
+ * @param {string} accountAddress - The address of the account cancelling the order.
190
+ * @return {CancelOrdersOnChainResponse} The unsigned cancel order action
191
+ */
192
+ cancelOrdersOnChain(orderIds: string[], accountAddress: string): Promise<CancelOrdersOnChainResponse>;
193
+ }
@@ -0,0 +1,8 @@
1
+ import type { OrderComponents } from '@opensea/seaport-js/lib/types';
2
+ export declare function getOrderComponentsFromMessage(orderMessage: string): OrderComponents;
3
+ export declare function getBulkOrderComponentsFromMessage(orderMessage: string): {
4
+ components: OrderComponents[];
5
+ types: any;
6
+ value: any;
7
+ };
8
+ export declare function getBulkSeaportOrderSignatures(signature: string, orderComponents: OrderComponents[]): string[];
@@ -0,0 +1,43 @@
1
+ export declare const SEAPORT_CONTRACT_NAME = "ImmutableSeaport";
2
+ export declare const SEAPORT_CONTRACT_VERSION_V1_5 = "1.5";
3
+ export declare const EIP_712_ORDER_TYPE: {
4
+ OrderComponents: {
5
+ name: string;
6
+ type: string;
7
+ }[];
8
+ OfferItem: {
9
+ name: string;
10
+ type: string;
11
+ }[];
12
+ ConsiderationItem: {
13
+ name: string;
14
+ type: string;
15
+ }[];
16
+ };
17
+ export declare enum OrderType {
18
+ FULL_OPEN = 0,// No partial fills, anyone can execute
19
+ PARTIAL_OPEN = 1,// Partial fills supported, anyone can execute
20
+ FULL_RESTRICTED = 2,// No partial fills, only offerer or zone can execute
21
+ PARTIAL_RESTRICTED = 3
22
+ }
23
+ export declare enum ItemType {
24
+ NATIVE = 0,
25
+ ERC20 = 1,
26
+ ERC721 = 2,
27
+ ERC1155 = 3,
28
+ ERC721_WITH_CRITERIA = 4,
29
+ ERC1155_WITH_CRITERIA = 5
30
+ }
31
+ export declare enum Side {
32
+ OFFER = 0,
33
+ CONSIDERATION = 1
34
+ }
35
+ export type NftItemType = ItemType.ERC721 | ItemType.ERC1155 | ItemType.ERC721_WITH_CRITERIA | ItemType.ERC1155_WITH_CRITERIA;
36
+ export declare enum BasicOrderRouteType {
37
+ ETH_TO_ERC721 = 0,
38
+ ETH_TO_ERC1155 = 1,
39
+ ERC20_TO_ERC721 = 2,
40
+ ERC20_TO_ERC1155 = 3,
41
+ ERC721_TO_ERC20 = 4,
42
+ ERC1155_TO_ERC20 = 5
43
+ }
@@ -0,0 +1,2 @@
1
+ export * from './seaport';
2
+ export * from './constants';
@@ -0,0 +1,6 @@
1
+ import type { OrderComponents } from '@opensea/seaport-js/lib/types';
2
+ import { Eip712MerkleTree } from './merkle';
3
+ export declare function getBulkOrderTreeHeight(length: number): number;
4
+ export declare function getBulkOrderTree(orderComponents: OrderComponents[], startIndex?: number, height?: number): Eip712MerkleTree<OrderComponents>;
5
+ export declare function getBulkOrderTypeHash(height: number): string;
6
+ export declare function getBulkOrderTypeHashes(maxHeight: number): string[];
@@ -0,0 +1,14 @@
1
+ import { TypedDataField } from 'ethers';
2
+ export type EIP712TypeDefinitions = Record<string, TypedDataField[]>;
3
+ type DefaultMap<T extends EIP712TypeDefinitions> = {
4
+ [K in keyof T]: any;
5
+ };
6
+ export declare class DefaultGetter<Types extends EIP712TypeDefinitions> {
7
+ protected types: Types;
8
+ defaultValues: DefaultMap<Types>;
9
+ constructor(types: Types);
10
+ static from<Types extends EIP712TypeDefinitions>(types: Types): DefaultMap<Types>;
11
+ static from<Types extends EIP712TypeDefinitions>(types: Types, type: keyof Types): any;
12
+ getDefaultValue(type: string): any;
13
+ }
14
+ export {};
@@ -0,0 +1,33 @@
1
+ import { MerkleTree } from 'merkletreejs';
2
+ import { TypedDataEncoder } from 'ethers';
3
+ import type { EIP712TypeDefinitions } from './defaults';
4
+ type BulkOrderElements<T> = [T, T] | [BulkOrderElements<T>, BulkOrderElements<T>];
5
+ export declare class Eip712MerkleTree<BaseType extends Record<string, any> = any> {
6
+ types: EIP712TypeDefinitions;
7
+ rootType: string;
8
+ leafType: string;
9
+ elements: BaseType[];
10
+ depth: number;
11
+ tree: MerkleTree;
12
+ private leafHasher;
13
+ defaultNode: BaseType;
14
+ defaultLeaf: string;
15
+ encoder: TypedDataEncoder;
16
+ get completedSize(): number;
17
+ /** Returns the array of elements in the tree, padded to the complete size with empty items. */
18
+ getCompleteElements(): BaseType[];
19
+ /** Returns the array of leaf nodes in the tree, padded to the complete size with default hashes. */
20
+ getCompleteLeaves(): string[];
21
+ get root(): string;
22
+ getProof(i: number): {
23
+ leaf: string;
24
+ proof: string[];
25
+ root: string;
26
+ };
27
+ getEncodedProofAndSignature(i: number, signature: string): string;
28
+ getDataToSign(): BulkOrderElements<BaseType>;
29
+ add(element: BaseType): void;
30
+ getBulkOrderHash(): string;
31
+ constructor(types: EIP712TypeDefinitions, rootType: string, leafType: string, elements: BaseType[], depth: number);
32
+ }
33
+ export {};
@@ -0,0 +1,10 @@
1
+ import { BytesLike } from 'ethers';
2
+ export declare const makeArray: <T>(len: number, getValue: (i: number) => T) => T[];
3
+ export declare const chunk: <T>(array: T[], size: number) => T[][];
4
+ export declare const bufferToHex: (buf: Buffer) => string;
5
+ export declare const hexToBuffer: (value: string) => Buffer;
6
+ export declare const bufferKeccak: (value: BytesLike) => Buffer;
7
+ export declare const hashConcat: (arr: BytesLike[]) => Buffer;
8
+ export declare const fillArray: <T>(arr: T[], length: number, value: T) => T[];
9
+ export declare const getRoot: (elements: (Buffer | string)[], hashLeaves?: boolean) => Buffer;
10
+ export declare const getNextLayer: (elements: Buffer[]) => Buffer[];
@@ -0,0 +1,7 @@
1
+ import { ConsiderationItem, OfferItem } from '@opensea/seaport-js/lib/types';
2
+ import { AssetCollectionItem, ERC20Item, Item, ProtocolData } from '../openapi/sdk';
3
+ import { OrderType } from './constants';
4
+ export declare function mapSeaportItemToImmutableItem(item: OfferItem | ConsiderationItem): Item;
5
+ export declare function mapSeaportItemToImmutableERC20Item(item: OfferItem | ConsiderationItem): ERC20Item;
6
+ export declare function mapSeaportItemToImmutableAssetCollectionItem(item: OfferItem | ConsiderationItem): AssetCollectionItem;
7
+ export declare function mapSeaportOrderTypeToImmutableProtocolDataOrderType(ot: OrderType): ProtocolData.order_type;
@@ -0,0 +1,6 @@
1
+ import { OrderComponents, TipInputItem } from '@opensea/seaport-js/lib/types';
2
+ import { Order } from '../openapi/sdk';
3
+ export declare function mapImmutableOrderToSeaportOrderComponents(order: Order): {
4
+ orderComponents: OrderComponents;
5
+ tips: Array<TipInputItem>;
6
+ };
@@ -0,0 +1,10 @@
1
+ import { Seaport as SeaportLib } from '@opensea/seaport-js';
2
+ import { JsonRpcProvider } from 'ethers';
3
+ import { SEAPORT_CONTRACT_VERSION_V1_5 } from './constants';
4
+ export type SeaportVersion = typeof SEAPORT_CONTRACT_VERSION_V1_5;
5
+ export declare class SeaportLibFactory {
6
+ private readonly defaultSeaportContractAddress;
7
+ private readonly provider;
8
+ constructor(defaultSeaportContractAddress: string, provider: JsonRpcProvider);
9
+ create(orderSeaportAddress?: string): SeaportLib;
10
+ }