Unlock Account (Login)
Exist Account Login again
Please update SDK after v3.1.5 and use UnlockAccount with `account.publicKey or `generateKeyPair` with `account.publicKey`
Step 1: GET Account info by address
const account = LoopringAPI.exchangeAPI.getAccount({
owner: accounStore.accAddress,
})
Step 2: Nonce & keySeed
const nonce = account ? account.nonce : accounStore.nonce;
const msg =
account.keySeed && account.keySeed !== ""
? account.keySeed
: sdk.GlobalAPI.KEY_MESSAGE.replace(
"${exchangeAddress}",
LOOPRING_EXPORTED_ACCOUNT.exchangeAddress
).replace("${nonce}", (nonce - 1).toString());
Step 3: UnlockAccount
const response = await LoopringAPI.userAPI.unLockAccount(
{
keyPair: {
web3: connectProvides.usedWeb3 as unknown as Web3,
address: account.owner,
keySeed: msg,
walletType: connectName,
chainId: Number(chainId),
accountId: Number(account.accountId),
isMobile: isMobile,
},
request: {
accountId: account.accountId,
},
},
account.publicKey
);