@imtbl/sdk 0.18.3 → 0.20.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.
package/dist/index.cjs CHANGED
@@ -2725,7 +2725,7 @@ class MultiRollupApiClients {
2725
2725
  }
2726
2726
 
2727
2727
  // eslint-disable-next-line @typescript-eslint/naming-convention
2728
- const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.18.3' };
2728
+ const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.20.0' };
2729
2729
  const createConfig = ({ basePath, headers, }) => {
2730
2730
  if (!basePath.trim()) {
2731
2731
  throw Error('basePath can not be empty');
@@ -2785,7 +2785,7 @@ class APIError extends Error {
2785
2785
 
2786
2786
  /* eslint-disable implicit-arrow-linebreak */
2787
2787
  const defaultHeaders = {
2788
- sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.18.3',
2788
+ sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.20.0',
2789
2789
  };
2790
2790
  /**
2791
2791
  * createAPIConfiguration to create a custom Configuration
@@ -3071,7 +3071,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
3071
3071
  chainID,
3072
3072
  coreContractAddress,
3073
3073
  registrationContractAddress,
3074
- sdkVersion: 'ts-immutable-sdk-0.18.3',
3074
+ sdkVersion: 'ts-immutable-sdk-0.20.0',
3075
3075
  });
3076
3076
  /**
3077
3077
  * Sets `sdkVersion` at the time of build
@@ -10761,7 +10761,7 @@ class ImmutableApiClient {
10761
10761
  ...listTradesParams,
10762
10762
  });
10763
10763
  }
10764
- async createListing({ orderHash, orderComponents, orderSignature, makerFee, }) {
10764
+ async createListing({ orderHash, orderComponents, orderSignature, makerFees, }) {
10765
10765
  if (orderComponents.offer.length !== 1) {
10766
10766
  throw new Error('Only one item can be listed at a time');
10767
10767
  }
@@ -10790,11 +10790,11 @@ class ImmutableApiClient {
10790
10790
  contract_address: orderComponents.consideration[0].token,
10791
10791
  },
10792
10792
  ],
10793
- fee: makerFee ? {
10794
- amount: makerFee.amount,
10793
+ fees: makerFees.map((x) => ({
10794
+ amount: x.amount,
10795
10795
  fee_type: FeeType.MAKER_MARKETPLACE,
10796
- recipient: makerFee.recipient,
10797
- } : undefined,
10796
+ recipient: x.recipient,
10797
+ })),
10798
10798
  end_time: new Date(parseInt(`${orderComponents.endTime.toString()}000`, 10)).toISOString(),
10799
10799
  protocol_data: {
10800
10800
  order_type: ProtocolData.order_type.FULL_RESTRICTED,
@@ -10984,15 +10984,8 @@ class Orderbook {
10984
10984
  * @return {ListingResult} The result of the order created in the Immutable services.
10985
10985
  */
10986
10986
  async createListing(createListingParams) {
10987
- const makerFee = createListingParams.makerFee
10988
- ? {
10989
- ...createListingParams.makerFee,
10990
- type: FeeType.MAKER_MARKETPLACE,
10991
- }
10992
- : undefined;
10993
10987
  const apiListingResponse = await this.apiClient.createListing({
10994
10988
  ...createListingParams,
10995
- makerFee,
10996
10989
  });
10997
10990
  return {
10998
10991
  result: mapFromOpenApiOrder(apiListingResponse.result),
@@ -11006,17 +10999,15 @@ class Orderbook {
11006
10999
  * @param {string} fulfillerAddress - The address of the account fulfilling the order.
11007
11000
  * @return {FulfillOrderResponse} Approval and fulfilment transactions.
11008
11001
  */
11009
- async fulfillOrder(listingId, takerAddress, takerFee) {
11002
+ async fulfillOrder(listingId, takerAddress, takerFees) {
11010
11003
  const fulfillmentDataRes = await this.apiClient.fulfillmentData([
11011
11004
  {
11012
11005
  order_id: listingId,
11013
- fee: takerFee
11014
- ? {
11015
- amount: takerFee.amount,
11016
- fee_type: FeeType.TAKER_MARKETPLACE,
11017
- recipient: takerFee.recipient,
11018
- }
11019
- : undefined,
11006
+ fees: takerFees.map((fee) => ({
11007
+ amount: fee.amount,
11008
+ fee_type: FeeType.TAKER_MARKETPLACE,
11009
+ recipient: fee.recipient,
11010
+ })),
11020
11011
  },
11021
11012
  ]);
11022
11013
  if (fulfillmentDataRes.result.length !== 1) {
@@ -30652,7 +30643,7 @@ const $64863c39386de592$export$7f8e2b98eca5a7f0 = async (config, provider, order
30652
30643
  };
30653
30644
  try {
30654
30645
  const fulfillerAddress = await provider.getSigner().getAddress();
30655
- const { actions: actions } = await orderbook.fulfillOrder(orderId, fulfillerAddress);
30646
+ const { actions: actions } = await orderbook.fulfillOrder(orderId, fulfillerAddress, []);
30656
30647
  unsignedTransactions = await (0, $a7367d01c6e76b1c$export$b087719c36e0f2dc)(actions);
30657
30648
  } catch {
30658
30649
  // Silently ignore error as this is usually thrown if user does not have enough balance
@@ -30903,14 +30894,13 @@ const $9085b221b72ac69e$export$e761f9e0703de895 = async (config, provider, order
30903
30894
  const createListingParams = {
30904
30895
  orderComponents: signedMessage.orderComponents,
30905
30896
  orderHash: signedMessage.orderHash,
30906
- orderSignature: signedMessage.signedMessage
30897
+ orderSignature: signedMessage.signedMessage,
30898
+ makerFees: []
30907
30899
  };
30908
30900
  if (makerFees !== undefined) {
30909
30901
  const orderBookFees = ($9051cee080948594$export$1e69c9cfc42e28d8)(makerFees, buyTokenOrNative.amount, decimals);
30910
- // @TODO add support for an array of fees when the orderbook enables it
30911
30902
  if (orderBookFees.length !== makerFees.length) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("One of the fees is too small, must be greater than 0.000001", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).CREATE_ORDER_LISTING_ERROR);
30912
- const [makerFee] = orderBookFees;
30913
- createListingParams.makerFee = makerFee;
30903
+ createListingParams.makerFees = orderBookFees;
30914
30904
  }
30915
30905
  try {
30916
30906
  const order = await orderbook.createListing(createListingParams);
@@ -31227,7 +31217,7 @@ var checkout_sdk = /*#__PURE__*/Object.freeze({
31227
31217
  function $parcel$export(e, n, v, s) {
31228
31218
  Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
31229
31219
  }
31230
- const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.18.3";
31220
+ const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.20.0";
31231
31221
  const $d663162fd5a0853f$export$83bf90b30cdfd29f = ()=>false;
31232
31222
  const $d663162fd5a0853f$export$1169f5475725171b = ()=>$d663162fd5a0853f$export$38a083d9fb5551ca;
31233
31223
 
package/dist/index.d.ts CHANGED
@@ -13507,7 +13507,10 @@ type CreateListingRequestBody = {
13507
13507
  * Buy item for listing should either be NATIVE or ERC20 item
13508
13508
  */
13509
13509
  buy: Array<Item>;
13510
- fee?: Fee$1;
13510
+ /**
13511
+ * 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.
13512
+ */
13513
+ fees: Array<Fee$1>;
13511
13514
  /**
13512
13515
  * Time after which the Order is considered expired
13513
13516
  */
@@ -13533,7 +13536,7 @@ type CreateListingRequestBody = {
13533
13536
 
13534
13537
  type FulfillmentDataRequest = {
13535
13538
  order_id: string;
13536
- fee?: Fee$1;
13539
+ fees: Array<Fee$1>;
13537
13540
  };
13538
13541
 
13539
13542
  /**
@@ -13843,7 +13846,7 @@ interface CreateListingParams {
13843
13846
  orderComponents: OrderComponents;
13844
13847
  orderHash: string;
13845
13848
  orderSignature: string;
13846
- makerFee?: FeeValue;
13849
+ makerFees: FeeValue[];
13847
13850
  }
13848
13851
  type ListListingsParams = Omit<Parameters<typeof OrdersService.prototype.listListings>[0], 'chainName'>;
13849
13852
  type ListTradesParams = Omit<Parameters<typeof OrdersService.prototype.listTrades>[0], 'chainName'>;
@@ -14056,7 +14059,7 @@ declare class Orderbook {
14056
14059
  * @param {string} fulfillerAddress - The address of the account fulfilling the order.
14057
14060
  * @return {FulfillOrderResponse} Approval and fulfilment transactions.
14058
14061
  */
14059
- fulfillOrder(listingId: string, takerAddress: string, takerFee?: FeeValue): Promise<FulfillOrderResponse>;
14062
+ fulfillOrder(listingId: string, takerAddress: string, takerFees: FeeValue[]): Promise<FulfillOrderResponse>;
14060
14063
  /**
14061
14064
  * Get an unsigned cancel order transaction. Orders can only be cancelled by
14062
14065
  * the account that created them.
package/dist/index.js CHANGED
@@ -2703,7 +2703,7 @@ class MultiRollupApiClients {
2703
2703
  }
2704
2704
 
2705
2705
  // eslint-disable-next-line @typescript-eslint/naming-convention
2706
- const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.18.3' };
2706
+ const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.20.0' };
2707
2707
  const createConfig = ({ basePath, headers, }) => {
2708
2708
  if (!basePath.trim()) {
2709
2709
  throw Error('basePath can not be empty');
@@ -2763,7 +2763,7 @@ class APIError extends Error {
2763
2763
 
2764
2764
  /* eslint-disable implicit-arrow-linebreak */
2765
2765
  const defaultHeaders = {
2766
- sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.18.3',
2766
+ sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.20.0',
2767
2767
  };
2768
2768
  /**
2769
2769
  * createAPIConfiguration to create a custom Configuration
@@ -3049,7 +3049,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
3049
3049
  chainID,
3050
3050
  coreContractAddress,
3051
3051
  registrationContractAddress,
3052
- sdkVersion: 'ts-immutable-sdk-0.18.3',
3052
+ sdkVersion: 'ts-immutable-sdk-0.20.0',
3053
3053
  });
3054
3054
  /**
3055
3055
  * Sets `sdkVersion` at the time of build
@@ -10739,7 +10739,7 @@ class ImmutableApiClient {
10739
10739
  ...listTradesParams,
10740
10740
  });
10741
10741
  }
10742
- async createListing({ orderHash, orderComponents, orderSignature, makerFee, }) {
10742
+ async createListing({ orderHash, orderComponents, orderSignature, makerFees, }) {
10743
10743
  if (orderComponents.offer.length !== 1) {
10744
10744
  throw new Error('Only one item can be listed at a time');
10745
10745
  }
@@ -10768,11 +10768,11 @@ class ImmutableApiClient {
10768
10768
  contract_address: orderComponents.consideration[0].token,
10769
10769
  },
10770
10770
  ],
10771
- fee: makerFee ? {
10772
- amount: makerFee.amount,
10771
+ fees: makerFees.map((x) => ({
10772
+ amount: x.amount,
10773
10773
  fee_type: FeeType.MAKER_MARKETPLACE,
10774
- recipient: makerFee.recipient,
10775
- } : undefined,
10774
+ recipient: x.recipient,
10775
+ })),
10776
10776
  end_time: new Date(parseInt(`${orderComponents.endTime.toString()}000`, 10)).toISOString(),
10777
10777
  protocol_data: {
10778
10778
  order_type: ProtocolData.order_type.FULL_RESTRICTED,
@@ -10962,15 +10962,8 @@ class Orderbook {
10962
10962
  * @return {ListingResult} The result of the order created in the Immutable services.
10963
10963
  */
10964
10964
  async createListing(createListingParams) {
10965
- const makerFee = createListingParams.makerFee
10966
- ? {
10967
- ...createListingParams.makerFee,
10968
- type: FeeType.MAKER_MARKETPLACE,
10969
- }
10970
- : undefined;
10971
10965
  const apiListingResponse = await this.apiClient.createListing({
10972
10966
  ...createListingParams,
10973
- makerFee,
10974
10967
  });
10975
10968
  return {
10976
10969
  result: mapFromOpenApiOrder(apiListingResponse.result),
@@ -10984,17 +10977,15 @@ class Orderbook {
10984
10977
  * @param {string} fulfillerAddress - The address of the account fulfilling the order.
10985
10978
  * @return {FulfillOrderResponse} Approval and fulfilment transactions.
10986
10979
  */
10987
- async fulfillOrder(listingId, takerAddress, takerFee) {
10980
+ async fulfillOrder(listingId, takerAddress, takerFees) {
10988
10981
  const fulfillmentDataRes = await this.apiClient.fulfillmentData([
10989
10982
  {
10990
10983
  order_id: listingId,
10991
- fee: takerFee
10992
- ? {
10993
- amount: takerFee.amount,
10994
- fee_type: FeeType.TAKER_MARKETPLACE,
10995
- recipient: takerFee.recipient,
10996
- }
10997
- : undefined,
10984
+ fees: takerFees.map((fee) => ({
10985
+ amount: fee.amount,
10986
+ fee_type: FeeType.TAKER_MARKETPLACE,
10987
+ recipient: fee.recipient,
10988
+ })),
10998
10989
  },
10999
10990
  ]);
11000
10991
  if (fulfillmentDataRes.result.length !== 1) {
@@ -30630,7 +30621,7 @@ const $64863c39386de592$export$7f8e2b98eca5a7f0 = async (config, provider, order
30630
30621
  };
30631
30622
  try {
30632
30623
  const fulfillerAddress = await provider.getSigner().getAddress();
30633
- const { actions: actions } = await orderbook.fulfillOrder(orderId, fulfillerAddress);
30624
+ const { actions: actions } = await orderbook.fulfillOrder(orderId, fulfillerAddress, []);
30634
30625
  unsignedTransactions = await (0, $a7367d01c6e76b1c$export$b087719c36e0f2dc)(actions);
30635
30626
  } catch {
30636
30627
  // Silently ignore error as this is usually thrown if user does not have enough balance
@@ -30881,14 +30872,13 @@ const $9085b221b72ac69e$export$e761f9e0703de895 = async (config, provider, order
30881
30872
  const createListingParams = {
30882
30873
  orderComponents: signedMessage.orderComponents,
30883
30874
  orderHash: signedMessage.orderHash,
30884
- orderSignature: signedMessage.signedMessage
30875
+ orderSignature: signedMessage.signedMessage,
30876
+ makerFees: []
30885
30877
  };
30886
30878
  if (makerFees !== undefined) {
30887
30879
  const orderBookFees = ($9051cee080948594$export$1e69c9cfc42e28d8)(makerFees, buyTokenOrNative.amount, decimals);
30888
- // @TODO add support for an array of fees when the orderbook enables it
30889
30880
  if (orderBookFees.length !== makerFees.length) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("One of the fees is too small, must be greater than 0.000001", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).CREATE_ORDER_LISTING_ERROR);
30890
- const [makerFee] = orderBookFees;
30891
- createListingParams.makerFee = makerFee;
30881
+ createListingParams.makerFees = orderBookFees;
30892
30882
  }
30893
30883
  try {
30894
30884
  const order = await orderbook.createListing(createListingParams);
@@ -31205,7 +31195,7 @@ var checkout_sdk = /*#__PURE__*/Object.freeze({
31205
31195
  function $parcel$export(e, n, v, s) {
31206
31196
  Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
31207
31197
  }
31208
- const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.18.3";
31198
+ const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.20.0";
31209
31199
  const $d663162fd5a0853f$export$83bf90b30cdfd29f = ()=>false;
31210
31200
  const $d663162fd5a0853f$export$1169f5475725171b = ()=>$d663162fd5a0853f$export$38a083d9fb5551ca;
31211
31201
 
@@ -811,7 +811,10 @@ type CreateListingRequestBody = {
811
811
  * Buy item for listing should either be NATIVE or ERC20 item
812
812
  */
813
813
  buy: Array<Item>;
814
- fee?: Fee$1;
814
+ /**
815
+ * 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.
816
+ */
817
+ fees: Array<Fee$1>;
815
818
  /**
816
819
  * Time after which the Order is considered expired
817
820
  */
@@ -837,7 +840,7 @@ type CreateListingRequestBody = {
837
840
 
838
841
  type FulfillmentDataRequest = {
839
842
  order_id: string;
840
- fee?: Fee$1;
843
+ fees: Array<Fee$1>;
841
844
  };
842
845
 
843
846
  /**
@@ -1147,7 +1150,7 @@ interface CreateListingParams {
1147
1150
  orderComponents: OrderComponents;
1148
1151
  orderHash: string;
1149
1152
  orderSignature: string;
1150
- makerFee?: FeeValue;
1153
+ makerFees: FeeValue[];
1151
1154
  }
1152
1155
  type ListListingsParams = Omit<Parameters<typeof OrdersService.prototype.listListings>[0], 'chainName'>;
1153
1156
  type ListTradesParams = Omit<Parameters<typeof OrdersService.prototype.listTrades>[0], 'chainName'>;
@@ -1360,7 +1363,7 @@ declare class Orderbook {
1360
1363
  * @param {string} fulfillerAddress - The address of the account fulfilling the order.
1361
1364
  * @return {FulfillOrderResponse} Approval and fulfilment transactions.
1362
1365
  */
1363
- fulfillOrder(listingId: string, takerAddress: string, takerFee?: FeeValue): Promise<FulfillOrderResponse>;
1366
+ fulfillOrder(listingId: string, takerAddress: string, takerFees: FeeValue[]): Promise<FulfillOrderResponse>;
1364
1367
  /**
1365
1368
  * Get an unsigned cancel order transaction. Orders can only be cancelled by
1366
1369
  * the account that created them.
package/dist/orderbook.js CHANGED
@@ -1075,7 +1075,7 @@ class ImmutableApiClient {
1075
1075
  ...listTradesParams,
1076
1076
  });
1077
1077
  }
1078
- async createListing({ orderHash, orderComponents, orderSignature, makerFee, }) {
1078
+ async createListing({ orderHash, orderComponents, orderSignature, makerFees, }) {
1079
1079
  if (orderComponents.offer.length !== 1) {
1080
1080
  throw new Error('Only one item can be listed at a time');
1081
1081
  }
@@ -1104,11 +1104,11 @@ class ImmutableApiClient {
1104
1104
  contract_address: orderComponents.consideration[0].token,
1105
1105
  },
1106
1106
  ],
1107
- fee: makerFee ? {
1108
- amount: makerFee.amount,
1107
+ fees: makerFees.map((x) => ({
1108
+ amount: x.amount,
1109
1109
  fee_type: FeeType.MAKER_MARKETPLACE,
1110
- recipient: makerFee.recipient,
1111
- } : undefined,
1110
+ recipient: x.recipient,
1111
+ })),
1112
1112
  end_time: new Date(parseInt(`${orderComponents.endTime.toString()}000`, 10)).toISOString(),
1113
1113
  protocol_data: {
1114
1114
  order_type: ProtocolData.order_type.FULL_RESTRICTED,
@@ -1298,15 +1298,8 @@ class Orderbook {
1298
1298
  * @return {ListingResult} The result of the order created in the Immutable services.
1299
1299
  */
1300
1300
  async createListing(createListingParams) {
1301
- const makerFee = createListingParams.makerFee
1302
- ? {
1303
- ...createListingParams.makerFee,
1304
- type: FeeType.MAKER_MARKETPLACE,
1305
- }
1306
- : undefined;
1307
1301
  const apiListingResponse = await this.apiClient.createListing({
1308
1302
  ...createListingParams,
1309
- makerFee,
1310
1303
  });
1311
1304
  return {
1312
1305
  result: mapFromOpenApiOrder(apiListingResponse.result),
@@ -1320,17 +1313,15 @@ class Orderbook {
1320
1313
  * @param {string} fulfillerAddress - The address of the account fulfilling the order.
1321
1314
  * @return {FulfillOrderResponse} Approval and fulfilment transactions.
1322
1315
  */
1323
- async fulfillOrder(listingId, takerAddress, takerFee) {
1316
+ async fulfillOrder(listingId, takerAddress, takerFees) {
1324
1317
  const fulfillmentDataRes = await this.apiClient.fulfillmentData([
1325
1318
  {
1326
1319
  order_id: listingId,
1327
- fee: takerFee
1328
- ? {
1329
- amount: takerFee.amount,
1330
- fee_type: FeeType.TAKER_MARKETPLACE,
1331
- recipient: takerFee.recipient,
1332
- }
1333
- : undefined,
1320
+ fees: takerFees.map((fee) => ({
1321
+ amount: fee.amount,
1322
+ fee_type: FeeType.TAKER_MARKETPLACE,
1323
+ recipient: fee.recipient,
1324
+ })),
1334
1325
  },
1335
1326
  ]);
1336
1327
  if (fulfillmentDataRes.result.length !== 1) {
package/dist/passport.js CHANGED
@@ -1709,7 +1709,7 @@ class MultiRollupApiClients {
1709
1709
  }
1710
1710
 
1711
1711
  // eslint-disable-next-line @typescript-eslint/naming-convention
1712
- const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-0.18.3' };
1712
+ const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-0.20.0' };
1713
1713
  const createConfig = ({ basePath, headers, }) => {
1714
1714
  if (!basePath.trim()) {
1715
1715
  throw Error('basePath can not be empty');
@@ -1765,7 +1765,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
1765
1765
  chainID,
1766
1766
  coreContractAddress,
1767
1767
  registrationContractAddress,
1768
- sdkVersion: 'ts-immutable-sdk-0.18.3',
1768
+ sdkVersion: 'ts-immutable-sdk-0.20.0',
1769
1769
  });
1770
1770
  /**
1771
1771
  * Sets `sdkVersion` at the time of build
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@imtbl/sdk",
3
3
  "description": "Immutable Unified SDK",
4
- "version": "0.18.3",
4
+ "version": "0.20.0",
5
5
  "author": "Immutable",
6
6
  "browser": "./dist/index.browser.js",
7
7
  "bugs": "https://github.com/immutable/ts-immutable-sdk/issues",