@imtbl/orderbook 2.16.1-alpha.1 → 2.16.1-alpha.3
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.
- package/dist/browser/index.js +4 -4
- package/dist/node/index.cjs +12 -12
- package/dist/node/index.js +4 -4
- package/dist/types/api-client/api-client.d.ts +6 -3
- package/dist/types/openapi/mapper.d.ts +2 -1
- package/dist/types/openapi/mapper.test.d.ts +1 -0
- package/dist/types/openapi/sdk/index.d.ts +4 -0
- package/dist/types/openapi/sdk/models/CreateTraitBidRequestBody.d.ts +42 -0
- package/dist/types/openapi/sdk/models/ListTraitBidsResult.d.ts +6 -0
- package/dist/types/openapi/sdk/models/Order.d.ts +7 -1
- package/dist/types/openapi/sdk/models/TraitBidResult.d.ts +4 -0
- package/dist/types/openapi/sdk/models/TraitFilter.d.ts +10 -0
- package/dist/types/openapi/sdk/services/OrdersService.d.ts +71 -0
- package/dist/types/orderbook.d.ts +29 -1
- package/dist/types/types.d.ts +30 -1
- package/package.json +3 -3
|
@@ -16,6 +16,7 @@ export type { ChainName } from './models/ChainName';
|
|
|
16
16
|
export type { CollectionBidResult } from './models/CollectionBidResult';
|
|
17
17
|
export type { CreateBidRequestBody } from './models/CreateBidRequestBody';
|
|
18
18
|
export type { CreateCollectionBidRequestBody } from './models/CreateCollectionBidRequestBody';
|
|
19
|
+
export type { CreateTraitBidRequestBody } from './models/CreateTraitBidRequestBody';
|
|
19
20
|
export type { CreateListingRequestBody } from './models/CreateListingRequestBody';
|
|
20
21
|
export type { ERC1155CollectionItem } from './models/ERC1155CollectionItem';
|
|
21
22
|
export type { ERC1155Item } from './models/ERC1155Item';
|
|
@@ -34,6 +35,7 @@ export type { InactiveOrderStatus } from './models/InactiveOrderStatus';
|
|
|
34
35
|
export type { Item } from './models/Item';
|
|
35
36
|
export type { ListBidsResult } from './models/ListBidsResult';
|
|
36
37
|
export type { ListCollectionBidsResult } from './models/ListCollectionBidsResult';
|
|
38
|
+
export type { ListTraitBidsResult } from './models/ListTraitBidsResult';
|
|
37
39
|
export type { ListingResult } from './models/ListingResult';
|
|
38
40
|
export type { ListListingsResult } from './models/ListListingsResult';
|
|
39
41
|
export type { ListTradeResult } from './models/ListTradeResult';
|
|
@@ -49,5 +51,7 @@ export { ProtocolData } from './models/ProtocolData';
|
|
|
49
51
|
export type { Trade } from './models/Trade';
|
|
50
52
|
export type { TradeBlockchainMetadata } from './models/TradeBlockchainMetadata';
|
|
51
53
|
export type { TradeResult } from './models/TradeResult';
|
|
54
|
+
export type { TraitBidResult } from './models/TraitBidResult';
|
|
55
|
+
export type { TraitFilter } from './models/TraitFilter';
|
|
52
56
|
export type { UnfulfillableOrder } from './models/UnfulfillableOrder';
|
|
53
57
|
export { OrdersService } from './services/OrdersService';
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { AssetCollectionItem } from './AssetCollectionItem';
|
|
2
|
+
import type { ERC20Item } from './ERC20Item';
|
|
3
|
+
import type { Fee } from './Fee';
|
|
4
|
+
import type { ProtocolData } from './ProtocolData';
|
|
5
|
+
import type { TraitFilter } from './TraitFilter';
|
|
6
|
+
export type CreateTraitBidRequestBody = {
|
|
7
|
+
account_address: string;
|
|
8
|
+
order_hash: string;
|
|
9
|
+
/**
|
|
10
|
+
* Buy item for trait bid should either be ERC721 or ERC1155 collection item
|
|
11
|
+
*/
|
|
12
|
+
buy: Array<AssetCollectionItem>;
|
|
13
|
+
/**
|
|
14
|
+
* Buy fees should only include maker marketplace fees and should be no more than two entries as more entires will incur more gas. It is best practice to have this as few as possible.
|
|
15
|
+
*/
|
|
16
|
+
fees: Array<Fee>;
|
|
17
|
+
/**
|
|
18
|
+
* Time after which the Order is considered expired
|
|
19
|
+
*/
|
|
20
|
+
end_at: string;
|
|
21
|
+
protocol_data: ProtocolData;
|
|
22
|
+
/**
|
|
23
|
+
* A random value added to the create Order request
|
|
24
|
+
*/
|
|
25
|
+
salt: string;
|
|
26
|
+
/**
|
|
27
|
+
* Sell item for trait bid should be an ERC20 item
|
|
28
|
+
*/
|
|
29
|
+
sell: Array<ERC20Item>;
|
|
30
|
+
/**
|
|
31
|
+
* Digital signature generated by the user for the specific Order
|
|
32
|
+
*/
|
|
33
|
+
signature: string;
|
|
34
|
+
/**
|
|
35
|
+
* Time after which Order is considered active
|
|
36
|
+
*/
|
|
37
|
+
start_at: string;
|
|
38
|
+
/**
|
|
39
|
+
* Trait criteria to match NFTs against
|
|
40
|
+
*/
|
|
41
|
+
trait_criteria: Array<TraitFilter>;
|
|
42
|
+
};
|
|
@@ -4,6 +4,7 @@ import type { FillStatus } from './FillStatus';
|
|
|
4
4
|
import type { Item } from './Item';
|
|
5
5
|
import type { OrderStatus } from './OrderStatus';
|
|
6
6
|
import type { ProtocolData } from './ProtocolData';
|
|
7
|
+
import type { TraitFilter } from './TraitFilter';
|
|
7
8
|
export type Order = {
|
|
8
9
|
account_address: string;
|
|
9
10
|
buy: Array<Item>;
|
|
@@ -46,6 +47,10 @@ export type Order = {
|
|
|
46
47
|
*/
|
|
47
48
|
updated_at: string;
|
|
48
49
|
fill_status: FillStatus;
|
|
50
|
+
/**
|
|
51
|
+
* Trait criteria for trait bids when returned by the API
|
|
52
|
+
*/
|
|
53
|
+
trait_criteria?: Array<TraitFilter>;
|
|
49
54
|
};
|
|
50
55
|
export declare namespace Order {
|
|
51
56
|
/**
|
|
@@ -54,6 +59,7 @@ export declare namespace Order {
|
|
|
54
59
|
enum type {
|
|
55
60
|
LISTING = "LISTING",
|
|
56
61
|
BID = "BID",
|
|
57
|
-
COLLECTION_BID = "COLLECTION_BID"
|
|
62
|
+
COLLECTION_BID = "COLLECTION_BID",
|
|
63
|
+
TRAIT_BID = "TRAIT_BID"
|
|
58
64
|
}
|
|
59
65
|
}
|
|
@@ -5,11 +5,13 @@ import type { ChainName } from '../models/ChainName';
|
|
|
5
5
|
import type { CollectionBidResult } from '../models/CollectionBidResult';
|
|
6
6
|
import type { CreateBidRequestBody } from '../models/CreateBidRequestBody';
|
|
7
7
|
import type { CreateCollectionBidRequestBody } from '../models/CreateCollectionBidRequestBody';
|
|
8
|
+
import type { CreateTraitBidRequestBody } from '../models/CreateTraitBidRequestBody';
|
|
8
9
|
import type { CreateListingRequestBody } from '../models/CreateListingRequestBody';
|
|
9
10
|
import type { FulfillableOrder } from '../models/FulfillableOrder';
|
|
10
11
|
import type { FulfillmentDataRequest } from '../models/FulfillmentDataRequest';
|
|
11
12
|
import type { ListBidsResult } from '../models/ListBidsResult';
|
|
12
13
|
import type { ListCollectionBidsResult } from '../models/ListCollectionBidsResult';
|
|
14
|
+
import type { ListTraitBidsResult } from '../models/ListTraitBidsResult';
|
|
13
15
|
import type { ListingResult } from '../models/ListingResult';
|
|
14
16
|
import type { ListListingsResult } from '../models/ListListingsResult';
|
|
15
17
|
import type { ListTradeResult } from '../models/ListTradeResult';
|
|
@@ -17,6 +19,7 @@ import type { OrderStatusName } from '../models/OrderStatusName';
|
|
|
17
19
|
import type { PageCursor } from '../models/PageCursor';
|
|
18
20
|
import type { PageSize } from '../models/PageSize';
|
|
19
21
|
import type { TradeResult } from '../models/TradeResult';
|
|
22
|
+
import type { TraitBidResult } from '../models/TraitBidResult';
|
|
20
23
|
import type { UnfulfillableOrder } from '../models/UnfulfillableOrder';
|
|
21
24
|
import type { CancelablePromise } from '../core/CancelablePromise';
|
|
22
25
|
import type { BaseHttpRequest } from '../core/BaseHttpRequest';
|
|
@@ -218,6 +221,61 @@ export declare class OrdersService {
|
|
|
218
221
|
chainName: ChainName;
|
|
219
222
|
requestBody: CreateCollectionBidRequestBody;
|
|
220
223
|
}): CancelablePromise<CollectionBidResult>;
|
|
224
|
+
/**
|
|
225
|
+
* List all trait bids
|
|
226
|
+
* List all trait bids
|
|
227
|
+
* @returns ListTraitBidsResult OK response.
|
|
228
|
+
* @throws ApiError
|
|
229
|
+
*/
|
|
230
|
+
listTraitBids({ chainName, status, buyItemContractAddress, sellItemContractAddress, accountAddress, fromUpdatedAt, pageSize, sortBy, sortDirection, pageCursor, }: {
|
|
231
|
+
chainName: ChainName;
|
|
232
|
+
/**
|
|
233
|
+
* Order status to filter by
|
|
234
|
+
*/
|
|
235
|
+
status?: OrderStatusName;
|
|
236
|
+
/**
|
|
237
|
+
* Buy item contract address to filter by
|
|
238
|
+
*/
|
|
239
|
+
buyItemContractAddress?: string;
|
|
240
|
+
/**
|
|
241
|
+
* Sell item contract address to filter by
|
|
242
|
+
*/
|
|
243
|
+
sellItemContractAddress?: string;
|
|
244
|
+
/**
|
|
245
|
+
* The account address of the user who created the bid
|
|
246
|
+
*/
|
|
247
|
+
accountAddress?: string;
|
|
248
|
+
/**
|
|
249
|
+
* From updated at including given date
|
|
250
|
+
*/
|
|
251
|
+
fromUpdatedAt?: string;
|
|
252
|
+
/**
|
|
253
|
+
* Maximum number of orders to return per page
|
|
254
|
+
*/
|
|
255
|
+
pageSize?: PageSize;
|
|
256
|
+
/**
|
|
257
|
+
* 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`.
|
|
258
|
+
*/
|
|
259
|
+
sortBy?: 'created_at' | 'updated_at' | 'sell_item_amount';
|
|
260
|
+
/**
|
|
261
|
+
* Ascending or descending direction for sort
|
|
262
|
+
*/
|
|
263
|
+
sortDirection?: 'asc' | 'desc';
|
|
264
|
+
/**
|
|
265
|
+
* Page cursor to retrieve previous or next page. Use the value returned in the response.
|
|
266
|
+
*/
|
|
267
|
+
pageCursor?: PageCursor;
|
|
268
|
+
}): CancelablePromise<ListTraitBidsResult>;
|
|
269
|
+
/**
|
|
270
|
+
* Create a trait bid
|
|
271
|
+
* Create a trait bid
|
|
272
|
+
* @returns TraitBidResult Created response.
|
|
273
|
+
* @throws ApiError
|
|
274
|
+
*/
|
|
275
|
+
createTraitBid({ chainName, requestBody, }: {
|
|
276
|
+
chainName: ChainName;
|
|
277
|
+
requestBody: CreateTraitBidRequestBody;
|
|
278
|
+
}): CancelablePromise<TraitBidResult>;
|
|
221
279
|
/**
|
|
222
280
|
* Get a single listing by ID
|
|
223
281
|
* Get a single listing by ID
|
|
@@ -257,6 +315,19 @@ export declare class OrdersService {
|
|
|
257
315
|
*/
|
|
258
316
|
collectionBidId: string;
|
|
259
317
|
}): CancelablePromise<CollectionBidResult>;
|
|
318
|
+
/**
|
|
319
|
+
* Get a single trait bid by ID
|
|
320
|
+
* Get a single trait bid by ID
|
|
321
|
+
* @returns TraitBidResult OK response.
|
|
322
|
+
* @throws ApiError
|
|
323
|
+
*/
|
|
324
|
+
getTraitBid({ chainName, traitBidId, }: {
|
|
325
|
+
chainName: ChainName;
|
|
326
|
+
/**
|
|
327
|
+
* Global Trait Bid identifier
|
|
328
|
+
*/
|
|
329
|
+
traitBidId: string;
|
|
330
|
+
}): CancelablePromise<TraitBidResult>;
|
|
260
331
|
/**
|
|
261
332
|
* Retrieve fulfillment data for orders
|
|
262
333
|
* Retrieve signed fulfillment data based on the list of order IDs and corresponding fees.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ModuleConfiguration } from '@imtbl/config';
|
|
2
2
|
import { OrderbookModuleConfiguration, OrderbookOverrides } from './config/config';
|
|
3
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';
|
|
4
|
+
import { BidResult, CancelOrdersOnChainResponse, CollectionBidResult, CreateBidParams, CreateCollectionBidParams, CreateTraitBidParams, CreateListingParams, FeeValue, FulfillBulkOrdersResponse, FulfillmentListing, FulfillmentOrder, FulfillOrderResponse, ListBidsParams, ListBidsResult, ListCollectionBidsParams, ListCollectionBidsResult, ListTraitBidsParams, ListTraitBidsResult, ListingResult, ListListingsParams, ListListingsResult, ListTradesParams, ListTradesResult, PrepareBidParams, PrepareBidResponse, PrepareBulkListingsParams, PrepareBulkListingsResponse, PrepareCancelOrdersResponse, PrepareCollectionBidParams, PrepareCollectionBidResponse, PrepareTraitBidParams, PrepareTraitBidResponse, TraitBidResult, PrepareListingParams, PrepareListingResponse, TradeResult } from './types';
|
|
5
5
|
/**
|
|
6
6
|
* zkEVM orderbook SDK
|
|
7
7
|
* @constructor
|
|
@@ -40,6 +40,12 @@ export declare class Orderbook {
|
|
|
40
40
|
* @return {CollectionBidResult} The returned collection bid result.
|
|
41
41
|
*/
|
|
42
42
|
getCollectionBid(collectionBidId: string): Promise<CollectionBidResult>;
|
|
43
|
+
/**
|
|
44
|
+
* Get a trait bid by ID
|
|
45
|
+
* @param {string} traitBidId - The trait bid id to find.
|
|
46
|
+
* @return {TraitBidResult} The returned trait bid result.
|
|
47
|
+
*/
|
|
48
|
+
getTraitBid(traitBidId: string): Promise<TraitBidResult>;
|
|
43
49
|
/**
|
|
44
50
|
* Get a trade by ID
|
|
45
51
|
* @param {string} tradeId - The tradeId to find.
|
|
@@ -67,6 +73,13 @@ export declare class Orderbook {
|
|
|
67
73
|
* @return {ListCollectionBidsResult} The paged collection bids.
|
|
68
74
|
*/
|
|
69
75
|
listCollectionBids(listOrderParams: ListCollectionBidsParams): Promise<ListCollectionBidsResult>;
|
|
76
|
+
/**
|
|
77
|
+
* List trait bids. This method is used to get a list of trait bids filtered
|
|
78
|
+
* by conditions specified in the params object.
|
|
79
|
+
* @param {ListTraitBidsParams} listOrderParams - Filtering, ordering and page parameters.
|
|
80
|
+
* @return {ListTraitBidsResult} The paged trait bids.
|
|
81
|
+
*/
|
|
82
|
+
listTraitBids(listOrderParams: ListTraitBidsParams): Promise<ListTraitBidsResult>;
|
|
70
83
|
/**
|
|
71
84
|
* List trades. This method is used to get a list of trades filtered by conditions specified
|
|
72
85
|
* in the params object
|
|
@@ -140,6 +153,21 @@ export declare class Orderbook {
|
|
|
140
153
|
* in the Immutable services.
|
|
141
154
|
*/
|
|
142
155
|
createCollectionBid(createCollectionBidParams: CreateCollectionBidParams): Promise<CollectionBidResult>;
|
|
156
|
+
/**
|
|
157
|
+
* Get required transactions and messages for signing prior to creating a trait bid
|
|
158
|
+
* through the {@linkcode createTraitBid} method. Uses the same Seaport criteria-based
|
|
159
|
+
* order shape as collection bids.
|
|
160
|
+
* @param {PrepareTraitBidParams} params - Details about the trait bid to be created.
|
|
161
|
+
* @return {PrepareTraitBidResponse} Unsigned approval (if any), typed order message, and
|
|
162
|
+
* order components for {@linkcode createTraitBid}.
|
|
163
|
+
*/
|
|
164
|
+
prepareTraitBid({ makerAddress, sell, buy, orderStart, orderExpiry, }: PrepareTraitBidParams): Promise<PrepareTraitBidResponse>;
|
|
165
|
+
/**
|
|
166
|
+
* Create a trait bid (collection criteria offer plus trait filters submitted to the API).
|
|
167
|
+
* @param {CreateTraitBidParams} createTraitBidParams - Signed order and trait criteria.
|
|
168
|
+
* @return {TraitBidResult} The created trait bid.
|
|
169
|
+
*/
|
|
170
|
+
createTraitBid(createTraitBidParams: CreateTraitBidParams): Promise<TraitBidResult>;
|
|
143
171
|
/**
|
|
144
172
|
* Get unsigned transactions that can be submitted to fulfil an open order. If the approval
|
|
145
173
|
* transaction exists it must be signed and submitted to the chain before the fulfilment
|
package/dist/types/types.d.ts
CHANGED
|
@@ -32,7 +32,7 @@ export interface ERC1155CollectionItem {
|
|
|
32
32
|
contractAddress: string;
|
|
33
33
|
amount: string;
|
|
34
34
|
}
|
|
35
|
-
export type Order = Listing | Bid | CollectionBid;
|
|
35
|
+
export type Order = Listing | Bid | CollectionBid | TraitBid;
|
|
36
36
|
export interface Listing extends OrderFields {
|
|
37
37
|
type: 'LISTING';
|
|
38
38
|
sell: (ERC721Item | ERC1155Item)[];
|
|
@@ -48,6 +48,22 @@ export interface CollectionBid extends OrderFields {
|
|
|
48
48
|
sell: ERC20Item[];
|
|
49
49
|
buy: (ERC721CollectionItem | ERC1155CollectionItem)[];
|
|
50
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* A single trait filter (attribute name + acceptable values).
|
|
53
|
+
*/
|
|
54
|
+
export interface TraitFilter {
|
|
55
|
+
traitType: string;
|
|
56
|
+
values: string[];
|
|
57
|
+
}
|
|
58
|
+
export interface TraitBid extends OrderFields {
|
|
59
|
+
type: 'TRAIT_BID';
|
|
60
|
+
sell: ERC20Item[];
|
|
61
|
+
buy: (ERC721CollectionItem | ERC1155CollectionItem)[];
|
|
62
|
+
/**
|
|
63
|
+
* Trait criteria for this bid. Empty if the API response omits criteria.
|
|
64
|
+
*/
|
|
65
|
+
traitCriteria: TraitFilter[];
|
|
66
|
+
}
|
|
51
67
|
interface OrderFields {
|
|
52
68
|
id: string;
|
|
53
69
|
chain: {
|
|
@@ -256,6 +272,19 @@ export interface BulkCollectionBidsResult {
|
|
|
256
272
|
order?: CollectionBid;
|
|
257
273
|
}[];
|
|
258
274
|
}
|
|
275
|
+
export type ListTraitBidsParams = Omit<Parameters<typeof OrdersService.prototype.listTraitBids>[0], 'chainName'>;
|
|
276
|
+
export interface TraitBidResult {
|
|
277
|
+
result: TraitBid;
|
|
278
|
+
}
|
|
279
|
+
export interface ListTraitBidsResult {
|
|
280
|
+
page: Page;
|
|
281
|
+
result: TraitBid[];
|
|
282
|
+
}
|
|
283
|
+
export type PrepareTraitBidParams = PrepareCollectionBidParams;
|
|
284
|
+
export type PrepareTraitBidResponse = PrepareOrderResponse;
|
|
285
|
+
export interface CreateTraitBidParams extends CreateCollectionBidParams {
|
|
286
|
+
traitCriteria: TraitFilter[];
|
|
287
|
+
}
|
|
259
288
|
export interface FulfillmentOrder {
|
|
260
289
|
orderId: string;
|
|
261
290
|
takerFees: FeeValue[];
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@imtbl/orderbook",
|
|
3
|
-
"version": "2.16.1-alpha.
|
|
3
|
+
"version": "2.16.1-alpha.3",
|
|
4
4
|
"author": "Immutable",
|
|
5
5
|
"bugs": "https://github.com/immutable/ts-immutable-sdk/issues",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@imtbl/config": "2.16.1-alpha.
|
|
8
|
-
"@imtbl/metrics": "2.16.1-alpha.
|
|
7
|
+
"@imtbl/config": "2.16.1-alpha.3",
|
|
8
|
+
"@imtbl/metrics": "2.16.1-alpha.3",
|
|
9
9
|
"@opensea/seaport-js": "4.0.3",
|
|
10
10
|
"axios": "^1.6.5",
|
|
11
11
|
"ethers": "^6.13.4",
|