protected void UpdateBalance() { WalletManager.GetBalance((balance) => { // When the callback is called, print out the balance on UI text Debug.LogFormat("MyWalletBalanceDemo:Start - WalletManager.GetBalance() returned, balance={0}", balance); _balanceEthText.text = balance.ToString(); }); }
private void Start() { // Get balance with EthGetBalanceUnityRequest in WalletManager, using coroutine WalletManager.GetBalance(_address, (balance) => { // When the callback is called, print out the balance on UI text Debug.LogFormat("StaticWalletBalance:Start - EthGetBalanceUnityRequest returned, balance={0}", balance); _balanceUnityRequestText.text = balance.ToString(); }); // Get balance with Web3, using Task and await var t = GetBalanceByWeb3(_address, (balance) => // Put result as var t just to avoid warning in VisualStudio { // When the callback is called, print out the balance on UI text Debug.LogFormat("StaticWalletBalance:Start - Web3 returned, balance={0}", balance); _balanceWeb3Text.text = balance.ToString(); }); }