Open woniesong92 opened 6 years ago
Do you mean that you want to get an notification when an wallet is unlocked, or just to get the wallet address that has been unlocked?
Both would be nice. In Metamask, you can check the accounts
array and see if it's empty to know if the user has unlocked their wallet. Using this, people can show the warning sign "Please unlock your wallet in Metamask before using our dapp."
What I want is user's pubkey who call some contract api, or pubkey of any address. I wrote a dapp, which stored encrypted data in that smart contract. I want to use user's pubkey to encrypt the data, and let user decrypt it by privatekey. Could you add caller's pubkey to smartcontract's Blockchain.transaction object?
I think if you add this feature, dapp developers can do more things by smart-contract
Thanks for your advice! I will discuss about this with my colleagues later.
@zoowii wallet address is your public key #6 You can get it by such js code
window.postMessage({ "target": "contentscript", "data":{}, "method": "getAccount", }, "*");
window.addEventListener('message', function(e) { try{ var user_account = e.data.data.account; console.log(user_account); }catch (e) { } });
@hostgame nebulas's address is not same with public key, event decode them to integers
Also, is there a way to detect whether the user has unlocked a wallet?