@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.
@@ -11447,8 +11447,8 @@ interface CancelParams {
11447
11447
  type ExchangeContracts = {
11448
11448
  multicall: string;
11449
11449
  coreFactory: string;
11450
- quoterV2: string;
11451
- peripheryRouter: string;
11450
+ quoter: string;
11451
+ swapRouter: string;
11452
11452
  immutableSwapProxy: string;
11453
11453
  };
11454
11454
  /**
@@ -12433,7 +12433,6 @@ declare class HttpClient {
12433
12433
  constructor(config?: CheckoutModuleConfiguration);
12434
12434
  private shouldAddPublishableKey;
12435
12435
  private setupInterceptors;
12436
- private processResponse;
12437
12436
  request(config: AxiosRequestConfig): Promise<AxiosResponse<any, any>>;
12438
12437
  get(url: string, config?: AxiosRequestConfig): Promise<AxiosResponse<any, any>>;
12439
12438
  post(url: string, data?: any, config?: AxiosRequestConfig): Promise<AxiosResponse<any, any>>;
package/dist/checkout.js CHANGED
@@ -16668,7 +16668,7 @@ const SUPPORTED_SANDBOX_BRIDGES = [ETH_SEPOLIA_TO_ZKEVM_DEVNET, ETH_SEPOLIA_TO_Z
16668
16668
  /**
16669
16669
  * @constant {BridgeInstance[]} SUPPORTED_PRODUCTION_BRIDGES - An array of supported bridge instances for the production environment.
16670
16670
  */
16671
- const SUPPORTED_PRODUCTION_BRIDGES = [];
16671
+ const SUPPORTED_PRODUCTION_BRIDGES = [ETH_MAINNET_TO_ZKEVM_MAINNET];
16672
16672
  /**
16673
16673
  * @constant {Object} SUPPORTED_BRIDGES_FOR_ENVIRONMENT - An object mapping environment types to their supported bridge instances.
16674
16674
  */
@@ -19402,7 +19402,7 @@ class Router {
19402
19402
  return await this.getBestQuoteFromRoutes(routes, amountSpecified, tradeType);
19403
19403
  }
19404
19404
  async getBestQuoteFromRoutes(routes, amountSpecified, tradeType) {
19405
- const quotes = await getQuotesForRoutes(this.provider, this.routingContracts.quoterV2, routes, amountSpecified, tradeType);
19405
+ const quotes = await getQuotesForRoutes(this.provider, this.routingContracts.quoter, routes, amountSpecified, tradeType);
19406
19406
  if (quotes.length === 0) {
19407
19407
  throw new NoRoutesAvailableError();
19408
19408
  }
@@ -20043,10 +20043,10 @@ function adjustQuoteWithFees(ourQuote, amountSpecified, fees, nativeTokenService
20043
20043
 
20044
20044
  const CONTRACTS_FOR_CHAIN_ID = {
20045
20045
  [IMMUTABLE_TESTNET_CHAIN_ID]: {
20046
- multicall: '0x4DB567A44451b27C1fAd7f52e1cDf64b915d62f9',
20047
- coreFactory: '0xb18c44b211065E69844FbA9AE146DA362104AfBf',
20048
- quoterV2: '0x87854A7D4b9BaC3D37f4516A1Ac7F36fB5ad539f',
20049
- peripheryRouter: '0x786ec643F231960D4C1A4E336990F8E7bF8f1277',
20046
+ multicall: '0x4857Dfd11c712e862eC362cEee29F7974B70EfcD',
20047
+ coreFactory: '0x56c2162254b0E4417288786eE402c2B41d4e181e',
20048
+ quoter: '0xF6Ad3CcF71Abb3E12beCf6b3D2a74C963859ADCd',
20049
+ swapRouter: '0x0b012055F770AE7BB7a8303968A7Fb6088A2296e',
20050
20050
  immutableSwapProxy: '0xDdBDa144cEbe1cCd68E746CDff8a6e4Be51A9e98',
20051
20051
  },
20052
20052
  };
@@ -20155,7 +20155,7 @@ class Exchange {
20155
20155
  this.wrappedNativeToken = config.chain.wrappedNativeToken;
20156
20156
  this.nativeTokenService = new NativeTokenService(this.nativeToken, this.wrappedNativeToken);
20157
20157
  this.secondaryFees = config.secondaryFees;
20158
- this.routerContractAddress = config.chain.contracts.peripheryRouter;
20158
+ this.routerContractAddress = config.chain.contracts.swapRouter;
20159
20159
  this.swapProxyContractAddress = config.chain.contracts.immutableSwapProxy;
20160
20160
  this.provider = new ethers.providers.StaticJsonRpcProvider({
20161
20161
  url: config.chain.rpcUrl,
@@ -25801,7 +25801,7 @@ class APIError extends Error {
25801
25801
 
25802
25802
  /* eslint-disable implicit-arrow-linebreak */
25803
25803
  const defaultHeaders = {
25804
- sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.39.2',
25804
+ sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.39.4',
25805
25805
  };
25806
25806
  /**
25807
25807
  * createAPIConfiguration to create a custom Configuration
@@ -27150,7 +27150,7 @@ const GAS_OVERRIDES = {
27150
27150
  maxPriorityFeePerGas: BigNumber$1.from(101e9),
27151
27151
  };
27152
27152
 
27153
- const SDK_VERSION_MARKER = '0.39.2';
27153
+ const SDK_VERSION_MARKER = '0.39.4';
27154
27154
  // This SDK version is replaced by the `yarn build` command ran on the root level
27155
27155
  const globalPackageVersion = () => SDK_VERSION_MARKER;
27156
27156
 
@@ -27189,7 +27189,13 @@ class RemoteConfigFetcher {
27189
27189
  async loadConfig() {
27190
27190
  if (this.configCache)
27191
27191
  return this.configCache;
27192
- const response = await this.httpClient.get(`${this.getEndpoint()}/${this.version}/config`);
27192
+ let response;
27193
+ try {
27194
+ response = await this.httpClient.get(`${this.getEndpoint()}/${this.version}/config`);
27195
+ }
27196
+ catch (err) {
27197
+ throw new CheckoutError(`Error: ${err.message}`, CheckoutErrorType.API_ERROR);
27198
+ }
27193
27199
  // Ensure that the configuration is valid
27194
27200
  this.configCache = this.parseResponse(response);
27195
27201
  return this.configCache;
@@ -27197,7 +27203,13 @@ class RemoteConfigFetcher {
27197
27203
  async loadConfigTokens() {
27198
27204
  if (this.tokensCache)
27199
27205
  return this.tokensCache;
27200
- const response = await this.httpClient.get(`${this.getEndpoint()}/${this.version}/config/tokens`);
27206
+ let response;
27207
+ try {
27208
+ response = await this.httpClient.get(`${this.getEndpoint()}/${this.version}/config/tokens`);
27209
+ }
27210
+ catch (err) {
27211
+ throw new CheckoutError(`Error: ${err.message}`, CheckoutErrorType.API_ERROR);
27212
+ }
27201
27213
  // Ensure that the configuration is valid
27202
27214
  this.tokensCache = this.parseResponse(response);
27203
27215
  return this.tokensCache;
@@ -27404,13 +27416,7 @@ class Blockscout {
27404
27416
  const cached = this.getCache(url);
27405
27417
  if (cached)
27406
27418
  return Promise.resolve(cached);
27407
- const response = await this.httpClient.get(url);
27408
- if (response.status >= 400) {
27409
- return Promise.reject({
27410
- code: response.status,
27411
- message: response.statusText,
27412
- });
27413
- }
27419
+ const response = await this.httpClient.get(url); // success if 2XX response otherwise throw error
27414
27420
  // To get around an issue with native tokens being an ERC-20, there is the need
27415
27421
  // to remove IMX from `resp` and add it back in using getNativeTokenByWalletAddress.
27416
27422
  // This has affected some of the early wallets, and it might not be an issue in mainnet
@@ -27445,13 +27451,7 @@ class Blockscout {
27445
27451
  const cached = this.getCache(url);
27446
27452
  if (cached)
27447
27453
  return Promise.resolve(cached);
27448
- const response = await this.httpClient.get(url);
27449
- if (response.status >= 400) {
27450
- return Promise.reject({
27451
- code: response.status,
27452
- message: response.statusText,
27453
- });
27454
- }
27454
+ const response = await this.httpClient.get(url); // success if 2XX response otherwise throw error
27455
27455
  const data = {
27456
27456
  token: this.nativeToken,
27457
27457
  value: response.data.coin_balance,
@@ -30696,22 +30696,8 @@ class HttpClient {
30696
30696
  return config;
30697
30697
  }, (error) => Promise.reject(error));
30698
30698
  }
30699
- // eslint-disable-next-line class-methods-use-this
30700
- processResponse(response) {
30701
- if (response && response?.status !== 200) {
30702
- throw new CheckoutError(`Error: ${response.status} ${response.statusText}`, CheckoutErrorType.API_ERROR);
30703
- }
30704
- }
30705
30699
  async request(config) {
30706
- let response;
30707
- try {
30708
- response = await this.axiosInstance.request(config);
30709
- }
30710
- catch (error) {
30711
- throw new CheckoutError(error.message, CheckoutErrorType.API_ERROR);
30712
- }
30713
- this.processResponse(response);
30714
- return response;
30700
+ return await this.axiosInstance.request(config);
30715
30701
  }
30716
30702
  async get(url, config) {
30717
30703
  const requestConfig = {
@@ -17,7 +17,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
17
17
  chainID,
18
18
  coreContractAddress,
19
19
  registrationContractAddress,
20
- sdkVersion: 'ts-immutable-sdk-0.39.2',
20
+ sdkVersion: 'ts-immutable-sdk-0.39.4',
21
21
  });
22
22
  /**
23
23
  * Sets `sdkVersion` at the time of build