@imtbl/sdk 0.18.2 → 0.19.0-alpha

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.2' };
2728
+ const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.19.0-alpha' };
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.2',
2788
+ sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.19.0-alpha',
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.2',
3074
+ sdkVersion: 'ts-immutable-sdk-0.19.0-alpha',
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) {
@@ -30328,6 +30319,34 @@ const $91807edfd7057288$export$8e03ea04d59f2402 = async (config, availableRoutin
30328
30319
 
30329
30320
 
30330
30321
 
30322
+
30323
+
30324
+
30325
+ const $5649bc8af91da370$export$1fb2bd867f4a9be3 = async (config, availableRoutingOptions, balanceRequirement)=>{
30326
+ if (balanceRequirement.type !== ($4b58188d47aafe8d$export$1fc8f52ad1810e52).ERC20 && balanceRequirement.type !== ($4b58188d47aafe8d$export$1fc8f52ad1810e52).NATIVE) return undefined;
30327
+ const requiredBalance = balanceRequirement.required;
30328
+ let hasAllowList = false;
30329
+ const onRampProvidersAllowList = await ($5a5ccedc98d53d25$export$9ec9fc71f3ce62c4)(config, availableRoutingOptions);
30330
+ Object.values(onRampProvidersAllowList).forEach((onRampAllowList)=>{
30331
+ if (onRampAllowList.length > 0 && !hasAllowList) hasAllowList = !!onRampAllowList.find((token)=>token.address === requiredBalance.token?.address);
30332
+ });
30333
+ if (!hasAllowList) return undefined;
30334
+ return {
30335
+ type: ($4b58188d47aafe8d$export$3af78bb3e8650ee6).ONRAMP,
30336
+ chainId: ($4013c5c91bb535f6$export$c9af4e4b001c6476)(config),
30337
+ asset: {
30338
+ balance: requiredBalance.balance,
30339
+ formattedBalance: requiredBalance.formattedBalance,
30340
+ token: {
30341
+ ...requiredBalance.token
30342
+ }
30343
+ }
30344
+ };
30345
+ };
30346
+
30347
+
30348
+
30349
+
30331
30350
  const $c16168a9c28ae4fd$export$31ce7ba1a2956195 = (balanceRequirements)=>{
30332
30351
  let insufficientBalanceCount = 0;
30333
30352
  let insufficientRequirement;
@@ -30351,6 +30370,12 @@ const $c16168a9c28ae4fd$export$c39a7b7dc167cdb4 = async (config, availableRoutin
30351
30370
  const swapFundingStep = await ($91807edfd7057288$export$8e03ea04d59f2402)(config, availableRoutingOptions, dexQuoteCache, ownerAddress, insufficientRequirement, tokenBalances, swappableTokens);
30352
30371
  return swapFundingStep;
30353
30372
  };
30373
+ const $c16168a9c28ae4fd$export$e1b6e4d22d0365ee = async (config, availableRoutingOptions, insufficientRequirement)=>{
30374
+ if (!availableRoutingOptions.onRamp) return undefined;
30375
+ if (insufficientRequirement === undefined) return undefined;
30376
+ const onRampFundingStep = await ($5649bc8af91da370$export$1fb2bd867f4a9be3)(config, availableRoutingOptions, insufficientRequirement);
30377
+ return onRampFundingStep;
30378
+ };
30354
30379
  const $c16168a9c28ae4fd$export$92606e71d0a264ff = async (config, ownerAddress, balanceRequirements, availableRoutingOptions)=>{
30355
30380
  let readOnlyProviders;
30356
30381
  try {
@@ -30371,7 +30396,7 @@ const $c16168a9c28ae4fd$export$92606e71d0a264ff = async (config, ownerAddress, b
30371
30396
  let bridgeFundingStep;
30372
30397
  if (availableRoutingOptions.bridge && insufficientRequirement) bridgeFundingStep = await ($fa9ac5bfdbbf9dfa$export$ddc7ba2b57d7c5fa)(config, readOnlyProviders, ownerAddress, availableRoutingOptions, insufficientRequirement, tokenBalances, feeEstimates);
30373
30398
  const swapFundingStep = await $c16168a9c28ae4fd$export$c39a7b7dc167cdb4(config, availableRoutingOptions, insufficientRequirement, dexQuoteCache, ownerAddress, tokenBalances, allowList.swap);
30374
- // Check on-ramp routes
30399
+ const onRampFundingStep = await $c16168a9c28ae4fd$export$e1b6e4d22d0365ee(config, availableRoutingOptions, insufficientRequirement);
30375
30400
  // Check swap routes
30376
30401
  // > Could bridge first
30377
30402
  // > Could on-ramp first
@@ -30384,7 +30409,7 @@ const $c16168a9c28ae4fd$export$92606e71d0a264ff = async (config, ownerAddress, b
30384
30409
  fundingRoutes: []
30385
30410
  };
30386
30411
  let priority = 0;
30387
- if (bridgeFundingStep || swapFundingStep) {
30412
+ if (bridgeFundingStep || swapFundingStep || onRampFundingStep) {
30388
30413
  response.response.type = ($b23305044c0e096a$export$3057de18ac0c076).ROUTES_FOUND;
30389
30414
  response.response.message = "Routes found";
30390
30415
  }
@@ -30406,6 +30431,15 @@ const $c16168a9c28ae4fd$export$92606e71d0a264ff = async (config, ownerAddress, b
30406
30431
  ]
30407
30432
  });
30408
30433
  }
30434
+ if (onRampFundingStep) {
30435
+ priority++;
30436
+ response.fundingRoutes.push({
30437
+ priority: priority,
30438
+ steps: [
30439
+ onRampFundingStep
30440
+ ]
30441
+ });
30442
+ }
30409
30443
  return response;
30410
30444
  };
30411
30445
 
@@ -30609,7 +30643,7 @@ const $64863c39386de592$export$7f8e2b98eca5a7f0 = async (config, provider, order
30609
30643
  };
30610
30644
  try {
30611
30645
  const fulfillerAddress = await provider.getSigner().getAddress();
30612
- const { actions: actions } = await orderbook.fulfillOrder(orderId, fulfillerAddress);
30646
+ const { actions: actions } = await orderbook.fulfillOrder(orderId, fulfillerAddress, []);
30613
30647
  unsignedTransactions = await (0, $a7367d01c6e76b1c$export$b087719c36e0f2dc)(actions);
30614
30648
  } catch {
30615
30649
  // Silently ignore error as this is usually thrown if user does not have enough balance
@@ -30860,14 +30894,13 @@ const $9085b221b72ac69e$export$e761f9e0703de895 = async (config, provider, order
30860
30894
  const createListingParams = {
30861
30895
  orderComponents: signedMessage.orderComponents,
30862
30896
  orderHash: signedMessage.orderHash,
30863
- orderSignature: signedMessage.signedMessage
30897
+ orderSignature: signedMessage.signedMessage,
30898
+ makerFees: []
30864
30899
  };
30865
30900
  if (makerFees !== undefined) {
30866
30901
  const orderBookFees = ($9051cee080948594$export$1e69c9cfc42e28d8)(makerFees, buyTokenOrNative.amount, decimals);
30867
- // @TODO add support for an array of fees when the orderbook enables it
30868
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);
30869
- const [makerFee] = orderBookFees;
30870
- createListingParams.makerFee = makerFee;
30903
+ createListingParams.makerFees = orderBookFees;
30871
30904
  }
30872
30905
  try {
30873
30906
  const order = await orderbook.createListing(createListingParams);
@@ -31184,7 +31217,7 @@ var checkout_sdk = /*#__PURE__*/Object.freeze({
31184
31217
  function $parcel$export(e, n, v, s) {
31185
31218
  Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
31186
31219
  }
31187
- const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.18.2";
31220
+ const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.19.0-alpha";
31188
31221
  const $d663162fd5a0853f$export$83bf90b30cdfd29f = ()=>false;
31189
31222
  const $d663162fd5a0853f$export$1169f5475725171b = ()=>$d663162fd5a0853f$export$38a083d9fb5551ca;
31190
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.2' };
2706
+ const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.19.0-alpha' };
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.2',
2766
+ sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.19.0-alpha',
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.2',
3052
+ sdkVersion: 'ts-immutable-sdk-0.19.0-alpha',
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) {
@@ -30306,6 +30297,34 @@ const $91807edfd7057288$export$8e03ea04d59f2402 = async (config, availableRoutin
30306
30297
 
30307
30298
 
30308
30299
 
30300
+
30301
+
30302
+
30303
+ const $5649bc8af91da370$export$1fb2bd867f4a9be3 = async (config, availableRoutingOptions, balanceRequirement)=>{
30304
+ if (balanceRequirement.type !== ($4b58188d47aafe8d$export$1fc8f52ad1810e52).ERC20 && balanceRequirement.type !== ($4b58188d47aafe8d$export$1fc8f52ad1810e52).NATIVE) return undefined;
30305
+ const requiredBalance = balanceRequirement.required;
30306
+ let hasAllowList = false;
30307
+ const onRampProvidersAllowList = await ($5a5ccedc98d53d25$export$9ec9fc71f3ce62c4)(config, availableRoutingOptions);
30308
+ Object.values(onRampProvidersAllowList).forEach((onRampAllowList)=>{
30309
+ if (onRampAllowList.length > 0 && !hasAllowList) hasAllowList = !!onRampAllowList.find((token)=>token.address === requiredBalance.token?.address);
30310
+ });
30311
+ if (!hasAllowList) return undefined;
30312
+ return {
30313
+ type: ($4b58188d47aafe8d$export$3af78bb3e8650ee6).ONRAMP,
30314
+ chainId: ($4013c5c91bb535f6$export$c9af4e4b001c6476)(config),
30315
+ asset: {
30316
+ balance: requiredBalance.balance,
30317
+ formattedBalance: requiredBalance.formattedBalance,
30318
+ token: {
30319
+ ...requiredBalance.token
30320
+ }
30321
+ }
30322
+ };
30323
+ };
30324
+
30325
+
30326
+
30327
+
30309
30328
  const $c16168a9c28ae4fd$export$31ce7ba1a2956195 = (balanceRequirements)=>{
30310
30329
  let insufficientBalanceCount = 0;
30311
30330
  let insufficientRequirement;
@@ -30329,6 +30348,12 @@ const $c16168a9c28ae4fd$export$c39a7b7dc167cdb4 = async (config, availableRoutin
30329
30348
  const swapFundingStep = await ($91807edfd7057288$export$8e03ea04d59f2402)(config, availableRoutingOptions, dexQuoteCache, ownerAddress, insufficientRequirement, tokenBalances, swappableTokens);
30330
30349
  return swapFundingStep;
30331
30350
  };
30351
+ const $c16168a9c28ae4fd$export$e1b6e4d22d0365ee = async (config, availableRoutingOptions, insufficientRequirement)=>{
30352
+ if (!availableRoutingOptions.onRamp) return undefined;
30353
+ if (insufficientRequirement === undefined) return undefined;
30354
+ const onRampFundingStep = await ($5649bc8af91da370$export$1fb2bd867f4a9be3)(config, availableRoutingOptions, insufficientRequirement);
30355
+ return onRampFundingStep;
30356
+ };
30332
30357
  const $c16168a9c28ae4fd$export$92606e71d0a264ff = async (config, ownerAddress, balanceRequirements, availableRoutingOptions)=>{
30333
30358
  let readOnlyProviders;
30334
30359
  try {
@@ -30349,7 +30374,7 @@ const $c16168a9c28ae4fd$export$92606e71d0a264ff = async (config, ownerAddress, b
30349
30374
  let bridgeFundingStep;
30350
30375
  if (availableRoutingOptions.bridge && insufficientRequirement) bridgeFundingStep = await ($fa9ac5bfdbbf9dfa$export$ddc7ba2b57d7c5fa)(config, readOnlyProviders, ownerAddress, availableRoutingOptions, insufficientRequirement, tokenBalances, feeEstimates);
30351
30376
  const swapFundingStep = await $c16168a9c28ae4fd$export$c39a7b7dc167cdb4(config, availableRoutingOptions, insufficientRequirement, dexQuoteCache, ownerAddress, tokenBalances, allowList.swap);
30352
- // Check on-ramp routes
30377
+ const onRampFundingStep = await $c16168a9c28ae4fd$export$e1b6e4d22d0365ee(config, availableRoutingOptions, insufficientRequirement);
30353
30378
  // Check swap routes
30354
30379
  // > Could bridge first
30355
30380
  // > Could on-ramp first
@@ -30362,7 +30387,7 @@ const $c16168a9c28ae4fd$export$92606e71d0a264ff = async (config, ownerAddress, b
30362
30387
  fundingRoutes: []
30363
30388
  };
30364
30389
  let priority = 0;
30365
- if (bridgeFundingStep || swapFundingStep) {
30390
+ if (bridgeFundingStep || swapFundingStep || onRampFundingStep) {
30366
30391
  response.response.type = ($b23305044c0e096a$export$3057de18ac0c076).ROUTES_FOUND;
30367
30392
  response.response.message = "Routes found";
30368
30393
  }
@@ -30384,6 +30409,15 @@ const $c16168a9c28ae4fd$export$92606e71d0a264ff = async (config, ownerAddress, b
30384
30409
  ]
30385
30410
  });
30386
30411
  }
30412
+ if (onRampFundingStep) {
30413
+ priority++;
30414
+ response.fundingRoutes.push({
30415
+ priority: priority,
30416
+ steps: [
30417
+ onRampFundingStep
30418
+ ]
30419
+ });
30420
+ }
30387
30421
  return response;
30388
30422
  };
30389
30423
 
@@ -30587,7 +30621,7 @@ const $64863c39386de592$export$7f8e2b98eca5a7f0 = async (config, provider, order
30587
30621
  };
30588
30622
  try {
30589
30623
  const fulfillerAddress = await provider.getSigner().getAddress();
30590
- const { actions: actions } = await orderbook.fulfillOrder(orderId, fulfillerAddress);
30624
+ const { actions: actions } = await orderbook.fulfillOrder(orderId, fulfillerAddress, []);
30591
30625
  unsignedTransactions = await (0, $a7367d01c6e76b1c$export$b087719c36e0f2dc)(actions);
30592
30626
  } catch {
30593
30627
  // Silently ignore error as this is usually thrown if user does not have enough balance
@@ -30838,14 +30872,13 @@ const $9085b221b72ac69e$export$e761f9e0703de895 = async (config, provider, order
30838
30872
  const createListingParams = {
30839
30873
  orderComponents: signedMessage.orderComponents,
30840
30874
  orderHash: signedMessage.orderHash,
30841
- orderSignature: signedMessage.signedMessage
30875
+ orderSignature: signedMessage.signedMessage,
30876
+ makerFees: []
30842
30877
  };
30843
30878
  if (makerFees !== undefined) {
30844
30879
  const orderBookFees = ($9051cee080948594$export$1e69c9cfc42e28d8)(makerFees, buyTokenOrNative.amount, decimals);
30845
- // @TODO add support for an array of fees when the orderbook enables it
30846
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);
30847
- const [makerFee] = orderBookFees;
30848
- createListingParams.makerFee = makerFee;
30881
+ createListingParams.makerFees = orderBookFees;
30849
30882
  }
30850
30883
  try {
30851
30884
  const order = await orderbook.createListing(createListingParams);
@@ -31162,7 +31195,7 @@ var checkout_sdk = /*#__PURE__*/Object.freeze({
31162
31195
  function $parcel$export(e, n, v, s) {
31163
31196
  Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
31164
31197
  }
31165
- const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.18.2";
31198
+ const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.19.0-alpha";
31166
31199
  const $d663162fd5a0853f$export$83bf90b30cdfd29f = ()=>false;
31167
31200
  const $d663162fd5a0853f$export$1169f5475725171b = ()=>$d663162fd5a0853f$export$38a083d9fb5551ca;
31168
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.2' };
1712
+ const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-0.19.0-alpha' };
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.2',
1768
+ sdkVersion: 'ts-immutable-sdk-0.19.0-alpha',
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.2",
4
+ "version": "0.19.0-alpha",
5
5
  "author": "Immutable",
6
6
  "browser": "./dist/index.browser.js",
7
7
  "bugs": "https://github.com/immutable/ts-immutable-sdk/issues",
@@ -31,6 +31,7 @@
31
31
  "typechain": "^8.1.1"
32
32
  },
33
33
  "devDependencies": {
34
+ "@imtbl/analytics": "0.0.0",
34
35
  "@imtbl/blockchain-data": "0.0.0",
35
36
  "@imtbl/checkout-sdk": "0.0.0",
36
37
  "@imtbl/checkout-widgets": "0.0.0",