func (u OperationBody) MustCreatePassiveOfferOp() CreatePassiveOfferOp {
	val, ok := u.GetCreatePassiveOfferOp()

	if !ok {
		panic("arm CreatePassiveOfferOp is not set")
	}

	return val
}

func ( u OperationBody ) MustCreatePassiveOfferOp ( ) CreatePassiveOfferOp { val , ok := u . GetCreatePassiveOfferOp ( ) if ! ok { panic ( " " ) } return val }

// MustCreatePassiveOfferOp retrieves the CreatePassiveOfferOp value from the union,
// panicing if the value is not set.

MustCreatePassiveOfferOp retrieves the CreatePassiveOfferOp value from the union panicing if the value is not set .


func (u OperationBody) GetCreatePassiveOfferOp() (result CreatePassiveOfferOp, ok bool) {
	armName, _ := u.ArmForSwitch(int32(u.Type))

	if armName == "CreatePassiveOfferOp" {
		result = *u.CreatePassiveOfferOp
		ok = true
	}

	return
}

func ( u OperationBody ) GetCreatePassiveOfferOp ( ) ( result CreatePassiveOfferOp , ok bool ) { armName , _ := u . ArmForSwitch ( int32 ( u . Type ) ) if armName == " " { result = * u . CreatePassiveOfferOp ok = true } return }

// GetCreatePassiveOfferOp retrieves the CreatePassiveOfferOp value from the union,
// returning ok if the union's switch indicated the value is valid.

GetCreatePassiveOfferOp retrieves the CreatePassiveOfferOp value from the union returning ok if the union s switch indicated the value is valid .


func (u OperationBody) MustSetOptionsOp() SetOptionsOp {
	val, ok := u.GetSetOptionsOp()

	if !ok {
		panic("arm SetOptionsOp is not set")
	}

	return val
}

func ( u OperationBody ) MustSetOptionsOp ( ) SetOptionsOp { val , ok := u . GetSetOptionsOp ( ) if ! ok { panic ( " " ) } return val }

// MustSetOptionsOp retrieves the SetOptionsOp value from the union,
// panicing if the value is not set.

MustSetOptionsOp retrieves the SetOptionsOp value from the union panicing if the value is not set .


func (u OperationBody) GetSetOptionsOp() (result SetOptionsOp, ok bool) {
	armName, _ := u.ArmForSwitch(int32(u.Type))

	if armName == "SetOptionsOp" {
		result = *u.SetOptionsOp
		ok = true
	}

	return
}

func ( u OperationBody ) GetSetOptionsOp ( ) ( result SetOptionsOp , ok bool ) { armName , _ := u . ArmForSwitch ( int32 ( u . Type ) ) if armName == " " { result = * u . SetOptionsOp ok = true } return }

// GetSetOptionsOp retrieves the SetOptionsOp value from the union,
// returning ok if the union's switch indicated the value is valid.

GetSetOptionsOp retrieves the SetOptionsOp value from the union returning ok if the union s switch indicated the value is valid .


func (u OperationBody) MustChangeTrustOp() ChangeTrustOp {
	val, ok := u.GetChangeTrustOp()

	if !ok {
		panic("arm ChangeTrustOp is not set")
	}

	return val
}

func ( u OperationBody ) MustChangeTrustOp ( ) ChangeTrustOp { val , ok := u . GetChangeTrustOp ( ) if ! ok { panic ( " " ) } return val }

// MustChangeTrustOp retrieves the ChangeTrustOp value from the union,
// panicing if the value is not set.

MustChangeTrustOp retrieves the ChangeTrustOp value from the union panicing if the value is not set .


func (u OperationBody) GetChangeTrustOp() (result ChangeTrustOp, ok bool) {
	armName, _ := u.ArmForSwitch(int32(u.Type))

	if armName == "ChangeTrustOp" {
		result = *u.ChangeTrustOp
		ok = true
	}

	return
}

func ( u OperationBody ) GetChangeTrustOp ( ) ( result ChangeTrustOp , ok bool ) { armName , _ := u . ArmForSwitch ( int32 ( u . Type ) ) if armName == " " { result = * u . ChangeTrustOp ok = true } return }

// GetChangeTrustOp retrieves the ChangeTrustOp value from the union,
// returning ok if the union's switch indicated the value is valid.

GetChangeTrustOp retrieves the ChangeTrustOp value from the union returning ok if the union s switch indicated the value is valid .


func (u OperationBody) MustAllowTrustOp() AllowTrustOp {
	val, ok := u.GetAllowTrustOp()

	if !ok {
		panic("arm AllowTrustOp is not set")
	}

	return val
}

func ( u OperationBody ) MustAllowTrustOp ( ) AllowTrustOp { val , ok := u . GetAllowTrustOp ( ) if ! ok { panic ( " " ) } return val }

// MustAllowTrustOp retrieves the AllowTrustOp value from the union,
// panicing if the value is not set.

MustAllowTrustOp retrieves the AllowTrustOp value from the union panicing if the value is not set .


func (u OperationBody) GetAllowTrustOp() (result AllowTrustOp, ok bool) {
	armName, _ := u.ArmForSwitch(int32(u.Type))

	if armName == "AllowTrustOp" {
		result = *u.AllowTrustOp
		ok = true
	}

	return
}

func ( u OperationBody ) GetAllowTrustOp ( ) ( result AllowTrustOp , ok bool ) { armName , _ := u . ArmForSwitch ( int32 ( u . Type ) ) if armName == " " { result = * u . AllowTrustOp ok = true } return }

// GetAllowTrustOp retrieves the AllowTrustOp value from the union,
// returning ok if the union's switch indicated the value is valid.

GetAllowTrustOp retrieves the AllowTrustOp value from the union returning ok if the union s switch indicated the value is valid .


func (u OperationBody) MustDestination() AccountId {
	val, ok := u.GetDestination()

	if !ok {
		panic("arm Destination is not set")
	}

	return val
}

func ( u OperationBody ) MustDestination ( ) AccountId { val , ok := u . GetDestination ( ) if ! ok { panic ( " " ) } return val }

// MustDestination retrieves the Destination value from the union,
// panicing if the value is not set.

MustDestination retrieves the Destination value from the union panicing if the value is not set .


func (u OperationBody) GetDestination() (result AccountId, ok bool) {
	armName, _ := u.ArmForSwitch(int32(u.Type))

	if armName == "Destination" {
		result = *u.Destination
		ok = true
	}

	return
}

func ( u OperationBody ) GetDestination ( ) ( result AccountId , ok bool ) { armName , _ := u . ArmForSwitch ( int32 ( u . Type ) ) if armName == " " { result = * u . Destination ok = true } return }

// GetDestination retrieves the Destination value from the union,
// returning ok if the union's switch indicated the value is valid.

GetDestination retrieves the Destination value from the union returning ok if the union s switch indicated the value is valid .


func (u OperationBody) MustManageDataOp() ManageDataOp {
	val, ok := u.GetManageDataOp()

	if !ok {
		panic("arm ManageDataOp is not set")
	}

	return val
}

func ( u OperationBody ) MustManageDataOp ( ) ManageDataOp { val , ok := u . GetManageDataOp ( ) if ! ok { panic ( " " ) } return val }

// MustManageDataOp retrieves the ManageDataOp value from the union,
// panicing if the value is not set.

MustManageDataOp retrieves the ManageDataOp value from the union panicing if the value is not set .


func (u OperationBody) GetManageDataOp() (result ManageDataOp, ok bool) {
	armName, _ := u.ArmForSwitch(int32(u.Type))

	if armName == "ManageDataOp" {
		result = *u.ManageDataOp
		ok = true
	}

	return
}

func ( u OperationBody ) GetManageDataOp ( ) ( result ManageDataOp , ok bool ) { armName , _ := u . ArmForSwitch ( int32 ( u . Type ) ) if armName == " " { result = * u . ManageDataOp ok = true } return }

// GetManageDataOp retrieves the ManageDataOp value from the union,
// returning ok if the union's switch indicated the value is valid.

GetManageDataOp retrieves the ManageDataOp value from the union returning ok if the union s switch indicated the value is valid .


func (e MemoType) ValidEnum(v int32) bool {
	_, ok := memoTypeMap[v]
	return ok
}

func ( e MemoType ) ValidEnum ( v int32 ) bool { _ , ok := memoTypeMap [ v ] return ok }

// ValidEnum validates a proposed value for this enum.  Implements
// the Enum interface for MemoType

ValidEnum validates a proposed value for this enum . Implements the Enum interface for MemoType


func (u Memo) ArmForSwitch(sw int32) (string, bool) {
	switch MemoType(sw) {
	case MemoTypeMemoNone:
		return "", true
	case MemoTypeMemoText:
		return "Text", true
	case MemoTypeMemoId:
		return "Id", true
	case MemoTypeMemoHash:
		return "Hash", true
	case MemoTypeMemoReturn:
		return "RetHash", true
	}
	return "-", false
}

func ( u Memo ) ArmForSwitch ( sw int32 ) ( string , bool ) { switch MemoType ( sw ) { case MemoTypeMemoNone : return " " , true case MemoTypeMemoText : return " " , true case MemoTypeMemoId : return " " , true case MemoTypeMemoHash : return " " , true case MemoTypeMemoReturn : return " " , true } return " " , false }

// ArmForSwitch returns which field name should be used for storing
// the value for an instance of Memo

ArmForSwitch returns which field name should be used for storing the value for an instance of Memo


func NewMemo(aType MemoType, value interface{}) (result Memo, err error) {
	result.Type = aType
	switch MemoType(aType) {
	case MemoTypeMemoNone:
		// void
	case MemoTypeMemoText:
		tv, ok := value.(string)
		if !ok {
			err = fmt.Errorf("invalid value, must be string")
			return
		}
		result.Text = &tv
	case MemoTypeMemoId:
		tv, ok := value.(Uint64)
		if !ok {
			err = fmt.Errorf("invalid value, must be Uint64")
			return
		}
		result.Id = &tv
	case MemoTypeMemoHash:
		tv, ok := value.(Hash)
		if !ok {
			err = fmt.Errorf("invalid value, must be Hash")
			return
		}
		result.Hash = &tv
	case MemoTypeMemoReturn:
		tv, ok := value.(Hash)
		if !ok {
			err = fmt.Errorf("invalid value, must be Hash")
			return
		}
		result.RetHash = &tv
	}
	return
}

func
NewMemo
(
aType
MemoType
,
value
interface
{
}
)
(
result
Memo
,
err
error
)
{
result
.
Type
=
aType
switch
MemoType
(
aType
)
{
case
MemoTypeMemoNone
:
// void
case
MemoTypeMemoText
:
tv
,
ok
:=
value
.
(
string
)
if
!
ok
{
err
=
fmt
.
Errorf
(
"
"
)
return
}
result
.
Text
=
&
tv
case
MemoTypeMemoId
:
tv
,
ok
:=
value
.
(
Uint64
)
if
!
ok
{
err
=
fmt
.
Errorf
(
"
"
)
return
}
result
.
Id
=
&
tv
case
MemoTypeMemoHash
:
tv
,
ok
:=
value
.
(
Hash
)
if
!
ok
{
err
=
fmt
.
Errorf
(
"
"
)
return
}
result
.
Hash
=
&
tv
case
MemoTypeMemoReturn
:
tv
,
ok
:=
value
.
(
Hash
)
if
!
ok
{
err
=
fmt
.
Errorf
(
"
"
)
return
}
result
.
RetHash
=
&
tv
}
return
}


func (u Memo) MustText() string {
	val, ok := u.GetText()

	if !ok {
		panic("arm Text is not set")
	}

	return val
}

func ( u Memo ) MustText ( ) string { val , ok := u . GetText ( ) if ! ok { panic ( " " ) } return val }

// MustText retrieves the Text value from the union,
// panicing if the value is not set.

MustText retrieves the Text value from the union panicing if the value is not set .


func (u Memo) GetText() (result string, ok bool) {
	armName, _ := u.ArmForSwitch(int32(u.Type))

	if armName == "Text" {
		result = *u.Text
		ok = true
	}

	return
}

func ( u Memo ) GetText ( ) ( result string , ok bool ) { armName , _ := u . ArmForSwitch ( int32 ( u . Type ) ) if armName == " " { result = * u . Text ok = true } return }

// GetText retrieves the Text value from the union,
// returning ok if the union's switch indicated the value is valid.

GetText retrieves the Text value from the union returning ok if the union s switch indicated the value is valid .


func (u Memo) MustId() Uint64 {
	val, ok := u.GetId()

	if !ok {
		panic("arm Id is not set")
	}

	return val
}

func ( u Memo ) MustId ( ) Uint64 { val , ok := u . GetId ( ) if ! ok { panic ( " " ) } return val }

// MustId retrieves the Id value from the union,
// panicing if the value is not set.

MustId retrieves the Id value from the union panicing if the value is not set .


func (u Memo) GetId() (result Uint64, ok bool) {
	armName, _ := u.ArmForSwitch(int32(u.Type))

	if armName == "Id" {
		result = *u.Id
		ok = true
	}

	return
}

func ( u Memo ) GetId ( ) ( result Uint64 , ok bool ) { armName , _ := u . ArmForSwitch ( int32 ( u . Type ) ) if armName == " " { result = * u . Id ok = true } return }

// GetId retrieves the Id value from the union,
// returning ok if the union's switch indicated the value is valid.

GetId retrieves the Id value from the union returning ok if the union s switch indicated the value is valid .


func (u Memo) MustHash() Hash {
	val, ok := u.GetHash()

	if !ok {
		panic("arm Hash is not set")
	}

	return val
}

func ( u Memo ) MustHash ( ) Hash { val , ok := u . GetHash ( ) if ! ok { panic ( " " ) } return val }

// MustHash retrieves the Hash value from the union,
// panicing if the value is not set.

MustHash retrieves the Hash value from the union panicing if the value is not set .


