public static void Encode(XdrDataOutputStream stream, FeeBumpTransactionEnvelope encodedFeeBumpTransactionEnvelope)
        {
            FeeBumpTransaction.Encode(stream, encodedFeeBumpTransactionEnvelope.Tx);
            int signaturessize = encodedFeeBumpTransactionEnvelope.Signatures.Length;

            stream.WriteInt(signaturessize);
            for (int i = 0; i < signaturessize; i++)
            {
                DecoratedSignature.Encode(stream, encodedFeeBumpTransactionEnvelope.Signatures[i]);
            }
        }
        public static FeeBumpTransactionEnvelope Decode(XdrDataInputStream stream)
        {
            FeeBumpTransactionEnvelope decodedFeeBumpTransactionEnvelope = new FeeBumpTransactionEnvelope();

            decodedFeeBumpTransactionEnvelope.Tx = FeeBumpTransaction.Decode(stream);
            int signaturessize = stream.ReadInt();

            decodedFeeBumpTransactionEnvelope.Signatures = new DecoratedSignature[signaturessize];
            for (int i = 0; i < signaturessize; i++)
            {
                decodedFeeBumpTransactionEnvelope.Signatures[i] = DecoratedSignature.Decode(stream);
            }
            return(decodedFeeBumpTransactionEnvelope);
        }
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);
        }