@imtbl/sdk 0.18.1 → 0.18.3

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.1' };
2728
+ const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.18.3' };
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.1',
2788
+ sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.18.3',
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.1',
3074
+ sdkVersion: 'ts-immutable-sdk-0.18.3',
3075
3075
  });
3076
3076
  /**
3077
3077
  * Sets `sdkVersion` at the time of build
@@ -7559,6 +7559,9 @@ var PassportErrorType;
7559
7559
  PassportErrorType["CREATE_TRADE_ERROR"] = "CREATE_TRADE_ERROR";
7560
7560
  PassportErrorType["OPERATION_NOT_SUPPORTED_ERROR"] = "OPERATION_NOT_SUPPORTED_ERROR";
7561
7561
  })(PassportErrorType || (PassportErrorType = {}));
7562
+ function isAPIError(error) {
7563
+ return 'code' in error && 'message' in error;
7564
+ }
7562
7565
  class PassportError extends Error {
7563
7566
  type;
7564
7567
  constructor(message, type) {
@@ -7571,7 +7574,13 @@ const withPassportError = async (fn, customErrorType) => {
7571
7574
  return await fn();
7572
7575
  }
7573
7576
  catch (error) {
7574
- const errorMessage = `${customErrorType}: ${error.message}` || 'UnknownError';
7577
+ let errorMessage;
7578
+ if (globalAxios$1.isAxiosError(error) && error.response?.data && isAPIError(error.response.data)) {
7579
+ errorMessage = error.response.data.message;
7580
+ }
7581
+ else {
7582
+ errorMessage = error.message;
7583
+ }
7575
7584
  throw new PassportError(errorMessage, customErrorType);
7576
7585
  }
7577
7586
  };
@@ -7638,6 +7647,8 @@ const formUrlEncodedHeader = {
7638
7647
  },
7639
7648
  };
7640
7649
  const getAuthConfiguration = ({ oidcConfiguration, authenticationDomain, }) => {
7650
+ const store = typeof window !== 'undefined' ? window.localStorage : new oidcClientTs.InMemoryWebStorage();
7651
+ const userStore = new oidcClientTs.WebStorageStateStore({ store });
7641
7652
  const baseConfiguration = {
7642
7653
  authority: authenticationDomain,
7643
7654
  redirect_uri: oidcConfiguration.redirectUri,
@@ -7654,7 +7665,7 @@ const getAuthConfiguration = ({ oidcConfiguration, authenticationDomain, }) => {
7654
7665
  mergeClaims: true,
7655
7666
  loadUserInfo: true,
7656
7667
  scope: oidcConfiguration.scope,
7657
- userStore: new oidcClientTs.WebStorageStateStore({ store: window.localStorage }),
7668
+ userStore,
7658
7669
  };
7659
7670
  if (oidcConfiguration.audience) {
7660
7671
  baseConfiguration.extraQueryParams = {
@@ -8879,7 +8890,7 @@ class ConfirmationScreen {
8879
8890
  let href = '';
8880
8891
  if (chainType === TransactionApprovalRequestChainTypeEnum.Starkex) {
8881
8892
  // eslint-disable-next-line max-len
8882
- href = `${this.config.passportDomain}/transaction-confirmation/transaction.html?transactionId=${transactionId}&imxEtherAddress=${imxEtherAddress}&chainType=starkex`;
8893
+ href = `${this.config.passportDomain}/transaction-confirmation/transaction?transactionId=${transactionId}&imxEtherAddress=${imxEtherAddress}&chainType=starkex`;
8883
8894
  }
8884
8895
  else {
8885
8896
  // eslint-disable-next-line max-len
@@ -8926,7 +8937,7 @@ class ConfirmationScreen {
8926
8937
  return;
8927
8938
  }
8928
8939
  this.confirmationWindow = openPopupCenter({
8929
- url: `${this.config.passportDomain}/transaction-confirmation/loading.html`,
8940
+ url: `${this.config.passportDomain}/transaction-confirmation/loading`,
8930
8941
  title: CONFIRMATION_WINDOW_TITLE,
8931
8942
  width: popupOptions?.width || CONFIRMATION_WINDOW_WIDTH,
8932
8943
  height: popupOptions?.height || CONFIRMATION_WINDOW_HEIGHT,
@@ -30317,6 +30328,34 @@ const $91807edfd7057288$export$8e03ea04d59f2402 = async (config, availableRoutin
30317
30328
 
30318
30329
 
30319
30330
 
30331
+
30332
+
30333
+
30334
+ const $5649bc8af91da370$export$1fb2bd867f4a9be3 = async (config, availableRoutingOptions, balanceRequirement)=>{
30335
+ if (balanceRequirement.type !== ($4b58188d47aafe8d$export$1fc8f52ad1810e52).ERC20 && balanceRequirement.type !== ($4b58188d47aafe8d$export$1fc8f52ad1810e52).NATIVE) return undefined;
30336
+ const requiredBalance = balanceRequirement.required;
30337
+ let hasAllowList = false;
30338
+ const onRampProvidersAllowList = await ($5a5ccedc98d53d25$export$9ec9fc71f3ce62c4)(config, availableRoutingOptions);
30339
+ Object.values(onRampProvidersAllowList).forEach((onRampAllowList)=>{
30340
+ if (onRampAllowList.length > 0 && !hasAllowList) hasAllowList = !!onRampAllowList.find((token)=>token.address === requiredBalance.token?.address);
30341
+ });
30342
+ if (!hasAllowList) return undefined;
30343
+ return {
30344
+ type: ($4b58188d47aafe8d$export$3af78bb3e8650ee6).ONRAMP,
30345
+ chainId: ($4013c5c91bb535f6$export$c9af4e4b001c6476)(config),
30346
+ asset: {
30347
+ balance: requiredBalance.balance,
30348
+ formattedBalance: requiredBalance.formattedBalance,
30349
+ token: {
30350
+ ...requiredBalance.token
30351
+ }
30352
+ }
30353
+ };
30354
+ };
30355
+
30356
+
30357
+
30358
+
30320
30359
  const $c16168a9c28ae4fd$export$31ce7ba1a2956195 = (balanceRequirements)=>{
30321
30360
  let insufficientBalanceCount = 0;
30322
30361
  let insufficientRequirement;
@@ -30340,6 +30379,12 @@ const $c16168a9c28ae4fd$export$c39a7b7dc167cdb4 = async (config, availableRoutin
30340
30379
  const swapFundingStep = await ($91807edfd7057288$export$8e03ea04d59f2402)(config, availableRoutingOptions, dexQuoteCache, ownerAddress, insufficientRequirement, tokenBalances, swappableTokens);
30341
30380
  return swapFundingStep;
30342
30381
  };
30382
+ const $c16168a9c28ae4fd$export$e1b6e4d22d0365ee = async (config, availableRoutingOptions, insufficientRequirement)=>{
30383
+ if (!availableRoutingOptions.onRamp) return undefined;
30384
+ if (insufficientRequirement === undefined) return undefined;
30385
+ const onRampFundingStep = await ($5649bc8af91da370$export$1fb2bd867f4a9be3)(config, availableRoutingOptions, insufficientRequirement);
30386
+ return onRampFundingStep;
30387
+ };
30343
30388
  const $c16168a9c28ae4fd$export$92606e71d0a264ff = async (config, ownerAddress, balanceRequirements, availableRoutingOptions)=>{
30344
30389
  let readOnlyProviders;
30345
30390
  try {
@@ -30360,7 +30405,7 @@ const $c16168a9c28ae4fd$export$92606e71d0a264ff = async (config, ownerAddress, b
30360
30405
  let bridgeFundingStep;
30361
30406
  if (availableRoutingOptions.bridge && insufficientRequirement) bridgeFundingStep = await ($fa9ac5bfdbbf9dfa$export$ddc7ba2b57d7c5fa)(config, readOnlyProviders, ownerAddress, availableRoutingOptions, insufficientRequirement, tokenBalances, feeEstimates);
30362
30407
  const swapFundingStep = await $c16168a9c28ae4fd$export$c39a7b7dc167cdb4(config, availableRoutingOptions, insufficientRequirement, dexQuoteCache, ownerAddress, tokenBalances, allowList.swap);
30363
- // Check on-ramp routes
30408
+ const onRampFundingStep = await $c16168a9c28ae4fd$export$e1b6e4d22d0365ee(config, availableRoutingOptions, insufficientRequirement);
30364
30409
  // Check swap routes
30365
30410
  // > Could bridge first
30366
30411
  // > Could on-ramp first
@@ -30373,7 +30418,7 @@ const $c16168a9c28ae4fd$export$92606e71d0a264ff = async (config, ownerAddress, b
30373
30418
  fundingRoutes: []
30374
30419
  };
30375
30420
  let priority = 0;
30376
- if (bridgeFundingStep || swapFundingStep) {
30421
+ if (bridgeFundingStep || swapFundingStep || onRampFundingStep) {
30377
30422
  response.response.type = ($b23305044c0e096a$export$3057de18ac0c076).ROUTES_FOUND;
30378
30423
  response.response.message = "Routes found";
30379
30424
  }
@@ -30395,6 +30440,15 @@ const $c16168a9c28ae4fd$export$92606e71d0a264ff = async (config, ownerAddress, b
30395
30440
  ]
30396
30441
  });
30397
30442
  }
30443
+ if (onRampFundingStep) {
30444
+ priority++;
30445
+ response.fundingRoutes.push({
30446
+ priority: priority,
30447
+ steps: [
30448
+ onRampFundingStep
30449
+ ]
30450
+ });
30451
+ }
30398
30452
  return response;
30399
30453
  };
30400
30454
 
@@ -31173,7 +31227,7 @@ var checkout_sdk = /*#__PURE__*/Object.freeze({
31173
31227
  function $parcel$export(e, n, v, s) {
31174
31228
  Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
31175
31229
  }
31176
- const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.18.1";
31230
+ const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.18.3";
31177
31231
  const $d663162fd5a0853f$export$83bf90b30cdfd29f = ()=>false;
31178
31232
  const $d663162fd5a0853f$export$1169f5475725171b = ()=>$d663162fd5a0853f$export$38a083d9fb5551ca;
31179
31233
 
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
- import globalAxios$1, { HttpStatusCode as HttpStatusCode$2 } from 'axios';
1
+ import globalAxios$1, { isAxiosError as isAxiosError$1, HttpStatusCode as HttpStatusCode$2 } from 'axios';
2
2
  import { ImmutableX, Config, IMXError, createStarkSigner, generateLegacyStarkPrivateKey, TransfersApi, OrdersApi as OrdersApi$1, UsersApi, Contracts, TradesApi, ExchangesApi, WithdrawalsApi, MintsApi, DepositsApi, EncodingApi, TokensApi as TokensApi$1 } from '@imtbl/core-sdk';
3
- import { UserManager, WebStorageStateStore } from 'oidc-client-ts';
3
+ import { UserManager, InMemoryWebStorage, WebStorageStateStore } from 'oidc-client-ts';
4
4
  import jwt_decode from 'jwt-decode';
5
5
  import * as crypto from 'crypto';
6
6
  import { Magic } from 'magic-sdk';
@@ -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.1' };
2706
+ const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.18.3' };
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.1',
2766
+ sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.18.3',
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.1',
3052
+ sdkVersion: 'ts-immutable-sdk-0.18.3',
3053
3053
  });