func (u Memo) GetHash() (result Hash, ok bool) {
	armName, _ := u.ArmForSwitch(int32(u.Type))

	if armName == "Hash" {
		result = *u.Hash
		ok = true
	}

	return
}

func ( u Memo ) GetHash ( ) ( result Hash , ok bool ) { armName , _ := u . ArmForSwitch ( int32 ( u . Type ) ) if armName == " " { result = * u . Hash ok = true } return }

// GetHash retrieves the Hash value from the union,
// returning ok if the union's switch indicated the value is valid.

GetHash retrieves the Hash value from the union returning ok if the union s switch indicated the value is valid .


func (u Memo) MustRetHash() Hash {
	val, ok := u.GetRetHash()

	if !ok {
		panic("arm RetHash is not set")
	}

	return val
}

func ( u Memo ) MustRetHash ( ) Hash { val , ok := u . GetRetHash ( ) if ! ok { panic ( " " ) } return val }

// MustRetHash retrieves the RetHash value from the union,
// panicing if the value is not set.

MustRetHash retrieves the RetHash value from the union panicing if the value is not set .


func NewTransactionExt(v int32, value interface{}) (result TransactionExt, err error) {
	result.V = v
	switch int32(v) {
	case 0:
		// void
	}
	return
}

func
NewTransactionExt
(
v
int32
,
value
interface
{
}
)
(
result
TransactionExt
,
err
error
)
{
result
.
V
=
v
switch
int32
(
v
)
{
case
0
:
// void
}
return
}

// NewTransactionExt creates a new  TransactionExt.

NewTransactionExt creates a new TransactionExt .


func (e CreateAccountResultCode) ValidEnum(v int32) bool {
	_, ok := createAccountResultCodeMap[v]
	return ok
}

func ( e CreateAccountResultCode ) ValidEnum ( v int32 ) bool { _ , ok := createAccountResultCodeMap [ v ] return ok }

// ValidEnum validates a proposed value for this enum.  Implements
// the Enum interface for CreateAccountResultCode

ValidEnum validates a proposed value for this enum . Implements the Enum interface for CreateAccountResultCode


func (u CreateAccountResult) ArmForSwitch(sw int32) (string, bool) {
	switch CreateAccountResultCode(sw) {
	case CreateAccountResultCodeCreateAccountSuccess:
		return "", true
	default:
		return "", true
	}
}

// ArmForSwitch returns which field name should be used for storing
// the value for an instance of CreateAccountResult

ArmForSwitch returns which field name should be used for storing the value for an instance of CreateAccountResult


func NewCreateAccountResult(code CreateAccountResultCode, value interface{}) (result CreateAccountResult, err error) {
	result.Code = code
	switch CreateAccountResultCode(code) {
	case CreateAccountResultCodeCreateAccountSuccess:
		// void
	default:
		// void
	}
	return
}

// NewCreateAccountResult creates a new  CreateAccountResult.

NewCreateAccountResult creates a new CreateAccountResult .


func (e PaymentResultCode) ValidEnum(v int32) bool {
	_, ok := paymentResultCodeMap[v]
	return ok
}

func ( e PaymentResultCode ) ValidEnum ( v int32 ) bool { _ , ok := paymentResultCodeMap [ v ] return ok }

// ValidEnum validates a proposed value for this enum.  Implements
// the Enum interface for PaymentResultCode

ValidEnum validates a proposed value for this enum . Implements the Enum interface for PaymentResultCode


func (u PaymentResult) ArmForSwitch(sw int32) (string, bool) {
	switch PaymentResultCode(sw) {
	case PaymentResultCodePaymentSuccess:
		return "", true
	default:
		return "", true
	}
}

func ( u PaymentResult ) ArmForSwitch ( sw int32 ) ( string , bool ) { switch PaymentResultCode ( sw ) { case PaymentResultCodePaymentSuccess : return " " , true default : return " " , true } }

// ArmForSwitch returns which field name should be used for storing
// the value for an instance of PaymentResult

ArmForSwitch returns which field name should be used for storing the value for an instance of PaymentResult


func NewPaymentResult(code PaymentResultCode, value interface{}) (result PaymentResult, err error) {
	result.Code = code
	switch PaymentResultCode(code) {
	case PaymentResultCodePaymentSuccess:
		// void
	default:
		// void
	}
	return
}

func
NewPaymentResult
(
code
PaymentResultCode
,
value
interface
{
}
)
(
result
PaymentResult
,
err
error
)
{
result
.
Code
=
code
switch
PaymentResultCode
(
code
)
{
case
PaymentResultCodePaymentSuccess
:
// void
default
:
// void
}
return
}

// NewPaymentResult creates a new  PaymentResult.

NewPaymentResult creates a new PaymentResult .


func (e PathPaymentResultCode) ValidEnum(v int32) bool {
	_, ok := pathPaymentResultCodeMap[v]
	return ok
}

func ( e PathPaymentResultCode ) ValidEnum ( v int32 ) bool { _ , ok := pathPaymentResultCodeMap [ v ] return ok }

// ValidEnum validates a proposed value for this enum.  Implements
// the Enum interface for PathPaymentResultCode

ValidEnum validates a proposed value for this enum . Implements the Enum interface for PathPaymentResultCode


func (u PathPaymentResult) ArmForSwitch(sw int32) (string, bool) {
	switch PathPaymentResultCode(sw) {
	case PathPaymentResultCodePathPaymentSuccess:
		return "Success", true
	case PathPaymentResultCodePathPaymentNoIssuer:
		return "NoIssuer", true
	default:
		return "", true
	}
}

// ArmForSwitch returns which field name should be used for storing
// the value for an instance of PathPaymentResult

ArmForSwitch returns which field name should be used for storing the value for an instance of PathPaymentResult


func NewPathPaymentResult(code PathPaymentResultCode, value interface{}) (result PathPaymentResult, err error) {
	result.Code = code
	switch PathPaymentResultCode(code) {
	case PathPaymentResultCodePathPaymentSuccess:
		tv, ok := value.(PathPaymentResultSuccess)
		if !ok {
			err = fmt.Errorf("invalid value, must be PathPaymentResultSuccess")
			return
		}
		result.Success = &tv
	case PathPaymentResultCodePathPaymentNoIssuer:
		tv, ok := value.(Asset)
		if !ok {
			err = fmt.Errorf("invalid value, must be Asset")
			return
		}
		result.NoIssuer = &tv
	default:
		// void
	}
	return
}

// NewPathPaymentResult creates a new  PathPaymentResult.

NewPathPaymentResult creates a new PathPaymentResult .


func (u PathPaymentResult) MustNoIssuer() Asset {
	val, ok := u.GetNoIssuer()

	if !ok {
		panic("arm NoIssuer is not set")
	}

	return val
}

func ( u PathPaymentResult ) MustNoIssuer ( ) Asset { val , ok := u . GetNoIssuer ( ) if ! ok { panic ( " " ) } return val }

// MustNoIssuer retrieves the NoIssuer value from the union,
// panicing if the value is not set.

MustNoIssuer retrieves the NoIssuer value from the union panicing if the value is not set .


func (u PathPaymentResult) GetNoIssuer() (result Asset, ok bool) {
	armName, _ := u.ArmForSwitch(int32(u.Code))

	if armName == "NoIssuer" {
		result = *u.NoIssuer
		ok = true
	}

	return
}

func ( u PathPaymentResult ) GetNoIssuer ( ) ( result Asset , ok bool ) { armName , _ := u . ArmForSwitch ( int32 ( u . Code ) ) if armName == " " { result = * u . NoIssuer ok = true } return }

// GetNoIssuer retrieves the NoIssuer value from the union,
// returning ok if the union's switch indicated the value is valid.

GetNoIssuer retrieves the NoIssuer value from the union returning ok if the union s switch indicated the value is valid .


func (e ManageOfferResultCode) ValidEnum(v int32) bool {
	_, ok := manageOfferResultCodeMap[v]
	return ok
}

func ( e ManageOfferResultCode ) ValidEnum ( v int32 ) bool { _ , ok := manageOfferResultCodeMap [ v ] return ok }

// ValidEnum validates a proposed value for this enum.  Implements
// the Enum interface for ManageOfferResultCode

ValidEnum validates a proposed value for this enum . Implements the Enum interface for ManageOfferResultCode


func (e ManageOfferEffect) ValidEnum(v int32) bool {
	_, ok := manageOfferEffectMap[v]
	return ok
}

func ( e ManageOfferEffect ) ValidEnum ( v int32 ) bool { _ , ok := manageOfferEffectMap [ v ] return ok }

// ValidEnum validates a proposed value for this enum.  Implements
// the Enum interface for ManageOfferEffect

ValidEnum validates a proposed value for this enum . Implements the Enum interface for ManageOfferEffect


func (u ManageOfferSuccessResultOffer) ArmForSwitch(sw int32) (string, bool) {
	switch ManageOfferEffect(sw) {
	case ManageOfferEffectManageOfferCreated:
		return "Offer", true
	case ManageOfferEffectManageOfferUpdated:
		return "Offer", true
	default:
		return "", true
	}
}

func ( u ManageOfferSuccessResultOffer ) ArmForSwitch ( sw int32 ) ( string , bool ) { switch ManageOfferEffect ( sw ) { case ManageOfferEffectManageOfferCreated : return " " , true case ManageOfferEffectManageOfferUpdated : return " " , true default : return " " , true } }

// ArmForSwitch returns which field name should be used for storing
// the value for an instance of ManageOfferSuccessResultOffer

ArmForSwitch returns which field name should be used for storing the value for an instance of ManageOfferSuccessResultOffer


func NewManageOfferSuccessResultOffer(effect ManageOfferEffect, value interface{}) (result ManageOfferSuccessResultOffer, err error) {
	result.Effect = effect
	switch ManageOfferEffect(effect) {
	case ManageOfferEffectManageOfferCreated:
		tv, ok := value.(OfferEntry)
		if !ok {
			err = fmt.Errorf("invalid value, must be OfferEntry")
			return
		}
		result.Offer = &tv
	case ManageOfferEffectManageOfferUpdated:
		tv, ok := value.(OfferEntry)
		if !ok {
			err = fmt.Errorf("invalid value, must be OfferEntry")
			return
		}
		result.Offer = &tv
	default:
		// void
	}
	return
}

func
NewManageOfferSuccessResultOffer
(
effect
ManageOfferEffect
,
value
interface
{
}
)
(
result
ManageOfferSuccessResultOffer
,
err
error
)
{
result
.
Effect
=
effect
switch
ManageOfferEffect
(
effect
)
{
case
ManageOfferEffectManageOfferCreated
:
tv
,
ok
:=
value
.
(
OfferEntry
)
if
!
ok
{
err
=
fmt
.
Errorf
(
"
"
)
return
}
result
.
Offer
=
&
tv
case
ManageOfferEffectManageOfferUpdated
:
tv
,
ok
:=
value
.
(
OfferEntry
)
if
!
ok
{
err
=
fmt
.
Errorf
(
"
"
)
return
}
result
.
Offer
=
&
tv
default
:
// void
}
return
}

// NewManageOfferSuccessResultOffer creates a new  ManageOfferSuccessResultOffer.

NewManageOfferSuccessResultOffer creates a new ManageOfferSuccessResultOffer .


func (u ManageOfferResult) ArmForSwitch(sw int32) (string, bool) {
	switch ManageOfferResultCode(sw) {
	case ManageOfferResultCodeManageOfferSuccess:
		return "Success", true
	default:
		return "", true
	}
}

func ( u ManageOfferResult ) ArmForSwitch ( sw int32 ) ( string , bool ) { switch ManageOfferResultCode ( sw ) { case ManageOfferResultCodeManageOfferSuccess : return " " , true default : return " " , true } }

// ArmForSwitch returns which field name should be used for storing
// the value for an instance of ManageOfferResult

ArmForSwitch returns which field name should be used for storing the value for an instance of ManageOfferResult


func NewManageOfferResult(code ManageOfferResultCode, value interface{}) (result ManageOfferResult, err error) {
	result.Code = code
	switch ManageOfferResultCode(code) {
	case ManageOfferResultCodeManageOfferSuccess:
		tv, ok := value.(ManageOfferSuccessResult)
		if !ok {
			err = fmt.Errorf("invalid value, must be ManageOfferSuccessResult")
			return
		}
		result.Success = &tv
	default:
		// void
	}
	return
}

func
NewManageOfferResult
(
code
ManageOfferResultCode
,
value
interface
{
}
)
(
result
ManageOfferResult
,
err
error
)
{
result
.
Code
=
code
switch
ManageOfferResultCode
(
code
)
{
case
ManageOfferResultCodeManageOfferSuccess
:
tv
,
ok
:=
value
.
(
ManageOfferSuccessResult
)
if
!
ok
{
err
=
fmt
.
Errorf
(
"
"
)
return
}
result
.
Success
=
&
tv
default
:
// void
}
return
}

// NewManageOfferResult creates a new  ManageOfferResult.

NewManageOfferResult creates a new ManageOfferResult .


func (e SetOptionsResultCode) ValidEnum(v int32) bool {
	_, ok := setOptionsResultCodeMap[v]
	return ok
}

func ( e SetOptionsResultCode ) ValidEnum ( v int32 ) bool { _ , ok := setOptionsResultCodeMap [ v ] return ok }

// ValidEnum validates a proposed value for this enum.  Implements
// the Enum interface for SetOptionsResultCode

ValidEnum validates a proposed value for this enum . Implements the Enum interface for SetOptionsResultCode


func (u SetOptionsResult) ArmForSwitch(sw int32) (string, bool) {
	switch SetOptionsResultCode(sw) {
	case SetOptionsResultCodeSetOptionsSuccess:
		return "", true
	default:
		return "", true
	}
}

func ( u SetOptionsResult ) ArmForSwitch ( sw int32 ) ( string , bool ) { switch SetOptionsResultCode ( sw ) { case SetOptionsResultCodeSetOptionsSuccess : return " " , true default : return " " , true } }

// ArmForSwitch returns which field name should be used for storing
// the value for an instance of SetOptionsResult

