stoway / TronNet

.net sdk of tron
MIT License
69 stars 43 forks source link

Some issues need to be fixed! #38

Open hy-net opened 2 years ago

hy-net commented 2 years ago
  1. BalanceOfFunctionOutput unit256 should convert to BigInteger instead of long

    public class BalanceOfFunctionOutput : IFunctionOutputDTO { [Parameter("uint256", 1)] public BigInteger Balance { get; set; } }

  2. BalanceOfAsync() should allow to pass in an Account with only PublicKey. There is no reason we need to have access to PrivateKey just to query for the balance. Look into the code and you should notices that the PrivateKey passed in is not used at all.

    and since #1 had been changed to BigInteger, the following line in BalanceOfAsync() shall change to

    // var balance = Convert.ToDecimal(result.Balance); var balance = (decimal)result.Balance;

  3. The following code won't compile without explicitly cast the result to (byte)

    internal byte GetPublicAddressPrefix()
    {
        return (byte)(_network == TronNetwork.MainNet ? 0x41 : 0xa0);
    }