Exemple #1
0
        public async Task <Hash32> Transfer(Address to, BigInteger amount, BigInteger stepLimit, int?networkID = null)
        {
            var builder = new TransferTransactionBuilder();

            builder.PrivateKey = PrivateKey;
            builder.To         = to;
            builder.Value      = amount;
            builder.StepLimit  = stepLimit;
            builder.NID        = networkID ?? Consts.ApiUrl.GetNetworkID(ApiUrl);

            var tx = builder.Build();
            var sendTransaction = new SendTransaction(ApiUrl);

            return(await sendTransaction.Invoke(tx));
        }
Exemple #2
0
        public static Hash32 Transfer(Address to, PrivateKey privateKey, BigInteger amount, BigInteger stepLimit, string Api)
        {
            var builder = new TransferTransactionBuilder
            {
                PrivateKey = privateKey,
                To         = to,
                Value      = amount,
                StepLimit  = stepLimit,
                NID        = 3
            };

            var tx = builder.Build();
            var sendTransaction = new SendTransaction(Api);

            return(sendTransaction.Invoke(tx).Result);
        }
Exemple #3
0
        public void Test_RPCInvalidRequestException()
        {
            var txBuilder = new TransactionBuilder();

            txBuilder.PrivateKey = PrivateKey.Random();
            txBuilder.To         = "hx0000000000000000000000000000000000000000";
            txBuilder.StepLimit  = 100000000;
            txBuilder.NID        = 2;
            txBuilder.Value      = 0;

            var tx = txBuilder.Build();

            var gendTransactin = new SendTransaction(Consts.ApiUrl.TestNet);

            Assert.ThrowsAsync(typeof(RPCInvalidRequestException), async() => await gendTransactin.Invoke(tx));
        }