ArmForSwitch returns which field name should be used for storing the value for an instance of SetOptionsResult


func NewSetOptionsResult(code SetOptionsResultCode, value interface{}) (result SetOptionsResult, err error) {
	result.Code = code
	switch SetOptionsResultCode(code) {
	case SetOptionsResultCodeSetOptionsSuccess:
		// void
	default:
		// void
	}
	return
}

func
NewSetOptionsResult
(
code
SetOptionsResultCode
,
value
interface
{
}
)
(
result
SetOptionsResult
,
err
error
)
{
result
.
Code
=
code
switch
SetOptionsResultCode
(
code
)
{
case
SetOptionsResultCodeSetOptionsSuccess
:
// void
default
:
// void
}
return
}

// NewSetOptionsResult creates a new  SetOptionsResult.

NewSetOptionsResult creates a new SetOptionsResult .


func (e ChangeTrustResultCode) ValidEnum(v int32) bool {
	_, ok := changeTrustResultCodeMap[v]
	return ok
}

func ( e ChangeTrustResultCode ) ValidEnum ( v int32 ) bool { _ , ok := changeTrustResultCodeMap [ v ] return ok }

// ValidEnum validates a proposed value for this enum.  Implements
// the Enum interface for ChangeTrustResultCode

ValidEnum validates a proposed value for this enum . Implements the Enum interface for ChangeTrustResultCode


func (u ChangeTrustResult) ArmForSwitch(sw int32) (string, bool) {
	switch ChangeTrustResultCode(sw) {
	case ChangeTrustResultCodeChangeTrustSuccess:
		return "", true
	default:
		return "", true
	}
}

func ( u ChangeTrustResult ) ArmForSwitch ( sw int32 ) ( string , bool ) { switch ChangeTrustResultCode ( sw ) { case ChangeTrustResultCodeChangeTrustSuccess : return " " , true default : return " " , true } }

// ArmForSwitch returns which field name should be used for storing
// the value for an instance of ChangeTrustResult

ArmForSwitch returns which field name should be used for storing the value for an instance of ChangeTrustResult


func NewChangeTrustResult(code ChangeTrustResultCode, value interface{}) (result ChangeTrustResult, err error) {
	result.Code = code
	switch ChangeTrustResultCode(code) {
	case ChangeTrustResultCodeChangeTrustSuccess:
		// void
	default:
		// void
	}
	return
}

func
NewChangeTrustResult
(
code
ChangeTrustResultCode
,
value
interface
{
}
)
(
result
ChangeTrustResult
,
err
error
)
{
result
.
Code
=
code
switch
ChangeTrustResultCode
(
code
)
{
case
ChangeTrustResultCodeChangeTrustSuccess
:
// void
default
:
// void
}
return
}

// NewChangeTrustResult creates a new  ChangeTrustResult.

NewChangeTrustResult creates a new ChangeTrustResult .


func (e AllowTrustResultCode) ValidEnum(v int32) bool {
	_, ok := allowTrustResultCodeMap[v]
	return ok
}

func ( e AllowTrustResultCode ) ValidEnum ( v int32 ) bool { _ , ok := allowTrustResultCodeMap [ v ] return ok }

// ValidEnum validates a proposed value for this enum.  Implements
// the Enum interface for AllowTrustResultCode

ValidEnum validates a proposed value for this enum . Implements the Enum interface for AllowTrustResultCode


func (u AllowTrustResult) ArmForSwitch(sw int32) (string, bool) {
	switch AllowTrustResultCode(sw) {
	case AllowTrustResultCodeAllowTrustSuccess:
		return "", true
	default:
		return "", true
	}
}

func ( u AllowTrustResult ) ArmForSwitch ( sw int32 ) ( string , bool ) { switch AllowTrustResultCode ( sw ) { case AllowTrustResultCodeAllowTrustSuccess : return " " , true default : return " " , true } }

// ArmForSwitch returns which field name should be used for storing
// the value for an instance of AllowTrustResult

ArmForSwitch returns which field name should be used for storing the value for an instance of AllowTrustResult


func NewAllowTrustResult(code AllowTrustResultCode, value interface{}) (result AllowTrustResult, err error) {
	result.Code = code
	switch AllowTrustResultCode(code) {
	case AllowTrustResultCodeAllowTrustSuccess:
		// void
	default:
		// void
	}
	return
}

func
NewAllowTrustResult
(
code
AllowTrustResultCode
,
value
interface
{
}
)
(
result
AllowTrustResult
,
err
error
)
{
result
.
Code
=
code
switch
AllowTrustResultCode
(
code
)
{
case
AllowTrustResultCodeAllowTrustSuccess
:
// void
default
:
// void
}
return
}

// NewAllowTrustResult creates a new  AllowTrustResult.

NewAllowTrustResult creates a new AllowTrustResult .


func (e AccountMergeResultCode) ValidEnum(v int32) bool {
	_, ok := accountMergeResultCodeMap[v]
	return ok
}

func ( e AccountMergeResultCode ) ValidEnum ( v int32 ) bool { _ , ok := accountMergeResultCodeMap [ v ] return ok }

// ValidEnum validates a proposed value for this enum.  Implements
// the Enum interface for AccountMergeResultCode

ValidEnum validates a proposed value for this enum . Implements the Enum interface for AccountMergeResultCode


func (u AccountMergeResult) ArmForSwitch(sw int32) (string, bool) {
	switch AccountMergeResultCode(sw) {
	case AccountMergeResultCodeAccountMergeSuccess:
		return "SourceAccountBalance", true
	default:
		return "", true
	}
}

// ArmForSwitch returns which field name should be used for storing
// the value for an instance of AccountMergeResult

ArmForSwitch returns which field name should be used for storing the value for an instance of AccountMergeResult


func NewAccountMergeResult(code AccountMergeResultCode, value interface{}) (result AccountMergeResult, err error) {
	result.Code = code
	switch AccountMergeResultCode(code) {
	case AccountMergeResultCodeAccountMergeSuccess:
		tv, ok := value.(Int64)
		if !ok {
			err = fmt.Errorf("invalid value, must be Int64")
			return
		}
		result.SourceAccountBalance = &tv
	default:
		// void
	}
	return
}

// NewAccountMergeResult creates a new  AccountMergeResult.

NewAccountMergeResult creates a new AccountMergeResult .


func (u AccountMergeResult) MustSourceAccountBalance() Int64 {
	val, ok := u.GetSourceAccountBalance()

	if !ok {
		panic("arm SourceAccountBalance is not set")
	}

	return val
}

func ( u AccountMergeResult ) MustSourceAccountBalance ( ) Int64 { val , ok := u . GetSourceAccountBalance ( ) if ! ok { panic ( " " ) } return val }

// MustSourceAccountBalance retrieves the SourceAccountBalance value from the union,
// panicing if the value is not set.

MustSourceAccountBalance retrieves the SourceAccountBalance value from the union panicing if the value is not set .


func (u AccountMergeResult) GetSourceAccountBalance() (result Int64, ok bool) {
	armName, _ := u.ArmForSwitch(int32(u.Code))

	if armName == "SourceAccountBalance" {
		result = *u.SourceAccountBalance
		ok = true
	}

	return
}

func ( u AccountMergeResult ) GetSourceAccountBalance ( ) ( result Int64 , ok bool ) { armName , _ := u . ArmForSwitch ( int32 ( u . Code ) ) if armName == " " { result = * u . SourceAccountBalance ok = true } return }

// GetSourceAccountBalance retrieves the SourceAccountBalance value from the union,
// returning ok if the union's switch indicated the value is valid.

GetSourceAccountBalance retrieves the SourceAccountBalance value from the union returning ok if the union s switch indicated the value is valid .


func (e InflationResultCode) ValidEnum(v int32) bool {
	_, ok := inflationResultCodeMap[v]
	return ok
}

func ( e InflationResultCode ) ValidEnum ( v int32 ) bool { _ , ok := inflationResultCodeMap [ v ] return ok }

// ValidEnum validates a proposed value for this enum.  Implements
// the Enum interface for InflationResultCode

ValidEnum validates a proposed value for this enum . Implements the Enum interface for InflationResultCode


func (u InflationResult) ArmForSwitch(sw int32) (string, bool) {
	switch InflationResultCode(sw) {
	case InflationResultCodeInflationSuccess:
		return "Payouts", true
	default:
		return "", true
	}
}

func ( u InflationResult ) ArmForSwitch ( sw int32 ) ( string , bool ) { switch InflationResultCode ( sw ) { case InflationResultCodeInflationSuccess : return " " , true default : return " " , true } }

// ArmForSwitch returns which field name should be used for storing
// the value for an instance of InflationResult

ArmForSwitch returns which field name should be used for storing the value for an instance of InflationResult


func NewInflationResult(code InflationResultCode, value interface{}) (result InflationResult, err error) {
	result.Code = code
	switch InflationResultCode(code) {
	case InflationResultCodeInflationSuccess:
		tv, ok := value.([]InflationPayout)
		if !ok {
			err = fmt.Errorf("invalid value, must be []InflationPayout")
			return
		}
		result.Payouts = &tv
	default:
		// void
	}
	return
}

func
NewInflationResult
(
code
InflationResultCode
,
value
interface
{
}
)
(
result
InflationResult
,
err
error
)
{
result
.
Code
=
code
switch
InflationResultCode
(
code
)
{
case
InflationResultCodeInflationSuccess
:
tv
,
ok
:=
value
.
(
[
]
InflationPayout
)
if
!
ok
{
err
=
fmt
.
Errorf
(
"
"
)
return
}
result
.
Payouts
=
&
tv
default
:
// void
}
return
}

// NewInflationResult creates a new  InflationResult.

NewInflationResult creates a new InflationResult .


func (u InflationResult) MustPayouts() []InflationPayout {
	val, ok := u.GetPayouts()

	if !ok {
		panic("arm Payouts is not set")
	}

	return val
}

func ( u InflationResult ) MustPayouts ( ) [ ] InflationPayout { val , ok := u . GetPayouts ( ) if ! ok { panic ( " " ) } return val }

// MustPayouts retrieves the Payouts value from the union,
// panicing if the value is not set.

MustPayouts retrieves the Payouts value from the union panicing if the value is not set .


func (u InflationResult) GetPayouts() (result []InflationPayout, ok bool) {
	armName, _ := u.ArmForSwitch(int32(u.Code))

	if armName == "Payouts" {
		result = *u.Payouts
		ok = true
	}

	return
}

func ( u InflationResult ) GetPayouts ( ) ( result [ ] InflationPayout , ok bool ) { armName , _ := u . ArmForSwitch ( int32 ( u . Code ) ) if armName == " " { result = * u . Payouts ok = true } return }

// GetPayouts retrieves the Payouts value from the union,
// returning ok if the union's switch indicated the value is valid.

GetPayouts retrieves the Payouts value from the union returning ok if the union s switch indicated the value is valid .


func (e ManageDataResultCode) ValidEnum(v int32) bool {
	_, ok := manageDataResultCodeMap[v]
	return ok
}

func ( e ManageDataResultCode ) ValidEnum ( v int32 ) bool { _ , ok := manageDataResultCodeMap [ v ] return ok }

// ValidEnum validates a proposed value for this enum.  Implements
// the Enum interface for ManageDataResultCode

ValidEnum validates a proposed value for this enum . Implements the Enum interface for ManageDataResultCode


func (u ManageDataResult) ArmForSwitch(sw int32) (string, bool) {
	switch ManageDataResultCode(sw) {
	case ManageDataResultCodeManageDataSuccess:
		return "", true
	default:
		return "", true
	}
}

func ( u ManageDataResult ) ArmForSwitch ( sw int32 ) ( string , bool ) { switch ManageDataResultCode ( sw ) { case ManageDataResultCodeManageDataSuccess : return " " , true default : return " " , true } }

// ArmForSwitch returns which field name should be used for storing
// the value for an instance of ManageDataResult

ArmForSwitch returns which field name should be used for storing the value for an instance of ManageDataResult


func NewManageDataResult(code ManageDataResultCode, value interface{}) (result ManageDataResult, err error) {
	result.Code = code
	switch ManageDataResultCode(code) {
	case ManageDataResultCodeManageDataSuccess:
		// void
	default:
		// void
	}
	return
}

func
NewManageDataResult
(
code
ManageDataResultCode
,
value
interface
{
}
)
(
result
ManageDataResult
,
err
error
)
{
result
.
Code
=
code
switch
ManageDataResultCode
(
code
)
{
case
ManageDataResultCodeManageDataSuccess
:
// void
default
:
// void
}
return
}

// NewManageDataResult creates a new  ManageDataResult.

NewManageDataResult creates a new ManageDataResult .


func (e OperationResultCode) ValidEnum(v int32) bool {
	_, ok := operationResultCodeMap[v]
	return ok
}

func ( e OperationResultCode ) ValidEnum ( v int32 ) bool { _ , ok := operationResultCodeMap [ v ] return ok }

// ValidEnum validates a proposed value for this enum.  Implements
// the Enum interface for OperationResultCode

ValidEnum validates a proposed value for this enum . Implements the Enum interface for OperationResultCode


func (u OperationResultTr) ArmForSwitch(sw int32) (string, bool) {
	switch OperationType(sw) {
	case OperationTypeCreateAccount:
		return "CreateAccountResult", true
	case OperationTypePayment:
		return "PaymentResult", true
	case OperationTypePathPayment:
		return "PathPaymentResult", true
	case OperationTypeManageOffer:
		return "ManageOfferResult", true
	case OperationTypeCreatePassiveOffer:
		return "CreatePassiveOfferResult", true
	case OperationTypeSetOptions:
		return "SetOptionsResult", true
	case OperationTypeChangeTrust:
		return "ChangeTrustResult", true
	case OperationTypeAllowTrust:
		return "AllowTrustResult", true
	case OperationTypeAccountMerge:
		return "AccountMergeResult", true
	case OperationTypeInflation:
		return "InflationResult", true
	case OperationTypeManageData:
		return "ManageDataResult", true
	}
	return "-", false
}

