xdr

package
Version: v0.0.0-...-fb9541f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 27, 2020 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package xdr contains the generated code for parsing the xdr structures used for paydex.

Package xdr is generated from:

Paydex-SCP.x
Paydex-ledger-entries.x
Paydex-ledger.x
Paydex-overlay.x
Paydex-transaction.x
Paydex-types.x

DO NOT EDIT or your changes may be overwritten

Index

Examples

Constants

View Source
const MaskAccountFlags = 0x7

MaskAccountFlags is an XDR Const defines as:

const MASK_ACCOUNT_FLAGS = 0x7;
View Source
const MaskOfferentryFlags = 1

MaskOfferentryFlags is an XDR Const defines as:

const MASK_OFFERENTRY_FLAGS = 1;
View Source
const MaskTrustlineFlags = 1

MaskTrustlineFlags is an XDR Const defines as:

const MASK_TRUSTLINE_FLAGS = 1;
View Source
const MaxOpsPerTx = 100

MaxOpsPerTx is an XDR Const defines as:

const MAX_OPS_PER_TX = 100;

Variables

View Source
var AssetTypeToString = map[AssetType]string{
	AssetTypeAssetTypeNative:           "native",
	AssetTypeAssetTypeCreditAlphanum4:  "credit_alphanum4",
	AssetTypeAssetTypeCreditAlphanum12: "credit_alphanum12",
}

AssetTypeToString maps an xdr.AssetType to its string representation

View Source
var StringToAssetType = map[string]AssetType{
	"native":            AssetTypeAssetTypeNative,
	"credit_alphanum4":  AssetTypeAssetTypeCreditAlphanum4,
	"credit_alphanum12": AssetTypeAssetTypeCreditAlphanum12,
}

StringToAssetType maps an strings to its xdr.AssetType representation

View Source
var ValidAssetCode = regexp.MustCompile("^[[:alnum:]]{1,12}$")

Functions

func Marshal

func Marshal(w io.Writer, v interface{}) (int, error)

Marshal writes an xdr element `v` into `w`.

func MarshalBase64

func MarshalBase64(v interface{}) (string, error)

func SafeUnmarshal

func SafeUnmarshal(data []byte, dest interface{}) error

SafeUnmarshal decodes the provided reader into the destination and verifies that provided bytes are all consumed by the unmarshalling process.

func SafeUnmarshalBase64

func SafeUnmarshalBase64(data string, dest interface{}) error

SafeUnmarshalBase64 first decodes the provided reader from base64 before decoding the xdr into the provided destination. Also ensures that the reader is fully consumed.

func Unmarshal

func Unmarshal(r io.Reader, v interface{}) (int, error)

Unmarshal reads an xdr element from `r` into `v`.

Example

ExampleUnmarshal shows the lowest-level process to decode a base64 envelope encoded in base64.

package main

import (
	"encoding/base64"
	"fmt"
	"log"
	"strings"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

// ExampleUnmarshal shows the lowest-level process to decode a base64
// envelope encoded in base64.
func main() {
	data := "AAAAAGL8HQvQkbK2HA3WVjRrKmjX00fG8sLI7m0ERwJW/AX3AAAACgAAAAAAAAABAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAArqN6LeOagjxMaUP96Bzfs9e0corNZXzBWJkFoK7kvkwAAAAAO5rKAAAAAAAAAAABVvwF9wAAAEAKZ7IPj/46PuWU6ZOtyMosctNAkXRNX9WCAI5RnfRk+AyxDLoDZP/9l3NvsxQtWj9juQOuoBlFLnWu8intgxQA"

	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)
	}

	fmt.Printf("This tx has %d operations\n", len(tx.Tx.Operations))
}

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())
		})
	})
})
Output:

read 192 bytes
This tx has 1 operations

Types

type AccountEntry

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<20>; // possible signers for this account

     // reserved for future use
     union switch (int v)
     {
     case 0:
         void;
     case 1:
         struct
         {
             Liabilities liabilities;

             union switch (int v)
             {
             case 0:
                 void;
             }
             ext;
         } v1;
     }
     ext;
 };

func (AccountEntry) MarshalBinary

func (s AccountEntry) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (*AccountEntry) MasterKeyWeight

func (a *AccountEntry) MasterKeyWeight() byte

func (*AccountEntry) SignerSummary

func (a *AccountEntry) SignerSummary() map[string]int32

func (*AccountEntry) ThresholdHigh

func (a *AccountEntry) ThresholdHigh() byte

func (*AccountEntry) ThresholdLow

func (a *AccountEntry) ThresholdLow() byte

func (*AccountEntry) ThresholdMedium

func (a *AccountEntry) ThresholdMedium() byte

func (*AccountEntry) UnmarshalBinary

func (s *AccountEntry) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

type AccountEntryExt

type AccountEntryExt struct {
	V  int32
	V1 *AccountEntryV1
}

AccountEntryExt is an XDR NestedUnion defines as:

union switch (int v)
     {
     case 0:
         void;
     case 1:
         struct
         {
             Liabilities liabilities;

             union switch (int v)
             {
             case 0:
                 void;
             }
             ext;
         } v1;
     }

func NewAccountEntryExt

func NewAccountEntryExt(v int32, value interface{}) (result AccountEntryExt, err error)

NewAccountEntryExt creates a new AccountEntryExt.

func (AccountEntryExt) ArmForSwitch

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 (AccountEntryExt) GetV1

func (u AccountEntryExt) GetV1() (result AccountEntryV1, ok bool)

GetV1 retrieves the V1 value from the union, returning ok if the union's switch indicated the value is valid.

func (AccountEntryExt) MarshalBinary

func (s AccountEntryExt) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (AccountEntryExt) MustV1

func (u AccountEntryExt) MustV1() AccountEntryV1

MustV1 retrieves the V1 value from the union, panicing if the value is not set.

func (AccountEntryExt) SwitchFieldName

func (u AccountEntryExt) SwitchFieldName() string

SwitchFieldName returns the field name in which this union's discriminant is stored

func (*AccountEntryExt) UnmarshalBinary

func (s *AccountEntryExt) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

type AccountEntryV1

type AccountEntryV1 struct {
	Liabilities Liabilities
	Ext         AccountEntryV1Ext
}

AccountEntryV1 is an XDR NestedStruct defines as:

struct
         {
             Liabilities liabilities;

             union switch (int v)
             {
             case 0:
                 void;
             }
             ext;
         }

func (AccountEntryV1) MarshalBinary

func (s AccountEntryV1) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (*AccountEntryV1) UnmarshalBinary

func (s *AccountEntryV1) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

type AccountEntryV1Ext

type AccountEntryV1Ext struct {
	V int32
}

AccountEntryV1Ext is an XDR NestedUnion defines as:

union switch (int v)
             {
             case 0:
                 void;
             }

func NewAccountEntryV1Ext

func NewAccountEntryV1Ext(v int32, value interface{}) (result AccountEntryV1Ext, err error)

NewAccountEntryV1Ext creates a new AccountEntryV1Ext.

func (AccountEntryV1Ext) ArmForSwitch

func (u AccountEntryV1Ext) ArmForSwitch(sw int32) (string, bool)

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

func (AccountEntryV1Ext) MarshalBinary

func (s AccountEntryV1Ext) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (AccountEntryV1Ext) SwitchFieldName

func (u AccountEntryV1Ext) SwitchFieldName() string

SwitchFieldName returns the field name in which this union's discriminant is stored

func (*AccountEntryV1Ext) UnmarshalBinary

func (s *AccountEntryV1Ext) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

type AccountFlags

type AccountFlags int32

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) IsAuthImmutable

func (accountFlags AccountFlags) IsAuthImmutable() bool

IsAuthImmutable returns true if the account has the "AUTH_IMMUTABLE" option turned on.

func (AccountFlags) IsAuthRequired

func (accountFlags AccountFlags) IsAuthRequired() bool

IsAuthRequired returns true if the account has the "AUTH_REQUIRED" option turned on.

func (AccountFlags) IsAuthRevocable

func (accountFlags AccountFlags) IsAuthRevocable() bool

IsAuthRevocable returns true if the account has the "AUTH_REVOCABLE" option turned on.

func (AccountFlags) MarshalBinary

func (s AccountFlags) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (*AccountFlags) Scan

func (t *AccountFlags) Scan(src interface{}) error

Scan reads from src into an AccountFlags

func (AccountFlags) String

func (e AccountFlags) String() string

String returns the name of `e`

func (*AccountFlags) UnmarshalBinary

