예제 #1
0
        /// <summary>
        /// Returns base64-encoded Operation XDR object.
        /// </summary>
        /// <returns></returns>
        public string ToXdrBase64()
        {
            var operation = ToXDR();
            var writer    = new Generated.ByteWriter();

            Generated.Operation.Encode(writer, operation);
            return(Convert.ToBase64String(writer.ToArray()));
        }
예제 #2
0
        /// <summary>
        /// Returns base64-encoded TransactionEnvelope XDR object. Transaction need to have at least one signature.
        /// </summary>
        /// <returns></returns>
        public string ToEnvelopeXdrBase64()
        {
            var envelope = ToEnvelopeXDR();
            var writer   = new Generated.ByteWriter();

            Generated.TransactionEnvelope.Encode(writer, envelope);
            return(Convert.ToBase64String(writer.ToArray()));
        }
예제 #3
0
        public static string EncodeCheck(VersionByte versionByte, byte[] data)
        {
            var writer = new Generated.ByteWriter();

            writer.Write((byte)versionByte);
            writer.Write(data);
            byte[] checksum = StrKey.CalculateChecksum(writer.ToArray());
            writer.Write(checksum);
            return(Base32Encoding.ToString(writer.ToArray()));
        }
예제 #4
0
        /// <summary>
        /// Returns signature base.
        /// </summary>
        /// <returns></returns>
        public byte[] SignatureBase()
        {
            var writer = new Generated.ByteWriter();

            // Hashed NetworkID
            writer.Write(Network.CurrentNetworkId);

            // Envelope Type - 4 bytes
            Generated.EnvelopeType.Encode(writer, Generated.EnvelopeType.Create(Generated.EnvelopeType.EnvelopeTypeEnum.ENVELOPE_TYPE_TX));

            // Transaction XDR bytes
            var txWriter = new Generated.ByteWriter();

            Generated.Transaction.Encode(txWriter, this.ToXDR());

            writer.Write(txWriter.ToArray());

            return(writer.ToArray());
        }