func ( u OperationResultTr ) ArmForSwitch ( sw int32 ) ( string , bool ) { switch OperationType ( sw ) { case OperationTypeCreateAccount : return " " , true case OperationTypePayment : return " " , true case OperationTypePathPayment : return " " , true case OperationTypeManageOffer : return " " , true case OperationTypeCreatePassiveOffer : return " " , true case OperationTypeSetOptions : return " " , true case OperationTypeChangeTrust : return " " , true case OperationTypeAllowTrust : return " " , true case OperationTypeAccountMerge : return " " , true case OperationTypeInflation : return " " , true case OperationTypeManageData : return " " , true } return " " , false }

// ArmForSwitch returns which field name should be used for storing
// the value for an instance of OperationResultTr

ArmForSwitch returns which field name should be used for storing the value for an instance of OperationResultTr


func NewOperationResultTr(aType OperationType, value interface{}) (result OperationResultTr, err error) {
	result.Type = aType
	switch OperationType(aType) {
	case OperationTypeCreateAccount:
		tv, ok := value.(CreateAccountResult)
		if !ok {
			err = fmt.Errorf("invalid value, must be CreateAccountResult")
			return
		}
		result.CreateAccountResult = &tv
	case OperationTypePayment:
		tv, ok := value.(PaymentResult)
		if !ok {
			err = fmt.Errorf("invalid value, must be PaymentResult")
			return
		}
		result.PaymentResult = &tv
	case OperationTypePathPayment:
		tv, ok := value.(PathPaymentResult)
		if !ok {
			err = fmt.Errorf("invalid value, must be PathPaymentResult")
			return
		}
		result.PathPaymentResult = &tv
	case OperationTypeManageOffer:
		tv, ok := value.(ManageOfferResult)
		if !ok {
			err = fmt.Errorf("invalid value, must be ManageOfferResult")
			return
		}
		result.ManageOfferResult = &tv
	case OperationTypeCreatePassiveOffer:
		tv, ok := value.(ManageOfferResult)
		if !ok {
			err = fmt.Errorf("invalid value, must be ManageOfferResult")
			return
		}
		result.CreatePassiveOfferResult = &tv
	case OperationTypeSetOptions:
		tv, ok := value.(SetOptionsResult)
		if !ok {
			err = fmt.Errorf("invalid value, must be SetOptionsResult")
			return
		}
		result.SetOptionsResult = &tv
	case OperationTypeChangeTrust:
		tv, ok := value.(ChangeTrustResult)
		if !ok {
			err = fmt.Errorf("invalid value, must be ChangeTrustResult")
			return
		}
		result.ChangeTrustResult = &tv
	case OperationTypeAllowTrust:
		tv, ok := value.(AllowTrustResult)
		if !ok {
			err = fmt.Errorf("invalid value, must be AllowTrustResult")
			return
		}
		result.AllowTrustResult = &tv
	case OperationTypeAccountMerge:
		tv, ok := value.(AccountMergeResult)
		if !ok {
			err = fmt.Errorf("invalid value, must be AccountMergeResult")
			return
		}
		result.AccountMergeResult = &tv
	case OperationTypeInflation:
		tv, ok := value.(InflationResult)
		if !ok {
			err = fmt.Errorf("invalid value, must be InflationResult")
			return
		}
		result.InflationResult = &tv
	case OperationTypeManageData:
		tv, ok := value.(ManageDataResult)
		if !ok {
			err = fmt.Errorf("invalid value, must be ManageDataResult")
			return
		}
		result.ManageDataResult = &tv
	}
	return
}

func NewOperationResultTr ( aType OperationType , value interface { } ) ( result OperationResultTr , err error ) { result . Type = aType switch OperationType ( aType ) { case OperationTypeCreateAccount : tv , ok := value . ( CreateAccountResult ) if ! ok { err = fmt . Errorf ( " " ) return } result . CreateAccountResult = & tv case OperationTypePayment : tv , ok := value . ( PaymentResult ) if ! ok { err = fmt . Errorf ( " " ) return } result . PaymentResult = & tv case OperationTypePathPayment : tv , ok := value . ( PathPaymentResult ) if ! ok { err = fmt . Errorf ( " " ) return } result . PathPaymentResult = & tv case OperationTypeManageOffer : tv , ok := value . ( ManageOfferResult ) if ! ok { err = fmt . Errorf ( " " ) return } result . ManageOfferResult = & tv case OperationTypeCreatePassiveOffer : tv , ok := value . ( ManageOfferResult ) if ! ok { err = fmt . Errorf ( " " ) return } result . CreatePassiveOfferResult = & tv case OperationTypeSetOptions : tv , ok := value . ( SetOptionsResult ) if ! ok { err = fmt . Errorf ( " " ) return } result . SetOptionsResult = & tv case OperationTypeChangeTrust : tv , ok := value . ( ChangeTrustResult ) if ! ok { err = fmt . Errorf ( " " ) return } result . ChangeTrustResult = & tv case OperationTypeAllowTrust : tv , ok := value . ( AllowTrustResult ) if ! ok { err = fmt . Errorf ( " " ) return } result . AllowTrustResult = & tv case OperationTypeAccountMerge : tv , ok := value . ( AccountMergeResult ) if ! ok { err = fmt . Errorf ( " " ) return } result . AccountMergeResult = & tv case OperationTypeInflation : tv , ok := value . ( InflationResult ) if ! ok { err = fmt . Errorf ( " " ) return } result . InflationResult = & tv case OperationTypeManageData : tv , ok := value . ( ManageDataResult ) if ! ok { err = fmt . Errorf ( " " ) return } result . ManageDataResult = & tv } return }

// NewOperationResultTr creates a new  OperationResultTr.

NewOperationResultTr creates a new OperationResultTr .


func (u OperationResultTr) MustCreateAccountResult() CreateAccountResult {
	val, ok := u.GetCreateAccountResult()

	if !ok {
		panic("arm CreateAccountResult is not set")
	}

	return val
}

func ( u OperationResultTr ) MustCreateAccountResult ( ) CreateAccountResult { val , ok := u . GetCreateAccountResult ( ) if ! ok { panic ( " " ) } return val }

// MustCreateAccountResult retrieves the CreateAccountResult value from the union,
// panicing if the value is not set.

MustCreateAccountResult retrieves the CreateAccountResult value from the union panicing if the value is not set .


func (u OperationResultTr) GetCreateAccountResult() (result CreateAccountResult, ok bool) {
	armName, _ := u.ArmForSwitch(int32(u.Type))

	if armName == "CreateAccountResult" {
		result = *u.CreateAccountResult
		ok = true
	}

	return
}

func ( u OperationResultTr ) GetCreateAccountResult ( ) ( result CreateAccountResult , ok bool ) { armName , _ := u . ArmForSwitch ( int32 ( u . Type ) ) if armName == " " { result = * u . CreateAccountResult ok = true } return }

// GetCreateAccountResult retrieves the CreateAccountResult value from the union,
// returning ok if the union's switch indicated the value is valid.

GetCreateAccountResult retrieves the CreateAccountResult value from the union returning ok if the union s switch indicated the value is valid .


func (u OperationResultTr) MustPaymentResult() PaymentResult {
	val, ok := u.GetPaymentResult()

	if !ok {
		panic("arm PaymentResult is not set")
	}

	return val
}

func ( u OperationResultTr ) MustPaymentResult ( ) PaymentResult { val , ok := u . GetPaymentResult ( ) if ! ok { panic ( " " ) } return val }

// MustPaymentResult retrieves the PaymentResult value from the union,
// panicing if the value is not set.

MustPaymentResult retrieves the PaymentResult value from the union panicing if the value is not set .


func (u OperationResultTr) GetPaymentResult() (result PaymentResult, ok bool) {
	armName, _ := u.ArmForSwitch(int32(u.Type))

	if armName == "PaymentResult" {
		result = *u.PaymentResult
		ok = true
	}

	return
}

func ( u OperationResultTr ) GetPaymentResult ( ) ( result PaymentResult , ok bool ) { armName , _ := u . ArmForSwitch ( int32 ( u . Type ) ) if armName == " " { result = * u . PaymentResult ok = true } return }

// GetPaymentResult retrieves the PaymentResult value from the union,
// returning ok if the union's switch indicated the value is valid.

GetPaymentResult retrieves the PaymentResult value from the union returning ok if the union s switch indicated the value is valid .


func (u OperationResultTr) MustPathPaymentResult() PathPaymentResult {
	val, ok := u.GetPathPaymentResult()

	if !ok {
		panic("arm PathPaymentResult is not set")
	}

	return val
}

func ( u OperationResultTr ) MustPathPaymentResult ( ) PathPaymentResult { val , ok := u . GetPathPaymentResult ( ) if ! ok { panic ( " " ) } return val }

// MustPathPaymentResult retrieves the PathPaymentResult value from the union,
// panicing if the value is not set.

MustPathPaymentResult retrieves the PathPaymentResult value from the union panicing if the value is not set .


func (u OperationResultTr) GetPathPaymentResult() (result PathPaymentResult, ok bool) {
	armName, _ := u.ArmForSwitch(int32(u.Type))

	if armName == "PathPaymentResult" {
		result = *u.PathPaymentResult
		ok = true
	}

	return
}

func ( u OperationResultTr ) GetPathPaymentResult ( ) ( result PathPaymentResult , ok bool ) { armName , _ := u . ArmForSwitch ( int32 ( u . Type ) ) if armName == " " { result = * u . PathPaymentResult ok = true } return }

// GetPathPaymentResult retrieves the PathPaymentResult value from the union,
// returning ok if the union's switch indicated the value is valid.

GetPathPaymentResult retrieves the PathPaymentResult value from the union returning ok if the union s switch indicated the value is valid .


func (u OperationResultTr) MustManageOfferResult() ManageOfferResult {
	val, ok := u.GetManageOfferResult()

	if !ok {
		panic("arm ManageOfferResult is not set")
	}

	return val
}

func ( u OperationResultTr ) MustManageOfferResult ( ) ManageOfferResult { val , ok := u . GetManageOfferResult ( ) if ! ok { panic ( " " ) } return val }

// MustManageOfferResult retrieves the ManageOfferResult value from the union,
// panicing if the value is not set.

MustManageOfferResult retrieves the ManageOfferResult value from the union panicing if the value is not set .


func (u OperationResultTr) GetManageOfferResult() (result ManageOfferResult, ok bool) {
	armName, _ := u.ArmForSwitch(int32(u.Type))

	if armName == "ManageOfferResult" {
		result = *u.ManageOfferResult
		ok = true
	}

	return
}

func ( u OperationResultTr ) GetManageOfferResult ( ) ( result ManageOfferResult , ok bool ) { armName , _ := u . ArmForSwitch ( int32 ( u . Type ) ) if armName == " " { result = * u . ManageOfferResult ok = true } return }

// GetManageOfferResult retrieves the ManageOfferResult value from the union,
// returning ok if the union's switch indicated the value is valid.

GetManageOfferResult retrieves the ManageOfferResult value from the union returning ok if the union s switch indicated the value is valid .


func (u OperationResultTr) MustCreatePassiveOfferResult() ManageOfferResult {
	val, ok := u.GetCreatePassiveOfferResult()

	if !ok {
		panic("arm CreatePassiveOfferResult is not set")
	}

	return val
}

func ( u OperationResultTr ) MustCreatePassiveOfferResult ( ) ManageOfferResult { val , ok := u . GetCreatePassiveOfferResult ( ) if ! ok { panic ( " " ) } return val }

// MustCreatePassiveOfferResult retrieves the CreatePassiveOfferResult value from the union,
// panicing if the value is not set.

MustCreatePassiveOfferResult retrieves the CreatePassiveOfferResult value from the union panicing if the value is not set .


func (u OperationResultTr) MustSetOptionsResult() SetOptionsResult {
	val, ok := u.GetSetOptionsResult()

	if !ok {
		panic("arm SetOptionsResult is not set")
	}

	return val
}

func ( u OperationResultTr ) MustSetOptionsResult ( ) SetOptionsResult { val , ok := u . GetSetOptionsResult ( ) if ! ok { panic ( " " ) } return val }

// MustSetOptionsResult retrieves the SetOptionsResult value from the union,
// panicing if the value is not set.

MustSetOptionsResult retrieves the SetOptionsResult value from the union panicing if the value is not set .


func (u OperationResultTr) GetSetOptionsResult() (result SetOptionsResult, ok bool) {
	armName, _ := u.ArmForSwitch(int32(u.Type))

	if armName == "SetOptionsResult" {
		result = *u.SetOptionsResult
		ok = true
	}

	return
}

func ( u OperationResultTr ) GetSetOptionsResult ( ) ( result SetOptionsResult , ok bool ) { armName , _ := u . ArmForSwitch ( int32 ( u . Type ) ) if armName == " " { result = * u . SetOptionsResult ok = true } return }

// GetSetOptionsResult retrieves the SetOptionsResult value from the union,
// returning ok if the union's switch indicated the value is valid.

GetSetOptionsResult retrieves the SetOptionsResult value from the union returning ok if the union s switch indicated the value is valid .


func (u OperationResultTr) MustChangeTrustResult() ChangeTrustResult {
	val, ok := u.GetChangeTrustResult()

	if !ok {
		panic("arm ChangeTrustResult is not set")
	}

	return val
}

func ( u OperationResultTr ) MustChangeTrustResult ( ) ChangeTrustResult { val , ok := u . GetChangeTrustResult ( ) if ! ok { panic ( " " ) } return val }

// MustChangeTrustResult retrieves the ChangeTrustResult value from the union,
// panicing if the value is not set.

MustChangeTrustResult retrieves the ChangeTrustResult value from the union panicing if the value is not set .


func (u OperationResultTr) GetChangeTrustResult() (result ChangeTrustResult, ok bool) {
	armName, _ := u.ArmForSwitch(int32(u.Type))

	if armName == "ChangeTrustResult" {
		result = *u.ChangeTrustResult
		ok = true
	}

	return
}

