/// <summary>
        ///     Returns signature base for the given network.
        /// </summary>
        /// <param name="network">The network <see cref="Network"/> the transaction will be sent to.</param>
        /// <returns></returns>
        public override byte[] SignatureBase(Network network)
        {
            if (network == null)
            {
                throw new NoNetworkSelectedException();
            }

            // Hashed NetworkID
            var networkHash = new Hash {
                InnerValue = network.NetworkId
            };
            var taggedTransaction = new TransactionSignaturePayload.TransactionSignaturePayloadTaggedTransaction
            {
                Discriminant = EnvelopeType.Create(EnvelopeType.EnvelopeTypeEnum.ENVELOPE_TYPE_TX),
                Tx           = ToXdrV1(),
            };

            var txSignature = new TransactionSignaturePayload
            {
                NetworkId         = networkHash,
                TaggedTransaction = taggedTransaction
            };

            var writer = new XdrDataOutputStream();

            TransactionSignaturePayload.Encode(writer, txSignature);
            return(writer.ToArray());
        }
        public static TransactionSignaturePayload Decode(IByteReader stream)
        {
            TransactionSignaturePayload decodedTransactionSignaturePayload = new TransactionSignaturePayload();

            decodedTransactionSignaturePayload.NetworkId         = Hash.Decode(stream);
            decodedTransactionSignaturePayload.TaggedTransaction = TransactionSignaturePayloadTaggedTransaction.Decode(stream);
            return(decodedTransactionSignaturePayload);
        }
示例#3
0
        public static TransactionSignaturePayload Decode(XdrDataInputStream stream)
        {
            var decodedTransactionSignaturePayload = new TransactionSignaturePayload();

            decodedTransactionSignaturePayload.NetworkId         = Hash.Decode(stream);
            decodedTransactionSignaturePayload.TaggedTransaction = TransactionSignaturePayloadTaggedTransaction.Decode(stream);
            return(decodedTransactionSignaturePayload);
        }
        public static void Encode(XdrDataOutputStream stream,
                                  TransactionSignaturePayload encodedTransactionSignaturePayload)
        {
            Hash.Encode(stream, encodedTransactionSignaturePayload.NetworkId);

            TransactionSignaturePayloadTaggedTransaction.Encode(stream,
                                                                encodedTransactionSignaturePayload.TaggedTransaction);
        }
 public static void Encode(IByteWriter stream, TransactionSignaturePayload encodedTransactionSignaturePayload)
 {
     Hash.Encode(stream, encodedTransactionSignaturePayload.NetworkId);
     TransactionSignaturePayloadTaggedTransaction.Encode(stream, encodedTransactionSignaturePayload.TaggedTransaction);
 }