@imtbl/sdk 0.14.0-alpha → 0.14.0-alpha.1

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/index.cjs CHANGED
@@ -2420,7 +2420,7 @@ class MultiRollupApiClients {
2420
2420
  }
2421
2421
 
2422
2422
  // eslint-disable-next-line @typescript-eslint/naming-convention
2423
- const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.14.0-alpha' };
2423
+ const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.14.0-alpha.1' };
2424
2424
  const createConfig = ({ basePath, headers, }) => {
2425
2425
  if (!basePath.trim()) {
2426
2426
  throw Error('basePath can not be empty');
@@ -2480,7 +2480,7 @@ class APIError extends Error {
2480
2480
 
2481
2481
  /* eslint-disable implicit-arrow-linebreak */
2482
2482
  const defaultHeaders = {
2483
- sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.14.0-alpha',
2483
+ sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.14.0-alpha.1',
2484
2484
  };
2485
2485
  /**
2486
2486
  * createAPIConfiguration to create a custom Configuration
@@ -2752,7 +2752,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
2752
2752
  chainID,
2753
2753
  coreContractAddress,
2754
2754
  registrationContractAddress,
2755
- sdkVersion: 'ts-immutable-sdk-0.14.0-alpha',
2755
+ sdkVersion: 'ts-immutable-sdk-0.14.0-alpha.1',
2756
2756
  });
2757
2757
  /**
2758
2758
  * Sets `sdkVersion` at the time of build
@@ -9877,7 +9877,7 @@ class ImmutableApiClient {
9877
9877
  ],
9878
9878
  fees: makerFee ? [{
9879
9879
  amount: makerFee.amount,
9880
- fee_type: makerFee.type,
9880
+ fee_type: FeeType.MAKER_MARKETPLACE,
9881
9881
  recipient: makerFee.recipient,
9882
9882
  }] : [],
9883
9883
  end_time: new Date(parseInt(`${orderComponents.endTime.toString()}000`, 10)).toISOString(),
@@ -9946,6 +9946,67 @@ function getOrderbookConfig(environment) {
9946
9946
  }
9947
9947
  }
9948
9948
 
9949
+ function mapFromOpenApiOrder(order) {
9950
+ const buyItems = order.buy.map((item) => {
9951
+ if (item.item_type === 'ERC20') {
9952
+ return {
9953
+ type: 'ERC20',
9954
+ contractAddress: item.contract_address,
9955
+ amount: item.start_amount,
9956
+ };
9957
+ }
9958
+ if (item.item_type === 'NATIVE') {
9959
+ return {
9960
+ type: 'NATIVE',
9961
+ amount: item.start_amount,
9962
+ };
9963
+ }
9964
+ throw new Error('Buy items must be either ERC20 or NATIVE');
9965
+ });
9966
+ const sellItems = order.sell.map((item) => {
9967
+ if (item.item_type === 'ERC721') {
9968
+ return {
9969
+ type: 'ERC721',
9970
+ contractAddress: item.contract_address,
9971
+ tokenId: item.token_id,
9972
+ };
9973
+ }
9974
+ throw new Error('Sell items must ERC721');
9975
+ });
9976
+ return {
9977
+ id: order.id,
9978
+ accountAddress: order.account_address,
9979
+ buy: buyItems,
9980
+ sell: sellItems,
9981
+ fees: order.fees.map((fee) => ({
9982
+ amount: fee.amount,
9983
+ recipient: fee.recipient,
9984
+ type: fee.fee_type,
9985
+ })),
9986
+ chain: order.chain,
9987
+ createTime: order.create_time,
9988
+ endTime: order.end_time,
9989
+ protocolData: {
9990
+ counter: order.protocol_data.counter,
9991
+ orderType: order.protocol_data.order_type,
9992
+ seaportAddress: order.protocol_data.seaport_address,
9993
+ seaportVersion: order.protocol_data.seaport_version,
9994
+ zoneAddress: order.protocol_data.zone_address,
9995
+ },
9996
+ salt: order.salt,
9997
+ signature: order.signature,
9998
+ startTime: order.start_time,
9999
+ status: order.status,
10000
+ updateTime: order.update_time,
10001
+ };
10002
+ }
10003
+ function mapFromOpenApiPage(page) {
10004
+ return {
10005
+ nextCursor: page.next_cursor,
10006
+ previousCursor: page.previous_cursor,
10007
+ };
10008
+ }
10009
+
9949
10010
  class SeaportLibFactory {
9950
10011
  defaultSeaportContractAddress;
9951
10012
  provider;
@@ -10005,8 +10066,11 @@ class Orderbook {
10005
10066
  * @param {string} listingId - The listingId to find.
10006
10067
  * @return {ListingResult} The returned order result.
10007
10068
  */
10008
- getListing(listingId) {
10009
- return this.apiClient.getListing(listingId);
10069
+ async getListing(listingId) {
10070
+ const apiListing = await this.apiClient.getListing(listingId);
10071
+ return {
10072
+ result: mapFromOpenApiOrder(apiListing.result),
10073
+ };
10010
10074
  }
10011
10075
  /**
10012
10076
  * List orders. This method is used to get a list of orders filtered by conditions specified
@@ -10014,8 +10078,12 @@ class Orderbook {
10014
10078
  * @param {ListListingsParams} listOrderParams - Filtering, ordering and page parameters.
10015
10079
  * @return {ListListingsResult} The paged orders.
10016
10080
  */
10017
- listListings(listOrderParams) {
10018
- return this.apiClient.listListings(listOrderParams);
10081
+ async listListings(listOrderParams) {
10082
+ const apiListings = await this.apiClient.listListings(listOrderParams);
10083
+ return {
10084
+ page: mapFromOpenApiPage(apiListings.page),
10085
+ result: apiListings.result.map(mapFromOpenApiOrder),
10086
+ };
10019
10087
  }
10020
10088
  /**
10021
10089
  * Get required transactions and messages for signing prior to creating a listing
@@ -10037,8 +10105,20 @@ class Orderbook {
10037
10105
  * @param {CreateListingParams} createListingParams - create an order with the given params.
10038
10106
  * @return {ListingResult} The result of the order created in the Immutable services.
10039
10107
  */
10040
- createListing(createListingParams) {
10041
- return this.apiClient.createListing(createListingParams);
10108
+ async createListing(createListingParams) {
10109
+ const makerFee = createListingParams.makerFee
10110
+ ? {
10111
+ ...createListingParams.makerFee,
10112
+ type: FeeType.MAKER_MARKETPLACE,
10113
+ }
10114
+ : undefined;
10115
+ const apiListingResponse = await this.apiClient.createListing({
10116
+ ...createListingParams,
10117
+ makerFee,
10118
+ });
10119
+ return {
10120
+ result: mapFromOpenApiOrder(apiListingResponse.result),
10121
+ };
10042
10122
  }
10043
10123
  /**
10044
10124
  * Get unsigned transactions that can be submitted to fulfil an open order. If the approval
@@ -10055,7 +10135,7 @@ class Orderbook {
10055
10135
  fee: takerFee
10056
10136
  ? {
10057
10137
  amount: takerFee.amount,
10058
- fee_type: takerFee.type,
10138
+ fee_type: FeeType.TAKER_MARKETPLACE,
10059
10139
  recipient: takerFee.recipient,
10060
10140
  }
10061
10141
  : undefined,
@@ -28367,13 +28447,13 @@ const $64863c39386de592$export$7f8e2b98eca5a7f0 = async (config, provider, order
28367
28447
  let type = ($4b58188d47aafe8d$export$1fc8f52ad1810e52).NATIVE;
28368
28448
  let contractAddress = "";
28369
28449
  const buyArray = order.result.buy;
28370
- if (buyArray.length > 0) switch(buyArray[0].item_type){
28450
+ if (buyArray.length > 0) switch(buyArray[0].type){
28371
28451
  case "NATIVE":
28372
28452
  type = ($4b58188d47aafe8d$export$1fc8f52ad1810e52).NATIVE;
28373
28453
  break;
28374
28454
  case "ERC20":
28375
28455
  type = ($4b58188d47aafe8d$export$1fc8f52ad1810e52).ERC20;
28376
- contractAddress = buyArray[0].contract_address;
28456
+ contractAddress = buyArray[0].contractAddress;
28377
28457
  break;
28378
28458
  default:
28379
28459
  throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("Purchasing token type is unsupported", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).UNSUPPORTED_TOKEN_TYPE_ERROR, {
@@ -28381,7 +28461,7 @@ const $64863c39386de592$export$7f8e2b98eca5a7f0 = async (config, provider, order
28381
28461
  });
28382
28462
  }
28383
28463
  buyArray.forEach((item)=>{
28384
- if (item.item_type !== ($4b58188d47aafe8d$export$1fc8f52ad1810e52).ERC721) amount = amount.add((ethers.BigNumber).from(item.start_amount));
28464
+ if (item.type !== ($4b58188d47aafe8d$export$1fc8f52ad1810e52).ERC721) amount = amount.add((ethers.BigNumber).from(item.amount));
28385
28465
  });
28386
28466
  const feeArray = order.result.fees;
28387
28467
  feeArray.forEach((item)=>{
@@ -28598,7 +28678,7 @@ var checkout_sdk = /*#__PURE__*/Object.freeze({
28598
28678
  function $parcel$export(e, n, v, s) {
28599
28679
  Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
28600
28680
  }
28601
- const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.14.0-alpha";
28681
+ const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.14.0-alpha.1";
28602
28682
  const $d663162fd5a0853f$export$83bf90b30cdfd29f = ()=>false;
28603
28683
  const $d663162fd5a0853f$export$1169f5475725171b = ()=>$d663162fd5a0853f$export$38a083d9fb5551ca;
28604
28684
 
package/dist/index.d.ts CHANGED
@@ -1281,7 +1281,7 @@ interface GetTokenResult {
1281
1281
  * @export
1282
1282
  * @interface Page
1283
1283
  */
1284
- interface Page$1 {
1284
+ interface Page$2 {
1285
1285
  /**
1286
1286
  * First item as an encoded string
1287
1287
  * @type {string}
@@ -1325,7 +1325,7 @@ interface ListActivitiesResult {
1325
1325
  * @type {Page}
1326
1326
  * @memberof ListActivitiesResult
1327
1327
  */
1328
- 'page': Page$1;
1328
+ 'page': Page$2;
1329
1329
  }
1330
1330
 
1331
1331
  /**
@@ -1357,7 +1357,7 @@ interface ListChainsResult {
1357
1357
  * @type {Page}
1358
1358
  * @memberof ListChainsResult
1359
1359
  */
1360
- 'page': Page$1;
1360
+ 'page': Page$2;
1361
1361
  }
1362
1362
 
1363
1363
  /**
@@ -1389,7 +1389,7 @@ interface ListCollectionsResult {
1389
1389
  * @type {Page}
1390
1390
  * @memberof ListCollectionsResult
1391
1391
  */
1392
- 'page': Page$1;
1392
+ 'page': Page$2;
1393
1393
  }
1394
1394
 
1395
1395
  /**
@@ -1471,7 +1471,7 @@ interface ListNFTOwnersResult {
1471
1471
  * @type {Page}
1472
1472
  * @memberof ListNFTOwnersResult
1473
1473
  */
1474
- 'page': Page$1;
1474
+ 'page': Page$2;
1475
1475
  }
1476
1476
 
1477
1477
  /**
@@ -1503,7 +1503,7 @@ interface ListNFTsResult {
1503
1503
  * @type {Page}
1504
1504
  * @memberof ListNFTsResult
1505
1505
  */
1506
- 'page': Page$1;
1506
+ 'page': Page$2;
1507
1507
  }
1508
1508
 
1509
1509
  /**
@@ -1535,7 +1535,7 @@ interface ListTokensResult {
1535
1535
  * @type {Page}
1536
1536
  * @memberof ListTokensResult
1537
1537
  */
1538
- 'page': Page$1;
1538
+ 'page': Page$2;
1539
1539
  }
1540
1540
 
1541
1541
  /**
@@ -7209,7 +7209,7 @@ declare type OrderSell = Token;
7209
7209
  * @export
7210
7210
  * @interface Order
7211
7211
  */
7212
- interface Order$1 {
7212
+ interface Order$2 {
7213
7213
  /**
7214
7214
  * Amount of the asset already sold by this order
7215
7215
  * @type {string}
@@ -7307,7 +7307,7 @@ interface ListOrdersResponse {
7307
7307
  * @type {Array<Order>}
7308
7308
  * @memberof ListOrdersResponse
7309
7309
  */
7310
- 'result': Array<Order$1>;
7310
+ 'result': Array<Order$2>;
7311
7311
  }
7312
7312
 
7313
7313
  /**
@@ -11079,7 +11079,7 @@ declare class OrdersApi extends BaseAPI {
11079
11079
  * @throws {RequiredError}
11080
11080
  * @memberof OrdersApi
11081
11081
  */
11082
- getOrder(requestParameters: OrdersApiGetOrderRequest, options?: AxiosRequestConfig): Promise<AxiosResponse<Order$1, any>>;
11082
+ getOrder(requestParameters: OrdersApiGetOrderRequest, options?: AxiosRequestConfig): Promise<AxiosResponse<Order$2, any>>;
11083
11083
  /**
11084
11084
  * Get an order (V3)
11085
11085
  * @summary Get an order (V3)
@@ -13331,7 +13331,7 @@ declare enum OrderStatus {
13331
13331
  EXPIRED = "EXPIRED"
13332
13332
  }
13333
13333
 
13334
- type Order = {
13334
+ type Order$1 = {
13335
13335
  account_address: string;
13336
13336
  buy: Array<Item>;
13337
13337
  fees: Array<Fee$1>;
@@ -13371,17 +13371,17 @@ type Order = {
13371
13371
 
13372
13372
  type FulfillmentDataResult = {
13373
13373
  extra_data: string;
13374
- order: Order;
13374
+ order: Order$1;
13375
13375
  };
13376
13376
 
13377
- type ListingResult = {
13378
- result: Order;
13377
+ type ListingResult$1 = {
13378
+ result: Order$1;
13379
13379
  };
13380
13380
 
13381
13381
  /**
13382
13382
  * Pagination properties
13383
13383
  */
13384
- type Page = {
13384
+ type Page$1 = {
13385
13385
  /**
13386
13386
  * First item as an encoded string
13387
13387
  */
@@ -13392,9 +13392,9 @@ type Page = {
13392
13392
  next_cursor: string | null;
13393
13393
  };
13394
13394
 
13395
- type ListListingsResult = {
13396
- page: Page;
13397
- result: Array<Order>;
13395
+ type ListListingsResult$1 = {
13396
+ page: Page$1;
13397
+ result: Array<Order$1>;
13398
13398
  };
13399
13399
 
13400
13400
  /**
@@ -13450,7 +13450,7 @@ declare class OrdersService {
13450
13450
  * Page cursor to retrieve previous or next page. Use the value returned in the response.
13451
13451
  */
13452
13452
  pageCursor?: PageCursor;
13453
- }): CancelablePromise<ListListingsResult>;
13453
+ }): CancelablePromise<ListListingsResult$1>;
13454
13454
  /**
13455
13455
  * Create a listing
13456
13456
  * Create a listing
@@ -13460,7 +13460,7 @@ declare class OrdersService {
13460
13460
  createListing({ chainName, requestBody, }: {
13461
13461
  chainName: ChainName$1;
13462
13462
  requestBody: CreateListingRequestBody;
13463
- }): CancelablePromise<ListingResult>;
13463
+ }): CancelablePromise<ListingResult$1>;
13464
13464
  /**
13465
13465
  * Get a single listing by ID
13466
13466
  * Get a single listing by ID
@@ -13473,7 +13473,7 @@ declare class OrdersService {
13473
13473
  * Global Order identifier
13474
13474
  */
13475
13475
  listingId: string;
13476
- }): CancelablePromise<ListingResult>;
13476
+ }): CancelablePromise<ListingResult$1>;
13477
13477
  /**
13478
13478
  * Retrieve fulfillment data for orders
13479
13479
  * Retrieve signed fulfillment data based on the list of order IDs and corresponding fees.
@@ -13521,7 +13521,7 @@ interface CreateListingParams {
13521
13521
  orderComponents: OrderComponents;
13522
13522
  orderHash: string;
13523
13523
  orderSignature: string;
13524
- makerFee?: Fee;
13524
+ makerFee?: FeeValue;
13525
13525
  }
13526
13526
  type ListListingsParams = Omit<Parameters<typeof OrdersService.prototype.listListings>[0], 'chainName'>;
13527
13527
  declare enum FeeType {
@@ -13530,11 +13530,13 @@ declare enum FeeType {
13530
13530
  PROTOCOL = "PROTOCOL",
13531
13531
  ROYALTY = "ROYALTY"
13532
13532
  }
13533
- interface Fee {
13534
- type: FeeType;
13533
+ interface FeeValue {
13535
13534
  recipient: string;
13536
13535
  amount: string;
13537
13536
  }
13537
+ interface Fee extends FeeValue {
13538
+ type: FeeType;
13539
+ }
13538
13540
  declare enum TransactionPurpose {
13539
13541
  APPROVAL = "APPROVAL",
13540
13542
  FULFILL_ORDER = "FULFILL_ORDER"
@@ -13568,6 +13570,54 @@ interface FulfillOrderResponse {
13568
13570
  interface CancelOrderResponse {
13569
13571
  unsignedCancelOrderTransaction: PopulatedTransaction;
13570
13572
  }
13573
+ interface Order {
13574
+ id: string;
13575
+ accountAddress: string;
13576
+ buy: (ERC20Item$1 | NativeItem$1)[];
13577
+ sell: ERC721Item$1[];
13578
+ fees: Fee[];
13579
+ chain: {
13580
+ id: string;
13581
+ name: string;
13582
+ };
13583
+ createTime: string;
13584
+ updateTime: string;
13585
+ /**
13586
+ * Time after which the Order is considered active
13587
+ */
13588
+ startTime: string;
13589
+ /**
13590
+ * Time after which the Order is expired
13591
+ */
13592
+ endTime: string;
13593
+ protocolData: {
13594
+ orderType: 'FULL_RESTRICTED';
13595
+ zoneAddress: string;
13596
+ counter: string;
13597
+ seaportAddress: string;
13598
+ seaportVersion: string;
13599
+ };
13600
+ salt: string;
13601
+ signature: string;
13602
+ status: OrderStatus;
13603
+ }
13604
+ interface ListingResult {
13605
+ result: Order;
13606
+ }
13607
+ interface ListListingsResult {
13608
+ page: Page;
13609
+ result: Order[];
13610
+ }
13611
+ interface Page {
13612
+ /**
13613
+ * First item as an encoded string
13614
+ */
13615
+ previousCursor: string | null;
13616
+ /**
13617
+ * Last item as an encoded string
13618
+ */
13619
+ nextCursor: string | null;
13620
+ }
13571
13621
 
