repo
stringlengths 5
67
| path
stringlengths 4
218
| func_name
stringlengths 0
151
| original_string
stringlengths 52
373k
| language
stringclasses 6
values | code
stringlengths 52
373k
| code_tokens
listlengths 10
512
| docstring
stringlengths 3
47.2k
| docstring_tokens
listlengths 3
234
| sha
stringlengths 40
40
| url
stringlengths 85
339
| partition
stringclasses 3
values |
|---|---|---|---|---|---|---|---|---|---|---|---|
stellar/go-stellar-base
|
build/set_options.go
|
MutateSetOptions
|
func (m Thresholds) MutateSetOptions(o *xdr.SetOptionsOp) (err error) {
if m.Low != nil {
val := xdr.Uint32(*m.Low)
o.LowThreshold = &val
}
if m.Medium != nil {
val := xdr.Uint32(*m.Medium)
o.MedThreshold = &val
}
if m.High != nil {
val := xdr.Uint32(*m.High)
o.HighThreshold = &val
}
return
}
|
go
|
func (m Thresholds) MutateSetOptions(o *xdr.SetOptionsOp) (err error) {
if m.Low != nil {
val := xdr.Uint32(*m.Low)
o.LowThreshold = &val
}
if m.Medium != nil {
val := xdr.Uint32(*m.Medium)
o.MedThreshold = &val
}
if m.High != nil {
val := xdr.Uint32(*m.High)
o.HighThreshold = &val
}
return
}
|
[
"func",
"(",
"m",
"Thresholds",
")",
"MutateSetOptions",
"(",
"o",
"*",
"xdr",
".",
"SetOptionsOp",
")",
"(",
"err",
"error",
")",
"{",
"if",
"m",
".",
"Low",
"!=",
"nil",
"{",
"val",
":=",
"xdr",
".",
"Uint32",
"(",
"*",
"m",
".",
"Low",
")",
"\n",
"o",
".",
"LowThreshold",
"=",
"&",
"val",
"\n",
"}",
"\n",
"if",
"m",
".",
"Medium",
"!=",
"nil",
"{",
"val",
":=",
"xdr",
".",
"Uint32",
"(",
"*",
"m",
".",
"Medium",
")",
"\n",
"o",
".",
"MedThreshold",
"=",
"&",
"val",
"\n",
"}",
"\n",
"if",
"m",
".",
"High",
"!=",
"nil",
"{",
"val",
":=",
"xdr",
".",
"Uint32",
"(",
"*",
"m",
".",
"High",
")",
"\n",
"o",
".",
"HighThreshold",
"=",
"&",
"val",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
// MutateSetOptions for Thresholds sets the SetOptionsOp's thresholds fields
|
[
"MutateSetOptions",
"for",
"Thresholds",
"sets",
"the",
"SetOptionsOp",
"s",
"thresholds",
"fields"
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/build/set_options.go#L138-L155
|
test
|
stellar/go-stellar-base
|
build/set_options.go
|
MutateSetOptions
|
func (m SetFlag) MutateSetOptions(o *xdr.SetOptionsOp) (err error) {
if !isFlagValid(xdr.AccountFlags(m)) {
return errors.New("Unknown flag in SetFlag mutator")
}
var val xdr.Uint32
if o.SetFlags == nil {
val = xdr.Uint32(m)
} else {
val = xdr.Uint32(m) | *o.SetFlags
}
o.SetFlags = &val
return
}
|
go
|
func (m SetFlag) MutateSetOptions(o *xdr.SetOptionsOp) (err error) {
if !isFlagValid(xdr.AccountFlags(m)) {
return errors.New("Unknown flag in SetFlag mutator")
}
var val xdr.Uint32
if o.SetFlags == nil {
val = xdr.Uint32(m)
} else {
val = xdr.Uint32(m) | *o.SetFlags
}
o.SetFlags = &val
return
}
|
[
"func",
"(",
"m",
"SetFlag",
")",
"MutateSetOptions",
"(",
"o",
"*",
"xdr",
".",
"SetOptionsOp",
")",
"(",
"err",
"error",
")",
"{",
"if",
"!",
"isFlagValid",
"(",
"xdr",
".",
"AccountFlags",
"(",
"m",
")",
")",
"{",
"return",
"errors",
".",
"New",
"(",
"\"Unknown flag in SetFlag mutator\"",
")",
"\n",
"}",
"\n",
"var",
"val",
"xdr",
".",
"Uint32",
"\n",
"if",
"o",
".",
"SetFlags",
"==",
"nil",
"{",
"val",
"=",
"xdr",
".",
"Uint32",
"(",
"m",
")",
"\n",
"}",
"else",
"{",
"val",
"=",
"xdr",
".",
"Uint32",
"(",
"m",
")",
"|",
"*",
"o",
".",
"SetFlags",
"\n",
"}",
"\n",
"o",
".",
"SetFlags",
"=",
"&",
"val",
"\n",
"return",
"\n",
"}"
] |
// MutateSetOptions for SetFlag sets the SetOptionsOp's SetFlags field
|
[
"MutateSetOptions",
"for",
"SetFlag",
"sets",
"the",
"SetOptionsOp",
"s",
"SetFlags",
"field"
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/build/set_options.go#L178-L191
|
test
|
stellar/go-stellar-base
|
build/set_options.go
|
MutateSetOptions
|
func (m ClearFlag) MutateSetOptions(o *xdr.SetOptionsOp) (err error) {
if !isFlagValid(xdr.AccountFlags(m)) {
return errors.New("Unknown flag in SetFlag mutator")
}
var val xdr.Uint32
if o.ClearFlags == nil {
val = xdr.Uint32(m)
} else {
val = xdr.Uint32(m) | *o.ClearFlags
}
o.ClearFlags = &val
return
}
|
go
|
func (m ClearFlag) MutateSetOptions(o *xdr.SetOptionsOp) (err error) {
if !isFlagValid(xdr.AccountFlags(m)) {
return errors.New("Unknown flag in SetFlag mutator")
}
var val xdr.Uint32
if o.ClearFlags == nil {
val = xdr.Uint32(m)
} else {
val = xdr.Uint32(m) | *o.ClearFlags
}
o.ClearFlags = &val
return
}
|
[
"func",
"(",
"m",
"ClearFlag",
")",
"MutateSetOptions",
"(",
"o",
"*",
"xdr",
".",
"SetOptionsOp",
")",
"(",
"err",
"error",
")",
"{",
"if",
"!",
"isFlagValid",
"(",
"xdr",
".",
"AccountFlags",
"(",
"m",
")",
")",
"{",
"return",
"errors",
".",
"New",
"(",
"\"Unknown flag in SetFlag mutator\"",
")",
"\n",
"}",
"\n",
"var",
"val",
"xdr",
".",
"Uint32",
"\n",
"if",
"o",
".",
"ClearFlags",
"==",
"nil",
"{",
"val",
"=",
"xdr",
".",
"Uint32",
"(",
"m",
")",
"\n",
"}",
"else",
"{",
"val",
"=",
"xdr",
".",
"Uint32",
"(",
"m",
")",
"|",
"*",
"o",
".",
"ClearFlags",
"\n",
"}",
"\n",
"o",
".",
"ClearFlags",
"=",
"&",
"val",
"\n",
"return",
"\n",
"}"
] |
// MutateSetOptions for ClearFlag sets the SetOptionsOp's ClearFlags field
|
[
"MutateSetOptions",
"for",
"ClearFlag",
"sets",
"the",
"SetOptionsOp",
"s",
"ClearFlags",
"field"
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/build/set_options.go#L214-L227
|
test
|
stellar/go-stellar-base
|
build/create_account.go
|
MutateCreateAccount
|
func (m Destination) MutateCreateAccount(o *xdr.CreateAccountOp) error {
return setAccountId(m.AddressOrSeed, &o.Destination)
}
|
go
|
func (m Destination) MutateCreateAccount(o *xdr.CreateAccountOp) error {
return setAccountId(m.AddressOrSeed, &o.Destination)
}
|
[
"func",
"(",
"m",
"Destination",
")",
"MutateCreateAccount",
"(",
"o",
"*",
"xdr",
".",
"CreateAccountOp",
")",
"error",
"{",
"return",
"setAccountId",
"(",
"m",
".",
"AddressOrSeed",
",",
"&",
"o",
".",
"Destination",
")",
"\n",
"}"
] |
// MutateCreateAccount for Destination sets the CreateAccountOp's Destination
// field
|
[
"MutateCreateAccount",
"for",
"Destination",
"sets",
"the",
"CreateAccountOp",
"s",
"Destination",
"field"
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/build/create_account.go#L53-L55
|
test
|
stellar/go-stellar-base
|
build/create_account.go
|
MutateCreateAccount
|
func (m NativeAmount) MutateCreateAccount(o *xdr.CreateAccountOp) (err error) {
o.StartingBalance, err = amount.Parse(m.Amount)
return
}
|
go
|
func (m NativeAmount) MutateCreateAccount(o *xdr.CreateAccountOp) (err error) {
o.StartingBalance, err = amount.Parse(m.Amount)
return
}
|
[
"func",
"(",
"m",
"NativeAmount",
")",
"MutateCreateAccount",
"(",
"o",
"*",
"xdr",
".",
"CreateAccountOp",
")",
"(",
"err",
"error",
")",
"{",
"o",
".",
"StartingBalance",
",",
"err",
"=",
"amount",
".",
"Parse",
"(",
"m",
".",
"Amount",
")",
"\n",
"return",
"\n",
"}"
] |
// MutateCreateAccount for NativeAmount sets the CreateAccountOp's
// StartingBalance field
|
[
"MutateCreateAccount",
"for",
"NativeAmount",
"sets",
"the",
"CreateAccountOp",
"s",
"StartingBalance",
"field"
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/build/create_account.go#L59-L62
|
test
|
stellar/go-stellar-base
|
keypair/main.go
|
Random
|
func Random() (*Full, error) {
var rawSeed [32]byte
_, err := io.ReadFull(rand.Reader, rawSeed[:])
if err != nil {
return nil, err
}
kp, err := FromRawSeed(rawSeed)
if err != nil {
return nil, err
}
return kp, nil
}
|
go
|
func Random() (*Full, error) {
var rawSeed [32]byte
_, err := io.ReadFull(rand.Reader, rawSeed[:])
if err != nil {
return nil, err
}
kp, err := FromRawSeed(rawSeed)
if err != nil {
return nil, err
}
return kp, nil
}
|
[
"func",
"Random",
"(",
")",
"(",
"*",
"Full",
",",
"error",
")",
"{",
"var",
"rawSeed",
"[",
"32",
"]",
"byte",
"\n",
"_",
",",
"err",
":=",
"io",
".",
"ReadFull",
"(",
"rand",
".",
"Reader",
",",
"rawSeed",
"[",
":",
"]",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"kp",
",",
"err",
":=",
"FromRawSeed",
"(",
"rawSeed",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"kp",
",",
"nil",
"\n",
"}"
] |
// Random creates a random full keypair
|
[
"Random",
"creates",
"a",
"random",
"full",
"keypair"
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/keypair/main.go#L44-L59
|
test
|
stellar/go-stellar-base
|
keypair/main.go
|
Master
|
func Master(networkPassphrase string) KP {
kp, err := FromRawSeed(network.ID(networkPassphrase))
if err != nil {
panic(err)
}
return kp
}
|
go
|
func Master(networkPassphrase string) KP {
kp, err := FromRawSeed(network.ID(networkPassphrase))
if err != nil {
panic(err)
}
return kp
}
|
[
"func",
"Master",
"(",
"networkPassphrase",
"string",
")",
"KP",
"{",
"kp",
",",
"err",
":=",
"FromRawSeed",
"(",
"network",
".",
"ID",
"(",
"networkPassphrase",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"panic",
"(",
"err",
")",
"\n",
"}",
"\n",
"return",
"kp",
"\n",
"}"
] |
// Master returns the master keypair for a given network passphrase
|
[
"Master",
"returns",
"the",
"master",
"keypair",
"for",
"a",
"given",
"network",
"passphrase"
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/keypair/main.go#L62-L70
|
test
|
stellar/go-stellar-base
|
keypair/main.go
|
Parse
|
func Parse(addressOrSeed string) (KP, error) {
_, err := strkey.Decode(strkey.VersionByteAccountID, addressOrSeed)
if err == nil {
return &FromAddress{addressOrSeed}, nil
}
if err != strkey.ErrInvalidVersionByte {
return nil, err
}
_, err = strkey.Decode(strkey.VersionByteSeed, addressOrSeed)
if err == nil {
return &Full{addressOrSeed}, nil
}
return nil, err
}
|
go
|
func Parse(addressOrSeed string) (KP, error) {
_, err := strkey.Decode(strkey.VersionByteAccountID, addressOrSeed)
if err == nil {
return &FromAddress{addressOrSeed}, nil
}
if err != strkey.ErrInvalidVersionByte {
return nil, err
}
_, err = strkey.Decode(strkey.VersionByteSeed, addressOrSeed)
if err == nil {
return &Full{addressOrSeed}, nil
}
return nil, err
}
|
[
"func",
"Parse",
"(",
"addressOrSeed",
"string",
")",
"(",
"KP",
",",
"error",
")",
"{",
"_",
",",
"err",
":=",
"strkey",
".",
"Decode",
"(",
"strkey",
".",
"VersionByteAccountID",
",",
"addressOrSeed",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"return",
"&",
"FromAddress",
"{",
"addressOrSeed",
"}",
",",
"nil",
"\n",
"}",
"\n",
"if",
"err",
"!=",
"strkey",
".",
"ErrInvalidVersionByte",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"_",
",",
"err",
"=",
"strkey",
".",
"Decode",
"(",
"strkey",
".",
"VersionByteSeed",
",",
"addressOrSeed",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"return",
"&",
"Full",
"{",
"addressOrSeed",
"}",
",",
"nil",
"\n",
"}",
"\n",
"return",
"nil",
",",
"err",
"\n",
"}"
] |
// Parse constructs a new KP from the provided string, which should be either
// an address, or a seed. If the provided input is a seed, the resulting KP
// will have signing capabilities.
|
[
"Parse",
"constructs",
"a",
"new",
"KP",
"from",
"the",
"provided",
"string",
"which",
"should",
"be",
"either",
"an",
"address",
"or",
"a",
"seed",
".",
"If",
"the",
"provided",
"input",
"is",
"a",
"seed",
"the",
"resulting",
"KP",
"will",
"have",
"signing",
"capabilities",
"."
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/keypair/main.go#L75-L91
|
test
|
stellar/go-stellar-base
|
keypair/main.go
|
MustParse
|
func MustParse(addressOrSeed string) KP {
kp, err := Parse(addressOrSeed)
if err != nil {
panic(err)
}
return kp
}
|
go
|
func MustParse(addressOrSeed string) KP {
kp, err := Parse(addressOrSeed)
if err != nil {
panic(err)
}
return kp
}
|
[
"func",
"MustParse",
"(",
"addressOrSeed",
"string",
")",
"KP",
"{",
"kp",
",",
"err",
":=",
"Parse",
"(",
"addressOrSeed",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"panic",
"(",
"err",
")",
"\n",
"}",
"\n",
"return",
"kp",
"\n",
"}"
] |
// MustParse is the panic-on-fail version of Parse
|
[
"MustParse",
"is",
"the",
"panic",
"-",
"on",
"-",
"fail",
"version",
"of",
"Parse"
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/keypair/main.go#L104-L111
|
test
|
stellar/go-stellar-base
|
build/allow_trust.go
|
MutateAllowTrust
|
func (m Authorize) MutateAllowTrust(o *xdr.AllowTrustOp) error {
o.Authorize = m.Value
return nil
}
|
go
|
func (m Authorize) MutateAllowTrust(o *xdr.AllowTrustOp) error {
o.Authorize = m.Value
return nil
}
|
[
"func",
"(",
"m",
"Authorize",
")",
"MutateAllowTrust",
"(",
"o",
"*",
"xdr",
".",
"AllowTrustOp",
")",
"error",
"{",
"o",
".",
"Authorize",
"=",
"m",
".",
"Value",
"\n",
"return",
"nil",
"\n",
"}"
] |
// MutateAllowTrust for Authorize sets the AllowTrustOp's Authorize field
|
[
"MutateAllowTrust",
"for",
"Authorize",
"sets",
"the",
"AllowTrustOp",
"s",
"Authorize",
"field"
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/build/allow_trust.go#L50-L53
|
test
|
stellar/go-stellar-base
|
build/allow_trust.go
|
MutateAllowTrust
|
func (m AllowTrustAsset) MutateAllowTrust(o *xdr.AllowTrustOp) (err error) {
length := len(m.Code)
switch {
case length >= 1 && length <= 4:
var code [4]byte
byteArray := []byte(m.Code)
copy(code[:], byteArray[0:length])
o.Asset, err = xdr.NewAllowTrustOpAsset(xdr.AssetTypeAssetTypeCreditAlphanum4, code)
case length >= 5 && length <= 12:
var code [12]byte
byteArray := []byte(m.Code)
copy(code[:], byteArray[0:length])
o.Asset, err = xdr.NewAllowTrustOpAsset(xdr.AssetTypeAssetTypeCreditAlphanum12, code)
default:
err = errors.New("Asset code length is invalid")
}
return
}
|
go
|
func (m AllowTrustAsset) MutateAllowTrust(o *xdr.AllowTrustOp) (err error) {
length := len(m.Code)
switch {
case length >= 1 && length <= 4:
var code [4]byte
byteArray := []byte(m.Code)
copy(code[:], byteArray[0:length])
o.Asset, err = xdr.NewAllowTrustOpAsset(xdr.AssetTypeAssetTypeCreditAlphanum4, code)
case length >= 5 && length <= 12:
var code [12]byte
byteArray := []byte(m.Code)
copy(code[:], byteArray[0:length])
o.Asset, err = xdr.NewAllowTrustOpAsset(xdr.AssetTypeAssetTypeCreditAlphanum12, code)
default:
err = errors.New("Asset code length is invalid")
}
return
}
|
[
"func",
"(",
"m",
"AllowTrustAsset",
")",
"MutateAllowTrust",
"(",
"o",
"*",
"xdr",
".",
"AllowTrustOp",
")",
"(",
"err",
"error",
")",
"{",
"length",
":=",
"len",
"(",
"m",
".",
"Code",
")",
"\n",
"switch",
"{",
"case",
"length",
">=",
"1",
"&&",
"length",
"<=",
"4",
":",
"var",
"code",
"[",
"4",
"]",
"byte",
"\n",
"byteArray",
":=",
"[",
"]",
"byte",
"(",
"m",
".",
"Code",
")",
"\n",
"copy",
"(",
"code",
"[",
":",
"]",
",",
"byteArray",
"[",
"0",
":",
"length",
"]",
")",
"\n",
"o",
".",
"Asset",
",",
"err",
"=",
"xdr",
".",
"NewAllowTrustOpAsset",
"(",
"xdr",
".",
"AssetTypeAssetTypeCreditAlphanum4",
",",
"code",
")",
"\n",
"case",
"length",
">=",
"5",
"&&",
"length",
"<=",
"12",
":",
"var",
"code",
"[",
"12",
"]",
"byte",
"\n",
"byteArray",
":=",
"[",
"]",
"byte",
"(",
"m",
".",
"Code",
")",
"\n",
"copy",
"(",
"code",
"[",
":",
"]",
",",
"byteArray",
"[",
"0",
":",
"length",
"]",
")",
"\n",
"o",
".",
"Asset",
",",
"err",
"=",
"xdr",
".",
"NewAllowTrustOpAsset",
"(",
"xdr",
".",
"AssetTypeAssetTypeCreditAlphanum12",
",",
"code",
")",
"\n",
"default",
":",
"err",
"=",
"errors",
".",
"New",
"(",
"\"Asset code length is invalid\"",
")",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
// MutateAllowTrust for Asset sets the AllowTrustOp's Asset field
|
[
"MutateAllowTrust",
"for",
"Asset",
"sets",
"the",
"AllowTrustOp",
"s",
"Asset",
"field"
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/build/allow_trust.go#L56-L75
|
test
|
stellar/go-stellar-base
|
build/allow_trust.go
|
MutateAllowTrust
|
func (m Trustor) MutateAllowTrust(o *xdr.AllowTrustOp) error {
return setAccountId(m.Address, &o.Trustor)
}
|
go
|
func (m Trustor) MutateAllowTrust(o *xdr.AllowTrustOp) error {
return setAccountId(m.Address, &o.Trustor)
}
|
[
"func",
"(",
"m",
"Trustor",
")",
"MutateAllowTrust",
"(",
"o",
"*",
"xdr",
".",
"AllowTrustOp",
")",
"error",
"{",
"return",
"setAccountId",
"(",
"m",
".",
"Address",
",",
"&",
"o",
".",
"Trustor",
")",
"\n",
"}"
] |
// MutateAllowTrust for Trustor sets the AllowTrustOp's Trustor field
|
[
"MutateAllowTrust",
"for",
"Trustor",
"sets",
"the",
"AllowTrustOp",
"s",
"Trustor",
"field"
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/build/allow_trust.go#L78-L80
|
test
|
stellar/go-stellar-base
|
xdr/allow_trust_op_asset.go
|
ToAsset
|
func (a AllowTrustOpAsset) ToAsset(issuer AccountId) (ret Asset) {
var err error
switch a.Type {
case AssetTypeAssetTypeCreditAlphanum4:
ret, err = NewAsset(AssetTypeAssetTypeCreditAlphanum4, AssetAlphaNum4{
AssetCode: a.MustAssetCode4(),
Issuer: issuer,
})
case AssetTypeAssetTypeCreditAlphanum12:
ret, err = NewAsset(AssetTypeAssetTypeCreditAlphanum12, AssetAlphaNum12{
AssetCode: a.MustAssetCode12(),
Issuer: issuer,
})
default:
err = fmt.Errorf("Unexpected type for AllowTrustOpAsset: %d", a.Type)
}
if err != nil {
panic(err)
}
return
}
|
go
|
func (a AllowTrustOpAsset) ToAsset(issuer AccountId) (ret Asset) {
var err error
switch a.Type {
case AssetTypeAssetTypeCreditAlphanum4:
ret, err = NewAsset(AssetTypeAssetTypeCreditAlphanum4, AssetAlphaNum4{
AssetCode: a.MustAssetCode4(),
Issuer: issuer,
})
case AssetTypeAssetTypeCreditAlphanum12:
ret, err = NewAsset(AssetTypeAssetTypeCreditAlphanum12, AssetAlphaNum12{
AssetCode: a.MustAssetCode12(),
Issuer: issuer,
})
default:
err = fmt.Errorf("Unexpected type for AllowTrustOpAsset: %d", a.Type)
}
if err != nil {
panic(err)
}
return
}
|
[
"func",
"(",
"a",
"AllowTrustOpAsset",
")",
"ToAsset",
"(",
"issuer",
"AccountId",
")",
"(",
"ret",
"Asset",
")",
"{",
"var",
"err",
"error",
"\n",
"switch",
"a",
".",
"Type",
"{",
"case",
"AssetTypeAssetTypeCreditAlphanum4",
":",
"ret",
",",
"err",
"=",
"NewAsset",
"(",
"AssetTypeAssetTypeCreditAlphanum4",
",",
"AssetAlphaNum4",
"{",
"AssetCode",
":",
"a",
".",
"MustAssetCode4",
"(",
")",
",",
"Issuer",
":",
"issuer",
",",
"}",
")",
"\n",
"case",
"AssetTypeAssetTypeCreditAlphanum12",
":",
"ret",
",",
"err",
"=",
"NewAsset",
"(",
"AssetTypeAssetTypeCreditAlphanum12",
",",
"AssetAlphaNum12",
"{",
"AssetCode",
":",
"a",
".",
"MustAssetCode12",
"(",
")",
",",
"Issuer",
":",
"issuer",
",",
"}",
")",
"\n",
"default",
":",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"Unexpected type for AllowTrustOpAsset: %d\"",
",",
"a",
".",
"Type",
")",
"\n",
"}",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"panic",
"(",
"err",
")",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
// ToAsset converts `a` to a proper xdr.Asset
|
[
"ToAsset",
"converts",
"a",
"to",
"a",
"proper",
"xdr",
".",
"Asset"
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/allow_trust_op_asset.go#L8-L31
|
test
|
stellar/go-stellar-base
|
xdr/asset.go
|
SetNative
|
func (a *Asset) SetNative() error {
newa, err := NewAsset(AssetTypeAssetTypeNative, nil)
if err != nil {
return err
}
*a = newa
return nil
}
|
go
|
func (a *Asset) SetNative() error {
newa, err := NewAsset(AssetTypeAssetTypeNative, nil)
if err != nil {
return err
}
*a = newa
return nil
}
|
[
"func",
"(",
"a",
"*",
"Asset",
")",
"SetNative",
"(",
")",
"error",
"{",
"newa",
",",
"err",
":=",
"NewAsset",
"(",
"AssetTypeAssetTypeNative",
",",
"nil",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"*",
"a",
"=",
"newa",
"\n",
"return",
"nil",
"\n",
"}"
] |
// SetNative overwrites `a` with the native asset type
|
[
"SetNative",
"overwrites",
"a",
"with",
"the",
"native",
"asset",
"type"
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/asset.go#L45-L52
|
test
|
stellar/go-stellar-base
|
xdr/asset.go
|
String
|
func (a Asset) String() string {
var t, c, i string
a.MustExtract(&t, &c, &i)
if a.Type == AssetTypeAssetTypeNative {
return t
}
return fmt.Sprintf("%s/%s/%s", t, c, i)
}
|
go
|
func (a Asset) String() string {
var t, c, i string
a.MustExtract(&t, &c, &i)
if a.Type == AssetTypeAssetTypeNative {
return t
}
return fmt.Sprintf("%s/%s/%s", t, c, i)
}
|
[
"func",
"(",
"a",
"Asset",
")",
"String",
"(",
")",
"string",
"{",
"var",
"t",
",",
"c",
",",
"i",
"string",
"\n",
"a",
".",
"MustExtract",
"(",
"&",
"t",
",",
"&",
"c",
",",
"&",
"i",
")",
"\n",
"if",
"a",
".",
"Type",
"==",
"AssetTypeAssetTypeNative",
"{",
"return",
"t",
"\n",
"}",
"\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"%s/%s/%s\"",
",",
"t",
",",
"c",
",",
"i",
")",
"\n",
"}"
] |
// String returns a display friendly form of the asset
|
[
"String",
"returns",
"a",
"display",
"friendly",
"form",
"of",
"the",
"asset"
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/asset.go#L55-L65
|
test
|
stellar/go-stellar-base
|
xdr/asset.go
|
Equals
|
func (a Asset) Equals(other Asset) bool {
if a.Type != other.Type {
return false
}
switch a.Type {
case AssetTypeAssetTypeNative:
return true
case AssetTypeAssetTypeCreditAlphanum4:
l := a.MustAlphaNum4()
r := other.MustAlphaNum4()
return l.AssetCode == r.AssetCode && l.Issuer.Equals(r.Issuer)
case AssetTypeAssetTypeCreditAlphanum12:
l := a.MustAlphaNum12()
r := other.MustAlphaNum12()
return l.AssetCode == r.AssetCode && l.Issuer.Equals(r.Issuer)
default:
panic(fmt.Errorf("Unknown asset type: %v", a.Type))
}
}
|
go
|
func (a Asset) Equals(other Asset) bool {
if a.Type != other.Type {
return false
}
switch a.Type {
case AssetTypeAssetTypeNative:
return true
case AssetTypeAssetTypeCreditAlphanum4:
l := a.MustAlphaNum4()
r := other.MustAlphaNum4()
return l.AssetCode == r.AssetCode && l.Issuer.Equals(r.Issuer)
case AssetTypeAssetTypeCreditAlphanum12:
l := a.MustAlphaNum12()
r := other.MustAlphaNum12()
return l.AssetCode == r.AssetCode && l.Issuer.Equals(r.Issuer)
default:
panic(fmt.Errorf("Unknown asset type: %v", a.Type))
}
}
|
[
"func",
"(",
"a",
"Asset",
")",
"Equals",
"(",
"other",
"Asset",
")",
"bool",
"{",
"if",
"a",
".",
"Type",
"!=",
"other",
".",
"Type",
"{",
"return",
"false",
"\n",
"}",
"\n",
"switch",
"a",
".",
"Type",
"{",
"case",
"AssetTypeAssetTypeNative",
":",
"return",
"true",
"\n",
"case",
"AssetTypeAssetTypeCreditAlphanum4",
":",
"l",
":=",
"a",
".",
"MustAlphaNum4",
"(",
")",
"\n",
"r",
":=",
"other",
".",
"MustAlphaNum4",
"(",
")",
"\n",
"return",
"l",
".",
"AssetCode",
"==",
"r",
".",
"AssetCode",
"&&",
"l",
".",
"Issuer",
".",
"Equals",
"(",
"r",
".",
"Issuer",
")",
"\n",
"case",
"AssetTypeAssetTypeCreditAlphanum12",
":",
"l",
":=",
"a",
".",
"MustAlphaNum12",
"(",
")",
"\n",
"r",
":=",
"other",
".",
"MustAlphaNum12",
"(",
")",
"\n",
"return",
"l",
".",
"AssetCode",
"==",
"r",
".",
"AssetCode",
"&&",
"l",
".",
"Issuer",
".",
"Equals",
"(",
"r",
".",
"Issuer",
")",
"\n",
"default",
":",
"panic",
"(",
"fmt",
".",
"Errorf",
"(",
"\"Unknown asset type: %v\"",
",",
"a",
".",
"Type",
")",
")",
"\n",
"}",
"\n",
"}"
] |
// Equals returns true if `other` is equivalent to `a`
|
[
"Equals",
"returns",
"true",
"if",
"other",
"is",
"equivalent",
"to",
"a"
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/asset.go#L68-L86
|
test
|
stellar/go-stellar-base
|
xdr/asset.go
|
MustExtract
|
func (a Asset) MustExtract(typ interface{}, code interface{}, issuer interface{}) {
err := a.Extract(typ, code, issuer)
if err != nil {
panic(err)
}
}
|
go
|
func (a Asset) MustExtract(typ interface{}, code interface{}, issuer interface{}) {
err := a.Extract(typ, code, issuer)
if err != nil {
panic(err)
}
}
|
[
"func",
"(",
"a",
"Asset",
")",
"MustExtract",
"(",
"typ",
"interface",
"{",
"}",
",",
"code",
"interface",
"{",
"}",
",",
"issuer",
"interface",
"{",
"}",
")",
"{",
"err",
":=",
"a",
".",
"Extract",
"(",
"typ",
",",
"code",
",",
"issuer",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"panic",
"(",
"err",
")",
"\n",
"}",
"\n",
"}"
] |
// MustExtract behaves as Extract, but panics if an error occurs.
|
[
"MustExtract",
"behaves",
"as",
"Extract",
"but",
"panics",
"if",
"an",
"error",
"occurs",
"."
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/asset.go#L148-L154
|
test
|
stellar/go-stellar-base
|
xdr/xdr_generated.go
|
Unmarshal
|
func Unmarshal(r io.Reader, v interface{}) (int, error) {
// delegate to xdr package's Unmarshal
return xdr.Unmarshal(r, v)
}
|
go
|
func Unmarshal(r io.Reader, v interface{}) (int, error) {
// delegate to xdr package's Unmarshal
return xdr.Unmarshal(r, v)
}
|
[
"func",
"Unmarshal",
"(",
"r",
"io",
".",
"Reader",
",",
"v",
"interface",
"{",
"}",
")",
"(",
"int",
",",
"error",
")",
"{",
"return",
"xdr",
".",
"Unmarshal",
"(",
"r",
",",
"v",
")",
"\n",
"}"
] |
// Unmarshal reads an xdr element from `r` into `v`.
|
[
"Unmarshal",
"reads",
"an",
"xdr",
"element",
"from",
"r",
"into",
"v",
"."
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/xdr_generated.go#L21-L24
|
test
|
stellar/go-stellar-base
|
xdr/xdr_generated.go
|
Marshal
|
func Marshal(w io.Writer, v interface{}) (int, error) {
// delegate to xdr package's Marshal
return xdr.Marshal(w, v)
}
|
go
|
func Marshal(w io.Writer, v interface{}) (int, error) {
// delegate to xdr package's Marshal
return xdr.Marshal(w, v)
}
|
[
"func",
"Marshal",
"(",
"w",
"io",
".",
"Writer",
",",
"v",
"interface",
"{",
"}",
")",
"(",
"int",
",",
"error",
")",
"{",
"return",
"xdr",
".",
"Marshal",
"(",
"w",
",",
"v",
")",
"\n",
"}"
] |
// Marshal writes an xdr element `v` into `w`.
|
[
"Marshal",
"writes",
"an",
"xdr",
"element",
"v",
"into",
"w",
"."
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/xdr_generated.go#L27-L30
|
test
|
stellar/go-stellar-base
|
xdr/xdr_generated.go
|
ValidEnum
|
func (e CryptoKeyType) ValidEnum(v int32) bool {
_, ok := cryptoKeyTypeMap[v]
return ok
}
|
go
|
func (e CryptoKeyType) ValidEnum(v int32) bool {
_, ok := cryptoKeyTypeMap[v]
return ok
}
|
[
"func",
"(",
"e",
"CryptoKeyType",
")",
"ValidEnum",
"(",
"v",
"int32",
")",
"bool",
"{",
"_",
",",
"ok",
":=",
"cryptoKeyTypeMap",
"[",
"v",
"]",
"\n",
"return",
"ok",
"\n",
"}"
] |
// ValidEnum validates a proposed value for this enum. Implements
// the Enum interface for CryptoKeyType
|
[
"ValidEnum",
"validates",
"a",
"proposed",
"value",
"for",
"this",
"enum",
".",
"Implements",
"the",
"Enum",
"interface",
"for",
"CryptoKeyType"
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/xdr_generated.go#L87-L90
|
test
|
stellar/go-stellar-base
|
xdr/xdr_generated.go
|
NewPublicKey
|
func NewPublicKey(aType CryptoKeyType, value interface{}) (result PublicKey, err error) {
result.Type = aType
switch CryptoKeyType(aType) {
case CryptoKeyTypeKeyTypeEd25519:
tv, ok := value.(Uint256)
if !ok {
err = fmt.Errorf("invalid value, must be Uint256")
return
}
result.Ed25519 = &tv
}
return
}
|
go
|
func NewPublicKey(aType CryptoKeyType, value interface{}) (result PublicKey, err error) {
result.Type = aType
switch CryptoKeyType(aType) {
case CryptoKeyTypeKeyTypeEd25519:
tv, ok := value.(Uint256)
if !ok {
err = fmt.Errorf("invalid value, must be Uint256")
return
}
result.Ed25519 = &tv
}
return
}
|
[
"func",
"NewPublicKey",
"(",
"aType",
"CryptoKeyType",
",",
"value",
"interface",
"{",
"}",
")",
"(",
"result",
"PublicKey",
",",
"err",
"error",
")",
"{",
"result",
".",
"Type",
"=",
"aType",
"\n",
"switch",
"CryptoKeyType",
"(",
"aType",
")",
"{",
"case",
"CryptoKeyTypeKeyTypeEd25519",
":",
"tv",
",",
"ok",
":=",
"value",
".",
"(",
"Uint256",
")",
"\n",
"if",
"!",
"ok",
"{",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"invalid value, must be Uint256\"",
")",
"\n",
"return",
"\n",
"}",
"\n",
"result",
".",
"Ed25519",
"=",
"&",
"tv",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
// NewPublicKey creates a new PublicKey.
|
[
"NewPublicKey",
"creates",
"a",
"new",
"PublicKey",
"."
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/xdr_generated.go#L128-L140
|
test
|
stellar/go-stellar-base
|
xdr/xdr_generated.go
|
MustEd25519
|
func (u PublicKey) MustEd25519() Uint256 {
val, ok := u.GetEd25519()
if !ok {
panic("arm Ed25519 is not set")
}
return val
}
|
go
|
func (u PublicKey) MustEd25519() Uint256 {
val, ok := u.GetEd25519()
if !ok {
panic("arm Ed25519 is not set")
}
return val
}
|
[
"func",
"(",
"u",
"PublicKey",
")",
"MustEd25519",
"(",
")",
"Uint256",
"{",
"val",
",",
"ok",
":=",
"u",
".",
"GetEd25519",
"(",
")",
"\n",
"if",
"!",
"ok",
"{",
"panic",
"(",
"\"arm Ed25519 is not set\"",
")",
"\n",
"}",
"\n",
"return",
"val",
"\n",
"}"
] |
// MustEd25519 retrieves the Ed25519 value from the union,
// panicing if the value is not set.
|
[
"MustEd25519",
"retrieves",
"the",
"Ed25519",
"value",
"from",
"the",
"union",
"panicing",
"if",
"the",
"value",
"is",
"not",
"set",
"."
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/xdr_generated.go#L144-L152
|
test
|
stellar/go-stellar-base
|
xdr/xdr_generated.go
|
NewNodeId
|
func NewNodeId(aType CryptoKeyType, value interface{}) (result NodeId, err error) {
u, err := NewPublicKey(aType, value)
result = NodeId(u)
return
}
|
go
|
func NewNodeId(aType CryptoKeyType, value interface{}) (result NodeId, err error) {
u, err := NewPublicKey(aType, value)
result = NodeId(u)
return
}
|
[
"func",
"NewNodeId",
"(",
"aType",
"CryptoKeyType",
",",
"value",
"interface",
"{",
"}",
")",
"(",
"result",
"NodeId",
",",
"err",
"error",
")",
"{",
"u",
",",
"err",
":=",
"NewPublicKey",
"(",
"aType",
",",
"value",
")",
"\n",
"result",
"=",
"NodeId",
"(",
"u",
")",
"\n",
"return",
"\n",
"}"
] |
// NewNodeId creates a new NodeId.
|
[
"NewNodeId",
"creates",
"a",
"new",
"NodeId",
"."
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/xdr_generated.go#L198-L202
|
test
|
stellar/go-stellar-base
|
xdr/xdr_generated.go
|
NewAccountId
|
func NewAccountId(aType CryptoKeyType, value interface{}) (result AccountId, err error) {
u, err := NewPublicKey(aType, value)
result = AccountId(u)
return
}
|
go
|
func NewAccountId(aType CryptoKeyType, value interface{}) (result AccountId, err error) {
u, err := NewPublicKey(aType, value)
result = AccountId(u)
return
}
|
[
"func",
"NewAccountId",
"(",
"aType",
"CryptoKeyType",
",",
"value",
"interface",
"{",
"}",
")",
"(",
"result",
"AccountId",
",",
"err",
"error",
")",
"{",
"u",
",",
"err",
":=",
"NewPublicKey",
"(",
"aType",
",",
"value",
")",
"\n",
"result",
"=",
"AccountId",
"(",
"u",
")",
"\n",
"return",
"\n",
"}"
] |
// NewAccountId creates a new AccountId.
|
[
"NewAccountId",
"creates",
"a",
"new",
"AccountId",
"."
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/xdr_generated.go#L279-L283
|
test
|
stellar/go-stellar-base
|
xdr/xdr_generated.go
|
ValidEnum
|
func (e AssetType) ValidEnum(v int32) bool {
_, ok := assetTypeMap[v]
return ok
}
|
go
|
func (e AssetType) ValidEnum(v int32) bool {
_, ok := assetTypeMap[v]
return ok
}
|
[
"func",
"(",
"e",
"AssetType",
")",
"ValidEnum",
"(",
"v",
"int32",
")",
"bool",
"{",
"_",
",",
"ok",
":=",
"assetTypeMap",
"[",
"v",
"]",
"\n",
"return",
"ok",
"\n",
"}"
] |
// ValidEnum validates a proposed value for this enum. Implements
// the Enum interface for AssetType
|
[
"ValidEnum",
"validates",
"a",
"proposed",
"value",
"for",
"this",
"enum",
".",
"Implements",
"the",
"Enum",
"interface",
"for",
"AssetType"
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/xdr_generated.go#L362-L365
|
test
|
stellar/go-stellar-base
|
xdr/xdr_generated.go
|
ArmForSwitch
|
func (u Asset) ArmForSwitch(sw int32) (string, bool) {
switch AssetType(sw) {
case AssetTypeAssetTypeNative:
return "", true
case AssetTypeAssetTypeCreditAlphanum4:
return "AlphaNum4", true
case AssetTypeAssetTypeCreditAlphanum12:
return "AlphaNum12", true
}
return "-", false
}
|
go
|
func (u Asset) ArmForSwitch(sw int32) (string, bool) {
switch AssetType(sw) {
case AssetTypeAssetTypeNative:
return "", true
case AssetTypeAssetTypeCreditAlphanum4:
return "AlphaNum4", true
case AssetTypeAssetTypeCreditAlphanum12:
return "AlphaNum12", true
}
return "-", false
}
|
[
"func",
"(",
"u",
"Asset",
")",
"ArmForSwitch",
"(",
"sw",
"int32",
")",
"(",
"string",
",",
"bool",
")",
"{",
"switch",
"AssetType",
"(",
"sw",
")",
"{",
"case",
"AssetTypeAssetTypeNative",
":",
"return",
"\"\"",
",",
"true",
"\n",
"case",
"AssetTypeAssetTypeCreditAlphanum4",
":",
"return",
"\"AlphaNum4\"",
",",
"true",
"\n",
"case",
"AssetTypeAssetTypeCreditAlphanum12",
":",
"return",
"\"AlphaNum12\"",
",",
"true",
"\n",
"}",
"\n",
"return",
"\"-\"",
",",
"false",
"\n",
"}"
] |
// ArmForSwitch returns which field name should be used for storing
// the value for an instance of Asset
|
[
"ArmForSwitch",
"returns",
"which",
"field",
"name",
"should",
"be",
"used",
"for",
"storing",
"the",
"value",
"for",
"an",
"instance",
"of",
"Asset"
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/xdr_generated.go#L437-L447
|
test
|
stellar/go-stellar-base
|
xdr/xdr_generated.go
|
NewAsset
|
func NewAsset(aType AssetType, value interface{}) (result Asset, err error) {
result.Type = aType
switch AssetType(aType) {
case AssetTypeAssetTypeNative:
// void
case AssetTypeAssetTypeCreditAlphanum4:
tv, ok := value.(AssetAlphaNum4)
if !ok {
err = fmt.Errorf("invalid value, must be AssetAlphaNum4")
return
}
result.AlphaNum4 = &tv
case AssetTypeAssetTypeCreditAlphanum12:
tv, ok := value.(AssetAlphaNum12)
if !ok {
err = fmt.Errorf("invalid value, must be AssetAlphaNum12")
return
}
result.AlphaNum12 = &tv
}
return
}
|
go
|
func NewAsset(aType AssetType, value interface{}) (result Asset, err error) {
result.Type = aType
switch AssetType(aType) {
case AssetTypeAssetTypeNative:
// void
case AssetTypeAssetTypeCreditAlphanum4:
tv, ok := value.(AssetAlphaNum4)
if !ok {
err = fmt.Errorf("invalid value, must be AssetAlphaNum4")
return
}
result.AlphaNum4 = &tv
case AssetTypeAssetTypeCreditAlphanum12:
tv, ok := value.(AssetAlphaNum12)
if !ok {
err = fmt.Errorf("invalid value, must be AssetAlphaNum12")
return
}
result.AlphaNum12 = &tv
}
return
}
|
[
"func",
"NewAsset",
"(",
"aType",
"AssetType",
",",
"value",
"interface",
"{",
"}",
")",
"(",
"result",
"Asset",
",",
"err",
"error",
")",
"{",
"result",
".",
"Type",
"=",
"aType",
"\n",
"switch",
"AssetType",
"(",
"aType",
")",
"{",
"case",
"AssetTypeAssetTypeNative",
":",
"case",
"AssetTypeAssetTypeCreditAlphanum4",
":",
"tv",
",",
"ok",
":=",
"value",
".",
"(",
"AssetAlphaNum4",
")",
"\n",
"if",
"!",
"ok",
"{",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"invalid value, must be AssetAlphaNum4\"",
")",
"\n",
"return",
"\n",
"}",
"\n",
"result",
".",
"AlphaNum4",
"=",
"&",
"tv",
"\n",
"case",
"AssetTypeAssetTypeCreditAlphanum12",
":",
"tv",
",",
"ok",
":=",
"value",
".",
"(",
"AssetAlphaNum12",
")",
"\n",
"if",
"!",
"ok",
"{",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"invalid value, must be AssetAlphaNum12\"",
")",
"\n",
"return",
"\n",
"}",
"\n",
"result",
".",
"AlphaNum12",
"=",
"&",
"tv",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
// NewAsset creates a new Asset.
|
[
"NewAsset",
"creates",
"a",
"new",
"Asset",
"."
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/xdr_generated.go#L450-L471
|
test
|
stellar/go-stellar-base
|
xdr/xdr_generated.go
|
MustAlphaNum4
|
func (u Asset) MustAlphaNum4() AssetAlphaNum4 {
val, ok := u.GetAlphaNum4()
if !ok {
panic("arm AlphaNum4 is not set")
}
return val
}
|
go
|
func (u Asset) MustAlphaNum4() AssetAlphaNum4 {
val, ok := u.GetAlphaNum4()
if !ok {
panic("arm AlphaNum4 is not set")
}
return val
}
|
[
"func",
"(",
"u",
"Asset",
")",
"MustAlphaNum4",
"(",
")",
"AssetAlphaNum4",
"{",
"val",
",",
"ok",
":=",
"u",
".",
"GetAlphaNum4",
"(",
")",
"\n",
"if",
"!",
"ok",
"{",
"panic",
"(",
"\"arm AlphaNum4 is not set\"",
")",
"\n",
"}",
"\n",
"return",
"val",
"\n",
"}"
] |
// MustAlphaNum4 retrieves the AlphaNum4 value from the union,
// panicing if the value is not set.
|
[
"MustAlphaNum4",
"retrieves",
"the",
"AlphaNum4",
"value",
"from",
"the",
"union",
"panicing",
"if",
"the",
"value",
"is",
"not",
"set",
"."
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/xdr_generated.go#L475-L483
|
test
|
stellar/go-stellar-base
|
xdr/xdr_generated.go
|
GetAlphaNum4
|
func (u Asset) GetAlphaNum4() (result AssetAlphaNum4, ok bool) {
armName, _ := u.ArmForSwitch(int32(u.Type))
if armName == "AlphaNum4" {
result = *u.AlphaNum4
ok = true
}
return
}
|
go
|
func (u Asset) GetAlphaNum4() (result AssetAlphaNum4, ok bool) {
armName, _ := u.ArmForSwitch(int32(u.Type))
if armName == "AlphaNum4" {
result = *u.AlphaNum4
ok = true
}
return
}
|
[
"func",
"(",
"u",
"Asset",
")",
"GetAlphaNum4",
"(",
")",
"(",
"result",
"AssetAlphaNum4",
",",
"ok",
"bool",
")",
"{",
"armName",
",",
"_",
":=",
"u",
".",
"ArmForSwitch",
"(",
"int32",
"(",
"u",
".",
"Type",
")",
")",
"\n",
"if",
"armName",
"==",
"\"AlphaNum4\"",
"{",
"result",
"=",
"*",
"u",
".",
"AlphaNum4",
"\n",
"ok",
"=",
"true",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
// GetAlphaNum4 retrieves the AlphaNum4 value from the union,
// returning ok if the union's switch indicated the value is valid.
|
[
"GetAlphaNum4",
"retrieves",
"the",
"AlphaNum4",
"value",
"from",
"the",
"union",
"returning",
"ok",
"if",
"the",
"union",
"s",
"switch",
"indicated",
"the",
"value",
"is",
"valid",
"."
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/xdr_generated.go#L487-L496
|
test
|
stellar/go-stellar-base
|
xdr/xdr_generated.go
|
MustAlphaNum12
|
func (u Asset) MustAlphaNum12() AssetAlphaNum12 {
val, ok := u.GetAlphaNum12()
if !ok {
panic("arm AlphaNum12 is not set")
}
return val
}
|
go
|
func (u Asset) MustAlphaNum12() AssetAlphaNum12 {
val, ok := u.GetAlphaNum12()
if !ok {
panic("arm AlphaNum12 is not set")
}
return val
}
|
[
"func",
"(",
"u",
"Asset",
")",
"MustAlphaNum12",
"(",
")",
"AssetAlphaNum12",
"{",
"val",
",",
"ok",
":=",
"u",
".",
"GetAlphaNum12",
"(",
")",
"\n",
"if",
"!",
"ok",
"{",
"panic",
"(",
"\"arm AlphaNum12 is not set\"",
")",
"\n",
"}",
"\n",
"return",
"val",
"\n",
"}"
] |
// MustAlphaNum12 retrieves the AlphaNum12 value from the union,
// panicing if the value is not set.
|
[
"MustAlphaNum12",
"retrieves",
"the",
"AlphaNum12",
"value",
"from",
"the",
"union",
"panicing",
"if",
"the",
"value",
"is",
"not",
"set",
"."
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/xdr_generated.go#L500-L508
|
test
|
stellar/go-stellar-base
|
xdr/xdr_generated.go
|
GetAlphaNum12
|
func (u Asset) GetAlphaNum12() (result AssetAlphaNum12, ok bool) {
armName, _ := u.ArmForSwitch(int32(u.Type))
if armName == "AlphaNum12" {
result = *u.AlphaNum12
ok = true
}
return
}
|
go
|
func (u Asset) GetAlphaNum12() (result AssetAlphaNum12, ok bool) {
armName, _ := u.ArmForSwitch(int32(u.Type))
if armName == "AlphaNum12" {
result = *u.AlphaNum12
ok = true
}
return
}
|
[
"func",
"(",
"u",
"Asset",
")",
"GetAlphaNum12",
"(",
")",
"(",
"result",
"AssetAlphaNum12",
",",
"ok",
"bool",
")",
"{",
"armName",
",",
"_",
":=",
"u",
".",
"ArmForSwitch",
"(",
"int32",
"(",
"u",
".",
"Type",
")",
")",
"\n",
"if",
"armName",
"==",
"\"AlphaNum12\"",
"{",
"result",
"=",
"*",
"u",
".",
"AlphaNum12",
"\n",
"ok",
"=",
"true",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
// GetAlphaNum12 retrieves the AlphaNum12 value from the union,
// returning ok if the union's switch indicated the value is valid.
|
[
"GetAlphaNum12",
"retrieves",
"the",
"AlphaNum12",
"value",
"from",
"the",
"union",
"returning",
"ok",
"if",
"the",
"union",
"s",
"switch",
"indicated",
"the",
"value",
"is",
"valid",
"."
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/xdr_generated.go#L512-L521
|
test
|
stellar/go-stellar-base
|
xdr/xdr_generated.go
|
ValidEnum
|
func (e ThresholdIndexes) ValidEnum(v int32) bool {
_, ok := thresholdIndexesMap[v]
return ok
}
|
go
|
func (e ThresholdIndexes) ValidEnum(v int32) bool {
_, ok := thresholdIndexesMap[v]
return ok
}
|
[
"func",
"(",
"e",
"ThresholdIndexes",
")",
"ValidEnum",
"(",
"v",
"int32",
")",
"bool",
"{",
"_",
",",
"ok",
":=",
"thresholdIndexesMap",
"[",
"v",
"]",
"\n",
"return",
"ok",
"\n",
"}"
] |
// ValidEnum validates a proposed value for this enum. Implements
// the Enum interface for ThresholdIndexes
|
[
"ValidEnum",
"validates",
"a",
"proposed",
"value",
"for",
"this",
"enum",
".",
"Implements",
"the",
"Enum",
"interface",
"for",
"ThresholdIndexes"
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/xdr_generated.go#L564-L567
|
test
|
stellar/go-stellar-base
|
xdr/xdr_generated.go
|
ValidEnum
|
func (e LedgerEntryType) ValidEnum(v int32) bool {
_, ok := ledgerEntryTypeMap[v]
return ok
}
|
go
|
func (e LedgerEntryType) ValidEnum(v int32) bool {
_, ok := ledgerEntryTypeMap[v]
return ok
}
|
[
"func",
"(",
"e",
"LedgerEntryType",
")",
"ValidEnum",
"(",
"v",
"int32",
")",
"bool",
"{",
"_",
",",
"ok",
":=",
"ledgerEntryTypeMap",
"[",
"v",
"]",
"\n",
"return",
"ok",
"\n",
"}"
] |
// ValidEnum validates a proposed value for this enum. Implements
// the Enum interface for LedgerEntryType
|
[
"ValidEnum",
"validates",
"a",
"proposed",
"value",
"for",
"this",
"enum",
".",
"Implements",
"the",
"Enum",
"interface",
"for",
"LedgerEntryType"
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/xdr_generated.go#L603-L606
|
test
|
stellar/go-stellar-base
|
xdr/xdr_generated.go
|
ValidEnum
|
func (e AccountFlags) ValidEnum(v int32) bool {
_, ok := accountFlagsMap[v]
return ok
}
|
go
|
func (e AccountFlags) ValidEnum(v int32) bool {
_, ok := accountFlagsMap[v]
return ok
}
|
[
"func",
"(",
"e",
"AccountFlags",
")",
"ValidEnum",
"(",
"v",
"int32",
")",
"bool",
"{",
"_",
",",
"ok",
":=",
"accountFlagsMap",
"[",
"v",
"]",
"\n",
"return",
"ok",
"\n",
"}"
] |
// ValidEnum validates a proposed value for this enum. Implements
// the Enum interface for AccountFlags
|
[
"ValidEnum",
"validates",
"a",
"proposed",
"value",
"for",
"this",
"enum",
".",
"Implements",
"the",
"Enum",
"interface",
"for",
"AccountFlags"
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/xdr_generated.go#L659-L662
|
test
|
stellar/go-stellar-base
|
xdr/xdr_generated.go
|
NewAccountEntryExt
|
func NewAccountEntryExt(v int32, value interface{}) (result AccountEntryExt, err error) {
result.V = v
switch int32(v) {
case 0:
// void
}
return
}
|
go
|
func NewAccountEntryExt(v int32, value interface{}) (result AccountEntryExt, err error) {
result.V = v
switch int32(v) {
case 0:
// void
}
return
}
|
[
"func",
"NewAccountEntryExt",
"(",
"v",
"int32",
",",
"value",
"interface",
"{",
"}",
")",
"(",
"result",
"AccountEntryExt",
",",
"err",
"error",
")",
"{",
"result",
".",
"V",
"=",
"v",
"\n",
"switch",
"int32",
"(",
"v",
")",
"{",
"case",
"0",
":",
"}",
"\n",
"return",
"\n",
"}"
] |
// NewAccountEntryExt creates a new AccountEntryExt.
|
[
"NewAccountEntryExt",
"creates",
"a",
"new",
"AccountEntryExt",
"."
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/xdr_generated.go#L699-L706
|
test
|
stellar/go-stellar-base
|
xdr/xdr_generated.go
|
ValidEnum
|
func (e TrustLineFlags) ValidEnum(v int32) bool {
_, ok := trustLineFlagsMap[v]
return ok
}
|
go
|
func (e TrustLineFlags) ValidEnum(v int32) bool {
_, ok := trustLineFlagsMap[v]
return ok
}
|
[
"func",
"(",
"e",
"TrustLineFlags",
")",
"ValidEnum",
"(",
"v",
"int32",
")",
"bool",
"{",
"_",
",",
"ok",
":=",
"trustLineFlagsMap",
"[",
"v",
"]",
"\n",
"return",
"ok",
"\n",
"}"
] |
// ValidEnum validates a proposed value for this enum. Implements
// the Enum interface for TrustLineFlags
|
[
"ValidEnum",
"validates",
"a",
"proposed",
"value",
"for",
"this",
"enum",
".",
"Implements",
"the",
"Enum",
"interface",
"for",
"TrustLineFlags"
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/xdr_generated.go#L770-L773
|
test
|
stellar/go-stellar-base
|
xdr/xdr_generated.go
|
NewTrustLineEntryExt
|
func NewTrustLineEntryExt(v int32, value interface{}) (result TrustLineEntryExt, err error) {
result.V = v
switch int32(v) {
case 0:
// void
}
return
}
|
go
|
func NewTrustLineEntryExt(v int32, value interface{}) (result TrustLineEntryExt, err error) {
result.V = v
switch int32(v) {
case 0:
// void
}
return
}
|
[
"func",
"NewTrustLineEntryExt",
"(",
"v",
"int32",
",",
"value",
"interface",
"{",
"}",
")",
"(",
"result",
"TrustLineEntryExt",
",",
"err",
"error",
")",
"{",
"result",
".",
"V",
"=",
"v",
"\n",
"switch",
"int32",
"(",
"v",
")",
"{",
"case",
"0",
":",
"}",
"\n",
"return",
"\n",
"}"
] |
// NewTrustLineEntryExt creates a new TrustLineEntryExt.
|
[
"NewTrustLineEntryExt",
"creates",
"a",
"new",
"TrustLineEntryExt",
"."
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/xdr_generated.go#L810-L817
|
test
|
stellar/go-stellar-base
|
xdr/xdr_generated.go
|
ValidEnum
|
func (e OfferEntryFlags) ValidEnum(v int32) bool {
_, ok := offerEntryFlagsMap[v]
return ok
}
|
go
|
func (e OfferEntryFlags) ValidEnum(v int32) bool {
_, ok := offerEntryFlagsMap[v]
return ok
}
|
[
"func",
"(",
"e",
"OfferEntryFlags",
")",
"ValidEnum",
"(",
"v",
"int32",
")",
"bool",
"{",
"_",
",",
"ok",
":=",
"offerEntryFlagsMap",
"[",
"v",
"]",
"\n",
"return",
"ok",
"\n",
"}"
] |
// ValidEnum validates a proposed value for this enum. Implements
// the Enum interface for OfferEntryFlags
|
[
"ValidEnum",
"validates",
"a",
"proposed",
"value",
"for",
"this",
"enum",
".",
"Implements",
"the",
"Enum",
"interface",
"for",
"OfferEntryFlags"
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/xdr_generated.go#L869-L872
|
test
|
stellar/go-stellar-base
|
xdr/xdr_generated.go
|
NewOfferEntryExt
|
func NewOfferEntryExt(v int32, value interface{}) (result OfferEntryExt, err error) {
result.V = v
switch int32(v) {
case 0:
// void
}
return
}
|
go
|
func NewOfferEntryExt(v int32, value interface{}) (result OfferEntryExt, err error) {
result.V = v
switch int32(v) {
case 0:
// void
}
return
}
|
[
"func",
"NewOfferEntryExt",
"(",
"v",
"int32",
",",
"value",
"interface",
"{",
"}",
")",
"(",
"result",
"OfferEntryExt",
",",
"err",
"error",
")",
"{",
"result",
".",
"V",
"=",
"v",
"\n",
"switch",
"int32",
"(",
"v",
")",
"{",
"case",
"0",
":",
"}",
"\n",
"return",
"\n",
"}"
] |
// NewOfferEntryExt creates a new OfferEntryExt.
|
[
"NewOfferEntryExt",
"creates",
"a",
"new",
"OfferEntryExt",
"."
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/xdr_generated.go#L909-L916
|
test
|
stellar/go-stellar-base
|
xdr/xdr_generated.go
|
NewDataEntryExt
|
func NewDataEntryExt(v int32, value interface{}) (result DataEntryExt, err error) {
result.V = v
switch int32(v) {
case 0:
// void
}
return
}
|
go
|
func NewDataEntryExt(v int32, value interface{}) (result DataEntryExt, err error) {
result.V = v
switch int32(v) {
case 0:
// void
}
return
}
|
[
"func",
"NewDataEntryExt",
"(",
"v",
"int32",
",",
"value",
"interface",
"{",
"}",
")",
"(",
"result",
"DataEntryExt",
",",
"err",
"error",
")",
"{",
"result",
".",
"V",
"=",
"v",
"\n",
"switch",
"int32",
"(",
"v",
")",
"{",
"case",
"0",
":",
"}",
"\n",
"return",
"\n",
"}"
] |
// NewDataEntryExt creates a new DataEntryExt.
|
[
"NewDataEntryExt",
"creates",
"a",
"new",
"DataEntryExt",
"."
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/xdr_generated.go#L985-L992
|
test
|
stellar/go-stellar-base
|
xdr/xdr_generated.go
|
NewLedgerEntryData
|
func NewLedgerEntryData(aType LedgerEntryType, value interface{}) (result LedgerEntryData, err error) {
result.Type = aType
switch LedgerEntryType(aType) {
case LedgerEntryTypeAccount:
tv, ok := value.(AccountEntry)
if !ok {
err = fmt.Errorf("invalid value, must be AccountEntry")
return
}
result.Account = &tv
case LedgerEntryTypeTrustline:
tv, ok := value.(TrustLineEntry)
if !ok {
err = fmt.Errorf("invalid value, must be TrustLineEntry")
return
}
result.TrustLine = &tv
case LedgerEntryTypeOffer:
tv, ok := value.(OfferEntry)
if !ok {
err = fmt.Errorf("invalid value, must be OfferEntry")
return
}
result.Offer = &tv
case LedgerEntryTypeData:
tv, ok := value.(DataEntry)
if !ok {
err = fmt.Errorf("invalid value, must be DataEntry")
return
}
result.Data = &tv
}
return
}
|
go
|
func NewLedgerEntryData(aType LedgerEntryType, value interface{}) (result LedgerEntryData, err error) {
result.Type = aType
switch LedgerEntryType(aType) {
case LedgerEntryTypeAccount:
tv, ok := value.(AccountEntry)
if !ok {
err = fmt.Errorf("invalid value, must be AccountEntry")
return
}
result.Account = &tv
case LedgerEntryTypeTrustline:
tv, ok := value.(TrustLineEntry)
if !ok {
err = fmt.Errorf("invalid value, must be TrustLineEntry")
return
}
result.TrustLine = &tv
case LedgerEntryTypeOffer:
tv, ok := value.(OfferEntry)
if !ok {
err = fmt.Errorf("invalid value, must be OfferEntry")
return
}
result.Offer = &tv
case LedgerEntryTypeData:
tv, ok := value.(DataEntry)
if !ok {
err = fmt.Errorf("invalid value, must be DataEntry")
return
}
result.Data = &tv
}
return
}
|
[
"func",
"NewLedgerEntryData",
"(",
"aType",
"LedgerEntryType",
",",
"value",
"interface",
"{",
"}",
")",
"(",
"result",
"LedgerEntryData",
",",
"err",
"error",
")",
"{",
"result",
".",
"Type",
"=",
"aType",
"\n",
"switch",
"LedgerEntryType",
"(",
"aType",
")",
"{",
"case",
"LedgerEntryTypeAccount",
":",
"tv",
",",
"ok",
":=",
"value",
".",
"(",
"AccountEntry",
")",
"\n",
"if",
"!",
"ok",
"{",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"invalid value, must be AccountEntry\"",
")",
"\n",
"return",
"\n",
"}",
"\n",
"result",
".",
"Account",
"=",
"&",
"tv",
"\n",
"case",
"LedgerEntryTypeTrustline",
":",
"tv",
",",
"ok",
":=",
"value",
".",
"(",
"TrustLineEntry",
")",
"\n",
"if",
"!",
"ok",
"{",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"invalid value, must be TrustLineEntry\"",
")",
"\n",
"return",
"\n",
"}",
"\n",
"result",
".",
"TrustLine",
"=",
"&",
"tv",
"\n",
"case",
"LedgerEntryTypeOffer",
":",
"tv",
",",
"ok",
":=",
"value",
".",
"(",
"OfferEntry",
")",
"\n",
"if",
"!",
"ok",
"{",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"invalid value, must be OfferEntry\"",
")",
"\n",
"return",
"\n",
"}",
"\n",
"result",
".",
"Offer",
"=",
"&",
"tv",
"\n",
"case",
"LedgerEntryTypeData",
":",
"tv",
",",
"ok",
":=",
"value",
".",
"(",
"DataEntry",
")",
"\n",
"if",
"!",
"ok",
"{",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"invalid value, must be DataEntry\"",
")",
"\n",
"return",
"\n",
"}",
"\n",
"result",
".",
"Data",
"=",
"&",
"tv",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
// NewLedgerEntryData creates a new LedgerEntryData.
|
[
"NewLedgerEntryData",
"creates",
"a",
"new",
"LedgerEntryData",
"."
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/xdr_generated.go#L1063-L1096
|
test
|
stellar/go-stellar-base
|
xdr/xdr_generated.go
|
NewLedgerEntryExt
|
func NewLedgerEntryExt(v int32, value interface{}) (result LedgerEntryExt, err error) {
result.V = v
switch int32(v) {
case 0:
// void
}
return
}
|
go
|
func NewLedgerEntryExt(v int32, value interface{}) (result LedgerEntryExt, err error) {
result.V = v
switch int32(v) {
case 0:
// void
}
return
}
|
[
"func",
"NewLedgerEntryExt",
"(",
"v",
"int32",
",",
"value",
"interface",
"{",
"}",
")",
"(",
"result",
"LedgerEntryExt",
",",
"err",
"error",
")",
"{",
"result",
".",
"V",
"=",
"v",
"\n",
"switch",
"int32",
"(",
"v",
")",
"{",
"case",
"0",
":",
"}",
"\n",
"return",
"\n",
"}"
] |
// NewLedgerEntryExt creates a new LedgerEntryExt.
|
[
"NewLedgerEntryExt",
"creates",
"a",
"new",
"LedgerEntryExt",
"."
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/xdr_generated.go#L1227-L1234
|
test
|
stellar/go-stellar-base
|
xdr/xdr_generated.go
|
ValidEnum
|
func (e EnvelopeType) ValidEnum(v int32) bool {
_, ok := envelopeTypeMap[v]
return ok
}
|
go
|
func (e EnvelopeType) ValidEnum(v int32) bool {
_, ok := envelopeTypeMap[v]
return ok
}
|
[
"func",
"(",
"e",
"EnvelopeType",
")",
"ValidEnum",
"(",
"v",
"int32",
")",
"bool",
"{",
"_",
",",
"ok",
":=",
"envelopeTypeMap",
"[",
"v",
"]",
"\n",
"return",
"ok",
"\n",
"}"
] |
// ValidEnum validates a proposed value for this enum. Implements
// the Enum interface for EnvelopeType
|
[
"ValidEnum",
"validates",
"a",
"proposed",
"value",
"for",
"this",
"enum",
".",
"Implements",
"the",
"Enum",
"interface",
"for",
"EnvelopeType"
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/xdr_generated.go#L1295-L1298
|
test
|
stellar/go-stellar-base
|
xdr/xdr_generated.go
|
ValidEnum
|
func (e OperationType) ValidEnum(v int32) bool {
_, ok := operationTypeMap[v]
return ok
}
|
go
|
func (e OperationType) ValidEnum(v int32) bool {
_, ok := operationTypeMap[v]
return ok
}
|
[
"func",
"(",
"e",
"OperationType",
")",
"ValidEnum",
"(",
"v",
"int32",
")",
"bool",
"{",
"_",
",",
"ok",
":=",
"operationTypeMap",
"[",
"v",
"]",
"\n",
"return",
"ok",
"\n",
"}"
] |
// ValidEnum validates a proposed value for this enum. Implements
// the Enum interface for OperationType
|
[
"ValidEnum",
"validates",
"a",
"proposed",
"value",
"for",
"this",
"enum",
".",
"Implements",
"the",
"Enum",
"interface",
"for",
"OperationType"
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/xdr_generated.go#L1368-L1371
|
test
|
stellar/go-stellar-base
|
xdr/xdr_generated.go
|
ArmForSwitch
|
func (u AllowTrustOpAsset) ArmForSwitch(sw int32) (string, bool) {
switch AssetType(sw) {
case AssetTypeAssetTypeCreditAlphanum4:
return "AssetCode4", true
case AssetTypeAssetTypeCreditAlphanum12:
return "AssetCode12", true
}
return "-", false
}
|
go
|
func (u AllowTrustOpAsset) ArmForSwitch(sw int32) (string, bool) {
switch AssetType(sw) {
case AssetTypeAssetTypeCreditAlphanum4:
return "AssetCode4", true
case AssetTypeAssetTypeCreditAlphanum12:
return "AssetCode12", true
}
return "-", false
}
|
[
"func",
"(",
"u",
"AllowTrustOpAsset",
")",
"ArmForSwitch",
"(",
"sw",
"int32",
")",
"(",
"string",
",",
"bool",
")",
"{",
"switch",
"AssetType",
"(",
"sw",
")",
"{",
"case",
"AssetTypeAssetTypeCreditAlphanum4",
":",
"return",
"\"AssetCode4\"",
",",
"true",
"\n",
"case",
"AssetTypeAssetTypeCreditAlphanum12",
":",
"return",
"\"AssetCode12\"",
",",
"true",
"\n",
"}",
"\n",
"return",
"\"-\"",
",",
"false",
"\n",
"}"
] |
// ArmForSwitch returns which field name should be used for storing
// the value for an instance of AllowTrustOpAsset
|
[
"ArmForSwitch",
"returns",
"which",
"field",
"name",
"should",
"be",
"used",
"for",
"storing",
"the",
"value",
"for",
"an",
"instance",
"of",
"AllowTrustOpAsset"
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/xdr_generated.go#L1547-L1555
|
test
|
stellar/go-stellar-base
|
xdr/xdr_generated.go
|
NewAllowTrustOpAsset
|
func NewAllowTrustOpAsset(aType AssetType, value interface{}) (result AllowTrustOpAsset, err error) {
result.Type = aType
switch AssetType(aType) {
case AssetTypeAssetTypeCreditAlphanum4:
tv, ok := value.([4]byte)
if !ok {
err = fmt.Errorf("invalid value, must be [4]byte")
return
}
result.AssetCode4 = &tv
case AssetTypeAssetTypeCreditAlphanum12:
tv, ok := value.([12]byte)
if !ok {
err = fmt.Errorf("invalid value, must be [12]byte")
return
}
result.AssetCode12 = &tv
}
return
}
|
go
|
func NewAllowTrustOpAsset(aType AssetType, value interface{}) (result AllowTrustOpAsset, err error) {
result.Type = aType
switch AssetType(aType) {
case AssetTypeAssetTypeCreditAlphanum4:
tv, ok := value.([4]byte)
if !ok {
err = fmt.Errorf("invalid value, must be [4]byte")
return
}
result.AssetCode4 = &tv
case AssetTypeAssetTypeCreditAlphanum12:
tv, ok := value.([12]byte)
if !ok {
err = fmt.Errorf("invalid value, must be [12]byte")
return
}
result.AssetCode12 = &tv
}
return
}
|
[
"func",
"NewAllowTrustOpAsset",
"(",
"aType",
"AssetType",
",",
"value",
"interface",
"{",
"}",
")",
"(",
"result",
"AllowTrustOpAsset",
",",
"err",
"error",
")",
"{",
"result",
".",
"Type",
"=",
"aType",
"\n",
"switch",
"AssetType",
"(",
"aType",
")",
"{",
"case",
"AssetTypeAssetTypeCreditAlphanum4",
":",
"tv",
",",
"ok",
":=",
"value",
".",
"(",
"[",
"4",
"]",
"byte",
")",
"\n",
"if",
"!",
"ok",
"{",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"invalid value, must be [4]byte\"",
")",
"\n",
"return",
"\n",
"}",
"\n",
"result",
".",
"AssetCode4",
"=",
"&",
"tv",
"\n",
"case",
"AssetTypeAssetTypeCreditAlphanum12",
":",
"tv",
",",
"ok",
":=",
"value",
".",
"(",
"[",
"12",
"]",
"byte",
")",
"\n",
"if",
"!",
"ok",
"{",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"invalid value, must be [12]byte\"",
")",
"\n",
"return",
"\n",
"}",
"\n",
"result",
".",
"AssetCode12",
"=",
"&",
"tv",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
// NewAllowTrustOpAsset creates a new AllowTrustOpAsset.
|
[
"NewAllowTrustOpAsset",
"creates",
"a",
"new",
"AllowTrustOpAsset",
"."
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/xdr_generated.go#L1558-L1577
|
test
|
stellar/go-stellar-base
|
xdr/xdr_generated.go
|
MustAssetCode4
|
func (u AllowTrustOpAsset) MustAssetCode4() [4]byte {
val, ok := u.GetAssetCode4()
if !ok {
panic("arm AssetCode4 is not set")
}
return val
}
|
go
|
func (u AllowTrustOpAsset) MustAssetCode4() [4]byte {
val, ok := u.GetAssetCode4()
if !ok {
panic("arm AssetCode4 is not set")
}
return val
}
|
[
"func",
"(",
"u",
"AllowTrustOpAsset",
")",
"MustAssetCode4",
"(",
")",
"[",
"4",
"]",
"byte",
"{",
"val",
",",
"ok",
":=",
"u",
".",
"GetAssetCode4",
"(",
")",
"\n",
"if",
"!",
"ok",
"{",
"panic",
"(",
"\"arm AssetCode4 is not set\"",
")",
"\n",
"}",
"\n",
"return",
"val",
"\n",
"}"
] |
// MustAssetCode4 retrieves the AssetCode4 value from the union,
// panicing if the value is not set.
|
[
"MustAssetCode4",
"retrieves",
"the",
"AssetCode4",
"value",
"from",
"the",
"union",
"panicing",
"if",
"the",
"value",
"is",
"not",
"set",
"."
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/xdr_generated.go#L1581-L1589
|
test
|
stellar/go-stellar-base
|
xdr/xdr_generated.go
|
GetAssetCode4
|
func (u AllowTrustOpAsset) GetAssetCode4() (result [4]byte, ok bool) {
armName, _ := u.ArmForSwitch(int32(u.Type))
if armName == "AssetCode4" {
result = *u.AssetCode4
ok = true
}
return
}
|
go
|
func (u AllowTrustOpAsset) GetAssetCode4() (result [4]byte, ok bool) {
armName, _ := u.ArmForSwitch(int32(u.Type))
if armName == "AssetCode4" {
result = *u.AssetCode4
ok = true
}
return
}
|
[
"func",
"(",
"u",
"AllowTrustOpAsset",
")",
"GetAssetCode4",
"(",
")",
"(",
"result",
"[",
"4",
"]",
"byte",
",",
"ok",
"bool",
")",
"{",
"armName",
",",
"_",
":=",
"u",
".",
"ArmForSwitch",
"(",
"int32",
"(",
"u",
".",
"Type",
")",
")",
"\n",
"if",
"armName",
"==",
"\"AssetCode4\"",
"{",
"result",
"=",
"*",
"u",
".",
"AssetCode4",
"\n",
"ok",
"=",
"true",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
// GetAssetCode4 retrieves the AssetCode4 value from the union,
// returning ok if the union's switch indicated the value is valid.
|
[
"GetAssetCode4",
"retrieves",
"the",
"AssetCode4",
"value",
"from",
"the",
"union",
"returning",
"ok",
"if",
"the",
"union",
"s",
"switch",
"indicated",
"the",
"value",
"is",
"valid",
"."
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/xdr_generated.go#L1593-L1602
|
test
|
stellar/go-stellar-base
|
xdr/xdr_generated.go
|
MustAssetCode12
|
func (u AllowTrustOpAsset) MustAssetCode12() [12]byte {
val, ok := u.GetAssetCode12()
if !ok {
panic("arm AssetCode12 is not set")
}
return val
}
|
go
|
func (u AllowTrustOpAsset) MustAssetCode12() [12]byte {
val, ok := u.GetAssetCode12()
if !ok {
panic("arm AssetCode12 is not set")
}
return val
}
|
[
"func",
"(",
"u",
"AllowTrustOpAsset",
")",
"MustAssetCode12",
"(",
")",
"[",
"12",
"]",
"byte",
"{",
"val",
",",
"ok",
":=",
"u",
".",
"GetAssetCode12",
"(",
")",
"\n",
"if",
"!",
"ok",
"{",
"panic",
"(",
"\"arm AssetCode12 is not set\"",
")",
"\n",
"}",
"\n",
"return",
"val",
"\n",
"}"
] |
// MustAssetCode12 retrieves the AssetCode12 value from the union,
// panicing if the value is not set.
|
[
"MustAssetCode12",
"retrieves",
"the",
"AssetCode12",
"value",
"from",
"the",
"union",
"panicing",
"if",
"the",
"value",
"is",
"not",
"set",
"."
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/xdr_generated.go#L1606-L1614
|
test
|
stellar/go-stellar-base
|
xdr/xdr_generated.go
|
GetAssetCode12
|
func (u AllowTrustOpAsset) GetAssetCode12() (result [12]byte, ok bool) {
armName, _ := u.ArmForSwitch(int32(u.Type))
if armName == "AssetCode12" {
result = *u.AssetCode12
ok = true
}
return
}
|
go
|
func (u AllowTrustOpAsset) GetAssetCode12() (result [12]byte, ok bool) {
armName, _ := u.ArmForSwitch(int32(u.Type))
if armName == "AssetCode12" {
result = *u.AssetCode12
ok = true
}
return
}
|
[
"func",
"(",
"u",
"AllowTrustOpAsset",
")",
"GetAssetCode12",
"(",
")",
"(",
"result",
"[",
"12",
"]",
"byte",
",",
"ok",
"bool",
")",
"{",
"armName",
",",
"_",
":=",
"u",
".",
"ArmForSwitch",
"(",
"int32",
"(",
"u",
".",
"Type",
")",
")",
"\n",
"if",
"armName",
"==",
"\"AssetCode12\"",
"{",
"result",
"=",
"*",
"u",
".",
"AssetCode12",
"\n",
"ok",
"=",
"true",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
// GetAssetCode12 retrieves the AssetCode12 value from the union,
// returning ok if the union's switch indicated the value is valid.
|
[
"GetAssetCode12",
"retrieves",
"the",
"AssetCode12",
"value",
"from",
"the",
"union",
"returning",
"ok",
"if",
"the",
"union",
"s",
"switch",
"indicated",
"the",
"value",
"is",
"valid",
"."
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/xdr_generated.go#L1618-L1627
|
test
|
stellar/go-stellar-base
|
xdr/xdr_generated.go
|
NewOperationBody
|
func NewOperationBody(aType OperationType, value interface{}) (result OperationBody, err error) {
result.Type = aType
switch OperationType(aType) {
case OperationTypeCreateAccount:
tv, ok := value.(CreateAccountOp)
if !ok {
err = fmt.Errorf("invalid value, must be CreateAccountOp")
return
}
result.CreateAccountOp = &tv
case OperationTypePayment:
tv, ok := value.(PaymentOp)
if !ok {
err = fmt.Errorf("invalid value, must be PaymentOp")
return
}
result.PaymentOp = &tv
case OperationTypePathPayment:
tv, ok := value.(PathPaymentOp)
if !ok {
err = fmt.Errorf("invalid value, must be PathPaymentOp")
return
}
result.PathPaymentOp = &tv
case OperationTypeManageOffer:
tv, ok := value.(ManageOfferOp)
if !ok {
err = fmt.Errorf("invalid value, must be ManageOfferOp")
return
}
result.ManageOfferOp = &tv
case OperationTypeCreatePassiveOffer:
tv, ok := value.(CreatePassiveOfferOp)
if !ok {
err = fmt.Errorf("invalid value, must be CreatePassiveOfferOp")
return
}
result.CreatePassiveOfferOp = &tv
case OperationTypeSetOptions:
tv, ok := value.(SetOptionsOp)
if !ok {
err = fmt.Errorf("invalid value, must be SetOptionsOp")
return
}
result.SetOptionsOp = &tv
case OperationTypeChangeTrust:
tv, ok := value.(ChangeTrustOp)
if !ok {
err = fmt.Errorf("invalid value, must be ChangeTrustOp")
return
}
result.ChangeTrustOp = &tv
case OperationTypeAllowTrust:
tv, ok := value.(AllowTrustOp)
if !ok {
err = fmt.Errorf("invalid value, must be AllowTrustOp")
return
}
result.AllowTrustOp = &tv
case OperationTypeAccountMerge:
tv, ok := value.(AccountId)
if !ok {
err = fmt.Errorf("invalid value, must be AccountId")
return
}
result.Destination = &tv
case OperationTypeInflation:
// void
case OperationTypeManageData:
tv, ok := value.(ManageDataOp)
if !ok {
err = fmt.Errorf("invalid value, must be ManageDataOp")
return
}
result.ManageDataOp = &tv
}
return
}
|
go
|
func NewOperationBody(aType OperationType, value interface{}) (result OperationBody, err error) {
result.Type = aType
switch OperationType(aType) {
case OperationTypeCreateAccount:
tv, ok := value.(CreateAccountOp)
if !ok {
err = fmt.Errorf("invalid value, must be CreateAccountOp")
return
}
result.CreateAccountOp = &tv
case OperationTypePayment:
tv, ok := value.(PaymentOp)
if !ok {
err = fmt.Errorf("invalid value, must be PaymentOp")
return
}
result.PaymentOp = &tv
case OperationTypePathPayment:
tv, ok := value.(PathPaymentOp)
if !ok {
err = fmt.Errorf("invalid value, must be PathPaymentOp")
return
}
result.PathPaymentOp = &tv
case OperationTypeManageOffer:
tv, ok := value.(ManageOfferOp)
if !ok {
err = fmt.Errorf("invalid value, must be ManageOfferOp")
return
}
result.ManageOfferOp = &tv
case OperationTypeCreatePassiveOffer:
tv, ok := value.(CreatePassiveOfferOp)
if !ok {
err = fmt.Errorf("invalid value, must be CreatePassiveOfferOp")
return
}
result.CreatePassiveOfferOp = &tv
case OperationTypeSetOptions:
tv, ok := value.(SetOptionsOp)
if !ok {
err = fmt.Errorf("invalid value, must be SetOptionsOp")
return
}
result.SetOptionsOp = &tv
case OperationTypeChangeTrust:
tv, ok := value.(ChangeTrustOp)
if !ok {
err = fmt.Errorf("invalid value, must be ChangeTrustOp")
return
}
result.ChangeTrustOp = &tv
case OperationTypeAllowTrust:
tv, ok := value.(AllowTrustOp)
if !ok {
err = fmt.Errorf("invalid value, must be AllowTrustOp")
return
}
result.AllowTrustOp = &tv
case OperationTypeAccountMerge:
tv, ok := value.(AccountId)
if !ok {
err = fmt.Errorf("invalid value, must be AccountId")
return
}
result.Destination = &tv
case OperationTypeInflation:
// void
case OperationTypeManageData:
tv, ok := value.(ManageDataOp)
if !ok {
err = fmt.Errorf("invalid value, must be ManageDataOp")
return
}
result.ManageDataOp = &tv
}
return
}
|
[
"func",
"NewOperationBody",
"(",
"aType",
"OperationType",
",",
"value",
"interface",
"{",
"}",
")",
"(",
"result",
"OperationBody",
",",
"err",
"error",
")",
"{",
"result",
".",
"Type",
"=",
"aType",
"\n",
"switch",
"OperationType",
"(",
"aType",
")",
"{",
"case",
"OperationTypeCreateAccount",
":",
"tv",
",",
"ok",
":=",
"value",
".",
"(",
"CreateAccountOp",
")",
"\n",
"if",
"!",
"ok",
"{",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"invalid value, must be CreateAccountOp\"",
")",
"\n",
"return",
"\n",
"}",
"\n",
"result",
".",
"CreateAccountOp",
"=",
"&",
"tv",
"\n",
"case",
"OperationTypePayment",
":",
"tv",
",",
"ok",
":=",
"value",
".",
"(",
"PaymentOp",
")",
"\n",
"if",
"!",
"ok",
"{",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"invalid value, must be PaymentOp\"",
")",
"\n",
"return",
"\n",
"}",
"\n",
"result",
".",
"PaymentOp",
"=",
"&",
"tv",
"\n",
"case",
"OperationTypePathPayment",
":",
"tv",
",",
"ok",
":=",
"value",
".",
"(",
"PathPaymentOp",
")",
"\n",
"if",
"!",
"ok",
"{",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"invalid value, must be PathPaymentOp\"",
")",
"\n",
"return",
"\n",
"}",
"\n",
"result",
".",
"PathPaymentOp",
"=",
"&",
"tv",
"\n",
"case",
"OperationTypeManageOffer",
":",
"tv",
",",
"ok",
":=",
"value",
".",
"(",
"ManageOfferOp",
")",
"\n",
"if",
"!",
"ok",
"{",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"invalid value, must be ManageOfferOp\"",
")",
"\n",
"return",
"\n",
"}",
"\n",
"result",
".",
"ManageOfferOp",
"=",
"&",
"tv",
"\n",
"case",
"OperationTypeCreatePassiveOffer",
":",
"tv",
",",
"ok",
":=",
"value",
".",
"(",
"CreatePassiveOfferOp",
")",
"\n",
"if",
"!",
"ok",
"{",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"invalid value, must be CreatePassiveOfferOp\"",
")",
"\n",
"return",
"\n",
"}",
"\n",
"result",
".",
"CreatePassiveOfferOp",
"=",
"&",
"tv",
"\n",
"case",
"OperationTypeSetOptions",
":",
"tv",
",",
"ok",
":=",
"value",
".",
"(",
"SetOptionsOp",
")",
"\n",
"if",
"!",
"ok",
"{",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"invalid value, must be SetOptionsOp\"",
")",
"\n",
"return",
"\n",
"}",
"\n",
"result",
".",
"SetOptionsOp",
"=",
"&",
"tv",
"\n",
"case",
"OperationTypeChangeTrust",
":",
"tv",
",",
"ok",
":=",
"value",
".",
"(",
"ChangeTrustOp",
")",
"\n",
"if",
"!",
"ok",
"{",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"invalid value, must be ChangeTrustOp\"",
")",
"\n",
"return",
"\n",
"}",
"\n",
"result",
".",
"ChangeTrustOp",
"=",
"&",
"tv",
"\n",
"case",
"OperationTypeAllowTrust",
":",
"tv",
",",
"ok",
":=",
"value",
".",
"(",
"AllowTrustOp",
")",
"\n",
"if",
"!",
"ok",
"{",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"invalid value, must be AllowTrustOp\"",
")",
"\n",
"return",
"\n",
"}",
"\n",
"result",
".",
"AllowTrustOp",
"=",
"&",
"tv",
"\n",
"case",
"OperationTypeAccountMerge",
":",
"tv",
",",
"ok",
":=",
"value",
".",
"(",
"AccountId",
")",
"\n",
"if",
"!",
"ok",
"{",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"invalid value, must be AccountId\"",
")",
"\n",
"return",
"\n",
"}",
"\n",
"result",
".",
"Destination",
"=",
"&",
"tv",
"\n",
"case",
"OperationTypeInflation",
":",
"case",
"OperationTypeManageData",
":",
"tv",
",",
"ok",
":=",
"value",
".",
"(",
"ManageDataOp",
")",
"\n",
"if",
"!",
"ok",
"{",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"invalid value, must be ManageDataOp\"",
")",
"\n",
"return",
"\n",
"}",
"\n",
"result",
".",
"ManageDataOp",
"=",
"&",
"tv",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
// NewOperationBody creates a new OperationBody.
|
[
"NewOperationBody",
"creates",
"a",
"new",
"OperationBody",
"."
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/xdr_generated.go#L1748-L1825
|
test
|
stellar/go-stellar-base
|
xdr/xdr_generated.go
|
MustCreateAccountOp
|
func (u OperationBody) MustCreateAccountOp() CreateAccountOp {
val, ok := u.GetCreateAccountOp()
if !ok {
panic("arm CreateAccountOp is not set")
}
return val
}
|
go
|
func (u OperationBody) MustCreateAccountOp() CreateAccountOp {
val, ok := u.GetCreateAccountOp()
if !ok {
panic("arm CreateAccountOp is not set")
}
return val
}
|
[
"func",
"(",
"u",
"OperationBody",
")",
"MustCreateAccountOp",
"(",
")",
"CreateAccountOp",
"{",
"val",
",",
"ok",
":=",
"u",
".",
"GetCreateAccountOp",
"(",
")",
"\n",
"if",
"!",
"ok",
"{",
"panic",
"(",
"\"arm CreateAccountOp is not set\"",
")",
"\n",
"}",
"\n",
"return",
"val",
"\n",
"}"
] |
// MustCreateAccountOp retrieves the CreateAccountOp value from the union,
// panicing if the value is not set.
|
[
"MustCreateAccountOp",
"retrieves",
"the",
"CreateAccountOp",
"value",
"from",
"the",
"union",
"panicing",
"if",
"the",
"value",
"is",
"not",
"set",
"."
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/xdr_generated.go#L1829-L1837
|
test
|
stellar/go-stellar-base
|
xdr/xdr_generated.go
|
GetCreateAccountOp
|
func (u OperationBody) GetCreateAccountOp() (result CreateAccountOp, ok bool) {
armName, _ := u.ArmForSwitch(int32(u.Type))
if armName == "CreateAccountOp" {
result = *u.CreateAccountOp
ok = true
}
return
}
|
go
|
func (u OperationBody) GetCreateAccountOp() (result CreateAccountOp, ok bool) {
armName, _ := u.ArmForSwitch(int32(u.Type))
if armName == "CreateAccountOp" {
result = *u.CreateAccountOp
ok = true
}
return
}
|
[
"func",
"(",
"u",
"OperationBody",
")",
"GetCreateAccountOp",
"(",
")",
"(",
"result",
"CreateAccountOp",
",",
"ok",
"bool",
")",
"{",
"armName",
",",
"_",
":=",
"u",
".",
"ArmForSwitch",
"(",
"int32",
"(",
"u",
".",
"Type",
")",
")",
"\n",
"if",
"armName",
"==",
"\"CreateAccountOp\"",
"{",
"result",
"=",
"*",
"u",
".",
"CreateAccountOp",
"\n",
"ok",
"=",
"true",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
// GetCreateAccountOp retrieves the CreateAccountOp value from the union,
// returning ok if the union's switch indicated the value is valid.
|
[
"GetCreateAccountOp",
"retrieves",
"the",
"CreateAccountOp",
"value",
"from",
"the",
"union",
"returning",
"ok",
"if",
"the",
"union",
"s",
"switch",
"indicated",
"the",
"value",
"is",
"valid",
"."
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/xdr_generated.go#L1841-L1850
|
test
|
stellar/go-stellar-base
|
xdr/xdr_generated.go
|
MustPaymentOp
|
func (u OperationBody) MustPaymentOp() PaymentOp {
val, ok := u.GetPaymentOp()
if !ok {
panic("arm PaymentOp is not set")
}
return val
}
|
go
|
func (u OperationBody) MustPaymentOp() PaymentOp {
val, ok := u.GetPaymentOp()
if !ok {
panic("arm PaymentOp is not set")
}
return val
}
|
[
"func",
"(",
"u",
"OperationBody",
")",
"MustPaymentOp",
"(",
")",
"PaymentOp",
"{",
"val",
",",
"ok",
":=",
"u",
".",
"GetPaymentOp",
"(",
")",
"\n",
"if",
"!",
"ok",
"{",
"panic",
"(",
"\"arm PaymentOp is not set\"",
")",
"\n",
"}",
"\n",
"return",
"val",
"\n",
"}"
] |
// MustPaymentOp retrieves the PaymentOp value from the union,
// panicing if the value is not set.
|
[
"MustPaymentOp",
"retrieves",
"the",
"PaymentOp",
"value",
"from",
"the",
"union",
"panicing",
"if",
"the",
"value",
"is",
"not",
"set",
"."
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/xdr_generated.go#L1854-L1862
|
test
|
stellar/go-stellar-base
|
xdr/xdr_generated.go
|
GetPaymentOp
|
func (u OperationBody) GetPaymentOp() (result PaymentOp, ok bool) {
armName, _ := u.ArmForSwitch(int32(u.Type))
if armName == "PaymentOp" {
result = *u.PaymentOp
ok = true
}
return
}
|
go
|
func (u OperationBody) GetPaymentOp() (result PaymentOp, ok bool) {
armName, _ := u.ArmForSwitch(int32(u.Type))
if armName == "PaymentOp" {
result = *u.PaymentOp
ok = true
}
return
}
|
[
"func",
"(",
"u",
"OperationBody",
")",
"GetPaymentOp",
"(",
")",
"(",
"result",
"PaymentOp",
",",
"ok",
"bool",
")",
"{",
"armName",
",",
"_",
":=",
"u",
".",
"ArmForSwitch",
"(",
"int32",
"(",
"u",
".",
"Type",
")",
")",
"\n",
"if",
"armName",
"==",
"\"PaymentOp\"",
"{",
"result",
"=",
"*",
"u",
".",
"PaymentOp",
"\n",
"ok",
"=",
"true",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
// GetPaymentOp retrieves the PaymentOp value from the union,
// returning ok if the union's switch indicated the value is valid.
|
[
"GetPaymentOp",
"retrieves",
"the",
"PaymentOp",
"value",
"from",
"the",
"union",
"returning",
"ok",
"if",
"the",
"union",
"s",
"switch",
"indicated",
"the",
"value",
"is",
"valid",
"."
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/xdr_generated.go#L1866-L1875
|
test
|
stellar/go-stellar-base
|
xdr/xdr_generated.go
|
MustPathPaymentOp
|
func (u OperationBody) MustPathPaymentOp() PathPaymentOp {
val, ok := u.GetPathPaymentOp()
if !ok {
panic("arm PathPaymentOp is not set")
}
return val
}
|
go
|
func (u OperationBody) MustPathPaymentOp() PathPaymentOp {
val, ok := u.GetPathPaymentOp()
if !ok {
panic("arm PathPaymentOp is not set")
}
return val
}
|
[
"func",
"(",
"u",
"OperationBody",
")",
"MustPathPaymentOp",
"(",
")",
"PathPaymentOp",
"{",
"val",
",",
"ok",
":=",
"u",
".",
"GetPathPaymentOp",
"(",
")",
"\n",
"if",
"!",
"ok",
"{",
"panic",
"(",
"\"arm PathPaymentOp is not set\"",
")",
"\n",
"}",
"\n",
"return",
"val",
"\n",
"}"
] |
// MustPathPaymentOp retrieves the PathPaymentOp value from the union,
// panicing if the value is not set.
|
[
"MustPathPaymentOp",
"retrieves",
"the",
"PathPaymentOp",
"value",
"from",
"the",
"union",
"panicing",
"if",
"the",
"value",
"is",
"not",
"set",
"."
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/xdr_generated.go#L1879-L1887
|
test
|
stellar/go-stellar-base
|
xdr/xdr_generated.go
|
GetPathPaymentOp
|
func (u OperationBody) GetPathPaymentOp() (result PathPaymentOp, ok bool) {
armName, _ := u.ArmForSwitch(int32(u.Type))
if armName == "PathPaymentOp" {
result = *u.PathPaymentOp
ok = true
}
return
}
|
go
|
func (u OperationBody) GetPathPaymentOp() (result PathPaymentOp, ok bool) {
armName, _ := u.ArmForSwitch(int32(u.Type))
if armName == "PathPaymentOp" {
result = *u.PathPaymentOp
ok = true
}
return
}
|
[
"func",
"(",
"u",
"OperationBody",
")",
"GetPathPaymentOp",
"(",
")",
"(",
"result",
"PathPaymentOp",
",",
"ok",
"bool",
")",
"{",
"armName",
",",
"_",
":=",
"u",
".",
"ArmForSwitch",
"(",
"int32",
"(",
"u",
".",
"Type",
")",
")",
"\n",
"if",
"armName",
"==",
"\"PathPaymentOp\"",
"{",
"result",
"=",
"*",
"u",
".",
"PathPaymentOp",
"\n",
"ok",
"=",
"true",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
// GetPathPaymentOp retrieves the PathPaymentOp value from the union,
// returning ok if the union's switch indicated the value is valid.
|
[
"GetPathPaymentOp",
"retrieves",
"the",
"PathPaymentOp",
"value",
"from",
"the",
"union",
"returning",
"ok",
"if",
"the",
"union",
"s",
"switch",
"indicated",
"the",
"value",
"is",
"valid",
"."
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/xdr_generated.go#L1891-L1900
|
test
|
stellar/go-stellar-base
|
xdr/xdr_generated.go
|
MustManageOfferOp
|
func (u OperationBody) MustManageOfferOp() ManageOfferOp {
val, ok := u.GetManageOfferOp()
if !ok {
panic("arm ManageOfferOp is not set")
}
return val
}
|
go
|
func (u OperationBody) MustManageOfferOp() ManageOfferOp {
val, ok := u.GetManageOfferOp()
if !ok {
panic("arm ManageOfferOp is not set")
}
return val
}
|
[
"func",
"(",
"u",
"OperationBody",
")",
"MustManageOfferOp",
"(",
")",
"ManageOfferOp",
"{",
"val",
",",
"ok",
":=",
"u",
".",
"GetManageOfferOp",
"(",
")",
"\n",
"if",
"!",
"ok",
"{",
"panic",
"(",
"\"arm ManageOfferOp is not set\"",
")",
"\n",
"}",
"\n",
"return",
"val",
"\n",
"}"
] |
// MustManageOfferOp retrieves the ManageOfferOp value from the union,
// panicing if the value is not set.
|
[
"MustManageOfferOp",
"retrieves",
"the",
"ManageOfferOp",
"value",
"from",
"the",
"union",
"panicing",
"if",
"the",
"value",
"is",
"not",
"set",
"."
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/xdr_generated.go#L1904-L1912
|
test
|
stellar/go-stellar-base
|
xdr/xdr_generated.go
|
GetManageOfferOp
|
func (u OperationBody) GetManageOfferOp() (result ManageOfferOp, ok bool) {
armName, _ := u.ArmForSwitch(int32(u.Type))
if armName == "ManageOfferOp" {
result = *u.ManageOfferOp
ok = true
}
return
}
|
go
|
func (u OperationBody) GetManageOfferOp() (result ManageOfferOp, ok bool) {
armName, _ := u.ArmForSwitch(int32(u.Type))
if armName == "ManageOfferOp" {
result = *u.ManageOfferOp
ok = true
}
return
}
|
[
"func",
"(",
"u",
"OperationBody",
")",
"GetManageOfferOp",
"(",
")",
"(",
"result",
"ManageOfferOp",
",",
"ok",
"bool",
")",
"{",
"armName",
",",
"_",
":=",
"u",
".",
"ArmForSwitch",
"(",
"int32",
"(",
"u",
".",
"Type",
")",
")",
"\n",
"if",
"armName",
"==",
"\"ManageOfferOp\"",
"{",
"result",
"=",
"*",
"u",
".",
"ManageOfferOp",
"\n",
"ok",
"=",
"true",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
// GetManageOfferOp retrieves the ManageOfferOp value from the union,
// returning ok if the union's switch indicated the value is valid.
|
[
"GetManageOfferOp",
"retrieves",
"the",
"ManageOfferOp",
"value",
"from",
"the",
"union",
"returning",
"ok",
"if",
"the",
"union",
"s",
"switch",
"indicated",
"the",
"value",
"is",
"valid",
"."
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/xdr_generated.go#L1916-L1925
|
test
|
stellar/go-stellar-base
|
xdr/xdr_generated.go
|
MustCreatePassiveOfferOp
|
func (u OperationBody) MustCreatePassiveOfferOp() CreatePassiveOfferOp {
val, ok := u.GetCreatePassiveOfferOp()
if !ok {
panic("arm CreatePassiveOfferOp is not set")
}
return val
}
|
go
|
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",
"(",
")",
"\n",
"if",
"!",
"ok",
"{",
"panic",
"(",
"\"arm CreatePassiveOfferOp is not set\"",
")",
"\n",
"}",
"\n",
"return",
"val",
"\n",
"}"
] |
// 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",
"."
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/xdr_generated.go#L1929-L1937
|
test
|
stellar/go-stellar-base
|
xdr/xdr_generated.go
|
GetCreatePassiveOfferOp
|
func (u OperationBody) GetCreatePassiveOfferOp() (result CreatePassiveOfferOp, ok bool) {
armName, _ := u.ArmForSwitch(int32(u.Type))
if armName == "CreatePassiveOfferOp" {
result = *u.CreatePassiveOfferOp
ok = true
}
return
}
|
go
|
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",
")",
")",
"\n",
"if",
"armName",
"==",
"\"CreatePassiveOfferOp\"",
"{",
"result",
"=",
"*",
"u",
".",
"CreatePassiveOfferOp",
"\n",
"ok",
"=",
"true",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
// 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",
"."
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/xdr_generated.go#L1941-L1950
|
test
|
stellar/go-stellar-base
|
xdr/xdr_generated.go
|
MustSetOptionsOp
|
func (u OperationBody) MustSetOptionsOp() SetOptionsOp {
val, ok := u.GetSetOptionsOp()
if !ok {
panic("arm SetOptionsOp is not set")
}
return val
}
|
go
|
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",
"(",
")",
"\n",
"if",
"!",
"ok",
"{",
"panic",
"(",
"\"arm SetOptionsOp is not set\"",
")",
"\n",
"}",
"\n",
"return",
"val",
"\n",
"}"
] |
// 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",
"."
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/xdr_generated.go#L1954-L1962
|
test
|
stellar/go-stellar-base
|
xdr/xdr_generated.go
|
GetSetOptionsOp
|
func (u OperationBody) GetSetOptionsOp() (result SetOptionsOp, ok bool) {
armName, _ := u.ArmForSwitch(int32(u.Type))
if armName == "SetOptionsOp" {
result = *u.SetOptionsOp
ok = true
}
return
}
|
go
|
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",
")",
")",
"\n",
"if",
"armName",
"==",
"\"SetOptionsOp\"",
"{",
"result",
"=",
"*",
"u",
".",
"SetOptionsOp",
"\n",
"ok",
"=",
"true",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
// 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",
"."
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/xdr_generated.go#L1966-L1975
|
test
|
stellar/go-stellar-base
|
xdr/xdr_generated.go
|
MustChangeTrustOp
|
func (u OperationBody) MustChangeTrustOp() ChangeTrustOp {
val, ok := u.GetChangeTrustOp()
if !ok {
panic("arm ChangeTrustOp is not set")
}
return val
}
|
go
|
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",
"(",
")",
"\n",
"if",
"!",
"ok",
"{",
"panic",
"(",
"\"arm ChangeTrustOp is not set\"",
")",
"\n",
"}",
"\n",
"return",
"val",
"\n",
"}"
] |
// 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",
"."
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/xdr_generated.go#L1979-L1987
|
test
|
stellar/go-stellar-base
|
xdr/xdr_generated.go
|
GetChangeTrustOp
|
func (u OperationBody) GetChangeTrustOp() (result ChangeTrustOp, ok bool) {
armName, _ := u.ArmForSwitch(int32(u.Type))
if armName == "ChangeTrustOp" {
result = *u.ChangeTrustOp
ok = true
}
return
}
|
go
|
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",
")",
")",
"\n",
"if",
"armName",
"==",
"\"ChangeTrustOp\"",
"{",
"result",
"=",
"*",
"u",
".",
"ChangeTrustOp",
"\n",
"ok",
"=",
"true",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
// 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",
"."
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/xdr_generated.go#L1991-L2000
|
test
|
stellar/go-stellar-base
|
xdr/xdr_generated.go
|
MustAllowTrustOp
|
func (u OperationBody) MustAllowTrustOp() AllowTrustOp {
val, ok := u.GetAllowTrustOp()
if !ok {
panic("arm AllowTrustOp is not set")
}
return val
}
|
go
|
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",
"(",
")",
"\n",
"if",
"!",
"ok",
"{",
"panic",
"(",
"\"arm AllowTrustOp is not set\"",
")",
"\n",
"}",
"\n",
"return",
"val",
"\n",
"}"
] |
// 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",
"."
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/xdr_generated.go#L2004-L2012
|
test
|
stellar/go-stellar-base
|
xdr/xdr_generated.go
|
GetAllowTrustOp
|
func (u OperationBody) GetAllowTrustOp() (result AllowTrustOp, ok bool) {
armName, _ := u.ArmForSwitch(int32(u.Type))
if armName == "AllowTrustOp" {
result = *u.AllowTrustOp
ok = true
}
return
}
|
go
|
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",
")",
")",
"\n",
"if",
"armName",
"==",
"\"AllowTrustOp\"",
"{",
"result",
"=",
"*",
"u",
".",
"AllowTrustOp",
"\n",
"ok",
"=",
"true",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
// 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",
"."
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/xdr_generated.go#L2016-L2025
|
test
|
stellar/go-stellar-base
|
xdr/xdr_generated.go
|
MustDestination
|
func (u OperationBody) MustDestination() AccountId {
val, ok := u.GetDestination()
if !ok {
panic("arm Destination is not set")
}
return val
}
|
go
|
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",
"(",
")",
"\n",
"if",
"!",
"ok",
"{",
"panic",
"(",
"\"arm Destination is not set\"",
")",
"\n",
"}",
"\n",
"return",
"val",
"\n",
"}"
] |
// 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",
"."
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/xdr_generated.go#L2029-L2037
|
test
|
stellar/go-stellar-base
|
xdr/xdr_generated.go
|
GetDestination
|
func (u OperationBody) GetDestination() (result AccountId, ok bool) {
armName, _ := u.ArmForSwitch(int32(u.Type))
if armName == "Destination" {
result = *u.Destination
ok = true
}
return
}
|
go
|
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",
")",
")",
"\n",
"if",
"armName",
"==",
"\"Destination\"",
"{",
"result",
"=",
"*",
"u",
".",
"Destination",
"\n",
"ok",
"=",
"true",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
// 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",
"."
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/xdr_generated.go#L2041-L2050
|
test
|
stellar/go-stellar-base
|
xdr/xdr_generated.go
|
MustManageDataOp
|
func (u OperationBody) MustManageDataOp() ManageDataOp {
val, ok := u.GetManageDataOp()
if !ok {
panic("arm ManageDataOp is not set")
}
return val
}
|
go
|
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",
"(",
")",
"\n",
"if",
"!",
"ok",
"{",
"panic",
"(",
"\"arm ManageDataOp is not set\"",
")",
"\n",
"}",
"\n",
"return",
"val",
"\n",
"}"
] |
// 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",
"."
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/xdr_generated.go#L2054-L2062
|
test
|
stellar/go-stellar-base
|
xdr/xdr_generated.go
|
GetManageDataOp
|
func (u OperationBody) GetManageDataOp() (result ManageDataOp, ok bool) {
armName, _ := u.ArmForSwitch(int32(u.Type))
if armName == "ManageDataOp" {
result = *u.ManageDataOp
ok = true
}
return
}
|
go
|
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",
")",
")",
"\n",
"if",
"armName",
"==",
"\"ManageDataOp\"",
"{",
"result",
"=",
"*",
"u",
".",
"ManageDataOp",
"\n",
"ok",
"=",
"true",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
// 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",
"."
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/xdr_generated.go#L2066-L2075
|
test
|
stellar/go-stellar-base
|
xdr/xdr_generated.go
|
ValidEnum
|
func (e MemoType) ValidEnum(v int32) bool {
_, ok := memoTypeMap[v]
return ok
}
|
go
|
func (e MemoType) ValidEnum(v int32) bool {
_, ok := memoTypeMap[v]
return ok
}
|
[
"func",
"(",
"e",
"MemoType",
")",
"ValidEnum",
"(",
"v",
"int32",
")",
"bool",
"{",
"_",
",",
"ok",
":=",
"memoTypeMap",
"[",
"v",
"]",
"\n",
"return",
"ok",
"\n",
"}"
] |
// 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"
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/xdr_generated.go#L2150-L2153
|
test
|
stellar/go-stellar-base
|
xdr/xdr_generated.go
|
ArmForSwitch
|
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
}
|
go
|
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",
"\n",
"case",
"MemoTypeMemoText",
":",
"return",
"\"Text\"",
",",
"true",
"\n",
"case",
"MemoTypeMemoId",
":",
"return",
"\"Id\"",
",",
"true",
"\n",
"case",
"MemoTypeMemoHash",
":",
"return",
"\"Hash\"",
",",
"true",
"\n",
"case",
"MemoTypeMemoReturn",
":",
"return",
"\"RetHash\"",
",",
"true",
"\n",
"}",
"\n",
"return",
"\"-\"",
",",
"false",
"\n",
"}"
] |
// 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"
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/xdr_generated.go#L2193-L2207
|
test
|
stellar/go-stellar-base
|
xdr/xdr_generated.go
|
NewMemo
|
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
}
|
go
|
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",
"\n",
"switch",
"MemoType",
"(",
"aType",
")",
"{",
"case",
"MemoTypeMemoNone",
":",
"case",
"MemoTypeMemoText",
":",
"tv",
",",
"ok",
":=",
"value",
".",
"(",
"string",
")",
"\n",
"if",
"!",
"ok",
"{",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"invalid value, must be string\"",
")",
"\n",
"return",
"\n",
"}",
"\n",
"result",
".",
"Text",
"=",
"&",
"tv",
"\n",
"case",
"MemoTypeMemoId",
":",
"tv",
",",
"ok",
":=",
"value",
".",
"(",
"Uint64",
")",
"\n",
"if",
"!",
"ok",
"{",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"invalid value, must be Uint64\"",
")",
"\n",
"return",
"\n",
"}",
"\n",
"result",
".",
"Id",
"=",
"&",
"tv",
"\n",
"case",
"MemoTypeMemoHash",
":",
"tv",
",",
"ok",
":=",
"value",
".",
"(",
"Hash",
")",
"\n",
"if",
"!",
"ok",
"{",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"invalid value, must be Hash\"",
")",
"\n",
"return",
"\n",
"}",
"\n",
"result",
".",
"Hash",
"=",
"&",
"tv",
"\n",
"case",
"MemoTypeMemoReturn",
":",
"tv",
",",
"ok",
":=",
"value",
".",
"(",
"Hash",
")",
"\n",
"if",
"!",
"ok",
"{",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"invalid value, must be Hash\"",
")",
"\n",
"return",
"\n",
"}",
"\n",
"result",
".",
"RetHash",
"=",
"&",
"tv",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
// NewMemo creates a new Memo.
|
[
"NewMemo",
"creates",
"a",
"new",
"Memo",
"."
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/xdr_generated.go#L2210-L2245
|
test
|
stellar/go-stellar-base
|
xdr/xdr_generated.go
|
MustText
|
func (u Memo) MustText() string {
val, ok := u.GetText()
if !ok {
panic("arm Text is not set")
}
return val
}
|
go
|
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",
"(",
")",
"\n",
"if",
"!",
"ok",
"{",
"panic",
"(",
"\"arm Text is not set\"",
")",
"\n",
"}",
"\n",
"return",
"val",
"\n",
"}"
] |
// 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",
"."
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/xdr_generated.go#L2249-L2257
|
test
|
stellar/go-stellar-base
|
xdr/xdr_generated.go
|
GetText
|
func (u Memo) GetText() (result string, ok bool) {
armName, _ := u.ArmForSwitch(int32(u.Type))
if armName == "Text" {
result = *u.Text
ok = true
}
return
}
|
go
|
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",
")",
")",
"\n",
"if",
"armName",
"==",
"\"Text\"",
"{",
"result",
"=",
"*",
"u",
".",
"Text",
"\n",
"ok",
"=",
"true",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
// 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",
"."
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/xdr_generated.go#L2261-L2270
|
test
|
stellar/go-stellar-base
|
xdr/xdr_generated.go
|
MustId
|
func (u Memo) MustId() Uint64 {
val, ok := u.GetId()
if !ok {
panic("arm Id is not set")
}
return val
}
|
go
|
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",
"(",
")",
"\n",
"if",
"!",
"ok",
"{",
"panic",
"(",
"\"arm Id is not set\"",
")",
"\n",
"}",
"\n",
"return",
"val",
"\n",
"}"
] |
// 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",
"."
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/xdr_generated.go#L2274-L2282
|
test
|
stellar/go-stellar-base
|
xdr/xdr_generated.go
|
GetId
|
func (u Memo) GetId() (result Uint64, ok bool) {
armName, _ := u.ArmForSwitch(int32(u.Type))
if armName == "Id" {
result = *u.Id
ok = true
}
return
}
|
go
|
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",
")",
")",
"\n",
"if",
"armName",
"==",
"\"Id\"",
"{",
"result",
"=",
"*",
"u",
".",
"Id",
"\n",
"ok",
"=",
"true",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
// 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",
"."
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/xdr_generated.go#L2286-L2295
|
test
|
stellar/go-stellar-base
|
xdr/xdr_generated.go
|
MustHash
|
func (u Memo) MustHash() Hash {
val, ok := u.GetHash()
if !ok {
panic("arm Hash is not set")
}
return val
}
|
go
|
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",
"(",
")",
"\n",
"if",
"!",
"ok",
"{",
"panic",
"(",
"\"arm Hash is not set\"",
")",
"\n",
"}",
"\n",
"return",
"val",
"\n",
"}"
] |
// 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",
"."
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/xdr_generated.go#L2299-L2307
|
test
|
stellar/go-stellar-base
|
xdr/xdr_generated.go
|
GetHash
|
func (u Memo) GetHash() (result Hash, ok bool) {
armName, _ := u.ArmForSwitch(int32(u.Type))
if armName == "Hash" {
result = *u.Hash
ok = true
}
return
}
|
go
|
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",
")",
")",
"\n",
"if",
"armName",
"==",
"\"Hash\"",
"{",
"result",
"=",
"*",
"u",
".",
"Hash",
"\n",
"ok",
"=",
"true",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
// 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",
"."
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/xdr_generated.go#L2311-L2320
|
test
|
stellar/go-stellar-base
|
xdr/xdr_generated.go
|
MustRetHash
|
func (u Memo) MustRetHash() Hash {
val, ok := u.GetRetHash()
if !ok {
panic("arm RetHash is not set")
}
return val
}
|
go
|
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",
"(",
")",
"\n",
"if",
"!",
"ok",
"{",
"panic",
"(",
"\"arm RetHash is not set\"",
")",
"\n",
"}",
"\n",
"return",
"val",
"\n",
"}"
] |
// 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",
"."
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/xdr_generated.go#L2324-L2332
|
test
|
stellar/go-stellar-base
|
xdr/xdr_generated.go
|
NewTransactionExt
|
func NewTransactionExt(v int32, value interface{}) (result TransactionExt, err error) {
result.V = v
switch int32(v) {
case 0:
// void
}
return
}
|
go
|
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",
"\n",
"switch",
"int32",
"(",
"v",
")",
"{",
"case",
"0",
":",
"}",
"\n",
"return",
"\n",
"}"
] |
// NewTransactionExt creates a new TransactionExt.
|
[
"NewTransactionExt",
"creates",
"a",
"new",
"TransactionExt",
"."
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/xdr_generated.go#L2389-L2396
|
test
|
stellar/go-stellar-base
|
xdr/xdr_generated.go
|
ValidEnum
|
func (e CreateAccountResultCode) ValidEnum(v int32) bool {
_, ok := createAccountResultCodeMap[v]
return ok
}
|
go
|
func (e CreateAccountResultCode) ValidEnum(v int32) bool {
_, ok := createAccountResultCodeMap[v]
return ok
}
|
[
"func",
"(",
"e",
"CreateAccountResultCode",
")",
"ValidEnum",
"(",
"v",
"int32",
")",
"bool",
"{",
"_",
",",
"ok",
":=",
"createAccountResultCodeMap",
"[",
"v",
"]",
"\n",
"return",
"ok",
"\n",
"}"
] |
// 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"
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/xdr_generated.go#L2511-L2514
|
test
|
stellar/go-stellar-base
|
xdr/xdr_generated.go
|
ArmForSwitch
|
func (u CreateAccountResult) ArmForSwitch(sw int32) (string, bool) {
switch CreateAccountResultCode(sw) {
case CreateAccountResultCodeCreateAccountSuccess:
return "", true
default:
return "", true
}
}
|
go
|
func (u CreateAccountResult) ArmForSwitch(sw int32) (string, bool) {
switch CreateAccountResultCode(sw) {
case CreateAccountResultCodeCreateAccountSuccess:
return "", true
default:
return "", true
}
}
|
[
"func",
"(",
"u",
"CreateAccountResult",
")",
"ArmForSwitch",
"(",
"sw",
"int32",
")",
"(",
"string",
",",
"bool",
")",
"{",
"switch",
"CreateAccountResultCode",
"(",
"sw",
")",
"{",
"case",
"CreateAccountResultCodeCreateAccountSuccess",
":",
"return",
"\"\"",
",",
"true",
"\n",
"default",
":",
"return",
"\"\"",
",",
"true",
"\n",
"}",
"\n",
"}"
] |
// 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"
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/xdr_generated.go#L2544-L2551
|
test
|
stellar/go-stellar-base
|
xdr/xdr_generated.go
|
NewCreateAccountResult
|
func NewCreateAccountResult(code CreateAccountResultCode, value interface{}) (result CreateAccountResult, err error) {
result.Code = code
switch CreateAccountResultCode(code) {
case CreateAccountResultCodeCreateAccountSuccess:
// void
default:
// void
}
return
}
|
go
|
func NewCreateAccountResult(code CreateAccountResultCode, value interface{}) (result CreateAccountResult, err error) {
result.Code = code
switch CreateAccountResultCode(code) {
case CreateAccountResultCodeCreateAccountSuccess:
// void
default:
// void
}
return
}
|
[
"func",
"NewCreateAccountResult",
"(",
"code",
"CreateAccountResultCode",
",",
"value",
"interface",
"{",
"}",
")",
"(",
"result",
"CreateAccountResult",
",",
"err",
"error",
")",
"{",
"result",
".",
"Code",
"=",
"code",
"\n",
"switch",
"CreateAccountResultCode",
"(",
"code",
")",
"{",
"case",
"CreateAccountResultCodeCreateAccountSuccess",
":",
"default",
":",
"}",
"\n",
"return",
"\n",
"}"
] |
// NewCreateAccountResult creates a new CreateAccountResult.
|
[
"NewCreateAccountResult",
"creates",
"a",
"new",
"CreateAccountResult",
"."
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/xdr_generated.go#L2554-L2563
|
test
|
stellar/go-stellar-base
|
xdr/xdr_generated.go
|
ValidEnum
|
func (e PaymentResultCode) ValidEnum(v int32) bool {
_, ok := paymentResultCodeMap[v]
return ok
}
|
go
|
func (e PaymentResultCode) ValidEnum(v int32) bool {
_, ok := paymentResultCodeMap[v]
return ok
}
|
[
"func",
"(",
"e",
"PaymentResultCode",
")",
"ValidEnum",
"(",
"v",
"int32",
")",
"bool",
"{",
"_",
",",
"ok",
":=",
"paymentResultCodeMap",
"[",
"v",
"]",
"\n",
"return",
"ok",
"\n",
"}"
] |
// 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"
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/xdr_generated.go#L2614-L2617
|
test
|
stellar/go-stellar-base
|
xdr/xdr_generated.go
|
ArmForSwitch
|
func (u PaymentResult) ArmForSwitch(sw int32) (string, bool) {
switch PaymentResultCode(sw) {
case PaymentResultCodePaymentSuccess:
return "", true
default:
return "", true
}
}
|
go
|
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",
"\n",
"default",
":",
"return",
"\"\"",
",",
"true",
"\n",
"}",
"\n",
"}"
] |
// 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"
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/xdr_generated.go#L2647-L2654
|
test
|
stellar/go-stellar-base
|
xdr/xdr_generated.go
|
NewPaymentResult
|
func NewPaymentResult(code PaymentResultCode, value interface{}) (result PaymentResult, err error) {
result.Code = code
switch PaymentResultCode(code) {
case PaymentResultCodePaymentSuccess:
// void
default:
// void
}
return
}
|
go
|
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",
"\n",
"switch",
"PaymentResultCode",
"(",
"code",
")",
"{",
"case",
"PaymentResultCodePaymentSuccess",
":",
"default",
":",
"}",
"\n",
"return",
"\n",
"}"
] |
// NewPaymentResult creates a new PaymentResult.
|
[
"NewPaymentResult",
"creates",
"a",
"new",
"PaymentResult",
"."
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/xdr_generated.go#L2657-L2666
|
test
|
stellar/go-stellar-base
|
xdr/xdr_generated.go
|
ValidEnum
|
func (e PathPaymentResultCode) ValidEnum(v int32) bool {
_, ok := pathPaymentResultCodeMap[v]
return ok
}
|
go
|
func (e PathPaymentResultCode) ValidEnum(v int32) bool {
_, ok := pathPaymentResultCodeMap[v]
return ok
}
|
[
"func",
"(",
"e",
"PathPaymentResultCode",
")",
"ValidEnum",
"(",
"v",
"int32",
")",
"bool",
"{",
"_",
",",
"ok",
":=",
"pathPaymentResultCodeMap",
"[",
"v",
"]",
"\n",
"return",
"ok",
"\n",
"}"
] |
// 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"
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/xdr_generated.go#L2726-L2729
|
test
|
stellar/go-stellar-base
|
xdr/xdr_generated.go
|
ArmForSwitch
|
func (u PathPaymentResult) ArmForSwitch(sw int32) (string, bool) {
switch PathPaymentResultCode(sw) {
case PathPaymentResultCodePathPaymentSuccess:
return "Success", true
case PathPaymentResultCodePathPaymentNoIssuer:
return "NoIssuer", true
default:
return "", true
}
}
|
go
|
func (u PathPaymentResult) ArmForSwitch(sw int32) (string, bool) {
switch PathPaymentResultCode(sw) {
case PathPaymentResultCodePathPaymentSuccess:
return "Success", true
case PathPaymentResultCodePathPaymentNoIssuer:
return "NoIssuer", true
default:
return "", true
}
}
|
[
"func",
"(",
"u",
"PathPaymentResult",
")",
"ArmForSwitch",
"(",
"sw",
"int32",
")",
"(",
"string",
",",
"bool",
")",
"{",
"switch",
"PathPaymentResultCode",
"(",
"sw",
")",
"{",
"case",
"PathPaymentResultCodePathPaymentSuccess",
":",
"return",
"\"Success\"",
",",
"true",
"\n",
"case",
"PathPaymentResultCodePathPaymentNoIssuer",
":",
"return",
"\"NoIssuer\"",
",",
"true",
"\n",
"default",
":",
"return",
"\"\"",
",",
"true",
"\n",
"}",
"\n",
"}"
] |
// 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"
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/xdr_generated.go#L2795-L2804
|
test
|
stellar/go-stellar-base
|
xdr/xdr_generated.go
|
NewPathPaymentResult
|
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
}
|
go
|
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
}
|
[
"func",
"NewPathPaymentResult",
"(",
"code",
"PathPaymentResultCode",
",",
"value",
"interface",
"{",
"}",
")",
"(",
"result",
"PathPaymentResult",
",",
"err",
"error",
")",
"{",
"result",
".",
"Code",
"=",
"code",
"\n",
"switch",
"PathPaymentResultCode",
"(",
"code",
")",
"{",
"case",
"PathPaymentResultCodePathPaymentSuccess",
":",
"tv",
",",
"ok",
":=",
"value",
".",
"(",
"PathPaymentResultSuccess",
")",
"\n",
"if",
"!",
"ok",
"{",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"invalid value, must be PathPaymentResultSuccess\"",
")",
"\n",
"return",
"\n",
"}",
"\n",
"result",
".",
"Success",
"=",
"&",
"tv",
"\n",
"case",
"PathPaymentResultCodePathPaymentNoIssuer",
":",
"tv",
",",
"ok",
":=",
"value",
".",
"(",
"Asset",
")",
"\n",
"if",
"!",
"ok",
"{",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"invalid value, must be Asset\"",
")",
"\n",
"return",
"\n",
"}",
"\n",
"result",
".",
"NoIssuer",
"=",
"&",
"tv",
"\n",
"default",
":",
"}",
"\n",
"return",
"\n",
"}"
] |
// NewPathPaymentResult creates a new PathPaymentResult.
|
[
"NewPathPaymentResult",
"creates",
"a",
"new",
"PathPaymentResult",
"."
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/xdr_generated.go#L2807-L2828
|
test
|
stellar/go-stellar-base
|
xdr/xdr_generated.go
|
MustNoIssuer
|
func (u PathPaymentResult) MustNoIssuer() Asset {
val, ok := u.GetNoIssuer()
if !ok {
panic("arm NoIssuer is not set")
}
return val
}
|
go
|
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",
"(",
")",
"\n",
"if",
"!",
"ok",
"{",
"panic",
"(",
"\"arm NoIssuer is not set\"",
")",
"\n",
"}",
"\n",
"return",
"val",
"\n",
"}"
] |
// 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",
"."
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/xdr_generated.go#L2857-L2865
|
test
|
stellar/go-stellar-base
|
xdr/xdr_generated.go
|
GetNoIssuer
|
func (u PathPaymentResult) GetNoIssuer() (result Asset, ok bool) {
armName, _ := u.ArmForSwitch(int32(u.Code))
if armName == "NoIssuer" {
result = *u.NoIssuer
ok = true
}
return
}
|
go
|
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",
")",
")",
"\n",
"if",
"armName",
"==",
"\"NoIssuer\"",
"{",
"result",
"=",
"*",
"u",
".",
"NoIssuer",
"\n",
"ok",
"=",
"true",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
// 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",
"."
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/xdr_generated.go#L2869-L2878
|
test
|
stellar/go-stellar-base
|
xdr/xdr_generated.go
|
ValidEnum
|
func (e ManageOfferResultCode) ValidEnum(v int32) bool {
_, ok := manageOfferResultCodeMap[v]
return ok
}
|
go
|
func (e ManageOfferResultCode) ValidEnum(v int32) bool {
_, ok := manageOfferResultCodeMap[v]
return ok
}
|
[
"func",
"(",
"e",
"ManageOfferResultCode",
")",
"ValidEnum",
"(",
"v",
"int32",
")",
"bool",
"{",
"_",
",",
"ok",
":=",
"manageOfferResultCodeMap",
"[",
"v",
"]",
"\n",
"return",
"ok",
"\n",
"}"
] |
// 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"
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/xdr_generated.go#L2941-L2944
|
test
|
stellar/go-stellar-base
|
xdr/xdr_generated.go
|
ValidEnum
|
func (e ManageOfferEffect) ValidEnum(v int32) bool {
_, ok := manageOfferEffectMap[v]
return ok
}
|
go
|
func (e ManageOfferEffect) ValidEnum(v int32) bool {
_, ok := manageOfferEffectMap[v]
return ok
}
|
[
"func",
"(",
"e",
"ManageOfferEffect",
")",
"ValidEnum",
"(",
"v",
"int32",
")",
"bool",
"{",
"_",
",",
"ok",
":=",
"manageOfferEffectMap",
"[",
"v",
"]",
"\n",
"return",
"ok",
"\n",
"}"
] |
// 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"
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/xdr_generated.go#L2977-L2980
|
test
|
stellar/go-stellar-base
|
xdr/xdr_generated.go
|
ArmForSwitch
|
func (u ManageOfferSuccessResultOffer) ArmForSwitch(sw int32) (string, bool) {
switch ManageOfferEffect(sw) {
case ManageOfferEffectManageOfferCreated:
return "Offer", true
case ManageOfferEffectManageOfferUpdated:
return "Offer", true
default:
return "", true
}
}
|
go
|
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",
"\"Offer\"",
",",
"true",
"\n",
"case",
"ManageOfferEffectManageOfferUpdated",
":",
"return",
"\"Offer\"",
",",
"true",
"\n",
"default",
":",
"return",
"\"\"",
",",
"true",
"\n",
"}",
"\n",
"}"
] |
// 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"
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/xdr_generated.go#L3012-L3021
|
test
|
stellar/go-stellar-base
|
xdr/xdr_generated.go
|
NewManageOfferSuccessResultOffer
|
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
}
|
go
|
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",
"\n",
"switch",
"ManageOfferEffect",
"(",
"effect",
")",
"{",
"case",
"ManageOfferEffectManageOfferCreated",
":",
"tv",
",",
"ok",
":=",
"value",
".",
"(",
"OfferEntry",
")",
"\n",
"if",
"!",
"ok",
"{",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"invalid value, must be OfferEntry\"",
")",
"\n",
"return",
"\n",
"}",
"\n",
"result",
".",
"Offer",
"=",
"&",
"tv",
"\n",
"case",
"ManageOfferEffectManageOfferUpdated",
":",
"tv",
",",
"ok",
":=",
"value",
".",
"(",
"OfferEntry",
")",
"\n",
"if",
"!",
"ok",
"{",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"invalid value, must be OfferEntry\"",
")",
"\n",
"return",
"\n",
"}",
"\n",
"result",
".",
"Offer",
"=",
"&",
"tv",
"\n",
"default",
":",
"}",
"\n",
"return",
"\n",
"}"
] |
// NewManageOfferSuccessResultOffer creates a new ManageOfferSuccessResultOffer.
|
[
"NewManageOfferSuccessResultOffer",
"creates",
"a",
"new",
"ManageOfferSuccessResultOffer",
"."
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/xdr_generated.go#L3024-L3045
|
test
|
stellar/go-stellar-base
|
xdr/xdr_generated.go
|
ArmForSwitch
|
func (u ManageOfferResult) ArmForSwitch(sw int32) (string, bool) {
switch ManageOfferResultCode(sw) {
case ManageOfferResultCodeManageOfferSuccess:
return "Success", true
default:
return "", true
}
}
|
go
|
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",
"\"Success\"",
",",
"true",
"\n",
"default",
":",
"return",
"\"\"",
",",
"true",
"\n",
"}",
"\n",
"}"
] |
// 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"
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/xdr_generated.go#L3118-L3125
|
test
|
stellar/go-stellar-base
|
xdr/xdr_generated.go
|
NewManageOfferResult
|
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
}
|
go
|
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",
"\n",
"switch",
"ManageOfferResultCode",
"(",
"code",
")",
"{",
"case",
"ManageOfferResultCodeManageOfferSuccess",
":",
"tv",
",",
"ok",
":=",
"value",
".",
"(",
"ManageOfferSuccessResult",
")",
"\n",
"if",
"!",
"ok",
"{",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"invalid value, must be ManageOfferSuccessResult\"",
")",
"\n",
"return",
"\n",
"}",
"\n",
"result",
".",
"Success",
"=",
"&",
"tv",
"\n",
"default",
":",
"}",
"\n",
"return",
"\n",
"}"
] |
// NewManageOfferResult creates a new ManageOfferResult.
|
[
"NewManageOfferResult",
"creates",
"a",
"new",
"ManageOfferResult",
"."
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/xdr_generated.go#L3128-L3142
|
test
|
stellar/go-stellar-base
|
xdr/xdr_generated.go
|
ValidEnum
|
func (e SetOptionsResultCode) ValidEnum(v int32) bool {
_, ok := setOptionsResultCodeMap[v]
return ok
}
|
go
|
func (e SetOptionsResultCode) ValidEnum(v int32) bool {
_, ok := setOptionsResultCodeMap[v]
return ok
}
|
[
"func",
"(",
"e",
"SetOptionsResultCode",
")",
"ValidEnum",
"(",
"v",
"int32",
")",
"bool",
"{",
"_",
",",
"ok",
":=",
"setOptionsResultCodeMap",
"[",
"v",
"]",
"\n",
"return",
"ok",
"\n",
"}"
] |
// 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"
] |
79c570612c0b461db178aa8949d9f13cafc2a7c9
|
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/xdr_generated.go#L3217-L3220
|
test
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.