func ( u OperationResultTr ) GetChangeTrustResult ( ) ( result ChangeTrustResult , ok bool ) { armName , _ := u . ArmForSwitch ( int32 ( u . Type ) ) if armName == " " { result = * u . ChangeTrustResult ok = true } return }

// GetChangeTrustResult retrieves the ChangeTrustResult value from the union,
// returning ok if the union's switch indicated the value is valid.

GetChangeTrustResult retrieves the ChangeTrustResult value from the union returning ok if the union s switch indicated the value is valid .


func (u OperationResultTr) MustAllowTrustResult() AllowTrustResult {
	val, ok := u.GetAllowTrustResult()

	if !ok {
		panic("arm AllowTrustResult is not set")
	}

	return val
}

func ( u OperationResultTr ) MustAllowTrustResult ( ) AllowTrustResult { val , ok := u . GetAllowTrustResult ( ) if ! ok { panic ( " " ) } return val }

// MustAllowTrustResult retrieves the AllowTrustResult value from the union,
// panicing if the value is not set.

MustAllowTrustResult retrieves the AllowTrustResult value from the union panicing if the value is not set .


func (u OperationResultTr) GetAllowTrustResult() (result AllowTrustResult, ok bool) {
	armName, _ := u.ArmForSwitch(int32(u.Type))

	if armName == "AllowTrustResult" {
		result = *u.AllowTrustResult
		ok = true
	}

	return
}

func ( u OperationResultTr ) GetAllowTrustResult ( ) ( result AllowTrustResult , ok bool ) { armName , _ := u . ArmForSwitch ( int32 ( u . Type ) ) if armName == " " { result = * u . AllowTrustResult ok = true } return }

// GetAllowTrustResult retrieves the AllowTrustResult value from the union,
// returning ok if the union's switch indicated the value is valid.

GetAllowTrustResult retrieves the AllowTrustResult value from the union returning ok if the union s switch indicated the value is valid .


func (u OperationResultTr) MustAccountMergeResult() AccountMergeResult {
	val, ok := u.GetAccountMergeResult()

	if !ok {
		panic("arm AccountMergeResult is not set")
	}

	return val
}

func ( u OperationResultTr ) MustAccountMergeResult ( ) AccountMergeResult { val , ok := u . GetAccountMergeResult ( ) if ! ok { panic ( " " ) } return val }

// MustAccountMergeResult retrieves the AccountMergeResult value from the union,
// panicing if the value is not set.

MustAccountMergeResult retrieves the AccountMergeResult value from the union panicing if the value is not set .


func (u OperationResultTr) GetAccountMergeResult() (result AccountMergeResult, ok bool) {
	armName, _ := u.ArmForSwitch(int32(u.Type))

	if armName == "AccountMergeResult" {
		result = *u.AccountMergeResult
		ok = true
	}

	return
}

func ( u OperationResultTr ) GetAccountMergeResult ( ) ( result AccountMergeResult , ok bool ) { armName , _ := u . ArmForSwitch ( int32 ( u . Type ) ) if armName == " " { result = * u . AccountMergeResult ok = true } return }

// GetAccountMergeResult retrieves the AccountMergeResult value from the union,
// returning ok if the union's switch indicated the value is valid.

GetAccountMergeResult retrieves the AccountMergeResult value from the union returning ok if the union s switch indicated the value is valid .


func (u OperationResultTr) MustInflationResult() InflationResult {
	val, ok := u.GetInflationResult()

	if !ok {
		panic("arm InflationResult is not set")
	}

	return val
}

func ( u OperationResultTr ) MustInflationResult ( ) InflationResult { val , ok := u . GetInflationResult ( ) if ! ok { panic ( " " ) } return val }

// MustInflationResult retrieves the InflationResult value from the union,
// panicing if the value is not set.

MustInflationResult retrieves the InflationResult value from the union panicing if the value is not set .


func (u OperationResultTr) GetInflationResult() (result InflationResult, ok bool) {
	armName, _ := u.ArmForSwitch(int32(u.Type))

	if armName == "InflationResult" {
		result = *u.InflationResult
		ok = true
	}

	return
}

func ( u OperationResultTr ) GetInflationResult ( ) ( result InflationResult , ok bool ) { armName , _ := u . ArmForSwitch ( int32 ( u . Type ) ) if armName == " " { result = * u . InflationResult ok = true } return }

// GetInflationResult retrieves the InflationResult value from the union,
// returning ok if the union's switch indicated the value is valid.

GetInflationResult retrieves the InflationResult value from the union returning ok if the union s switch indicated the value is valid .


func (u OperationResultTr) MustManageDataResult() ManageDataResult {
	val, ok := u.GetManageDataResult()

	if !ok {
		panic("arm ManageDataResult is not set")
	}

	return val
}

func ( u OperationResultTr ) MustManageDataResult ( ) ManageDataResult { val , ok := u . GetManageDataResult ( ) if ! ok { panic ( " " ) } return val }

// MustManageDataResult retrieves the ManageDataResult value from the union,
// panicing if the value is not set.

MustManageDataResult retrieves the ManageDataResult value from the union panicing if the value is not set .


func (u OperationResultTr) GetManageDataResult() (result ManageDataResult, ok bool) {
	armName, _ := u.ArmForSwitch(int32(u.Type))

	if armName == "ManageDataResult" {
		result = *u.ManageDataResult
		ok = true
	}

	return
}

func ( u OperationResultTr ) GetManageDataResult ( ) ( result ManageDataResult , ok bool ) { armName , _ := u . ArmForSwitch ( int32 ( u . Type ) ) if armName == " " { result = * u . ManageDataResult ok = true } return }

// GetManageDataResult retrieves the ManageDataResult value from the union,
// returning ok if the union's switch indicated the value is valid.

GetManageDataResult retrieves the ManageDataResult value from the union returning ok if the union s switch indicated the value is valid .


func (u OperationResult) ArmForSwitch(sw int32) (string, bool) {
	switch OperationResultCode(sw) {
	case OperationResultCodeOpInner:
		return "Tr", true
	default:
		return "", true
	}
}

func ( u OperationResult ) ArmForSwitch ( sw int32 ) ( string , bool ) { switch OperationResultCode ( sw ) { case OperationResultCodeOpInner : return " " , true default : return " " , true } }

// ArmForSwitch returns which field name should be used for storing
// the value for an instance of OperationResult

ArmForSwitch returns which field name should be used for storing the value for an instance of OperationResult


func NewOperationResult(code OperationResultCode, value interface{}) (result OperationResult, err error) {
	result.Code = code
	switch OperationResultCode(code) {
	case OperationResultCodeOpInner:
		tv, ok := value.(OperationResultTr)
		if !ok {
			err = fmt.Errorf("invalid value, must be OperationResultTr")
			return
		}
		result.Tr = &tv
	default:
		// void
	}
	return
}

func
NewOperationResult
(
code
OperationResultCode
,
value
interface
{
}
)
(
result
OperationResult
,
err
error
)
{
result
.
Code
=
code
switch
OperationResultCode
(
code
)
{
case
OperationResultCodeOpInner
:
tv
,
ok
:=
value
.
(
OperationResultTr
)
if
!
ok
{
err
=
fmt
.
Errorf
(
"
"
)
return
}
result
.
Tr
=
&
tv
default
:
// void
}
return
}

// NewOperationResult creates a new  OperationResult.

NewOperationResult creates a new OperationResult .


func (u OperationResult) MustTr() OperationResultTr {
	val, ok := u.GetTr()

	if !ok {
		panic("arm Tr is not set")
	}

	return val
}

func ( u OperationResult ) MustTr ( ) OperationResultTr { val , ok := u . GetTr ( ) if ! ok { panic ( " " ) } return val }

// MustTr retrieves the Tr value from the union,
// panicing if the value is not set.

MustTr retrieves the Tr value from the union panicing if the value is not set .


func (u OperationResult) GetTr() (result OperationResultTr, ok bool) {
	armName, _ := u.ArmForSwitch(int32(u.Code))

	if armName == "Tr" {
		result = *u.Tr
		ok = true
	}

	return
}

func ( u OperationResult ) GetTr ( ) ( result OperationResultTr , ok bool ) { armName , _ := u . ArmForSwitch ( int32 ( u . Code ) ) if armName == " " { result = * u . Tr ok = true } return }

// GetTr retrieves the Tr value from the union,
// returning ok if the union's switch indicated the value is valid.

GetTr retrieves the Tr value from the union returning ok if the union s switch indicated the value is valid .


func (e TransactionResultCode) ValidEnum(v int32) bool {
	_, ok := transactionResultCodeMap[v]
	return ok
}

func ( e TransactionResultCode ) ValidEnum ( v int32 ) bool { _ , ok := transactionResultCodeMap [ v ] return ok }

// ValidEnum validates a proposed value for this enum.  Implements
// the Enum interface for TransactionResultCode

ValidEnum validates a proposed value for this enum . Implements the Enum interface for TransactionResultCode


func (u TransactionResultResult) ArmForSwitch(sw int32) (string, bool) {
	switch TransactionResultCode(sw) {
	case TransactionResultCodeTxSuccess:
		return "Results", true
	case TransactionResultCodeTxFailed:
		return "Results", true
	default:
		return "", true
	}
}

func ( u TransactionResultResult ) ArmForSwitch ( sw int32 ) ( string , bool ) { switch TransactionResultCode ( sw ) { case TransactionResultCodeTxSuccess : return " " , true case TransactionResultCodeTxFailed : return " " , true default : return " " , true } }

// ArmForSwitch returns which field name should be used for storing
// the value for an instance of TransactionResultResult

ArmForSwitch returns which field name should be used for storing the value for an instance of TransactionResultResult


func NewTransactionResultResult(code TransactionResultCode, value interface{}) (result TransactionResultResult, err error) {
	result.Code = code
	switch TransactionResultCode(code) {
	case TransactionResultCodeTxSuccess:
		tv, ok := value.([]OperationResult)
		if !ok {
			err = fmt.Errorf("invalid value, must be []OperationResult")
			return
		}
		result.Results = &tv
	case TransactionResultCodeTxFailed:
		tv, ok := value.([]OperationResult)
		if !ok {
			err = fmt.Errorf("invalid value, must be []OperationResult")
			return
		}
		result.Results = &tv
	default:
		// void
	}
	return
}

func
NewTransactionResultResult
(
code
TransactionResultCode
,
value
interface
{
}
)
(
result
TransactionResultResult
,
err
error
)
{
result
.
Code
=
code
switch
TransactionResultCode
(
code
)
{
case
TransactionResultCodeTxSuccess
:
tv
,
ok
:=
value
.
(
[
]
OperationResult
)
if
!
ok
{
err
=
fmt
.
Errorf
(
"
"
)
return
}
result
.
Results
=
&
tv
case
TransactionResultCodeTxFailed
:
tv
,
ok
:=
value
.
(
[
]
OperationResult
)
if
!
ok
{
err
=
fmt
.
Errorf
(
"
"
)
return
}
result
.
Results
=
&
tv
default
:
// void
}
return
}

// NewTransactionResultResult creates a new  TransactionResultResult.

NewTransactionResultResult creates a new TransactionResultResult .


func (u TransactionResultResult) MustResults() []OperationResult {
	val, ok := u.GetResults()

	if !ok {
		panic("arm Results is not set")
	}

	return val
}

func ( u TransactionResultResult ) MustResults ( ) [ ] OperationResult { val , ok := u . GetResults ( ) if ! ok { panic ( " " ) } return val }

// MustResults retrieves the Results value from the union,
// panicing if the value is not set.

MustResults retrieves the Results value from the union panicing if the value is not set .


func (u TransactionResultResult) GetResults() (result []OperationResult, ok bool) {
	armName, _ := u.ArmForSwitch(int32(u.Code))

	if armName == "Results" {
		result = *u.Results
		ok = true
	}

	return
}

func ( u TransactionResultResult ) GetResults ( ) ( result [ ] OperationResult , ok bool ) { armName , _ := u . ArmForSwitch ( int32 ( u . Code ) ) if armName == " " { result = * u . Results ok = true } return }

// GetResults retrieves the Results value from the union,
// returning ok if the union's switch indicated the value is valid.

GetResults retrieves the Results value from the union returning ok if the union s switch indicated the value is valid .


func NewTransactionResultExt(v int32, value interface{}) (result TransactionResultExt, err error) {
	result.V = v
	switch int32(v) {
	case 0:
		// void
	}
	return
}

func
NewTransactionResultExt
(
v
int32
,
value
interface
{
}
)
(
result
TransactionResultExt
,
err
error
)
{
result
.
V
=
v
switch
int32
(
v
)
{
case
0
:
// void
}
return
}

// NewTransactionResultExt creates a new  TransactionResultExt.

NewTransactionResultExt creates a new TransactionResultExt .


func NewStellarValueExt(v int32, value interface{}) (result StellarValueExt, err error) {
	result.V = v
	switch int32(v) {
	case 0:
		// void
	}
	return
}

func
NewStellarValueExt
(
v
int32
,
value
interface
{
}
)
(
result
StellarValueExt
,
err
error
)
{
result
.
V
=
v
switch
int32
(
v
)
{
case
0
:
// void
}
return
}

// NewStellarValueExt creates a new  StellarValueExt.

NewStellarValueExt creates a new StellarValueExt .


func NewLedgerHeaderExt(v int32, value interface{}) (result LedgerHeaderExt, err error) {
	result.V = v
	switch int32(v) {
	case 0:
		// void
	}
	return
}

func
NewLedgerHeaderExt
(
v
int32
,
value
interface
{
}
)
(
result
LedgerHeaderExt
,
err
error
)
{
result
.
V
=
v
switch
int32
(
v
)
{
case
0
:
// void
}
return
}

// NewLedgerHeaderExt creates a new  LedgerHeaderExt.

NewLedgerHeaderExt creates a new LedgerHeaderExt .


func (e LedgerUpgradeType) ValidEnum(v int32) bool {
	_, ok := ledgerUpgradeTypeMap[v]
	return ok
}