13572
13622
  /**
13573
13623
  * zkEVM orderbook SDK
@@ -13620,7 +13670,7 @@ declare class Orderbook {
13620
13670
  * @param {string} fulfillerAddress - The address of the account fulfilling the order.
13621
13671
  * @return {FulfillOrderResponse} Approval and fulfilment transactions.
13622
13672
  */
13623
- fulfillOrder(listingId: string, takerAddress: string, takerFee?: Fee): Promise<FulfillOrderResponse>;
13673
+ fulfillOrder(listingId: string, takerAddress: string, takerFee?: FeeValue): Promise<FulfillOrderResponse>;
13624
13674
  /**
13625
13675
  * Get an unsigned cancel order transaction. Orders can only be cancelled by
13626
13676
  * the account that created them.
@@ -13643,6 +13693,7 @@ type orderbook_d_CreateListingParams = CreateListingParams;
13643
13693
  type orderbook_d_Fee = Fee;
13644
13694
  type orderbook_d_FeeType = FeeType;
13645
13695
  declare const orderbook_d_FeeType: typeof FeeType;
13696
+ type orderbook_d_FeeValue = FeeValue;
13646
13697
  type orderbook_d_FulfillOrderResponse = FulfillOrderResponse;
13647
13698
  type orderbook_d_ListListingsParams = ListListingsParams;
13648
13699
  type orderbook_d_ListListingsResult = ListListingsResult;
@@ -13652,6 +13703,7 @@ type orderbook_d_OrderStatus = OrderStatus;
13652
13703
  declare const orderbook_d_OrderStatus: typeof OrderStatus;
13653
13704
  type orderbook_d_Orderbook = Orderbook;
13654
13705
  declare const orderbook_d_Orderbook: typeof Orderbook;
13706
+ type orderbook_d_Page = Page;
13655
13707
  type orderbook_d_PrepareListingParams = PrepareListingParams;
13656
13708
  type orderbook_d_PrepareListingResponse = PrepareListingResponse;
13657
13709
  type orderbook_d_RoyaltyInfo = RoyaltyInfo;
@@ -13673,6 +13725,7 @@ declare namespace orderbook_d {
13673
13725
  ERC721Item$1 as ERC721Item,
13674
13726
  orderbook_d_Fee as Fee,
13675
13727
  orderbook_d_FeeType as FeeType,
13728
+ orderbook_d_FeeValue as FeeValue,
13676
13729
  orderbook_d_FulfillOrderResponse as FulfillOrderResponse,
13677
13730
  orderbook_d_ListListingsParams as ListListingsParams,
13678
13731
  orderbook_d_ListListingsResult as ListListingsResult,
@@ -13681,6 +13734,7 @@ declare namespace orderbook_d {
13681
13734
  orderbook_d_Order as Order,
13682
13735
  orderbook_d_OrderStatus as OrderStatus,
13683
13736
  orderbook_d_Orderbook as Orderbook,
13737
+ orderbook_d_Page as Page,
13684
13738
  orderbook_d_PrepareListingParams as PrepareListingParams,
13685
13739
  orderbook_d_PrepareListingResponse as PrepareListingResponse,
13686
13740
  orderbook_d_RoyaltyInfo as RoyaltyInfo,
package/dist/index.js CHANGED
@@ -2398,7 +2398,7 @@ class MultiRollupApiClients {
2398
2398
  }
2399
2399
 
2400
2400
  // eslint-disable-next-line @typescript-eslint/naming-convention
2401
- const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.14.0-alpha' };
2401
+ const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.14.0-alpha.1' };
2402
2402
  const createConfig = ({ basePath, headers, }) => {
2403
2403
  if (!basePath.trim()) {
2404
2404
  throw Error('basePath can not be empty');
@@ -2458,7 +2458,7 @@ class APIError extends Error {
2458
2458
 
2459
2459
  /* eslint-disable implicit-arrow-linebreak */
