@imtbl/sdk 1.30.0-alpha.1 → 1.30.0-alpha.2

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.
Files changed (37) hide show
  1. package/dist/blockchain_data.js +2 -2
  2. package/dist/browser/checkout/{BridgeWidget-b488c49c.js → BridgeWidget-2a670c8a.js} +1 -1
  3. package/dist/browser/checkout/{HorizontalMenu-94558d7e.js → HorizontalMenu-b27619a9.js} +1 -1
  4. package/dist/browser/checkout/{OnRampWidget-cf3dad47.js → OnRampWidget-4a764ba3.js} +1 -1
  5. package/dist/browser/checkout/{SaleWidget-e68a74b5.js → SaleWidget-bd87c96c.js} +1 -1
  6. package/dist/browser/checkout/{SpendingCapHero-277a2aed.js → SpendingCapHero-fbde4158.js} +1 -1
  7. package/dist/browser/checkout/{SwapWidget-f1c4e02c.js → SwapWidget-73986871.js} +1 -1
  8. package/dist/browser/checkout/{TopUpView-0bcbc762.js → TopUpView-49db4e0c.js} +1 -1
  9. package/dist/browser/checkout/{WalletWidget-d302dc44.js → WalletWidget-9af01453.js} +1 -1
  10. package/dist/browser/checkout/{auto-track-f9611a2a.js → auto-track-fe6fb084.js} +1 -1
  11. package/dist/browser/checkout/{balance-3d411bbd.js → balance-11636d12.js} +1 -1
  12. package/dist/browser/checkout/{index-adcf7b3e.js → index-376396ce.js} +1 -1
  13. package/dist/browser/checkout/{index-0662954f.js → index-72581709.js} +1 -1
  14. package/dist/browser/checkout/{index-4da0c2bb.js → index-9493d2b3.js} +2 -2
  15. package/dist/browser/checkout/{index-3db0886f.js → index-be1e7f3b.js} +1 -1
  16. package/dist/browser/checkout/{index-266a0a59.js → index-dc45bf6b.js} +1 -1
  17. package/dist/browser/checkout/{index-d9350375.js → index-e2a7040c.js} +1 -1
  18. package/dist/browser/checkout/{index-939bb675.js → index-ea3db59e.js} +1 -1
  19. package/dist/browser/checkout/index-f4000748.js +1 -0
  20. package/dist/browser/checkout/{index.umd-4ad5ee36.js → index.umd-44a60fe6.js} +1 -1
  21. package/dist/browser/checkout/{retry-cd8de993.js → retry-427ffe34.js} +1 -1
  22. package/dist/browser/checkout/sdk.js +4 -4
  23. package/dist/browser/checkout/widgets-esm.js +1 -1
  24. package/dist/browser/checkout/widgets.js +1 -1
  25. package/dist/checkout.d.ts +4 -2
  26. package/dist/checkout.js +28 -19
  27. package/dist/config.js +1 -1
  28. package/dist/index.browser.js +4 -4
  29. package/dist/index.browser.js.map +1 -1
  30. package/dist/index.cjs +31 -22
  31. package/dist/index.d.ts +4 -2
  32. package/dist/index.js +31 -22
  33. package/dist/orderbook.js +1 -1
  34. package/dist/passport.js +4 -4
  35. package/dist/x.js +3 -3
  36. package/package.json +1 -1
  37. package/dist/browser/checkout/index-57dbdf1d.js +0 -1
@@ -14354,6 +14354,8 @@ interface SmartCheckoutParams {
14354
14354
  onComplete?: (result: SmartCheckoutResult) => void;
14355
14355
  /** The callback to be executed on each funding route found */
14356
14356
  onFundingRoute?: (fundingRoute: FundingRoute) => void;
14357
+ /** A flag to get funding routes based on full or partial amount */
14358
+ fundingRouteFullAmount?: boolean;
14357
14359
  }
