Connecting to Wallet
How to connect to WELLDONE Wallet
You must first request a connection to your WELLDONE Wallet to utilize in a dApp. A webpage can connect to your WELLDONE Wallet using the methods listed below, and once connected, a user in your wallet can grant you access to your account.
window.dapp.request(chainName: string, { method: "dapp:accounts" }
When you execute this method, a pop-up window opens asking for your approval. If the user hits Deny or closes the window, the connection request is refused with an error; if the user clicks Accept, the method returns a Promise object containing the address and public key information for the account corresponding to the chainName
.
The method asks for connections to all networks registered on the WELLDONE Wallet at the same time. In other words, if younrequest with ethereum
in chainName
, you will be automatically granted access to the cosmos
or other chains, in addition to ethereum
. If the webpage is already linked to your wallet, it imports the information from your account without asking further authorization.
The example that illustrates the object returned when providing ethereum
as an argument in chainName
is shown below.
{ "ethereum": { "address": "0x....", "pubKey": "0x...." } }
WELLDONE Wallet currently only supports one address/public key pair per chainID. If there are no accounts in each network, the method produces an empty object.
Example
A basic example of connecting to a WELLDONE Wallet to obtain information about an Ethereum account. Press the Connect Wallet
button to send the dapp:accounts
method to connect to your wallet and retrieve your account's address and public key.