Ejemplo n.º 1
0
        /// <summary>
        /// The submit method applies a transaction and sends it to the network to be confirmed and included in future ledgers.
        /// Submit-only mode takes a signed, serialized transaction as a binary blob, and submits it to the network as-is.
        /// Since signed transaction objects are immutable, no part of the transaction can be modified or automatically filled in after submission.
        /// </summary>
        public async Task <SubmitResponse> Submit(SubmitRequest request, CancellationToken cancellationToken = default)
        {
            jsonBuffer.Clear();
            jsonWriter.Reset();
            jsonWriter.WriteStartObject();
            var requestId = WriteHeader(jsonWriter, "submit");

            jsonWriter.WriteBase16String("tx_blob", request.TxBlob.Span);
            jsonWriter.WriteBoolean("fail_hard", request.FailHard);
            WriteFooter(jsonWriter);
            jsonWriter.WriteEndObject();
            jsonWriter.Flush();
            var response = await SendReceiveAsync(requestId, jsonBuffer.WrittenMemory, cancellationToken);

            return(new SubmitResponse(response));
        }