14358
14360
  /**
14359
14361
  * Represents a native item requirement for a transaction.
@@ -16574,14 +16576,14 @@ declare class Checkout {
16574
16576
  /**
16575
16577
  * Determines the requirements for performing a buy.
16576
16578
  * @param {BuyParams} params - The parameters for the buy.
16577
- */
16579
+ */
16578
16580
  buy(params: BuyParams): Promise<BuyResult>;
16579
16581
  /**
16580
16582
  * Determines the requirements for performing a sell.
16581
16583
  * @param {SellParams} params - The parameters for the sell.
16582
16584
  * Only currently actions the first order in the array until we support batch processing.
16583
16585
  * Only currently actions the first fee in the fees array of each order until we support multiple fees.
16584
- */
16586
+ */
16585
16587
  sell(params: SellParams): Promise<SellResult>;
16586
16588
  /**
16587
16589
  * Cancels a sell.
package/dist/checkout.js CHANGED
@@ -140,7 +140,7 @@ const flattenProperties$1 = (properties) => {
140
140
  };
141
141
 
142
142
  // WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
143
- const SDK_VERSION$1 = '1.30.0-alpha.1';
143
+ const SDK_VERSION$1 = '1.30.0-alpha.2';
144
144
  const getFrameParentDomain$1 = () => {
145
145
  if (isNode$1()) {
146
146
  return '';
@@ -28892,7 +28892,7 @@ const flattenProperties = (properties) => {
28892
28892
  };
28893
28893
 
28894
28894
  // WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
28895
- const SDK_VERSION = '1.30.0-alpha.1';
28895
+ const SDK_VERSION = '1.30.0-alpha.2';
28896
28896
  const getFrameParentDomain = () => {
28897
28897
  if (isNode()) {
28898
28898
  return '';
@@ -39950,7 +39950,7 @@ class APIError extends Error {
39950
39950
 
39951
39951
  /* eslint-disable implicit-arrow-linebreak */
39952
39952
  const defaultHeaders = {
39953
- sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-1.30.0-alpha.1',
39953
+ sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-1.30.0-alpha.2',
39954
39954
  };