3054
3054
  /**
3055
3055
  * Sets `sdkVersion` at the time of build
@@ -7537,6 +7537,9 @@ var PassportErrorType;
7537
7537
  PassportErrorType["CREATE_TRADE_ERROR"] = "CREATE_TRADE_ERROR";
7538
7538
  PassportErrorType["OPERATION_NOT_SUPPORTED_ERROR"] = "OPERATION_NOT_SUPPORTED_ERROR";
7539
7539
  })(PassportErrorType || (PassportErrorType = {}));
7540
+ function isAPIError(error) {
7541
+ return 'code' in error && 'message' in error;
7542
+ }
7540
7543
  class PassportError extends Error {
7541
7544
  type;
7542
7545
  constructor(message, type) {
@@ -7549,7 +7552,13 @@ const withPassportError = async (fn, customErrorType) => {
7549
7552
  return await fn();
7550
7553
  }
7551
7554
  catch (error) {
7552
- const errorMessage = `${customErrorType}: ${error.message}` || 'UnknownError';
7555
+ let errorMessage;
7556
+ if (isAxiosError$1(error) && error.response?.data && isAPIError(error.response.data)) {
7557
+ errorMessage = error.response.data.message;
7558
+ }
7559
+ else {
7560
+ errorMessage = error.message;
7561
+ }
7553
7562
  throw new PassportError(errorMessage, customErrorType);
7554
7563
  }
7555
7564
  };
@@ -7616,6 +7625,8 @@ const formUrlEncodedHeader = {
7616
7625
  },
7617
7626
  };
7618
7627
  const getAuthConfiguration = ({ oidcConfiguration, authenticationDomain, }) => {
7628
+ const store = typeof window !== 'undefined' ? window.localStorage : new InMemoryWebStorage();
7629
+ const userStore = new WebStorageStateStore({ store });
7619
7630
  const baseConfiguration = {
7620
7631
  authority: authenticationDomain,
7621
7632
  redirect_uri: oidcConfiguration.redirectUri,
@@ -7632,7 +7643,7 @@ const getAuthConfiguration = ({ oidcConfiguration, authenticationDomain, }) => {
7632
7643
  mergeClaims: true,
7633
7644
  loadUserInfo: true,
7634
7645
  scope: oidcConfiguration.scope,
7635
- userStore: new WebStorageStateStore({ store: window.localStorage }),
7646
+ userStore,
7636
7647
  };
7637
7648
  if (oidcConfiguration.audience) {
7638
7649
  baseConfiguration.extraQueryParams = {
@@ -8857,7 +8868,7 @@ class ConfirmationScreen {
8857
8868
  let href = '';
8858
8869
  if (chainType === TransactionApprovalRequestChainTypeEnum.Starkex) {
8859
8870
  // eslint-disable-next-line max-len
8860
- href = `${this.config.passportDomain}/transaction-confirmation/transaction.html?transactionId=${transactionId}&imxEtherAddress=${imxEtherAddress}&chainType=starkex`;
8871
+ href = `${this.config.passportDomain}/transaction-confirmation/transaction?transactionId=${transactionId}&imxEtherAddress=${imxEtherAddress}&chainType=starkex`;
8861
8872
  }
8862
8873
  else {
8863
8874
  // eslint-disable-next-line max-len
@@ -8904,7 +8915,7 @@ class ConfirmationScreen {
8904
8915
  return;
8905
8916
  }
8906
8917
  this.confirmationWindow = openPopupCenter({
8907
- url: `${this.config.passportDomain}/transaction-confirmation/loading.html`,
8918
+ url: `${this.config.passportDomain}/transaction-confirmation/loading`,
8908
8919
  title: CONFIRMATION_WINDOW_TITLE,
8909
8920
  width: popupOptions?.width || CONFIRMATION_WINDOW_WIDTH,
8910
8921
  height: popupOptions?.height || CONFIRMATION_WINDOW_HEIGHT,
@@ -30295,6 +30306,34 @@ const $91807edfd7057288$export$8e03ea04d59f2402 = async (config, availableRoutin
30295
30306
 
30296
30307
 
30297
30308
 
30309
+
30310
+
30311
+
30312
+ const $5649bc8af91da370$export$1fb2bd867f4a9be3 = async (config, availableRoutingOptions, balanceRequirement)=>{
30313
+ if (balanceRequirement.type !== ($4b58188d47aafe8d$export$1fc8f52ad1810e52).ERC20 && balanceRequirement.type !== ($4b58188d47aafe8d$export$1fc8f52ad1810e52).NATIVE) return undefined;
30314
+ const requiredBalance = balanceRequirement.required;
30315
+ let hasAllowList = false;
30316
+ const onRampProvidersAllowList = await ($5a5ccedc98d53d25$export$9ec9fc71f3ce62c4)(config, availableRoutingOptions);
30317
+ Object.values(onRampProvidersAllowList).forEach((onRampAllowList)=>{
30318
+ if (onRampAllowList.length > 0 && !hasAllowList) hasAllowList = !!onRampAllowList.find((token)=>token.address === requiredBalance.token?.address);
30319
+ });
30320
+ if (!hasAllowList) return undefined;
30321
+ return {
30322
+ type: ($4b58188d47aafe8d$export$3af78bb3e8650ee6).ONRAMP,
30323
+ chainId: ($4013c5c91bb535f6$export$c9af4e4b001c6476)(config),
30324
+ asset: {
30325
+ balance: requiredBalance.balance,
30326
+ formattedBalance: requiredBalance.formattedBalance,
30327
+ token: {
30328
+ ...requiredBalance.token
30329
+ }
30330
+ }
30331
+ };
30332
+ };
30333
+
30334
+
30335
+
30336
+
30298
30337
  const $c16168a9c28ae4fd$export$31ce7ba1a2956195 = (balanceRequirements)=>{
30299
30338
  let insufficientBalanceCount = 0;
30300
30339
  let insufficientRequirement;
@@ -30318,6 +30357,12 @@ const $c16168a9c28ae4fd$export$c39a7b7dc167cdb4 = async (config, availableRoutin
30318
30357
  const swapFundingStep = await ($91807edfd7057288$export$8e03ea04d59f2402)(config, availableRoutingOptions, dexQuoteCache, ownerAddress, insufficientRequirement, tokenBalances, swappableTokens);
30319
30358
  return swapFundingStep;
30320
30359
  };
30360
+ const $c16168a9c28ae4fd$export$e1b6e4d22d0365ee = async (config, availableRoutingOptions, insufficientRequirement)=>{
30361
+ if (!availableRoutingOptions.onRamp) return undefined;
30362
+ if (insufficientRequirement === undefined) return undefined;
30363
+ const onRampFundingStep = await ($5649bc8af91da370$export$1fb2bd867f4a9be3)(config, availableRoutingOptions, insufficientRequirement);
30364
+ return onRampFundingStep;
30365
+ };
30321
30366
  const $c16168a9c28ae4fd$export$92606e71d0a264ff = async (config, ownerAddress, balanceRequirements, availableRoutingOptions)=>{
30322
30367
  let readOnlyProviders;
30323
30368
  try {
@@ -30338,7 +30383,7 @@ const $c16168a9c28ae4fd$export$92606e71d0a264ff = async (config, ownerAddress, b
30338
30383
  let bridgeFundingStep;
30339
30384
  if (availableRoutingOptions.bridge && insufficientRequirement) bridgeFundingStep = await ($fa9ac5bfdbbf9dfa$export$ddc7ba2b57d7c5fa)(config, readOnlyProviders, ownerAddress, availableRoutingOptions, insufficientRequirement, tokenBalances, feeEstimates);
30340
30385
  const swapFundingStep = await $c16168a9c28ae4fd$export$c39a7b7dc167cdb4(config, availableRoutingOptions, insufficientRequirement, dexQuoteCache, ownerAddress, tokenBalances, allowList.swap);
30341
- // Check on-ramp routes
30386
+ const onRampFundingStep = await $c16168a9c28ae4fd$export$e1b6e4d22d0365ee(config, availableRoutingOptions, insufficientRequirement);
30342
30387
  // Check swap routes
30343
30388
  // > Could bridge first
30344
30389
  // > Could on-ramp first
@@ -30351,7 +30396,7 @@ const $c16168a9c28ae4fd$export$92606e71d0a264ff = async (config, ownerAddress, b
30351
30396
  fundingRoutes: []
30352
30397
  };
30353
30398
  let priority = 0;
30354
- if (bridgeFundingStep || swapFundingStep) {
30399
+ if (bridgeFundingStep || swapFundingStep || onRampFundingStep) {
30355
30400
  response.response.type = ($b23305044c0e096a$export$3057de18ac0c076).ROUTES_FOUND;
30356
30401
  response.response.message = "Routes found";
30357
30402
  }
@@ -30373,6 +30418,15 @@ const $c16168a9c28ae4fd$export$92606e71d0a264ff = async (config, ownerAddress, b
30373
30418
  ]
30374
30419
  });
30375
30420
  }
30421
+ if (onRampFundingStep) {
30422
+ priority++;
30423
+ response.fundingRoutes.push({
30424
+ priority: priority,
30425
+ steps: [
30426
+ onRampFundingStep
30427
+ ]
30428
+ });
30429
+ }
30376
30430
  return response;
30377
30431
  };
30378
30432
 
@@ -31151,7 +31205,7 @@ var checkout_sdk = /*#__PURE__*/Object.freeze({
31151
31205
  function $parcel$export(e, n, v, s) {
31152
31206
  Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
31153
31207
  }
31154
- const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.18.1";
31208
+ const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.18.3";
31155
31209
  const $d663162fd5a0853f$export$83bf90b30cdfd29f = ()=>false;
31156
31210
  const $d663162fd5a0853f$export$1169f5475725171b = ()=>$d663162fd5a0853f$export$38a083d9fb5551ca;
31157
31211
 
package/dist/passport.js CHANGED
@@ -1,6 +1,6 @@
1
- import globalAxios$1 from 'axios';
1
+ import globalAxios$1, { isAxiosError as isAxiosError$1 } from 'axios';
2
2
  import { ImmutableX, Config, generateLegacyStarkPrivateKey, createStarkSigner } from '@imtbl/core-sdk';
3
- import { UserManager, WebStorageStateStore } from 'oidc-client-ts';
3
+ import { UserManager, InMemoryWebStorage, WebStorageStateStore } from 'oidc-client-ts';
4
4
  import jwt_decode from 'jwt-decode';
5
5
  import * as crypto from 'crypto';
6
6
  import { Magic } from 'magic-sdk';
@@ -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.1' };
1712
+ const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-0.18.3' };
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.1',
1768
+ sdkVersion: 'ts-immutable-sdk-0.18.3',
1769
1769
  });
