TronNet has IContractClient to get Usdt balance, but I can't get the TRX(Native Coin) balance.
https://github.com/stoway/TronNet
I've Found GetAccountBalance in TronNet.Protocol.Wallet but this code returns Grpc.Core.RpcException: Status(StatusCode="Unknown", Detail="") Exception
var options = new TronNetOptions()
{
Network = TronNetwork.MainNet,
Channel = new GrpcChannelOption { Host = "grpc.trongrid.io", Port = 50051 },
SolidityChannel = new GrpcChannelOption { Host = "grpc.trongrid.io", Port = 50052 },
ApiKey = "80a8b20f-a917-43a9-a2f1-809fe6eec0d6"
};
var grpcChannelClient = new GrpcChannelClient(null, options);
var walletClient = new WalletClient(grpcChannelClient, options);
var transactionClient = new TransactionClient(walletClient, options);
var wallet = walletClient.GetProtocol();
var ownerAddressBytes = Base58Encoder.DecodeFromBase58Check(publicAddress);
var accountIdentitfier = new AccountIdentifier();
var blockIdentifier = new BlockIdentifier();
accountIdentitfier.Address = ByteString.CopyFrom(ownerAddressBytes);
blockIdentifier.Hash = ByteString.CopyFromUtf8("latest");
var accountBalanceRequest = new AccountBalanceRequest { AccountIdentifier = accountIdentitfier, BlockIdentifier = blockIdentifier};
var response = await wallet.GetAccountBalanceAsync(accountBalanceRequest, walletClient.GetHeaders());
return response.Balance;