39955
39955
  /**
39956
39956
  * createAPIConfiguration to create a custom Configuration
@@ -41384,7 +41384,7 @@ const IMMUTABLE_ZKVEM_GAS_OVERRIDES = {
41384
41384
  maxPriorityFeePerGas: BigNumber$1.from(10e9),
41385
41385
  };
41386
41386
 
41387
- const SDK_VERSION_MARKER = '1.30.0-alpha.1';
41387
+ const SDK_VERSION_MARKER = '1.30.0-alpha.2';
41388
41388
  // This SDK version is replaced by the `yarn build` command ran on the root level
41389
41389
  const globalPackageVersion = () => SDK_VERSION_MARKER;
41390
41390
 
@@ -44432,7 +44432,7 @@ const routingCalculator = async (config, ownerAddress, balanceRequirements, avai
44432
44432
  };
44433
44433
  };
44434
44434
 
44435
- const overrideSufficientBalanceCheckResult = (balanceCheckResult) => {
44435
+ const overrideBalanceCheckResult = (balanceCheckResult) => {
44436
44436
  const modifiedRequirements = balanceCheckResult.balanceRequirements.map((requirement) => {
44437
44437
  if (requirement.type === ItemType.ERC20 && requirement.sufficient) {
44438
44438
  return {
@@ -44451,9 +44451,9 @@ const overrideSufficientBalanceCheckResult = (balanceCheckResult) => {
44451
44451
  balanceRequirements: modifiedRequirements,
44452
44452
  };
44453
44453
  };
44454
- const processRoutes = async (config, ownerAddress, sufficient, availableRoutingOptions, transactionRequirements, balanceCheckResult, onComplete, onFundingRoute) => {
44455
- const finalBalanceCheckResult = sufficient && onComplete
44456
- ? overrideSufficientBalanceCheckResult(balanceCheckResult)
44454
+ const processRoutes = async (config, ownerAddress, sufficient, availableRoutingOptions, transactionRequirements, balanceCheckResult, fundingRouteFullAmount, onComplete, onFundingRoute) => {
44455
+ const finalBalanceCheckResult = !fundingRouteFullAmount || (sufficient && onComplete)
44456
+ ? overrideBalanceCheckResult(balanceCheckResult)
44457
44457
  : balanceCheckResult;
44458
44458
  const routingOutcome = await measureAsyncExecution(config, 'Total time to run the routing calculator', routingCalculator(config, ownerAddress, finalBalanceCheckResult, availableRoutingOptions, onFundingRoute));
44459
44459
  onComplete?.({
@@ -44466,7 +44466,7 @@ const processRoutes = async (config, ownerAddress, sufficient, availableRoutingO
44466
44466
  });
44467
44467
  return routingOutcome;
44468
44468
  };
44469
- const smartCheckout = async (config, provider, itemRequirements, transactionOrGasAmount, routingOptions, onComplete, onFundingRoute) => {
44469
+ const smartCheckout = async (config, provider, itemRequirements, transactionOrGasAmount, routingOptions, onComplete, onFundingRoute, fundingRouteFullAmount = false) => {
44470
44470
  const ownerAddress = await provider.getSigner().getAddress();
44471
44471
  let aggregatedItems = itemAggregator(itemRequirements);
44472
44472
  const erc20AllowancePromise = hasERC20Allowances(provider, ownerAddress, aggregatedItems);
@@ -44493,7 +44493,7 @@ const smartCheckout = async (config, provider, itemRequirements, transactionOrGa
44493
44493
  if (routingOptions?.bridge === false)
44494
44494
  availableRoutingOptions.bridge = false;
44495
44495
  if (onComplete) {
44496
- processRoutes(config, ownerAddress, sufficient, availableRoutingOptions, transactionRequirements, balanceCheckResult, onComplete, onFundingRoute);
44496
+ processRoutes(config, ownerAddress, sufficient, availableRoutingOptions, transactionRequirements, balanceCheckResult, fundingRouteFullAmount, onComplete, onFundingRoute);
44497
44497
  return {
44498
44498
  sufficient,
44499
44499
  transactionRequirements,
@@ -44505,7 +44505,7 @@ const smartCheckout = async (config, provider, itemRequirements, transactionOrGa
44505
44505
  transactionRequirements,
44506
44506
  };
44507
44507
  }
44508
- const routingOutcome = await processRoutes(config, ownerAddress, sufficient, availableRoutingOptions, transactionRequirements, balanceCheckResult, onComplete, onFundingRoute);
44508
+ const routingOutcome = await processRoutes(config, ownerAddress, sufficient, availableRoutingOptions, transactionRequirements, balanceCheckResult, fundingRouteFullAmount, onComplete, onFundingRoute);
44509
44509
  return {
44510
44510
  sufficient,
44511
44511
  transactionRequirements,
@@ -45454,7 +45454,8 @@ class Checkout {
45454
45454
  const cdnUrl = getWidgetsEsmUrl(version);
45455
45455
  // WebpackIgnore comment required to prevent webpack modifying the import statement and
45456
45456
  // breaking the dynamic import in certain applications integrating checkout
45457
- const checkoutWidgetsModule = await import(/* webpackIgnore: true */ cdnUrl);
45457
+ const checkoutWidgetsModule = await import(
45458
+ /* webpackIgnore: true */ cdnUrl);
45458
45459
  if (checkoutWidgetsModule && checkoutWidgetsModule.WidgetsFactory) {
45459
45460
  return new checkoutWidgetsModule.WidgetsFactory(checkout, config);
45460
45461
  }
