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_STRICT_RECEIVE:
                    PathPaymentStrictReceiveResult.Encode(stream, encodedOperationResultTr.PathPaymentStrictReceiveResult);
                    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;

                case OperationType.OperationTypeEnum.PATH_PAYMENT_STRICT_SEND:
                    PathPaymentStrictSendResult.Encode(stream, encodedOperationResultTr.PathPaymentStrictSendResult);
                    break;

                case OperationType.OperationTypeEnum.CREATE_CLAIMABLE_BALANCE:
                    CreateClaimableBalanceResult.Encode(stream, encodedOperationResultTr.CreateClaimableBalanceResult);
                    break;

                case OperationType.OperationTypeEnum.CLAIM_CLAIMABLE_BALANCE:
                    ClaimClaimableBalanceResult.Encode(stream, encodedOperationResultTr.ClaimClaimableBalanceResult);
                    break;

                case OperationType.OperationTypeEnum.BEGIN_SPONSORING_FUTURE_RESERVES:
                    BeginSponsoringFutureReservesResult.Encode(stream, encodedOperationResultTr.BeginSponsoringFutureReservesResult);
                    break;

                case OperationType.OperationTypeEnum.END_SPONSORING_FUTURE_RESERVES:
                    EndSponsoringFutureReservesResult.Encode(stream, encodedOperationResultTr.EndSponsoringFutureReservesResult);
                    break;

                case OperationType.OperationTypeEnum.REVOKE_SPONSORSHIP:
                    RevokeSponsorshipResult.Encode(stream, encodedOperationResultTr.RevokeSponsorshipResult);
                    break;
                }
            }