@imtbl/sdk 0.27.11 → 0.27.12

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.
@@ -16187,7 +16187,7 @@ class OrdersService {
16187
16187
  * @returns ListListingsResult OK response.
16188
16188
  * @throws ApiError
16189
16189
  */
16190
- listListings({ chainName, status, sellItemContractAddress, buyItemContractAddress, sellItemTokenId, pageSize, sortBy, sortDirection, pageCursor, }) {
16190
+ listListings({ chainName, status, sellItemContractAddress, buyItemContractAddress, sellItemTokenId, fromUpdatedAt, pageSize, sortBy, sortDirection, pageCursor, }) {
16191
16191
  return this.httpRequest.request({
16192
16192
  method: 'GET',
16193
16193
  url: '/v1/chains/{chain_name}/orders/listings',
@@ -16199,6 +16199,7 @@ class OrdersService {
16199
16199
  'sell_item_contract_address': sellItemContractAddress,
16200
16200
  'buy_item_contract_address': buyItemContractAddress,
16201
16201
  'sell_item_token_id': sellItemTokenId,
16202
+ 'from_updated_at': fromUpdatedAt,
16202
16203
  'page_size': pageSize,
16203
16204
  'sort_by': sortBy,
16204
16205
  'sort_direction': sortDirection,
@@ -16282,7 +16283,7 @@ class OrdersService {
16282
16283
  * @returns ListTradeResult OK response.
16283
16284
  * @throws ApiError
16284
16285
  */
16285
- listTrades({ chainName, accountAddress, pageSize, sortBy, sortDirection, pageCursor, }) {
16286
+ listTrades({ chainName, accountAddress, fromIndexedAt, pageSize, sortBy, sortDirection, pageCursor, }) {
16286
16287
  return this.httpRequest.request({
16287
16288
  method: 'GET',
16288
16289
  url: '/v1/chains/{chain_name}/trades',
@@ -16291,6 +16292,7 @@ class OrdersService {
16291
16292
  },
16292
16293
  query: {
16293
16294
  'account_address': accountAddress,
16295
+ 'from_indexed_at': fromIndexedAt,
16294
16296
  'page_size': pageSize,
16295
16297
  'sort_by': sortBy,
16296
16298
  'sort_direction': sortDirection,
@@ -16356,6 +16358,16 @@ var CancelledOrderStatus;
16356
16358
  })(CancelledOrderStatus.cancellation_type || (CancelledOrderStatus.cancellation_type = {}));
16357
16359
  })(CancelledOrderStatus || (CancelledOrderStatus = {}));
16358
16360
 
16361
+ /* istanbul ignore file */
16362
+ /* tslint:disable */
16363
+ /* eslint-disable */
16364
+ var FailedOrderCancellation;
16365
+ (function (FailedOrderCancellation) {
16366
+ (function (reason_code) {
16367
+ reason_code["ALREADY_FILLED"] = "ALREADY_FILLED";
16368
+ })(FailedOrderCancellation.reason_code || (FailedOrderCancellation.reason_code = {}));
16369
+ })(FailedOrderCancellation || (FailedOrderCancellation = {}));
16370
+
16359
16371
  /* istanbul ignore file */
16360
16372
  /* tslint:disable */
16361
16373
  /* eslint-disable */
@@ -20587,7 +20599,7 @@ class APIError extends Error {
20587
20599
 
20588
20600
  /* eslint-disable implicit-arrow-linebreak */
20589
20601
  const defaultHeaders = {
20590
- sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.27.11',
20602
+ sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.27.12',
20591
20603
  };
20592
20604
  /**
20593
20605
  * createAPIConfiguration to create a custom Configuration
@@ -21954,6 +21966,20 @@ class $fd8a8472dcc3ec2b$export$ef140a6b05dfc786 {
21954
21966
 
21955
21967
 
21956
21968
 
21969
+ const $458d407830d66110$export$e6a390ea6399b7d8 = (config, debugString, seconds)=>{
21970
+ // eslint-disable-next-line no-console
21971
+ if (!config.isProduction) console.debug(debugString, seconds);
21972
+ };
21973
+ const $458d407830d66110$export$5280dbcb91c8b391 = async (config, debugString, promise)=>{
21974
+ const startTime = performance.now();
21975
+ const result = await promise;
21976
+ const endTime = performance.now();
21977
+ const elapsedTimeInSeconds = (endTime - startTime) / 1000;
21978
+ $458d407830d66110$export$e6a390ea6399b7d8(config, debugString, elapsedTimeInSeconds);
21979
+ return result;
21980
+ };
21981
+
21982
+
21957
21983
  const $1564e43dde50bb61$export$df96cd8d56be0ab1 = async (config, web3Provider, walletAddress)=>await ($a8bc256d81a5e2c1$export$bacc563de539c6c3)(async ()=>{
21958
21984
  const networkInfo = await ($de192de6ef100f9f$export$79f13b4cfaaf0d09)(config, web3Provider);
21959
21985
  if (!networkInfo.isSupported) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)(`Chain:${networkInfo.chainId} is not a supported chain`, ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).CHAIN_NOT_SUPPORTED_ERROR, {
@@ -22108,12 +22134,12 @@ const $1564e43dde50bb61$export$fee49741664a4d7e = async (config, web3Provider, w
22108
22134
  // Please remove this hack once https://immutable.atlassian.net/browse/WT-1710
22109
22135
  // is done.
22110
22136
  const isL1Chain = ($4013c5c91bb535f6$export$9b794d067cdd1af6)(config) === chainId;
22111
- return await $1564e43dde50bb61$export$8c978679845804d4(walletAddress, chainId, isL1Chain ? tokens : []);
22137
+ return ($458d407830d66110$export$5280dbcb91c8b391)(config, `Time to fetch balances using blockscout for ${chainId}`, $1564e43dde50bb61$export$8c978679845804d4(walletAddress, chainId, isL1Chain ? tokens : []));
22112
22138
  }
22113
22139
  // This fallback to use ERC20s calls which is a best effort solution
22114
22140
  // Fails in fetching data from the RCP calls might result in some
22115
22141
  // missing data.
22116
- return await $1564e43dde50bb61$export$a3238cee431627c6(config, web3Provider, walletAddress, tokens);
22142
+ return await ($458d407830d66110$export$5280dbcb91c8b391)(config, `Time to fetch balances using RPC for ${chainId}`, $1564e43dde50bb61$export$a3238cee431627c6(config, web3Provider, walletAddress, tokens));
22117
22143
  };
22118
22144
 
22119
22145
 
@@ -22354,7 +22380,7 @@ async function $67fc622a2b913d5f$export$7cf6178417769841(chainId, config) {
22354
22380
  overrides: dexConfig?.overrides
22355
22381
  });
22356
22382
  }
22357
- async function $67fc622a2b913d5f$export$c60ce6c6a92bc2ff(config) {
22383
+ function $67fc622a2b913d5f$export$c60ce6c6a92bc2ff(config) {
22358
22384
  return new (Orderbook)({
22359
22385
  baseConfig: {
22360
22386
  environment: config.environment
@@ -23155,8 +23181,8 @@ const $5e9bcae98dc8ff19$export$1165ca270f090a66 = (isDevelopment, isProduction)=
23155
23181
 
23156
23182
 
23157
23183
 
23158
- const $1fda5c40669a566d$export$1fac8e857d728583 = async ()=>false;
23159
- const $1fda5c40669a566d$export$2e83e9eeaf217e20 = async (config)=>{
23184
+ const $1fda5c40669a566d$export$5d79dcabf4595ae0 = async ()=>true;
23185
+ const $1fda5c40669a566d$export$2c2bcd6e0d9a9969 = async (config)=>{
23160
23186
  const availability = ($5e9bcae98dc8ff19$export$1165ca270f090a66)(config.isDevelopment, config.isProduction);
23161
23187
  try {
23162
23188
  return await availability.checkDexAvailability();
@@ -23177,18 +23203,18 @@ const $7f2e17f026d4fc8d$export$86d9f998ddda013e = async (config, provider)=>{
23177
23203
  const geoBlockingChecks = [];
23178
23204
  if (availableRoutingOptions.onRamp) geoBlockingChecks.push({
23179
23205
  id: "onRamp",
23180
- promise: ($1fda5c40669a566d$export$1fac8e857d728583)()
23206
+ promise: ($1fda5c40669a566d$export$5d79dcabf4595ae0)()
23181
23207
  });
23182
23208
  if (availableRoutingOptions.swap) geoBlockingChecks.push({
23183
23209
  id: "swap",
23184
- promise: ($1fda5c40669a566d$export$2e83e9eeaf217e20)(config)
23210
+ promise: ($1fda5c40669a566d$export$2c2bcd6e0d9a9969)(config)
23185
23211
  });
23186
23212
  if (geoBlockingChecks.length > 0) {
23187
23213
  const promises = geoBlockingChecks.map((geoBlockingCheck)=>geoBlockingCheck.promise);
23188
23214
  const geoBlockingStatus = await Promise.allSettled(promises);
23189
23215
  geoBlockingStatus.forEach((result, index)=>{
23190
23216
  const statusId = geoBlockingChecks[index].id;
23191
- availableRoutingOptions[statusId] = availableRoutingOptions[statusId] && result.status === "fulfilled" && !result.value;
23217
+ availableRoutingOptions[statusId] = availableRoutingOptions[statusId] && result.status === "fulfilled" && result.value;
23192
23218
  });
23193
23219
  }
23194
23220
  // Bridge not available if passport provider
@@ -23295,7 +23321,7 @@ const $049bba630af05555$export$6946a1f17c2bbf26 = async (config, chainId, wallet
23295
23321
  }
23296
23322
  // Resolve all the quotes and link them back to the swappable token
23297
23323
  // The swappable token array is in the same position in the array as the quote in the promise array
23298
- const dexTransactionResponse = await Promise.allSettled(dexTransactionResponsePromises);
23324
+ const dexTransactionResponse = await (0, $458d407830d66110$export$5280dbcb91c8b391)(config, "Time to resolve swap quotes from the dex", Promise.allSettled(dexTransactionResponsePromises));
23299
23325
  dexTransactionResponse.forEach((response, index)=>{
23300
23326
  if (response.status === "rejected") return; // Ignore any requests to dex that failed to resolve
23301
23327
  const swappableToken = fromToken[index];
@@ -23312,15 +23338,6 @@ const $049bba630af05555$export$6946a1f17c2bbf26 = async (config, chainId, wallet
23312
23338
  };
23313
23339
 
23314
23340
 
23315
- const $3ee85f12225c19f3$export$fb80fe94a81a3132 = async (config, dexQuoteCache, walletAddress, requiredToken, swappableTokens)=>{
23316
- const dexQuotes = dexQuoteCache.get(requiredToken.address);
23317
- if (dexQuotes && dexQuotes.size > 0) return dexQuotes;
23318
- const quotes = await ($049bba630af05555$export$6946a1f17c2bbf26)(config, ($4013c5c91bb535f6$export$c9af4e4b001c6476)(config), walletAddress, requiredToken, swappableTokens);
23319
- dexQuoteCache.set(requiredToken.address, quotes);
23320
- return quotes;
23321
- };
23322
-
23323
-
23324
23341
  const $91807edfd7057288$var$constructFees = (approvalGasFees, swapGasFees, swapFees)=>{
23325
23342
  let approvalGasFeeAmount = (BigNumber$1).from(0);
23326
23343
  let approvalGasFeeFormatted = "0";
@@ -23448,11 +23465,17 @@ const $91807edfd7057288$export$7b6318fc1a8067b3 = (l2Balances, approval)=>{
23448
23465
  approvalGasTokenAddress: approvalGasTokenAddress
23449
23466
  };
23450
23467
  };
23451
- const $91807edfd7057288$export$38077235fe748d40 = (l2Balances, swapFees, approvalFees, tokenBeingSwapped)=>{
23468
+ const $91807edfd7057288$export$38077235fe748d40 = (l2Balances, approvalFees, swapGasFees, swapFees, tokenBeingSwapped)=>{
23452
23469
  // Set up a map of token addresses to amounts for each of the swap fees
23453
23470
  const feeMap = new Map();
23454
23471
  // Add the approval fee to list of fees
23455
23472
  if (approvalFees.approvalGasTokenAddress !== "") feeMap.set(approvalFees.approvalGasTokenAddress, approvalFees.approvalGasFee);
23473
+ // Add the swap gas fee to list of fees
23474
+ if (swapGasFees) {
23475
+ const fee = feeMap.get(swapGasFees.token.address);
23476
+ if (fee) feeMap.set(swapGasFees.token.address, fee.add(swapGasFees.value));
23477
+ else feeMap.set(swapGasFees.token.address, swapGasFees.value);
23478
+ }
23456
23479
  // Add the token being swapped to list of fees to ensure the user can cover the fee + the token swap
23457
23480
  if (tokenBeingSwapped) {
23458
23481
  const fee = feeMap.get(tokenBeingSwapped.address);
@@ -23501,7 +23524,7 @@ const $91807edfd7057288$export$567a0c83c08c514b = (l2balance, balanceRequirement
23501
23524
  // that is going to be swapped from another item requirement then return true
23502
23525
  return remainingBalance.gte(amountBeingSwapped);
23503
23526
  };
23504
- const $91807edfd7057288$export$8e03ea04d59f2402 = async (config, availableRoutingOptions, dexQuoteCache, walletAddress, balanceRequirement, tokenBalanceResults, swappableTokens, balanceRequirements)=>{
23527
+ const $91807edfd7057288$export$8e03ea04d59f2402 = async (config, availableRoutingOptions, walletAddress, balanceRequirement, tokenBalanceResults, swappableTokens, balanceRequirements)=>{
23505
23528
  const fundingSteps = [];
23506
23529
  if (!availableRoutingOptions.swap) return fundingSteps;
23507
23530
  if (swappableTokens.length === 0) return fundingSteps;
@@ -23512,7 +23535,7 @@ const $91807edfd7057288$export$8e03ea04d59f2402 = async (config, availableRoutin
23512
23535
  if (!l2TokenBalanceResult) return fundingSteps;
23513
23536
  const l2Balances = l2TokenBalanceResult.balances;
23514
23537
  if (l2Balances.length === 0) return fundingSteps;
23515
- const quotes = await ($3ee85f12225c19f3$export$fb80fe94a81a3132)(config, dexQuoteCache, walletAddress, requiredToken, swappableTokens);
23538
+ const quotes = await ($049bba630af05555$export$6946a1f17c2bbf26)(config, ($4013c5c91bb535f6$export$c9af4e4b001c6476)(config), walletAddress, requiredToken, swappableTokens);
23516
23539
  const quoteTokenAddresses = Array.from(quotes.keys());
23517
23540
  for (const quoteTokenAddress of quoteTokenAddresses){
23518
23541
  const quote = quotes.get(quoteTokenAddress);
@@ -23529,7 +23552,7 @@ const $91807edfd7057288$export$8e03ea04d59f2402 = async (config, availableRoutin
23529
23552
  // If user does not have enough to cover approval fees then continue
23530
23553
  if (!approvalFees.sufficient) continue;
23531
23554
  // If user does not have enough to cover swap fees then continue
23532
- if (!$91807edfd7057288$export$38077235fe748d40(l2Balances, quote.quote.fees, approvalFees, {
23555
+ if (!$91807edfd7057288$export$38077235fe748d40(l2Balances, approvalFees, quote.swap, quote.quote.fees, {
23533
23556
  amount: amountOfQuoteTokenRequired.value,
23534
23557
  address: quoteTokenAddress
23535
23558
  })) continue;
@@ -23934,13 +23957,14 @@ const $7500587317643fc8$export$c3e193fd573f1a94 = async (config, swappableTokens
23934
23957
 
23935
23958
 
23936
23959
 
23937
- const $d54df4a884f14123$export$d46f2133747ffd93 = async (config, dexQuoteCache, ownerAddress, requiredTokenAddress, insufficientRequirement, filteredSwappableTokens)=>{
23960
+
23961
+ const $d54df4a884f14123$export$d46f2133747ffd93 = async (config, ownerAddress, requiredTokenAddress, insufficientRequirement, filteredSwappableTokens)=>{
23938
23962
  const filteredSwappableTokensAddresses = [];
23939
23963
  for (const token of filteredSwappableTokens){
23940
23964
  if (!token.address) continue;
23941
23965
  filteredSwappableTokensAddresses.push(token.address);
23942
23966
  }
23943
- const dexQuotes = await ($3ee85f12225c19f3$export$fb80fe94a81a3132)(config, dexQuoteCache, ownerAddress, {
23967
+ const dexQuotes = await ($049bba630af05555$export$6946a1f17c2bbf26)(config, ($4013c5c91bb535f6$export$c9af4e4b001c6476)(config), ownerAddress, {
23944
23968
  address: requiredTokenAddress,
23945
23969
  amount: insufficientRequirement.delta.balance
23946
23970
  }, filteredSwappableTokensAddresses);
@@ -24050,7 +24074,7 @@ const $afd57acae9471ac5$export$d9b96654eebdaf2a = (bridgeFundingSteps, swapFundi
24050
24074
  }
24051
24075
  return bridgeAndSwapRoutes;
24052
24076
  };
24053
- const $afd57acae9471ac5$export$f95ed27e871fe308 = async (config, readOnlyProviders, availableRoutingOptions, insufficientRequirement, dexQuoteCache, ownerAddress, feeEstimates, tokenBalances, bridgeableTokens, swappableTokens, balanceRequirements)=>{
24077
+ const $afd57acae9471ac5$export$f95ed27e871fe308 = async (config, readOnlyProviders, availableRoutingOptions, insufficientRequirement, ownerAddress, feeEstimates, tokenBalances, bridgeableTokens, swappableTokens, balanceRequirements)=>{
24054
24078
  const { l1balances: l1balances, l2balances: l2balances } = ($7bb5af1d8b5d9127$export$8280985cc3da7882)(config, tokenBalances);
24055
24079
  const requiredTokenAddress = insufficientRequirement.required.token.address;
24056
24080
  if ($afd57acae9471ac5$export$b94e88f4f8805f71(bridgeableTokens, swappableTokens, l1balances, l2balances, availableRoutingOptions, requiredTokenAddress)) return [];
@@ -24061,7 +24085,7 @@ const $afd57acae9471ac5$export$f95ed27e871fe308 = async (config, readOnlyProvide
24061
24085
  const filteredSwappableTokens = $afd57acae9471ac5$export$ed7c59bd8d1bb5a7(requiredTokenAddress, bridgeableTokens, swappableTokens, l1tol2Addresses);
24062
24086
  if (filteredSwappableTokens.length === 0) return [];
24063
24087
  // Fetch all the dex quotes from the list of swappable tokens
24064
- const dexQuotes = await ($d54df4a884f14123$export$d46f2133747ffd93)(config, dexQuoteCache, ownerAddress, requiredTokenAddress, insufficientRequirement, filteredSwappableTokens);
24088
+ const dexQuotes = await ($d54df4a884f14123$export$d46f2133747ffd93)(config, ownerAddress, requiredTokenAddress, insufficientRequirement, filteredSwappableTokens);
24065
24089
  // Construct bridge requirements based on L2 balances, slippage and swap fees
24066
24090
  const bridgeRequirements = ($62e968a3dd87940e$export$df667c749c93b110)(dexQuotes, l1balances, l2balances, l1tol2Addresses, balanceRequirements);
24067
24091
  if (bridgeRequirements.length === 0) return [];
@@ -24104,7 +24128,7 @@ const $afd57acae9471ac5$export$f95ed27e871fe308 = async (config, readOnlyProvide
24104
24128
  // Modify the users L2 balance to include the amount as if the user successfully bridged
24105
24129
  const modifiedTokenBalances = $afd57acae9471ac5$var$modifyTokenBalancesWithBridgedAmount(config, tokenBalances, l2balances, bridgedTokens, swappableTokens);
24106
24130
  // Call the swap route with the faked bridged balances
24107
- const swapRoutes = await ($91807edfd7057288$export$8e03ea04d59f2402)(config, availableRoutingOptions, dexQuoteCache, ownerAddress, insufficientRequirement, modifiedTokenBalances, swappableTokensAfterBridging, balanceRequirements);
24131
+ const swapRoutes = await ($91807edfd7057288$export$8e03ea04d59f2402)(config, availableRoutingOptions, ownerAddress, insufficientRequirement, modifiedTokenBalances, swappableTokensAfterBridging, balanceRequirements);
24108
24132
  if (!swapRoutes) return [];
24109
24133
  const originalBalanceSwapRoutes = $afd57acae9471ac5$export$1fc63300bde5e690(tokenBalances, swapRoutes);
24110
24134
  return $afd57acae9471ac5$export$d9b96654eebdaf2a(bridgeResults, originalBalanceSwapRoutes, l1tol2Addresses);
@@ -24146,6 +24170,7 @@ const $5649bc8af91da370$export$1fb2bd867f4a9be3 = async (config, availableRoutin
24146
24170
 
24147
24171
 
24148
24172
 
24173
+
24149
24174
  const $c16168a9c28ae4fd$var$hasAvailableRoutingOptions = (availableRoutingOptions)=>availableRoutingOptions.bridge || availableRoutingOptions.swap || availableRoutingOptions.onRamp;
24150
24175
  const $c16168a9c28ae4fd$export$31ce7ba1a2956195 = (balanceRequirements)=>{
24151
24176
  let insufficientBalanceCount = 0;
@@ -24169,7 +24194,7 @@ const $c16168a9c28ae4fd$export$ab86023c267660 = async (config, readOnlyProviders
24169
24194
  if (availableRoutingOptions.bridge && insufficientRequirement) bridgeFundingStep = await ($fa9ac5bfdbbf9dfa$export$ddc7ba2b57d7c5fa)(config, readOnlyProviders, ownerAddress, availableRoutingOptions, bridgeRequirement, tokenBalances, feeEstimates);
24170
24195
  return bridgeFundingStep;
24171
24196
  };
24172
- const $c16168a9c28ae4fd$export$814624e957fa0f11 = async (config, availableRoutingOptions, insufficientRequirement, dexQuoteCache, ownerAddress, tokenBalances, swapTokenAllowList, balanceRequirements)=>{
24197
+ const $c16168a9c28ae4fd$export$814624e957fa0f11 = async (config, availableRoutingOptions, insufficientRequirement, ownerAddress, tokenBalances, swapTokenAllowList, balanceRequirements)=>{
24173
24198
  const fundingSteps = [];
24174
24199
  if (!availableRoutingOptions.swap) return fundingSteps;
24175
24200
  if (insufficientRequirement === undefined) return fundingSteps;
@@ -24180,9 +24205,9 @@ const $c16168a9c28ae4fd$export$814624e957fa0f11 = async (config, availableRoutin
24180
24205
  if (swapTokenAllowList.length === 0) return fundingSteps;
24181
24206
  const swappableTokens = swapTokenAllowList.filter((token)=>token.address).map((token)=>token.address);
24182
24207
  if (swappableTokens.length === 0) return fundingSteps;
24183
- return await ($91807edfd7057288$export$8e03ea04d59f2402)(config, availableRoutingOptions, dexQuoteCache, ownerAddress, insufficientRequirement, tokenBalances, swappableTokens, balanceRequirements);
24208
+ return await ($91807edfd7057288$export$8e03ea04d59f2402)(config, availableRoutingOptions, ownerAddress, insufficientRequirement, tokenBalances, swappableTokens, balanceRequirements);
24184
24209
  };
24185
- const $c16168a9c28ae4fd$export$2becd43da9d21f73 = async (config, readOnlyProviders, availableRoutingOptions, insufficientRequirement, dexQuoteCache, ownerAddress, tokenBalances, tokenAllowList, feeEstimates, balanceRequirements)=>{
24210
+ const $c16168a9c28ae4fd$export$2becd43da9d21f73 = async (config, readOnlyProviders, availableRoutingOptions, insufficientRequirement, ownerAddress, tokenBalances, tokenAllowList, feeEstimates, balanceRequirements)=>{
24186
24211
  if (!insufficientRequirement) return [];
24187
24212
  const l1balancesResult = tokenBalances.get(($4013c5c91bb535f6$export$9b794d067cdd1af6)(config));
24188
24213
  const l2balancesResult = tokenBalances.get(($4013c5c91bb535f6$export$c9af4e4b001c6476)(config));
@@ -24200,7 +24225,7 @@ const $c16168a9c28ae4fd$export$2becd43da9d21f73 = async (config, readOnlyProvide
24200
24225
  });
24201
24226
  const swapTokenAllowList = tokenAllowList?.swap ?? [];
24202
24227
  if (insufficientRequirement.type !== ($4b58188d47aafe8d$export$1fc8f52ad1810e52).NATIVE && insufficientRequirement.type !== ($4b58188d47aafe8d$export$1fc8f52ad1810e52).ERC20) return [];
24203
- const routes = await ($afd57acae9471ac5$export$f95ed27e871fe308)(config, readOnlyProviders, availableRoutingOptions, insufficientRequirement, dexQuoteCache, ownerAddress, feeEstimates, tokenBalances, bridgeableL1Addresses, swapTokenAllowList, balanceRequirements);
24228
+ const routes = await ($afd57acae9471ac5$export$f95ed27e871fe308)(config, readOnlyProviders, availableRoutingOptions, insufficientRequirement, ownerAddress, feeEstimates, tokenBalances, bridgeableL1Addresses, swapTokenAllowList, balanceRequirements);
24204
24229
  return routes;
24205
24230
  };
24206
24231
  const $c16168a9c28ae4fd$export$e1b6e4d22d0365ee = async (config, availableRoutingOptions, insufficientRequirement)=>{
@@ -24222,20 +24247,18 @@ const $c16168a9c28ae4fd$export$92606e71d0a264ff = async (config, ownerAddress, b
24222
24247
  message: err.message
24223
24248
  });
24224
24249
  }
24225
- const tokenBalances = await ($33acec7b4a26c053$export$23ddeb2642d2f9d)(config, readOnlyProviders, ownerAddress, availableRoutingOptions);
24226
- const allowList = await ($5a5ccedc98d53d25$export$1ad29657d49c5440)(config, tokenBalances, availableRoutingOptions);
24227
- // Bridge and swap fee cache
24250
+ const tokenBalances = await ($458d407830d66110$export$5280dbcb91c8b391)(config, "Time to get token balances inside router", ($33acec7b4a26c053$export$23ddeb2642d2f9d)(config, readOnlyProviders, ownerAddress, availableRoutingOptions));
24251
+ const allowList = await ($458d407830d66110$export$5280dbcb91c8b391)(config, "Time to get routing allowlist", ($5a5ccedc98d53d25$export$1ad29657d49c5440)(config, tokenBalances, availableRoutingOptions));
24252
+ // Fee estimate cache
24228
24253
  const feeEstimates = new Map();
24229
- // Dex quotes cache
24230
- const dexQuoteCache = new Map();
24231
24254
  // Ensures only 1 balance requirement is insufficient
24232
24255
  const insufficientRequirement = $c16168a9c28ae4fd$export$31ce7ba1a2956195(balanceRequirements);
24233
24256
  const routePromises = [];
24234
24257
  routePromises.push($c16168a9c28ae4fd$export$ab86023c267660(config, readOnlyProviders, availableRoutingOptions, insufficientRequirement, ownerAddress, tokenBalances, feeEstimates));
24235
- routePromises.push($c16168a9c28ae4fd$export$814624e957fa0f11(config, availableRoutingOptions, insufficientRequirement, dexQuoteCache, ownerAddress, tokenBalances, allowList.swap, balanceRequirements));
24258
+ routePromises.push($c16168a9c28ae4fd$export$814624e957fa0f11(config, availableRoutingOptions, insufficientRequirement, ownerAddress, tokenBalances, allowList.swap, balanceRequirements));
24236
24259
  routePromises.push($c16168a9c28ae4fd$export$e1b6e4d22d0365ee(config, availableRoutingOptions, insufficientRequirement));
24237
- routePromises.push($c16168a9c28ae4fd$export$2becd43da9d21f73(config, readOnlyProviders, availableRoutingOptions, insufficientRequirement, dexQuoteCache, ownerAddress, tokenBalances, allowList, feeEstimates, balanceRequirements));
24238
- const resolved = await Promise.all(routePromises);
24260
+ routePromises.push($c16168a9c28ae4fd$export$2becd43da9d21f73(config, readOnlyProviders, availableRoutingOptions, insufficientRequirement, ownerAddress, tokenBalances, allowList, feeEstimates, balanceRequirements));
24261
+ const resolved = await ($458d407830d66110$export$5280dbcb91c8b391)(config, "Time to resolve all routes", Promise.all(routePromises));
24239
24262
  let bridgeFundingStep;
24240
24263
  let swapFundingSteps = [];
24241
24264
  let onRampFundingStep;
@@ -24302,26 +24325,31 @@ const $c16168a9c28ae4fd$export$92606e71d0a264ff = async (config, ownerAddress, b
24302
24325
  };
24303
24326
 
24304
24327
 
24328
+
24305
24329
  const $0e7419077c373b24$export$9e073f9ada8c81e6 = async (config, provider, itemRequirements, transactionOrGasAmount)=>{
24306
24330
  const ownerAddress = await provider.getSigner().getAddress();
24307
24331
  let aggregatedItems = ($074f75878f618031$export$c804c9ade5c28607)(itemRequirements);
24308
- const erc20Allowances = await ($fc8b338399d890f3$export$d93c00812189e36)(provider, ownerAddress, aggregatedItems);
24309
- const erc721Allowances = await ($35c3fc7013888ba5$export$be546c525d418988)(provider, ownerAddress, aggregatedItems);
24310
- const aggregatedAllowances = ($ddc6bcd0896481e5$export$2fbfa41a4de56a89)(erc20Allowances, erc721Allowances);
24311
- const gasItem = await ($7d1bfafb81e64d74$export$3a4140bd9e983e4e)(provider, aggregatedAllowances, transactionOrGasAmount);
24332
+ const erc20AllowancePromise = ($fc8b338399d890f3$export$d93c00812189e36)(provider, ownerAddress, aggregatedItems);
24333
+ const erc721AllowancePromise = ($35c3fc7013888ba5$export$be546c525d418988)(provider, ownerAddress, aggregatedItems);
24334
+ const resolvedAllowances = await ($458d407830d66110$export$5280dbcb91c8b391)(config, "Time to calculate token allowances", Promise.all([
24335
+ erc20AllowancePromise,
24336
+ erc721AllowancePromise
24337
+ ]));
24338
+ const aggregatedAllowances = ($ddc6bcd0896481e5$export$2fbfa41a4de56a89)(resolvedAllowances[0], resolvedAllowances[1]);
24339
+ const gasItem = await ($458d407830d66110$export$5280dbcb91c8b391)(config, "Time to run gas calculator", ($7d1bfafb81e64d74$export$3a4140bd9e983e4e)(provider, aggregatedAllowances, transactionOrGasAmount));
24312
24340
  if (gasItem !== null) {
24313
24341
  aggregatedItems.push(gasItem);
24314
24342
  aggregatedItems = ($074f75878f618031$export$c804c9ade5c28607)(aggregatedItems);
24315
24343
  }
24316
- const balanceCheckResult = await ($beb896e098e41faf$export$ddfc885f43c3cb6e)(config, provider, ownerAddress, aggregatedItems);
24344
+ const balanceCheckResult = await ($458d407830d66110$export$5280dbcb91c8b391)(config, "Time to run balance checks", ($beb896e098e41faf$export$ddfc885f43c3cb6e)(config, provider, ownerAddress, aggregatedItems));
24317
24345
  const { sufficient: sufficient } = balanceCheckResult;
24318
24346
  const transactionRequirements = balanceCheckResult.balanceRequirements;
24319
24347
  if (sufficient) return {
24320
24348
  sufficient: sufficient,
24321
24349
  transactionRequirements: transactionRequirements
24322
24350
  };
24323
- const availableRoutingOptions = await ($7f2e17f026d4fc8d$export$86d9f998ddda013e)(config, provider);
24324
- const routingOutcome = await ($c16168a9c28ae4fd$export$92606e71d0a264ff)(config, ownerAddress, balanceCheckResult, availableRoutingOptions);
24351
+ const availableRoutingOptions = await ($458d407830d66110$export$5280dbcb91c8b391)(config, "Time to fetch available routing options", ($7f2e17f026d4fc8d$export$86d9f998ddda013e)(config, provider));
24352
+ const routingOutcome = await ($458d407830d66110$export$5280dbcb91c8b391)(config, "Total time to run the routing calculator", ($c16168a9c28ae4fd$export$92606e71d0a264ff)(config, ownerAddress, balanceCheckResult, availableRoutingOptions));
24325
24353
  return {
24326
24354
  sufficient: sufficient,
24327
24355
  transactionRequirements: transactionRequirements,
@@ -24504,6 +24532,7 @@ const $9051cee080948594$export$1e69c9cfc42e28d8 = (orderFees, weiAmount, decimal
24504
24532
  };
24505
24533
 
24506
24534
 
24535
+
24507
24536
  const $64863c39386de592$export$4249179755829904 = (type, contractAddress, amount, spenderAddress)=>{
24508
24537
  switch(type){
24509
24538
  case ($4b58188d47aafe8d$export$1fc8f52ad1810e52).ERC20:
@@ -24542,8 +24571,8 @@ const $64863c39386de592$export$7f8e2b98eca5a7f0 = async (config, provider, order
24542
24571
  if (orders.length === 0) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("No orders were provided to the orders array. Please provide at least one order.", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).FULFILL_ORDER_LISTING_ERROR);
24543
24572
  const { id: id, takerFees: takerFees } = orders[0];
24544
24573
  try {
24545
- orderbook = await $67fc622a2b913d5f$export$c60ce6c6a92bc2ff(config);
24546
- order = await orderbook.getListing(id);
24574
+ orderbook = $67fc622a2b913d5f$export$c60ce6c6a92bc2ff(config);
24575
+ order = await (0, $458d407830d66110$export$5280dbcb91c8b391)(config, "Time to fetch the listing from the orderbook", orderbook.getListing(id));
24547
24576
  const { seaportContractAddress: seaportContractAddress } = orderbook.config();
24548
24577
  spenderAddress = seaportContractAddress;
24549
24578
  } catch (err) {
@@ -24560,23 +24589,26 @@ const $64863c39386de592$export$7f8e2b98eca5a7f0 = async (config, provider, order
24560
24589
  let decimals = 18;
24561
24590
  if (order.result.buy[0].type === "ERC20") {
24562
24591
  const tokenContract = $06a6c5c23f7f2479$export$fbbc17f6e6e58544(order.result.buy[0].contractAddress, ($d85ad1457a3f1a83$export$db5daa1b5156ccfe), provider);
24563
- decimals = await tokenContract.decimals();
24592
+ decimals = await ($458d407830d66110$export$5280dbcb91c8b391)(config, "Time to get decimals of token contract for the buy token", tokenContract.decimals());
24564
24593
  }
24565
24594
  let fees = [];
24566
24595
  if (takerFees && takerFees.length > 0) fees = ($9051cee080948594$export$1e69c9cfc42e28d8)(takerFees, buyToken.amount, decimals);
24567
24596
  let unsignedApprovalTransactions = [];
24568
24597
  let unsignedFulfillmentTransactions = [];
24569
24598
  let orderActions = [];
24599
+ const fulfillOrderStartTime = new Date().getTime();
24570
24600
  try {
24571
- const fulfillerAddress = await provider.getSigner().getAddress();
24572
- const { actions: actions } = await orderbook.fulfillOrder(id, fulfillerAddress, fees);
24601
+ const fulfillerAddress = await (0, $458d407830d66110$export$5280dbcb91c8b391)(config, "Time to get the address from the provider", provider.getSigner().getAddress());
24602
+ const { actions: actions } = await (0, $458d407830d66110$export$5280dbcb91c8b391)(config, "Time to call fulfillOrder from the orderbook", orderbook.fulfillOrder(id, fulfillerAddress, fees));
24573
24603
  orderActions = actions;
24574
- unsignedApprovalTransactions = await (0, $a7367d01c6e76b1c$export$f64a20a30eb98855)(actions);
24575
- } catch {
24576
- // Silently ignore error as this is usually thrown if user does not have enough balance
24604
+ unsignedApprovalTransactions = await (0, $458d407830d66110$export$5280dbcb91c8b391)(config, "Time to construct the unsigned approval transactions", (0, $a7367d01c6e76b1c$export$f64a20a30eb98855)(actions));
24605
+ } catch (err) {
24606
+ // Silently ignore error as this is usually thrown if user does not have enough balance
24607
+ const elapsedTimeInSeconds = (new Date().getTime() - fulfillOrderStartTime) / 1000;
24608
+ ($458d407830d66110$export$e6a390ea6399b7d8)(config, "Time to call fulfillOrder from the orderbook", elapsedTimeInSeconds);
24577
24609
  }
24578
24610
  try {
24579
- unsignedFulfillmentTransactions = await (0, $a7367d01c6e76b1c$export$396bd6ce7d3ab533)(orderActions);
24611
+ unsignedFulfillmentTransactions = await (0, $458d407830d66110$export$5280dbcb91c8b391)(config, "Time to construct the unsigned fulfillment transactions", (0, $a7367d01c6e76b1c$export$396bd6ce7d3ab533)(orderActions));
24580
24612
  } catch {
24581
24613
  // if cannot estimate gas then silently continue and use gas limit in smartCheckout
24582
24614
  // but get the fulfillment transactions after they have approved the spending
@@ -24608,7 +24640,7 @@ const $64863c39386de592$export$7f8e2b98eca5a7f0 = async (config, provider, order
24608
24640
  const itemRequirements = [
24609
24641
  $64863c39386de592$export$4249179755829904(type, contractAddress, amount, spenderAddress)
24610
24642
  ];
24611
- const smartCheckoutResult = await ($0e7419077c373b24$export$9e073f9ada8c81e6)(config, provider, itemRequirements, $64863c39386de592$export$8f2ff92ab8657f0b(gasLimit, unsignedFulfillmentTransactions));
24643
+ const smartCheckoutResult = await ($458d407830d66110$export$5280dbcb91c8b391)(config, "Total time running smart checkout", ($0e7419077c373b24$export$9e073f9ada8c81e6)(config, provider, itemRequirements, $64863c39386de592$export$8f2ff92ab8657f0b(gasLimit, unsignedFulfillmentTransactions)));
24612
24644
  if (smartCheckoutResult.sufficient) {
24613
24645
  const approvalResult = await ($25ac589234c10b67$export$19693ca396db083e)(provider, unsignedApprovalTransactions);
24614
24646
  if (approvalResult.type === ($d855a5ba32004345$export$f51b97f3aaf2d5a8).FAILED) return {
@@ -24650,15 +24682,16 @@ const $64863c39386de592$export$7f8e2b98eca5a7f0 = async (config, provider, order
24650
24682
 
24651
24683
 
24652
24684
 
24685
+
24653
24686
  const $9c3db1bb9c8b69d3$export$70b61ad426ddbe54 = async (config, provider, orderIds)=>{
24654
24687
  let unsignedCancelOrderTransaction;
24655
24688
  if (orderIds.length === 0) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("No orderIds were provided to the orderIds array. Please provide at least one orderId.", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).CANCEL_ORDER_LISTING_ERROR);
24656
24689
  // Update this when bulk cancel is supported
24657
24690
  const orderId = orderIds[0];
24658
24691
  try {
24659
- const offererAddress = await provider.getSigner().getAddress();
24660
- const orderbook = await $67fc622a2b913d5f$export$c60ce6c6a92bc2ff(config);
24661
- const cancelOrderResponse = await orderbook.cancelOrder(orderId, offererAddress);
24692
+ const offererAddress = await (0, $458d407830d66110$export$5280dbcb91c8b391)(config, "Time to get the address from the provider", provider.getSigner().getAddress());
24693
+ const orderbook = $67fc622a2b913d5f$export$c60ce6c6a92bc2ff(config);
24694
+ const cancelOrderResponse = await (0, $458d407830d66110$export$5280dbcb91c8b391)(config, "Time to get the cancel order from the orderbook", orderbook.cancelOrder(orderId, offererAddress));
24662
24695
  unsignedCancelOrderTransaction = cancelOrderResponse.unsignedCancelOrderTransaction;
24663
24696
  } catch (err) {
24664
24697
  throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("An error occurred while cancelling the order listing", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).CANCEL_ORDER_LISTING_ERROR, {
@@ -24691,6 +24724,7 @@ const $9c3db1bb9c8b69d3$export$70b61ad426ddbe54 = async (config, provider, order
24691
24724
 
24692
24725
 
24693
24726
 
24727
+
24694
24728
  const $9085b221b72ac69e$export$af768ccdf17d5c04 = (id, contractAddress, spenderAddress)=>({
24695
24729
  type: ($4b58188d47aafe8d$export$1fc8f52ad1810e52).ERC721,
24696
24730
  id: id,
@@ -24719,15 +24753,15 @@ const $9085b221b72ac69e$export$e761f9e0703de895 = async (config, provider, order
24719
24753
  if (buyToken.type === ($4b58188d47aafe8d$export$1fc8f52ad1810e52).ERC20) {
24720
24754
  // get this from the allowed list
24721
24755
  const buyTokenContract = new (Contract$1)(buyToken.contractAddress, JSON.stringify(($d85ad1457a3f1a83$export$db5daa1b5156ccfe)), provider);
24722
- decimals = await buyTokenContract.decimals();
24756
+ decimals = await ($458d407830d66110$export$5280dbcb91c8b391)(config, "Time to get decimals of token contract for the buy token", buyTokenContract.decimals());
24723
24757
  }
24724
24758
  const buyTokenOrNative = $9085b221b72ac69e$export$586d02673c66d423(buyToken, decimals);
24725
24759
  try {
24726
- const walletAddress = await provider.getSigner().getAddress();
24727
- orderbook = await $67fc622a2b913d5f$export$c60ce6c6a92bc2ff(config);
24760
+ const walletAddress = await (0, $458d407830d66110$export$5280dbcb91c8b391)(config, "Time to get the address from the provider", provider.getSigner().getAddress());
24761
+ orderbook = $67fc622a2b913d5f$export$c60ce6c6a92bc2ff(config);
24728
24762
  const { seaportContractAddress: seaportContractAddress } = orderbook.config();
24729
24763
  spenderAddress = seaportContractAddress;
24730
- listing = await orderbook.prepareListing({
24764
+ listing = await (0, $458d407830d66110$export$5280dbcb91c8b391)(config, "Time to prepare the listing from the orderbook", orderbook.prepareListing({
24731
24765
  makerAddress: walletAddress,
24732
24766
  buy: buyTokenOrNative,
24733
24767
  sell: {
@@ -24735,7 +24769,7 @@ const $9085b221b72ac69e$export$e761f9e0703de895 = async (config, provider, order
24735
24769
  contractAddress: sellToken.collectionAddress,
24736
24770
  tokenId: sellToken.id
24737
24771
  }
24738
- });
24772
+ }));
24739
24773
  } catch (err) {
24740
24774
  throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("An error occurred while preparing the listing", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).PREPARE_ORDER_LISTING_ERROR, {
24741
24775
  message: err.message,
@@ -24746,13 +24780,13 @@ const $9085b221b72ac69e$export$e761f9e0703de895 = async (config, provider, order
24746
24780
  const itemRequirements = [
24747
24781
  $9085b221b72ac69e$export$af768ccdf17d5c04(sellToken.id, sellToken.collectionAddress, spenderAddress)
24748
24782
  ];
24749
- const smartCheckoutResult = await ($0e7419077c373b24$export$9e073f9ada8c81e6)(config, provider, itemRequirements, {
24783
+ const smartCheckoutResult = await ($458d407830d66110$export$5280dbcb91c8b391)(config, "Total time running smart checkout", ($0e7419077c373b24$export$9e073f9ada8c81e6)(config, provider, itemRequirements, {
24750
24784
  type: ($4b58188d47aafe8d$export$65c64e46348ee3c1).GAS,
24751
24785
  gasToken: {
24752
24786
  type: ($4b58188d47aafe8d$export$537fa3efd10ed435).NATIVE,
24753
24787
  limit: (BigNumber$1).from((constants).estimatedFulfillmentGasGwei)
24754
24788
  }
24755
- });
24789
+ }));
24756
24790
  if (smartCheckoutResult.sufficient) {
24757
24791
  const unsignedTransactions = await ($a7367d01c6e76b1c$export$c5b3365853cb6159)(listing.actions);
24758
24792
  const approvalResult = await ($25ac589234c10b67$export$19693ca396db083e)(provider, unsignedTransactions.approvalTransactions);
@@ -25,7 +25,7 @@ var $045213b18e9f1f94$export$75be0f6af9650f2c;
25
25
  })($045213b18e9f1f94$export$75be0f6af9650f2c || ($045213b18e9f1f94$export$75be0f6af9650f2c = {}));
26
26
 
27
27
 
28
- const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.27.11";
28
+ const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.27.12";
29
29
  const $d663162fd5a0853f$export$83bf90b30cdfd29f = ()=>false;
30
30
  const $d663162fd5a0853f$export$1169f5475725171b = ()=>$d663162fd5a0853f$export$38a083d9fb5551ca;
31
31
 
@@ -16,7 +16,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
16
16
  chainID,
17
17
  coreContractAddress,
18
18
  registrationContractAddress,
19
- sdkVersion: 'ts-immutable-sdk-0.27.11',
19
+ sdkVersion: 'ts-immutable-sdk-0.27.12',
20
20
  });
21
21
  /**
22
22
  * Sets `sdkVersion` at the time of build