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
d9a78da1d3
commit
03df126955
|
@ -61,13 +61,15 @@ SQUtils.QObject {
|
|||
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();
|
||||
})
|
||||
if (!validAccount) {
|
||||
console.warn("SessionRequestResolver - resolveEvent - invalid account", request.account)
|
||||
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 }
|
||||
} catch (e) {
|
||||
|
|
Loading…
Reference in New Issue