Ejemplo n.º 1
0
        public static void Encode(XdrDataOutputStream stream, TransactionV0Envelope encodedTransactionV0Envelope)
        {
            TransactionV0.Encode(stream, encodedTransactionV0Envelope.Tx);
            int signaturessize = encodedTransactionV0Envelope.Signatures.Length;

            stream.WriteInt(signaturessize);
            for (int i = 0; i < signaturessize; i++)
            {
                DecoratedSignature.Encode(stream, encodedTransactionV0Envelope.Signatures[i]);
            }
        }
Ejemplo n.º 2
0
        public static TransactionV0Envelope Decode(XdrDataInputStream stream)
        {
            TransactionV0Envelope decodedTransactionV0Envelope = new TransactionV0Envelope();

            decodedTransactionV0Envelope.Tx = TransactionV0.Decode(stream);
            int signaturessize = stream.ReadInt();

            decodedTransactionV0Envelope.Signatures = new DecoratedSignature[signaturessize];
            for (int i = 0; i < signaturessize; i++)
            {
                decodedTransactionV0Envelope.Signatures[i] = DecoratedSignature.Decode(stream);
            }
            return(decodedTransactionV0Envelope);
        }
Ejemplo n.º 3
0
        public static void Encode(XdrDataOutputStream stream, TransactionEnvelope encodedTransactionEnvelope)
        {
            stream.WriteInt((int)encodedTransactionEnvelope.Discriminant.InnerValue);
            switch (encodedTransactionEnvelope.Discriminant.InnerValue)
            {
            case EnvelopeType.EnvelopeTypeEnum.ENVELOPE_TYPE_TX_V0:
                TransactionV0Envelope.Encode(stream, encodedTransactionEnvelope.V0);
                break;

            case EnvelopeType.EnvelopeTypeEnum.ENVELOPE_TYPE_TX:
                TransactionV1Envelope.Encode(stream, encodedTransactionEnvelope.V1);
                break;

            case EnvelopeType.EnvelopeTypeEnum.ENVELOPE_TYPE_TX_FEE_BUMP:
                FeeBumpTransactionEnvelope.Encode(stream, encodedTransactionEnvelope.FeeBump);
                break;
            }
        }
        public static TransactionEnvelope Decode(XdrDataInputStream stream)
        {
            TransactionEnvelope decodedTransactionEnvelope = new TransactionEnvelope();
            EnvelopeType        discriminant = EnvelopeType.Decode(stream);

            decodedTransactionEnvelope.Discriminant = discriminant;
            switch (decodedTransactionEnvelope.Discriminant.InnerValue)
            {
            case EnvelopeType.EnvelopeTypeEnum.ENVELOPE_TYPE_TX_V0:
                decodedTransactionEnvelope.V0 = TransactionV0Envelope.Decode(stream);
                break;

            case EnvelopeType.EnvelopeTypeEnum.ENVELOPE_TYPE_TX:
                decodedTransactionEnvelope.V1 = TransactionV1Envelope.Decode(stream);
                break;

            case EnvelopeType.EnvelopeTypeEnum.ENVELOPE_TYPE_TX_FEE_BUMP:
                decodedTransactionEnvelope.FeeBump = FeeBumpTransactionEnvelope.Decode(stream);
                break;
            }
            return(decodedTransactionEnvelope);
        }