Closed daustany closed 3 years ago
using TronNet; namespace TronNetTest { class Class1 { private readonly IWalletClient _walletClient; public Class1(IWalletClient walletClient) { _walletClient = walletClient; } public async Task<decimal> GetBalanceAsync() { var protocol = _walletClient.GetProtocol(); var address = "TGehVcNhud84JDCGrNHKVz9jEAVKUpbuiv"; var addr = _walletClient.ParseAddress(address); var account = await protocol.GetAccountAsync(new TronNet.Protocol.Account { Address = addr }); var balance = Convert.ToDecimal(account.Balance) / 1_000_000L; return balance; } } }