public static OperationResultTr Decode(XdrDataInputStream stream)
            {
                OperationResultTr decodedOperationResultTr = new OperationResultTr();
                OperationType     discriminant             = OperationType.Decode(stream);

                decodedOperationResultTr.Discriminant = discriminant;
                switch (decodedOperationResultTr.Discriminant.InnerValue)
                {
                case OperationType.OperationTypeEnum.CREATE_ACCOUNT:
                    decodedOperationResultTr.CreateAccountResult = CreateAccountResult.Decode(stream);
                    break;

                case OperationType.OperationTypeEnum.PAYMENT:
                    decodedOperationResultTr.PaymentResult = PaymentResult.Decode(stream);
                    break;

                case OperationType.OperationTypeEnum.PATH_PAYMENT:
                    decodedOperationResultTr.PathPaymentResult = PathPaymentResult.Decode(stream);
                    break;

                case OperationType.OperationTypeEnum.MANAGE_OFFER:
                    decodedOperationResultTr.ManageOfferResult = ManageOfferResult.Decode(stream);
                    break;

                case OperationType.OperationTypeEnum.CREATE_PASSIVE_OFFER:
                    decodedOperationResultTr.CreatePassiveOfferResult = ManageOfferResult.Decode(stream);
                    break;

                case OperationType.OperationTypeEnum.SET_OPTIONS:
                    decodedOperationResultTr.SetOptionsResult = SetOptionsResult.Decode(stream);
                    break;

                case OperationType.OperationTypeEnum.CHANGE_TRUST:
                    decodedOperationResultTr.ChangeTrustResult = ChangeTrustResult.Decode(stream);
                    break;

                case OperationType.OperationTypeEnum.ALLOW_TRUST:
                    decodedOperationResultTr.AllowTrustResult = AllowTrustResult.Decode(stream);
                    break;

                case OperationType.OperationTypeEnum.ACCOUNT_MERGE:
                    decodedOperationResultTr.AccountMergeResult = AccountMergeResult.Decode(stream);
                    break;

                case OperationType.OperationTypeEnum.INFLATION:
                    decodedOperationResultTr.InflationResult = InflationResult.Decode(stream);
                    break;

                case OperationType.OperationTypeEnum.MANAGE_DATA:
                    decodedOperationResultTr.ManageDataResult = ManageDataResult.Decode(stream);
                    break;

                case OperationType.OperationTypeEnum.BUMP_SEQUENCE:
                    decodedOperationResultTr.BumpSeqResult = BumpSequenceResult.Decode(stream);
                    break;
                }
                return(decodedOperationResultTr);
            }
            public static void Encode(XdrDataOutputStream stream, OperationResultTr encodedOperationResultTr)
            {
                stream.WriteInt((int)encodedOperationResultTr.Discriminant.InnerValue);
                switch (encodedOperationResultTr.Discriminant.InnerValue)
                {
                case OperationType.OperationTypeEnum.CREATE_ACCOUNT:
                    CreateAccountResult.Encode(stream, encodedOperationResultTr.CreateAccountResult);
                    break;

                case OperationType.OperationTypeEnum.PAYMENT:
                    PaymentResult.Encode(stream, encodedOperationResultTr.PaymentResult);
                    break;

                case OperationType.OperationTypeEnum.PATH_PAYMENT:
                    PathPaymentResult.Encode(stream, encodedOperationResultTr.PathPaymentResult);
                    break;

                case OperationType.OperationTypeEnum.MANAGE_SELL_OFFER:
                    ManageSellOfferResult.Encode(stream, encodedOperationResultTr.ManageSellOfferResult);
                    break;

                case OperationType.OperationTypeEnum.CREATE_PASSIVE_SELL_OFFER:
                    ManageSellOfferResult.Encode(stream, encodedOperationResultTr.CreatePassiveSellOfferResult);
                    break;

                case OperationType.OperationTypeEnum.SET_OPTIONS:
                    SetOptionsResult.Encode(stream, encodedOperationResultTr.SetOptionsResult);
                    break;

                case OperationType.OperationTypeEnum.CHANGE_TRUST:
                    ChangeTrustResult.Encode(stream, encodedOperationResultTr.ChangeTrustResult);
                    break;

                case OperationType.OperationTypeEnum.ALLOW_TRUST:
                    AllowTrustResult.Encode(stream, encodedOperationResultTr.AllowTrustResult);
                    break;

                case OperationType.OperationTypeEnum.ACCOUNT_MERGE:
                    AccountMergeResult.Encode(stream, encodedOperationResultTr.AccountMergeResult);
                    break;

                case OperationType.OperationTypeEnum.INFLATION:
                    InflationResult.Encode(stream, encodedOperationResultTr.InflationResult);
                    break;

                case OperationType.OperationTypeEnum.MANAGE_DATA:
                    ManageDataResult.Encode(stream, encodedOperationResultTr.ManageDataResult);
                    break;

                case OperationType.OperationTypeEnum.BUMP_SEQUENCE:
                    BumpSequenceResult.Encode(stream, encodedOperationResultTr.BumpSeqResult);
                    break;

                case OperationType.OperationTypeEnum.MANAGE_BUY_OFFER:
                    ManageBuyOfferResult.Encode(stream, encodedOperationResultTr.ManageBuyOfferResult);
                    break;
                }
            }
        public static void Encode(XdrDataOutputStream stream, PathPaymentResult encodedPathPaymentResult)
        {
            stream.WriteInt((int)encodedPathPaymentResult.Discriminant.InnerValue);
            switch (encodedPathPaymentResult.Discriminant.InnerValue)
            {
            case PathPaymentResultCode.PathPaymentResultCodeEnum.PATH_PAYMENT_SUCCESS:
                PathPaymentResultSuccess.Encode(stream, encodedPathPaymentResult.Success);
                break;

            case PathPaymentResultCode.PathPaymentResultCodeEnum.PATH_PAYMENT_NO_ISSUER:
                Asset.Encode(stream, encodedPathPaymentResult.NoIssuer);
                break;

            default:
                break;
            }
        }
        public static PathPaymentResult Decode(XdrDataInputStream stream)
        {
            PathPaymentResult     decodedPathPaymentResult = new PathPaymentResult();
            PathPaymentResultCode discriminant             = PathPaymentResultCode.Decode(stream);

            decodedPathPaymentResult.Discriminant = discriminant;
            switch (decodedPathPaymentResult.Discriminant.InnerValue)
            {
            case PathPaymentResultCode.PathPaymentResultCodeEnum.PATH_PAYMENT_SUCCESS:
                decodedPathPaymentResult.Success = PathPaymentResultSuccess.Decode(stream);
                break;

            case PathPaymentResultCode.PathPaymentResultCodeEnum.PATH_PAYMENT_NO_ISSUER:
                decodedPathPaymentResult.NoIssuer = Asset.Decode(stream);
                break;

            default:
                break;
            }
            return(decodedPathPaymentResult);
        }