2460
2460
  const defaultHeaders = {
2461
- sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.14.0-alpha',
2461
+ sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.14.0-alpha.1',
2462
2462
  };
2463
2463
  /**
2464
2464
  * createAPIConfiguration to create a custom Configuration
@@ -2730,7 +2730,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
2730
2730
  chainID,
2731
2731
  coreContractAddress,
2732
2732
  registrationContractAddress,
2733
- sdkVersion: 'ts-immutable-sdk-0.14.0-alpha',
2733
+ sdkVersion: 'ts-immutable-sdk-0.14.0-alpha.1',
2734
2734
  });
2735
2735
  /**
2736
2736
  * Sets `sdkVersion` at the time of build
@@ -9855,7 +9855,7 @@ class ImmutableApiClient {
9855
9855
  ],
9856
9856
  fees: makerFee ? [{
9857
9857
  amount: makerFee.amount,
9858
- fee_type: makerFee.type,
9858
+ fee_type: FeeType.MAKER_MARKETPLACE,
9859
9859
  recipient: makerFee.recipient,
9860
9860
  }] : [],
9861
9861
  end_time: new Date(parseInt(`${orderComponents.endTime.toString()}000`, 10)).toISOString(),
@@ -9924,6 +9924,67 @@ function getOrderbookConfig(environment) {
9924
9924
  }
9925
9925
  }
9926
9926
 
9927
+ function mapFromOpenApiOrder(order) {
9928
+ const buyItems = order.buy.map((item) => {
9929
+ if (item.item_type === 'ERC20') {
9930
+ return {
9931
+ type: 'ERC20',
9932
+ contractAddress: item.contract_address,
9933
+ amount: item.start_amount,
9934
+ };
9935
+ }
9936
+ if (item.item_type === 'NATIVE') {
9937
+ return {
9938
+ type: 'NATIVE',
9939
+ amount: item.start_amount,
9940
+ };
9941
+ }
9942
+ throw new Error('Buy items must be either ERC20 or NATIVE');
9943
+ });
9944
+ const sellItems = order.sell.map((item) => {
9945
+ if (item.item_type === 'ERC721') {
9946
+ return {
9947
+ type: 'ERC721',
9948
+ contractAddress: item.contract_address,
9949
+ tokenId: item.token_id,
9950
+ };
9951
+ }
9952
+ throw new Error('Sell items must ERC721');
9953
+ });
9954
+ return {
9955
+ id: order.id,
9956
+ accountAddress: order.account_address,
9957
+ buy: buyItems,
9958
+ sell: sellItems,
9959
+ fees: order.fees.map((fee) => ({
9960
+ amount: fee.amount,
9961
+ recipient: fee.recipient,
9962
+ type: fee.fee_type,
9963
+ })),
9964
+ chain: order.chain,
9965
+ createTime: order.create_time,
9966
+ endTime: order.end_time,
9967
+ protocolData: {
9968
+ counter: order.protocol_data.counter,
9969
+ orderType: order.protocol_data.order_type,
9970
+ seaportAddress: order.protocol_data.seaport_address,
9971
+ seaportVersion: order.protocol_data.seaport_version,
9972
+ zoneAddress: order.protocol_data.zone_address,
9973
+ },
9974
+ salt: order.salt,
9975
+ signature: order.signature,
9976
+ startTime: order.start_time,
9977
+ status: order.status,
9978
+ updateTime: order.update_time,
9979
+ };
9980
+ }
9981
+ function mapFromOpenApiPage(page) {
9982
+ return {
9983
+ nextCursor: page.next_cursor,
9984
+ previousCursor: page.previous_cursor,
9985
+ };
9986
+ }
9987
+
9927
9988
  class SeaportLibFactory {
9928
9989
  defaultSeaportContractAddress;
9929
9990
  provider;
@@ -9983,8 +10044,11 @@ class Orderbook {
9983
10044
  * @param {string} listingId - The listingId to find.
9984
10045
  * @return {ListingResult} The returned order result.
9985
10046
  */
