func (u AccountId) GetEd25519() (result Uint256, ok bool) {
	return PublicKey(u).GetEd25519()
}
GetEd25519 retrieves the Ed25519 value from the union,
returning ok if the union's switch indicated the value is valid.
package xdr
import (
	"fmt"
	"io"
	"github.com/nullstyle/go-xdr/xdr3"
)
func Unmarshal(r io.Reader, v interface{}) (int, error) {
	return xdr.Unmarshal(r, v)
}
func Marshal(w io.Writer, v interface{}) (int, error) {
	return xdr.Marshal(w, v)
}
type Hash [32]byte
func (e Hash) XDRMaxSize() int {
	return 32
}
type Uint256 [32]byte
func (e Uint256) XDRMaxSize() int {
	return 32
}
type Uint32 uint32
type Int32 int32
type Uint64 uint64
type Int64 int64
type CryptoKeyType int32
const (
	CryptoKeyTypeKeyTypeEd25519 CryptoKeyType = 0
	CryptoKeyTypeKeyTypeHashTx  CryptoKeyType = 1
	CryptoKeyTypeKeyTypeHashX   CryptoKeyType = 2
)
var cryptoKeyTypeMap = map[int32]string{
	0: "CryptoKeyTypeKeyTypeEd25519",
	1: "CryptoKeyTypeKeyTypeHashTx",
	2: "CryptoKeyTypeKeyTypeHashX",
}
func (e CryptoKeyType) ValidEnum(v int32) bool {
	_, ok := cryptoKeyTypeMap[v]
	return ok
}
func (e CryptoKeyType) String() string {
	name, _ := cryptoKeyTypeMap[int32(e)]
	return name
}
type PublicKeyType int32
const (
	PublicKeyTypePublicKeyTypeEd25519 PublicKeyType = 0
)
var publicKeyTypeMap = map[int32]string{
	0: "PublicKeyTypePublicKeyTypeEd25519",
}
func (e PublicKeyType) ValidEnum(v int32) bool {
	_, ok := publicKeyTypeMap[v]
	return ok
}
func (e PublicKeyType) String() string {
	name, _ := publicKeyTypeMap[int32(e)]
	return name
}
type SignerKeyType int32
const (
	SignerKeyTypeSignerKeyTypeEd25519 SignerKeyType = 0
	SignerKeyTypeSignerKeyTypeHashTx  SignerKeyType = 1
	SignerKeyTypeSignerKeyTypeHashX   SignerKeyType = 2
)
var signerKeyTypeMap = map[int32]string{
	0: "SignerKeyTypeSignerKeyTypeEd25519",
	1: "SignerKeyTypeSignerKeyTypeHashTx",
	2: "SignerKeyTypeSignerKeyTypeHashX",
}
func (e SignerKeyType) ValidEnum(v int32) bool {
	_, ok := signerKeyTypeMap[v]
	return ok
}
func (e SignerKeyType) String() string {
	name, _ := signerKeyTypeMap[int32(e)]
	return name
}
type PublicKey struct {
	Type    PublicKeyType
	Ed25519 *Uint256
}
func (u PublicKey) SwitchFieldName() string {
	return "Type"
}
func (u PublicKey) ArmForSwitch(sw int32) (string, bool) {
	switch PublicKeyType(sw) {
	case PublicKeyTypePublicKeyTypeEd25519:
		return "Ed25519", true
	}
	return "-", false
}
func NewPublicKey(aType PublicKeyType, value interface{}) (result PublicKey, err error) {
	result.Type = aType
	switch PublicKeyType(aType) {
	case PublicKeyTypePublicKeyTypeEd25519:
		tv, ok := value.(Uint256)
		if !ok {
			err = fmt.Errorf("invalid value, must be Uint256")
			return
		}
		result.Ed25519 = &tv
	}
	return
}
func (u PublicKey) MustEd25519() Uint256 {
	val, ok := u.GetEd25519()
	if !ok {
		panic("arm Ed25519 is not set")
	}
	return val
}
func (u PublicKey) GetEd25519() (result Uint256, ok bool) {
	armName, _ := u.ArmForSwitch(int32(u.Type))
	if armName == "Ed25519" {
		result = *u.Ed25519
		ok = true
	}
	return
}
type SignerKey struct {
	Type    SignerKeyType
	Ed25519 *Uint256
	HashTx  *Uint256
	HashX   *Uint256
}
func (u SignerKey) SwitchFieldName() string {
	return "Type"
}
func (u SignerKey) ArmForSwitch(sw int32) (string, bool) {
	switch SignerKeyType(sw) {
	case SignerKeyTypeSignerKeyTypeEd25519:
		return "Ed25519", true
	case SignerKeyTypeSignerKeyTypeHashTx:
		return "HashTx", true
	case SignerKeyTypeSignerKeyTypeHashX:
		return "HashX", true
	}
	return "-", false
}
func NewSignerKey(aType SignerKeyType, value interface{}) (result SignerKey, err error) {
	result.Type = aType
	switch SignerKeyType(aType) {
	case SignerKeyTypeSignerKeyTypeEd25519:
		tv, ok := value.(Uint256)
		if !ok {
			err = fmt.Errorf("invalid value, must be Uint256")
			return
		}
		result.Ed25519 = &tv
	case SignerKeyTypeSignerKeyTypeHashTx:
		tv, ok := value.(Uint256)
		if !ok {
			err = fmt.Errorf("invalid value, must be Uint256")
			return
		}
		result.HashTx = &tv
	case SignerKeyTypeSignerKeyTypeHashX:
		tv, ok := value.(Uint256)
		if !ok {
			err = fmt.Errorf("invalid value, must be Uint256")
			return
		}
		result.HashX = &tv
	}
	return
}
func (u SignerKey) MustEd25519() Uint256 {
	val, ok := u.GetEd25519()
	if !ok {
		panic("arm Ed25519 is not set")
	}
	return val
}
func (u SignerKey) GetEd25519() (result Uint256, ok bool) {
	armName, _ := u.ArmForSwitch(int32(u.Type))
	if armName == "Ed25519" {
		result = *u.Ed25519
		ok = true
	}
	return
}
func (u SignerKey) MustHashTx() Uint256 {
	val, ok := u.GetHashTx()
	if !ok {
		panic("arm HashTx is not set")
	}
	return val
}
func (u SignerKey) GetHashTx() (result Uint256, ok bool) {
	armName, _ := u.ArmForSwitch(int32(u.Type))
	if armName == "HashTx" {
		result = *u.HashTx
		ok = true
	}
	return
}
func (u SignerKey) MustHashX() Uint256 {
	val, ok := u.GetHashX()
	if !ok {
		panic("arm HashX is not set")
	}
	return val
}
func (u SignerKey) GetHashX() (result Uint256, ok bool) {
	armName, _ := u.ArmForSwitch(int32(u.Type))
	if armName == "HashX" {
		result = *u.HashX
		ok = true
	}
	return
}
type Signature []byte
func (e Signature) XDRMaxSize() int {
	return 64
}
type SignatureHint [4]byte
func (e SignatureHint) XDRMaxSize() int {
	return 4
}
type NodeId PublicKey
func (u NodeId) SwitchFieldName() string {
	return PublicKey(u).SwitchFieldName()
}
func (u NodeId) ArmForSwitch(sw int32) (string, bool) {
	return PublicKey(u).ArmForSwitch(sw)
}
func NewNodeId(aType PublicKeyType, value interface{}) (result NodeId, err error) {
	u, err := NewPublicKey(aType, value)
	result = NodeId(u)
	return
}
func (u NodeId) MustEd25519() Uint256 {
	return PublicKey(u).MustEd25519()
}
func (u NodeId) GetEd25519() (result Uint256, ok bool) {
	return PublicKey(u).GetEd25519()
}
type Curve25519Secret struct {
	Key [32]byte `xdrmaxsize:"32"`
}
type Curve25519Public struct {
	Key [32]byte `xdrmaxsize:"32"`
}
type HmacSha256Key struct {
	Key [32]byte `xdrmaxsize:"32"`
}
type HmacSha256Mac struct {
	Mac [32]byte `xdrmaxsize:"32"`
}
type AccountId PublicKey
func (u AccountId) SwitchFieldName() string {
	return PublicKey(u).SwitchFieldName()
}
func (u AccountId) ArmForSwitch(sw int32) (string, bool) {
	return PublicKey(u).ArmForSwitch(sw)
}
func NewAccountId(aType PublicKeyType, value interface{}) (result AccountId, err error) {
	u, err := NewPublicKey(aType, value)
	result = AccountId(u)
	return
}
func (u AccountId) MustEd25519() Uint256 {
	return PublicKey(u).MustEd25519()
}