fix(WalletConnect): Fix the parsed account in the session request
The account in the session request composed by the dApp can have a different case from what Status is using. When resolving the session request the account address will be replaced with the one from the account model.
This commit is contained in:
parent
00fb1ff60a
commit
f60c3321ce
|
@ -61,13 +61,15 @@ SQUtils.QObject {
|
||||||
return { request: null, error: SessionRequest.InvalidChainId }
|
return { request: null, error: SessionRequest.InvalidChainId }
|
||||||
}
|
}
|
||||||
|
|
||||||
const validAccount = !!SQUtils.ModelUtils.getFirstModelEntryIf(accountsModel, (account) => {
|
const validAccount = SQUtils.ModelUtils.getFirstModelEntryIf(accountsModel, (account) => {
|
||||||
return account.address.toLowerCase() === request.account.toLowerCase();
|
return account.address.toLowerCase() === request.account.toLowerCase();
|
||||||
})
|
})
|
||||||
if (!validAccount) {
|
if (!validAccount) {
|
||||||
console.warn("SessionRequestResolver - resolveEvent - invalid account", request.account)
|
console.warn("SessionRequestResolver - resolveEvent - invalid account", request.account)
|
||||||
return { request: null, error: SessionRequest.InvalidAccount }
|
return { request: null, error: SessionRequest.InvalidAccount }
|
||||||
}
|
}
|
||||||
|
// Override the account with the validated one to always match the case
|
||||||
|
request.account = validAccount.address
|
||||||
|
|
||||||
return { request, error: SessionRequest.NoError }
|
return { request, error: SessionRequest.NoError }
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
Loading…
Reference in New Issue