import "github.com/stellar/go/xdr"
Package xdr contains the generated code for parsing the xdr structures used for stellar.
lint:file-ignore S1005 The issue should be fixed in xdrgen. Unfortunately, there's no way to ignore a single file in staticcheck. lint:file-ignore U1000 fmtTest is not needed anywhere, should be removed in xdrgen. Package xdr is generated from:
Stellar-SCP.x Stellar-ledger-entries.x Stellar-ledger.x Stellar-overlay.x Stellar-transaction.x Stellar-types.x
DO NOT EDIT or your changes may be overwritten
account_entry.go account_flags.go account_id.go account_thresholds.go allow_trust_op_asset.go asset.go claimable_balance_id.go claimant.go db.go go_string.go hash.go json.go ledger_close_meta.go ledger_entry.go ledger_entry_change.go ledger_key.go main.go memo.go muxed_account.go path_payment_result.go price.go signer_key.go signers.go string.go transaction_envelope.go transaction_meta.go transaction_result.go trust_line_entry.go trust_line_flags.go xdr_generated.go
const MaskAccountFlags = 0x7
MaskAccountFlags is an XDR Const defines as:
const MASK_ACCOUNT_FLAGS = 0x7;
const MaskOfferentryFlags = 1
MaskOfferentryFlags is an XDR Const defines as:
const MASK_OFFERENTRY_FLAGS = 1;
const MaskTrustlineFlags = 1
MaskTrustlineFlags is an XDR Const defines as:
const MASK_TRUSTLINE_FLAGS = 1;
const MaskTrustlineFlagsV13 = 3
MaskTrustlineFlagsV13 is an XDR Const defines as:
const MASK_TRUSTLINE_FLAGS_V13 = 3;
const MaxOpsPerTx = 100
MaxOpsPerTx is an XDR Const defines as:
const MAX_OPS_PER_TX = 100;
const MaxSigners = 20
MaxSigners is an XDR Const defines as:
const MAX_SIGNERS = 20;
var AssetTypeToString = map[AssetType]string{ AssetTypeAssetTypeNative: "native", AssetTypeAssetTypeCreditAlphanum4: "credit_alphanum4", AssetTypeAssetTypeCreditAlphanum12: "credit_alphanum12", }
AssetTypeToString maps an xdr.AssetType to its string representation
var StringToAssetType = map[string]AssetType{ "native": AssetTypeAssetTypeNative, "credit_alphanum4": AssetTypeAssetTypeCreditAlphanum4, "credit_alphanum12": AssetTypeAssetTypeCreditAlphanum12, }
StringToAssetType maps an strings to its xdr.AssetType representation
var ValidAssetCode = regexp.MustCompile("^[[:alnum:]]{1,12}$")
Marshal writes an xdr element `v` into `w`.
ReadFrameLength returns a length of a framed XDR object.
SafeUnmarshal decodes the provided reader into the destination and verifies that provided bytes are all consumed by the unmarshalling process.
SafeUnmarshalBase64 first decodes the provided reader from base64 before decoding the xdr into the provided destination. Also ensures that the reader is fully consumed.
SafeUnmarshalHex first decodes the provided reader from hex before decoding the xdr into the provided destination. Also ensures that the reader is fully consumed.
Unmarshal reads an xdr element from `r` into `v`.
ExampleUnmarshal shows the lowest-level process to decode a base64 envelope encoded in base64.
Code:
package main
import (
"encoding/base64"
"fmt"
"log"
"strings"
"testing"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/stretchr/testify/assert"
)
// ExampleUnmarshal shows the lowest-level process to decode a base64
// envelope encoded in base64.
func main() {
data := "AAAAAgAAAABi/B0L0JGythwN1lY0aypo19NHxvLCyO5tBEcCVvwF9wAAAAoAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAK6jei3jmoI8TGlD/egc37PXtHKKzWV8wViZBaCu5L5MAAAAADuaygAAAAAAAAAAAVb8BfcAAABACmeyD4/+Oj7llOmTrcjKLHLTQJF0TV/VggCOUZ30ZPgMsQy6A2T//Zdzb7MULVo/Y7kDrqAZRS51rvIp7YMUAA=="
rawr := strings.NewReader(data)
b64r := base64.NewDecoder(base64.StdEncoding, rawr)
var tx TransactionEnvelope
bytesRead, err := Unmarshal(b64r, &tx)
fmt.Printf("read %d bytes\n", bytesRead)
if err != nil {
log.Fatal(err)
}
operations := tx.Operations()
fmt.Printf("This tx has %d operations\n", len(operations))
}
func TestSafeUnmarshalHex(t *testing.T) {
accountID := MustAddress("GC3C4AKRBQLHOJ45U4XG35ESVWRDECWO5XLDGYADO6DPR3L7KIDVUMML")
hex, err := MarshalHex(accountID)
assert.NoError(t, err)
assert.Equal(t, "00000000b62e01510c1677279da72e6df492ada2320aceedd63360037786f8ed7f52075a", hex)
var parsed AccountId
err = SafeUnmarshalHex(hex, &parsed)
assert.NoError(t, err)
assert.True(t, accountID.Equals(parsed))
}
var _ = Describe("xdr.SafeUnmarshal", func() {
var (
result int32
data []byte
err error
)
JustBeforeEach(func() {
err = SafeUnmarshal(data, &result)
})
Context("input data is a single xdr value", func() {
BeforeEach(func() {
data = []byte{0x00, 0x00, 0x00, 0x01}
})
It("succeeds", func() {
Expect(err).To(BeNil())
})
It("decodes the data correctly", func() {
Expect(result).To(Equal(int32(1)))
})
})
Context("when the input data contains more than one encoded struct", func() {
BeforeEach(func() {
data = []byte{
0x00, 0x00, 0x00, 0x01,
0x00, 0x00, 0x00, 0x01,
}
})
It("errors", func() {
Expect(err).ToNot(BeNil())
})
})
})
var _ = Describe("xdr.SafeUnmarshalBase64", func() {
var (
result int32
data string
err error
)
JustBeforeEach(func() {
err = SafeUnmarshalBase64(data, &result)
})
Context("input data is a single xdr value", func() {
BeforeEach(func() {
data = "AAAAAQ=="
})
It("succeeds", func() {
Expect(err).To(BeNil())
})
It("decodes the data correctly", func() {
Expect(result).To(Equal(int32(1)))
})
})
Context("when the input data contains more than one encoded struct", func() {
BeforeEach(func() {
data = "AAAAAQAAAAI="
})
It("errors", func() {
Expect(err).ToNot(BeNil())
})
})
})
XDR and RPC define a (minimal) framing format which our metadata arrives in: a 4-byte big-endian length header that has the high bit set, followed by that length worth of XDR data. Decoding this involves just a little more work than xdr.Unmarshal.
type AccountEntry struct { AccountId AccountId Balance Int64 SeqNum SequenceNumber NumSubEntries Uint32 InflationDest *AccountId Flags Uint32 HomeDomain String32 Thresholds Thresholds Signers []Signer `xdrmaxsize:"20"` Ext AccountEntryExt }
AccountEntry is an XDR Struct defines as:
struct AccountEntry { AccountID accountID; // master public key for this account int64 balance; // in stroops SequenceNumber seqNum; // last sequence number used for this account uint32 numSubEntries; // number of sub-entries this account has // drives the reserve AccountID* inflationDest; // Account to vote for during inflation uint32 flags; // see AccountFlags string32 homeDomain; // can be used for reverse federation and memo lookup // fields used for signatures // thresholds stores unsigned bytes: [weight of master|low|medium|high] Thresholds thresholds; Signer signers<MAX_SIGNERS>; // possible signers for this account // reserved for future use union switch (int v) { case 0: void; case 1: AccountEntryExtensionV1 v1; } ext; };
func (account *AccountEntry) Liabilities() Liabilities
Liabilities returns AccountEntry's liabilities
func (s AccountEntry) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (account *AccountEntry) MasterKeyWeight() byte
func (account *AccountEntry) NumSponsored() Uint32
NumSponsored returns NumSponsored value for account.
func (account *AccountEntry) NumSponsoring() Uint32
NumSponsoring returns NumSponsoring value for account.
func (account *AccountEntry) SignerSponsoringIDs() []SponsorshipDescriptor
SignerSponsoringIDs returns SignerSponsoringIDs value for account. This will return a slice of nil values if V2 extension does not exist.
func (account *AccountEntry) SignerSummary() map[string]int32
func (account *AccountEntry) SponsorPerSigner() map[string]AccountId
SponsorPerSigner returns a mapping of signer to its sponsor
func (account *AccountEntry) ThresholdHigh() byte
func (account *AccountEntry) ThresholdLow() byte
func (account *AccountEntry) ThresholdMedium() byte
func (s *AccountEntry) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
type AccountEntryExt struct { V int32 V1 *AccountEntryExtensionV1 }
AccountEntryExt is an XDR NestedUnion defines as:
union switch (int v) { case 0: void; case 1: AccountEntryExtensionV1 v1; }
func NewAccountEntryExt(v int32, value interface{}) (result AccountEntryExt, err error)
NewAccountEntryExt creates a new AccountEntryExt.
func (u AccountEntryExt) ArmForSwitch(sw int32) (string, bool)
ArmForSwitch returns which field name should be used for storing the value for an instance of AccountEntryExt
func (u AccountEntryExt) GetV1() (result AccountEntryExtensionV1, ok bool)
GetV1 retrieves the V1 value from the union, returning ok if the union's switch indicated the value is valid.
func (s AccountEntryExt) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (u AccountEntryExt) MustV1() AccountEntryExtensionV1
MustV1 retrieves the V1 value from the union, panicing if the value is not set.
func (u AccountEntryExt) SwitchFieldName() string
SwitchFieldName returns the field name in which this union's discriminant is stored
func (s *AccountEntryExt) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
type AccountEntryExtensionV1 struct { Liabilities Liabilities Ext AccountEntryExtensionV1Ext }
AccountEntryExtensionV1 is an XDR Struct defines as:
struct AccountEntryExtensionV1 { Liabilities liabilities; union switch (int v) { case 0: void; case 2: AccountEntryExtensionV2 v2; } ext; };
func (s AccountEntryExtensionV1) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (s *AccountEntryExtensionV1) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
type AccountEntryExtensionV1Ext struct { V int32 V2 *AccountEntryExtensionV2 }
AccountEntryExtensionV1Ext is an XDR NestedUnion defines as:
union switch (int v) { case 0: void; case 2: AccountEntryExtensionV2 v2; }
func NewAccountEntryExtensionV1Ext(v int32, value interface{}) (result AccountEntryExtensionV1Ext, err error)
NewAccountEntryExtensionV1Ext creates a new AccountEntryExtensionV1Ext.
func (u AccountEntryExtensionV1Ext) ArmForSwitch(sw int32) (string, bool)
ArmForSwitch returns which field name should be used for storing the value for an instance of AccountEntryExtensionV1Ext
func (u AccountEntryExtensionV1Ext) GetV2() (result AccountEntryExtensionV2, ok bool)
GetV2 retrieves the V2 value from the union, returning ok if the union's switch indicated the value is valid.
func (s AccountEntryExtensionV1Ext) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (u AccountEntryExtensionV1Ext) MustV2() AccountEntryExtensionV2
MustV2 retrieves the V2 value from the union, panicing if the value is not set.
func (u AccountEntryExtensionV1Ext) SwitchFieldName() string
SwitchFieldName returns the field name in which this union's discriminant is stored
func (s *AccountEntryExtensionV1Ext) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
type AccountEntryExtensionV2 struct { NumSponsored Uint32 NumSponsoring Uint32 SignerSponsoringIDs []SponsorshipDescriptor `xdrmaxsize:"20"` Ext AccountEntryExtensionV2Ext }
AccountEntryExtensionV2 is an XDR Struct defines as:
struct AccountEntryExtensionV2 { uint32 numSponsored; uint32 numSponsoring; SponsorshipDescriptor signerSponsoringIDs<MAX_SIGNERS>; union switch (int v) { case 0: void; } ext; };
func (s AccountEntryExtensionV2) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (s *AccountEntryExtensionV2) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
AccountEntryExtensionV2Ext is an XDR NestedUnion defines as:
union switch (int v) { case 0: void; }
func NewAccountEntryExtensionV2Ext(v int32, value interface{}) (result AccountEntryExtensionV2Ext, err error)
NewAccountEntryExtensionV2Ext creates a new AccountEntryExtensionV2Ext.
func (u AccountEntryExtensionV2Ext) ArmForSwitch(sw int32) (string, bool)
ArmForSwitch returns which field name should be used for storing the value for an instance of AccountEntryExtensionV2Ext
func (s AccountEntryExtensionV2Ext) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (u AccountEntryExtensionV2Ext) SwitchFieldName() string
SwitchFieldName returns the field name in which this union's discriminant is stored
func (s *AccountEntryExtensionV2Ext) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
AccountFlags is an XDR Enum defines as:
enum AccountFlags { // masks for each flag // Flags set on issuer accounts // TrustLines are created with authorized set to "false" requiring // the issuer to set it for each TrustLine AUTH_REQUIRED_FLAG = 0x1, // If set, the authorized flag in TrustLines can be cleared // otherwise, authorization cannot be revoked AUTH_REVOCABLE_FLAG = 0x2, // Once set, causes all AUTH_* flags to be read-only AUTH_IMMUTABLE_FLAG = 0x4 };
const ( AccountFlagsAuthRequiredFlag AccountFlags = 1 AccountFlagsAuthRevocableFlag AccountFlags = 2 AccountFlagsAuthImmutableFlag AccountFlags = 4 )
func (accountFlags AccountFlags) IsAuthImmutable() bool
IsAuthImmutable returns true if the account has the "AUTH_IMMUTABLE" option turned on.
func (accountFlags AccountFlags) IsAuthRequired() bool
IsAuthRequired returns true if the account has the "AUTH_REQUIRED" option turned on.
func (accountFlags AccountFlags) IsAuthRevocable() bool
IsAuthRevocable returns true if the account has the "AUTH_REVOCABLE" option turned on.
func (s AccountFlags) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (t *AccountFlags) Scan(src interface{}) error
Scan reads from src into an AccountFlags
func (e AccountFlags) String() string
String returns the name of `e`
func (s *AccountFlags) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
func (e AccountFlags) ValidEnum(v int32) bool
ValidEnum validates a proposed value for this enum. Implements the Enum interface for AccountFlags
AccountId is an XDR Typedef defines as:
typedef PublicKey AccountID;
AddressToAccountId returns an AccountId for a given address string. If the address is not valid the error returned will not be nil
func NewAccountId(aType PublicKeyType, value interface{}) (result AccountId, err error)
NewAccountId creates a new AccountId.
Address returns the strkey encoded form of this AccountId. This method will panic if the accountid is backed by a public key of an unknown type.
ArmForSwitch returns which field name should be used for storing the value for an instance of PublicKey
Equals returns true if `other` is equivalent to `aid`
GetAddress returns the strkey encoded form of this AccountId, and an error if the AccountId is backed by a public key of an unknown type.
GetEd25519 retrieves the Ed25519 value from the union, returning ok if the union's switch indicated the value is valid.
GoString implements fmt.GoStringer.
LedgerKey implements the `Keyer` interface
MarshalBinary implements encoding.BinaryMarshaler.
MarshalBinaryCompress marshals AccountId to []byte but unlike MarshalBinary() it removes all unnecessary bytes, exploting the fact that XDR is padding data to 4 bytes in union discriminants etc. It's primary use is in ingest/io.StateReader that keep LedgerKeys in memory so this function decrease memory requirements.
Warning, do not use UnmarshalBinary() on data encoded using this method!
MustEd25519 retrieves the Ed25519 value from the union, panicing if the value is not set.
SetAddress modifies the receiver, setting it's value to the AccountId form of the provided address.
SwitchFieldName returns the field name in which this union's discriminant is stored
func (aid *AccountId) ToMuxedAccount() MuxedAccount
ToMuxedAccount transforms an AccountId into a MuxedAccount with a zero memo id
UnmarshalBinary implements encoding.BinaryUnmarshaler.
type AccountMergeResult struct { Code AccountMergeResultCode SourceAccountBalance *Int64 }
AccountMergeResult is an XDR Union defines as:
union AccountMergeResult switch (AccountMergeResultCode code) { case ACCOUNT_MERGE_SUCCESS: int64 sourceAccountBalance; // how much got transfered from source account default: void; };
func NewAccountMergeResult(code AccountMergeResultCode, value interface{}) (result AccountMergeResult, err error)
NewAccountMergeResult creates a new AccountMergeResult.
func (u AccountMergeResult) ArmForSwitch(sw int32) (string, bool)
ArmForSwitch returns which field name should be used for storing the value for an instance of AccountMergeResult
func (u AccountMergeResult) GetSourceAccountBalance() (result Int64, ok bool)
GetSourceAccountBalance retrieves the SourceAccountBalance value from the union, returning ok if the union's switch indicated the value is valid.
func (s AccountMergeResult) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (u AccountMergeResult) MustSourceAccountBalance() Int64
MustSourceAccountBalance retrieves the SourceAccountBalance value from the union, panicing if the value is not set.
func (u AccountMergeResult) SwitchFieldName() string
SwitchFieldName returns the field name in which this union's discriminant is stored
func (s *AccountMergeResult) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
AccountMergeResultCode is an XDR Enum defines as:
enum AccountMergeResultCode { // codes considered as "success" for the operation ACCOUNT_MERGE_SUCCESS = 0, // codes considered as "failure" for the operation ACCOUNT_MERGE_MALFORMED = -1, // can't merge onto itself ACCOUNT_MERGE_NO_ACCOUNT = -2, // destination does not exist ACCOUNT_MERGE_IMMUTABLE_SET = -3, // source account has AUTH_IMMUTABLE set ACCOUNT_MERGE_HAS_SUB_ENTRIES = -4, // account has trust lines/offers ACCOUNT_MERGE_SEQNUM_TOO_FAR = -5, // sequence number is over max allowed ACCOUNT_MERGE_DEST_FULL = -6, // can't add source balance to // destination balance ACCOUNT_MERGE_IS_SPONSOR = -7 // can't merge account that is a sponsor };
const ( AccountMergeResultCodeAccountMergeSuccess AccountMergeResultCode = 0 AccountMergeResultCodeAccountMergeMalformed AccountMergeResultCode = -1 AccountMergeResultCodeAccountMergeNoAccount AccountMergeResultCode = -2 AccountMergeResultCodeAccountMergeImmutableSet AccountMergeResultCode = -3 AccountMergeResultCodeAccountMergeHasSubEntries AccountMergeResultCode = -4 AccountMergeResultCodeAccountMergeSeqnumTooFar AccountMergeResultCode = -5 AccountMergeResultCodeAccountMergeDestFull AccountMergeResultCode = -6 AccountMergeResultCodeAccountMergeIsSponsor AccountMergeResultCode = -7 )
func (s AccountMergeResultCode) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (e AccountMergeResultCode) String() string
String returns the name of `e`
func (s *AccountMergeResultCode) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
func (e AccountMergeResultCode) ValidEnum(v int32) bool
ValidEnum validates a proposed value for this enum. Implements the Enum interface for AccountMergeResultCode
type AllowTrustOp struct { Trustor AccountId Asset AllowTrustOpAsset Authorize Uint32 }
AllowTrustOp is an XDR Struct defines as:
struct AllowTrustOp { AccountID trustor; union switch (AssetType type) { // ASSET_TYPE_NATIVE is not allowed case ASSET_TYPE_CREDIT_ALPHANUM4: AssetCode4 assetCode4; case ASSET_TYPE_CREDIT_ALPHANUM12: AssetCode12 assetCode12; // add other asset types here in the future } asset; // 0, or any bitwise combination of TrustLineFlags uint32 authorize; };
func (s AllowTrustOp) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (s *AllowTrustOp) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
type AllowTrustOpAsset struct { Type AssetType AssetCode4 *AssetCode4 AssetCode12 *AssetCode12 }
AllowTrustOpAsset is an XDR NestedUnion defines as:
union switch (AssetType type) { // ASSET_TYPE_NATIVE is not allowed case ASSET_TYPE_CREDIT_ALPHANUM4: AssetCode4 assetCode4; case ASSET_TYPE_CREDIT_ALPHANUM12: AssetCode12 assetCode12; // add other asset types here in the future }
func MustNewAllowTrustAsset(code string) AllowTrustOpAsset
MustNewAllowTrustAsset returns a new allow trust asset, panicking if it can't.
func NewAllowTrustAsset(code string) (AllowTrustOpAsset, error)
NewAllowTrustAsset returns a new allow trust asset, panicking if it can't.
func NewAllowTrustOpAsset(aType AssetType, value interface{}) (result AllowTrustOpAsset, err error)
NewAllowTrustOpAsset creates a new AllowTrustOpAsset.
func (u AllowTrustOpAsset) ArmForSwitch(sw int32) (string, bool)
ArmForSwitch returns which field name should be used for storing the value for an instance of AllowTrustOpAsset
func (u AllowTrustOpAsset) GetAssetCode12() (result AssetCode12, ok bool)
GetAssetCode12 retrieves the AssetCode12 value from the union, returning ok if the union's switch indicated the value is valid.
func (u AllowTrustOpAsset) GetAssetCode4() (result AssetCode4, ok bool)
GetAssetCode4 retrieves the AssetCode4 value from the union, returning ok if the union's switch indicated the value is valid.
func (s AllowTrustOpAsset) GoString() string
GoString implements fmt.GoStringer.
func (s AllowTrustOpAsset) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (u AllowTrustOpAsset) MustAssetCode12() AssetCode12
MustAssetCode12 retrieves the AssetCode12 value from the union, panicing if the value is not set.
func (u AllowTrustOpAsset) MustAssetCode4() AssetCode4
MustAssetCode4 retrieves the AssetCode4 value from the union, panicing if the value is not set.
func (u AllowTrustOpAsset) SwitchFieldName() string
SwitchFieldName returns the field name in which this union's discriminant is stored
func (a AllowTrustOpAsset) ToAsset(issuer AccountId) (asset Asset)
ToAsset for AllowTrustOpAsset converts the xdr.AllowTrustOpAsset to a standard xdr.Asset.
func (s *AllowTrustOpAsset) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
type AllowTrustResult struct { Code AllowTrustResultCode }
AllowTrustResult is an XDR Union defines as:
union AllowTrustResult switch (AllowTrustResultCode code) { case ALLOW_TRUST_SUCCESS: void; default: void; };
func NewAllowTrustResult(code AllowTrustResultCode, value interface{}) (result AllowTrustResult, err error)
NewAllowTrustResult creates a new AllowTrustResult.
func (u AllowTrustResult) ArmForSwitch(sw int32) (string, bool)
ArmForSwitch returns which field name should be used for storing the value for an instance of AllowTrustResult
func (s AllowTrustResult) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (u AllowTrustResult) SwitchFieldName() string
SwitchFieldName returns the field name in which this union's discriminant is stored
func (s *AllowTrustResult) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
AllowTrustResultCode is an XDR Enum defines as:
enum AllowTrustResultCode { // codes considered as "success" for the operation ALLOW_TRUST_SUCCESS = 0, // codes considered as "failure" for the operation ALLOW_TRUST_MALFORMED = -1, // asset is not ASSET_TYPE_ALPHANUM ALLOW_TRUST_NO_TRUST_LINE = -2, // trustor does not have a trustline // source account does not require trust ALLOW_TRUST_TRUST_NOT_REQUIRED = -3, ALLOW_TRUST_CANT_REVOKE = -4, // source account can't revoke trust, ALLOW_TRUST_SELF_NOT_ALLOWED = -5 // trusting self is not allowed };
const ( AllowTrustResultCodeAllowTrustSuccess AllowTrustResultCode = 0 AllowTrustResultCodeAllowTrustMalformed AllowTrustResultCode = -1 AllowTrustResultCodeAllowTrustNoTrustLine AllowTrustResultCode = -2 AllowTrustResultCodeAllowTrustTrustNotRequired AllowTrustResultCode = -3 AllowTrustResultCodeAllowTrustCantRevoke AllowTrustResultCode = -4 AllowTrustResultCodeAllowTrustSelfNotAllowed AllowTrustResultCode = -5 )
func (s AllowTrustResultCode) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (e AllowTrustResultCode) String() string
String returns the name of `e`
func (s *AllowTrustResultCode) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
func (e AllowTrustResultCode) ValidEnum(v int32) bool
ValidEnum validates a proposed value for this enum. Implements the Enum interface for AllowTrustResultCode
type Asset struct { Type AssetType AlphaNum4 *AssetAlphaNum4 AlphaNum12 *AssetAlphaNum12 }
Asset is an XDR Union defines as:
union Asset switch (AssetType type) { case ASSET_TYPE_NATIVE: // Not credit void; case ASSET_TYPE_CREDIT_ALPHANUM4: struct { AssetCode4 assetCode; AccountID issuer; } alphaNum4; case ASSET_TYPE_CREDIT_ALPHANUM12: struct { AssetCode12 assetCode; AccountID issuer; } alphaNum12; // add other asset types here in the future };
BuildAsset creates a new asset from a given `assetType`, `code`, and `issuer`.
Valid assetTypes are:
- `native` - `credit_alphanum4` - `credit_alphanum12`
BuildAssets parses a list of assets from a given string. The string is expected to be a comma separated list of assets encoded in the format (Code:Issuer or "native") defined by SEP-0011 https://github.com/stellar/stellar-protocol/pull/313 If the string is empty, BuildAssets will return an empty list of assets
MustNewCreditAsset returns a new general asset, panicking if it can't.
MustNewNativeAsset returns a new native asset, panicking if it can't.
NewAsset creates a new Asset.
NewCreditAsset returns a new general asset, returning an error if it can't.
ArmForSwitch returns which field name should be used for storing the value for an instance of Asset
Equals returns true if `other` is equivalent to `a`
Extract is a helper function to extract information from an xdr.Asset structure. It extracts the asset's type to the `typ` input parameter (which must be either a *string or *xdr.AssetType). It also extracts the asset's code and issuer to `code` and `issuer` respectively if they are of type *string and the asset is non-native
func (u Asset) GetAlphaNum12() (result AssetAlphaNum12, ok bool)
GetAlphaNum12 retrieves the AlphaNum12 value from the union, returning ok if the union's switch indicated the value is valid.
func (u Asset) GetAlphaNum4() (result AssetAlphaNum4, ok bool)
GetAlphaNum4 retrieves the AlphaNum4 value from the union, returning ok if the union's switch indicated the value is valid.
GoString implements fmt.GoStringer.
MarshalBinary implements encoding.BinaryMarshaler.
MarshalBinaryCompress marshals Asset to []byte but unlike MarshalBinary() it removes all unnecessary bytes, exploting the fact that XDR is padding data to 4 bytes in union discriminants etc. It's primary use is in ingest/io.StateReader that keep LedgerKeys in memory so this function decrease memory requirements.
Warning, do not use UnmarshalBinary() on data encoded using this method!
func (u Asset) MustAlphaNum12() AssetAlphaNum12
MustAlphaNum12 retrieves the AlphaNum12 value from the union, panicing if the value is not set.
func (u Asset) MustAlphaNum4() AssetAlphaNum4
MustAlphaNum4 retrieves the AlphaNum4 value from the union, panicing if the value is not set.
MustExtract behaves as Extract, but panics if an error occurs.
Scan reads from src into an Asset
SetCredit overwrites `a` with a credit asset using `code` and `issuer`. The asset type (CreditAlphanum4 or CreditAlphanum12) is chosen automatically based upon the length of `code`.
SetNative overwrites `a` with the native asset type
String returns a display friendly form of the asset
StringCanonical returns a display friendly form of the asset following its canonical representation
SwitchFieldName returns the field name in which this union's discriminant is stored
func (a *Asset) ToAllowTrustOpAsset(code string) (AllowTrustOpAsset, error)
ToAllowTrustOpAsset for Asset converts the Asset to a corresponding XDR "allow trust" asset, used by the XDR allow trust operation.
UnmarshalBinary implements encoding.BinaryUnmarshaler.
Value implements the database/sql/driver Valuer interface.
type AssetAlphaNum12 struct { AssetCode AssetCode12 Issuer AccountId }
AssetAlphaNum12 is an XDR NestedStruct defines as:
struct { AssetCode12 assetCode; AccountID issuer; }
func (s AssetAlphaNum12) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (s *AssetAlphaNum12) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
type AssetAlphaNum4 struct { AssetCode AssetCode4 Issuer AccountId }
AssetAlphaNum4 is an XDR NestedStruct defines as:
struct { AssetCode4 assetCode; AccountID issuer; }
func (s AssetAlphaNum4) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (s *AssetAlphaNum4) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
AssetCode12 is an XDR Typedef defines as:
typedef opaque AssetCode12[12];
func (s AssetCode12) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (s *AssetCode12) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
func (e AssetCode12) XDRMaxSize() int
XDRMaxSize implements the Sized interface for AssetCode12
AssetCode4 is an XDR Typedef defines as:
typedef opaque AssetCode4[4];
func (s AssetCode4) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (s *AssetCode4) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
func (e AssetCode4) XDRMaxSize() int
XDRMaxSize implements the Sized interface for AssetCode4
AssetType is an XDR Enum defines as:
enum AssetType { ASSET_TYPE_NATIVE = 0, ASSET_TYPE_CREDIT_ALPHANUM4 = 1, ASSET_TYPE_CREDIT_ALPHANUM12 = 2 };
const ( AssetTypeAssetTypeNative AssetType = 0 AssetTypeAssetTypeCreditAlphanum4 AssetType = 1 AssetTypeAssetTypeCreditAlphanum12 AssetType = 2 )
MarshalBinary implements encoding.BinaryMarshaler.
Scan reads from src into an AssetType
String returns the name of `e`
UnmarshalBinary implements encoding.BinaryUnmarshaler.
ValidEnum validates a proposed value for this enum. Implements the Enum interface for AssetType
Auth is an XDR Struct defines as:
struct Auth { // Empty message, just to confirm // establishment of MAC keys. int unused; };
MarshalBinary implements encoding.BinaryMarshaler.
UnmarshalBinary implements encoding.BinaryUnmarshaler.
type AuthCert struct { Pubkey Curve25519Public Expiration Uint64 Sig Signature }
AuthCert is an XDR Struct defines as:
struct AuthCert { Curve25519Public pubkey; uint64 expiration; Signature sig; };
MarshalBinary implements encoding.BinaryMarshaler.
UnmarshalBinary implements encoding.BinaryUnmarshaler.
type AuthenticatedMessage struct { V Uint32 V0 *AuthenticatedMessageV0 }
AuthenticatedMessage is an XDR Union defines as:
union AuthenticatedMessage switch (uint32 v) { case 0: struct { uint64 sequence; StellarMessage message; HmacSha256Mac mac; } v0; };
func NewAuthenticatedMessage(v Uint32, value interface{}) (result AuthenticatedMessage, err error)
NewAuthenticatedMessage creates a new AuthenticatedMessage.
func (u AuthenticatedMessage) ArmForSwitch(sw int32) (string, bool)
ArmForSwitch returns which field name should be used for storing the value for an instance of AuthenticatedMessage
func (u AuthenticatedMessage) GetV0() (result AuthenticatedMessageV0, ok bool)
GetV0 retrieves the V0 value from the union, returning ok if the union's switch indicated the value is valid.
func (s AuthenticatedMessage) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (u AuthenticatedMessage) MustV0() AuthenticatedMessageV0
MustV0 retrieves the V0 value from the union, panicing if the value is not set.
func (u AuthenticatedMessage) SwitchFieldName() string
SwitchFieldName returns the field name in which this union's discriminant is stored
func (s *AuthenticatedMessage) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
type AuthenticatedMessageV0 struct { Sequence Uint64 Message StellarMessage Mac HmacSha256Mac }
AuthenticatedMessageV0 is an XDR NestedStruct defines as:
struct { uint64 sequence; StellarMessage message; HmacSha256Mac mac; }
func (s AuthenticatedMessageV0) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (s *AuthenticatedMessageV0) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
BeginSponsoringFutureReservesOp is an XDR Struct defines as:
struct BeginSponsoringFutureReservesOp { AccountID sponsoredID; };
func (s BeginSponsoringFutureReservesOp) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (s *BeginSponsoringFutureReservesOp) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
type BeginSponsoringFutureReservesResult struct { Code BeginSponsoringFutureReservesResultCode }
BeginSponsoringFutureReservesResult is an XDR Union defines as:
union BeginSponsoringFutureReservesResult switch (BeginSponsoringFutureReservesResultCode code) { case BEGIN_SPONSORING_FUTURE_RESERVES_SUCCESS: void; default: void; };
func NewBeginSponsoringFutureReservesResult(code BeginSponsoringFutureReservesResultCode, value interface{}) (result BeginSponsoringFutureReservesResult, err error)
NewBeginSponsoringFutureReservesResult creates a new BeginSponsoringFutureReservesResult.
func (u BeginSponsoringFutureReservesResult) ArmForSwitch(sw int32) (string, bool)
ArmForSwitch returns which field name should be used for storing the value for an instance of BeginSponsoringFutureReservesResult
func (s BeginSponsoringFutureReservesResult) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (u BeginSponsoringFutureReservesResult) SwitchFieldName() string
SwitchFieldName returns the field name in which this union's discriminant is stored
func (s *BeginSponsoringFutureReservesResult) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
BeginSponsoringFutureReservesResultCode is an XDR Enum defines as:
enum BeginSponsoringFutureReservesResultCode { // codes considered as "success" for the operation BEGIN_SPONSORING_FUTURE_RESERVES_SUCCESS = 0, // codes considered as "failure" for the operation BEGIN_SPONSORING_FUTURE_RESERVES_MALFORMED = -1, BEGIN_SPONSORING_FUTURE_RESERVES_ALREADY_SPONSORED = -2, BEGIN_SPONSORING_FUTURE_RESERVES_RECURSIVE = -3 };
const ( BeginSponsoringFutureReservesResultCodeBeginSponsoringFutureReservesSuccess BeginSponsoringFutureReservesResultCode = 0 BeginSponsoringFutureReservesResultCodeBeginSponsoringFutureReservesMalformed BeginSponsoringFutureReservesResultCode = -1 BeginSponsoringFutureReservesResultCodeBeginSponsoringFutureReservesAlreadySponsored BeginSponsoringFutureReservesResultCode = -2 BeginSponsoringFutureReservesResultCodeBeginSponsoringFutureReservesRecursive BeginSponsoringFutureReservesResultCode = -3 )
func (s BeginSponsoringFutureReservesResultCode) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (e BeginSponsoringFutureReservesResultCode) String() string
String returns the name of `e`
func (s *BeginSponsoringFutureReservesResultCode) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
func (e BeginSponsoringFutureReservesResultCode) ValidEnum(v int32) bool
ValidEnum validates a proposed value for this enum. Implements the Enum interface for BeginSponsoringFutureReservesResultCode
type BucketEntry struct { Type BucketEntryType LiveEntry *LedgerEntry DeadEntry *LedgerKey MetaEntry *BucketMetadata }
BucketEntry is an XDR Union defines as:
union BucketEntry switch (BucketEntryType type) { case LIVEENTRY: case INITENTRY: LedgerEntry liveEntry; case DEADENTRY: LedgerKey deadEntry; case METAENTRY: BucketMetadata metaEntry; };
func NewBucketEntry(aType BucketEntryType, value interface{}) (result BucketEntry, err error)
NewBucketEntry creates a new BucketEntry.
func (u BucketEntry) ArmForSwitch(sw int32) (string, bool)
ArmForSwitch returns which field name should be used for storing the value for an instance of BucketEntry
func (u BucketEntry) GetDeadEntry() (result LedgerKey, ok bool)
GetDeadEntry retrieves the DeadEntry value from the union, returning ok if the union's switch indicated the value is valid.
func (u BucketEntry) GetLiveEntry() (result LedgerEntry, ok bool)
GetLiveEntry retrieves the LiveEntry value from the union, returning ok if the union's switch indicated the value is valid.
func (u BucketEntry) GetMetaEntry() (result BucketMetadata, ok bool)
GetMetaEntry retrieves the MetaEntry value from the union, returning ok if the union's switch indicated the value is valid.
func (s BucketEntry) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (u BucketEntry) MustDeadEntry() LedgerKey
MustDeadEntry retrieves the DeadEntry value from the union, panicing if the value is not set.
func (u BucketEntry) MustLiveEntry() LedgerEntry
MustLiveEntry retrieves the LiveEntry value from the union, panicing if the value is not set.
func (u BucketEntry) MustMetaEntry() BucketMetadata
MustMetaEntry retrieves the MetaEntry value from the union, panicing if the value is not set.
func (u BucketEntry) SwitchFieldName() string
SwitchFieldName returns the field name in which this union's discriminant is stored
func (s *BucketEntry) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
BucketEntryType is an XDR Enum defines as:
enum BucketEntryType { METAENTRY = -1, // At-and-after protocol 11: bucket metadata, should come first. LIVEENTRY = 0, // Before protocol 11: created-or-updated; // At-and-after protocol 11: only updated. DEADENTRY = 1, INITENTRY = 2 // At-and-after protocol 11: only created. };
const ( BucketEntryTypeMetaentry BucketEntryType = -1 BucketEntryTypeLiveentry BucketEntryType = 0 BucketEntryTypeDeadentry BucketEntryType = 1 BucketEntryTypeInitentry BucketEntryType = 2 )
func (s BucketEntryType) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (e BucketEntryType) String() string
String returns the name of `e`
func (s *BucketEntryType) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
func (e BucketEntryType) ValidEnum(v int32) bool
ValidEnum validates a proposed value for this enum. Implements the Enum interface for BucketEntryType
type BucketMetadata struct { LedgerVersion Uint32 Ext BucketMetadataExt }
BucketMetadata is an XDR Struct defines as:
struct BucketMetadata { // Indicates the protocol version used to create / merge this bucket. uint32 ledgerVersion; // reserved for future use union switch (int v) { case 0: void; } ext; };
func (s BucketMetadata) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (s *BucketMetadata) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
BucketMetadataExt is an XDR NestedUnion defines as:
union switch (int v) { case 0: void; }
func NewBucketMetadataExt(v int32, value interface{}) (result BucketMetadataExt, err error)
NewBucketMetadataExt creates a new BucketMetadataExt.
func (u BucketMetadataExt) ArmForSwitch(sw int32) (string, bool)
ArmForSwitch returns which field name should be used for storing the value for an instance of BucketMetadataExt
func (s BucketMetadataExt) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (u BucketMetadataExt) SwitchFieldName() string
SwitchFieldName returns the field name in which this union's discriminant is stored
func (s *BucketMetadataExt) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
type BumpSequenceOp struct { BumpTo SequenceNumber }
BumpSequenceOp is an XDR Struct defines as:
struct BumpSequenceOp { SequenceNumber bumpTo; };
func (s BumpSequenceOp) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (s *BumpSequenceOp) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
type BumpSequenceResult struct { Code BumpSequenceResultCode }
BumpSequenceResult is an XDR Union defines as:
union BumpSequenceResult switch (BumpSequenceResultCode code) { case BUMP_SEQUENCE_SUCCESS: void; default: void; };
func NewBumpSequenceResult(code BumpSequenceResultCode, value interface{}) (result BumpSequenceResult, err error)
NewBumpSequenceResult creates a new BumpSequenceResult.
func (u BumpSequenceResult) ArmForSwitch(sw int32) (string, bool)
ArmForSwitch returns which field name should be used for storing the value for an instance of BumpSequenceResult
func (s BumpSequenceResult) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (u BumpSequenceResult) SwitchFieldName() string
SwitchFieldName returns the field name in which this union's discriminant is stored
func (s *BumpSequenceResult) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
BumpSequenceResultCode is an XDR Enum defines as:
enum BumpSequenceResultCode { // codes considered as "success" for the operation BUMP_SEQUENCE_SUCCESS = 0, // codes considered as "failure" for the operation BUMP_SEQUENCE_BAD_SEQ = -1 // `bumpTo` is not within bounds };
const ( BumpSequenceResultCodeBumpSequenceSuccess BumpSequenceResultCode = 0 BumpSequenceResultCodeBumpSequenceBadSeq BumpSequenceResultCode = -1 )
func (s BumpSequenceResultCode) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (e BumpSequenceResultCode) String() string
String returns the name of `e`
func (s *BumpSequenceResultCode) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
func (e BumpSequenceResultCode) ValidEnum(v int32) bool
ValidEnum validates a proposed value for this enum. Implements the Enum interface for BumpSequenceResultCode
ChangeTrustOp is an XDR Struct defines as:
struct ChangeTrustOp { Asset line; // if limit is set to 0, deletes the trust line int64 limit; };
func (s ChangeTrustOp) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (s *ChangeTrustOp) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
type ChangeTrustResult struct { Code ChangeTrustResultCode }
ChangeTrustResult is an XDR Union defines as:
union ChangeTrustResult switch (ChangeTrustResultCode code) { case CHANGE_TRUST_SUCCESS: void; default: void; };
func NewChangeTrustResult(code ChangeTrustResultCode, value interface{}) (result ChangeTrustResult, err error)
NewChangeTrustResult creates a new ChangeTrustResult.
func (u ChangeTrustResult) ArmForSwitch(sw int32) (string, bool)
ArmForSwitch returns which field name should be used for storing the value for an instance of ChangeTrustResult
func (s ChangeTrustResult) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (u ChangeTrustResult) SwitchFieldName() string
SwitchFieldName returns the field name in which this union's discriminant is stored
func (s *ChangeTrustResult) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
ChangeTrustResultCode is an XDR Enum defines as:
enum ChangeTrustResultCode { // codes considered as "success" for the operation CHANGE_TRUST_SUCCESS = 0, // codes considered as "failure" for the operation CHANGE_TRUST_MALFORMED = -1, // bad input CHANGE_TRUST_NO_ISSUER = -2, // could not find issuer CHANGE_TRUST_INVALID_LIMIT = -3, // cannot drop limit below balance // cannot create with a limit of 0 CHANGE_TRUST_LOW_RESERVE = -4, // not enough funds to create a new trust line, CHANGE_TRUST_SELF_NOT_ALLOWED = -5 // trusting self is not allowed };
const ( ChangeTrustResultCodeChangeTrustSuccess ChangeTrustResultCode = 0 ChangeTrustResultCodeChangeTrustMalformed ChangeTrustResultCode = -1 ChangeTrustResultCodeChangeTrustNoIssuer ChangeTrustResultCode = -2 ChangeTrustResultCodeChangeTrustInvalidLimit ChangeTrustResultCode = -3 ChangeTrustResultCodeChangeTrustLowReserve ChangeTrustResultCode = -4 ChangeTrustResultCodeChangeTrustSelfNotAllowed ChangeTrustResultCode = -5 )
func (s ChangeTrustResultCode) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (e ChangeTrustResultCode) String() string
String returns the name of `e`
func (s *ChangeTrustResultCode) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
func (e ChangeTrustResultCode) ValidEnum(v int32) bool
ValidEnum validates a proposed value for this enum. Implements the Enum interface for ChangeTrustResultCode
type ClaimClaimableBalanceOp struct { BalanceId ClaimableBalanceId }
ClaimClaimableBalanceOp is an XDR Struct defines as:
struct ClaimClaimableBalanceOp { ClaimableBalanceID balanceID; };
func (s ClaimClaimableBalanceOp) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (s *ClaimClaimableBalanceOp) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
type ClaimClaimableBalanceResult struct { Code ClaimClaimableBalanceResultCode }
ClaimClaimableBalanceResult is an XDR Union defines as:
union ClaimClaimableBalanceResult switch (ClaimClaimableBalanceResultCode code) { case CLAIM_CLAIMABLE_BALANCE_SUCCESS: void; default: void; };
func NewClaimClaimableBalanceResult(code ClaimClaimableBalanceResultCode, value interface{}) (result ClaimClaimableBalanceResult, err error)
NewClaimClaimableBalanceResult creates a new ClaimClaimableBalanceResult.
func (u ClaimClaimableBalanceResult) ArmForSwitch(sw int32) (string, bool)
ArmForSwitch returns which field name should be used for storing the value for an instance of ClaimClaimableBalanceResult
func (s ClaimClaimableBalanceResult) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (u ClaimClaimableBalanceResult) SwitchFieldName() string
SwitchFieldName returns the field name in which this union's discriminant is stored
func (s *ClaimClaimableBalanceResult) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
ClaimClaimableBalanceResultCode is an XDR Enum defines as:
enum ClaimClaimableBalanceResultCode { CLAIM_CLAIMABLE_BALANCE_SUCCESS = 0, CLAIM_CLAIMABLE_BALANCE_DOES_NOT_EXIST = -1, CLAIM_CLAIMABLE_BALANCE_CANNOT_CLAIM = -2, CLAIM_CLAIMABLE_BALANCE_LINE_FULL = -3, CLAIM_CLAIMABLE_BALANCE_NO_TRUST = -4, CLAIM_CLAIMABLE_BALANCE_NOT_AUTHORIZED = -5 };
const ( ClaimClaimableBalanceResultCodeClaimClaimableBalanceSuccess ClaimClaimableBalanceResultCode = 0 ClaimClaimableBalanceResultCodeClaimClaimableBalanceDoesNotExist ClaimClaimableBalanceResultCode = -1 ClaimClaimableBalanceResultCodeClaimClaimableBalanceCannotClaim ClaimClaimableBalanceResultCode = -2 ClaimClaimableBalanceResultCodeClaimClaimableBalanceLineFull ClaimClaimableBalanceResultCode = -3 ClaimClaimableBalanceResultCodeClaimClaimableBalanceNoTrust ClaimClaimableBalanceResultCode = -4 ClaimClaimableBalanceResultCodeClaimClaimableBalanceNotAuthorized ClaimClaimableBalanceResultCode = -5 )
func (s ClaimClaimableBalanceResultCode) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (e ClaimClaimableBalanceResultCode) String() string
String returns the name of `e`
func (s *ClaimClaimableBalanceResultCode) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
func (e ClaimClaimableBalanceResultCode) ValidEnum(v int32) bool
ValidEnum validates a proposed value for this enum. Implements the Enum interface for ClaimClaimableBalanceResultCode
type ClaimOfferAtom struct { SellerId AccountId OfferId Int64 AssetSold Asset AmountSold Int64 AssetBought Asset AmountBought Int64 }
ClaimOfferAtom is an XDR Struct defines as:
struct ClaimOfferAtom { // emitted to identify the offer AccountID sellerID; // Account that owns the offer int64 offerID; // amount and asset taken from the owner Asset assetSold; int64 amountSold; // amount and asset sent to the owner Asset assetBought; int64 amountBought; };
func (s ClaimOfferAtom) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (s *ClaimOfferAtom) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
type ClaimPredicate struct { Type ClaimPredicateType AndPredicates *[]ClaimPredicate `xdrmaxsize:"2"` OrPredicates *[]ClaimPredicate `xdrmaxsize:"2"` NotPredicate **ClaimPredicate AbsBefore *Int64 RelBefore *Int64 }
ClaimPredicate is an XDR Union defines as:
union ClaimPredicate switch (ClaimPredicateType type) { case CLAIM_PREDICATE_UNCONDITIONAL: void; case CLAIM_PREDICATE_AND: ClaimPredicate andPredicates<2>; case CLAIM_PREDICATE_OR: ClaimPredicate orPredicates<2>; case CLAIM_PREDICATE_NOT: ClaimPredicate* notPredicate; case CLAIM_PREDICATE_BEFORE_ABSOLUTE_TIME: int64 absBefore; // Predicate will be true if closeTime < absBefore case CLAIM_PREDICATE_BEFORE_RELATIVE_TIME: int64 relBefore; // Seconds since closeTime of the ledger in which the // ClaimableBalanceEntry was created };
func NewClaimPredicate(aType ClaimPredicateType, value interface{}) (result ClaimPredicate, err error)
NewClaimPredicate creates a new ClaimPredicate.
func (u ClaimPredicate) ArmForSwitch(sw int32) (string, bool)
ArmForSwitch returns which field name should be used for storing the value for an instance of ClaimPredicate
func (u ClaimPredicate) GetAbsBefore() (result Int64, ok bool)
GetAbsBefore retrieves the AbsBefore value from the union, returning ok if the union's switch indicated the value is valid.
func (u ClaimPredicate) GetAndPredicates() (result []ClaimPredicate, ok bool)
GetAndPredicates retrieves the AndPredicates value from the union, returning ok if the union's switch indicated the value is valid.
func (u ClaimPredicate) GetNotPredicate() (result *ClaimPredicate, ok bool)
GetNotPredicate retrieves the NotPredicate value from the union, returning ok if the union's switch indicated the value is valid.
func (u ClaimPredicate) GetOrPredicates() (result []ClaimPredicate, ok bool)
GetOrPredicates retrieves the OrPredicates value from the union, returning ok if the union's switch indicated the value is valid.
func (u ClaimPredicate) GetRelBefore() (result Int64, ok bool)
GetRelBefore retrieves the RelBefore value from the union, returning ok if the union's switch indicated the value is valid.
func (s ClaimPredicate) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (c ClaimPredicate) MarshalJSON() ([]byte, error)
func (u ClaimPredicate) MustAbsBefore() Int64
MustAbsBefore retrieves the AbsBefore value from the union, panicing if the value is not set.
func (u ClaimPredicate) MustAndPredicates() []ClaimPredicate
MustAndPredicates retrieves the AndPredicates value from the union, panicing if the value is not set.
func (u ClaimPredicate) MustNotPredicate() *ClaimPredicate
MustNotPredicate retrieves the NotPredicate value from the union, panicing if the value is not set.
func (u ClaimPredicate) MustOrPredicates() []ClaimPredicate
MustOrPredicates retrieves the OrPredicates value from the union, panicing if the value is not set.
func (u ClaimPredicate) MustRelBefore() Int64
MustRelBefore retrieves the RelBefore value from the union, panicing if the value is not set.
func (c *ClaimPredicate) Scan(src interface{}) error
Scan reads from src into a ClaimPredicate
func (u ClaimPredicate) SwitchFieldName() string
SwitchFieldName returns the field name in which this union's discriminant is stored
func (s *ClaimPredicate) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
func (c *ClaimPredicate) UnmarshalJSON(b []byte) error
func (c ClaimPredicate) Value() (driver.Value, error)
Value implements the database/sql/driver Valuer interface.
ClaimPredicateType is an XDR Enum defines as:
enum ClaimPredicateType { CLAIM_PREDICATE_UNCONDITIONAL = 0, CLAIM_PREDICATE_AND = 1, CLAIM_PREDICATE_OR = 2, CLAIM_PREDICATE_NOT = 3, CLAIM_PREDICATE_BEFORE_ABSOLUTE_TIME = 4, CLAIM_PREDICATE_BEFORE_RELATIVE_TIME = 5 };
const ( ClaimPredicateTypeClaimPredicateUnconditional ClaimPredicateType = 0 ClaimPredicateTypeClaimPredicateAnd ClaimPredicateType = 1 ClaimPredicateTypeClaimPredicateOr ClaimPredicateType = 2 ClaimPredicateTypeClaimPredicateNot ClaimPredicateType = 3 ClaimPredicateTypeClaimPredicateBeforeAbsoluteTime ClaimPredicateType = 4 ClaimPredicateTypeClaimPredicateBeforeRelativeTime ClaimPredicateType = 5 )
func (s ClaimPredicateType) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (e ClaimPredicateType) String() string
String returns the name of `e`
func (s *ClaimPredicateType) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
func (e ClaimPredicateType) ValidEnum(v int32) bool
ValidEnum validates a proposed value for this enum. Implements the Enum interface for ClaimPredicateType
type ClaimableBalanceEntry struct { BalanceId ClaimableBalanceId Claimants []Claimant `xdrmaxsize:"10"` Asset Asset Amount Int64 Ext ClaimableBalanceEntryExt }
ClaimableBalanceEntry is an XDR Struct defines as:
struct ClaimableBalanceEntry { // Unique identifier for this ClaimableBalanceEntry ClaimableBalanceID balanceID; // List of claimants with associated predicate Claimant claimants<10>; // Any asset including native Asset asset; // Amount of asset int64 amount; // reserved for future use union switch (int v) { case 0: void; } ext; };
func (s ClaimableBalanceEntry) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (s *ClaimableBalanceEntry) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
ClaimableBalanceEntryExt is an XDR NestedUnion defines as:
union switch (int v) { case 0: void; }
func NewClaimableBalanceEntryExt(v int32, value interface{}) (result ClaimableBalanceEntryExt, err error)
NewClaimableBalanceEntryExt creates a new ClaimableBalanceEntryExt.
func (u ClaimableBalanceEntryExt) ArmForSwitch(sw int32) (string, bool)
ArmForSwitch returns which field name should be used for storing the value for an instance of ClaimableBalanceEntryExt
func (s ClaimableBalanceEntryExt) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (u ClaimableBalanceEntryExt) SwitchFieldName() string
SwitchFieldName returns the field name in which this union's discriminant is stored
func (s *ClaimableBalanceEntryExt) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
type ClaimableBalanceId struct { Type ClaimableBalanceIdType V0 *Hash }
ClaimableBalanceId is an XDR Union defines as:
union ClaimableBalanceID switch (ClaimableBalanceIDType type) { case CLAIMABLE_BALANCE_ID_TYPE_V0: Hash v0; };
func NewClaimableBalanceId(aType ClaimableBalanceIdType, value interface{}) (result ClaimableBalanceId, err error)
NewClaimableBalanceId creates a new ClaimableBalanceId.
func (u ClaimableBalanceId) ArmForSwitch(sw int32) (string, bool)
ArmForSwitch returns which field name should be used for storing the value for an instance of ClaimableBalanceId
func (u ClaimableBalanceId) GetV0() (result Hash, ok bool)
GetV0 retrieves the V0 value from the union, returning ok if the union's switch indicated the value is valid.
func (s ClaimableBalanceId) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (cb ClaimableBalanceId) MarshalBinaryCompress() ([]byte, error)
MarshalBinaryCompress marshals ClaimableBalanceId to []byte but unlike MarshalBinary() it removes all unnecessary bytes, exploting the fact that XDR is padding data to 4 bytes in union discriminants etc. It's primary use is in ingest/io.StateReader that keep LedgerKeys in memory so this function decrease memory requirements.
Warning, do not use UnmarshalBinary() on data encoded using this method!
func (u ClaimableBalanceId) MustV0() Hash
MustV0 retrieves the V0 value from the union, panicing if the value is not set.
func (c *ClaimableBalanceId) Scan(src interface{}) error
Scan reads from src into a ClaimableBalanceId
func (u ClaimableBalanceId) SwitchFieldName() string
SwitchFieldName returns the field name in which this union's discriminant is stored
func (s *ClaimableBalanceId) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
func (c ClaimableBalanceId) Value() (driver.Value, error)
Value implements the database/sql/driver Valuer interface.
ClaimableBalanceIdType is an XDR Enum defines as:
enum ClaimableBalanceIDType { CLAIMABLE_BALANCE_ID_TYPE_V0 = 0 };
const ( ClaimableBalanceIdTypeClaimableBalanceIdTypeV0 ClaimableBalanceIdType = 0 )
func (s ClaimableBalanceIdType) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (e ClaimableBalanceIdType) String() string
String returns the name of `e`
func (s *ClaimableBalanceIdType) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
func (e ClaimableBalanceIdType) ValidEnum(v int32) bool
ValidEnum validates a proposed value for this enum. Implements the Enum interface for ClaimableBalanceIdType
type Claimant struct { Type ClaimantType V0 *ClaimantV0 }
Claimant is an XDR Union defines as:
union Claimant switch (ClaimantType type) { case CLAIMANT_TYPE_V0: struct { AccountID destination; // The account that can use this condition ClaimPredicate predicate; // Claimable if predicate is true } v0; };
func NewClaimant(aType ClaimantType, value interface{}) (result Claimant, err error)
NewClaimant creates a new Claimant.
SortClaimantsByDestination returns a new []Claimant array sorted by destination.
ArmForSwitch returns which field name should be used for storing the value for an instance of Claimant
func (u Claimant) GetV0() (result ClaimantV0, ok bool)
GetV0 retrieves the V0 value from the union, returning ok if the union's switch indicated the value is valid.
MarshalBinary implements encoding.BinaryMarshaler.
func (u Claimant) MustV0() ClaimantV0
MustV0 retrieves the V0 value from the union, panicing if the value is not set.
SwitchFieldName returns the field name in which this union's discriminant is stored
UnmarshalBinary implements encoding.BinaryUnmarshaler.
ClaimantType is an XDR Enum defines as:
enum ClaimantType { CLAIMANT_TYPE_V0 = 0 };
const ( ClaimantTypeClaimantTypeV0 ClaimantType = 0 )
func (s ClaimantType) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (e ClaimantType) String() string
String returns the name of `e`
func (s *ClaimantType) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
func (e ClaimantType) ValidEnum(v int32) bool
ValidEnum validates a proposed value for this enum. Implements the Enum interface for ClaimantType
type ClaimantV0 struct { Destination AccountId Predicate ClaimPredicate }
ClaimantV0 is an XDR NestedStruct defines as:
struct { AccountID destination; // The account that can use this condition ClaimPredicate predicate; // Claimable if predicate is true }
func (s ClaimantV0) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (s *ClaimantV0) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
CreateAccountOp is an XDR Struct defines as:
struct CreateAccountOp { AccountID destination; // account to create int64 startingBalance; // amount they end up with };
func (s CreateAccountOp) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (s *CreateAccountOp) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
type CreateAccountResult struct { Code CreateAccountResultCode }
CreateAccountResult is an XDR Union defines as:
union CreateAccountResult switch (CreateAccountResultCode code) { case CREATE_ACCOUNT_SUCCESS: void; default: void; };
func NewCreateAccountResult(code CreateAccountResultCode, value interface{}) (result CreateAccountResult, err error)
NewCreateAccountResult creates a new CreateAccountResult.
func (u CreateAccountResult) ArmForSwitch(sw int32) (string, bool)
ArmForSwitch returns which field name should be used for storing the value for an instance of CreateAccountResult
func (s CreateAccountResult) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (u CreateAccountResult) SwitchFieldName() string
SwitchFieldName returns the field name in which this union's discriminant is stored
func (s *CreateAccountResult) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
CreateAccountResultCode is an XDR Enum defines as:
enum CreateAccountResultCode { // codes considered as "success" for the operation CREATE_ACCOUNT_SUCCESS = 0, // account was created // codes considered as "failure" for the operation CREATE_ACCOUNT_MALFORMED = -1, // invalid destination CREATE_ACCOUNT_UNDERFUNDED = -2, // not enough funds in source account CREATE_ACCOUNT_LOW_RESERVE = -3, // would create an account below the min reserve CREATE_ACCOUNT_ALREADY_EXIST = -4 // account already exists };
const ( CreateAccountResultCodeCreateAccountSuccess CreateAccountResultCode = 0 CreateAccountResultCodeCreateAccountMalformed CreateAccountResultCode = -1 CreateAccountResultCodeCreateAccountUnderfunded CreateAccountResultCode = -2 CreateAccountResultCodeCreateAccountLowReserve CreateAccountResultCode = -3 CreateAccountResultCodeCreateAccountAlreadyExist CreateAccountResultCode = -4 )
func (s CreateAccountResultCode) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (e CreateAccountResultCode) String() string
String returns the name of `e`
func (s *CreateAccountResultCode) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
func (e CreateAccountResultCode) ValidEnum(v int32) bool
ValidEnum validates a proposed value for this enum. Implements the Enum interface for CreateAccountResultCode
type CreateClaimableBalanceOp struct { Asset Asset Amount Int64 Claimants []Claimant `xdrmaxsize:"10"` }
CreateClaimableBalanceOp is an XDR Struct defines as:
struct CreateClaimableBalanceOp { Asset asset; int64 amount; Claimant claimants<10>; };
func (s CreateClaimableBalanceOp) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (s *CreateClaimableBalanceOp) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
type CreateClaimableBalanceResult struct { Code CreateClaimableBalanceResultCode BalanceId *ClaimableBalanceId }
CreateClaimableBalanceResult is an XDR Union defines as:
union CreateClaimableBalanceResult switch (CreateClaimableBalanceResultCode code) { case CREATE_CLAIMABLE_BALANCE_SUCCESS: ClaimableBalanceID balanceID; default: void; };
func NewCreateClaimableBalanceResult(code CreateClaimableBalanceResultCode, value interface{}) (result CreateClaimableBalanceResult, err error)
NewCreateClaimableBalanceResult creates a new CreateClaimableBalanceResult.
func (u CreateClaimableBalanceResult) ArmForSwitch(sw int32) (string, bool)
ArmForSwitch returns which field name should be used for storing the value for an instance of CreateClaimableBalanceResult
func (u CreateClaimableBalanceResult) GetBalanceId() (result ClaimableBalanceId, ok bool)
GetBalanceId retrieves the BalanceId value from the union, returning ok if the union's switch indicated the value is valid.
func (s CreateClaimableBalanceResult) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (u CreateClaimableBalanceResult) MustBalanceId() ClaimableBalanceId
MustBalanceId retrieves the BalanceId value from the union, panicing if the value is not set.
func (u CreateClaimableBalanceResult) SwitchFieldName() string
SwitchFieldName returns the field name in which this union's discriminant is stored
func (s *CreateClaimableBalanceResult) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
CreateClaimableBalanceResultCode is an XDR Enum defines as:
enum CreateClaimableBalanceResultCode { CREATE_CLAIMABLE_BALANCE_SUCCESS = 0, CREATE_CLAIMABLE_BALANCE_MALFORMED = -1, CREATE_CLAIMABLE_BALANCE_LOW_RESERVE = -2, CREATE_CLAIMABLE_BALANCE_NO_TRUST = -3, CREATE_CLAIMABLE_BALANCE_NOT_AUTHORIZED = -4, CREATE_CLAIMABLE_BALANCE_UNDERFUNDED = -5 };
const ( CreateClaimableBalanceResultCodeCreateClaimableBalanceSuccess CreateClaimableBalanceResultCode = 0 CreateClaimableBalanceResultCodeCreateClaimableBalanceMalformed CreateClaimableBalanceResultCode = -1 CreateClaimableBalanceResultCodeCreateClaimableBalanceLowReserve CreateClaimableBalanceResultCode = -2 CreateClaimableBalanceResultCodeCreateClaimableBalanceNoTrust CreateClaimableBalanceResultCode = -3 CreateClaimableBalanceResultCodeCreateClaimableBalanceNotAuthorized CreateClaimableBalanceResultCode = -4 CreateClaimableBalanceResultCodeCreateClaimableBalanceUnderfunded CreateClaimableBalanceResultCode = -5 )
func (s CreateClaimableBalanceResultCode) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (e CreateClaimableBalanceResultCode) String() string
String returns the name of `e`
func (s *CreateClaimableBalanceResultCode) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
func (e CreateClaimableBalanceResultCode) ValidEnum(v int32) bool
ValidEnum validates a proposed value for this enum. Implements the Enum interface for CreateClaimableBalanceResultCode
CreatePassiveSellOfferOp is an XDR Struct defines as:
struct CreatePassiveSellOfferOp { Asset selling; // A Asset buying; // B int64 amount; // amount taker gets. if set to 0, delete the offer Price price; // cost of A in terms of B };
func (s CreatePassiveSellOfferOp) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (s *CreatePassiveSellOfferOp) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
CryptoKeyType is an XDR Enum defines as:
enum CryptoKeyType { KEY_TYPE_ED25519 = 0, KEY_TYPE_PRE_AUTH_TX = 1, KEY_TYPE_HASH_X = 2, // MUXED enum values for supported type are derived from the enum values // above by ORing them with 0x100 KEY_TYPE_MUXED_ED25519 = 0x100 };
const ( CryptoKeyTypeKeyTypeEd25519 CryptoKeyType = 0 CryptoKeyTypeKeyTypePreAuthTx CryptoKeyType = 1 CryptoKeyTypeKeyTypeHashX CryptoKeyType = 2 CryptoKeyTypeKeyTypeMuxedEd25519 CryptoKeyType = 256 )
func (s CryptoKeyType) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (e CryptoKeyType) String() string
String returns the name of `e`
func (s *CryptoKeyType) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
func (e CryptoKeyType) ValidEnum(v int32) bool
ValidEnum validates a proposed value for this enum. Implements the Enum interface for CryptoKeyType
Curve25519Public is an XDR Struct defines as:
struct Curve25519Public { opaque key[32]; };
func (s Curve25519Public) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (s *Curve25519Public) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
Curve25519Secret is an XDR Struct defines as:
struct Curve25519Secret { opaque key[32]; };
func (s Curve25519Secret) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (s *Curve25519Secret) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
type DataEntry struct { AccountId AccountId DataName String64 DataValue DataValue Ext DataEntryExt }
DataEntry is an XDR Struct defines as:
struct DataEntry { AccountID accountID; // account this data belongs to string64 dataName; DataValue dataValue; // reserved for future use union switch (int v) { case 0: void; } ext; };
MarshalBinary implements encoding.BinaryMarshaler.
UnmarshalBinary implements encoding.BinaryUnmarshaler.
DataEntryExt is an XDR NestedUnion defines as:
union switch (int v) { case 0: void; }
func NewDataEntryExt(v int32, value interface{}) (result DataEntryExt, err error)
NewDataEntryExt creates a new DataEntryExt.
func (u DataEntryExt) ArmForSwitch(sw int32) (string, bool)
ArmForSwitch returns which field name should be used for storing the value for an instance of DataEntryExt
func (s DataEntryExt) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (u DataEntryExt) SwitchFieldName() string
SwitchFieldName returns the field name in which this union's discriminant is stored
func (s *DataEntryExt) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
DataValue is an XDR Typedef defines as:
typedef opaque DataValue<64>;
MarshalBinary implements encoding.BinaryMarshaler.
UnmarshalBinary implements encoding.BinaryUnmarshaler.
XDRMaxSize implements the Sized interface for DataValue
type DecoratedSignature struct { Hint SignatureHint Signature Signature }
DecoratedSignature is an XDR Struct defines as:
struct DecoratedSignature { SignatureHint hint; // last 4 bytes of the public key, used as a hint Signature signature; // actual signature };
func (s DecoratedSignature) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (s *DecoratedSignature) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
type DontHave struct { Type MessageType ReqHash Uint256 }
DontHave is an XDR Struct defines as:
struct DontHave { MessageType type; uint256 reqHash; };
MarshalBinary implements encoding.BinaryMarshaler.
UnmarshalBinary implements encoding.BinaryUnmarshaler.
EncryptedBody is an XDR Typedef defines as:
typedef opaque EncryptedBody<64000>;
func (s EncryptedBody) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (s *EncryptedBody) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
func (e EncryptedBody) XDRMaxSize() int
XDRMaxSize implements the Sized interface for EncryptedBody
type EndSponsoringFutureReservesResult struct { Code EndSponsoringFutureReservesResultCode }
EndSponsoringFutureReservesResult is an XDR Union defines as:
union EndSponsoringFutureReservesResult switch (EndSponsoringFutureReservesResultCode code) { case END_SPONSORING_FUTURE_RESERVES_SUCCESS: void; default: void; };
func NewEndSponsoringFutureReservesResult(code EndSponsoringFutureReservesResultCode, value interface{}) (result EndSponsoringFutureReservesResult, err error)
NewEndSponsoringFutureReservesResult creates a new EndSponsoringFutureReservesResult.
func (u EndSponsoringFutureReservesResult) ArmForSwitch(sw int32) (string, bool)
ArmForSwitch returns which field name should be used for storing the value for an instance of EndSponsoringFutureReservesResult
func (s EndSponsoringFutureReservesResult) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (u EndSponsoringFutureReservesResult) SwitchFieldName() string
SwitchFieldName returns the field name in which this union's discriminant is stored
func (s *EndSponsoringFutureReservesResult) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
EndSponsoringFutureReservesResultCode is an XDR Enum defines as:
enum EndSponsoringFutureReservesResultCode { // codes considered as "success" for the operation END_SPONSORING_FUTURE_RESERVES_SUCCESS = 0, // codes considered as "failure" for the operation END_SPONSORING_FUTURE_RESERVES_NOT_SPONSORED = -1 };
const ( EndSponsoringFutureReservesResultCodeEndSponsoringFutureReservesSuccess EndSponsoringFutureReservesResultCode = 0 EndSponsoringFutureReservesResultCodeEndSponsoringFutureReservesNotSponsored EndSponsoringFutureReservesResultCode = -1 )
func (s EndSponsoringFutureReservesResultCode) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (e EndSponsoringFutureReservesResultCode) String() string
String returns the name of `e`
func (s *EndSponsoringFutureReservesResultCode) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
func (e EndSponsoringFutureReservesResultCode) ValidEnum(v int32) bool
ValidEnum validates a proposed value for this enum. Implements the Enum interface for EndSponsoringFutureReservesResultCode
EnvelopeType is an XDR Enum defines as:
enum EnvelopeType { ENVELOPE_TYPE_TX_V0 = 0, ENVELOPE_TYPE_SCP = 1, ENVELOPE_TYPE_TX = 2, ENVELOPE_TYPE_AUTH = 3, ENVELOPE_TYPE_SCPVALUE = 4, ENVELOPE_TYPE_TX_FEE_BUMP = 5, ENVELOPE_TYPE_OP_ID = 6 };
const ( EnvelopeTypeEnvelopeTypeTxV0 EnvelopeType = 0 EnvelopeTypeEnvelopeTypeScp EnvelopeType = 1 EnvelopeTypeEnvelopeTypeTx EnvelopeType = 2 EnvelopeTypeEnvelopeTypeAuth EnvelopeType = 3 EnvelopeTypeEnvelopeTypeScpvalue EnvelopeType = 4 EnvelopeTypeEnvelopeTypeTxFeeBump EnvelopeType = 5 EnvelopeTypeEnvelopeTypeOpId EnvelopeType = 6 )
func (s EnvelopeType) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (e EnvelopeType) String() string
String returns the name of `e`
func (s *EnvelopeType) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
func (e EnvelopeType) ValidEnum(v int32) bool
ValidEnum validates a proposed value for this enum. Implements the Enum interface for EnvelopeType
Error is an XDR Struct defines as:
struct Error { ErrorCode code; string msg<100>; };
MarshalBinary implements encoding.BinaryMarshaler.
UnmarshalBinary implements encoding.BinaryUnmarshaler.
ErrorCode is an XDR Enum defines as:
enum ErrorCode { ERR_MISC = 0, // Unspecific error ERR_DATA = 1, // Malformed data ERR_CONF = 2, // Misconfiguration error ERR_AUTH = 3, // Authentication failure ERR_LOAD = 4 // System overloaded };
const ( ErrorCodeErrMisc ErrorCode = 0 ErrorCodeErrData ErrorCode = 1 ErrorCodeErrConf ErrorCode = 2 ErrorCodeErrAuth ErrorCode = 3 ErrorCodeErrLoad ErrorCode = 4 )
MarshalBinary implements encoding.BinaryMarshaler.
String returns the name of `e`
UnmarshalBinary implements encoding.BinaryUnmarshaler.
ValidEnum validates a proposed value for this enum. Implements the Enum interface for ErrorCode
type FeeBumpTransaction struct { FeeSource MuxedAccount Fee Int64 InnerTx FeeBumpTransactionInnerTx Ext FeeBumpTransactionExt }
FeeBumpTransaction is an XDR Struct defines as:
struct FeeBumpTransaction { MuxedAccount feeSource; int64 fee; union switch (EnvelopeType type) { case ENVELOPE_TYPE_TX: TransactionV1Envelope v1; } innerTx; union switch (int v) { case 0: void; } ext; };
func (s FeeBumpTransaction) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (s *FeeBumpTransaction) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
type FeeBumpTransactionEnvelope struct { Tx FeeBumpTransaction Signatures []DecoratedSignature `xdrmaxsize:"20"` }
FeeBumpTransactionEnvelope is an XDR Struct defines as:
struct FeeBumpTransactionEnvelope { FeeBumpTransaction tx; /* Each decorated signature is a signature over the SHA256 hash of * a TransactionSignaturePayload */ DecoratedSignature signatures<20>; };
func (s FeeBumpTransactionEnvelope) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (s *FeeBumpTransactionEnvelope) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
FeeBumpTransactionExt is an XDR NestedUnion defines as:
union switch (int v) { case 0: void; }
func NewFeeBumpTransactionExt(v int32, value interface{}) (result FeeBumpTransactionExt, err error)
NewFeeBumpTransactionExt creates a new FeeBumpTransactionExt.
func (u FeeBumpTransactionExt) ArmForSwitch(sw int32) (string, bool)
ArmForSwitch returns which field name should be used for storing the value for an instance of FeeBumpTransactionExt
func (s FeeBumpTransactionExt) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (u FeeBumpTransactionExt) SwitchFieldName() string
SwitchFieldName returns the field name in which this union's discriminant is stored
func (s *FeeBumpTransactionExt) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
type FeeBumpTransactionInnerTx struct { Type EnvelopeType V1 *TransactionV1Envelope }
FeeBumpTransactionInnerTx is an XDR NestedUnion defines as:
union switch (EnvelopeType type) { case ENVELOPE_TYPE_TX: TransactionV1Envelope v1; }
func NewFeeBumpTransactionInnerTx(aType EnvelopeType, value interface{}) (result FeeBumpTransactionInnerTx, err error)
NewFeeBumpTransactionInnerTx creates a new FeeBumpTransactionInnerTx.
func (u FeeBumpTransactionInnerTx) ArmForSwitch(sw int32) (string, bool)
ArmForSwitch returns which field name should be used for storing the value for an instance of FeeBumpTransactionInnerTx
func (u FeeBumpTransactionInnerTx) GetV1() (result TransactionV1Envelope, ok bool)
GetV1 retrieves the V1 value from the union, returning ok if the union's switch indicated the value is valid.
func (e FeeBumpTransactionInnerTx) GoString() string
GoString implements fmt.GoStringer.
func (s FeeBumpTransactionInnerTx) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (u FeeBumpTransactionInnerTx) MustV1() TransactionV1Envelope
MustV1 retrieves the V1 value from the union, panicing if the value is not set.
func (u FeeBumpTransactionInnerTx) SwitchFieldName() string
SwitchFieldName returns the field name in which this union's discriminant is stored
func (s *FeeBumpTransactionInnerTx) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
Hash is an XDR Typedef defines as:
typedef opaque Hash[32];
MarshalBinary implements encoding.BinaryMarshaler.
Scan reads from a src into an xdr.Hash
UnmarshalBinary implements encoding.BinaryUnmarshaler.
XDRMaxSize implements the Sized interface for Hash
type Hello struct { LedgerVersion Uint32 OverlayVersion Uint32 OverlayMinVersion Uint32 NetworkId Hash VersionStr string `xdrmaxsize:"100"` ListeningPort int32 PeerId NodeId Cert AuthCert Nonce Uint256 }
Hello is an XDR Struct defines as:
struct Hello { uint32 ledgerVersion; uint32 overlayVersion; uint32 overlayMinVersion; Hash networkID; string versionStr<100>; int listeningPort; NodeID peerID; AuthCert cert; uint256 nonce; };
MarshalBinary implements encoding.BinaryMarshaler.
UnmarshalBinary implements encoding.BinaryUnmarshaler.
HmacSha256Key is an XDR Struct defines as:
struct HmacSha256Key { opaque key[32]; };
func (s HmacSha256Key) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (s *HmacSha256Key) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
HmacSha256Mac is an XDR Struct defines as:
struct HmacSha256Mac { opaque mac[32]; };
func (s HmacSha256Mac) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (s *HmacSha256Mac) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
InflationPayout is an XDR Struct defines as:
struct InflationPayout // or use PaymentResultAtom to limit types? { AccountID destination; int64 amount; };
func (s InflationPayout) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (s *InflationPayout) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
type InflationResult struct { Code InflationResultCode Payouts *[]InflationPayout }
InflationResult is an XDR Union defines as:
union InflationResult switch (InflationResultCode code) { case INFLATION_SUCCESS: InflationPayout payouts<>; default: void; };
func NewInflationResult(code InflationResultCode, value interface{}) (result InflationResult, err error)
NewInflationResult creates a new InflationResult.
func (u InflationResult) ArmForSwitch(sw int32) (string, bool)
ArmForSwitch returns which field name should be used for storing the value for an instance of InflationResult
func (u InflationResult) GetPayouts() (result []InflationPayout, ok bool)
GetPayouts retrieves the Payouts value from the union, returning ok if the union's switch indicated the value is valid.
func (s InflationResult) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (u InflationResult) MustPayouts() []InflationPayout
MustPayouts retrieves the Payouts value from the union, panicing if the value is not set.
func (u InflationResult) SwitchFieldName() string
SwitchFieldName returns the field name in which this union's discriminant is stored
func (s *InflationResult) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
InflationResultCode is an XDR Enum defines as:
enum InflationResultCode { // codes considered as "success" for the operation INFLATION_SUCCESS = 0, // codes considered as "failure" for the operation INFLATION_NOT_TIME = -1 };
const ( InflationResultCodeInflationSuccess InflationResultCode = 0 InflationResultCodeInflationNotTime InflationResultCode = -1 )
func (s InflationResultCode) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (e InflationResultCode) String() string
String returns the name of `e`
func (s *InflationResultCode) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
func (e InflationResultCode) ValidEnum(v int32) bool
ValidEnum validates a proposed value for this enum. Implements the Enum interface for InflationResultCode
type InnerTransactionResult struct { FeeCharged Int64 Result InnerTransactionResultResult Ext InnerTransactionResultExt }
InnerTransactionResult is an XDR Struct defines as:
struct InnerTransactionResult { // Always 0. Here for binary compatibility. int64 feeCharged; union switch (TransactionResultCode code) { // txFEE_BUMP_INNER_SUCCESS is not included case txSUCCESS: case txFAILED: OperationResult results<>; case txTOO_EARLY: case txTOO_LATE: case txMISSING_OPERATION: case txBAD_SEQ: case txBAD_AUTH: case txINSUFFICIENT_BALANCE: case txNO_ACCOUNT: case txINSUFFICIENT_FEE: case txBAD_AUTH_EXTRA: case txINTERNAL_ERROR: case txNOT_SUPPORTED: // txFEE_BUMP_INNER_FAILED is not included case txBAD_SPONSORSHIP: void; } result; // reserved for future use union switch (int v) { case 0: void; } ext; };
func (s InnerTransactionResult) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (s *InnerTransactionResult) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
InnerTransactionResultExt is an XDR NestedUnion defines as:
union switch (int v) { case 0: void; }
func NewInnerTransactionResultExt(v int32, value interface{}) (result InnerTransactionResultExt, err error)
NewInnerTransactionResultExt creates a new InnerTransactionResultExt.
func (u InnerTransactionResultExt) ArmForSwitch(sw int32) (string, bool)
ArmForSwitch returns which field name should be used for storing the value for an instance of InnerTransactionResultExt
func (s InnerTransactionResultExt) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (u InnerTransactionResultExt) SwitchFieldName() string
SwitchFieldName returns the field name in which this union's discriminant is stored
func (s *InnerTransactionResultExt) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
type InnerTransactionResultPair struct { TransactionHash Hash Result InnerTransactionResult }
InnerTransactionResultPair is an XDR Struct defines as:
struct InnerTransactionResultPair { Hash transactionHash; // hash of the inner transaction InnerTransactionResult result; // result for the inner transaction };
func (s InnerTransactionResultPair) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (s *InnerTransactionResultPair) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
type InnerTransactionResultResult struct { Code TransactionResultCode Results *[]OperationResult }
InnerTransactionResultResult is an XDR NestedUnion defines as:
union switch (TransactionResultCode code) { // txFEE_BUMP_INNER_SUCCESS is not included case txSUCCESS: case txFAILED: OperationResult results<>; case txTOO_EARLY: case txTOO_LATE: case txMISSING_OPERATION: case txBAD_SEQ: case txBAD_AUTH: case txINSUFFICIENT_BALANCE: case txNO_ACCOUNT: case txINSUFFICIENT_FEE: case txBAD_AUTH_EXTRA: case txINTERNAL_ERROR: case txNOT_SUPPORTED: // txFEE_BUMP_INNER_FAILED is not included case txBAD_SPONSORSHIP: void; }
func NewInnerTransactionResultResult(code TransactionResultCode, value interface{}) (result InnerTransactionResultResult, err error)
NewInnerTransactionResultResult creates a new InnerTransactionResultResult.
func (u InnerTransactionResultResult) ArmForSwitch(sw int32) (string, bool)
ArmForSwitch returns which field name should be used for storing the value for an instance of InnerTransactionResultResult
func (u InnerTransactionResultResult) GetResults() (result []OperationResult, ok bool)
GetResults retrieves the Results value from the union, returning ok if the union's switch indicated the value is valid.
func (s InnerTransactionResultResult) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (u InnerTransactionResultResult) MustResults() []OperationResult
MustResults retrieves the Results value from the union, panicing if the value is not set.
func (u InnerTransactionResultResult) SwitchFieldName() string
SwitchFieldName returns the field name in which this union's discriminant is stored
func (s *InnerTransactionResultResult) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
Int32 is an XDR Typedef defines as:
typedef int int32;
MarshalBinary implements encoding.BinaryMarshaler.
UnmarshalBinary implements encoding.BinaryUnmarshaler.
Int64 is an XDR Typedef defines as:
typedef hyper int64;
MarshalBinary implements encoding.BinaryMarshaler.
Scan reads from src into an Int64
UnmarshalBinary implements encoding.BinaryUnmarshaler.
IpAddrType is an XDR Enum defines as:
enum IPAddrType { IPv4 = 0, IPv6 = 1 };
const ( IpAddrTypeIPv4 IpAddrType = 0 IpAddrTypeIPv6 IpAddrType = 1 )
func (s IpAddrType) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (e IpAddrType) String() string
String returns the name of `e`
func (s *IpAddrType) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
func (e IpAddrType) ValidEnum(v int32) bool
ValidEnum validates a proposed value for this enum. Implements the Enum interface for IpAddrType
Keyer represents a type that can be converted into a LedgerKey
type LedgerCloseMeta struct { V int32 V0 *LedgerCloseMetaV0 }
LedgerCloseMeta is an XDR Union defines as:
union LedgerCloseMeta switch (int v) { case 0: LedgerCloseMetaV0 v0; };
func NewLedgerCloseMeta(v int32, value interface{}) (result LedgerCloseMeta, err error)
NewLedgerCloseMeta creates a new LedgerCloseMeta.
func (u LedgerCloseMeta) ArmForSwitch(sw int32) (string, bool)
ArmForSwitch returns which field name should be used for storing the value for an instance of LedgerCloseMeta
func (u LedgerCloseMeta) GetV0() (result LedgerCloseMetaV0, ok bool)
GetV0 retrieves the V0 value from the union, returning ok if the union's switch indicated the value is valid.
func (l LedgerCloseMeta) LedgerHash() Hash
func (l LedgerCloseMeta) LedgerSequence() uint32
func (s LedgerCloseMeta) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (u LedgerCloseMeta) MustV0() LedgerCloseMetaV0
MustV0 retrieves the V0 value from the union, panicing if the value is not set.
func (l LedgerCloseMeta) PreviousLedgerHash() Hash
func (u LedgerCloseMeta) SwitchFieldName() string
SwitchFieldName returns the field name in which this union's discriminant is stored
func (s *LedgerCloseMeta) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
type LedgerCloseMetaV0 struct { LedgerHeader LedgerHeaderHistoryEntry TxSet TransactionSet TxProcessing []TransactionResultMeta UpgradesProcessing []UpgradeEntryMeta ScpInfo []ScpHistoryEntry }
LedgerCloseMetaV0 is an XDR Struct defines as:
struct LedgerCloseMetaV0 { LedgerHeaderHistoryEntry ledgerHeader; // NB: txSet is sorted in "Hash order" TransactionSet txSet; // NB: transactions are sorted in apply order here // fees for all transactions are processed first // followed by applying transactions TransactionResultMeta txProcessing<>; // upgrades are applied last UpgradeEntryMeta upgradesProcessing<>; // other misc information attached to the ledger close SCPHistoryEntry scpInfo<>; };
func (s LedgerCloseMetaV0) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (s *LedgerCloseMetaV0) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
LedgerCloseValueSignature is an XDR Struct defines as:
struct LedgerCloseValueSignature { NodeID nodeID; // which node introduced the value Signature signature; // nodeID's signature };
func (s LedgerCloseValueSignature) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (s *LedgerCloseValueSignature) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
type LedgerEntry struct { LastModifiedLedgerSeq Uint32 Data LedgerEntryData Ext LedgerEntryExt }
LedgerEntry is an XDR Struct defines as:
struct LedgerEntry { uint32 lastModifiedLedgerSeq; // ledger the LedgerEntry was last changed union switch (LedgerEntryType type) { case ACCOUNT: AccountEntry account; case TRUSTLINE: TrustLineEntry trustLine; case OFFER: OfferEntry offer; case DATA: DataEntry data; case CLAIMABLE_BALANCE: ClaimableBalanceEntry claimableBalance; } data; // reserved for future use union switch (int v) { case 0: void; case 1: LedgerEntryExtensionV1 v1; } ext; };
func (entry *LedgerEntry) LedgerKey() LedgerKey
LedgerKey implements the `Keyer` interface
func (s LedgerEntry) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (entry *LedgerEntry) SponsoringID() SponsorshipDescriptor
SponsoringID return SponsorshipDescriptor for a given ledger entry
func (s *LedgerEntry) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
type LedgerEntryChange struct { Type LedgerEntryChangeType Created *LedgerEntry Updated *LedgerEntry Removed *LedgerKey State *LedgerEntry }
LedgerEntryChange is an XDR Union defines as:
union LedgerEntryChange switch (LedgerEntryChangeType type) { case LEDGER_ENTRY_CREATED: LedgerEntry created; case LEDGER_ENTRY_UPDATED: LedgerEntry updated; case LEDGER_ENTRY_REMOVED: LedgerKey removed; case LEDGER_ENTRY_STATE: LedgerEntry state; };
func NewLedgerEntryChange(aType LedgerEntryChangeType, value interface{}) (result LedgerEntryChange, err error)
NewLedgerEntryChange creates a new LedgerEntryChange.
func (u LedgerEntryChange) ArmForSwitch(sw int32) (string, bool)
ArmForSwitch returns which field name should be used for storing the value for an instance of LedgerEntryChange
func (change *LedgerEntryChange) EntryType() LedgerEntryType
EntryType is a helper to get at the entry type for a change.
func (u LedgerEntryChange) GetCreated() (result LedgerEntry, ok bool)
GetCreated retrieves the Created value from the union, returning ok if the union's switch indicated the value is valid.
func (change *LedgerEntryChange) GetLedgerEntry() (LedgerEntry, bool)
GetLedgerEntry returns the ledger entry that was changed in `change`, along with a boolean indicating whether the entry value was valid.
func (u LedgerEntryChange) GetRemoved() (result LedgerKey, ok bool)
GetRemoved retrieves the Removed value from the union, returning ok if the union's switch indicated the value is valid.
func (u LedgerEntryChange) GetState() (result LedgerEntry, ok bool)
GetState retrieves the State value from the union, returning ok if the union's switch indicated the value is valid.
func (u LedgerEntryChange) GetUpdated() (result LedgerEntry, ok bool)
GetUpdated retrieves the Updated value from the union, returning ok if the union's switch indicated the value is valid.
func (change *LedgerEntryChange) LedgerKey() LedgerKey
LedgerKey returns the key for the ledger entry that was changed in `change`.
func (s LedgerEntryChange) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (change LedgerEntryChange) MarshalBinaryBase64() (string, error)
MarshalBinaryBase64 marshals XDR into a binary form and then encodes it using base64.
func (u LedgerEntryChange) MustCreated() LedgerEntry
MustCreated retrieves the Created value from the union, panicing if the value is not set.
func (u LedgerEntryChange) MustRemoved() LedgerKey
MustRemoved retrieves the Removed value from the union, panicing if the value is not set.
func (u LedgerEntryChange) MustState() LedgerEntry
MustState retrieves the State value from the union, panicing if the value is not set.
func (u LedgerEntryChange) MustUpdated() LedgerEntry
MustUpdated retrieves the Updated value from the union, panicing if the value is not set.
func (u LedgerEntryChange) SwitchFieldName() string
SwitchFieldName returns the field name in which this union's discriminant is stored
func (s *LedgerEntryChange) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
LedgerEntryChangeType is an XDR Enum defines as:
enum LedgerEntryChangeType { LEDGER_ENTRY_CREATED = 0, // entry was added to the ledger LEDGER_ENTRY_UPDATED = 1, // entry was modified in the ledger LEDGER_ENTRY_REMOVED = 2, // entry was removed from the ledger LEDGER_ENTRY_STATE = 3 // value of the entry };
const ( LedgerEntryChangeTypeLedgerEntryCreated LedgerEntryChangeType = 0 LedgerEntryChangeTypeLedgerEntryUpdated LedgerEntryChangeType = 1 LedgerEntryChangeTypeLedgerEntryRemoved LedgerEntryChangeType = 2 LedgerEntryChangeTypeLedgerEntryState LedgerEntryChangeType = 3 )
func (s LedgerEntryChangeType) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (e LedgerEntryChangeType) String() string
String returns the name of `e`
func (s *LedgerEntryChangeType) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
func (e LedgerEntryChangeType) ValidEnum(v int32) bool
ValidEnum validates a proposed value for this enum. Implements the Enum interface for LedgerEntryChangeType
type LedgerEntryChanges []LedgerEntryChange
LedgerEntryChanges is an XDR Typedef defines as:
typedef LedgerEntryChange LedgerEntryChanges<>;
func (s LedgerEntryChanges) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (t *LedgerEntryChanges) Scan(src interface{}) error
Scan reads from src into an LedgerEntryChanges struct
func (s *LedgerEntryChanges) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
type LedgerEntryData struct { Type LedgerEntryType Account *AccountEntry TrustLine *TrustLineEntry Offer *OfferEntry Data *DataEntry ClaimableBalance *ClaimableBalanceEntry }
LedgerEntryData is an XDR NestedUnion defines as:
union switch (LedgerEntryType type) { case ACCOUNT: AccountEntry account; case TRUSTLINE: TrustLineEntry trustLine; case OFFER: OfferEntry offer; case DATA: DataEntry data; case CLAIMABLE_BALANCE: ClaimableBalanceEntry claimableBalance; }
func NewLedgerEntryData(aType LedgerEntryType, value interface{}) (result LedgerEntryData, err error)
NewLedgerEntryData creates a new LedgerEntryData.
func (u LedgerEntryData) ArmForSwitch(sw int32) (string, bool)
ArmForSwitch returns which field name should be used for storing the value for an instance of LedgerEntryData
func (u LedgerEntryData) GetAccount() (result AccountEntry, ok bool)
GetAccount retrieves the Account value from the union, returning ok if the union's switch indicated the value is valid.
func (u LedgerEntryData) GetClaimableBalance() (result ClaimableBalanceEntry, ok bool)
GetClaimableBalance retrieves the ClaimableBalance value from the union, returning ok if the union's switch indicated the value is valid.
func (u LedgerEntryData) GetData() (result DataEntry, ok bool)
GetData retrieves the Data value from the union, returning ok if the union's switch indicated the value is valid.
func (u LedgerEntryData) GetOffer() (result OfferEntry, ok bool)
GetOffer retrieves the Offer value from the union, returning ok if the union's switch indicated the value is valid.
func (u LedgerEntryData) GetTrustLine() (result TrustLineEntry, ok bool)
GetTrustLine retrieves the TrustLine value from the union, returning ok if the union's switch indicated the value is valid.
func (s LedgerEntryData) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (u LedgerEntryData) MustAccount() AccountEntry
MustAccount retrieves the Account value from the union, panicing if the value is not set.
func (u LedgerEntryData) MustClaimableBalance() ClaimableBalanceEntry
MustClaimableBalance retrieves the ClaimableBalance value from the union, panicing if the value is not set.
func (u LedgerEntryData) MustData() DataEntry
MustData retrieves the Data value from the union, panicing if the value is not set.
func (u LedgerEntryData) MustOffer() OfferEntry
MustOffer retrieves the Offer value from the union, panicing if the value is not set.
func (u LedgerEntryData) MustTrustLine() TrustLineEntry
MustTrustLine retrieves the TrustLine value from the union, panicing if the value is not set.
func (u LedgerEntryData) SwitchFieldName() string
SwitchFieldName returns the field name in which this union's discriminant is stored
func (s *LedgerEntryData) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
type LedgerEntryExt struct { V int32 V1 *LedgerEntryExtensionV1 }
LedgerEntryExt is an XDR NestedUnion defines as:
union switch (int v) { case 0: void; case 1: LedgerEntryExtensionV1 v1; }
func NewLedgerEntryExt(v int32, value interface{}) (result LedgerEntryExt, err error)
NewLedgerEntryExt creates a new LedgerEntryExt.
func (u LedgerEntryExt) ArmForSwitch(sw int32) (string, bool)
ArmForSwitch returns which field name should be used for storing the value for an instance of LedgerEntryExt
func (u LedgerEntryExt) GetV1() (result LedgerEntryExtensionV1, ok bool)
GetV1 retrieves the V1 value from the union, returning ok if the union's switch indicated the value is valid.
func (s LedgerEntryExt) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (u LedgerEntryExt) MustV1() LedgerEntryExtensionV1
MustV1 retrieves the V1 value from the union, panicing if the value is not set.
func (u LedgerEntryExt) SwitchFieldName() string
SwitchFieldName returns the field name in which this union's discriminant is stored
func (s *LedgerEntryExt) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
type LedgerEntryExtensionV1 struct { SponsoringId SponsorshipDescriptor Ext LedgerEntryExtensionV1Ext }
LedgerEntryExtensionV1 is an XDR Struct defines as:
struct LedgerEntryExtensionV1 { SponsorshipDescriptor sponsoringID; union switch (int v) { case 0: void; } ext; };
func (s LedgerEntryExtensionV1) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (s *LedgerEntryExtensionV1) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
LedgerEntryExtensionV1Ext is an XDR NestedUnion defines as:
union switch (int v) { case 0: void; }
func NewLedgerEntryExtensionV1Ext(v int32, value interface{}) (result LedgerEntryExtensionV1Ext, err error)
NewLedgerEntryExtensionV1Ext creates a new LedgerEntryExtensionV1Ext.
func (u LedgerEntryExtensionV1Ext) ArmForSwitch(sw int32) (string, bool)
ArmForSwitch returns which field name should be used for storing the value for an instance of LedgerEntryExtensionV1Ext
func (s LedgerEntryExtensionV1Ext) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (u LedgerEntryExtensionV1Ext) SwitchFieldName() string
SwitchFieldName returns the field name in which this union's discriminant is stored
func (s *LedgerEntryExtensionV1Ext) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
LedgerEntryType is an XDR Enum defines as:
enum LedgerEntryType { ACCOUNT = 0, TRUSTLINE = 1, OFFER = 2, DATA = 3, CLAIMABLE_BALANCE = 4 };
const ( LedgerEntryTypeAccount LedgerEntryType = 0 LedgerEntryTypeTrustline LedgerEntryType = 1 LedgerEntryTypeOffer LedgerEntryType = 2 LedgerEntryTypeData LedgerEntryType = 3 LedgerEntryTypeClaimableBalance LedgerEntryType = 4 )
func (s LedgerEntryType) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (e LedgerEntryType) String() string
String returns the name of `e`
func (s *LedgerEntryType) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
func (e LedgerEntryType) ValidEnum(v int32) bool
ValidEnum validates a proposed value for this enum. Implements the Enum interface for LedgerEntryType
type LedgerHeader struct { LedgerVersion Uint32 PreviousLedgerHash Hash ScpValue StellarValue TxSetResultHash Hash BucketListHash Hash LedgerSeq Uint32 TotalCoins Int64 FeePool Int64 InflationSeq Uint32 IdPool Uint64 BaseFee Uint32 BaseReserve Uint32 MaxTxSetSize Uint32 SkipList [4]Hash Ext LedgerHeaderExt }
LedgerHeader is an XDR Struct defines as:
struct LedgerHeader { uint32 ledgerVersion; // the protocol version of the ledger Hash previousLedgerHash; // hash of the previous ledger header StellarValue scpValue; // what consensus agreed to Hash txSetResultHash; // the TransactionResultSet that led to this ledger Hash bucketListHash; // hash of the ledger state uint32 ledgerSeq; // sequence number of this ledger int64 totalCoins; // total number of stroops in existence. // 10,000,000 stroops in 1 XLM int64 feePool; // fees burned since last inflation run uint32 inflationSeq; // inflation sequence number uint64 idPool; // last used global ID, used for generating objects uint32 baseFee; // base fee per operation in stroops uint32 baseReserve; // account base reserve in stroops uint32 maxTxSetSize; // maximum size a transaction set can be Hash skipList[4]; // hashes of ledgers in the past. allows you to jump back // in time without walking the chain back ledger by ledger // each slot contains the oldest ledger that is mod of // either 50 5000 50000 or 500000 depending on index // skipList[0] mod(50), skipList[1] mod(5000), etc // reserved for future use union switch (int v) { case 0: void; } ext; };
func (s LedgerHeader) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (t *LedgerHeader) Scan(src interface{}) error
Scan reads from src into an LedgerHeader struct
func (s *LedgerHeader) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
LedgerHeaderExt is an XDR NestedUnion defines as:
union switch (int v) { case 0: void; }
func NewLedgerHeaderExt(v int32, value interface{}) (result LedgerHeaderExt, err error)
NewLedgerHeaderExt creates a new LedgerHeaderExt.
func (u LedgerHeaderExt) ArmForSwitch(sw int32) (string, bool)
ArmForSwitch returns which field name should be used for storing the value for an instance of LedgerHeaderExt
func (s LedgerHeaderExt) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (u LedgerHeaderExt) SwitchFieldName() string
SwitchFieldName returns the field name in which this union's discriminant is stored
func (s *LedgerHeaderExt) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
type LedgerHeaderHistoryEntry struct { Hash Hash Header LedgerHeader Ext LedgerHeaderHistoryEntryExt }
LedgerHeaderHistoryEntry is an XDR Struct defines as:
struct LedgerHeaderHistoryEntry { Hash hash; LedgerHeader header; // reserved for future use union switch (int v) { case 0: void; } ext; };
func (s LedgerHeaderHistoryEntry) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (s *LedgerHeaderHistoryEntry) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
LedgerHeaderHistoryEntryExt is an XDR NestedUnion defines as:
union switch (int v) { case 0: void; }
func NewLedgerHeaderHistoryEntryExt(v int32, value interface{}) (result LedgerHeaderHistoryEntryExt, err error)
NewLedgerHeaderHistoryEntryExt creates a new LedgerHeaderHistoryEntryExt.
func (u LedgerHeaderHistoryEntryExt) ArmForSwitch(sw int32) (string, bool)
ArmForSwitch returns which field name should be used for storing the value for an instance of LedgerHeaderHistoryEntryExt
func (s LedgerHeaderHistoryEntryExt) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (u LedgerHeaderHistoryEntryExt) SwitchFieldName() string
SwitchFieldName returns the field name in which this union's discriminant is stored
func (s *LedgerHeaderHistoryEntryExt) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
type LedgerKey struct { Type LedgerEntryType Account *LedgerKeyAccount TrustLine *LedgerKeyTrustLine Offer *LedgerKeyOffer Data *LedgerKeyData ClaimableBalance *LedgerKeyClaimableBalance }
LedgerKey is an XDR Union defines as:
union LedgerKey switch (LedgerEntryType type) { case ACCOUNT: struct { AccountID accountID; } account; case TRUSTLINE: struct { AccountID accountID; Asset asset; } trustLine; case OFFER: struct { AccountID sellerID; int64 offerID; } offer; case DATA: struct { AccountID accountID; string64 dataName; } data; case CLAIMABLE_BALANCE: struct { ClaimableBalanceID balanceID; } claimableBalance; };
func NewLedgerKey(aType LedgerEntryType, value interface{}) (result LedgerKey, err error)
NewLedgerKey creates a new LedgerKey.
ArmForSwitch returns which field name should be used for storing the value for an instance of LedgerKey
Equals returns true if `other` is equivalent to `key`
func (u LedgerKey) GetAccount() (result LedgerKeyAccount, ok bool)
GetAccount retrieves the Account value from the union, returning ok if the union's switch indicated the value is valid.
func (u LedgerKey) GetClaimableBalance() (result LedgerKeyClaimableBalance, ok bool)
GetClaimableBalance retrieves the ClaimableBalance value from the union, returning ok if the union's switch indicated the value is valid.
func (u LedgerKey) GetData() (result LedgerKeyData, ok bool)
GetData retrieves the Data value from the union, returning ok if the union's switch indicated the value is valid.
func (u LedgerKey) GetOffer() (result LedgerKeyOffer, ok bool)
GetOffer retrieves the Offer value from the union, returning ok if the union's switch indicated the value is valid.
func (u LedgerKey) GetTrustLine() (result LedgerKeyTrustLine, ok bool)
GetTrustLine retrieves the TrustLine value from the union, returning ok if the union's switch indicated the value is valid.
LedgerKey implements the `Keyer` interface
MarshalBinary implements encoding.BinaryMarshaler.
MarshalBinaryBase64 marshals XDR into a binary form and then encodes it using base64.
MarshalBinaryCompress marshals LedgerKey to []byte but unlike MarshalBinary() it removes all unnecessary bytes, exploting the fact that XDR is padding data to 4 bytes in union discriminants etc. It's primary use is in ingest/io.StateReader that keep LedgerKeys in memory so this function decrease memory requirements.
Warning, do not use UnmarshalBinary() on data encoded using this method!
Optimizations: - Writes a single byte for union discriminants vs 4 bytes. - Removes type and code padding for Asset.
func (u LedgerKey) MustAccount() LedgerKeyAccount
MustAccount retrieves the Account value from the union, panicing if the value is not set.
func (u LedgerKey) MustClaimableBalance() LedgerKeyClaimableBalance
MustClaimableBalance retrieves the ClaimableBalance value from the union, panicing if the value is not set.
func (u LedgerKey) MustData() LedgerKeyData
MustData retrieves the Data value from the union, panicing if the value is not set.
func (u LedgerKey) MustOffer() LedgerKeyOffer
MustOffer retrieves the Offer value from the union, panicing if the value is not set.
func (u LedgerKey) MustTrustLine() LedgerKeyTrustLine
MustTrustLine retrieves the TrustLine value from the union, panicing if the value is not set.
SetAccount mutates `key` such that it represents the identity of `account`
func (key *LedgerKey) SetClaimableBalance(balanceID ClaimableBalanceId) error
SetClaimableBalance mutates `key` such that it represents the identity of a claimable balance.
SetData mutates `key` such that it represents the identity of the data entry owned by `account` and for `name`.
SetOffer mutates `key` such that it represents the identity of the data entry owned by `account` and for offer `id`.
SetTrustline mutates `key` such that it represents the identity of the trustline owned by `account` and for `asset`.
SwitchFieldName returns the field name in which this union's discriminant is stored
UnmarshalBinary implements encoding.BinaryUnmarshaler.
LedgerKeyAccount is an XDR NestedStruct defines as:
struct { AccountID accountID; }
func (s LedgerKeyAccount) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (s *LedgerKeyAccount) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
type LedgerKeyClaimableBalance struct { BalanceId ClaimableBalanceId }
LedgerKeyClaimableBalance is an XDR NestedStruct defines as:
struct { ClaimableBalanceID balanceID; }
func (s LedgerKeyClaimableBalance) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (s *LedgerKeyClaimableBalance) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
LedgerKeyData is an XDR NestedStruct defines as:
struct { AccountID accountID; string64 dataName; }
func (s LedgerKeyData) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (s *LedgerKeyData) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
LedgerKeyOffer is an XDR NestedStruct defines as:
struct { AccountID sellerID; int64 offerID; }
func (s LedgerKeyOffer) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (s *LedgerKeyOffer) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
LedgerKeyTrustLine is an XDR NestedStruct defines as:
struct { AccountID accountID; Asset asset; }
func (s LedgerKeyTrustLine) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (s *LedgerKeyTrustLine) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
type LedgerScpMessages struct { LedgerSeq Uint32 Messages []ScpEnvelope }
LedgerScpMessages is an XDR Struct defines as:
struct LedgerSCPMessages { uint32 ledgerSeq; SCPEnvelope messages<>; };
func (s LedgerScpMessages) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (s *LedgerScpMessages) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
type LedgerUpgrade struct { Type LedgerUpgradeType NewLedgerVersion *Uint32 NewBaseFee *Uint32 NewMaxTxSetSize *Uint32 NewBaseReserve *Uint32 }
LedgerUpgrade is an XDR Union defines as:
union LedgerUpgrade switch (LedgerUpgradeType type) { case LEDGER_UPGRADE_VERSION: uint32 newLedgerVersion; // update ledgerVersion case LEDGER_UPGRADE_BASE_FEE: uint32 newBaseFee; // update baseFee case LEDGER_UPGRADE_MAX_TX_SET_SIZE: uint32 newMaxTxSetSize; // update maxTxSetSize case LEDGER_UPGRADE_BASE_RESERVE: uint32 newBaseReserve; // update baseReserve };
func NewLedgerUpgrade(aType LedgerUpgradeType, value interface{}) (result LedgerUpgrade, err error)
NewLedgerUpgrade creates a new LedgerUpgrade.
func (u LedgerUpgrade) ArmForSwitch(sw int32) (string, bool)
ArmForSwitch returns which field name should be used for storing the value for an instance of LedgerUpgrade
func (u LedgerUpgrade) GetNewBaseFee() (result Uint32, ok bool)
GetNewBaseFee retrieves the NewBaseFee value from the union, returning ok if the union's switch indicated the value is valid.
func (u LedgerUpgrade) GetNewBaseReserve() (result Uint32, ok bool)
GetNewBaseReserve retrieves the NewBaseReserve value from the union, returning ok if the union's switch indicated the value is valid.
func (u LedgerUpgrade) GetNewLedgerVersion() (result Uint32, ok bool)
GetNewLedgerVersion retrieves the NewLedgerVersion value from the union, returning ok if the union's switch indicated the value is valid.
func (u LedgerUpgrade) GetNewMaxTxSetSize() (result Uint32, ok bool)
GetNewMaxTxSetSize retrieves the NewMaxTxSetSize value from the union, returning ok if the union's switch indicated the value is valid.
func (s LedgerUpgrade) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (u LedgerUpgrade) MustNewBaseFee() Uint32
MustNewBaseFee retrieves the NewBaseFee value from the union, panicing if the value is not set.
func (u LedgerUpgrade) MustNewBaseReserve() Uint32
MustNewBaseReserve retrieves the NewBaseReserve value from the union, panicing if the value is not set.
func (u LedgerUpgrade) MustNewLedgerVersion() Uint32
MustNewLedgerVersion retrieves the NewLedgerVersion value from the union, panicing if the value is not set.
func (u LedgerUpgrade) MustNewMaxTxSetSize() Uint32
MustNewMaxTxSetSize retrieves the NewMaxTxSetSize value from the union, panicing if the value is not set.
func (t *LedgerUpgrade) Scan(src interface{}) error
Scan reads from src into an LedgerUpgrade struct
func (u LedgerUpgrade) SwitchFieldName() string
SwitchFieldName returns the field name in which this union's discriminant is stored
func (s *LedgerUpgrade) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
LedgerUpgradeType is an XDR Enum defines as:
enum LedgerUpgradeType { LEDGER_UPGRADE_VERSION = 1, LEDGER_UPGRADE_BASE_FEE = 2, LEDGER_UPGRADE_MAX_TX_SET_SIZE = 3, LEDGER_UPGRADE_BASE_RESERVE = 4 };
const ( LedgerUpgradeTypeLedgerUpgradeVersion LedgerUpgradeType = 1 LedgerUpgradeTypeLedgerUpgradeBaseFee LedgerUpgradeType = 2 LedgerUpgradeTypeLedgerUpgradeMaxTxSetSize LedgerUpgradeType = 3 LedgerUpgradeTypeLedgerUpgradeBaseReserve LedgerUpgradeType = 4 )
func (s LedgerUpgradeType) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (e LedgerUpgradeType) String() string
String returns the name of `e`
func (s *LedgerUpgradeType) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
func (e LedgerUpgradeType) ValidEnum(v int32) bool
ValidEnum validates a proposed value for this enum. Implements the Enum interface for LedgerUpgradeType
Liabilities is an XDR Struct defines as:
struct Liabilities { int64 buying; int64 selling; };
func (s Liabilities) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (s *Liabilities) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
type ManageBuyOfferOp struct { Selling Asset Buying Asset BuyAmount Int64 Price Price OfferId Int64 }
ManageBuyOfferOp is an XDR Struct defines as:
struct ManageBuyOfferOp { Asset selling; Asset buying; int64 buyAmount; // amount being bought. if set to 0, delete the offer Price price; // price of thing being bought in terms of what you are // selling // 0=create a new offer, otherwise edit an existing offer int64 offerID; };
func (s ManageBuyOfferOp) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (s *ManageBuyOfferOp) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
type ManageBuyOfferResult struct { Code ManageBuyOfferResultCode Success *ManageOfferSuccessResult }
ManageBuyOfferResult is an XDR Union defines as:
union ManageBuyOfferResult switch (ManageBuyOfferResultCode code) { case MANAGE_BUY_OFFER_SUCCESS: ManageOfferSuccessResult success; default: void; };
func NewManageBuyOfferResult(code ManageBuyOfferResultCode, value interface{}) (result ManageBuyOfferResult, err error)
NewManageBuyOfferResult creates a new ManageBuyOfferResult.
func (u ManageBuyOfferResult) ArmForSwitch(sw int32) (string, bool)
ArmForSwitch returns which field name should be used for storing the value for an instance of ManageBuyOfferResult
func (u ManageBuyOfferResult) GetSuccess() (result ManageOfferSuccessResult, ok bool)
GetSuccess retrieves the Success value from the union, returning ok if the union's switch indicated the value is valid.
func (s ManageBuyOfferResult) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (u ManageBuyOfferResult) MustSuccess() ManageOfferSuccessResult
MustSuccess retrieves the Success value from the union, panicing if the value is not set.
func (u ManageBuyOfferResult) SwitchFieldName() string
SwitchFieldName returns the field name in which this union's discriminant is stored
func (s *ManageBuyOfferResult) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
ManageBuyOfferResultCode is an XDR Enum defines as:
enum ManageBuyOfferResultCode { // codes considered as "success" for the operation MANAGE_BUY_OFFER_SUCCESS = 0, // codes considered as "failure" for the operation MANAGE_BUY_OFFER_MALFORMED = -1, // generated offer would be invalid MANAGE_BUY_OFFER_SELL_NO_TRUST = -2, // no trust line for what we're selling MANAGE_BUY_OFFER_BUY_NO_TRUST = -3, // no trust line for what we're buying MANAGE_BUY_OFFER_SELL_NOT_AUTHORIZED = -4, // not authorized to sell MANAGE_BUY_OFFER_BUY_NOT_AUTHORIZED = -5, // not authorized to buy MANAGE_BUY_OFFER_LINE_FULL = -6, // can't receive more of what it's buying MANAGE_BUY_OFFER_UNDERFUNDED = -7, // doesn't hold what it's trying to sell MANAGE_BUY_OFFER_CROSS_SELF = -8, // would cross an offer from the same user MANAGE_BUY_OFFER_SELL_NO_ISSUER = -9, // no issuer for what we're selling MANAGE_BUY_OFFER_BUY_NO_ISSUER = -10, // no issuer for what we're buying // update errors MANAGE_BUY_OFFER_NOT_FOUND = -11, // offerID does not match an existing offer MANAGE_BUY_OFFER_LOW_RESERVE = -12 // not enough funds to create a new Offer };
const ( ManageBuyOfferResultCodeManageBuyOfferSuccess ManageBuyOfferResultCode = 0 ManageBuyOfferResultCodeManageBuyOfferMalformed ManageBuyOfferResultCode = -1 ManageBuyOfferResultCodeManageBuyOfferSellNoTrust ManageBuyOfferResultCode = -2 ManageBuyOfferResultCodeManageBuyOfferBuyNoTrust ManageBuyOfferResultCode = -3 ManageBuyOfferResultCodeManageBuyOfferSellNotAuthorized ManageBuyOfferResultCode = -4 ManageBuyOfferResultCodeManageBuyOfferBuyNotAuthorized ManageBuyOfferResultCode = -5 ManageBuyOfferResultCodeManageBuyOfferLineFull ManageBuyOfferResultCode = -6 ManageBuyOfferResultCodeManageBuyOfferUnderfunded ManageBuyOfferResultCode = -7 ManageBuyOfferResultCodeManageBuyOfferCrossSelf ManageBuyOfferResultCode = -8 ManageBuyOfferResultCodeManageBuyOfferSellNoIssuer ManageBuyOfferResultCode = -9 ManageBuyOfferResultCodeManageBuyOfferBuyNoIssuer ManageBuyOfferResultCode = -10 ManageBuyOfferResultCodeManageBuyOfferNotFound ManageBuyOfferResultCode = -11 ManageBuyOfferResultCodeManageBuyOfferLowReserve ManageBuyOfferResultCode = -12 )
func (s ManageBuyOfferResultCode) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (e ManageBuyOfferResultCode) String() string
String returns the name of `e`
func (s *ManageBuyOfferResultCode) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
func (e ManageBuyOfferResultCode) ValidEnum(v int32) bool
ValidEnum validates a proposed value for this enum. Implements the Enum interface for ManageBuyOfferResultCode
ManageDataOp is an XDR Struct defines as:
struct ManageDataOp { string64 dataName; DataValue* dataValue; // set to null to clear };
func (s ManageDataOp) GoString() string
GoString implements fmt.GoStringer.
func (s ManageDataOp) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (s *ManageDataOp) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
type ManageDataResult struct { Code ManageDataResultCode }
ManageDataResult is an XDR Union defines as:
union ManageDataResult switch (ManageDataResultCode code) { case MANAGE_DATA_SUCCESS: void; default: void; };
func NewManageDataResult(code ManageDataResultCode, value interface{}) (result ManageDataResult, err error)
NewManageDataResult creates a new ManageDataResult.
func (u ManageDataResult) ArmForSwitch(sw int32) (string, bool)
ArmForSwitch returns which field name should be used for storing the value for an instance of ManageDataResult
func (s ManageDataResult) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (u ManageDataResult) SwitchFieldName() string
SwitchFieldName returns the field name in which this union's discriminant is stored
func (s *ManageDataResult) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
ManageDataResultCode is an XDR Enum defines as:
enum ManageDataResultCode { // codes considered as "success" for the operation MANAGE_DATA_SUCCESS = 0, // codes considered as "failure" for the operation MANAGE_DATA_NOT_SUPPORTED_YET = -1, // The network hasn't moved to this protocol change yet MANAGE_DATA_NAME_NOT_FOUND = -2, // Trying to remove a Data Entry that isn't there MANAGE_DATA_LOW_RESERVE = -3, // not enough funds to create a new Data Entry MANAGE_DATA_INVALID_NAME = -4 // Name not a valid string };
const ( ManageDataResultCodeManageDataSuccess ManageDataResultCode = 0 ManageDataResultCodeManageDataNotSupportedYet ManageDataResultCode = -1 ManageDataResultCodeManageDataNameNotFound ManageDataResultCode = -2 ManageDataResultCodeManageDataLowReserve ManageDataResultCode = -3 ManageDataResultCodeManageDataInvalidName ManageDataResultCode = -4 )
func (s ManageDataResultCode) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (e ManageDataResultCode) String() string
String returns the name of `e`
func (s *ManageDataResultCode) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
func (e ManageDataResultCode) ValidEnum(v int32) bool
ValidEnum validates a proposed value for this enum. Implements the Enum interface for ManageDataResultCode
ManageOfferEffect is an XDR Enum defines as:
enum ManageOfferEffect { MANAGE_OFFER_CREATED = 0, MANAGE_OFFER_UPDATED = 1, MANAGE_OFFER_DELETED = 2 };
const ( ManageOfferEffectManageOfferCreated ManageOfferEffect = 0 ManageOfferEffectManageOfferUpdated ManageOfferEffect = 1 ManageOfferEffectManageOfferDeleted ManageOfferEffect = 2 )
func (s ManageOfferEffect) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (e ManageOfferEffect) String() string
String returns the name of `e`
func (s *ManageOfferEffect) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
func (e ManageOfferEffect) ValidEnum(v int32) bool
ValidEnum validates a proposed value for this enum. Implements the Enum interface for ManageOfferEffect
type ManageOfferSuccessResult struct { OffersClaimed []ClaimOfferAtom Offer ManageOfferSuccessResultOffer }
ManageOfferSuccessResult is an XDR Struct defines as:
struct ManageOfferSuccessResult { // offers that got claimed while creating this offer ClaimOfferAtom offersClaimed<>; union switch (ManageOfferEffect effect) { case MANAGE_OFFER_CREATED: case MANAGE_OFFER_UPDATED: OfferEntry offer; default: void; } offer; };
func (s ManageOfferSuccessResult) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (s *ManageOfferSuccessResult) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
type ManageOfferSuccessResultOffer struct { Effect ManageOfferEffect Offer *OfferEntry }
ManageOfferSuccessResultOffer is an XDR NestedUnion defines as:
union switch (ManageOfferEffect effect) { case MANAGE_OFFER_CREATED: case MANAGE_OFFER_UPDATED: OfferEntry offer; default: void; }
func NewManageOfferSuccessResultOffer(effect ManageOfferEffect, value interface{}) (result ManageOfferSuccessResultOffer, err error)
NewManageOfferSuccessResultOffer creates a new ManageOfferSuccessResultOffer.
func (u ManageOfferSuccessResultOffer) ArmForSwitch(sw int32) (string, bool)
ArmForSwitch returns which field name should be used for storing the value for an instance of ManageOfferSuccessResultOffer
func (u ManageOfferSuccessResultOffer) GetOffer() (result OfferEntry, ok bool)
GetOffer retrieves the Offer value from the union, returning ok if the union's switch indicated the value is valid.
func (s ManageOfferSuccessResultOffer) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (u ManageOfferSuccessResultOffer) MustOffer() OfferEntry
MustOffer retrieves the Offer value from the union, panicing if the value is not set.
func (u ManageOfferSuccessResultOffer) SwitchFieldName() string
SwitchFieldName returns the field name in which this union's discriminant is stored
func (s *ManageOfferSuccessResultOffer) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
type ManageSellOfferOp struct { Selling Asset Buying Asset Amount Int64 Price Price OfferId Int64 }
ManageSellOfferOp is an XDR Struct defines as:
struct ManageSellOfferOp { Asset selling; Asset buying; int64 amount; // amount being sold. if set to 0, delete the offer Price price; // price of thing being sold in terms of what you are buying // 0=create a new offer, otherwise edit an existing offer int64 offerID; };
func (s ManageSellOfferOp) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (s *ManageSellOfferOp) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
type ManageSellOfferResult struct { Code ManageSellOfferResultCode Success *ManageOfferSuccessResult }
ManageSellOfferResult is an XDR Union defines as:
union ManageSellOfferResult switch (ManageSellOfferResultCode code) { case MANAGE_SELL_OFFER_SUCCESS: ManageOfferSuccessResult success; default: void; };
func NewManageSellOfferResult(code ManageSellOfferResultCode, value interface{}) (result ManageSellOfferResult, err error)
NewManageSellOfferResult creates a new ManageSellOfferResult.
func (u ManageSellOfferResult) ArmForSwitch(sw int32) (string, bool)
ArmForSwitch returns which field name should be used for storing the value for an instance of ManageSellOfferResult
func (u ManageSellOfferResult) GetSuccess() (result ManageOfferSuccessResult, ok bool)
GetSuccess retrieves the Success value from the union, returning ok if the union's switch indicated the value is valid.
func (s ManageSellOfferResult) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (u ManageSellOfferResult) MustSuccess() ManageOfferSuccessResult
MustSuccess retrieves the Success value from the union, panicing if the value is not set.
func (u ManageSellOfferResult) SwitchFieldName() string
SwitchFieldName returns the field name in which this union's discriminant is stored
func (s *ManageSellOfferResult) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
ManageSellOfferResultCode is an XDR Enum defines as:
enum ManageSellOfferResultCode { // codes considered as "success" for the operation MANAGE_SELL_OFFER_SUCCESS = 0, // codes considered as "failure" for the operation MANAGE_SELL_OFFER_MALFORMED = -1, // generated offer would be invalid MANAGE_SELL_OFFER_SELL_NO_TRUST = -2, // no trust line for what we're selling MANAGE_SELL_OFFER_BUY_NO_TRUST = -3, // no trust line for what we're buying MANAGE_SELL_OFFER_SELL_NOT_AUTHORIZED = -4, // not authorized to sell MANAGE_SELL_OFFER_BUY_NOT_AUTHORIZED = -5, // not authorized to buy MANAGE_SELL_OFFER_LINE_FULL = -6, // can't receive more of what it's buying MANAGE_SELL_OFFER_UNDERFUNDED = -7, // doesn't hold what it's trying to sell MANAGE_SELL_OFFER_CROSS_SELF = -8, // would cross an offer from the same user MANAGE_SELL_OFFER_SELL_NO_ISSUER = -9, // no issuer for what we're selling MANAGE_SELL_OFFER_BUY_NO_ISSUER = -10, // no issuer for what we're buying // update errors MANAGE_SELL_OFFER_NOT_FOUND = -11, // offerID does not match an existing offer MANAGE_SELL_OFFER_LOW_RESERVE = -12 // not enough funds to create a new Offer };
const ( ManageSellOfferResultCodeManageSellOfferSuccess ManageSellOfferResultCode = 0 ManageSellOfferResultCodeManageSellOfferMalformed ManageSellOfferResultCode = -1 ManageSellOfferResultCodeManageSellOfferSellNoTrust ManageSellOfferResultCode = -2 ManageSellOfferResultCodeManageSellOfferBuyNoTrust ManageSellOfferResultCode = -3 ManageSellOfferResultCodeManageSellOfferSellNotAuthorized ManageSellOfferResultCode = -4 ManageSellOfferResultCodeManageSellOfferBuyNotAuthorized ManageSellOfferResultCode = -5 ManageSellOfferResultCodeManageSellOfferLineFull ManageSellOfferResultCode = -6 ManageSellOfferResultCodeManageSellOfferUnderfunded ManageSellOfferResultCode = -7 ManageSellOfferResultCodeManageSellOfferCrossSelf ManageSellOfferResultCode = -8 ManageSellOfferResultCodeManageSellOfferSellNoIssuer ManageSellOfferResultCode = -9 ManageSellOfferResultCodeManageSellOfferBuyNoIssuer ManageSellOfferResultCode = -10 ManageSellOfferResultCodeManageSellOfferNotFound ManageSellOfferResultCode = -11 ManageSellOfferResultCodeManageSellOfferLowReserve ManageSellOfferResultCode = -12 )
func (s ManageSellOfferResultCode) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (e ManageSellOfferResultCode) String() string
String returns the name of `e`
func (s *ManageSellOfferResultCode) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
func (e ManageSellOfferResultCode) ValidEnum(v int32) bool
ValidEnum validates a proposed value for this enum. Implements the Enum interface for ManageSellOfferResultCode
type Memo struct { Type MemoType Text *string `xdrmaxsize:"28"` Id *Uint64 Hash *Hash RetHash *Hash }
Memo is an XDR Union defines as:
union Memo switch (MemoType type) { case MEMO_NONE: void; case MEMO_TEXT: string text<28>; case MEMO_ID: uint64 id; case MEMO_HASH: Hash hash; // the hash of what to pull from the content server case MEMO_RETURN: Hash retHash; // the hash of the tx you are rejecting };
NewMemo creates a new Memo.
ArmForSwitch returns which field name should be used for storing the value for an instance of Memo
GetHash retrieves the Hash 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.
GetRetHash retrieves the RetHash 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.
GoString implements fmt.GoStringer.
MarshalBinary implements encoding.BinaryMarshaler.
MustHash retrieves the Hash 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.
MustRetHash retrieves the RetHash 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.
SwitchFieldName returns the field name in which this union's discriminant is stored
UnmarshalBinary implements encoding.BinaryUnmarshaler.
MemoType is an XDR Enum defines as:
enum MemoType { MEMO_NONE = 0, MEMO_TEXT = 1, MEMO_ID = 2, MEMO_HASH = 3, MEMO_RETURN = 4 };
const ( MemoTypeMemoNone MemoType = 0 MemoTypeMemoText MemoType = 1 MemoTypeMemoId MemoType = 2 MemoTypeMemoHash MemoType = 3 MemoTypeMemoReturn MemoType = 4 )
MarshalBinary implements encoding.BinaryMarshaler.
String returns the name of `e`
UnmarshalBinary implements encoding.BinaryUnmarshaler.
ValidEnum validates a proposed value for this enum. Implements the Enum interface for MemoType
MessageType is an XDR Enum defines as:
enum MessageType { ERROR_MSG = 0, AUTH = 2, DONT_HAVE = 3, GET_PEERS = 4, // gets a list of peers this guy knows about PEERS = 5, GET_TX_SET = 6, // gets a particular txset by hash TX_SET = 7, TRANSACTION = 8, // pass on a tx you have heard about // SCP GET_SCP_QUORUMSET = 9, SCP_QUORUMSET = 10, SCP_MESSAGE = 11, GET_SCP_STATE = 12, // new messages HELLO = 13, SURVEY_REQUEST = 14, SURVEY_RESPONSE = 15 };
const ( MessageTypeErrorMsg MessageType = 0 MessageTypeAuth MessageType = 2 MessageTypeDontHave MessageType = 3 MessageTypeGetPeers MessageType = 4 MessageTypePeers MessageType = 5 MessageTypeGetTxSet MessageType = 6 MessageTypeTxSet MessageType = 7 MessageTypeTransaction MessageType = 8 MessageTypeGetScpQuorumset MessageType = 9 MessageTypeScpQuorumset MessageType = 10 MessageTypeScpMessage MessageType = 11 MessageTypeGetScpState MessageType = 12 MessageTypeHello MessageType = 13 MessageTypeSurveyRequest MessageType = 14 MessageTypeSurveyResponse MessageType = 15 )
func (s MessageType) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (e MessageType) String() string
String returns the name of `e`
func (s *MessageType) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
func (e MessageType) ValidEnum(v int32) bool
ValidEnum validates a proposed value for this enum. Implements the Enum interface for MessageType
type MuxedAccount struct { Type CryptoKeyType Ed25519 *Uint256 Med25519 *MuxedAccountMed25519 }
MuxedAccount is an XDR Union defines as:
union MuxedAccount switch (CryptoKeyType type) { case KEY_TYPE_ED25519: uint256 ed25519; case KEY_TYPE_MUXED_ED25519: struct { uint64 id; uint256 ed25519; } med25519; };
func MustMuxedAddress(address string) MuxedAccount
func MustMuxedAddressPtr(address string) *MuxedAccount
func NewMuxedAccount(aType CryptoKeyType, value interface{}) (result MuxedAccount, err error)
NewMuxedAccount creates a new MuxedAccount.
func (u MuxedAccount) ArmForSwitch(sw int32) (string, bool)
ArmForSwitch returns which field name should be used for storing the value for an instance of MuxedAccount
func (u MuxedAccount) GetEd25519() (result Uint256, ok bool)
GetEd25519 retrieves the Ed25519 value from the union, returning ok if the union's switch indicated the value is valid.
func (u MuxedAccount) GetMed25519() (result MuxedAccountMed25519, ok bool)
GetMed25519 retrieves the Med25519 value from the union, returning ok if the union's switch indicated the value is valid.
func (m MuxedAccount) GoString() string
GoString implements fmt.GoStringer.
func (s MuxedAccount) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (u MuxedAccount) MustEd25519() Uint256
MustEd25519 retrieves the Ed25519 value from the union, panicing if the value is not set.
func (u MuxedAccount) MustMed25519() MuxedAccountMed25519
MustMed25519 retrieves the Med25519 value from the union, panicing if the value is not set.
func (m *MuxedAccount) SetAddress(address string) error
SetAddress modifies the receiver, setting it's value to the MuxedAccount form of the provided address.
func (u MuxedAccount) SwitchFieldName() string
SwitchFieldName returns the field name in which this union's discriminant is stored
func (m MuxedAccount) ToAccountId() AccountId
ToAccountId transforms a MuxedAccount to an AccountId, dropping the memo Id if necessary
func (s *MuxedAccount) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
MuxedAccountMed25519 is an XDR NestedStruct defines as:
struct { uint64 id; uint256 ed25519; }
func (s MuxedAccountMed25519) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (s *MuxedAccountMed25519) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
NodeId is an XDR Typedef defines as:
typedef PublicKey NodeID;
func NewNodeId(aType PublicKeyType, value interface{}) (result NodeId, err error)
NewNodeId creates a new NodeId.
ArmForSwitch returns which field name should be used for storing the value for an instance of PublicKey
GetEd25519 retrieves the Ed25519 value from the union, returning ok if the union's switch indicated the value is valid.
MarshalBinary implements encoding.BinaryMarshaler.
MustEd25519 retrieves the Ed25519 value from the union, panicing if the value is not set.
SwitchFieldName returns the field name in which this union's discriminant is stored
UnmarshalBinary implements encoding.BinaryUnmarshaler.
type OfferEntry struct { SellerId AccountId OfferId Int64 Selling Asset Buying Asset Amount Int64 Price Price Flags Uint32 Ext OfferEntryExt }
OfferEntry is an XDR Struct defines as:
struct OfferEntry { AccountID sellerID; int64 offerID; Asset selling; // A Asset buying; // B int64 amount; // amount of A /* price for this offer: price of A in terms of B price=AmountB/AmountA=priceNumerator/priceDenominator price is after fees */ Price price; uint32 flags; // see OfferEntryFlags // reserved for future use union switch (int v) { case 0: void; } ext; };
func (s OfferEntry) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (s *OfferEntry) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
OfferEntryExt is an XDR NestedUnion defines as:
union switch (int v) { case 0: void; }
func NewOfferEntryExt(v int32, value interface{}) (result OfferEntryExt, err error)
NewOfferEntryExt creates a new OfferEntryExt.
func (u OfferEntryExt) ArmForSwitch(sw int32) (string, bool)
ArmForSwitch returns which field name should be used for storing the value for an instance of OfferEntryExt
func (s OfferEntryExt) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (u OfferEntryExt) SwitchFieldName() string
SwitchFieldName returns the field name in which this union's discriminant is stored
func (s *OfferEntryExt) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
OfferEntryFlags is an XDR Enum defines as:
enum OfferEntryFlags { // issuer has authorized account to perform transactions with its credit PASSIVE_FLAG = 1 };
const ( OfferEntryFlagsPassiveFlag OfferEntryFlags = 1 )
func (s OfferEntryFlags) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (e OfferEntryFlags) String() string
String returns the name of `e`
func (s *OfferEntryFlags) UnmarshalBinary(inp []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
func (e OfferEntryFlags) ValidEnum(v int32) bool
ValidEnum validates a proposed value for this enum. Implements the Enum interface for OfferEntryFlags
type Operation struct { SourceAccount *MuxedAccount Body OperationBody }
Operation is an XDR Struct defines as:
struct Operation { // sourceAccount is the account used to run the operation // if not set, the runtime defaults to "sourceAccount" specified at // the transaction level MuxedAccount* sourceAccount; union switch (OperationType type) { case CREATE_ACCOUNT: CreateAccountOp createAccountOp; case PAYMENT: PaymentOp paymentOp; case PATH_PAYMENT_STRICT_RECEIVE: PathPaymentStrictReceiveOp pathPaymentStrictReceiveOp; case MANAGE_SELL_OFFER: ManageSellOfferOp manageSellOfferOp; case CREATE_PASSIVE_SELL_OFFER: CreatePassiveSellOfferOp createPassiveSellOfferOp; case SET_OPTIONS: SetOptionsOp setOptionsOp; case CHANGE_TRUST: ChangeTrustOp changeTrustOp; case ALLOW_TRUST: AllowTrustOp allowTrustOp; case ACCOUNT_MERGE: MuxedAccount destination; case INFLATION: void; case MANAGE_DATA: ManageDataOp manageDataOp; case BUMP_SEQUENCE: BumpSequenceOp bumpSequenceOp; case MANAGE_BUY_OFFER: ManageBuyOfferOp manageBuyOfferOp; case PATH_PAYMENT_STRICT_SEND: PathPaymentStrictSendOp pathPaymentStrictSendOp; case CREATE_CLAIMABLE_BALANCE: CreateClaimableBalanceOp createClaimableBalanceOp; case CLAIM_CLAIMABLE_BALANCE: ClaimClaimableBalanceOp claimClaimableBalanceOp; case BEGIN_SPONSORING_FUTURE_RESERVES: BeginSponsoringFutureReservesOp beginSponsoringFutureReservesOp; case END_SPONSORING_FUTURE_RESERVES: void; case REVOKE_SPONSORSHIP: RevokeSponsorshipOp revokeSponsorshipOp; } body; };
GoString implements fmt.GoStringer.
MarshalBinary implements encoding.BinaryMarshaler.
UnmarshalBinary implements encoding.BinaryUnmarshaler.
type OperationBody struct { Type OperationType CreateAccountOp *CreateAccountOp PaymentOp *PaymentOp PathPaymentStrictReceiveOp *PathPaymentStrictReceiveOp ManageSellOfferOp *ManageSellOfferOp CreatePassiveSellOfferOp *CreatePassiveSellOfferOp SetOptionsOp *SetOptionsOp ChangeTrustOp *ChangeTrustOp AllowTrustOp *AllowTrustOp Destination *MuxedAccount ManageDataOp *ManageDataOp BumpSequenceOp *BumpSequenceOp ManageBuyOfferOp *ManageBuyOfferOp PathPaymentStrictSendOp *PathPaymentStrictSendOp CreateClaimableBalanceOp *CreateClaimableBalanceOp ClaimClaimableBalanceOp *ClaimClaimableBalanceOp BeginSponsoringFutureReservesOp *BeginSponsoringFutureReservesOp RevokeSponsorshipOp *RevokeSponsorshipOp }
OperationBody is an XDR NestedUnion defines as:
union switch (OperationType type) { case CREATE_ACCOUNT: CreateAccountOp createAccountOp; case PAYMENT: PaymentOp paymentOp; case PATH_PAYMENT_STRICT_RECEIVE: PathPaymentStrictReceiveOp pathPaymentStrictReceiveOp; case MANAGE_SELL_OFFER: ManageSellOfferOp manageSellOfferOp; case CREATE_PASSIVE_SELL_OFFER: CreatePassiveSellOfferOp createPassiveSellOfferOp; case SET_OPTIONS: SetOptionsOp setOptionsOp; case CHANGE_TRUST: ChangeTrustOp changeTrustOp; case ALLOW_TRUST: AllowTrustOp allowTrustOp; case ACCOUNT_MERGE: MuxedAccount destination; case INFLATION: void; case MANAGE_DATA: ManageDataOp manageDataOp; case BUMP_SEQUENCE: BumpSequenceOp bumpSequenceOp; case MANAGE_BUY_OFFER: ManageBuyOfferOp manageBuyOfferOp; case PATH_PAYMENT_STRICT_SEND: PathPaymentStrictSendOp pathPaymentStrictSendOp; case CREATE_CLAIMABLE_BALANCE: CreateClaimableBalanceOp createClaimableBalanceOp; case CLAIM_CLAIMABLE_BALANCE: ClaimClaimableBalanceOp claimClaimableBalanceOp; case BEGIN_SPONSORING_FUTURE_RESERVES: BeginSponsoringFutureReservesOp beginSponsoringFutureReservesOp; case END_SPONSORING_FUTURE_RESERVES: void; case REVOKE_SPONSORSHIP: RevokeSponsorshipOp revokeSponsorshipOp; }
func NewOperationBody(aType OperationType, value interface{}) (result OperationBody, err error)
NewOperationBody creates a new OperationBody.
func (u OperationBody) ArmForSwitch(sw int32) (string, bool)
ArmForSwitch returns which field name should be used for storing the value for an instance of OperationBody
func (u OperationBody) GetAllowTrustOp() (result AllowTrustOp, ok bool)
GetAllowTrustOp retrieves the AllowTrustOp value from the union, returning ok if the union's switch indicated the value is valid.
func (u OperationBody) GetBeginSponsoringFutureReservesOp() (result BeginSponsoringFutureReservesOp, ok bool)
GetBeginSponsoringFutureReservesOp retrieves the BeginSponsoringFutureReservesOp value from the union, returning ok if the union's switch indicated the value is valid.
func (u OperationBody) GetBumpSequenceOp() (result BumpSequenceOp, ok bool)
GetBumpSequenceOp retrieves the BumpSequenceOp value from the union, returning ok if the union's switch indicated the value is valid.
func (u OperationBody) GetChangeTrustOp() (result ChangeTrustOp, ok bool)
GetChangeTrustOp retrieves the ChangeTrustOp value from the union, returning ok if the union's switch indicated the value is valid.
func (u OperationBody) GetClaimClaimableBalanceOp() (result ClaimClaimableBalanceOp, ok bool)
GetClaimClaimableBalanceOp retrieves the ClaimClaimableBalanceOp value from the union, returning ok if the union's switch indicated the value is valid.
func (u OperationBody) GetCreateAccountOp() (result CreateAccountOp, ok bool)
GetCreateAccountOp retrieves the CreateAccountOp value from the union, returning ok if the union's switch indicated the value is valid.
func (u OperationBody) GetCreateClaimableBalanceOp() (result CreateClaimableBalanceOp, ok bool)
GetCreateClaimableBalanceOp retrieves the CreateClaimableBalanceOp value from the union, returning ok if the union's switch indicated the value is valid.
func (u OperationBody) GetCreatePassiveSellOfferOp() (result CreatePassiveSellOfferOp, ok bool)
GetCreatePassiveSellOfferOp retrieves the CreatePassiveSellOfferOp value from the union, returning ok if the union's switch indicated the value is valid.
func (u OperationBody) GetDestination() (result MuxedAccount, ok bool)
GetDestination retrieves the Destination value from the union, returning ok if the union's switch indicated the value is valid.
func (u OperationBody) GetManageBuyOfferOp() (result ManageBuyOfferOp, ok bool)
GetManageBuyOfferOp retrieves the ManageBuyOfferOp value from the union, returning ok if the union's switch indicated the value is valid.
func (u OperationBody) GetManageDataOp() (result ManageDataOp, ok bool)
GetManageDataOp retrieves the ManageDataOp value from the union, returning ok if the union's switch indicated the value is valid.
func (u OperationBody) GetManageSellOfferOp() (result ManageSellOfferOp, ok bool)
GetManageSellOfferOp retrieves the ManageSellOfferOp value from the union, returning ok if the union's switch indicated the value is valid.
func (u OperationBody) GetPathPaymentStrictReceiveOp() (result PathPaymentStrictReceiveOp, ok bool)
GetPathPaymentStrictReceiveOp retrieves the PathPaymentStrictReceiveOp value from the union, returning ok if the union's switch indicated the value is valid.
func (u OperationBody) GetPathPaymentStrictSendOp() (result PathPaymentStrictSendOp, ok bool)
GetPathPaymentStrictSendOp retrieves the PathPaymentStrictSendOp value from the union, returning ok if the union's switch indicated the value is valid.
func (u OperationBody) GetPaymentOp() (result PaymentOp, ok bool)
GetPaymentOp retrieves the PaymentOp value from the union, returning ok if the union's switch indicated the value is valid.
func (u OperationBody) GetRevokeSponsorshipOp() (result RevokeSponsorshipOp, ok bool)
GetRevokeSponsorshipOp retrieves the RevokeSponsorshipOp value from the union, returning ok if the union's switch indicated the value is valid.
func (u OperationBody) GetSetOptionsOp() (result SetOptionsOp, ok bool)
GetSetOptionsOp retrieves the SetOptionsOp value from the union, returning ok if the union's switch indicated the value is valid.
func (o OperationBody) GoString() string
GoString implements fmt.GoStringer.
func (s OperationBody) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (u OperationBody) MustAllowTrustOp() AllowTrustOp
MustAllowTrustOp retrieves the AllowTrustOp value from the union, panicing if the value is not set.
func (u OperationBody) MustBeginSponsoringFutureReservesOp() BeginSponsoringFutureReservesOp
MustBeginSponsoringFutureReservesOp retrieves the BeginSponsoringFutureReservesOp value from the union, panicing if the value is not set.
func (u OperationBody) MustBumpSequenceOp() BumpSequenceOp
MustBumpSequenceOp retrieves the BumpSequenceOp value from the union, panicing if the value is not set.
func (u OperationBody) MustChangeTrustOp() ChangeTrustOp
MustChangeTrustOp retrieves the ChangeTrustOp value from the union, panicing if the value is not set.
func (u OperationBody) MustClaimClaimableBalanceOp() ClaimClaimableBalanceOp
MustClaimClaimableBalanceOp retrieves the ClaimClaimableBalanceOp value from the union, panicing if the value is not set.
func (u OperationBody) MustCreateAccountOp() CreateAccountOp
MustCreateAccountOp retrieves the CreateAccountOp value from the union, panicing if the value is not set.
func (u OperationBody) MustCreateClaimableBalanceOp() CreateClaimableBalanceOp
MustCreateClaimableBalanceOp retrieves the CreateClaimableBalanceOp value from the union, panicing if the value is not set.
func (u OperationBody) MustCreatePassiveSellOfferOp() CreatePassiveSellOfferOp
MustCreatePassiveSellOfferOp retrieves the CreatePassiveSellOfferOp value from the union, panicing if the value is not set.
func (u OperationBody) MustDestination() MuxedAccount
MustDestination retrieves the Destination value from the union, panicing if the value is not set.
func (u OperationBody) MustManageBuyOfferOp() ManageBuyOfferOp
MustManageBuyOfferOp retrieves the ManageBuyOfferOp value from the union, panicing if the value is not set.
func (u OperationBody) MustManageDataOp() ManageDataOp
MustManageDataOp retrieves the ManageDataOp value from the union, panicing if the value is not set.
func (u OperationBody) MustManageSellOfferOp() ManageSellOfferOp
MustManageSellOfferOp retrieves the ManageSellOfferOp value from the union, panicing if the value is not set.
func (u OperationBody) MustPathPaymentStrictReceiveOp() PathPaymentStrictReceiveOp
MustPathPaymentStrictReceiveOp retrieves the PathPaymentStrictReceiveOp value from the union, panicing if the value is not set.
func (u OperationBody) MustPathPaymentStrictSendOp() PathPaymentStrictSendOp
MustPathPaymentStrictSendOp retrieves the PathPaymentStrictSendOp value from the union, panicing if the value is not set.
func (u OperationBody) MustPaymentOp() PaymentOp
MustPaymentOp retrieves the PaymentOp value from the union, panicing if the value is not set.
func (u OperationBody) MustRevokeSponsorshipOp() RevokeSponsorshipOp
MustRevokeSponsorshipOp retrieves the RevokeSponsorshipOp value from the union, panicing if the value is not set.
func (u OperationBody) MustSetOptionsOp() SetOptionsOp
MustSetOptionsOp retrieves the SetOptionsOp value from the union, panicing if the value is not set.