func ( e LedgerUpgradeType ) ValidEnum ( v int32 ) bool { _ , ok := ledgerUpgradeTypeMap [ v ] return ok }

// ValidEnum validates a proposed value for this enum.  Implements
// the Enum interface for LedgerUpgradeType

ValidEnum validates a proposed value for this enum . Implements the Enum interface for LedgerUpgradeType


func (u LedgerUpgrade) ArmForSwitch(sw int32) (string, bool) {
	switch LedgerUpgradeType(sw) {
	case LedgerUpgradeTypeLedgerUpgradeVersion:
		return "NewLedgerVersion", true
	case LedgerUpgradeTypeLedgerUpgradeBaseFee:
		return "NewBaseFee", true
	case LedgerUpgradeTypeLedgerUpgradeMaxTxSetSize:
		return "NewMaxTxSetSize", true
	}
	return "-", false
}

// ArmForSwitch returns which field name should be used for storing
// the value for an instance of LedgerUpgrade

ArmForSwitch returns which field name should be used for storing the value for an instance of LedgerUpgrade


func NewLedgerUpgrade(aType LedgerUpgradeType, value interface{}) (result LedgerUpgrade, err error) {
	result.Type = aType
	switch LedgerUpgradeType(aType) {
	case LedgerUpgradeTypeLedgerUpgradeVersion:
		tv, ok := value.(Uint32)
		if !ok {
			err = fmt.Errorf("invalid value, must be Uint32")
			return
		}
		result.NewLedgerVersion = &tv
	case LedgerUpgradeTypeLedgerUpgradeBaseFee:
		tv, ok := value.(Uint32)
		if !ok {
			err = fmt.Errorf("invalid value, must be Uint32")
			return
		}
		result.NewBaseFee = &tv
	case LedgerUpgradeTypeLedgerUpgradeMaxTxSetSize:
		tv, ok := value.(Uint32)
		if !ok {
			err = fmt.Errorf("invalid value, must be Uint32")
			return
		}
		result.NewMaxTxSetSize = &tv
	}
	return
}

// NewLedgerUpgrade creates a new  LedgerUpgrade.

NewLedgerUpgrade creates a new LedgerUpgrade .


func (u LedgerUpgrade) MustNewLedgerVersion() Uint32 {
	val, ok := u.GetNewLedgerVersion()

	if !ok {
		panic("arm NewLedgerVersion is not set")
	}

	return val
}

func ( u LedgerUpgrade ) MustNewLedgerVersion ( ) Uint32 { val , ok := u . GetNewLedgerVersion ( ) if ! ok { panic ( " " ) } return val }

// MustNewLedgerVersion retrieves the NewLedgerVersion value from the union,
// panicing if the value is not set.

MustNewLedgerVersion retrieves the NewLedgerVersion value from the union panicing if the value is not set .


func (u LedgerUpgrade) GetNewLedgerVersion() (result Uint32, ok bool) {
	armName, _ := u.ArmForSwitch(int32(u.Type))

	if armName == "NewLedgerVersion" {
		result = *u.NewLedgerVersion
		ok = true
	}

	return
}

func ( u LedgerUpgrade ) GetNewLedgerVersion ( ) ( result Uint32 , ok bool ) { armName , _ := u . ArmForSwitch ( int32 ( u . Type ) ) if armName == " " { result = * u . NewLedgerVersion ok = true } return }

// GetNewLedgerVersion retrieves the NewLedgerVersion value from the union,
// returning ok if the union's switch indicated the value is valid.

GetNewLedgerVersion retrieves the NewLedgerVersion value from the union returning ok if the union s switch indicated the value is valid .


func (u LedgerUpgrade) MustNewBaseFee() Uint32 {
	val, ok := u.GetNewBaseFee()

	if !ok {
		panic("arm NewBaseFee is not set")
	}

	return val
}

func ( u LedgerUpgrade ) MustNewBaseFee ( ) Uint32 { val , ok := u . GetNewBaseFee ( ) if ! ok { panic ( " " ) } return val }

// MustNewBaseFee retrieves the NewBaseFee value from the union,
// panicing if the value is not set.

MustNewBaseFee retrieves the NewBaseFee value from the union panicing if the value is not set .


func (u LedgerUpgrade) GetNewBaseFee() (result Uint32, ok bool) {
	armName, _ := u.ArmForSwitch(int32(u.Type))

	if armName == "NewBaseFee" {
		result = *u.NewBaseFee
		ok = true
	}

	return
}

func ( u LedgerUpgrade ) GetNewBaseFee ( ) ( result Uint32 , ok bool ) { armName , _ := u . ArmForSwitch ( int32 ( u . Type ) ) if armName == " " { result = * u . NewBaseFee ok = true } return }

// GetNewBaseFee retrieves the NewBaseFee value from the union,
// returning ok if the union's switch indicated the value is valid.

GetNewBaseFee retrieves the NewBaseFee value from the union returning ok if the union s switch indicated the value is valid .


func (u LedgerUpgrade) MustNewMaxTxSetSize() Uint32 {
	val, ok := u.GetNewMaxTxSetSize()

	if !ok {
		panic("arm NewMaxTxSetSize is not set")
	}

	return val
}

func ( u LedgerUpgrade ) MustNewMaxTxSetSize ( ) Uint32 { val , ok := u . GetNewMaxTxSetSize ( ) if ! ok { panic ( " " ) } return val }

// MustNewMaxTxSetSize retrieves the NewMaxTxSetSize value from the union,
// panicing if the value is not set.

MustNewMaxTxSetSize retrieves the NewMaxTxSetSize value from the union panicing if the value is not set .


func (u LedgerUpgrade) GetNewMaxTxSetSize() (result Uint32, ok bool) {
	armName, _ := u.ArmForSwitch(int32(u.Type))

	if armName == "NewMaxTxSetSize" {
		result = *u.NewMaxTxSetSize
		ok = true
	}

	return
}

func ( u LedgerUpgrade ) GetNewMaxTxSetSize ( ) ( result Uint32 , ok bool ) { armName , _ := u . ArmForSwitch ( int32 ( u . Type ) ) if armName == " " { result = * u . NewMaxTxSetSize ok = true } return }

// GetNewMaxTxSetSize retrieves the NewMaxTxSetSize value from the union,
// returning ok if the union's switch indicated the value is valid.

GetNewMaxTxSetSize retrieves the NewMaxTxSetSize value from the union returning ok if the union s switch indicated the value is valid .


func (u LedgerKey) ArmForSwitch(sw int32) (string, bool) {
	switch LedgerEntryType(sw) {
	case LedgerEntryTypeAccount:
		return "Account", true
	case LedgerEntryTypeTrustline:
		return "TrustLine", true
	case LedgerEntryTypeOffer:
		return "Offer", true
	case LedgerEntryTypeData:
		return "Data", true
	}
	return "-", false
}

func ( u LedgerKey ) ArmForSwitch ( sw int32 ) ( string , bool ) { switch LedgerEntryType ( sw ) { case LedgerEntryTypeAccount : return " " , true case LedgerEntryTypeTrustline : return " " , true case LedgerEntryTypeOffer : return " " , true case LedgerEntryTypeData : return " " , true } return " " , false }

// ArmForSwitch returns which field name should be used for storing
// the value for an instance of LedgerKey

ArmForSwitch returns which field name should be used for storing the value for an instance of LedgerKey


func NewLedgerKey(aType LedgerEntryType, value interface{}) (result LedgerKey, err error) {
	result.Type = aType
	switch LedgerEntryType(aType) {
	case LedgerEntryTypeAccount:
		tv, ok := value.(LedgerKeyAccount)
		if !ok {
			err = fmt.Errorf("invalid value, must be LedgerKeyAccount")
			return
		}
		result.Account = &tv
	case LedgerEntryTypeTrustline:
		tv, ok := value.(LedgerKeyTrustLine)
		if !ok {
			err = fmt.Errorf("invalid value, must be LedgerKeyTrustLine")
			return
		}
		result.TrustLine = &tv
	case LedgerEntryTypeOffer:
		tv, ok := value.(LedgerKeyOffer)
		if !ok {
			err = fmt.Errorf("invalid value, must be LedgerKeyOffer")
			return
		}
		result.Offer = &tv
	case LedgerEntryTypeData:
		tv, ok := value.(LedgerKeyData)
		if !ok {
			err = fmt.Errorf("invalid value, must be LedgerKeyData")
			return
		}
		result.Data = &tv
	}
	return
}

func NewLedgerKey ( aType LedgerEntryType , value interface { } ) ( result LedgerKey , err error ) { result . Type = aType switch LedgerEntryType ( aType ) { case LedgerEntryTypeAccount : tv , ok := value . ( LedgerKeyAccount ) if ! ok { err = fmt . Errorf ( " " ) return } result . Account = & tv case LedgerEntryTypeTrustline : tv , ok := value . ( LedgerKeyTrustLine ) if ! ok { err = fmt . Errorf ( " " ) return } result . TrustLine = & tv case LedgerEntryTypeOffer : tv , ok := value . ( LedgerKeyOffer ) if ! ok { err = fmt . Errorf ( " " ) return } result . Offer = & tv case LedgerEntryTypeData : tv , ok := value . ( LedgerKeyData ) if ! ok { err = fmt . Errorf ( " " ) return } result . Data = & tv } return }

// NewLedgerKey creates a new  LedgerKey.


func (e BucketEntryType) ValidEnum(v int32) bool {
	_, ok := bucketEntryTypeMap[v]
	return ok
}

func ( e BucketEntryType ) ValidEnum ( v int32 ) bool { _ , ok := bucketEntryTypeMap [ v ] return ok }

// ValidEnum validates a proposed value for this enum.  Implements
// the Enum interface for BucketEntryType

ValidEnum validates a proposed value for this enum . Implements the Enum interface for BucketEntryType


func (u BucketEntry) ArmForSwitch(sw int32) (string, bool) {
	switch BucketEntryType(sw) {
	case BucketEntryTypeLiveentry:
		return "LiveEntry", true
	case BucketEntryTypeDeadentry:
		return "DeadEntry", true
	}
	return "-", false
}

func ( u BucketEntry ) ArmForSwitch ( sw int32 ) ( string , bool ) { switch BucketEntryType ( sw ) { case BucketEntryTypeLiveentry : return " " , true case BucketEntryTypeDeadentry : return " " , true } return " " , false }

// ArmForSwitch returns which field name should be used for storing
// the value for an instance of BucketEntry

ArmForSwitch returns which field name should be used for storing the value for an instance of BucketEntry


func NewBucketEntry(aType BucketEntryType, value interface{}) (result BucketEntry, err error) {
	result.Type = aType
	switch BucketEntryType(aType) {
	case BucketEntryTypeLiveentry:
		tv, ok := value.(LedgerEntry)
		if !ok {
			err = fmt.Errorf("invalid value, must be LedgerEntry")
			return
		}
		result.LiveEntry = &tv
	case BucketEntryTypeDeadentry:
		tv, ok := value.(LedgerKey)
		if !ok {
			err = fmt.Errorf("invalid value, must be LedgerKey")
			return
		}
		result.DeadEntry = &tv
	}
	return
}

func NewBucketEntry ( aType BucketEntryType , value interface { } ) ( result BucketEntry , err error ) { result . Type = aType switch BucketEntryType ( aType ) { case BucketEntryTypeLiveentry : tv , ok := value . ( LedgerEntry ) if ! ok { err = fmt . Errorf ( " " ) return } result . LiveEntry = & tv case BucketEntryTypeDeadentry : tv , ok := value . ( LedgerKey ) if ! ok { err = fmt . Errorf ( " " ) return } result . DeadEntry = & tv } return }

// NewBucketEntry creates a new  BucketEntry.

NewBucketEntry creates a new BucketEntry .


func (u BucketEntry) MustLiveEntry() LedgerEntry {
	val, ok := u.GetLiveEntry()

	if !ok {
		panic("arm LiveEntry is not set")
	}

	return val
}

func ( u BucketEntry ) MustLiveEntry ( ) LedgerEntry { val , ok := u . GetLiveEntry ( ) if ! ok { panic ( " " ) } return val }

// MustLiveEntry retrieves the LiveEntry value from the union,
// panicing if the value is not set.

MustLiveEntry retrieves the LiveEntry value from the union panicing if the value is not set .


func (u BucketEntry) GetLiveEntry() (result LedgerEntry, ok bool) {
	armName, _ := u.ArmForSwitch(int32(u.Type))

	if armName == "LiveEntry" {
		result = *u.LiveEntry
		ok = true
	}

	return
}

func ( u BucketEntry ) GetLiveEntry ( ) ( result LedgerEntry , ok bool ) { armName , _ := u . ArmForSwitch ( int32 ( u . Type ) ) if armName == " " { result = * u . LiveEntry ok = true } return }

// GetLiveEntry retrieves the LiveEntry value from the union,
// returning ok if the union's switch indicated the value is valid.

GetLiveEntry retrieves the LiveEntry value from the union returning ok if the union s switch indicated the value is valid .


func (u BucketEntry) MustDeadEntry() LedgerKey {
	val, ok := u.GetDeadEntry()

	if !ok {
		panic("arm DeadEntry is not set")
	}

	return val
}

func ( u BucketEntry ) MustDeadEntry ( ) LedgerKey { val , ok := u . GetDeadEntry ( ) if ! ok { panic ( " " ) } return val }

// MustDeadEntry retrieves the DeadEntry value from the union,
// panicing if the value is not set.

MustDeadEntry retrieves the DeadEntry value from the union panicing if the value is not set .


func (u BucketEntry) GetDeadEntry() (result LedgerKey, ok bool) {
	armName, _ := u.ArmForSwitch(int32(u.Type))

	if armName == "DeadEntry" {
		result = *u.DeadEntry
		ok = true
	}

	return
}

func ( u BucketEntry ) GetDeadEntry ( ) ( result LedgerKey , ok bool ) { armName , _ := u . ArmForSwitch ( int32 ( u . Type ) ) if armName == " " { result = * u . DeadEntry ok = true } return }

