@imtbl/sdk 0.18.1 → 0.18.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.js +1 -1
- package/dist/checkout_sdk.js +1 -1
- package/dist/checkout_widgets.js +1 -1
- package/dist/immutablex_client.js +1 -1
- package/dist/index.browser.js +15 -15
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +19 -8
- package/dist/index.js +21 -10
- package/dist/passport.js +19 -8
- package/package.json +1 -1
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.
|
|
2728
|
+
const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.18.2' };
|
|
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.
|
|
2788
|
+
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.18.2',
|
|
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.
|
|
3074
|
+
sdkVersion: 'ts-immutable-sdk-0.18.2',
|
|
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
|
-
|
|
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
|
|
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
|
|
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
|
|
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,
|
|
@@ -31173,7 +31184,7 @@ var checkout_sdk = /*#__PURE__*/Object.freeze({
|
|
|
31173
31184
|
function $parcel$export(e, n, v, s) {
|
|
31174
31185
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
31175
31186
|
}
|
|
31176
|
-
const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.18.
|
|
31187
|
+
const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.18.2";
|
|
31177
31188
|
const $d663162fd5a0853f$export$83bf90b30cdfd29f = ()=>false;
|
|
31178
31189
|
const $d663162fd5a0853f$export$1169f5475725171b = ()=>$d663162fd5a0853f$export$38a083d9fb5551ca;
|
|
31179
31190
|
|
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.
|
|
2706
|
+
const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.18.2' };
|
|
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.
|
|
2766
|
+
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.18.2',
|
|
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.
|
|
3052
|
+
sdkVersion: 'ts-immutable-sdk-0.18.2',
|
|
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
|
-
|
|
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
|
|
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
|
|
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
|
|
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,
|
|
@@ -31151,7 +31162,7 @@ var checkout_sdk = /*#__PURE__*/Object.freeze({
|
|
|
31151
31162
|
function $parcel$export(e, n, v, s) {
|
|
31152
31163
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
31153
31164
|
}
|
|
31154
|
-
const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.18.
|
|
31165
|
+
const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.18.2";
|
|
31155
31166
|
const $d663162fd5a0853f$export$83bf90b30cdfd29f = ()=>false;
|
|
31156
31167
|
const $d663162fd5a0853f$export$1169f5475725171b = ()=>$d663162fd5a0853f$export$38a083d9fb5551ca;
|
|
31157
31168
|
|
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.
|
|
1712
|
+
const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-0.18.2' };
|
|
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.
|
|
1768
|
+
sdkVersion: 'ts-immutable-sdk-0.18.2',
|
|
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
|
-
|
|
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
|
|
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
|
|
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
|
|
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