@@ -45501,7 +45502,10 @@ class Checkout {
45501
45502
  * @returns {Promise<CheckConnectionResult>} - A promise that resolves to the result of the check.
45502
45503
  */
45503
45504
  async checkIsWalletConnected(params) {
45504
- const web3Provider = await validateProvider(this.config, params.provider, { allowMistmatchedChainId: true, allowUnsupportedProvider: true });
45505
+ const web3Provider = await validateProvider(this.config, params.provider, {
45506
+ allowMistmatchedChainId: true,
45507
+ allowUnsupportedProvider: true,
45508
+ });
45505
45509
  return checkIsWalletConnected(web3Provider);
45506
45510
  }
45507
45511
  /**
@@ -45515,7 +45519,8 @@ class Checkout {
45515
45519
  allowUnsupportedProvider: true,
45516
45520
  allowMistmatchedChainId: true,
45517
45521
  });
45518
- if (params.requestWalletPermissions && !web3Provider.provider?.isPassport) {
45522
+ if (params.requestWalletPermissions
45523
+ && !web3Provider.provider?.isPassport) {
45519
45524
  await requestPermissions(web3Provider);
45520
45525
  }
45521
45526
  else {
@@ -45625,7 +45630,7 @@ class Checkout {
45625
45630
  /**
45626
45631
  * Determines the requirements for performing a buy.
45627
45632
  * @param {BuyParams} params - The parameters for the buy.
45628
- */
45633
+ */
45629
45634
  async buy(params) {
45630
45635
  if (params.orders.length > 1) {
45631
45636
  // eslint-disable-next-line no-console
@@ -45639,7 +45644,7 @@ class Checkout {
45639
45644
  * @param {SellParams} params - The parameters for the sell.
45640
45645
  * Only currently actions the first order in the array until we support batch processing.
45641
45646
  * Only currently actions the first fee in the fees array of each order until we support multiple fees.
45642
- */
45647
+ */
45643
45648
  async sell(params) {
45644
45649
  if (params.orders.length > 1) {
45645
45650
  // eslint-disable-next-line no-console
@@ -45671,7 +45676,7 @@ class Checkout {
45671
45676
  catch (err) {
45672
45677
  throw new CheckoutError('Failed to map item requirements', CheckoutErrorType.ITEM_REQUIREMENTS_ERROR, { error: err });
45673
45678
  }
45674
- return await smartCheckout(this.config, web3Provider, itemRequirements, params.transactionOrGasAmount, params.routingOptions, params.onComplete, params.onFundingRoute);
45679
+ return await smartCheckout(this.config, web3Provider, itemRequirements, params.transactionOrGasAmount, params.routingOptions, params.onComplete, params.onFundingRoute, params.fundingRouteFullAmount);
45675
45680
  }
45676
45681
  /**
45677
45682
  * Checks if the given object is a Web3 provider.
@@ -45705,13 +45710,17 @@ class Checkout {
45705
45710
  const userInfo = await params.passport.getUserInfo();
45706
45711
  email = userInfo?.email;
45707
45712
  }
45708
- const tokenList = await getTokenAllowList(this.config, { type: TokenFilterTypes.ONRAMP });
45713
+ const tokenList = await getTokenAllowList(this.config, {
45714
+ type: TokenFilterTypes.ONRAMP,
45715
+ });
45709
45716
  const token = tokenList.tokens?.find((t) => isMatchingAddress(t.address, params.tokenAddress));
45710
45717
  if (token) {
45711
45718
  tokenAmount = params.tokenAmount;
45712
45719
  tokenSymbol = token.symbol;
45713
45720
  }
45714
- const allowedTokens = tokenList?.tokens?.filter((t) => t.symbol).map((t) => t.symbol);
45721
+ const allowedTokens = tokenList?.tokens
45722
+ ?.filter((t) => t.symbol)
45723
+ .map((t) => t.symbol);
45715
45724
  return await this.fiatRampService.createWidgetUrl({
45716
45725
  exchangeType: params.exchangeType,
45717
45726
  isPassport,
package/dist/config.js CHANGED
@@ -128,7 +128,7 @@ const flattenProperties = (properties) => {
128
128
  };
129
129
 
130
130
  // WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
131
- const SDK_VERSION = '1.30.0-alpha.1';
131
+ const SDK_VERSION = '1.30.0-alpha.2';
132
132
  const getFrameParentDomain = () => {
133
133
  if (isNode()) {
134
134
  return '';