// GetDeadEntry retrieves the DeadEntry value from the union,
// returning ok if the union's switch indicated the value is valid.

GetDeadEntry retrieves the DeadEntry value from the union returning ok if the union s switch indicated the value is valid .


func NewTransactionHistoryEntryExt(v int32, value interface{}) (result TransactionHistoryEntryExt, err error) {
	result.V = v
	switch int32(v) {
	case 0:
		// void
	}
	return
}

func
NewTransactionHistoryEntryExt
(
v
int32
,
value
interface
{
}
)
(
result
TransactionHistoryEntryExt
,
err
error
)
{
result
.
V
=
v
switch
int32
(
v
)
{
case
0
:
// void
}
return
}

// NewTransactionHistoryEntryExt creates a new  TransactionHistoryEntryExt.

NewTransactionHistoryEntryExt creates a new TransactionHistoryEntryExt .


func (u TransactionHistoryResultEntryExt) ArmForSwitch(sw int32) (string, bool) {
	switch int32(sw) {
	case 0:
		return "", true
	}
	return "-", false
}

func ( u TransactionHistoryResultEntryExt ) ArmForSwitch ( sw int32 ) ( string , bool ) { switch int32 ( sw ) { case 0 : return " " , true } return " " , false }

// ArmForSwitch returns which field name should be used for storing
// the value for an instance of TransactionHistoryResultEntryExt

ArmForSwitch returns which field name should be used for storing the value for an instance of TransactionHistoryResultEntryExt


func NewTransactionHistoryResultEntryExt(v int32, value interface{}) (result TransactionHistoryResultEntryExt, err error) {
	result.V = v
	switch int32(v) {
	case 0:
		// void
	}
	return
}

func
NewTransactionHistoryResultEntryExt
(
v
int32
,
value
interface
{
}
)
(
result
TransactionHistoryResultEntryExt
,
err
error
)
{
result
.
V
=
v
switch
int32
(
v
)
{
case
0
:
// void
}
return
}

// NewTransactionHistoryResultEntryExt creates a new  TransactionHistoryResultEntryExt.

NewTransactionHistoryResultEntryExt creates a new TransactionHistoryResultEntryExt .


func NewLedgerHeaderHistoryEntryExt(v int32, value interface{}) (result LedgerHeaderHistoryEntryExt, err error) {
	result.V = v
	switch int32(v) {
	case 0:
		// void
	}
	return
}

func
NewLedgerHeaderHistoryEntryExt
(
v
int32
,
value
interface
{
}
)
(
result
LedgerHeaderHistoryEntryExt
,
err
error
)
{
result
.
V
=
v
switch
int32
(
v
)
{
case
0
:
// void
}
return
}

// NewLedgerHeaderHistoryEntryExt creates a new  LedgerHeaderHistoryEntryExt.

NewLedgerHeaderHistoryEntryExt creates a new LedgerHeaderHistoryEntryExt .


func NewScpHistoryEntry(v int32, value interface{}) (result ScpHistoryEntry, err error) {
	result.V = v
	switch int32(v) {
	case 0:
		tv, ok := value.(ScpHistoryEntryV0)
		if !ok {
			err = fmt.Errorf("invalid value, must be ScpHistoryEntryV0")
			return
		}
		result.V0 = &tv
	}
	return
}

func NewScpHistoryEntry ( v int32 , value interface { } ) ( result ScpHistoryEntry , err error ) { result . V = v switch int32 ( v ) { case 0 : tv , ok := value . ( ScpHistoryEntryV0 ) if ! ok { err = fmt . Errorf ( " " ) return } result . V0 = & tv } return }

// NewScpHistoryEntry creates a new  ScpHistoryEntry.

NewScpHistoryEntry creates a new ScpHistoryEntry .


func (e LedgerEntryChangeType) ValidEnum(v int32) bool {
	_, ok := ledgerEntryChangeTypeMap[v]
	return ok
}

func ( e LedgerEntryChangeType ) ValidEnum ( v int32 ) bool { _ , ok := ledgerEntryChangeTypeMap [ v ] return ok }

// ValidEnum validates a proposed value for this enum.  Implements
// the Enum interface for LedgerEntryChangeType

ValidEnum validates a proposed value for this enum . Implements the Enum interface for LedgerEntryChangeType


func (u LedgerEntryChange) ArmForSwitch(sw int32) (string, bool) {
	switch LedgerEntryChangeType(sw) {
	case LedgerEntryChangeTypeLedgerEntryCreated:
		return "Created", true
	case LedgerEntryChangeTypeLedgerEntryUpdated:
		return "Updated", true
	case LedgerEntryChangeTypeLedgerEntryRemoved:
		return "Removed", true
	case LedgerEntryChangeTypeLedgerEntryState:
		return "State", true
	}
	return "-", false
}

func ( u LedgerEntryChange ) ArmForSwitch ( sw int32 ) ( string , bool ) { switch LedgerEntryChangeType ( sw ) { case LedgerEntryChangeTypeLedgerEntryCreated : return " " , true case LedgerEntryChangeTypeLedgerEntryUpdated : return " " , true case LedgerEntryChangeTypeLedgerEntryRemoved : return " " , true case LedgerEntryChangeTypeLedgerEntryState : return " " , true } return " " , false }

// ArmForSwitch returns which field name should be used for storing
// the value for an instance of LedgerEntryChange

ArmForSwitch returns which field name should be used for storing the value for an instance of LedgerEntryChange


func NewLedgerEntryChange(aType LedgerEntryChangeType, value interface{}) (result LedgerEntryChange, err error) {
	result.Type = aType
	switch LedgerEntryChangeType(aType) {
	case LedgerEntryChangeTypeLedgerEntryCreated:
		tv, ok := value.(LedgerEntry)
		if !ok {
			err = fmt.Errorf("invalid value, must be LedgerEntry")
			return
		}
		result.Created = &tv
	case LedgerEntryChangeTypeLedgerEntryUpdated:
		tv, ok := value.(LedgerEntry)
		if !ok {
			err = fmt.Errorf("invalid value, must be LedgerEntry")
			return
		}
		result.Updated = &tv
	case LedgerEntryChangeTypeLedgerEntryRemoved:
		tv, ok := value.(LedgerKey)
		if !ok {
			err = fmt.Errorf("invalid value, must be LedgerKey")
			return
		}
		result.Removed = &tv
	case LedgerEntryChangeTypeLedgerEntryState:
		tv, ok := value.(LedgerEntry)
		if !ok {
			err = fmt.Errorf("invalid value, must be LedgerEntry")
			return
		}
		result.State = &tv
	}
	return
}

func NewLedgerEntryChange ( aType LedgerEntryChangeType , value interface { } ) ( result LedgerEntryChange , err error ) { result . Type = aType switch LedgerEntryChangeType ( aType ) { case LedgerEntryChangeTypeLedgerEntryCreated : tv , ok := value . ( LedgerEntry ) if ! ok { err = fmt . Errorf ( " " ) return } result . Created = & tv case LedgerEntryChangeTypeLedgerEntryUpdated : tv , ok := value . ( LedgerEntry ) if ! ok { err = fmt . Errorf ( " " ) return } result . Updated = & tv case LedgerEntryChangeTypeLedgerEntryRemoved : tv , ok := value . ( LedgerKey ) if ! ok { err = fmt . Errorf ( " " ) return } result . Removed = & tv case LedgerEntryChangeTypeLedgerEntryState : tv , ok := value . ( LedgerEntry ) if ! ok { err = fmt . Errorf ( " " ) return } result . State = & tv } return }

// NewLedgerEntryChange creates a new  LedgerEntryChange.

NewLedgerEntryChange creates a new LedgerEntryChange .


func (u LedgerEntryChange) MustCreated() LedgerEntry {
	val, ok := u.GetCreated()

	if !ok {
		panic("arm Created is not set")
	}

	return val
}

func ( u LedgerEntryChange ) MustCreated ( ) LedgerEntry { val , ok := u . GetCreated ( ) if ! ok { panic ( " " ) } return val }

// MustCreated retrieves the Created value from the union,
// panicing if the value is not set.

MustCreated retrieves the Created value from the union panicing if the value is not set .


func (u LedgerEntryChange) GetCreated() (result LedgerEntry, ok bool) {
	armName, _ := u.ArmForSwitch(int32(u.Type))

	if armName == "Created" {
		result = *u.Created
		ok = true
	}

	return
}

func ( u LedgerEntryChange ) GetCreated ( ) ( result LedgerEntry , ok bool ) { armName , _ := u . ArmForSwitch ( int32 ( u . Type ) ) if armName == " " { result = * u . Created ok = true } return }

// GetCreated retrieves the Created value from the union,
// returning ok if the union's switch indicated the value is valid.

GetCreated retrieves the Created value from the union returning ok if the union s switch indicated the value is valid .


func (u LedgerEntryChange) MustUpdated() LedgerEntry {
	val, ok := u.GetUpdated()

	if !ok {
		panic("arm Updated is not set")
	}

	return val
}

func ( u LedgerEntryChange ) MustUpdated ( ) LedgerEntry { val , ok := u . GetUpdated ( ) if ! ok { panic ( " " ) } return val }

// MustUpdated retrieves the Updated value from the union,
// panicing if the value is not set.

MustUpdated retrieves the Updated value from the union panicing if the value is not set .


func (u LedgerEntryChange) GetUpdated() (result LedgerEntry, ok bool) {
	armName, _ := u.ArmForSwitch(int32(u.Type))

	if armName == "Updated" {
		result = *u.Updated
		ok = true
	}

	return
}

func ( u LedgerEntryChange ) GetUpdated ( ) ( result LedgerEntry , ok bool ) { armName , _ := u . ArmForSwitch ( int32 ( u . Type ) ) if armName == " " { result = * u . Updated ok = true } return }

// GetUpdated retrieves the Updated value from the union,
// returning ok if the union's switch indicated the value is valid.

GetUpdated retrieves the Updated value from the union returning ok if the union s switch indicated the value is valid .


func (u LedgerEntryChange) MustRemoved() LedgerKey {
	val, ok := u.GetRemoved()

	if !ok {
		panic("arm Removed is not set")
	}

	return val
}

func ( u LedgerEntryChange ) MustRemoved ( ) LedgerKey { val , ok := u . GetRemoved ( ) if ! ok { panic ( " " ) } return val }

// MustRemoved retrieves the Removed value from the union,
// panicing if the value is not set.

MustRemoved retrieves the Removed value from the union panicing if the value is not set .


func (u LedgerEntryChange) GetRemoved() (result LedgerKey, ok bool) {
	armName, _ := u.ArmForSwitch(int32(u.Type))

	if armName == "Removed" {
		result = *u.Removed
		ok = true
	}

	return
}

func ( u LedgerEntryChange ) GetRemoved ( ) ( result LedgerKey , ok bool ) { armName , _ := u . ArmForSwitch ( int32 ( u . Type ) ) if armName == " " { result = * u . Removed ok = true } return }

// GetRemoved retrieves the Removed value from the union,
// returning ok if the union's switch indicated the value is valid.

GetRemoved retrieves the Removed value from the union returning ok if the union s switch indicated the value is valid .


func (u LedgerEntryChange) MustState() LedgerEntry {
	val, ok := u.GetState()

	if !ok {
		panic("arm State is not set")
	}

	return val
}

func ( u LedgerEntryChange ) MustState ( ) LedgerEntry { val , ok := u . GetState ( ) if ! ok { panic ( " " ) } return val }

// MustState retrieves the State value from the union,
// panicing if the value is not set.

MustState retrieves the State value from the union panicing if the value is not set .


func (u LedgerEntryChange) GetState() (result LedgerEntry, ok bool) {
	armName, _ := u.ArmForSwitch(int32(u.Type))

	if armName == "State" {
		result = *u.State
		ok = true
	}

	return
}

func ( u LedgerEntryChange ) GetState ( ) ( result LedgerEntry , ok bool ) { armName , _ := u . ArmForSwitch ( int32 ( u . Type ) ) if armName == " " { result = * u . State ok = true } return }

// GetState retrieves the State value from the union,
// returning ok if the union's switch indicated the value is valid.

GetState retrieves the State value from the union returning ok if the union s switch indicated the value is valid .


func NewTransactionMeta(v int32, value interface{}) (result TransactionMeta, err error) {
	result.V = v
	switch int32(v) {
	case 0:
		tv, ok := value.([]OperationMeta)
		if !ok {
			err = fmt.Errorf("invalid value, must be []OperationMeta")
			return
		}
		result.Operations = &tv
	}
	return
}

func NewTransactionMeta ( v int32 , value interface { } ) ( result TransactionMeta , err error ) { result . V = v switch int32 ( v ) { case 0 : tv , ok := value . ( [ ] OperationMeta ) if ! ok { err = fmt . Errorf ( " " ) return } result . Operations = & tv } return }

// NewTransactionMeta creates a new  TransactionMeta.

NewTransactionMeta creates a new TransactionMeta .


func (u TransactionMeta) MustOperations() []OperationMeta {
	val, ok := u.GetOperations()

	if !ok {
		panic("arm Operations is not set")
	}

	return val
}

func ( u TransactionMeta ) MustOperations ( ) [ ] OperationMeta { val , ok := u . GetOperations ( ) if ! ok { panic ( " " ) } return val }

// MustOperations retrieves the Operations value from the union,
// panicing if the value is not set.

MustOperations retrieves the Operations value from the union panicing if the value is not set .


func (u TransactionMeta) GetOperations() (result []OperationMeta, ok bool) {
	armName, _ := u.ArmForSwitch(int32(u.V))

	if armName == "Operations" {
		result = *u.Operations
		ok = true
	}

	return
}

func ( u TransactionMeta ) GetOperations ( ) ( result [ ] OperationMeta , ok bool ) { armName , _ := u . ArmForSwitch ( int32 ( u . V ) ) if armName == " " { result = * u . Operations ok = true } return }

