@imtbl/sdk 0.28.0 → 0.28.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.d.ts +6 -0
- package/dist/checkout_sdk.js +11 -30
- package/dist/checkout_widgets.d.ts +6 -0
- package/dist/checkout_widgets.js +1 -1
- package/dist/immutablex_client.js +1 -1
- package/dist/index.browser.js +13 -13
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +29 -34
- package/dist/index.d.ts +6 -0
- package/dist/index.js +29 -34
- package/dist/passport.d.ts +6 -0
- package/dist/passport.js +17 -3
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3632,7 +3632,7 @@ class MultiRollupApiClients {
|
|
|
3632
3632
|
}
|
|
3633
3633
|
|
|
3634
3634
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
3635
|
-
const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.28.
|
|
3635
|
+
const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.28.2' };
|
|
3636
3636
|
const createConfig = ({ basePath, headers, }) => {
|
|
3637
3637
|
if (!basePath.trim()) {
|
|
3638
3638
|
throw Error('basePath can not be empty');
|
|
@@ -3692,7 +3692,7 @@ class APIError extends Error {
|
|
|
3692
3692
|
|
|
3693
3693
|
/* eslint-disable implicit-arrow-linebreak */
|
|
3694
3694
|
const defaultHeaders = {
|
|
3695
|
-
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.28.
|
|
3695
|
+
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.28.2',
|
|
3696
3696
|
};
|
|
3697
3697
|
/**
|
|
3698
3698
|
* createAPIConfiguration to create a custom Configuration
|
|
@@ -4103,7 +4103,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
|
|
|
4103
4103
|
chainID,
|
|
4104
4104
|
coreContractAddress,
|
|
4105
4105
|
registrationContractAddress,
|
|
4106
|
-
sdkVersion: 'ts-immutable-sdk-0.28.
|
|
4106
|
+
sdkVersion: 'ts-immutable-sdk-0.28.2',
|
|
4107
4107
|
});
|
|
4108
4108
|
/**
|
|
4109
4109
|
* Sets `sdkVersion` at the time of build
|
|
@@ -9750,7 +9750,7 @@ class PassportImxProviderFactory {
|
|
|
9750
9750
|
this.passportEventEmitter = passportEventEmitter;
|
|
9751
9751
|
}
|
|
9752
9752
|
async getProvider() {
|
|
9753
|
-
const user = await this.authManager.login();
|
|
9753
|
+
const user = await this.authManager.loginSilent() || await this.authManager.login();
|
|
9754
9754
|
return this.createProviderInstance(user);
|
|
9755
9755
|
}
|
|
9756
9756
|
async getProviderSilent() {
|
|
@@ -10747,6 +10747,20 @@ class Passport {
|
|
|
10747
10747
|
passportEventEmitter: this.passportEventEmitter,
|
|
10748
10748
|
});
|
|
10749
10749
|
}
|
|
10750
|
+
async signIn(options) {
|
|
10751
|
+
const { useCachedSession = false } = options || {};
|
|
10752
|
+
let user = await this.authManager.loginSilent();
|
|
10753
|
+
if (!user && !useCachedSession) {
|
|
10754
|
+
user = await this.authManager.login();
|
|
10755
|
+
}
|
|
10756
|
+
if (!user) {
|
|
10757
|
+
return null;
|
|
10758
|
+
}
|
|
10759
|
+
return user.profile;
|
|
10760
|
+
}
|
|
10761
|
+
/**
|
|
10762
|
+
* @deprecated The method connectImx(useCachedSession) should be used instead
|
|
10763
|
+
*/
|
|
10750
10764
|
async connectImxSilent() {
|
|
10751
10765
|
return this.passportImxProviderFactory.getProviderSilent();
|
|
10752
10766
|
}
|
|
@@ -25945,15 +25959,6 @@ class ApproveError extends ExchangeError {
|
|
|
25945
25959
|
super(message, ExchangeErrorCode.APPROVE_ERROR);
|
|
25946
25960
|
}
|
|
25947
25961
|
}
|
|
25948
|
-
class AlreadyApprovedError extends ExchangeError {
|
|
25949
|
-
tokenAddress;
|
|
25950
|
-
spenderAddress;
|
|
25951
|
-
constructor(amountApproved, tokenAddress, spenderAddress) {
|
|
25952
|
-
super(`already approved ${amountApproved} tokens`, ExchangeErrorCode.ALREADY_APPROVED_ERROR);
|
|
25953
|
-
this.tokenAddress = tokenAddress;
|
|
25954
|
-
this.spenderAddress = spenderAddress;
|
|
25955
|
-
}
|
|
25956
|
-
}
|
|
25957
25962
|
|
|
25958
25963
|
/* Autogenerated file. Do not edit manually. */
|
|
25959
25964
|
/* tslint:disable */
|
|
@@ -28587,8 +28592,7 @@ const calculateGasFee = (gasPrice, gasEstimate) =>
|
|
|
28587
28592
|
newAmount(gasEstimate.mul(gasPrice.value), gasPrice.token);
|
|
28588
28593
|
|
|
28589
28594
|
/**
|
|
28590
|
-
*
|
|
28591
|
-
* checking the existing allowance for the spender
|
|
28595
|
+
* Check if the spender needs approval for the token
|
|
28592
28596
|
*
|
|
28593
28597
|
* @param provider - The provider to use for the call
|
|
28594
28598
|
* @param ownerAddress - The address of the owner of the token
|
|
@@ -28596,11 +28600,11 @@ newAmount(gasEstimate.mul(gasPrice.value), gasPrice.token);
|
|
|
28596
28600
|
* @param spenderAddress - The address of the spender
|
|
28597
28601
|
* @returns - The amount of the token that needs to be approved
|
|
28598
28602
|
*/
|
|
28599
|
-
const
|
|
28603
|
+
const doesSpenderNeedApproval = async (provider, ownerAddress, tokenAmount, spenderAddress) => {
|
|
28600
28604
|
// create an instance of the ERC20 token contract
|
|
28601
28605
|
const erc20Contract = ERC20__factory.connect(tokenAmount.token.address, provider);
|
|
28602
28606
|
// get the allowance for the token spender
|
|
28603
|
-
// minimum is 0 - no allowance
|
|
28607
|
+
// the minimum allowance is 0 - no allowance
|
|
28604
28608
|
let allowance;
|
|
28605
28609
|
try {
|
|
28606
28610
|
allowance = await erc20Contract.allowance(ownerAddress, spenderAddress);
|
|
@@ -28609,12 +28613,12 @@ const getERC20AmountToApprove = async (provider, ownerAddress, tokenAmount, spen
|
|
|
28609
28613
|
const message = e instanceof Error ? e.message : 'Unknown Error';
|
|
28610
28614
|
throw new ApproveError(`failed to get allowance: ${message}`);
|
|
28611
28615
|
}
|
|
28612
|
-
//
|
|
28616
|
+
// check if approval is needed
|
|
28613
28617
|
const requiredAmount = tokenAmount.value.sub(allowance);
|
|
28614
28618
|
if (requiredAmount.isNegative() || requiredAmount.isZero()) {
|
|
28615
|
-
|
|
28619
|
+
return false;
|
|
28616
28620
|
}
|
|
28617
|
-
return
|
|
28621
|
+
return true;
|
|
28618
28622
|
};
|
|
28619
28623
|
/**
|
|
28620
28624
|
* Get an unsigned ERC20 approve transaction
|
|
@@ -28656,18 +28660,9 @@ const prepareApproval = (tradeType, userSpecifiedAmount, quotedAmountWithSlippag
|
|
|
28656
28660
|
* @returns The unsigned ERC20 approve transaction, or null if no approval is needed
|
|
28657
28661
|
*/
|
|
28658
28662
|
const getApproveTransaction = async (provider, ownerAddress, tokenAmount, spenderAddress) => {
|
|
28659
|
-
|
|
28660
|
-
|
|
28661
|
-
|
|
28662
|
-
}
|
|
28663
|
-
catch (e) {
|
|
28664
|
-
if (e instanceof AlreadyApprovedError) {
|
|
28665
|
-
// already approved for the required amount, nothing to do
|
|
28666
|
-
return null;
|
|
28667
|
-
}
|
|
28668
|
-
throw e;
|
|
28669
|
-
}
|
|
28670
|
-
return getUnsignedERC20ApproveTransaction(ownerAddress, amountToApprove, spenderAddress);
|
|
28663
|
+
const needsApproval = await doesSpenderNeedApproval(provider, ownerAddress, tokenAmount, spenderAddress);
|
|
28664
|
+
// @dev approvals are not additive, so we need to approve the full amount
|
|
28665
|
+
return needsApproval ? getUnsignedERC20ApproveTransaction(ownerAddress, tokenAmount, spenderAddress) : null;
|
|
28671
28666
|
};
|
|
28672
28667
|
async function getApproveGasEstimate(provider, ownerAddress, spenderAddress, tokenAddress) {
|
|
28673
28668
|
const erc20Contract = ERC20__factory.connect(tokenAddress, provider);
|
|
@@ -30318,7 +30313,7 @@ class $fd8a8472dcc3ec2b$export$ef140a6b05dfc786 {
|
|
|
30318
30313
|
|
|
30319
30314
|
const $458d407830d66110$export$e6a390ea6399b7d8 = (config, debugString, seconds)=>{
|
|
30320
30315
|
// eslint-disable-next-line no-console
|
|
30321
|
-
if (!config.isProduction) console.
|
|
30316
|
+
if (!config.isProduction) console.info(debugString, seconds);
|
|
30322
30317
|
};
|
|
30323
30318
|
const $458d407830d66110$export$5280dbcb91c8b391 = async (config, debugString, promise)=>{
|
|
30324
30319
|
const startTime = performance.now();
|
|
@@ -33559,7 +33554,7 @@ var $045213b18e9f1f94$export$75be0f6af9650f2c;
|
|
|
33559
33554
|
})($045213b18e9f1f94$export$75be0f6af9650f2c || ($045213b18e9f1f94$export$75be0f6af9650f2c = {}));
|
|
33560
33555
|
|
|
33561
33556
|
|
|
33562
|
-
const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.28.
|
|
33557
|
+
const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.28.2";
|
|
33563
33558
|
const $d663162fd5a0853f$export$83bf90b30cdfd29f = ()=>false;
|
|
33564
33559
|
const $d663162fd5a0853f$export$1169f5475725171b = ()=>$d663162fd5a0853f$export$38a083d9fb5551ca;
|
|
33565
33560
|
|
package/dist/index.d.ts
CHANGED
|
@@ -14961,6 +14961,12 @@ declare class Passport {
|
|
|
14961
14961
|
private readonly passportImxProviderFactory;
|
|
14962
14962
|
private readonly passportEventEmitter;
|
|
14963
14963
|
constructor(passportModuleConfiguration: PassportModuleConfiguration);
|
|
14964
|
+
signIn(options?: {
|
|
14965
|
+
useCachedSession: boolean;
|
|
14966
|
+
}): Promise<UserProfile | null>;
|
|
14967
|
+
/**
|
|
14968
|
+
* @deprecated The method connectImx(useCachedSession) should be used instead
|
|
14969
|
+
*/
|
|
14964
14970
|
connectImxSilent(): Promise<IMXProvider | null>;
|
|
14965
14971
|
connectImx(): Promise<IMXProvider>;
|
|
14966
14972
|
loginWithDeviceFlow(): Promise<DeviceConnectResponse>;
|
package/dist/index.js
CHANGED
|
@@ -3610,7 +3610,7 @@ class MultiRollupApiClients {
|
|
|
3610
3610
|
}
|
|
3611
3611
|
|
|
3612
3612
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
3613
|
-
const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.28.
|
|
3613
|
+
const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.28.2' };
|
|
3614
3614
|
const createConfig = ({ basePath, headers, }) => {
|
|
3615
3615
|
if (!basePath.trim()) {
|
|
3616
3616
|
throw Error('basePath can not be empty');
|
|
@@ -3670,7 +3670,7 @@ class APIError extends Error {
|
|
|
3670
3670
|
|
|
3671
3671
|
/* eslint-disable implicit-arrow-linebreak */
|
|
3672
3672
|
const defaultHeaders = {
|
|
3673
|
-
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.28.
|
|
3673
|
+
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.28.2',
|
|
3674
3674
|
};
|
|
3675
3675
|
/**
|
|
3676
3676
|
* createAPIConfiguration to create a custom Configuration
|
|
@@ -4081,7 +4081,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
|
|
|
4081
4081
|
chainID,
|
|
4082
4082
|
coreContractAddress,
|
|
4083
4083
|
registrationContractAddress,
|
|
4084
|
-
sdkVersion: 'ts-immutable-sdk-0.28.
|
|
4084
|
+
sdkVersion: 'ts-immutable-sdk-0.28.2',
|
|
4085
4085
|
});
|
|
4086
4086
|
/**
|
|
4087
4087
|
* Sets `sdkVersion` at the time of build
|
|
@@ -9728,7 +9728,7 @@ class PassportImxProviderFactory {
|
|
|
9728
9728
|
this.passportEventEmitter = passportEventEmitter;
|
|
9729
9729
|
}
|
|
9730
9730
|
async getProvider() {
|
|
9731
|
-
const user = await this.authManager.login();
|
|
9731
|
+
const user = await this.authManager.loginSilent() || await this.authManager.login();
|
|
9732
9732
|
return this.createProviderInstance(user);
|
|
9733
9733
|
}
|
|
9734
9734
|
async getProviderSilent() {
|
|
@@ -10725,6 +10725,20 @@ class Passport {
|
|
|
10725
10725
|
passportEventEmitter: this.passportEventEmitter,
|
|
10726
10726
|
});
|
|
10727
10727
|
}
|
|
10728
|
+
async signIn(options) {
|
|
10729
|
+
const { useCachedSession = false } = options || {};
|
|
10730
|
+
let user = await this.authManager.loginSilent();
|
|
10731
|
+
if (!user && !useCachedSession) {
|
|
10732
|
+
user = await this.authManager.login();
|
|
10733
|
+
}
|
|
10734
|
+
if (!user) {
|
|
10735
|
+
return null;
|
|
10736
|
+
}
|
|
10737
|
+
return user.profile;
|
|
10738
|
+
}
|
|
10739
|
+
/**
|
|
10740
|
+
* @deprecated The method connectImx(useCachedSession) should be used instead
|
|
10741
|
+
*/
|
|
10728
10742
|
async connectImxSilent() {
|
|
10729
10743
|
return this.passportImxProviderFactory.getProviderSilent();
|
|
10730
10744
|
}
|
|
@@ -25923,15 +25937,6 @@ class ApproveError extends ExchangeError {
|
|
|
25923
25937
|
super(message, ExchangeErrorCode.APPROVE_ERROR);
|
|
25924
25938
|
}
|
|
25925
25939
|
}
|
|
25926
|
-
class AlreadyApprovedError extends ExchangeError {
|
|
25927
|
-
tokenAddress;
|
|
25928
|
-
spenderAddress;
|
|
25929
|
-
constructor(amountApproved, tokenAddress, spenderAddress) {
|
|
25930
|
-
super(`already approved ${amountApproved} tokens`, ExchangeErrorCode.ALREADY_APPROVED_ERROR);
|
|
25931
|
-
this.tokenAddress = tokenAddress;
|
|
25932
|
-
this.spenderAddress = spenderAddress;
|
|
25933
|
-
}
|
|
25934
|
-
}
|
|
25935
25940
|
|
|
25936
25941
|
/* Autogenerated file. Do not edit manually. */
|
|
25937
25942
|
/* tslint:disable */
|
|
@@ -28565,8 +28570,7 @@ const calculateGasFee = (gasPrice, gasEstimate) =>
|
|
|
28565
28570
|
newAmount(gasEstimate.mul(gasPrice.value), gasPrice.token);
|
|
28566
28571
|
|
|
28567
28572
|
/**
|
|
28568
|
-
*
|
|
28569
|
-
* checking the existing allowance for the spender
|
|
28573
|
+
* Check if the spender needs approval for the token
|
|
28570
28574
|
*
|
|
28571
28575
|
* @param provider - The provider to use for the call
|
|
28572
28576
|
* @param ownerAddress - The address of the owner of the token
|
|
@@ -28574,11 +28578,11 @@ newAmount(gasEstimate.mul(gasPrice.value), gasPrice.token);
|
|
|
28574
28578
|
* @param spenderAddress - The address of the spender
|
|
28575
28579
|
* @returns - The amount of the token that needs to be approved
|
|
28576
28580
|
*/
|
|
28577
|
-
const
|
|
28581
|
+
const doesSpenderNeedApproval = async (provider, ownerAddress, tokenAmount, spenderAddress) => {
|
|
28578
28582
|
// create an instance of the ERC20 token contract
|
|
28579
28583
|
const erc20Contract = ERC20__factory.connect(tokenAmount.token.address, provider);
|
|
28580
28584
|
// get the allowance for the token spender
|
|
28581
|
-
// minimum is 0 - no allowance
|
|
28585
|
+
// the minimum allowance is 0 - no allowance
|
|
28582
28586
|
let allowance;
|
|
28583
28587
|
try {
|
|
28584
28588
|
allowance = await erc20Contract.allowance(ownerAddress, spenderAddress);
|
|
@@ -28587,12 +28591,12 @@ const getERC20AmountToApprove = async (provider, ownerAddress, tokenAmount, spen
|
|
|
28587
28591
|
const message = e instanceof Error ? e.message : 'Unknown Error';
|
|
28588
28592
|
throw new ApproveError(`failed to get allowance: ${message}`);
|
|
28589
28593
|
}
|
|
28590
|
-
//
|
|
28594
|
+
// check if approval is needed
|
|
28591
28595
|
const requiredAmount = tokenAmount.value.sub(allowance);
|
|
28592
28596
|
if (requiredAmount.isNegative() || requiredAmount.isZero()) {
|
|
28593
|
-
|
|
28597
|
+
return false;
|
|
28594
28598
|
}
|
|
28595
|
-
return
|
|
28599
|
+
return true;
|
|
28596
28600
|
};
|
|
28597
28601
|
/**
|
|
28598
28602
|
* Get an unsigned ERC20 approve transaction
|
|
@@ -28634,18 +28638,9 @@ const prepareApproval = (tradeType, userSpecifiedAmount, quotedAmountWithSlippag
|
|
|
28634
28638
|
* @returns The unsigned ERC20 approve transaction, or null if no approval is needed
|
|
28635
28639
|
*/
|
|
28636
28640
|
const getApproveTransaction = async (provider, ownerAddress, tokenAmount, spenderAddress) => {
|
|
28637
|
-
|
|
28638
|
-
|
|
28639
|
-
|
|
28640
|
-
}
|
|
28641
|
-
catch (e) {
|
|
28642
|
-
if (e instanceof AlreadyApprovedError) {
|
|
28643
|
-
// already approved for the required amount, nothing to do
|
|
28644
|
-
return null;
|
|
28645
|
-
}
|
|
28646
|
-
throw e;
|
|
28647
|
-
}
|
|
28648
|
-
return getUnsignedERC20ApproveTransaction(ownerAddress, amountToApprove, spenderAddress);
|
|
28641
|
+
const needsApproval = await doesSpenderNeedApproval(provider, ownerAddress, tokenAmount, spenderAddress);
|
|
28642
|
+
// @dev approvals are not additive, so we need to approve the full amount
|
|
28643
|
+
return needsApproval ? getUnsignedERC20ApproveTransaction(ownerAddress, tokenAmount, spenderAddress) : null;
|
|
28649
28644
|
};
|
|
28650
28645
|
async function getApproveGasEstimate(provider, ownerAddress, spenderAddress, tokenAddress) {
|
|
28651
28646
|
const erc20Contract = ERC20__factory.connect(tokenAddress, provider);
|
|
@@ -30296,7 +30291,7 @@ class $fd8a8472dcc3ec2b$export$ef140a6b05dfc786 {
|
|
|
30296
30291
|
|
|
30297
30292
|
const $458d407830d66110$export$e6a390ea6399b7d8 = (config, debugString, seconds)=>{
|
|
30298
30293
|
// eslint-disable-next-line no-console
|
|
30299
|
-
if (!config.isProduction) console.
|
|
30294
|
+
if (!config.isProduction) console.info(debugString, seconds);
|
|
30300
30295
|
};
|
|
30301
30296
|
const $458d407830d66110$export$5280dbcb91c8b391 = async (config, debugString, promise)=>{
|
|
30302
30297
|
const startTime = performance.now();
|
|
@@ -33537,7 +33532,7 @@ var $045213b18e9f1f94$export$75be0f6af9650f2c;
|
|
|
33537
33532
|
})($045213b18e9f1f94$export$75be0f6af9650f2c || ($045213b18e9f1f94$export$75be0f6af9650f2c = {}));
|
|
33538
33533
|
|
|
33539
33534
|
|
|
33540
|
-
const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.28.
|
|
33535
|
+
const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.28.2";
|
|
33541
33536
|
const $d663162fd5a0853f$export$83bf90b30cdfd29f = ()=>false;
|
|
33542
33537
|
const $d663162fd5a0853f$export$1169f5475725171b = ()=>$d663162fd5a0853f$export$38a083d9fb5551ca;
|
|
33543
33538
|
|
package/dist/passport.d.ts
CHANGED
|
@@ -10608,6 +10608,12 @@ declare class Passport {
|
|
|
10608
10608
|
private readonly passportImxProviderFactory;
|
|
10609
10609
|
private readonly passportEventEmitter;
|
|
10610
10610
|
constructor(passportModuleConfiguration: PassportModuleConfiguration);
|
|
10611
|
+
signIn(options?: {
|
|
10612
|
+
useCachedSession: boolean;
|
|
10613
|
+
}): Promise<UserProfile | null>;
|
|
10614
|
+
/**
|
|
10615
|
+
* @deprecated The method connectImx(useCachedSession) should be used instead
|
|
10616
|
+
*/
|
|
10611
10617
|
connectImxSilent(): Promise<IMXProvider | null>;
|
|
10612
10618
|
connectImx(): Promise<IMXProvider>;
|
|
10613
10619
|
loginWithDeviceFlow(): Promise<DeviceConnectResponse>;
|
package/dist/passport.js
CHANGED
|
@@ -2072,7 +2072,7 @@ class MultiRollupApiClients {
|
|
|
2072
2072
|
}
|
|
2073
2073
|
|
|
2074
2074
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
2075
|
-
const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-0.28.
|
|
2075
|
+
const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-0.28.2' };
|
|
2076
2076
|
const createConfig = ({ basePath, headers, }) => {
|
|
2077
2077
|
if (!basePath.trim()) {
|
|
2078
2078
|
throw Error('basePath can not be empty');
|
|
@@ -2128,7 +2128,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
|
|
|
2128
2128
|
chainID,
|
|
2129
2129
|
coreContractAddress,
|
|
2130
2130
|
registrationContractAddress,
|
|
2131
|
-
sdkVersion: 'ts-immutable-sdk-0.28.
|
|
2131
|
+
sdkVersion: 'ts-immutable-sdk-0.28.2',
|
|
2132
2132
|
});
|
|
2133
2133
|
/**
|
|
2134
2134
|
* Sets `sdkVersion` at the time of build
|
|
@@ -7758,7 +7758,7 @@ class PassportImxProviderFactory {
|
|
|
7758
7758
|
this.passportEventEmitter = passportEventEmitter;
|
|
7759
7759
|
}
|
|
7760
7760
|
async getProvider() {
|
|
7761
|
-
const user = await this.authManager.login();
|
|
7761
|
+
const user = await this.authManager.loginSilent() || await this.authManager.login();
|
|
7762
7762
|
return this.createProviderInstance(user);
|
|
7763
7763
|
}
|
|
7764
7764
|
async getProviderSilent() {
|
|
@@ -8755,6 +8755,20 @@ class Passport {
|
|
|
8755
8755
|
passportEventEmitter: this.passportEventEmitter,
|
|
8756
8756
|
});
|
|
8757
8757
|
}
|
|
8758
|
+
async signIn(options) {
|
|
8759
|
+
const { useCachedSession = false } = options || {};
|
|
8760
|
+
let user = await this.authManager.loginSilent();
|
|
8761
|
+
if (!user && !useCachedSession) {
|
|
8762
|
+
user = await this.authManager.login();
|
|
8763
|
+
}
|
|
8764
|
+
if (!user) {
|
|
8765
|
+
return null;
|
|
8766
|
+
}
|
|
8767
|
+
return user.profile;
|
|
8768
|
+
}
|
|
8769
|
+
/**
|
|
8770
|
+
* @deprecated The method connectImx(useCachedSession) should be used instead
|
|
8771
|
+
*/
|
|
8758
8772
|
async connectImxSilent() {
|
|
8759
8773
|
return this.passportImxProviderFactory.getProviderSilent();
|
|
8760
8774
|
}
|
package/package.json
CHANGED