Skip to main content

Methods

1. dapp:accounts

This method is used to request a wallet connection. A website can use this function to request a connection to your wallet, and if the user in the wallet approves the connection, the website can access your account. This approach asks for connections to all chains at the same time. In other words, if you make a request with ethereum in chainName, you will be granted access to the cosmos or other networks. If the webpage is already linked to your wallet, it imports the information from your account without asking for your additional authorization.

Params

The method takes the following input argument as a chainName.

type CHAIN_NAME = 'celestia' | 'celo' | 'cosmos' | 'ethereum' | 'juno' | 'klaytn' | 'near' | 'neon' | 'solana';

const account = await window.dapp.request(CHAIN_NAME, { method: "dapp:accounts" })

Returns

The method returns the Promise object with an address and pubKey value with the given chain account. WELLDONE Wallet currently only supports one address/public key pair per chainID

{ "ethereum": { "address": "0x....", "pubKey": "0x...." } }

Example

This example is to query the account information of Ethereum from your WELLDONE Wallet.

Live Editor
Result
Loading...

2. dapp:getBalance

This method returns the balance of the address.

Params

This method takes the network and account information to query balance as an argument.

type CHAIN_NAME = 'celestia' | 'celo' | 'cosmos' | 'ethereum' | 'juno' | 'klaytn' | 'near' | 'neon' | 'solana';
type ACCOUNTS = string;

const response = await window.dapp.request(CHAIN_NAME, {
method: 'dapp:getBalance',
params: [ACCOUNTS],
});

Returns

The method returns the balance of the address as a string type Promise object.

Promise<string>;

Example

This example is to query balance from the Ethereum account.

Live Editor
Result
Loading...

3. dapp:addChain

This method is to be utilized when adding other networks on the WELLDONE wallet. For the earlier release of WELLDONE wallet, it supports Ethereum, Cosmos and Solana. We are planning to support more networks for future releases.

tip

WELLDONE Studio operates AddChain to add networks to your wallet, as well as the directly using dapp:addChain method. More details may be found here.

Params

The method takes chainName and chainData that designates the network that you are going to add. See more information that you are required to pass on params for the following sections.

type CHAIN_NAME = 'cosmos' | 'ethereum' | 'solana';

await window.dapp.request(chainName: ChainName, (
method: "dapp:addChain",
params: [chainData]
))

Example

The following is a simple example that adds Ubiq network that is EVM compatible.

Live Editor
Result
Loading...

4. dapp:switchChain

This is the method that switch the network in the chain.

Params

The method takes CHAIN_NAME which is the name of the chain to change the network and NETWORK_ID of the network.

type CHAIN_NAME = 'celestia' | 'celo' | 'cosmos' | 'ethereum' | 'juno' | 'klaytn' | 'near' | 'neon' | 'solana';
type NETWORK_ID = string;

const response = await window.dapp.request(CHAIN_NAME, {
method: 'dapp:switchChain',
params: [NETWORK_ID],
});

Example

The following is an example of switching the network to Goerli Testnet in Ethereum.

Live Editor
Result
Loading...

5. dapp:signMessage

This is the method for signing messages.

Params

The method takes the name of the chain CHAIN_NAME and the message MESSAGE you want to sign as parameters in string type.

type CHAIN_NAME = 'celestia' | 'celo' | 'cosmos' | 'ethereum' | 'juno' | 'klaytn' | 'near' | 'neon' | 'solana';
type MESSAGE = string;

const response = await window.dapp.request(CHAIN_NAME, {
method: 'dapp:signMessage',
params: [MESSAGE],
});

Returns

The method returns the Promise object array including signature value that signed the transaction and the publicKey used for signing.

Promise<[{ signature: string; publicKey: string }]>;

Example

The following is an example of signing messages in Ethereum. You can verify returned signature using Verify Signature feature in Etherscan.

Live Editor
Result
Loading...

6. dapp:signTransaction

This is the method for signing transactions.

Params

The method takes the name of the chain CHAIN_NAME and the transaction HEX_STRING_TX_DATA you want to sign as parameters in string type. Because a transaction format differs by the network, WELLDONE Wallet takes the input transaction in HEX string type.

info

You can put the transaction objects as they are in EVM networks.

type CHAIN_NAME = 'celestia' | 'celo' | 'cosmos' | 'ethereum' | 'juno' | 'klaytn' | 'near' | 'neon' | 'solana';
type HEX_STRING_TX_DATA = string;

const response = await window.dapp.request(CHAIN_NAME, {
method: 'dapp:signTransaction',
params: [HEX_STRING_TX_DATA],
});

Returns

The method returns the Promise object array including signature value that signed the transaction and the publicKey used for signing.

Promise<[{ signature: string; publicKey: string }]>;

Example

The following is an example of a signing a transaction in Ethereum.

Live Editor
Result
Loading...

7. dapp:signAndSendTransaction

This is the method that signs and sends the transaction. From simple token transfer to contract deployment and change the state of the blockchain, this method can be used. You can send multiple transactions as well as one transaction. The WELLDONE Wallet finds and imports networks associated with that wallet address. Before submitting a transaction, you should evaluate whether to transmit it to the mainnet or the testnet.

Params

CHAIN NAME and HEX_STRING_TX_DATA are two parameters. CHAIN_NAME is the name of the network to which you wish to add, and HEX_STRING_TX_DATA is the value of converting the transaction to a HEX string type. Because a transaction format differs by networks, WELLDONE Wallet executes the transaction by taking the input argument in hex string type then translate it to compatible to the targeted network.

info

You can put the transaction objects as they are in EVM networks.

type CHAIN_NAME = 'celestia' | 'celo' | 'cosmos' | 'ethereum' | 'juno' | 'klaytn' | 'near' | 'neon' | 'solana';
type HEX_STRING_TX_DATA = 'string';

const response = await window.dapp.request(CHAIN_NAME, {
method: 'dapp:signAndSendTransaction',
params: [HEX_STRING_TX_DATA],
});

The following sections for each network provide details of what needs to be communicated to the HEX_STRING_TX_DATA.

Returns

This method returns the transaction hash value as a Promise object of type string because you can send multiple transactions as well as one transaction.

Promise<string[]>;

Example

The following is an example of sending a transaction on Ethereum network. A faucet is required to transmit a transaction. The following URL will send you a tap of the Ethereum Goerli testnet token.

Live Editor
Result
Loading...