Retrieve wallet balance
How to retrieve the native balance of a wallet
To fetch the balance of a wallet of a certain user you need to call the function getBalance, which will return a promise containing a WalletBalance object.
πŸ§™ If you only want to retrieve the balance of a user's wallet then getBalance is the perfect function, but if you also need to fetch his wallets or get some profile information, and maybe even need to authenticate the user, then it is recommended to retrieve the user account.

Function

1
venlyConnect.api.getBalance("<WALLET_ID>");
Copied!

Example

1
const venlyConnect = new VenlyConnect('YOUR_CLIENT_ID');
2
venlyConnect.api.getBalance("d91b644a-076f-44bf-ae90-29251df19784").then((balance) => {
3
console.log("The balance is",balance.balance);
4
})
Copied!

Returns

1
{
2
available: true
3
balance: 0.0012
4
decimals: 18
5
gasBalance: 0.0012
6
gasSymbol: "ETH"
7
rawBalance: "1200000000000000"
8
rawGasBalance: "1200000000000000"
9
secretType: "ETHEREUM"
10
symbol: "ETH"
11
}
Copied!

Function Reference

The function reference describes the different functions that are available in the Widget. For each function you can find the signature, it's parameters, and possible options documented.
Last modified 7d ago