func (s *AccountFlags) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

func (AccountFlags) ValidEnum

func (e AccountFlags) ValidEnum(v int32) bool

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

type AccountId

type AccountId PublicKey

AccountId is an XDR Typedef defines as:

typedef PublicKey AccountID;

func AddressToAccountId

func AddressToAccountId(address string) (AccountId, error)

AddressToAccountId returns an AccountId for a given address string. If the address is not valid the error returned will not be nil

func MustAddress

func MustAddress(address string) AccountId

func NewAccountId

func NewAccountId(aType PublicKeyType, value interface{}) (result AccountId, err error)

NewAccountId creates a new AccountId.

func (*AccountId) Address

func (aid *AccountId) Address() string

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.

func (AccountId) ArmForSwitch

func (u AccountId) ArmForSwitch(sw int32) (string, bool)

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

func (*AccountId) Equals

func (aid *AccountId) Equals(other AccountId) bool

Equals returns true if `other` is equivalent to `aid`

func (AccountId) GetEd25519

func (u AccountId) 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 (*AccountId) LedgerKey

func (aid *AccountId) LedgerKey() (ret LedgerKey)

LedgerKey implements the `Keyer` interface

func (AccountId) MarshalBinary

func (s AccountId) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (AccountId) MarshalBinaryCompress

func (aid AccountId) MarshalBinaryCompress() ([]byte, error)

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!

func (AccountId) MustEd25519

func (u AccountId) MustEd25519() Uint256

MustEd25519 retrieves the Ed25519 value from the union, panicing if the value is not set.

func (*AccountId) SetAddress

func (aid *AccountId) SetAddress(address string) error

SetAddress modifies the receiver, setting it's value to the AccountId form of the provided address.

func (AccountId) SwitchFieldName

func (u AccountId) SwitchFieldName() string

SwitchFieldName returns the field name in which this union's discriminant is stored

func (*AccountId) UnmarshalBinary

func (s *AccountId) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

type AccountMergeResult

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

func NewAccountMergeResult(code AccountMergeResultCode, value interface{}) (result AccountMergeResult, err error)

NewAccountMergeResult creates a new AccountMergeResult.

func (AccountMergeResult) ArmForSwitch

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 (AccountMergeResult) GetSourceAccountBalance

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 (AccountMergeResult) MarshalBinary

func (s AccountMergeResult) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (AccountMergeResult) MustSourceAccountBalance

func (u AccountMergeResult) MustSourceAccountBalance() Int64

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

func (AccountMergeResult) SwitchFieldName

func (u AccountMergeResult) SwitchFieldName() string

SwitchFieldName returns the field name in which this union's discriminant is stored

func (*AccountMergeResult) UnmarshalBinary

func (s *AccountMergeResult) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

type AccountMergeResultCode

type AccountMergeResultCode int32

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
 };
const (
	AccountMergeResultCodeAccountMergeSuccess       AccountMergeResultCode = 0
	AccountMergeResultCodeAccountMergeMalformed     AccountMergeResultCode = -1
	AccountMergeResultCodeAccountMergeNoAccount     AccountMergeResultCode = -2
	AccountMergeResultCodeAccountMergeImmutableSet  AccountMergeResultCode = -3
	AccountMergeResultCodeAccountMergeHasSubEntries AccountMergeResultCode = -4
	AccountMergeResultCodeAccountMergeSeqnumTooFar  AccountMergeResultCode = -5
	AccountMergeResultCodeAccountMergeDestFull      AccountMergeResultCode = -6
)

func (AccountMergeResultCode) MarshalBinary

func (s AccountMergeResultCode) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (AccountMergeResultCode) String

func (e AccountMergeResultCode) String() string

String returns the name of `e`

func (*AccountMergeResultCode) UnmarshalBinary

func (s *AccountMergeResultCode) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

func (AccountMergeResultCode) ValidEnum

func (e AccountMergeResultCode) ValidEnum(v int32) bool

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

type AllowTrustOp

type AllowTrustOp struct {
	Trustor   AccountId
	Asset     AllowTrustOpAsset
	Authorize bool
}

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;

     bool authorize;
 };

func (AllowTrustOp) MarshalBinary

func (s AllowTrustOp) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (*AllowTrustOp) UnmarshalBinary

func (s *AllowTrustOp) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

type AllowTrustOpAsset

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 NewAllowTrustOpAsset

func NewAllowTrustOpAsset(aType AssetType, value interface{}) (result AllowTrustOpAsset, err error)

NewAllowTrustOpAsset creates a new AllowTrustOpAsset.

func (AllowTrustOpAsset) ArmForSwitch

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 (AllowTrustOpAsset) GetAssetCode12

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 (AllowTrustOpAsset) GetAssetCode4

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 (AllowTrustOpAsset) MarshalBinary

func (s AllowTrustOpAsset) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (AllowTrustOpAsset) MustAssetCode12

func (u AllowTrustOpAsset) MustAssetCode12() AssetCode12

MustAssetCode12 retrieves the AssetCode12 value from the union, panicing if the value is not set.

func (AllowTrustOpAsset) MustAssetCode4

func (u AllowTrustOpAsset) MustAssetCode4() AssetCode4

MustAssetCode4 retrieves the AssetCode4 value from the union, panicing if the value is not set.

func (AllowTrustOpAsset) SwitchFieldName

func (u AllowTrustOpAsset) SwitchFieldName() string

SwitchFieldName returns the field name in which this union's discriminant is stored

func (AllowTrustOpAsset) ToAsset

func (a AllowTrustOpAsset) ToAsset(issuer AccountId) (asset Asset)

ToAsset for AllowTrustOpAsset converts the xdr.AllowTrustOpAsset to a standard xdr.Asset.

func (*AllowTrustOpAsset) UnmarshalBinary

func (s *AllowTrustOpAsset) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

type AllowTrustResult

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

func NewAllowTrustResult(code AllowTrustResultCode, value interface{}) (result AllowTrustResult, err error)

NewAllowTrustResult creates a new AllowTrustResult.

func (AllowTrustResult) ArmForSwitch

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 (AllowTrustResult) MarshalBinary

func (s AllowTrustResult) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (AllowTrustResult) SwitchFieldName

func (u AllowTrustResult) SwitchFieldName() string

SwitchFieldName returns the field name in which this union's discriminant is stored

func (*AllowTrustResult) UnmarshalBinary

func (s *AllowTrustResult) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

type AllowTrustResultCode

type AllowTrustResultCode int32

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 (AllowTrustResultCode) MarshalBinary

func (s AllowTrustResultCode) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (AllowTrustResultCode) String

func (e AllowTrustResultCode) String() string

String returns the name of `e`

func (*AllowTrustResultCode) UnmarshalBinary

func (s *AllowTrustResultCode) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

func (AllowTrustResultCode) ValidEnum

func (e AllowTrustResultCode) ValidEnum(v int32) bool

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

type Asset

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
 };

func BuildAsset

func BuildAsset(assetType, issuer, code string) (Asset, error)

BuildAsset creates a new asset from a given `assetType`, `code`, and `issuer`.

Valid assetTypes are:

- `native`
- `credit_alphanum4`
- `credit_alphanum12`

func BuildAssets

func BuildAssets(s string) ([]Asset, error)

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 If the string is empty, BuildAssets will return an empty list of assets

func MustNewCreditAsset

func MustNewCreditAsset(code string, issuer string) Asset

MustNewCreditAsset returns a new general asset, panicking if it can't.

func MustNewNativeAsset

func MustNewNativeAsset() Asset

MustNewNativeAsset returns a new native asset, panicking if it can't.

func NewAsset

func NewAsset(aType AssetType, value interface{}) (result Asset, err error)

NewAsset creates a new Asset.

func (Asset) ArmForSwitch

func (u Asset) ArmForSwitch(sw int32) (string, bool)

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

func (Asset) Equals

func (a Asset) Equals(other Asset) bool

Equals returns true if `other` is equivalent to `a`

func (Asset) Extract

func (a Asset) Extract(typ interface{}, code interface{}, issuer interface{}) error

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 (Asset) GetAlphaNum12

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 (Asset) GetAlphaNum4

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.

func (Asset) MarshalBinary

func (s Asset) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (Asset) MarshalBinaryCompress

func (a Asset) MarshalBinaryCompress() ([]byte, error)

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 (Asset) MustAlphaNum12

func (u Asset) MustAlphaNum12() AssetAlphaNum12

MustAlphaNum12 retrieves the AlphaNum12 value from the union, panicing if the value is not set.

