public async Task Query(string?memo)
        {
            Random  random    = new Random();
            Address sender    = new PrivateKey().ToAddress(),
                    recipient = new PrivateKey().ToAddress();
            Currency currency = new Currency("NCG", 2, minter: null);

            byte[] buffer = new byte[HashDigest <SHA256> .Size];
            random.NextBytes(buffer);
            BlockHash blockHash = new BlockHash(buffer);

            buffer = new byte[TxId.Size];
            random.NextBytes(buffer);
            TxId txId = new TxId(buffer);
            FungibleAssetValue amount = new FungibleAssetValue(currency, 10, 10);
            var result = await GraphQLTestUtils.ExecuteQueryAsync <TransferNCGHistoryType>(
                "{ blockHash txId sender recipient amount }",
                source : new TransferNCGHistory(blockHash, txId, sender, recipient, amount, memo));

            Assert.Equal(new Dictionary <string, object>
            {
                ["blockHash"] = blockHash.ToString(),
                ["txId"]      = txId.ToString(),
                ["sender"]    = sender.ToString(),
                ["recipient"] = recipient.ToString(),
                ["amount"]    = amount.GetQuantityString(),
            }, result.Data);
        }
示例#2
0
        public JObject ToJson()
        {
            JObject json = Transaction.ToJson();

            if (Confirmations != null)
            {
                json["blockhash"]     = BlockHash.ToString();
                json["confirmations"] = Confirmations;
                json["blocktime"]     = BlockTime;
            }
            return(json);
        }
示例#3
0
        public JObject ToJson()
        {
            JObject json = new JObject();

            if (TxId != null)
            {
                json["txid"] = TxId.ToString();
            }
            if (BlockHash != null)
            {
                json["blockhash"] = BlockHash.ToString();
            }
            json["executions"] = Executions.Select(p => p.ToJson()).ToArray();
            return(json);
        }
示例#4
0
        public JObject ToJson(ProtocolSettings protocolSettings)
        {
            JObject json = Utility.TransactionToJson(Transaction, protocolSettings);

            if (Confirmations != null)
            {
                json["blockhash"]     = BlockHash.ToString();
                json["confirmations"] = Confirmations;
                json["blocktime"]     = BlockTime;
                if (VMState != null)
                {
                    json["vmstate"] = VMState;
                }
            }
            return(json);
        }
示例#5
0
 public override string ToString()
 {
     return($"{Type}, {BlockNumber?.ToString() ?? BlockHash?.ToString()}");
 }
示例#6
0
 public override string ToString()
 {
     return($"[dr={DepositRoot.ToString().Substring(0, 10)} dc={DepositCount} bh={BlockHash.ToString().Substring(0, 10)}]");
 }