@imtbl/sdk 0.39.2-alpha.1 → 0.39.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.
- package/dist/blockchain_data.js +1 -1
- package/dist/browser/checkout/sdk.js +5 -5
- package/dist/browser/checkout/widgets.js +59 -59
- package/dist/checkout.d.ts +1 -0
- package/dist/checkout.js +34 -20
- package/dist/immutablex_client.js +1 -1
- package/dist/index.browser.js +4 -4
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +36 -22
- package/dist/index.d.ts +1 -0
- package/dist/index.js +36 -22
- package/dist/passport.js +2 -2
- package/package.json +1 -1
package/dist/checkout.d.ts
CHANGED
|
@@ -12433,6 +12433,7 @@ declare class HttpClient {
|
|
|
12433
12433
|
constructor(config?: CheckoutModuleConfiguration);
|
|
12434
12434
|
private shouldAddPublishableKey;
|
|
12435
12435
|
private setupInterceptors;
|
|
12436
|
+
private processResponse;
|
|
12436
12437
|
request(config: AxiosRequestConfig): Promise<AxiosResponse<any, any>>;
|
|
12437
12438
|
get(url: string, config?: AxiosRequestConfig): Promise<AxiosResponse<any, any>>;
|
|
12438
12439
|
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 = [];
|
|
16672
16672
|
/**
|
|
16673
16673
|
* @constant {Object} SUPPORTED_BRIDGES_FOR_ENVIRONMENT - An object mapping environment types to their supported bridge instances.
|
|
16674
16674
|
*/
|
|
@@ -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.2',
|
|
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.2';
|
|
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,13 +27189,7 @@ class RemoteConfigFetcher {
|
|
|
27189
27189
|
async loadConfig() {
|
|
27190
27190
|
if (this.configCache)
|
|
27191
27191
|
return this.configCache;
|
|
27192
|
-
|
|
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
|
-
}
|
|
27192
|
+
const response = await this.httpClient.get(`${this.getEndpoint()}/${this.version}/config`);
|
|
27199
27193
|
// Ensure that the configuration is valid
|
|
27200
27194
|
this.configCache = this.parseResponse(response);
|
|
27201
27195
|
return this.configCache;
|
|
@@ -27203,13 +27197,7 @@ class RemoteConfigFetcher {
|
|
|
27203
27197
|
async loadConfigTokens() {
|
|
27204
27198
|
if (this.tokensCache)
|
|
27205
27199
|
return this.tokensCache;
|
|
27206
|
-
|
|
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
|
-
}
|
|
27200
|
+
const response = await this.httpClient.get(`${this.getEndpoint()}/${this.version}/config/tokens`);
|
|
27213
27201
|
// Ensure that the configuration is valid
|
|
27214
27202
|
this.tokensCache = this.parseResponse(response);
|
|
27215
27203
|
return this.tokensCache;
|
|
@@ -27416,7 +27404,13 @@ class Blockscout {
|
|
|
27416
27404
|
const cached = this.getCache(url);
|
|
27417
27405
|
if (cached)
|
|
27418
27406
|
return Promise.resolve(cached);
|
|
27419
|
-
const response = await this.httpClient.get(url);
|
|
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
|
+
}
|
|
27420
27414
|
// To get around an issue with native tokens being an ERC-20, there is the need
|
|
27421
27415
|
// to remove IMX from `resp` and add it back in using getNativeTokenByWalletAddress.
|
|
27422
27416
|
// This has affected some of the early wallets, and it might not be an issue in mainnet
|
|
@@ -27451,7 +27445,13 @@ class Blockscout {
|
|
|
27451
27445
|
const cached = this.getCache(url);
|
|
27452
27446
|
if (cached)
|
|
27453
27447
|
return Promise.resolve(cached);
|
|
27454
|
-
const response = await this.httpClient.get(url);
|
|
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
|
+
}
|
|
27455
27455
|
const data = {
|
|
27456
27456
|
token: this.nativeToken,
|
|
27457
27457
|
value: response.data.coin_balance,
|
|
@@ -30696,8 +30696,22 @@ 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
|
+
}
|
|
30699
30705
|
async request(config) {
|
|
30700
|
-
|
|
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;
|
|
30701
30715
|
}
|
|
30702
30716
|
async get(url, config) {
|
|
30703
30717
|
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.2',
|
|
21
21
|
});
|
|
22
22
|
/**
|
|
23
23
|
* Sets `sdkVersion` at the time of build
|