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.
arkaneConnect.api.getBalance("<WALLET_ID>");
const arkaneConnect = new ArkaneConnect('YOUR_CLIENT_ID');arkaneConnect.api.getBalance("d91b644a-076f-44bf-ae90-29251df19784").then((balance) => {console.log("The balance is",balance.balance);})
{available: truebalance: 0.0012decimals: 18gasBalance: 0.0012gasSymbol: "ETH"rawBalance: "1200000000000000"rawGasBalance: "1200000000000000"secretType: "ETHEREUM"symbol: "ETH"}
The function reference describes the different functions that are available in the Widget. For each function you can find the signature, its parameters, and possible options documented.