@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/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.2' };
|
|
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.2',
|
|
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.2',
|
|
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 = [];
|
|
30955
30955
|
/**
|
|
30956
30956
|
* @constant {Object} SUPPORTED_BRIDGES_FOR_ENVIRONMENT - An object mapping environment types to their supported bridge instances.
|
|
30957
30957
|
*/
|
|
@@ -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.2';
|
|
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,13 +35521,7 @@ class RemoteConfigFetcher {
|
|
|
35521
35521
|
async loadConfig() {
|
|
35522
35522
|
if (this.configCache)
|
|
35523
35523
|
return this.configCache;
|
|
35524
|
-
|
|
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
|
-
}
|
|
35524
|
+
const response = await this.httpClient.get(`${this.getEndpoint()}/${this.version}/config`);
|
|
35531
35525
|
// Ensure that the configuration is valid
|
|
35532
35526
|
this.configCache = this.parseResponse(response);
|
|
35533
35527
|
return this.configCache;
|
|
@@ -35535,13 +35529,7 @@ class RemoteConfigFetcher {
|
|
|
35535
35529
|
async loadConfigTokens() {
|
|
35536
35530
|
if (this.tokensCache)
|
|
35537
35531
|
return this.tokensCache;
|
|
35538
|
-
|
|
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
|
-
}
|
|
35532
|
+
const response = await this.httpClient.get(`${this.getEndpoint()}/${this.version}/config/tokens`);
|
|
35545
35533
|
// Ensure that the configuration is valid
|
|
35546
35534
|
this.tokensCache = this.parseResponse(response);
|
|
35547
35535
|
return this.tokensCache;
|
|
@@ -35748,7 +35736,13 @@ class Blockscout {
|
|
|
35748
35736
|
const cached = this.getCache(url);
|
|
35749
35737
|
if (cached)
|
|
35750
35738
|
return Promise.resolve(cached);
|
|
35751
|
-
const response = await this.httpClient.get(url);
|
|
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
|
+
}
|
|
35752
35746
|
// To get around an issue with native tokens being an ERC-20, there is the need
|
|
35753
35747
|
// to remove IMX from `resp` and add it back in using getNativeTokenByWalletAddress.
|
|
35754
35748
|
// This has affected some of the early wallets, and it might not be an issue in mainnet
|
|
@@ -35783,7 +35777,13 @@ class Blockscout {
|
|
|
35783
35777
|
const cached = this.getCache(url);
|
|
35784
35778
|
if (cached)
|
|
35785
35779
|
return Promise.resolve(cached);
|
|
35786
|
-
const response = await this.httpClient.get(url);
|
|
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
|
+
}
|
|
35787
35787
|
const data = {
|
|
35788
35788
|
token: this.nativeToken,
|
|
35789
35789
|
value: response.data.coin_balance,
|
|
@@ -39028,8 +39028,22 @@ 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
|
+
}
|
|
39031
39037
|
async request(config) {
|
|
39032
|
-
|
|
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;
|
|
39033
39047
|
}
|
|
39034
39048
|
async get(url, config) {
|
|
39035
39049
|
const requestConfig = {
|
package/dist/index.d.ts
CHANGED
|
@@ -18361,6 +18361,7 @@ declare class HttpClient {
|
|
|
18361
18361
|
constructor(config?: CheckoutModuleConfiguration);
|
|
18362
18362
|
private shouldAddPublishableKey;
|
|
18363
18363
|
private setupInterceptors;
|
|
18364
|
+
private processResponse;
|
|
18364
18365
|
request(config: AxiosRequestConfig$1): Promise<AxiosResponse$1<any, any>>;
|
|
18365
18366
|
get(url: string, config?: AxiosRequestConfig$1): Promise<AxiosResponse$1<any, any>>;
|
|
18366
18367
|
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.2' };
|
|
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.2',
|
|
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.2',
|
|
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 = [];
|
|
30933
30933
|
/**
|
|
30934
30934
|
* @constant {Object} SUPPORTED_BRIDGES_FOR_ENVIRONMENT - An object mapping environment types to their supported bridge instances.
|
|
30935
30935
|
*/
|
|
@@ -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.2';
|
|
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,13 +35499,7 @@ class RemoteConfigFetcher {
|
|
|
35499
35499
|
async loadConfig() {
|
|
35500
35500
|
if (this.configCache)
|
|
35501
35501
|
return this.configCache;
|
|
35502
|
-
|
|
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
|
-
}
|
|
35502
|
+
const response = await this.httpClient.get(`${this.getEndpoint()}/${this.version}/config`);
|
|
35509
35503
|
// Ensure that the configuration is valid
|
|
35510
35504
|
this.configCache = this.parseResponse(response);
|
|
35511
35505
|
return this.configCache;
|
|
@@ -35513,13 +35507,7 @@ class RemoteConfigFetcher {
|
|
|
35513
35507
|
async loadConfigTokens() {
|
|
35514
35508
|
if (this.tokensCache)
|
|
35515
35509
|
return this.tokensCache;
|
|
35516
|
-
|
|
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
|
-
}
|
|
35510
|
+
const response = await this.httpClient.get(`${this.getEndpoint()}/${this.version}/config/tokens`);
|
|
35523
35511
|
// Ensure that the configuration is valid
|
|
35524
35512
|
this.tokensCache = this.parseResponse(response);
|
|
35525
35513
|
return this.tokensCache;
|
|
@@ -35726,7 +35714,13 @@ class Blockscout {
|
|
|
35726
35714
|
const cached = this.getCache(url);
|
|
35727
35715
|
if (cached)
|
|
35728
35716
|
return Promise.resolve(cached);
|
|
35729
|
-
const response = await this.httpClient.get(url);
|
|
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
|
+
}
|
|
35730
35724
|
// To get around an issue with native tokens being an ERC-20, there is the need
|
|
35731
35725
|
// to remove IMX from `resp` and add it back in using getNativeTokenByWalletAddress.
|
|
35732
35726
|
// This has affected some of the early wallets, and it might not be an issue in mainnet
|
|
@@ -35761,7 +35755,13 @@ class Blockscout {
|
|
|
35761
35755
|
const cached = this.getCache(url);
|
|
35762
35756
|
if (cached)
|
|
35763
35757
|
return Promise.resolve(cached);
|
|
35764
|
-
const response = await this.httpClient.get(url);
|
|
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
|
+
}
|
|
35765
35765
|
const data = {
|
|
35766
35766
|
token: this.nativeToken,
|
|
35767
35767
|
value: response.data.coin_balance,
|
|
@@ -39006,8 +39006,22 @@ 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
|
+
}
|
|
39009
39015
|
async request(config) {
|
|
39010
|
-
|
|
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;
|
|
39011
39025
|
}
|
|
39012
39026
|
async get(url, config) {
|
|
39013
39027
|
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.2' };
|
|
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.2',
|
|
2409
2409
|
});
|
|
2410
2410
|
/**
|
|
2411
2411
|
* Sets `sdkVersion` at the time of build
|
package/package.json
CHANGED