@imtbl/sdk 0.23.1 → 0.23.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 +2 -2
- 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 +3 -3
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +24 -13
- package/dist/index.js +24 -13
- package/dist/passport.js +22 -11
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3009,7 +3009,7 @@ class MultiRollupApiClients {
|
|
|
3009
3009
|
}
|
|
3010
3010
|
|
|
3011
3011
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
3012
|
-
const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.23.
|
|
3012
|
+
const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.23.2' };
|
|
3013
3013
|
const createConfig = ({ basePath, headers, }) => {
|
|
3014
3014
|
if (!basePath.trim()) {
|
|
3015
3015
|
throw Error('basePath can not be empty');
|
|
@@ -3069,7 +3069,7 @@ class APIError extends Error {
|
|
|
3069
3069
|
|
|
3070
3070
|
/* eslint-disable implicit-arrow-linebreak */
|
|
3071
3071
|
const defaultHeaders = {
|
|
3072
|
-
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.23.
|
|
3072
|
+
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.23.2',
|
|
3073
3073
|
};
|
|
3074
3074
|
/**
|
|
3075
3075
|
* createAPIConfiguration to create a custom Configuration
|
|
@@ -3355,7 +3355,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
|
|
|
3355
3355
|
chainID,
|
|
3356
3356
|
coreContractAddress,
|
|
3357
3357
|
registrationContractAddress,
|
|
3358
|
-
sdkVersion: 'ts-immutable-sdk-0.23.
|
|
3358
|
+
sdkVersion: 'ts-immutable-sdk-0.23.2',
|
|
3359
3359
|
});
|
|
3360
3360
|
/**
|
|
3361
3361
|
* Sets `sdkVersion` at the time of build
|
|
@@ -8217,14 +8217,25 @@ class AuthManager {
|
|
|
8217
8217
|
this.deviceCredentialsManager.clearCredentials();
|
|
8218
8218
|
}, PassportErrorType.LOGOUT_ERROR);
|
|
8219
8219
|
}
|
|
8220
|
-
async loginSilent() {
|
|
8221
|
-
|
|
8220
|
+
async loginSilent({ forceRefresh } = { forceRefresh: false }) {
|
|
8221
|
+
// eslint-disable-next-line arrow-body-style
|
|
8222
|
+
return withPassportError(async () => {
|
|
8223
|
+
return this.getUser({ forceRefresh });
|
|
8224
|
+
}, PassportErrorType.SILENT_LOGIN_ERROR);
|
|
8222
8225
|
}
|
|
8223
|
-
|
|
8226
|
+
/**
|
|
8227
|
+
* Get the user from the cache or refresh the token if it's expired.
|
|
8228
|
+
* @param forceRefresh If set to true, force an HTTP call to the OIDC server's authorization endpoint. This call will
|
|
8229
|
+
* throw an error if there's no refresh token.
|
|
8230
|
+
*/
|
|
8231
|
+
async getWebUser({ forceRefresh = false }) {
|
|
8232
|
+
if (forceRefresh) {
|
|
8233
|
+
const newOidcUser = await this.userManager.signinSilent();
|
|
8234
|
+
return newOidcUser ? AuthManager.mapOidcUserToDomainModel(newOidcUser) : null;
|
|
8235
|
+
}
|
|
8224
8236
|
const oidcUser = await this.userManager.getUser();
|
|
8225
|
-
if (!oidcUser)
|
|
8237
|
+
if (!oidcUser)
|
|
8226
8238
|
return null;
|
|
8227
|
-
}
|
|
8228
8239
|
const tokenExpired = isTokenExpired(oidcUser);
|
|
8229
8240
|
if (!tokenExpired) {
|
|
8230
8241
|
return AuthManager.mapOidcUserToDomainModel(oidcUser);
|
|
@@ -8237,9 +8248,9 @@ class AuthManager {
|
|
|
8237
8248
|
}
|
|
8238
8249
|
return null;
|
|
8239
8250
|
}
|
|
8240
|
-
async getUser() {
|
|
8251
|
+
async getUser({ forceRefresh } = { forceRefresh: false }) {
|
|
8241
8252
|
return withPassportError(async () => {
|
|
8242
|
-
const user = await this.getWebUser();
|
|
8253
|
+
const user = await this.getWebUser({ forceRefresh });
|
|
8243
8254
|
if (user) {
|
|
8244
8255
|
return user;
|
|
8245
8256
|
}
|
|
@@ -9017,7 +9028,7 @@ class PassportImxProviderFactory {
|
|
|
9017
9028
|
}, jwt);
|
|
9018
9029
|
// User metadata is updated asynchronously. Poll userinfo endpoint until it is updated.
|
|
9019
9030
|
const updatedUser = await retryWithDelay(async () => {
|
|
9020
|
-
const user = await this.authManager.loginSilent();
|
|
9031
|
+
const user = await this.authManager.loginSilent({ forceRefresh: true }); // force refresh to get updated user info
|
|
9021
9032
|
const metadataExists = !!user?.imx;
|
|
9022
9033
|
if (metadataExists) {
|
|
9023
9034
|
return user;
|
|
@@ -9517,7 +9528,7 @@ async function registerZkEvmUser({ authManager, config, magicProvider, multiRoll
|
|
|
9517
9528
|
user = await authManager.refreshToken(credentials.refresh_token);
|
|
9518
9529
|
}
|
|
9519
9530
|
else {
|
|
9520
|
-
user = await authManager.loginSilent();
|
|
9531
|
+
user = await authManager.loginSilent({ forceRefresh: true });
|
|
9521
9532
|
}
|
|
9522
9533
|
if (!user?.zkEvm) {
|
|
9523
9534
|
throw new JsonRpcError(RpcErrorCode.INTERNAL_ERROR, 'Failed to refresh user details');
|
|
@@ -32131,7 +32142,7 @@ var $045213b18e9f1f94$export$75be0f6af9650f2c;
|
|
|
32131
32142
|
})($045213b18e9f1f94$export$75be0f6af9650f2c || ($045213b18e9f1f94$export$75be0f6af9650f2c = {}));
|
|
32132
32143
|
|
|
32133
32144
|
|
|
32134
|
-
const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.23.
|
|
32145
|
+
const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.23.2";
|
|
32135
32146
|
const $d663162fd5a0853f$export$83bf90b30cdfd29f = ()=>false;
|
|
32136
32147
|
const $d663162fd5a0853f$export$1169f5475725171b = ()=>$d663162fd5a0853f$export$38a083d9fb5551ca;
|
|
32137
32148
|
|
package/dist/index.js
CHANGED
|
@@ -2987,7 +2987,7 @@ class MultiRollupApiClients {
|
|
|
2987
2987
|
}
|
|
2988
2988
|
|
|
2989
2989
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
2990
|
-
const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.23.
|
|
2990
|
+
const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.23.2' };
|
|
2991
2991
|
const createConfig = ({ basePath, headers, }) => {
|
|
2992
2992
|
if (!basePath.trim()) {
|
|
2993
2993
|
throw Error('basePath can not be empty');
|
|
@@ -3047,7 +3047,7 @@ class APIError extends Error {
|
|
|
3047
3047
|
|
|
3048
3048
|
/* eslint-disable implicit-arrow-linebreak */
|
|
3049
3049
|
const defaultHeaders = {
|
|
3050
|
-
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.23.
|
|
3050
|
+
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.23.2',
|
|
3051
3051
|
};
|
|
3052
3052
|
/**
|
|
3053
3053
|
* createAPIConfiguration to create a custom Configuration
|
|
@@ -3333,7 +3333,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
|
|
|
3333
3333
|
chainID,
|
|
3334
3334
|
coreContractAddress,
|
|
3335
3335
|
registrationContractAddress,
|
|
3336
|
-
sdkVersion: 'ts-immutable-sdk-0.23.
|
|
3336
|
+
sdkVersion: 'ts-immutable-sdk-0.23.2',
|
|
3337
3337
|
});
|
|
3338
3338
|
/**
|
|
3339
3339
|
* Sets `sdkVersion` at the time of build
|
|
@@ -8195,14 +8195,25 @@ class AuthManager {
|
|
|
8195
8195
|
this.deviceCredentialsManager.clearCredentials();
|
|
8196
8196
|
}, PassportErrorType.LOGOUT_ERROR);
|
|
8197
8197
|
}
|
|
8198
|
-
async loginSilent() {
|
|
8199
|
-
|
|
8198
|
+
async loginSilent({ forceRefresh } = { forceRefresh: false }) {
|
|
8199
|
+
// eslint-disable-next-line arrow-body-style
|
|
8200
|
+
return withPassportError(async () => {
|
|
8201
|
+
return this.getUser({ forceRefresh });
|
|
8202
|
+
}, PassportErrorType.SILENT_LOGIN_ERROR);
|
|
8200
8203
|
}
|
|
8201
|
-
|
|
8204
|
+
/**
|
|
8205
|
+
* Get the user from the cache or refresh the token if it's expired.
|
|
8206
|
+
* @param forceRefresh If set to true, force an HTTP call to the OIDC server's authorization endpoint. This call will
|
|
8207
|
+
* throw an error if there's no refresh token.
|
|
8208
|
+
*/
|
|
8209
|
+
async getWebUser({ forceRefresh = false }) {
|
|
8210
|
+
if (forceRefresh) {
|
|
8211
|
+
const newOidcUser = await this.userManager.signinSilent();
|
|
8212
|
+
return newOidcUser ? AuthManager.mapOidcUserToDomainModel(newOidcUser) : null;
|
|
8213
|
+
}
|
|
8202
8214
|
const oidcUser = await this.userManager.getUser();
|
|
8203
|
-
if (!oidcUser)
|
|
8215
|
+
if (!oidcUser)
|
|
8204
8216
|
return null;
|
|
8205
|
-
}
|
|
8206
8217
|
const tokenExpired = isTokenExpired(oidcUser);
|
|
8207
8218
|
if (!tokenExpired) {
|
|
8208
8219
|
return AuthManager.mapOidcUserToDomainModel(oidcUser);
|
|
@@ -8215,9 +8226,9 @@ class AuthManager {
|
|
|
8215
8226
|
}
|
|
8216
8227
|
return null;
|
|
8217
8228
|
}
|
|
8218
|
-
async getUser() {
|
|
8229
|
+
async getUser({ forceRefresh } = { forceRefresh: false }) {
|
|
8219
8230
|
return withPassportError(async () => {
|
|
8220
|
-
const user = await this.getWebUser();
|
|
8231
|
+
const user = await this.getWebUser({ forceRefresh });
|
|
8221
8232
|
if (user) {
|
|
8222
8233
|
return user;
|
|
8223
8234
|
}
|
|
@@ -8995,7 +9006,7 @@ class PassportImxProviderFactory {
|
|
|
8995
9006
|
}, jwt);
|
|
8996
9007
|
// User metadata is updated asynchronously. Poll userinfo endpoint until it is updated.
|
|
8997
9008
|
const updatedUser = await retryWithDelay(async () => {
|
|
8998
|
-
const user = await this.authManager.loginSilent();
|
|
9009
|
+
const user = await this.authManager.loginSilent({ forceRefresh: true }); // force refresh to get updated user info
|
|
8999
9010
|
const metadataExists = !!user?.imx;
|
|
9000
9011
|
if (metadataExists) {
|
|
9001
9012
|
return user;
|
|
@@ -9495,7 +9506,7 @@ async function registerZkEvmUser({ authManager, config, magicProvider, multiRoll
|
|
|
9495
9506
|
user = await authManager.refreshToken(credentials.refresh_token);
|
|
9496
9507
|
}
|
|
9497
9508
|
else {
|
|
9498
|
-
user = await authManager.loginSilent();
|
|
9509
|
+
user = await authManager.loginSilent({ forceRefresh: true });
|
|
9499
9510
|
}
|
|
9500
9511
|
if (!user?.zkEvm) {
|
|
9501
9512
|
throw new JsonRpcError(RpcErrorCode.INTERNAL_ERROR, 'Failed to refresh user details');
|
|
@@ -32109,7 +32120,7 @@ var $045213b18e9f1f94$export$75be0f6af9650f2c;
|
|
|
32109
32120
|
})($045213b18e9f1f94$export$75be0f6af9650f2c || ($045213b18e9f1f94$export$75be0f6af9650f2c = {}));
|
|
32110
32121
|
|
|
32111
32122
|
|
|
32112
|
-
const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.23.
|
|
32123
|
+
const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.23.2";
|
|
32113
32124
|
const $d663162fd5a0853f$export$83bf90b30cdfd29f = ()=>false;
|
|
32114
32125
|
const $d663162fd5a0853f$export$1169f5475725171b = ()=>$d663162fd5a0853f$export$38a083d9fb5551ca;
|
|
32115
32126
|
|
package/dist/passport.js
CHANGED
|
@@ -1785,7 +1785,7 @@ class MultiRollupApiClients {
|
|
|
1785
1785
|
}
|
|
1786
1786
|
|
|
1787
1787
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
1788
|
-
const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-0.23.
|
|
1788
|
+
const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-0.23.2' };
|
|
1789
1789
|
const createConfig = ({ basePath, headers, }) => {
|
|
1790
1790
|
if (!basePath.trim()) {
|
|
1791
1791
|
throw Error('basePath can not be empty');
|
|
@@ -1841,7 +1841,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
|
|
|
1841
1841
|
chainID,
|
|
1842
1842
|
coreContractAddress,
|
|
1843
1843
|
registrationContractAddress,
|
|
1844
|
-
sdkVersion: 'ts-immutable-sdk-0.23.
|
|
1844
|
+
sdkVersion: 'ts-immutable-sdk-0.23.2',
|
|
1845
1845
|
});
|
|
1846
1846
|
/**
|
|
1847
1847
|
* Sets `sdkVersion` at the time of build
|
|
@@ -6686,14 +6686,25 @@ class AuthManager {
|
|
|
6686
6686
|
this.deviceCredentialsManager.clearCredentials();
|
|
6687
6687
|
}, PassportErrorType.LOGOUT_ERROR);
|
|
6688
6688
|
}
|
|
6689
|
-
async loginSilent() {
|
|
6690
|
-
|
|
6689
|
+
async loginSilent({ forceRefresh } = { forceRefresh: false }) {
|
|
6690
|
+
// eslint-disable-next-line arrow-body-style
|
|
6691
|
+
return withPassportError(async () => {
|
|
6692
|
+
return this.getUser({ forceRefresh });
|
|
6693
|
+
}, PassportErrorType.SILENT_LOGIN_ERROR);
|
|
6691
6694
|
}
|
|
6692
|
-
|
|
6695
|
+
/**
|
|
6696
|
+
* Get the user from the cache or refresh the token if it's expired.
|
|
6697
|
+
* @param forceRefresh If set to true, force an HTTP call to the OIDC server's authorization endpoint. This call will
|
|
6698
|
+
* throw an error if there's no refresh token.
|
|
6699
|
+
*/
|
|
6700
|
+
async getWebUser({ forceRefresh = false }) {
|
|
6701
|
+
if (forceRefresh) {
|
|
6702
|
+
const newOidcUser = await this.userManager.signinSilent();
|
|
6703
|
+
return newOidcUser ? AuthManager.mapOidcUserToDomainModel(newOidcUser) : null;
|
|
6704
|
+
}
|
|
6693
6705
|
const oidcUser = await this.userManager.getUser();
|
|
6694
|
-
if (!oidcUser)
|
|
6706
|
+
if (!oidcUser)
|
|
6695
6707
|
return null;
|
|
6696
|
-
}
|
|
6697
6708
|
const tokenExpired = isTokenExpired(oidcUser);
|
|
6698
6709
|
if (!tokenExpired) {
|
|
6699
6710
|
return AuthManager.mapOidcUserToDomainModel(oidcUser);
|
|
@@ -6706,9 +6717,9 @@ class AuthManager {
|
|
|
6706
6717
|
}
|
|
6707
6718
|
return null;
|
|
6708
6719
|
}
|
|
6709
|
-
async getUser() {
|
|
6720
|
+
async getUser({ forceRefresh } = { forceRefresh: false }) {
|
|
6710
6721
|
return withPassportError(async () => {
|
|
6711
|
-
const user = await this.getWebUser();
|
|
6722
|
+
const user = await this.getWebUser({ forceRefresh });
|
|
6712
6723
|
if (user) {
|
|
6713
6724
|
return user;
|
|
6714
6725
|
}
|
|
@@ -7486,7 +7497,7 @@ class PassportImxProviderFactory {
|
|
|
7486
7497
|
}, jwt);
|
|
7487
7498
|
// User metadata is updated asynchronously. Poll userinfo endpoint until it is updated.
|
|
7488
7499
|
const updatedUser = await retryWithDelay(async () => {
|
|
7489
|
-
const user = await this.authManager.loginSilent();
|
|
7500
|
+
const user = await this.authManager.loginSilent({ forceRefresh: true }); // force refresh to get updated user info
|
|
7490
7501
|
const metadataExists = !!user?.imx;
|
|
7491
7502
|
if (metadataExists) {
|
|
7492
7503
|
return user;
|
|
@@ -7986,7 +7997,7 @@ async function registerZkEvmUser({ authManager, config, magicProvider, multiRoll
|
|
|
7986
7997
|
user = await authManager.refreshToken(credentials.refresh_token);
|
|
7987
7998
|
}
|
|
7988
7999
|
else {
|
|
7989
|
-
user = await authManager.loginSilent();
|
|
8000
|
+
user = await authManager.loginSilent({ forceRefresh: true });
|
|
7990
8001
|
}
|
|
7991
8002
|
if (!user?.zkEvm) {
|
|
7992
8003
|
throw new JsonRpcError(RpcErrorCode.INTERNAL_ERROR, 'Failed to refresh user details');
|
package/package.json
CHANGED