/// <summary> /// Updates this asset balance belonging in the user's wallet. /// </summary> public void UpdateBalance() { GetBalance(userWalletManager.GetWalletAddress(), balance => { bool changed = balance != AssetBalance; AssetBalance = balance; if (changed) { OnAssetBalanceChanged?.Invoke(AssetBalance); } }); }
/// <summary> /// Updates the balance of the active asset and invokes the onAssetBalanceChanged action if the active asset or ether balance changed. /// </summary> private void UpdateBalance() { var newAssetBalance = tradableAssetManager.ActiveTradableAsset.AssetBalance; var newEtherBalance = EtherBalance; assetBalance.text = StringUtils.LimitEnd(tradableAssetManager.ActiveTradableAsset?.AssetBalance?.ToString(), 14, "..."); if (lastAssetBalance != newAssetBalance || lastEtherBalance != newEtherBalance) { OnAssetBalanceChanged?.Invoke(); } lastAssetBalance = newAssetBalance; lastEtherBalance = newEtherBalance; }