コード例 #1
0
        public async Task <ParseTransactionReply> ParseTransaction(TransactionParameter parameter,
                                                                   ulong?requireBlock = null, ulong?requireLastBlock = null)
        {
            var queryParameters = CreateQueryParameters(parameter);

            queryParameters.AddIfHasValue(Parameters.RequireBlock, requireBlock);
            queryParameters.AddIfHasValue(Parameters.RequireLastBlock, requireLastBlock);
            return(await Get <ParseTransactionReply>("parseTransaction", queryParameters));
        }
コード例 #2
0
        public async Task <SignTransactionReply> SignTransaction(TransactionParameter parameter,
                                                                 string secretPhrase, bool?validate = null, ulong?requireBlock = null, ulong?requireLastBlock = null)
        {
            var queryParameters = CreateQueryParameters(parameter, true);

            queryParameters.Add(Parameters.SecretPhrase, secretPhrase);
            queryParameters.AddIfHasValue(Parameters.Validate, validate);
            queryParameters.AddIfHasValue(Parameters.RequireBlock, requireBlock);
            queryParameters.AddIfHasValue(Parameters.RequireLastBlock, requireLastBlock);
            return(await Get <SignTransactionReply>("signTransaction", queryParameters));
        }
コード例 #3
0
        private static Dictionary <string, string> CreateQueryParameters(TransactionParameter parameter,
                                                                         bool unsigned = false)
        {
            var queryParameters = new Dictionary <string, string>();

            if (parameter.TransactionBytes != null)
            {
                queryParameters.Add(!unsigned ? Parameters.TransactionBytes : Parameters.UnsignedTransactionBytes,
                                    parameter.TransactionBytes.ToHexString());
            }
            if (parameter.TransactionJson != null)
            {
                queryParameters.Add(!unsigned ? Parameters.TransactionJson : Parameters.UnsignedTransactionJson,
                                    parameter.TransactionJson);
            }
            if (!string.IsNullOrEmpty(parameter.PrunableAttachmentJson))
            {
                queryParameters.Add(Parameters.PrunableAttachmentJson, parameter.PrunableAttachmentJson);
            }
            return(queryParameters);
        }
コード例 #4
0
        public async Task <BroadcastTransactionReply> SendTransaction(TransactionParameter parameter)
        {
            var queryParameters = CreateQueryParameters(parameter);

            return(await Post <BroadcastTransactionReply>("sendTransaction", queryParameters));
        }