@imtbl/sdk 0.39.2 → 0.39.4

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
@@ -4256,7 +4256,7 @@ class MultiRollupApiClients {
4256
4256
  }
4257
4257
 
4258
4258
  // eslint-disable-next-line @typescript-eslint/naming-convention
4259
- const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.39.2' };
4259
+ const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.39.4' };
4260
4260
  const createConfig = ({ basePath, headers, }) => {
4261
4261
  if (!basePath.trim()) {
4262
4262
  throw Error('basePath can not be empty');
@@ -4316,7 +4316,7 @@ class APIError extends Error {
4316
4316
 
4317
4317
  /* eslint-disable implicit-arrow-linebreak */
4318
4318
  const defaultHeaders = {
4319
- sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.39.2',
4319
+ sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.39.4',
4320
4320
  };
4321
4321
  /**
4322
4322
  * createAPIConfiguration to create a custom Configuration
@@ -4755,7 +4755,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
4755
4755
  chainID,
4756
4756
  coreContractAddress,
4757
4757
  registrationContractAddress,
4758
- sdkVersion: 'ts-immutable-sdk-0.39.2',
4758
+ sdkVersion: 'ts-immutable-sdk-0.39.4',
4759
4759
  });
4760
4760
  /**
4761
4761
  * Sets `sdkVersion` at the time of build
@@ -30951,7 +30951,7 @@ const SUPPORTED_SANDBOX_BRIDGES = [ETH_SEPOLIA_TO_ZKEVM_DEVNET, ETH_SEPOLIA_TO_Z
30951
30951
  /**
30952
30952
  * @constant {BridgeInstance[]} SUPPORTED_PRODUCTION_BRIDGES - An array of supported bridge instances for the production environment.
30953
30953
  */
30954
- const SUPPORTED_PRODUCTION_BRIDGES = [];
30954
+ const SUPPORTED_PRODUCTION_BRIDGES = [ETH_MAINNET_TO_ZKEVM_MAINNET];
30955
30955
  /**
30956
30956
  * @constant {Object} SUPPORTED_BRIDGES_FOR_ENVIRONMENT - An object mapping environment types to their supported bridge instances.
30957
30957
  */
@@ -33685,7 +33685,7 @@ class Router {
33685
33685
  return await this.getBestQuoteFromRoutes(routes, amountSpecified, tradeType);
33686
33686
  }
33687
33687
  async getBestQuoteFromRoutes(routes, amountSpecified, tradeType) {
33688
- const quotes = await getQuotesForRoutes(this.provider, this.routingContracts.quoterV2, routes, amountSpecified, tradeType);
33688
+ const quotes = await getQuotesForRoutes(this.provider, this.routingContracts.quoter, routes, amountSpecified, tradeType);
33689
33689
  if (quotes.length === 0) {
33690
33690
  throw new NoRoutesAvailableError();
33691
33691
  }
@@ -34326,10 +34326,10 @@ function adjustQuoteWithFees(ourQuote, amountSpecified, fees, nativeTokenService
34326
34326
 
34327
34327
  const CONTRACTS_FOR_CHAIN_ID = {
34328
34328
  [IMMUTABLE_TESTNET_CHAIN_ID]: {
34329
- multicall: '0x4DB567A44451b27C1fAd7f52e1cDf64b915d62f9',
34330
- coreFactory: '0xb18c44b211065E69844FbA9AE146DA362104AfBf',
34331
- quoterV2: '0x87854A7D4b9BaC3D37f4516A1Ac7F36fB5ad539f',
34332
- peripheryRouter: '0x786ec643F231960D4C1A4E336990F8E7bF8f1277',
34329
+ multicall: '0x4857Dfd11c712e862eC362cEee29F7974B70EfcD',
34330
+ coreFactory: '0x56c2162254b0E4417288786eE402c2B41d4e181e',
34331
+ quoter: '0xF6Ad3CcF71Abb3E12beCf6b3D2a74C963859ADCd',
34332
+ swapRouter: '0x0b012055F770AE7BB7a8303968A7Fb6088A2296e',
34333
34333
  immutableSwapProxy: '0xDdBDa144cEbe1cCd68E746CDff8a6e4Be51A9e98',
34334
34334
  },
34335
34335
  };
@@ -34438,7 +34438,7 @@ class Exchange {
34438
34438
  this.wrappedNativeToken = config.chain.wrappedNativeToken;
34439
34439
  this.nativeTokenService = new NativeTokenService(this.nativeToken, this.wrappedNativeToken);
34440
34440
  this.secondaryFees = config.secondaryFees;
34441
- this.routerContractAddress = config.chain.contracts.peripheryRouter;
34441
+ this.routerContractAddress = config.chain.contracts.swapRouter;
34442
34442
  this.swapProxyContractAddress = config.chain.contracts.immutableSwapProxy;
34443
34443
  this.provider = new ethers.ethers.providers.StaticJsonRpcProvider({
34444
34444
  url: config.chain.rpcUrl,
@@ -35482,7 +35482,7 @@ const GAS_OVERRIDES = {
35482
35482
  maxPriorityFeePerGas: ethers.BigNumber.from(101e9),
35483
35483
  };
35484
35484
 
35485
- const SDK_VERSION_MARKER = '0.39.2';
35485
+ const SDK_VERSION_MARKER = '0.39.4';
35486
35486
  // This SDK version is replaced by the `yarn build` command ran on the root level
35487
35487
  const globalPackageVersion = () => SDK_VERSION_MARKER;
35488
35488
 
@@ -35521,7 +35521,13 @@ class RemoteConfigFetcher {
35521
35521
  async loadConfig() {
35522
35522
  if (this.configCache)
35523
35523
  return this.configCache;
35524
- const response = await this.httpClient.get(`${this.getEndpoint()}/${this.version}/config`);
35524
+ let response;
35525
+ try {
35526
+ response = await this.httpClient.get(`${this.getEndpoint()}/${this.version}/config`);
35527
+ }
35528
+ catch (err) {
35529
+ throw new CheckoutError(`Error: ${err.message}`, CheckoutErrorType.API_ERROR);
35530
+ }
35525
35531
  // Ensure that the configuration is valid
35526
35532
  this.configCache = this.parseResponse(response);
35527
35533
  return this.configCache;
@@ -35529,7 +35535,13 @@ class RemoteConfigFetcher {
35529
35535
  async loadConfigTokens() {
35530
35536
  if (this.tokensCache)
35531
35537
  return this.tokensCache;
35532
- const response = await this.httpClient.get(`${this.getEndpoint()}/${this.version}/config/tokens`);
35538
+ let response;
35539
+ try {
35540
+ response = await this.httpClient.get(`${this.getEndpoint()}/${this.version}/config/tokens`);
35541
+ }
35542
+ catch (err) {
35543
+ throw new CheckoutError(`Error: ${err.message}`, CheckoutErrorType.API_ERROR);
35544
+ }
35533
35545
  // Ensure that the configuration is valid
35534
35546
  this.tokensCache = this.parseResponse(response);
35535
35547
  return this.tokensCache;
@@ -35736,13 +35748,7 @@ class Blockscout {
35736
35748
  const cached = this.getCache(url);
35737
35749
  if (cached)
35738
35750
  return Promise.resolve(cached);
35739
- const response = await this.httpClient.get(url);
35740
- if (response.status >= 400) {
35741
- return Promise.reject({
35742
- code: response.status,
35743
- message: response.statusText,
35744
- });
35745
- }
35751
+ const response = await this.httpClient.get(url); // success if 2XX response otherwise throw error
35746
35752
  // To get around an issue with native tokens being an ERC-20, there is the need
35747
35753
  // to remove IMX from `resp` and add it back in using getNativeTokenByWalletAddress.
35748
35754
  // This has affected some of the early wallets, and it might not be an issue in mainnet
@@ -35777,13 +35783,7 @@ class Blockscout {
35777
35783
  const cached = this.getCache(url);
35778
35784
  if (cached)
35779
35785
  return Promise.resolve(cached);
35780
- const response = await this.httpClient.get(url);
35781
- if (response.status >= 400) {
35782
- return Promise.reject({
35783
- code: response.status,
35784
- message: response.statusText,
35785
- });
35786
- }
35786
+ const response = await this.httpClient.get(url); // success if 2XX response otherwise throw error
35787
35787
  const data = {
35788
35788
  token: this.nativeToken,
35789
35789
  value: response.data.coin_balance,
@@ -39028,22 +39028,8 @@ class HttpClient {
39028
39028
  return config;
39029
39029
  }, (error) => Promise.reject(error));
39030
39030
  }
39031
- // eslint-disable-next-line class-methods-use-this
39032
- processResponse(response) {
39033
- if (response && response?.status !== 200) {
39034
- throw new CheckoutError(`Error: ${response.status} ${response.statusText}`, CheckoutErrorType.API_ERROR);
39035
- }
39036
- }
39037
39031
  async request(config) {
39038
- let response;
39039
- try {
39040
- response = await this.axiosInstance.request(config);
39041
- }
39042
- catch (error) {
39043
- throw new CheckoutError(error.message, CheckoutErrorType.API_ERROR);
39044
- }
39045
- this.processResponse(response);
39046
- return response;
39032
+ return await this.axiosInstance.request(config);
39047
39033
  }
39048
39034
  async get(url, config) {
39049
39035
  const requestConfig = {
package/dist/index.d.ts CHANGED
@@ -17759,8 +17759,8 @@ interface CancelParams {
17759
17759
  type ExchangeContracts = {
17760
17760
  multicall: string;
17761
17761
  coreFactory: string;
17762
- quoterV2: string;
17763
- peripheryRouter: string;
17762
+ quoter: string;
17763
+ swapRouter: string;
17764
17764
  immutableSwapProxy: string;
17765
17765
  };
17766
17766
  /**
@@ -18361,7 +18361,6 @@ declare class HttpClient {
18361
18361
  constructor(config?: CheckoutModuleConfiguration);
18362
18362
  private shouldAddPublishableKey;
18363
18363
  private setupInterceptors;
18364
- private processResponse;
18365
18364
  request(config: AxiosRequestConfig$1): Promise<AxiosResponse$1<any, any>>;
18366
18365
  get(url: string, config?: AxiosRequestConfig$1): Promise<AxiosResponse$1<any, any>>;
18367
18366
  post(url: string, data?: any, config?: AxiosRequestConfig$1): Promise<AxiosResponse$1<any, any>>;
package/dist/index.js CHANGED
@@ -4234,7 +4234,7 @@ class MultiRollupApiClients {
4234
4234
  }
4235
4235
 
4236
4236
  // eslint-disable-next-line @typescript-eslint/naming-convention
4237
- const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.39.2' };
4237
+ const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.39.4' };
4238
4238
  const createConfig = ({ basePath, headers, }) => {
4239
4239
  if (!basePath.trim()) {
4240
4240
  throw Error('basePath can not be empty');
@@ -4294,7 +4294,7 @@ class APIError extends Error {
4294
4294
 
4295
4295
  /* eslint-disable implicit-arrow-linebreak */
4296
4296
  const defaultHeaders = {
4297
- sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.39.2',
4297
+ sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.39.4',
4298
4298
  };
4299
4299
  /**
4300
4300
  * createAPIConfiguration to create a custom Configuration
@@ -4733,7 +4733,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
4733
4733
  chainID,
4734
4734
  coreContractAddress,
4735
4735
  registrationContractAddress,
4736
- sdkVersion: 'ts-immutable-sdk-0.39.2',
4736
+ sdkVersion: 'ts-immutable-sdk-0.39.4',
4737
4737
  });
4738
4738
  /**
4739
4739
  * Sets `sdkVersion` at the time of build
@@ -30929,7 +30929,7 @@ const SUPPORTED_SANDBOX_BRIDGES = [ETH_SEPOLIA_TO_ZKEVM_DEVNET, ETH_SEPOLIA_TO_Z
30929
30929
  /**
30930
30930
  * @constant {BridgeInstance[]} SUPPORTED_PRODUCTION_BRIDGES - An array of supported bridge instances for the production environment.
30931
30931
  */
30932
- const SUPPORTED_PRODUCTION_BRIDGES = [];
30932
+ const SUPPORTED_PRODUCTION_BRIDGES = [ETH_MAINNET_TO_ZKEVM_MAINNET];
30933
30933
  /**
30934
30934
  * @constant {Object} SUPPORTED_BRIDGES_FOR_ENVIRONMENT - An object mapping environment types to their supported bridge instances.
30935
30935
  */
@@ -33663,7 +33663,7 @@ class Router {
33663
33663
  return await this.getBestQuoteFromRoutes(routes, amountSpecified, tradeType);
33664
33664
  }
33665
33665
  async getBestQuoteFromRoutes(routes, amountSpecified, tradeType) {
33666
- const quotes = await getQuotesForRoutes(this.provider, this.routingContracts.quoterV2, routes, amountSpecified, tradeType);
33666
+ const quotes = await getQuotesForRoutes(this.provider, this.routingContracts.quoter, routes, amountSpecified, tradeType);
33667
33667
  if (quotes.length === 0) {
33668
33668
  throw new NoRoutesAvailableError();
33669
33669
  }
@@ -34304,10 +34304,10 @@ function adjustQuoteWithFees(ourQuote, amountSpecified, fees, nativeTokenService
34304
34304
 
34305
34305
  const CONTRACTS_FOR_CHAIN_ID = {
34306
34306
  [IMMUTABLE_TESTNET_CHAIN_ID]: {
34307
- multicall: '0x4DB567A44451b27C1fAd7f52e1cDf64b915d62f9',
34308
- coreFactory: '0xb18c44b211065E69844FbA9AE146DA362104AfBf',
34309
- quoterV2: '0x87854A7D4b9BaC3D37f4516A1Ac7F36fB5ad539f',
34310
- peripheryRouter: '0x786ec643F231960D4C1A4E336990F8E7bF8f1277',
34307
+ multicall: '0x4857Dfd11c712e862eC362cEee29F7974B70EfcD',
34308
+ coreFactory: '0x56c2162254b0E4417288786eE402c2B41d4e181e',
34309
+ quoter: '0xF6Ad3CcF71Abb3E12beCf6b3D2a74C963859ADCd',
34310
+ swapRouter: '0x0b012055F770AE7BB7a8303968A7Fb6088A2296e',
34311
34311
  immutableSwapProxy: '0xDdBDa144cEbe1cCd68E746CDff8a6e4Be51A9e98',
34312
34312
  },
34313
34313
  };
@@ -34416,7 +34416,7 @@ class Exchange {
34416
34416
  this.wrappedNativeToken = config.chain.wrappedNativeToken;
34417
34417
  this.nativeTokenService = new NativeTokenService(this.nativeToken, this.wrappedNativeToken);
34418
34418
  this.secondaryFees = config.secondaryFees;
34419
- this.routerContractAddress = config.chain.contracts.peripheryRouter;
34419
+ this.routerContractAddress = config.chain.contracts.swapRouter;
34420
34420
  this.swapProxyContractAddress = config.chain.contracts.immutableSwapProxy;
34421
34421
  this.provider = new ethers.providers.StaticJsonRpcProvider({
34422
34422
  url: config.chain.rpcUrl,
@@ -35460,7 +35460,7 @@ const GAS_OVERRIDES = {
35460
35460
  maxPriorityFeePerGas: BigNumber$1.from(101e9),
35461
35461
  };
35462
35462
 
35463
- const SDK_VERSION_MARKER = '0.39.2';
35463
+ const SDK_VERSION_MARKER = '0.39.4';
35464
35464
  // This SDK version is replaced by the `yarn build` command ran on the root level
35465
35465
  const globalPackageVersion = () => SDK_VERSION_MARKER;
35466
35466
 
@@ -35499,7 +35499,13 @@ class RemoteConfigFetcher {
35499
35499
  async loadConfig() {
35500
35500
  if (this.configCache)
35501
35501
  return this.configCache;
35502
- const response = await this.httpClient.get(`${this.getEndpoint()}/${this.version}/config`);
35502
+ let response;
35503
+ try {
35504
+ response = await this.httpClient.get(`${this.getEndpoint()}/${this.version}/config`);
35505
+ }
35506
+ catch (err) {
35507
+ throw new CheckoutError(`Error: ${err.message}`, CheckoutErrorType.API_ERROR);
35508
+ }
35503
35509
  // Ensure that the configuration is valid
35504
35510
  this.configCache = this.parseResponse(response);
35505
35511
  return this.configCache;
@@ -35507,7 +35513,13 @@ class RemoteConfigFetcher {
35507
35513
  async loadConfigTokens() {
35508
35514
  if (this.tokensCache)
35509
35515
  return this.tokensCache;
35510
- const response = await this.httpClient.get(`${this.getEndpoint()}/${this.version}/config/tokens`);
35516
+ let response;
35517
+ try {
35518
+ response = await this.httpClient.get(`${this.getEndpoint()}/${this.version}/config/tokens`);
35519
+ }
35520
+ catch (err) {
35521
+ throw new CheckoutError(`Error: ${err.message}`, CheckoutErrorType.API_ERROR);
35522
+ }
35511
35523
  // Ensure that the configuration is valid
35512
35524
  this.tokensCache = this.parseResponse(response);
35513
35525
  return this.tokensCache;
@@ -35714,13 +35726,7 @@ class Blockscout {
35714
35726
  const cached = this.getCache(url);
35715
35727
  if (cached)
35716
35728
  return Promise.resolve(cached);
35717
- const response = await this.httpClient.get(url);
35718
- if (response.status >= 400) {
35719
- return Promise.reject({
35720
- code: response.status,
35721
- message: response.statusText,
35722
- });
35723
- }
35729
+ const response = await this.httpClient.get(url); // success if 2XX response otherwise throw error
35724
35730
  // To get around an issue with native tokens being an ERC-20, there is the need
35725
35731
  // to remove IMX from `resp` and add it back in using getNativeTokenByWalletAddress.
35726
35732
  // This has affected some of the early wallets, and it might not be an issue in mainnet
@@ -35755,13 +35761,7 @@ class Blockscout {
35755
35761
  const cached = this.getCache(url);
35756
35762
  if (cached)
35757
35763
  return Promise.resolve(cached);
35758
- const response = await this.httpClient.get(url);
35759
- if (response.status >= 400) {
35760
- return Promise.reject({
35761
- code: response.status,
35762
- message: response.statusText,
35763
- });
35764
- }
35764
+ const response = await this.httpClient.get(url); // success if 2XX response otherwise throw error
35765
35765
  const data = {
35766
35766
  token: this.nativeToken,
35767
35767
  value: response.data.coin_balance,
@@ -39006,22 +39006,8 @@ class HttpClient {
39006
39006
  return config;
39007
39007
  }, (error) => Promise.reject(error));
39008
39008
  }
39009
- // eslint-disable-next-line class-methods-use-this
39010
- processResponse(response) {
39011
- if (response && response?.status !== 200) {
39012
- throw new CheckoutError(`Error: ${response.status} ${response.statusText}`, CheckoutErrorType.API_ERROR);
39013
- }
39014
- }
39015
39009
  async request(config) {
39016
- let response;
39017
- try {
39018
- response = await this.axiosInstance.request(config);
39019
- }
39020
- catch (error) {
39021
- throw new CheckoutError(error.message, CheckoutErrorType.API_ERROR);
39022
- }
39023
- this.processResponse(response);
39024
- return response;
39010
+ return await this.axiosInstance.request(config);
39025
39011
  }
39026
39012
  async get(url, config) {
39027
39013
  const requestConfig = {
package/dist/passport.js CHANGED
@@ -2349,7 +2349,7 @@ class MultiRollupApiClients {
2349
2349
  }
2350
2350
 
2351
2351
  // eslint-disable-next-line @typescript-eslint/naming-convention
2352
- const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-0.39.2' };
2352
+ const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-0.39.4' };
2353
2353
  const createConfig = ({ basePath, headers, }) => {
2354
2354
  if (!basePath.trim()) {
2355
2355
  throw Error('basePath can not be empty');
@@ -2405,7 +2405,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
2405
2405
  chainID,
2406
2406
  coreContractAddress,
2407
2407
  registrationContractAddress,
2408
- sdkVersion: 'ts-immutable-sdk-0.39.2',
2408
+ sdkVersion: 'ts-immutable-sdk-0.39.4',
2409
2409
  });
2410
2410
  /**
2411
2411
  * 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.39.2",
4
+ "version": "0.39.4",
5
5
  "author": "Immutable",
6
6
  "browser": "./dist/index.browser.js",
7
7
  "bugs": "https://github.com/immutable/ts-immutable-sdk/issues",