@imtbl/sdk 0.28.0 → 0.28.1-alpha
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 +9 -1
- package/dist/checkout_sdk.js +10 -29
- package/dist/checkout_widgets.d.ts +9 -1
- package/dist/checkout_widgets.js +1 -1
- package/dist/global.d.ts +42 -0
- 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 +33 -34
- package/dist/index.d.ts +9 -1
- package/dist/index.js +33 -34
- package/dist/passport.d.ts +9 -1
- package/dist/passport.js +22 -4
- 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.1-alpha' };
|
|
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.1-alpha',
|
|
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.1-alpha',
|
|
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,10 +10747,28 @@ 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
|
}
|
|
10753
|
-
async connectImx() {
|
|
10767
|
+
async connectImx(options) {
|
|
10768
|
+
const { useCachedSession = false } = options || {};
|
|
10769
|
+
if (useCachedSession) {
|
|
10770
|
+
return this.passportImxProviderFactory.getProviderSilent();
|
|
10771
|
+
}
|
|
10754
10772
|
return this.passportImxProviderFactory.getProvider();
|
|
10755
10773
|
}
|
|
10756
10774
|
async loginWithDeviceFlow() {
|
|
@@ -25945,15 +25963,6 @@ class ApproveError extends ExchangeError {
|
|
|
25945
25963
|
super(message, ExchangeErrorCode.APPROVE_ERROR);
|
|
25946
25964
|
}
|
|
25947
25965
|
}
|
|
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
25966
|
|
|
25958
25967
|
/* Autogenerated file. Do not edit manually. */
|
|
25959
25968
|
/* tslint:disable */
|
|
@@ -28587,8 +28596,7 @@ const calculateGasFee = (gasPrice, gasEstimate) =>
|
|
|
28587
28596
|
newAmount(gasEstimate.mul(gasPrice.value), gasPrice.token);
|
|
28588
28597
|
|
|
28589
28598
|
/**
|
|
28590
|
-
*
|
|
28591
|
-
* checking the existing allowance for the spender
|
|
28599
|
+
* Check if the spender needs approval for the token
|
|
28592
28600
|
*
|
|
28593
28601
|
* @param provider - The provider to use for the call
|
|
28594
28602
|
* @param ownerAddress - The address of the owner of the token
|
|
@@ -28596,11 +28604,11 @@ newAmount(gasEstimate.mul(gasPrice.value), gasPrice.token);
|
|
|
28596
28604
|
* @param spenderAddress - The address of the spender
|
|
28597
28605
|
* @returns - The amount of the token that needs to be approved
|
|
28598
28606
|
*/
|
|
28599
|
-
const
|
|
28607
|
+
const doesSpenderNeedApproval = async (provider, ownerAddress, tokenAmount, spenderAddress) => {
|
|
28600
28608
|
// create an instance of the ERC20 token contract
|
|
28601
28609
|
const erc20Contract = ERC20__factory.connect(tokenAmount.token.address, provider);
|
|
28602
28610
|
// get the allowance for the token spender
|
|
28603
|
-
// minimum is 0 - no allowance
|
|
28611
|
+
// the minimum allowance is 0 - no allowance
|
|
28604
28612
|
let allowance;
|
|
28605
28613
|
try {
|
|
28606
28614
|
allowance = await erc20Contract.allowance(ownerAddress, spenderAddress);
|
|
@@ -28609,12 +28617,12 @@ const getERC20AmountToApprove = async (provider, ownerAddress, tokenAmount, spen
|
|
|
28609
28617
|
const message = e instanceof Error ? e.message : 'Unknown Error';
|
|
28610
28618
|
throw new ApproveError(`failed to get allowance: ${message}`);
|
|
28611
28619
|
}
|
|
28612
|
-
//
|
|
28620
|
+
// check if approval is needed
|
|
28613
28621
|
const requiredAmount = tokenAmount.value.sub(allowance);
|
|
28614
28622
|
if (requiredAmount.isNegative() || requiredAmount.isZero()) {
|
|
28615
|
-
|
|
28623
|
+
return false;
|
|
28616
28624
|
}
|
|
28617
|
-
return
|
|
28625
|
+
return true;
|
|
28618
28626
|
};
|
|
28619
28627
|
/**
|
|
28620
28628
|
* Get an unsigned ERC20 approve transaction
|
|
@@ -28656,18 +28664,9 @@ const prepareApproval = (tradeType, userSpecifiedAmount, quotedAmountWithSlippag
|
|
|
28656
28664
|
* @returns The unsigned ERC20 approve transaction, or null if no approval is needed
|
|
28657
28665
|
*/
|
|
28658
28666
|
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);
|
|
28667
|
+
const needsApproval = await doesSpenderNeedApproval(provider, ownerAddress, tokenAmount, spenderAddress);
|
|
28668
|
+
// @dev approvals are not additive, so we need to approve the full amount
|
|
28669
|
+
return needsApproval ? getUnsignedERC20ApproveTransaction(ownerAddress, tokenAmount, spenderAddress) : null;
|
|
28671
28670
|
};
|
|
28672
28671
|
async function getApproveGasEstimate(provider, ownerAddress, spenderAddress, tokenAddress) {
|
|
28673
28672
|
const erc20Contract = ERC20__factory.connect(tokenAddress, provider);
|
|
@@ -33559,7 +33558,7 @@ var $045213b18e9f1f94$export$75be0f6af9650f2c;
|
|
|
33559
33558
|
})($045213b18e9f1f94$export$75be0f6af9650f2c || ($045213b18e9f1f94$export$75be0f6af9650f2c = {}));
|
|
33560
33559
|
|
|
33561
33560
|
|
|
33562
|
-
const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.28.
|
|
33561
|
+
const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.28.1-alpha";
|
|
33563
33562
|
const $d663162fd5a0853f$export$83bf90b30cdfd29f = ()=>false;
|
|
33564
33563
|
const $d663162fd5a0853f$export$1169f5475725171b = ()=>$d663162fd5a0853f$export$38a083d9fb5551ca;
|
|
33565
33564
|
|
package/dist/index.d.ts
CHANGED
|
@@ -14961,8 +14961,16 @@ 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
|
-
connectImx(
|
|
14971
|
+
connectImx(options?: {
|
|
14972
|
+
useCachedSession: boolean;
|
|
14973
|
+
}): Promise<IMXProvider | null>;
|
|
14966
14974
|
loginWithDeviceFlow(): Promise<DeviceConnectResponse>;
|
|
14967
14975
|
connectImxDeviceFlow(deviceCode: string, interval: number, timeoutMs?: number): Promise<IMXProvider | null>;
|
|
14968
14976
|
getPKCEAuthorizationUrl(): string;
|
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.1-alpha' };
|
|
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.1-alpha',
|
|
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.1-alpha',
|
|
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,10 +10725,28 @@ 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
|
}
|
|
10731
|
-
async connectImx() {
|
|
10745
|
+
async connectImx(options) {
|
|
10746
|
+
const { useCachedSession = false } = options || {};
|
|
10747
|
+
if (useCachedSession) {
|
|
10748
|
+
return this.passportImxProviderFactory.getProviderSilent();
|
|
10749
|
+
}
|
|
10732
10750
|
return this.passportImxProviderFactory.getProvider();
|
|
10733
10751
|
}
|
|
10734
10752
|
async loginWithDeviceFlow() {
|
|
@@ -25923,15 +25941,6 @@ class ApproveError extends ExchangeError {
|
|
|
25923
25941
|
super(message, ExchangeErrorCode.APPROVE_ERROR);
|
|
25924
25942
|
}
|
|
25925
25943
|
}
|
|
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
25944
|
|
|
25936
25945
|
/* Autogenerated file. Do not edit manually. */
|
|
25937
25946
|
/* tslint:disable */
|
|
@@ -28565,8 +28574,7 @@ const calculateGasFee = (gasPrice, gasEstimate) =>
|
|
|
28565
28574
|
newAmount(gasEstimate.mul(gasPrice.value), gasPrice.token);
|
|
28566
28575
|
|
|
28567
28576
|
/**
|
|
28568
|
-
*
|
|
28569
|
-
* checking the existing allowance for the spender
|
|
28577
|
+
* Check if the spender needs approval for the token
|
|
28570
28578
|
*
|
|
28571
28579
|
* @param provider - The provider to use for the call
|
|
28572
28580
|
* @param ownerAddress - The address of the owner of the token
|
|
@@ -28574,11 +28582,11 @@ newAmount(gasEstimate.mul(gasPrice.value), gasPrice.token);
|
|
|
28574
28582
|
* @param spenderAddress - The address of the spender
|
|
28575
28583
|
* @returns - The amount of the token that needs to be approved
|
|
28576
28584
|
*/
|
|
28577
|
-
const
|
|
28585
|
+
const doesSpenderNeedApproval = async (provider, ownerAddress, tokenAmount, spenderAddress) => {
|
|
28578
28586
|
// create an instance of the ERC20 token contract
|
|
28579
28587
|
const erc20Contract = ERC20__factory.connect(tokenAmount.token.address, provider);
|
|
28580
28588
|
// get the allowance for the token spender
|
|
28581
|
-
// minimum is 0 - no allowance
|
|
28589
|
+
// the minimum allowance is 0 - no allowance
|
|
28582
28590
|
let allowance;
|
|
28583
28591
|
try {
|
|
28584
28592
|
allowance = await erc20Contract.allowance(ownerAddress, spenderAddress);
|
|
@@ -28587,12 +28595,12 @@ const getERC20AmountToApprove = async (provider, ownerAddress, tokenAmount, spen
|
|
|
28587
28595
|
const message = e instanceof Error ? e.message : 'Unknown Error';
|
|
28588
28596
|
throw new ApproveError(`failed to get allowance: ${message}`);
|
|
28589
28597
|
}
|
|
28590
|
-
//
|
|
28598
|
+
// check if approval is needed
|
|
28591
28599
|
const requiredAmount = tokenAmount.value.sub(allowance);
|
|
28592
28600
|
if (requiredAmount.isNegative() || requiredAmount.isZero()) {
|
|
28593
|
-
|
|
28601
|
+
return false;
|
|
28594
28602
|
}
|
|
28595
|
-
return
|
|
28603
|
+
return true;
|
|
28596
28604
|
};
|
|
28597
28605
|
/**
|
|
28598
28606
|
* Get an unsigned ERC20 approve transaction
|
|
@@ -28634,18 +28642,9 @@ const prepareApproval = (tradeType, userSpecifiedAmount, quotedAmountWithSlippag
|
|
|
28634
28642
|
* @returns The unsigned ERC20 approve transaction, or null if no approval is needed
|
|
28635
28643
|
*/
|
|
28636
28644
|
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);
|
|
28645
|
+
const needsApproval = await doesSpenderNeedApproval(provider, ownerAddress, tokenAmount, spenderAddress);
|
|
28646
|
+
// @dev approvals are not additive, so we need to approve the full amount
|
|
28647
|
+
return needsApproval ? getUnsignedERC20ApproveTransaction(ownerAddress, tokenAmount, spenderAddress) : null;
|
|
28649
28648
|
};
|
|
28650
28649
|
async function getApproveGasEstimate(provider, ownerAddress, spenderAddress, tokenAddress) {
|
|
28651
28650
|
const erc20Contract = ERC20__factory.connect(tokenAddress, provider);
|
|
@@ -33537,7 +33536,7 @@ var $045213b18e9f1f94$export$75be0f6af9650f2c;
|
|
|
33537
33536
|
})($045213b18e9f1f94$export$75be0f6af9650f2c || ($045213b18e9f1f94$export$75be0f6af9650f2c = {}));
|
|
33538
33537
|
|
|
33539
33538
|
|
|
33540
|
-
const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.28.
|
|
33539
|
+
const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.28.1-alpha";
|
|
33541
33540
|
const $d663162fd5a0853f$export$83bf90b30cdfd29f = ()=>false;
|
|
33542
33541
|
const $d663162fd5a0853f$export$1169f5475725171b = ()=>$d663162fd5a0853f$export$38a083d9fb5551ca;
|
|
33543
33542
|
|
package/dist/passport.d.ts
CHANGED
|
@@ -10608,8 +10608,16 @@ 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
|
-
connectImx(
|
|
10618
|
+
connectImx(options?: {
|
|
10619
|
+
useCachedSession: boolean;
|
|
10620
|
+
}): Promise<IMXProvider | null>;
|
|
10613
10621
|
loginWithDeviceFlow(): Promise<DeviceConnectResponse>;
|
|
10614
10622
|
connectImxDeviceFlow(deviceCode: string, interval: number, timeoutMs?: number): Promise<IMXProvider | null>;
|
|
10615
10623
|
getPKCEAuthorizationUrl(): string;
|
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.1-alpha' };
|
|
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.1-alpha',
|
|
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,10 +8755,28 @@ 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
|
}
|
|
8761
|
-
async connectImx() {
|
|
8775
|
+
async connectImx(options) {
|
|
8776
|
+
const { useCachedSession = false } = options || {};
|
|
8777
|
+
if (useCachedSession) {
|
|
8778
|
+
return this.passportImxProviderFactory.getProviderSilent();
|
|
8779
|
+
}
|
|
8762
8780
|
return this.passportImxProviderFactory.getProvider();
|
|
8763
8781
|
}
|
|
8764
8782
|
async loginWithDeviceFlow() {
|
package/package.json
CHANGED