1770
1770
  /**
1771
1771
  * Sets `sdkVersion` at the time of build
@@ -6236,6 +6236,9 @@ var PassportErrorType;
6236
6236
  PassportErrorType["CREATE_TRADE_ERROR"] = "CREATE_TRADE_ERROR";
6237
6237
  PassportErrorType["OPERATION_NOT_SUPPORTED_ERROR"] = "OPERATION_NOT_SUPPORTED_ERROR";
6238
6238
  })(PassportErrorType || (PassportErrorType = {}));
6239
+ function isAPIError(error) {
6240
+ return 'code' in error && 'message' in error;
6241
+ }
6239
6242
  class PassportError extends Error {
6240
6243
  type;
6241
6244
  constructor(message, type) {
@@ -6248,7 +6251,13 @@ const withPassportError = async (fn, customErrorType) => {
6248
6251
  return await fn();
6249
6252
  }
6250
6253
  catch (error) {
6251
- const errorMessage = `${customErrorType}: ${error.message}` || 'UnknownError';
6254
+ let errorMessage;
6255
+ if (isAxiosError$1(error) && error.response?.data && isAPIError(error.response.data)) {
6256
+ errorMessage = error.response.data.message;
6257
+ }
6258
+ else {
6259
+ errorMessage = error.message;
6260
+ }
6252
6261
  throw new PassportError(errorMessage, customErrorType);
6253
6262
  }
6254
6263
  };
@@ -6315,6 +6324,8 @@ const formUrlEncodedHeader = {
6315
6324
  },
6316
6325
  };
6317
6326
  const getAuthConfiguration = ({ oidcConfiguration, authenticationDomain, }) => {
6327
+ const store = typeof window !== 'undefined' ? window.localStorage : new InMemoryWebStorage();
6328
+ const userStore = new WebStorageStateStore({ store });
6318
6329
  const baseConfiguration = {
6319
6330
  authority: authenticationDomain,
6320
6331
  redirect_uri: oidcConfiguration.redirectUri,
@@ -6331,7 +6342,7 @@ const getAuthConfiguration = ({ oidcConfiguration, authenticationDomain, }) => {
6331
6342
  mergeClaims: true,
6332
6343
  loadUserInfo: true,
6333
6344
  scope: oidcConfiguration.scope,
6334
- userStore: new WebStorageStateStore({ store: window.localStorage }),
6345
+ userStore,
6335
6346
  };
6336
6347
  if (oidcConfiguration.audience) {
6337
6348
  baseConfiguration.extraQueryParams = {
@@ -7556,7 +7567,7 @@ class ConfirmationScreen {
7556
7567
  let href = '';
7557
7568
  if (chainType === TransactionApprovalRequestChainTypeEnum.Starkex) {
7558
7569
  // eslint-disable-next-line max-len
7559
- href = `${this.config.passportDomain}/transaction-confirmation/transaction.html?transactionId=${transactionId}&imxEtherAddress=${imxEtherAddress}&chainType=starkex`;
7570
+ href = `${this.config.passportDomain}/transaction-confirmation/transaction?transactionId=${transactionId}&imxEtherAddress=${imxEtherAddress}&chainType=starkex`;
7560
7571
  }
7561
7572
  else {
7562
7573
  // eslint-disable-next-line max-len
@@ -7603,7 +7614,7 @@ class ConfirmationScreen {
7603
7614
  return;
7604
7615
  }
7605
7616
  this.confirmationWindow = openPopupCenter({
7606
- url: `${this.config.passportDomain}/transaction-confirmation/loading.html`,
7617
+ url: `${this.config.passportDomain}/transaction-confirmation/loading`,
7607
7618
  title: CONFIRMATION_WINDOW_TITLE,
7608
7619
  width: popupOptions?.width || CONFIRMATION_WINDOW_WIDTH,
7609
7620
  height: popupOptions?.height || CONFIRMATION_WINDOW_HEIGHT,
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.1",
4
+ "version": "0.18.3",
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",