nebulasio / WebExtensionWallet

170 stars 58 forks source link

how to get user's wallet address? #6

Open qazujmko opened 6 years ago

yupnano commented 6 years ago

there is two methods for the present: 1 Set a input box on your page, and let user paste their wallet address. 2 You can get user wallet address by posting a message to webExtensionWallet. This feature is supported at the very beginning, and still reserved for now. You can learn how to use this feature from the example/example_old.html (We are planning to discard this feature and only NebPay API will be supported.)

ladyrick commented 6 years ago

可以在自己的合约中定义函数

function whoami(){
    return Blockchain.transaction.from;
}

然后发起交易调用这个函数,即可获取自己的钱包地址。


于是,情况就变成,WebExtensionWallet明知道我的钱包地址,却不告诉我,导致我只好给服务器发交易。 所以,我认为,没必要阻止用户在本地获取自己的钱包地址,免得白白给服务器增加负担。