Ejemplo n.º 1
0
        public void TestRpcNep5Balances()
        {
            JObject json = TestUtils.RpcTestCases.Find(p => p.Name == nameof(RpcClient.GetNep5BalancesAsync).ToLower()).Response.Result;
            var     item = RpcNep5Balances.FromJson(json);

            Assert.AreEqual(json.ToString(), item.ToJson().ToString());
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Returns the balance of all NEP-5 assets in the specified address.
        /// This method is provided by the plugin RpcNep5Tracker.
        /// </summary>
        public async Task <RpcNep5Balances> GetNep5BalancesAsync(string address)
        {
            var result = await RpcSendAsync(GetRpcName(), address.AsScriptHash())
                         .ConfigureAwait(false);

            return(RpcNep5Balances.FromJson(result));
        }
        public void TestFromJson()
        {
            var json            = balances.ToJson();
            var rpcNep5Balances = RpcNep5Balances.FromJson(json);

            rpcNep5Balances.Address.Should().Be("abc");
            rpcNep5Balances.Balances.Length.Should().Be(2);
        }
 public void Setup()
 {
     balances = new RpcNep5Balances()
     {
         Address  = "abc",
         Balances = new RpcNep5Balance[] {
             new RpcNep5Balance()
             {
                 AssetHash        = UInt160.Zero,
                 Amount           = BigInteger.Zero,
                 LastUpdatedBlock = 0
             },
             new RpcNep5Balance()
             {
                 AssetHash        = UInt160.Parse("0xa400ff00ff00ff00ff00ff00ff00ff00ff00ff01"),
                 Amount           = new BigInteger(1),
                 LastUpdatedBlock = 1
             }
         }
     };
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Returns the balance of all NEP-5 assets in the specified address.
 /// This method is provided by the plugin RpcNep5Tracker.
 /// </summary>
 public RpcNep5Balances GetNep5Balances(string address)
 {
     return(RpcNep5Balances.FromJson(RpcSend("getnep5balances", address)));
 }