set depreacted metamask fields

Signed-off-by: Andrea Maria Piana <andrea.maria.piana@gmail.com>
This commit is contained in:
Andrea Maria Piana 2021-05-27 10:48:39 +02:00
parent 3207300e02
commit e4e9556303
No known key found for this signature in database
GPG Key ID: AA6CCA6DE0E06424
1 changed files with 7 additions and 1 deletions

View File

@ -83,7 +83,10 @@
qrCodeResponse(data, callback); qrCodeResponse(data, callback);
} else if (data.isAllowed) { } else if (data.isAllowed) {
if (data.permission == 'web3') { if (data.permission == 'web3') {
window.statusAppcurrentAccountAddress = data.data[0]; var selectedAddress = data.data[0]
window.statusAppcurrentAccountAddress = selectedAddress;
// Set deprecated metamask fields
window.ethereum.selectedAddress = selectedAddress;
window.ethereum.emit("accountsChanged", data.data); window.ethereum.emit("accountsChanged", data.data);
} }
callback.resolve(data.data); callback.resolve(data.data);
@ -152,6 +155,9 @@
EthereumProvider.prototype.isStatus = true; EthereumProvider.prototype.isStatus = true;
EthereumProvider.prototype.status = new StatusAPI(); EthereumProvider.prototype.status = new StatusAPI();
EthereumProvider.prototype.isConnected = function () { return true; }; EthereumProvider.prototype.isConnected = function () { return true; };
// Set legacy metamask fields https://docs.metamask.io/guide/ethereum-provider.html#legacy-api
EthereumProvider.prototype.networkVersion = window.statusAppNetworkId;
EthereumProvider.prototype.chainId = "0x" + window.statusAppNetworkId.toString(16);
EthereumProvider.prototype._events = {}; EthereumProvider.prototype._events = {};