9986
- getListing(listingId) {
9987
- return this.apiClient.getListing(listingId);
10047
+ async getListing(listingId) {
10048
+ const apiListing = await this.apiClient.getListing(listingId);
10049
+ return {
10050
+ result: mapFromOpenApiOrder(apiListing.result),
10051
+ };
9988
10052
  }
9989
10053
  /**
9990
10054
  * List orders. This method is used to get a list of orders filtered by conditions specified
@@ -9992,8 +10056,12 @@ class Orderbook {
9992
10056
  * @param {ListListingsParams} listOrderParams - Filtering, ordering and page parameters.
9993
10057
  * @return {ListListingsResult} The paged orders.
9994
10058
  */
9995
- listListings(listOrderParams) {
9996
- return this.apiClient.listListings(listOrderParams);
10059
+ async listListings(listOrderParams) {
10060
+ const apiListings = await this.apiClient.listListings(listOrderParams);
10061
+ return {
10062
+ page: mapFromOpenApiPage(apiListings.page),
10063
+ result: apiListings.result.map(mapFromOpenApiOrder),
10064
+ };
9997
10065
  }
9998
10066
  /**
9999
10067
  * Get required transactions and messages for signing prior to creating a listing
@@ -10015,8 +10083,20 @@ class Orderbook {
10015
10083
  * @param {CreateListingParams} createListingParams - create an order with the given params.
10016
10084
  * @return {ListingResult} The result of the order created in the Immutable services.
10017
10085
  */
10018
- createListing(createListingParams) {
10019
- return this.apiClient.createListing(createListingParams);
10086
+ async createListing(createListingParams) {
10087
+ const makerFee = createListingParams.makerFee
10088
+ ? {
10089
+ ...createListingParams.makerFee,
10090
+ type: FeeType.MAKER_MARKETPLACE,
10091
+ }
10092
+ : undefined;
10093
+ const apiListingResponse = await this.apiClient.createListing({
10094
+ ...createListingParams,
10095
+ makerFee,
10096
+ });
10097
+ return {
10098
+ result: mapFromOpenApiOrder(apiListingResponse.result),
10099
+ };
10020
10100
  }
10021
10101
  /**
10022
10102
  * Get unsigned transactions that can be submitted to fulfil an open order. If the approval
@@ -10033,7 +10113,7 @@ class Orderbook {
10033
10113
  fee: takerFee
10034
10114
  ? {
10035
10115
  amount: takerFee.amount,
10036
- fee_type: takerFee.type,
10116
+ fee_type: FeeType.TAKER_MARKETPLACE,
10037
10117
  recipient: takerFee.recipient,
10038
10118
  }
10039
10119
  : undefined,
@@ -28345,13 +28425,13 @@ const $64863c39386de592$export$7f8e2b98eca5a7f0 = async (config, provider, order
28345
28425
  let type = ($4b58188d47aafe8d$export$1fc8f52ad1810e52).NATIVE;
28346
28426
  let contractAddress = "";
28347
28427
  const buyArray = order.result.buy;
28348
- if (buyArray.length > 0) switch(buyArray[0].item_type){
28428
+ if (buyArray.length > 0) switch(buyArray[0].type){
28349
28429
  case "NATIVE":
28350
28430
  type = ($4b58188d47aafe8d$export$1fc8f52ad1810e52).NATIVE;
28351
28431
  break;
28352
28432
  case "ERC20":
28353
28433
  type = ($4b58188d47aafe8d$export$1fc8f52ad1810e52).ERC20;
28354
- contractAddress = buyArray[0].contract_address;
28434
+ contractAddress = buyArray[0].contractAddress;
28355
28435
  break;
28356
28436
  default:
28357
28437
  throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("Purchasing token type is unsupported", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).UNSUPPORTED_TOKEN_TYPE_ERROR, {
@@ -28359,7 +28439,7 @@ const $64863c39386de592$export$7f8e2b98eca5a7f0 = async (config, provider, order
28359
28439
  });
28360
28440
  }
28361
28441
  buyArray.forEach((item)=>{
28362
- if (item.item_type !== ($4b58188d47aafe8d$export$1fc8f52ad1810e52).ERC721) amount = amount.add((BigNumber$1).from(item.start_amount));
28442
+ if (item.type !== ($4b58188d47aafe8d$export$1fc8f52ad1810e52).ERC721) amount = amount.add((BigNumber$1).from(item.amount));
28363
28443
  });
28364
28444
  const feeArray = order.result.fees;
28365
28445
  feeArray.forEach((item)=>{
@@ -28576,7 +28656,7 @@ var checkout_sdk = /*#__PURE__*/Object.freeze({
28576
28656
  function $parcel$export(e, n, v, s) {
28577
28657
  Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
28578
28658
  }
28579
- const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.14.0-alpha";
28659
+ const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.14.0-alpha.1";
28580
28660
  const $d663162fd5a0853f$export$83bf90b30cdfd29f = ()=>false;
28581
28661
  const $d663162fd5a0853f$export$1169f5475725171b = ()=>$d663162fd5a0853f$export$38a083d9fb5551ca;
28582
28662