func (Asset) MustAlphaNum4

func (u Asset) MustAlphaNum4() AssetAlphaNum4

MustAlphaNum4 retrieves the AlphaNum4 value from the union, panicing if the value is not set.

func (Asset) MustExtract

func (a Asset) MustExtract(typ interface{}, code interface{}, issuer interface{})

MustExtract behaves as Extract, but panics if an error occurs.

func (*Asset) Scan

func (t *Asset) Scan(src interface{}) error

Scan reads from src into an Asset

func (*Asset) SetCredit

func (a *Asset) SetCredit(code string, issuer AccountId) error

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`.

func (*Asset) SetNative

func (a *Asset) SetNative() error

SetNative overwrites `a` with the native asset type

func (Asset) String

func (a Asset) String() string

String returns a display friendly form of the asset

func (Asset) SwitchFieldName

func (u Asset) SwitchFieldName() string

SwitchFieldName returns the field name in which this union's discriminant is stored

func (*Asset) ToAllowTrustOpAsset

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.

func (*Asset) UnmarshalBinary

func (s *Asset) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

type AssetAlphaNum12

type AssetAlphaNum12 struct {
	AssetCode AssetCode12
	Issuer    AccountId
}

AssetAlphaNum12 is an XDR NestedStruct defines as:

struct
     {
         AssetCode12 assetCode;
         AccountID issuer;
     }

func (AssetAlphaNum12) MarshalBinary

func (s AssetAlphaNum12) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (*AssetAlphaNum12) UnmarshalBinary

func (s *AssetAlphaNum12) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

type AssetAlphaNum4

type AssetAlphaNum4 struct {
	AssetCode AssetCode4
	Issuer    AccountId
}

AssetAlphaNum4 is an XDR NestedStruct defines as:

struct
     {
         AssetCode4 assetCode;
         AccountID issuer;
     }

func (AssetAlphaNum4) MarshalBinary

func (s AssetAlphaNum4) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (*AssetAlphaNum4) UnmarshalBinary

func (s *AssetAlphaNum4) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

type AssetCode12

type AssetCode12 [12]byte

AssetCode12 is an XDR Typedef defines as:

typedef opaque AssetCode12[12];

func (AssetCode12) MarshalBinary

func (s AssetCode12) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (*AssetCode12) UnmarshalBinary

func (s *AssetCode12) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

func (AssetCode12) XDRMaxSize

func (e AssetCode12) XDRMaxSize() int

XDRMaxSize implements the Sized interface for AssetCode12

type AssetCode4

type AssetCode4 [4]byte

AssetCode4 is an XDR Typedef defines as:

typedef opaque AssetCode4[4];

func (AssetCode4) MarshalBinary

func (s AssetCode4) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (*AssetCode4) UnmarshalBinary

func (s *AssetCode4) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

func (AssetCode4) XDRMaxSize

func (e AssetCode4) XDRMaxSize() int

XDRMaxSize implements the Sized interface for AssetCode4

type AssetType

type AssetType int32

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
)

func (AssetType) MarshalBinary

func (s AssetType) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (*AssetType) Scan

func (t *AssetType) Scan(src interface{}) error

Scan reads from src into an AssetType

func (AssetType) String

func (e AssetType) String() string

String returns the name of `e`

func (*AssetType) UnmarshalBinary

func (s *AssetType) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

func (AssetType) ValidEnum

func (e AssetType) ValidEnum(v int32) bool

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

type Auth

type Auth struct {
	Unused int32
}

Auth is an XDR Struct defines as:

struct Auth
 {
     // Empty message, just to confirm
     // establishment of MAC keys.
     int unused;
 };

func (Auth) MarshalBinary

func (s Auth) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (*Auth) UnmarshalBinary

func (s *Auth) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

type AuthCert

type AuthCert struct {
	Pubkey     Curve25519Public
	Expiration Uint64
	Sig        Signature
}

AuthCert is an XDR Struct defines as:

struct AuthCert
 {
     Curve25519Public pubkey;
     uint64 expiration;
     Signature sig;
 };

func (AuthCert) MarshalBinary

func (s AuthCert) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (*AuthCert) UnmarshalBinary

func (s *AuthCert) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

type AuthenticatedMessage

type AuthenticatedMessage struct {
	V  Uint32
	V0 *AuthenticatedMessageV0
}

AuthenticatedMessage is an XDR Union defines as:

union AuthenticatedMessage switch (uint32 v)
 {
 case 0:
     struct
 {
    uint64 sequence;
    PaydexMessage message;
    HmacSha256Mac mac;
     } v0;
 };

func NewAuthenticatedMessage

func NewAuthenticatedMessage(v Uint32, value interface{}) (result AuthenticatedMessage, err error)

NewAuthenticatedMessage creates a new AuthenticatedMessage.

func (AuthenticatedMessage) ArmForSwitch

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 (AuthenticatedMessage) GetV0

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 (AuthenticatedMessage) MarshalBinary

func (s AuthenticatedMessage) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (AuthenticatedMessage) MustV0

MustV0 retrieves the V0 value from the union, panicing if the value is not set.

func (AuthenticatedMessage) SwitchFieldName

func (u AuthenticatedMessage) SwitchFieldName() string

SwitchFieldName returns the field name in which this union's discriminant is stored

func (*AuthenticatedMessage) UnmarshalBinary

func (s *AuthenticatedMessage) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

type AuthenticatedMessageV0

type AuthenticatedMessageV0 struct {
	Sequence Uint64
	Message  PaydexMessage
	Mac      HmacSha256Mac
}

AuthenticatedMessageV0 is an XDR NestedStruct defines as:

struct
 {
    uint64 sequence;
    PaydexMessage message;
    HmacSha256Mac mac;
     }

func (AuthenticatedMessageV0) MarshalBinary

func (s AuthenticatedMessageV0) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (*AuthenticatedMessageV0) UnmarshalBinary

func (s *AuthenticatedMessageV0) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

type BucketEntry

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

func NewBucketEntry(aType BucketEntryType, value interface{}) (result BucketEntry, err error)

NewBucketEntry creates a new BucketEntry.

func (BucketEntry) ArmForSwitch

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 (BucketEntry) GetDeadEntry

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 (BucketEntry) GetLiveEntry

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 (BucketEntry) GetMetaEntry

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 (BucketEntry) MarshalBinary

func (s BucketEntry) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (BucketEntry) MustDeadEntry

func (u BucketEntry) MustDeadEntry() LedgerKey

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

func (BucketEntry) MustLiveEntry

func (u BucketEntry) MustLiveEntry() LedgerEntry

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

func (BucketEntry) MustMetaEntry

func (u BucketEntry) MustMetaEntry() BucketMetadata

MustMetaEntry retrieves the MetaEntry value from the union, panicing if the value is not set.

func (BucketEntry) SwitchFieldName

func (u BucketEntry) SwitchFieldName() string

SwitchFieldName returns the field name in which this union's discriminant is stored

func (*BucketEntry) UnmarshalBinary

func (s *BucketEntry) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

type BucketEntryType

type BucketEntryType int32

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 (BucketEntryType) MarshalBinary

func (s BucketEntryType) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (BucketEntryType) String

func (e BucketEntryType) String() string

String returns the name of `e`

func (*BucketEntryType) UnmarshalBinary

func (s *BucketEntryType) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

func (BucketEntryType) ValidEnum

func (e BucketEntryType) ValidEnum(v int32) bool

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

type BucketMetadata

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 (BucketMetadata) MarshalBinary

func (s BucketMetadata) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (*BucketMetadata) UnmarshalBinary

func (s *BucketMetadata) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

type BucketMetadataExt

type BucketMetadataExt struct {
	V int32
}

BucketMetadataExt is an XDR NestedUnion defines as:

union switch (int v)
     {
     case 0:
         void;
     }

func NewBucketMetadataExt

func NewBucketMetadataExt(v int32, value interface{}) (result BucketMetadataExt, err error)

NewBucketMetadataExt creates a new BucketMetadataExt.

func (BucketMetadataExt) ArmForSwitch

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 (BucketMetadataExt) MarshalBinary

func (s BucketMetadataExt) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (BucketMetadataExt) SwitchFieldName

func (u BucketMetadataExt) SwitchFieldName() string

SwitchFieldName returns the field name in which this union's discriminant is stored

func (*BucketMetadataExt) UnmarshalBinary

func (s *BucketMetadataExt) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

type BumpSequenceOp

type BumpSequenceOp struct {
	BumpTo SequenceNumber
}

BumpSequenceOp is an XDR Struct defines as:

struct BumpSequenceOp
 {
     SequenceNumber bumpTo;
 };

func (BumpSequenceOp) MarshalBinary

func (s BumpSequenceOp) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (*BumpSequenceOp) UnmarshalBinary

func (s *BumpSequenceOp) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

type BumpSequenceResult

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

func NewBumpSequenceResult(code BumpSequenceResultCode, value interface{}) (result BumpSequenceResult, err error)

NewBumpSequenceResult creates a new BumpSequenceResult.

func (BumpSequenceResult) ArmForSwitch

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 (BumpSequenceResult) MarshalBinary

func (s BumpSequenceResult) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (BumpSequenceResult) SwitchFieldName

func (u BumpSequenceResult) SwitchFieldName() string

SwitchFieldName returns the field name in which this union's discriminant is stored

func (*BumpSequenceResult) UnmarshalBinary

func (s *BumpSequenceResult) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

type BumpSequenceResultCode

type BumpSequenceResultCode int32

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 (BumpSequenceResultCode) MarshalBinary

func (s BumpSequenceResultCode) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (BumpSequenceResultCode) String

func (e BumpSequenceResultCode) String() string

String returns the name of `e`

func (*BumpSequenceResultCode) UnmarshalBinary

func (s *BumpSequenceResultCode) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

func (BumpSequenceResultCode) ValidEnum

func (e BumpSequenceResultCode) ValidEnum(v int32) bool

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

type ChangeTrustOp

type ChangeTrustOp struct {
	Line  Asset
	Limit Int64
}

ChangeTrustOp is an XDR Struct defines as:

struct ChangeTrustOp
 {
     Asset line;

     // if limit is set to 0, deletes the trust line
     int64 limit;
 };

func (ChangeTrustOp) MarshalBinary

func (s ChangeTrustOp) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (*ChangeTrustOp) UnmarshalBinary

func (s *ChangeTrustOp) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

type ChangeTrustResult

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

func NewChangeTrustResult(code ChangeTrustResultCode, value interface{}) (result ChangeTrustResult, err error)

NewChangeTrustResult creates a new ChangeTrustResult.

func (ChangeTrustResult) ArmForSwitch

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 (ChangeTrustResult) MarshalBinary

func (s ChangeTrustResult) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (ChangeTrustResult) SwitchFieldName

func (u ChangeTrustResult) SwitchFieldName() string

SwitchFieldName returns the field name in which this union's discriminant is stored

func (*ChangeTrustResult) UnmarshalBinary

func (s *ChangeTrustResult) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

type ChangeTrustResultCode

type ChangeTrustResultCode int32

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 (ChangeTrustResultCode) MarshalBinary

func (s ChangeTrustResultCode) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (ChangeTrustResultCode) String

func (e ChangeTrustResultCode) String() string

String returns the name of `e`

func (*ChangeTrustResultCode) UnmarshalBinary

func (s *ChangeTrustResultCode) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

func (ChangeTrustResultCode) ValidEnum

func (e ChangeTrustResultCode) ValidEnum(v int32) bool

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

type ClaimOfferAtom

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 (ClaimOfferAtom) MarshalBinary

func (s ClaimOfferAtom) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (*ClaimOfferAtom) UnmarshalBinary

func (s *ClaimOfferAtom) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

type CreateAccountOp

type CreateAccountOp struct {
	Destination     AccountId
	StartingBalance Int64
}

CreateAccountOp is an XDR Struct defines as:

struct CreateAccountOp
 {
     AccountID destination; // account to create
     int64 startingBalance; // amount they end up with
 };

func (CreateAccountOp) MarshalBinary

func (s CreateAccountOp) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (*CreateAccountOp) UnmarshalBinary

func (s *CreateAccountOp) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

type CreateAccountResult

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

func NewCreateAccountResult(code CreateAccountResultCode, value interface{}) (result CreateAccountResult, err error)

NewCreateAccountResult creates a new CreateAccountResult.

func (CreateAccountResult) ArmForSwitch

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 (CreateAccountResult) MarshalBinary

func (s CreateAccountResult) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (CreateAccountResult) SwitchFieldName

func (u CreateAccountResult) SwitchFieldName() string

SwitchFieldName returns the field name in which this union's discriminant is stored

func (*CreateAccountResult) UnmarshalBinary

func (s *CreateAccountResult) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

type CreateAccountResultCode

type CreateAccountResultCode int32

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 (CreateAccountResultCode) MarshalBinary

func (s CreateAccountResultCode) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (CreateAccountResultCode) String

func (e CreateAccountResultCode) String() string

String returns the name of `e`

func (*CreateAccountResultCode) UnmarshalBinary

func (s *CreateAccountResultCode) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

func (CreateAccountResultCode) ValidEnum

func (e CreateAccountResultCode) ValidEnum(v int32) bool

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

type CreatePassiveSellOfferOp

type CreatePassiveSellOfferOp struct {
	Selling Asset
	Buying  Asset
	Amount  Int64
	Price   Price
}

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 (CreatePassiveSellOfferOp) MarshalBinary

func (s CreatePassiveSellOfferOp) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (*CreatePassiveSellOfferOp) UnmarshalBinary

func (s *CreatePassiveSellOfferOp) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

type CryptoKeyType

type CryptoKeyType int32

CryptoKeyType is an XDR Enum defines as:

enum CryptoKeyType
 {
     KEY_TYPE_ED25519 = 0,
     KEY_TYPE_PRE_AUTH_TX = 1,
     KEY_TYPE_HASH_X = 2
 };
const (
	CryptoKeyTypeKeyTypeEd25519   CryptoKeyType = 0
	CryptoKeyTypeKeyTypePreAuthTx CryptoKeyType = 1
	CryptoKeyTypeKeyTypeHashX     CryptoKeyType = 2
)

func (CryptoKeyType) MarshalBinary

func (s CryptoKeyType) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (CryptoKeyType) String

func (e CryptoKeyType) String() string

String returns the name of `e`

func (*CryptoKeyType) UnmarshalBinary

func (s *CryptoKeyType) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

func (CryptoKeyType) ValidEnum

func (e CryptoKeyType) ValidEnum(v int32) bool

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

type Curve25519Public

type Curve25519Public struct {
	Key [32]byte `xdrmaxsize:"32"`
}

Curve25519Public is an XDR Struct defines as:

struct Curve25519Public
 {
         opaque key[32];
 };

func (Curve25519Public) MarshalBinary

func (s Curve25519Public) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (*Curve25519Public) UnmarshalBinary

func (s *Curve25519Public) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

type Curve25519Secret

type Curve25519Secret struct {
	Key [32]byte `xdrmaxsize:"32"`
}

Curve25519Secret is an XDR Struct defines as:

struct Curve25519Secret
 {
         opaque key[32];
 };

func (Curve25519Secret) MarshalBinary

func (s Curve25519Secret) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (*Curve25519Secret) UnmarshalBinary

func (s *Curve25519Secret) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

type DataEntry

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;
 };

func (DataEntry) MarshalBinary

func (s DataEntry) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (*DataEntry) UnmarshalBinary

func (s *DataEntry) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

type DataEntryExt

type DataEntryExt struct {
	V int32
}

DataEntryExt is an XDR NestedUnion defines as:

union switch (int v)
     {
     case 0:
         void;
     }

func NewDataEntryExt

func NewDataEntryExt(v int32, value interface{}) (result DataEntryExt, err error)

NewDataEntryExt creates a new DataEntryExt.

func (DataEntryExt) ArmForSwitch

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 (DataEntryExt) MarshalBinary

func (s DataEntryExt) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (DataEntryExt) SwitchFieldName

func (u DataEntryExt) SwitchFieldName() string

SwitchFieldName returns the field name in which this union's discriminant is stored

func (*DataEntryExt) UnmarshalBinary

func (s *DataEntryExt) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

type DataValue

type DataValue []byte

DataValue is an XDR Typedef defines as:

typedef opaque DataValue<64>;

func (DataValue) MarshalBinary

func (s DataValue) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (*DataValue) UnmarshalBinary

func (s *DataValue) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

func (DataValue) XDRMaxSize

func (e DataValue) XDRMaxSize() int

XDRMaxSize implements the Sized interface for DataValue

type DecoratedSignature

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 (DecoratedSignature) MarshalBinary

func (s DecoratedSignature) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (*DecoratedSignature) UnmarshalBinary

func (s *DecoratedSignature) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

type DontHave

type DontHave struct {
	Type    MessageType
	ReqHash Uint256
}

DontHave is an XDR Struct defines as:

struct DontHave
 {
     MessageType type;
     uint256 reqHash;
 };

func (DontHave) MarshalBinary

func (s DontHave) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (*DontHave) UnmarshalBinary

func (s *DontHave) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

type EnvelopeType

type EnvelopeType int32

EnvelopeType is an XDR Enum defines as:

enum EnvelopeType
 {
     ENVELOPE_TYPE_SCP = 1,
     ENVELOPE_TYPE_TX = 2,
     ENVELOPE_TYPE_AUTH = 3,
     ENVELOPE_TYPE_SCPVALUE = 4
 };
const (
	EnvelopeTypeEnvelopeTypeScp      EnvelopeType = 1
	EnvelopeTypeEnvelopeTypeTx       EnvelopeType = 2
	EnvelopeTypeEnvelopeTypeAuth     EnvelopeType = 3
	EnvelopeTypeEnvelopeTypeScpvalue EnvelopeType = 4
)

func (EnvelopeType) MarshalBinary

func (s EnvelopeType) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (EnvelopeType) String

func (e EnvelopeType) String() string

String returns the name of `e`

func (*EnvelopeType) UnmarshalBinary

func (s *EnvelopeType) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

func (EnvelopeType) ValidEnum

func (e EnvelopeType) ValidEnum(v int32) bool

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

type Error

type Error struct {
	Code ErrorCode
	Msg  string `xdrmaxsize:"100"`
}

Error is an XDR Struct defines as:

struct Error
 {
     ErrorCode code;
     string msg<100>;
 };

func (Error) MarshalBinary

func (s Error) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (*Error) UnmarshalBinary

func (s *Error) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

type ErrorCode

type ErrorCode int32

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
)

func (ErrorCode) MarshalBinary

func (s ErrorCode) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (ErrorCode) String

func (e ErrorCode) String() string

String returns the name of `e`

func (*ErrorCode) UnmarshalBinary

func (s *ErrorCode) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

func (ErrorCode) ValidEnum

func (e ErrorCode) ValidEnum(v int32) bool

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

type Hash

type Hash [32]byte

Hash is an XDR Typedef defines as:

typedef opaque Hash[32];

func (Hash) MarshalBinary

func (s Hash) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (*Hash) Scan

func (t *Hash) Scan(src interface{}) error

Scan reads from a src into an xdr.Hash

func (*Hash) UnmarshalBinary

func (s *Hash) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

func (Hash) XDRMaxSize

func (e Hash) XDRMaxSize() int

XDRMaxSize implements the Sized interface for Hash

type Hello

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;
 };

func (Hello) MarshalBinary

func (s Hello) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (*Hello) UnmarshalBinary

func (s *Hello) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

type HmacSha256Key

type HmacSha256Key struct {
	Key [32]byte `xdrmaxsize:"32"`
}

HmacSha256Key is an XDR Struct defines as:

struct HmacSha256Key
 {
         opaque key[32];
 };

func (HmacSha256Key) MarshalBinary

func (s HmacSha256Key) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (*HmacSha256Key) UnmarshalBinary

func (s *HmacSha256Key) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

type HmacSha256Mac

type HmacSha256Mac struct {
	Mac [32]byte `xdrmaxsize:"32"`
}

HmacSha256Mac is an XDR Struct defines as:

struct HmacSha256Mac
 {
         opaque mac[32];
 };

func (HmacSha256Mac) MarshalBinary

func (s HmacSha256Mac) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (*HmacSha256Mac) UnmarshalBinary

func (s *HmacSha256Mac) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

type InflationPayout

type InflationPayout struct {
	Destination AccountId
	Amount      Int64
}

InflationPayout is an XDR Struct defines as:

struct InflationPayout // or use PaymentResultAtom to limit types?
 {
     AccountID destination;
     int64 amount;
 };

func (InflationPayout) MarshalBinary

func (s InflationPayout) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (*InflationPayout) UnmarshalBinary

func (s *InflationPayout) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

type InflationResult

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

func NewInflationResult(code InflationResultCode, value interface{}) (result InflationResult, err error)

NewInflationResult creates a new InflationResult.

func (InflationResult) ArmForSwitch

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 (InflationResult) GetPayouts

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 (InflationResult) MarshalBinary

func (s InflationResult) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (InflationResult) MustPayouts

func (u InflationResult) MustPayouts() []InflationPayout

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

func (InflationResult) SwitchFieldName

func (u InflationResult) SwitchFieldName() string

SwitchFieldName returns the field name in which this union's discriminant is stored

func (*InflationResult) UnmarshalBinary

func (s *InflationResult) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

type InflationResultCode

type InflationResultCode int32

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 (InflationResultCode) MarshalBinary

func (s InflationResultCode) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (InflationResultCode) String

func (e InflationResultCode) String() string

String returns the name of `e`

func (*InflationResultCode) UnmarshalBinary

func (s *InflationResultCode) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

func (InflationResultCode) ValidEnum

func (e InflationResultCode) ValidEnum(v int32) bool

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

type Int32

type Int32 int32

Int32 is an XDR Typedef defines as:

typedef int int32;

func (Int32) MarshalBinary

func (s Int32) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (*Int32) UnmarshalBinary

func (s *Int32) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

type Int64

type Int64 int64

Int64 is an XDR Typedef defines as:

typedef hyper int64;

func (Int64) MarshalBinary

func (s Int64) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (*Int64) Scan

func (t *Int64) Scan(src interface{}) error

Scan reads from src into an Int64

func (*Int64) UnmarshalBinary

func (s *Int64) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

type IpAddrType

type IpAddrType int32

IpAddrType is an XDR Enum defines as:

enum IPAddrType
 {
     IPv4 = 0,
     IPv6 = 1
 };
const (
	IpAddrTypeIPv4 IpAddrType = 0
	IpAddrTypeIPv6 IpAddrType = 1
)

func (IpAddrType) MarshalBinary

func (s IpAddrType) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (IpAddrType) String

func (e IpAddrType) String() string

String returns the name of `e`

func (*IpAddrType) UnmarshalBinary

func (s *IpAddrType) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

func (IpAddrType) ValidEnum

func (e IpAddrType) ValidEnum(v int32) bool

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

type Keyer

type Keyer interface {
	LedgerKey() LedgerKey
}

Keyer represents a type that can be converted into a LedgerKey

type LedgerCloseValueSignature

type LedgerCloseValueSignature struct {
	NodeId    NodeId
	Signature Signature
}

LedgerCloseValueSignature is an XDR Struct defines as:

struct LedgerCloseValueSignature
 {
     NodeID nodeID;       // which node introduced the value
     Signature signature; // nodeID's signature
 };

func (LedgerCloseValueSignature) MarshalBinary

func (s LedgerCloseValueSignature) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (*LedgerCloseValueSignature) UnmarshalBinary

func (s *LedgerCloseValueSignature) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

type LedgerEntry

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;
     }
     data;

     // reserved for future use
     union switch (int v)
     {
     case 0:
         void;
     }
     ext;
 };

func (*LedgerEntry) LedgerKey

func (entry *LedgerEntry) LedgerKey() LedgerKey

LedgerKey implements the `Keyer` interface

func (LedgerEntry) MarshalBinary

func (s LedgerEntry) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (*LedgerEntry) UnmarshalBinary

func (s *LedgerEntry) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

type LedgerEntryChange

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

func NewLedgerEntryChange(aType LedgerEntryChangeType, value interface{}) (result LedgerEntryChange, err error)

NewLedgerEntryChange creates a new LedgerEntryChange.

func (LedgerEntryChange) ArmForSwitch

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 (*LedgerEntryChange) EntryType

func (change *LedgerEntryChange) EntryType() LedgerEntryType

EntryType is a helper to get at the entry type for a change.

func (LedgerEntryChange) GetCreated

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 (LedgerEntryChange) GetRemoved

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 (LedgerEntryChange) GetState

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 (LedgerEntryChange) GetUpdated

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 (*LedgerEntryChange) LedgerKey

func (change *LedgerEntryChange) LedgerKey() LedgerKey

LedgerKey returns the key for the ledger entry that was changed in `change`.

func (LedgerEntryChange) MarshalBinary

func (s LedgerEntryChange) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (LedgerEntryChange) MarshalBinaryBase64

func (change LedgerEntryChange) MarshalBinaryBase64() (string, error)

MarshalBinaryBase64 marshals XDR into a binary form and then encodes it using base64.

func (LedgerEntryChange) MustCreated

func (u LedgerEntryChange) MustCreated() LedgerEntry

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

func (LedgerEntryChange) MustRemoved

func (u LedgerEntryChange) MustRemoved() LedgerKey

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

func (LedgerEntryChange) MustState

func (u LedgerEntryChange) MustState() LedgerEntry

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

func (LedgerEntryChange) MustUpdated

func (u LedgerEntryChange) MustUpdated() LedgerEntry

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

func (LedgerEntryChange) SwitchFieldName

func (u LedgerEntryChange) SwitchFieldName() string

SwitchFieldName returns the field name in which this union's discriminant is stored

func (*LedgerEntryChange) UnmarshalBinary

func (s *LedgerEntryChange) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

type LedgerEntryChangeType

type LedgerEntryChangeType int32

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 (LedgerEntryChangeType) MarshalBinary

func (s LedgerEntryChangeType) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (LedgerEntryChangeType) String

func (e LedgerEntryChangeType) String() string

String returns the name of `e`

func (*LedgerEntryChangeType) UnmarshalBinary

func (s *LedgerEntryChangeType) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

func (LedgerEntryChangeType) ValidEnum

func (e LedgerEntryChangeType) ValidEnum(v int32) bool

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

type LedgerEntryChanges

type LedgerEntryChanges []LedgerEntryChange

LedgerEntryChanges is an XDR Typedef defines as:

typedef LedgerEntryChange LedgerEntryChanges<>;

func (LedgerEntryChanges) MarshalBinary

func (s LedgerEntryChanges) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (*LedgerEntryChanges) Scan

func (t *LedgerEntryChanges) Scan(src interface{}) error

Scan reads from src into an LedgerEntryChanges struct

func (*LedgerEntryChanges) UnmarshalBinary

func (s *LedgerEntryChanges) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

type LedgerEntryData

type LedgerEntryData struct {
	Type      LedgerEntryType
	Account   *AccountEntry
	TrustLine *TrustLineEntry
	Offer     *OfferEntry
	Data      *DataEntry
}

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;
     }

func NewLedgerEntryData

func NewLedgerEntryData(aType LedgerEntryType, value interface{}) (result LedgerEntryData, err error)

NewLedgerEntryData creates a new LedgerEntryData.

func (LedgerEntryData) ArmForSwitch

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 (LedgerEntryData) GetAccount

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 (LedgerEntryData) GetData

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 (LedgerEntryData) GetOffer

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 (LedgerEntryData) GetTrustLine

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 (LedgerEntryData) MarshalBinary

func (s LedgerEntryData) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (LedgerEntryData) MustAccount

func (u LedgerEntryData) MustAccount() AccountEntry

MustAccount retrieves the Account value from the union, panicing if the value is not set.

func (LedgerEntryData) MustData

func (u LedgerEntryData) MustData() DataEntry

MustData retrieves the Data value from the union, panicing if the value is not set.

func (LedgerEntryData) MustOffer

func (u LedgerEntryData) MustOffer() OfferEntry

MustOffer retrieves the Offer value from the union, panicing if the value is not set.

func (LedgerEntryData) MustTrustLine

func (u LedgerEntryData) MustTrustLine() TrustLineEntry

MustTrustLine retrieves the TrustLine value from the union, panicing if the value is not set.

func (LedgerEntryData) SwitchFieldName

func (u LedgerEntryData) SwitchFieldName() string

SwitchFieldName returns the field name in which this union's discriminant is stored

func (*LedgerEntryData) UnmarshalBinary

func (s *LedgerEntryData) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

type LedgerEntryExt

type LedgerEntryExt struct {
	V int32
}

LedgerEntryExt is an XDR NestedUnion defines as:

union switch (int v)
     {
     case 0:
         void;
     }

func NewLedgerEntryExt

func NewLedgerEntryExt(v int32, value interface{}) (result LedgerEntryExt, err error)

NewLedgerEntryExt creates a new LedgerEntryExt.

func (LedgerEntryExt) ArmForSwitch

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 (LedgerEntryExt) MarshalBinary

func (s LedgerEntryExt) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (LedgerEntryExt) SwitchFieldName

func (u LedgerEntryExt) SwitchFieldName() string

SwitchFieldName returns the field name in which this union's discriminant is stored

func (*LedgerEntryExt) UnmarshalBinary

func (s *LedgerEntryExt) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

type LedgerEntryType

type LedgerEntryType int32

LedgerEntryType is an XDR Enum defines as:

enum LedgerEntryType
 {
     ACCOUNT = 0,
     TRUSTLINE = 1,
     OFFER = 2,
     DATA = 3
 };
const (
	LedgerEntryTypeAccount   LedgerEntryType = 0
	LedgerEntryTypeTrustline LedgerEntryType = 1
	LedgerEntryTypeOffer     LedgerEntryType = 2
	LedgerEntryTypeData      LedgerEntryType = 3
)

func (LedgerEntryType) MarshalBinary

func (s LedgerEntryType) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (LedgerEntryType) String

func (e LedgerEntryType) String() string

String returns the name of `e`

func (*LedgerEntryType) UnmarshalBinary

func (s *LedgerEntryType) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

func (LedgerEntryType) ValidEnum

func (e LedgerEntryType) ValidEnum(v int32) bool

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

type LedgerHeader

type LedgerHeader struct {
	LedgerVersion      Uint32
	PreviousLedgerHash Hash
	ScpValue           PaydexValue
	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
     PaydexValue 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 (LedgerHeader) MarshalBinary

func (s LedgerHeader) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (*LedgerHeader) Scan

func (t *LedgerHeader) Scan(src interface{}) error

Scan reads from src into an LedgerHeader struct

func (*LedgerHeader) UnmarshalBinary

func (s *LedgerHeader) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

type LedgerHeaderExt

type LedgerHeaderExt struct {
	V int32
}

LedgerHeaderExt is an XDR NestedUnion defines as:

union switch (int v)
     {
     case 0:
         void;
     }

func NewLedgerHeaderExt

func NewLedgerHeaderExt(v int32, value interface{}) (result LedgerHeaderExt, err error)

NewLedgerHeaderExt creates a new LedgerHeaderExt.

func (LedgerHeaderExt) ArmForSwitch

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 (LedgerHeaderExt) MarshalBinary

func (s LedgerHeaderExt) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (LedgerHeaderExt) SwitchFieldName

func (u LedgerHeaderExt) SwitchFieldName() string

SwitchFieldName returns the field name in which this union's discriminant is stored

func (*LedgerHeaderExt) UnmarshalBinary

func (s *LedgerHeaderExt) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

type LedgerHeaderHistoryEntry

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 (LedgerHeaderHistoryEntry) MarshalBinary

func (s LedgerHeaderHistoryEntry) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (*LedgerHeaderHistoryEntry) UnmarshalBinary

func (s *LedgerHeaderHistoryEntry) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

type LedgerHeaderHistoryEntryExt

type LedgerHeaderHistoryEntryExt struct {
	V int32
}

LedgerHeaderHistoryEntryExt is an XDR NestedUnion defines as:

union switch (int v)
     {
     case 0:
         void;
     }

func NewLedgerHeaderHistoryEntryExt

func NewLedgerHeaderHistoryEntryExt(v int32, value interface{}) (result LedgerHeaderHistoryEntryExt, err error)

NewLedgerHeaderHistoryEntryExt creates a new LedgerHeaderHistoryEntryExt.

func (LedgerHeaderHistoryEntryExt) ArmForSwitch

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 (LedgerHeaderHistoryEntryExt) MarshalBinary

func (s LedgerHeaderHistoryEntryExt) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (LedgerHeaderHistoryEntryExt) SwitchFieldName

func (u LedgerHeaderHistoryEntryExt) SwitchFieldName() string

SwitchFieldName returns the field name in which this union's discriminant is stored

func (*LedgerHeaderHistoryEntryExt) UnmarshalBinary

func (s *LedgerHeaderHistoryEntryExt) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

type LedgerKey

type LedgerKey struct {
	Type      LedgerEntryType
	Account   *LedgerKeyAccount
	TrustLine *LedgerKeyTrustLine
	Offer     *LedgerKeyOffer
	Data      *LedgerKeyData
}

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;
 };

func NewLedgerKey

func NewLedgerKey(aType LedgerEntryType, value interface{}) (result LedgerKey, err error)

NewLedgerKey creates a new LedgerKey.

func (LedgerKey) ArmForSwitch

func (u LedgerKey) ArmForSwitch(sw int32) (string, bool)

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

func (*LedgerKey) Equals

func (key *LedgerKey) Equals(other LedgerKey) bool

Equals returns true if `other` is equivalent to `key`

func (LedgerKey) GetAccount

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 (LedgerKey) GetData

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 (LedgerKey) GetOffer

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 (LedgerKey) GetTrustLine

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.

func (*LedgerKey) LedgerKey

func (key *LedgerKey) LedgerKey() LedgerKey

LedgerKey implements the `Keyer` interface

func (LedgerKey) MarshalBinary

func (s LedgerKey) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (LedgerKey) MarshalBinaryBase64

func (key LedgerKey) MarshalBinaryBase64() (string, error)

MarshalBinaryBase64 marshals XDR into a binary form and then encodes it using base64.

func (LedgerKey) MarshalBinaryCompress

func (key LedgerKey) MarshalBinaryCompress() ([]byte, error)

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 (LedgerKey) MustAccount

func (u LedgerKey) MustAccount() LedgerKeyAccount

MustAccount retrieves the Account value from the union, panicing if the value is not set.

func (LedgerKey) MustData

func (u LedgerKey) MustData() LedgerKeyData

MustData retrieves the Data value from the union, panicing if the value is not set.

func (LedgerKey) MustOffer

func (u LedgerKey) MustOffer() LedgerKeyOffer

MustOffer retrieves the Offer value from the union, panicing if the value is not set.

func (LedgerKey) MustTrustLine

func (u LedgerKey) MustTrustLine() LedgerKeyTrustLine

MustTrustLine retrieves the TrustLine value from the union, panicing if the value is not set.

func (*LedgerKey) SetAccount

func (key *LedgerKey) SetAccount(account AccountId) error

SetAccount mutates `key` such that it represents the identity of `account`

func (*LedgerKey) SetData

func (key *LedgerKey) SetData(account AccountId, name string) error

SetData mutates `key` such that it represents the identity of the data entry owned by `account` and for `name`.

func (*LedgerKey) SetOffer

func (key *LedgerKey) SetOffer(account AccountId, id uint64) error

SetOffer mutates `key` such that it represents the identity of the data entry owned by `account` and for offer `id`.

func (*LedgerKey) SetTrustline

func (key *LedgerKey) SetTrustline(account AccountId, line Asset) error

SetTrustline mutates `key` such that it represents the identity of the trustline owned by `account` and for `asset`.

func (LedgerKey) SwitchFieldName

func (u LedgerKey) SwitchFieldName() string

SwitchFieldName returns the field name in which this union's discriminant is stored

func (*LedgerKey) UnmarshalBinary

func (s *LedgerKey) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

type LedgerKeyAccount

type LedgerKeyAccount struct {
	AccountId AccountId
}

LedgerKeyAccount is an XDR NestedStruct defines as:

struct
     {
         AccountID accountID;
     }

func (LedgerKeyAccount) MarshalBinary

func (s LedgerKeyAccount) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (*LedgerKeyAccount) UnmarshalBinary

func (s *LedgerKeyAccount) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

type LedgerKeyData

type LedgerKeyData struct {
	AccountId AccountId
	DataName  String64
}

LedgerKeyData is an XDR NestedStruct defines as:

struct
     {
         AccountID accountID;
         string64 dataName;
     }

func (LedgerKeyData) MarshalBinary

func (s LedgerKeyData) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (*LedgerKeyData) UnmarshalBinary

func (s *LedgerKeyData) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

type LedgerKeyOffer

type LedgerKeyOffer struct {
	SellerId AccountId
	OfferId  Int64
}

LedgerKeyOffer is an XDR NestedStruct defines as:

struct
     {
         AccountID sellerID;
         int64 offerID;
     }

func (LedgerKeyOffer) MarshalBinary

func (s LedgerKeyOffer) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (*LedgerKeyOffer) UnmarshalBinary

func (s *LedgerKeyOffer) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

type LedgerKeyTrustLine

type LedgerKeyTrustLine struct {
	AccountId AccountId
	Asset     Asset
}

LedgerKeyTrustLine is an XDR NestedStruct defines as:

struct
     {
         AccountID accountID;
         Asset asset;
     }

func (LedgerKeyTrustLine) MarshalBinary

func (s LedgerKeyTrustLine) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (*LedgerKeyTrustLine) UnmarshalBinary

func (s *LedgerKeyTrustLine) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

type LedgerScpMessages

type LedgerScpMessages struct {
	LedgerSeq Uint32
	Messages  []ScpEnvelope
}

LedgerScpMessages is an XDR Struct defines as:

struct LedgerSCPMessages
 {
     uint32 ledgerSeq;
     SCPEnvelope messages<>;
 };

func (LedgerScpMessages) MarshalBinary

func (s LedgerScpMessages) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (*LedgerScpMessages) UnmarshalBinary

func (s *LedgerScpMessages) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

type LedgerUpgrade

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

func NewLedgerUpgrade(aType LedgerUpgradeType, value interface{}) (result LedgerUpgrade, err error)

NewLedgerUpgrade creates a new LedgerUpgrade.

func (LedgerUpgrade) ArmForSwitch

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 (LedgerUpgrade) GetNewBaseFee

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 (LedgerUpgrade) GetNewBaseReserve

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 (LedgerUpgrade) GetNewLedgerVersion

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 (LedgerUpgrade) GetNewMaxTxSetSize

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 (LedgerUpgrade) MarshalBinary

func (s LedgerUpgrade) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (LedgerUpgrade) MustNewBaseFee

func (u LedgerUpgrade) MustNewBaseFee() Uint32

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

func (LedgerUpgrade) MustNewBaseReserve

func (u LedgerUpgrade) MustNewBaseReserve() Uint32

MustNewBaseReserve retrieves the NewBaseReserve value from the union, panicing if the value is not set.

func (LedgerUpgrade) MustNewLedgerVersion

func (u LedgerUpgrade) MustNewLedgerVersion() Uint32

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

func (LedgerUpgrade) MustNewMaxTxSetSize

func (u LedgerUpgrade) MustNewMaxTxSetSize() Uint32

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

func (LedgerUpgrade) SwitchFieldName

func (u LedgerUpgrade) SwitchFieldName() string

SwitchFieldName returns the field name in which this union's discriminant is stored

func (*LedgerUpgrade) UnmarshalBinary

func (s *LedgerUpgrade) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

type LedgerUpgradeType

type LedgerUpgradeType int32

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 (LedgerUpgradeType) MarshalBinary

func (s LedgerUpgradeType) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (LedgerUpgradeType) String

func (e LedgerUpgradeType) String() string

String returns the name of `e`

func (*LedgerUpgradeType) UnmarshalBinary

func (s *LedgerUpgradeType) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

func (LedgerUpgradeType) ValidEnum

func (e LedgerUpgradeType) ValidEnum(v int32) bool

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

type Liabilities

type Liabilities struct {
	Buying  Int64
	Selling Int64
}

Liabilities is an XDR Struct defines as:

struct Liabilities
 {
     int64 buying;
     int64 selling;
 };

func (Liabilities) MarshalBinary

func (s Liabilities) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (*Liabilities) UnmarshalBinary

func (s *Liabilities) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

type ManageBuyOfferOp

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 (ManageBuyOfferOp) MarshalBinary

func (s ManageBuyOfferOp) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (*ManageBuyOfferOp) UnmarshalBinary

func (s *ManageBuyOfferOp) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

type ManageBuyOfferResult

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

func NewManageBuyOfferResult(code ManageBuyOfferResultCode, value interface{}) (result ManageBuyOfferResult, err error)

NewManageBuyOfferResult creates a new ManageBuyOfferResult.

func (ManageBuyOfferResult) ArmForSwitch

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 (ManageBuyOfferResult) GetSuccess

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 (ManageBuyOfferResult) MarshalBinary

func (s ManageBuyOfferResult) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (ManageBuyOfferResult) MustSuccess

MustSuccess retrieves the Success value from the union, panicing if the value is not set.

func (ManageBuyOfferResult) SwitchFieldName

func (u ManageBuyOfferResult) SwitchFieldName() string

SwitchFieldName returns the field name in which this union's discriminant is stored

func (*ManageBuyOfferResult) UnmarshalBinary

func (s *ManageBuyOfferResult) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

type ManageBuyOfferResultCode

type ManageBuyOfferResultCode int32

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 (ManageBuyOfferResultCode) MarshalBinary

func (s ManageBuyOfferResultCode) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (ManageBuyOfferResultCode) String

func (e ManageBuyOfferResultCode) String() string

String returns the name of `e`

func (*ManageBuyOfferResultCode) UnmarshalBinary

func (s *ManageBuyOfferResultCode) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

func (ManageBuyOfferResultCode) ValidEnum

func (e ManageBuyOfferResultCode) ValidEnum(v int32) bool

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

type ManageDataOp

type ManageDataOp struct {
	DataName  String64
	DataValue *DataValue
}

ManageDataOp is an XDR Struct defines as:

struct ManageDataOp
 {
     string64 dataName;
     DataValue* dataValue; // set to null to clear
 };

func (ManageDataOp) MarshalBinary

func (s ManageDataOp) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (*ManageDataOp) UnmarshalBinary

func (s *ManageDataOp) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

type ManageDataResult

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

func NewManageDataResult(code ManageDataResultCode, value interface{}) (result ManageDataResult, err error)

NewManageDataResult creates a new ManageDataResult.

func (ManageDataResult) ArmForSwitch

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 (ManageDataResult) MarshalBinary

func (s ManageDataResult) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (ManageDataResult) SwitchFieldName

func (u ManageDataResult) SwitchFieldName() string

SwitchFieldName returns the field name in which this union's discriminant is stored

func (*ManageDataResult) UnmarshalBinary

func (s *ManageDataResult) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

type ManageDataResultCode

type ManageDataResultCode int32

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 (ManageDataResultCode) MarshalBinary

func (s ManageDataResultCode) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (ManageDataResultCode) String

func (e ManageDataResultCode) String() string

String returns the name of `e`

func (*ManageDataResultCode) UnmarshalBinary

func (s *ManageDataResultCode) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

func (ManageDataResultCode) ValidEnum

func (e ManageDataResultCode) ValidEnum(v int32) bool

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

type ManageOfferEffect

type ManageOfferEffect int32

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 (ManageOfferEffect) MarshalBinary

func (s ManageOfferEffect) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (ManageOfferEffect) String

func (e ManageOfferEffect) String() string

String returns the name of `e`

func (*ManageOfferEffect) UnmarshalBinary

func (s *ManageOfferEffect) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

func (ManageOfferEffect) ValidEnum

func (e ManageOfferEffect) ValidEnum(v int32) bool

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

type ManageOfferSuccessResult

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 (ManageOfferSuccessResult) MarshalBinary

func (s ManageOfferSuccessResult) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (*ManageOfferSuccessResult) UnmarshalBinary

func (s *ManageOfferSuccessResult) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

type ManageOfferSuccessResultOffer

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

func NewManageOfferSuccessResultOffer(effect ManageOfferEffect, value interface{}) (result ManageOfferSuccessResultOffer, err error)

NewManageOfferSuccessResultOffer creates a new ManageOfferSuccessResultOffer.

func (ManageOfferSuccessResultOffer) ArmForSwitch

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 (ManageOfferSuccessResultOffer) GetOffer

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 (ManageOfferSuccessResultOffer) MarshalBinary

func (s ManageOfferSuccessResultOffer) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (ManageOfferSuccessResultOffer) MustOffer

MustOffer retrieves the Offer value from the union, panicing if the value is not set.

func (ManageOfferSuccessResultOffer) SwitchFieldName

func (u ManageOfferSuccessResultOffer) SwitchFieldName() string

SwitchFieldName returns the field name in which this union's discriminant is stored

func (*ManageOfferSuccessResultOffer) UnmarshalBinary

func (s *ManageOfferSuccessResultOffer) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

type ManageSellOfferOp

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 (ManageSellOfferOp) MarshalBinary

func (s ManageSellOfferOp) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (*ManageSellOfferOp) UnmarshalBinary

func (s *ManageSellOfferOp) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

type ManageSellOfferResult

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

func NewManageSellOfferResult(code ManageSellOfferResultCode, value interface{}) (result ManageSellOfferResult, err error)

NewManageSellOfferResult creates a new ManageSellOfferResult.

func (ManageSellOfferResult) ArmForSwitch

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 (ManageSellOfferResult) GetSuccess

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 (ManageSellOfferResult) MarshalBinary

func (s ManageSellOfferResult) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (ManageSellOfferResult) MustSuccess

MustSuccess retrieves the Success value from the union, panicing if the value is not set.

func (ManageSellOfferResult) SwitchFieldName

func (u ManageSellOfferResult) SwitchFieldName() string

SwitchFieldName returns the field name in which this union's discriminant is stored

func (*ManageSellOfferResult) UnmarshalBinary

func (s *ManageSellOfferResult) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

type ManageSellOfferResultCode

type ManageSellOfferResultCode int32

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 (ManageSellOfferResultCode) MarshalBinary

func (s ManageSellOfferResultCode) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (ManageSellOfferResultCode) String

func (e ManageSellOfferResultCode) String() string

String returns the name of `e`

func (*ManageSellOfferResultCode) UnmarshalBinary

func (s *ManageSellOfferResultCode) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

func (ManageSellOfferResultCode) ValidEnum

func (e ManageSellOfferResultCode) ValidEnum(v int32) bool

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

type Memo

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
 };

func NewMemo

func NewMemo(aType MemoType, value interface{}) (result Memo, err error)

NewMemo creates a new Memo.

func (Memo) ArmForSwitch

func (u Memo) ArmForSwitch(sw int32) (string, bool)

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

func (Memo) GetHash

func (u Memo) GetHash() (result Hash, ok bool)

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

func (Memo) GetId

func (u Memo) GetId() (result Uint64, ok bool)

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

func (Memo) GetRetHash

func (u Memo) GetRetHash() (result Hash, ok bool)

GetRetHash retrieves the RetHash value from the union, returning ok if the union's switch indicated the value is valid.

func (Memo) GetText

func (u Memo) GetText() (result string, ok bool)

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

func (Memo) MarshalBinary

func (s Memo) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (Memo) MustHash

func (u Memo) MustHash() Hash

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

func (Memo) MustId

func (u Memo) MustId() Uint64

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

func (Memo) MustRetHash

func (u Memo) MustRetHash() Hash

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

func (Memo) MustText

func (u Memo) MustText() string

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

func (Memo) SwitchFieldName

func (u Memo) SwitchFieldName() string

SwitchFieldName returns the field name in which this union's discriminant is stored

func (*Memo) UnmarshalBinary

func (s *Memo) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

type MemoType

type MemoType int32

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
)

func (MemoType) MarshalBinary

func (s MemoType) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (MemoType) String

func (e MemoType) String() string

String returns the name of `e`

func (*MemoType) UnmarshalBinary

func (s *MemoType) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

func (MemoType) ValidEnum

func (e MemoType) ValidEnum(v int32) bool

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

type MessageType

type MessageType int32

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
 };
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
)

func (MessageType) MarshalBinary

func (s MessageType) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (MessageType) String

func (e MessageType) String() string

String returns the name of `e`

func (*MessageType) UnmarshalBinary

func (s *MessageType) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

func (MessageType) ValidEnum

func (e MessageType) ValidEnum(v int32) bool

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

type NodeId

type NodeId PublicKey

NodeId is an XDR Typedef defines as:

typedef PublicKey NodeID;

func NewNodeId

func NewNodeId(aType PublicKeyType, value interface{}) (result NodeId, err error)

NewNodeId creates a new NodeId.

func (NodeId) ArmForSwitch

func (u NodeId) ArmForSwitch(sw int32) (string, bool)

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

func (NodeId) GetEd25519

func (u NodeId) 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 (NodeId) MarshalBinary

func (s NodeId) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (NodeId) MustEd25519

func (u NodeId) MustEd25519() Uint256

MustEd25519 retrieves the Ed25519 value from the union, panicing if the value is not set.

func (NodeId) SwitchFieldName

func (u NodeId) SwitchFieldName() string

SwitchFieldName returns the field name in which this union's discriminant is stored

func (*NodeId) UnmarshalBinary

func (s *NodeId) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

type OfferEntry

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 (OfferEntry) MarshalBinary

func (s OfferEntry) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (*OfferEntry) UnmarshalBinary

func (s *OfferEntry) UnmarshalBinary(inp []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

type OfferEntryExt

type OfferEntryExt struct {
	V int32
}

OfferEntryExt is an XDR NestedUnion defines as:

union switch (int v)
     {
     case 0:
         void;
     }

func NewOfferEntryExt

func NewOfferEntryExt(v int32, value interface{}) (result OfferEntryExt, err error)

NewOfferEntryExt creates a new OfferEntryExt.

func (OfferEntryExt) ArmForSwitch

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 (OfferEntryExt) MarshalBinary