// GetOperations retrieves the Operations value from the union,
// returning ok if the union's switch indicated the value is valid.

GetOperations retrieves the Operations value from the union returning ok if the union s switch indicated the value is valid .


func (e ErrorCode) ValidEnum(v int32) bool {
	_, ok := errorCodeMap[v]
	return ok
}

func ( e ErrorCode ) ValidEnum ( v int32 ) bool { _ , ok := errorCodeMap [ v ] return ok }

// ValidEnum validates a proposed value for this enum.  Implements
// the Enum interface for ErrorCode

ValidEnum validates a proposed value for this enum . Implements the Enum interface for ErrorCode


func (e IpAddrType) ValidEnum(v int32) bool {
	_, ok := ipAddrTypeMap[v]
	return ok
}

func ( e IpAddrType ) ValidEnum ( v int32 ) bool { _ , ok := ipAddrTypeMap [ v ] return ok }

// ValidEnum validates a proposed value for this enum.  Implements
// the Enum interface for IpAddrType

ValidEnum validates a proposed value for this enum . Implements the Enum interface for IpAddrType


func (u PeerAddressIp) ArmForSwitch(sw int32) (string, bool) {
	switch IpAddrType(sw) {
	case IpAddrTypeIPv4:
		return "Ipv4", true
	case IpAddrTypeIPv6:
		return "Ipv6", true
	}
	return "-", false
}

func ( u PeerAddressIp ) ArmForSwitch ( sw int32 ) ( string , bool ) { switch IpAddrType ( sw ) { case IpAddrTypeIPv4 : return " " , true case IpAddrTypeIPv6 : return " " , true } return " " , false }

// ArmForSwitch returns which field name should be used for storing
// the value for an instance of PeerAddressIp

ArmForSwitch returns which field name should be used for storing the value for an instance of PeerAddressIp


func NewPeerAddressIp(aType IpAddrType, value interface{}) (result PeerAddressIp, err error) {
	result.Type = aType
	switch IpAddrType(aType) {
	case IpAddrTypeIPv4:
		tv, ok := value.([4]byte)
		if !ok {
			err = fmt.Errorf("invalid value, must be [4]byte")
			return
		}
		result.Ipv4 = &tv
	case IpAddrTypeIPv6:
		tv, ok := value.([16]byte)
		if !ok {
			err = fmt.Errorf("invalid value, must be [16]byte")
			return
		}
		result.Ipv6 = &tv
	}
	return
}

func NewPeerAddressIp ( aType IpAddrType , value interface { } ) ( result PeerAddressIp , err error ) { result . Type = aType switch IpAddrType ( aType ) { case IpAddrTypeIPv4 : tv , ok := value . ( [ 4 ] byte ) if ! ok { err = fmt . Errorf ( " " ) return } result . Ipv4 = & tv case IpAddrTypeIPv6 : tv , ok := value . ( [ 16 ] byte ) if ! ok { err = fmt . Errorf ( " " ) return } result . Ipv6 = & tv } return }

// NewPeerAddressIp creates a new  PeerAddressIp.

NewPeerAddressIp creates a new PeerAddressIp .


func (u PeerAddressIp) MustIpv4() [4]byte {
	val, ok := u.GetIpv4()

	if !ok {
		panic("arm Ipv4 is not set")
	}

	return val
}

func ( u PeerAddressIp ) MustIpv4 ( ) [ 4 ] byte { val , ok := u . GetIpv4 ( ) if ! ok { panic ( " " ) } return val }

// MustIpv4 retrieves the Ipv4 value from the union,
// panicing if the value is not set.

MustIpv4 retrieves the Ipv4 value from the union panicing if the value is not set .


func (u PeerAddressIp) GetIpv4() (result [4]byte, ok bool) {
	armName, _ := u.ArmForSwitch(int32(u.Type))

	if armName == "Ipv4" {
		result = *u.Ipv4
		ok = true
	}

	return
}

func ( u PeerAddressIp ) GetIpv4 ( ) ( result [ 4 ] byte , ok bool ) { armName , _ := u . ArmForSwitch ( int32 ( u . Type ) ) if armName == " " { result = * u . Ipv4 ok = true } return }

// GetIpv4 retrieves the Ipv4 value from the union,
// returning ok if the union's switch indicated the value is valid.

GetIpv4 retrieves the Ipv4 value from the union returning ok if the union s switch indicated the value is valid .


func (u PeerAddressIp) MustIpv6() [16]byte {
	val, ok := u.GetIpv6()

	if !ok {
		panic("arm Ipv6 is not set")
	}

	return val
}

func ( u PeerAddressIp ) MustIpv6 ( ) [ 16 ] byte { val , ok := u . GetIpv6 ( ) if ! ok { panic ( " " ) } return val }

// MustIpv6 retrieves the Ipv6 value from the union,
// panicing if the value is not set.

MustIpv6 retrieves the Ipv6 value from the union panicing if the value is not set .


func (u PeerAddressIp) GetIpv6() (result [16]byte, ok bool) {
	armName, _ := u.ArmForSwitch(int32(u.Type))

	if armName == "Ipv6" {
		result = *u.Ipv6
		ok = true
	}

	return
}

func ( u PeerAddressIp ) GetIpv6 ( ) ( result [ 16 ] byte , ok bool ) { armName , _ := u . ArmForSwitch ( int32 ( u . Type ) ) if armName == " " { result = * u . Ipv6 ok = true } return }

// GetIpv6 retrieves the Ipv6 value from the union,
// returning ok if the union's switch indicated the value is valid.

GetIpv6 retrieves the Ipv6 value from the union returning ok if the union s switch indicated the value is valid .


func (e MessageType) ValidEnum(v int32) bool {
	_, ok := messageTypeMap[v]
	return ok
}

func ( e MessageType ) ValidEnum ( v int32 ) bool { _ , ok := messageTypeMap [ v ] return ok }

// ValidEnum validates a proposed value for this enum.  Implements
// the Enum interface for MessageType

ValidEnum validates a proposed value for this enum . Implements the Enum interface for MessageType


func (u StellarMessage) ArmForSwitch(sw int32) (string, bool) {
	switch MessageType(sw) {
	case MessageTypeErrorMsg:
		return "Error", true
	case MessageTypeHello:
		return "Hello", true
	case MessageTypeAuth:
		return "Auth", true
	case MessageTypeDontHave:
		return "DontHave", true
	case MessageTypeGetPeers:
		return "", true
	case MessageTypePeers:
		return "Peers", true
	case MessageTypeGetTxSet:
		return "TxSetHash", true
	case MessageTypeTxSet:
		return "TxSet", true
	case MessageTypeTransaction:
		return "Transaction", true
	case MessageTypeGetScpQuorumset:
		return "QSetHash", true
	case MessageTypeScpQuorumset:
		return "QSet", true
	case MessageTypeScpMessage:
		return "Envelope", true
	case MessageTypeGetScpState:
		return "GetScpLedgerSeq", true
	}
	return "-", false
}

func ( u StellarMessage ) ArmForSwitch ( sw int32 ) ( string , bool ) { switch MessageType ( sw ) { case MessageTypeErrorMsg : return " " , true case MessageTypeHello : return " " , true case MessageTypeAuth : return " " , true case MessageTypeDontHave : return " " , true case MessageTypeGetPeers : return " " , true case MessageTypePeers : return " " , true case MessageTypeGetTxSet : return " " , true case MessageTypeTxSet : return " " , true case MessageTypeTransaction : return " " , true case MessageTypeGetScpQuorumset : return " " , true case MessageTypeScpQuorumset : return " " , true case MessageTypeScpMessage : return " " , true case MessageTypeGetScpState : return " " , true } return " " , false }

// ArmForSwitch returns which field name should be used for storing
// the value for an instance of StellarMessage

ArmForSwitch returns which field name should be used for storing the value for an instance of StellarMessage


func NewStellarMessage(aType MessageType, value interface{}) (result StellarMessage, err error) {
	result.Type = aType
	switch MessageType(aType) {
	case MessageTypeErrorMsg:
		tv, ok := value.(Error)
		if !ok {
			err = fmt.Errorf("invalid value, must be Error")
			return
		}
		result.Error = &tv
	case MessageTypeHello:
		tv, ok := value.(Hello)
		if !ok {
			err = fmt.Errorf("invalid value, must be Hello")
			return
		}
		result.Hello = &tv
	case MessageTypeAuth:
		tv, ok := value.(Auth)
		if !ok {
			err = fmt.Errorf("invalid value, must be Auth")
			return
		}
		result.Auth = &tv
	case MessageTypeDontHave:
		tv, ok := value.(DontHave)
		if !ok {
			err = fmt.Errorf("invalid value, must be DontHave")
			return
		}
		result.DontHave = &tv
	case MessageTypeGetPeers:
		// void
	case MessageTypePeers:
		tv, ok := value.([]PeerAddress)
		if !ok {
			err = fmt.Errorf("invalid value, must be []PeerAddress")
			return
		}
		result.Peers = &tv
	case MessageTypeGetTxSet:
		tv, ok := value.(Uint256)
		if !ok {
			err = fmt.Errorf("invalid value, must be Uint256")
			return
		}
		result.TxSetHash = &tv
	case MessageTypeTxSet:
		tv, ok := value.(TransactionSet)
		if !ok {
			err = fmt.Errorf("invalid value, must be TransactionSet")
			return
		}
		result.TxSet = &tv
	case MessageTypeTransaction:
		tv, ok := value.(TransactionEnvelope)
		if !ok {
			err = fmt.Errorf("invalid value, must be TransactionEnvelope")
			return
		}
		result.Transaction = &tv
	case MessageTypeGetScpQuorumset:
		tv, ok := value.(Uint256)
		if !ok {
			err = fmt.Errorf("invalid value, must be Uint256")
			return
		}
		result.QSetHash = &tv
	case MessageTypeScpQuorumset:
		tv, ok := value.(ScpQuorumSet)
		if !ok {
			err = fmt.Errorf("invalid value, must be ScpQuorumSet")
			return
		}
		result.QSet = &tv
	case MessageTypeScpMessage:
		tv, ok := value.(ScpEnvelope)
		if !ok {
			err = fmt.Errorf("invalid value, must be ScpEnvelope")
			return
		}
		result.Envelope = &tv
	case MessageTypeGetScpState:
		tv, ok := value.(Uint32)
		if !ok {
			err = fmt.Errorf("invalid value, must be Uint32")
			return
		}
		result.GetScpLedgerSeq = &tv
	}
	return
}

func
NewStellarMessage
(
aType
MessageType
,
value
interface
{
}
)
(
result
StellarMessage
,
err
error
)
{
result
.
Type
=
aType
switch
MessageType
(
aType
)
{
case
MessageTypeErrorMsg
:
tv
,
ok
:=
value
.
(
Error
)
if
!
ok
{
err
=
fmt
.
Errorf
(
"
"
)
return
}
result
.
Error
=
&
tv
case
MessageTypeHello
:
tv
,
ok
:=
value
.
(
Hello
)
if
!
ok
{
err
=
fmt
.
Errorf
(
"
"
)
return
}
result
.
Hello
=
&
tv
case
MessageTypeAuth
:
tv
,
ok
:=
value
.
(
Auth
)
if
!
ok
{
err
=
fmt
.
Errorf
(
"
"
)
return
}
result
.
Auth
=
&
tv
case
MessageTypeDontHave
:
tv
,
ok
:=
value
.
(
DontHave
)
if
!
ok
{
err
=
fmt
.
Errorf
(
"
"
)
return
}
result
.
DontHave
=
&
tv
case
MessageTypeGetPeers
:
// void
case
MessageTypePeers
:
tv
,
ok
:=
value
.
(
[
]
PeerAddress
)
if
!
ok
{
err
=
fmt
.
Errorf
(
"
"
)
return
}
result
.
Peers
=
&
tv
case
MessageTypeGetTxSet
:
tv
,
ok
:=
value
.
(
Uint256
)
if
!
ok
{
err
=
fmt
.
Errorf
(
"
"
)
return
}
result
.
TxSetHash
=
&
tv
case
MessageTypeTxSet
:
tv
,
ok
:=
value
.
(
TransactionSet
)
if
!
ok
{
err
=
fmt
.
Errorf
(
"
"
)
return
}
result
.
TxSet
=
&
tv
case
MessageTypeTransaction
:
tv
,
ok
:=
value
.
(
TransactionEnvelope
)
if
!
ok
{
err
=
fmt
.
Errorf
(
"
"
)
return
}
result
.
Transaction
=
&
tv
case
MessageTypeGetScpQuorumset
:
tv
,
ok
:=
value
.
(
Uint256
)
if
!
ok
{
err
=
fmt
.
Errorf
(
"
"
)
return
}
result
.
QSetHash
=
&
tv
case
MessageTypeScpQuorumset
:
tv
,
ok
:=
value
.
(
ScpQuorumSet
)
if
!
ok
{
err
=
fmt
.
Errorf
(
"
"
)
return
}
result
.
QSet
=
&
tv
case
MessageTypeScpMessage
:
tv
,
ok
:=
value
.
(
ScpEnvelope
)
if
!
ok
{
err
=
fmt
.
Errorf
(
"
"
)
return
}
result
.
Envelope
=
&
tv
case
MessageTypeGetScpState
:
tv
,
ok
:=
value
.
(
Uint32
)
if
!
ok
{
err
=
fmt
.
Errorf
(
"
"
)
return
}
result
.
GetScpLedgerSeq
=
&
tv
}
return
}

// NewStellarMessage creates a new  StellarMessage.

NewStellarMessage creates a new StellarMessage .


func (u StellarMessage) MustError() Error {
	val, ok := u.GetError()

	if !ok {
		panic("arm Error is not set")
	}

	return val
}

func ( u StellarMessage ) MustError ( ) Error { val , ok := u . GetError ( ) if ! ok { panic ( " " ) } return val }

// MustError retrieves the Error value from the union,
// panicing if the value is not set.

MustError retrieves the Error value from the union panicing if the value is not set .