Documentation ¶
Overview ¶
Package data aims to provides all the data types that are needed to build tools, clients and servers for use on the Ripple network.
Ledger ¶
The ledger is a mixture of various data types, all persisted in the form of a key and value. The value contains a node, and some nodes refer to other nodes by their index. An index may or may not be equivalent to a node's key. A ledger consists of a LedgerHeader as the root of two trees, one for the transactions in that ledger and one for the state of all accounts at that point in time.
A ledger refers to its predecessor, which has a completely different tree for its transactions, but the account state tree will share most of its nodes with its successors and predecessors.
The full ledger consists of a sequence of such ledgers, each referring to, and dependent on its predecessor.
Important terms are key, value, index, hash and node. Keys, indexes and hashes are always 32 bytes in length and involve the use of the SHA512 cryptographic hash algorithm, discarding the last 32 bytes of the resulting hash. Sometimes they are the same thing, sometimes not.
LedgerHeader ¶
This is the root of the two trees for a single ledger. It contains information about the ledger and its predecessor. A ledger header node is never reused between ledgers.
Node: Simple big-endian binary encoding of LedgerHeader Index: SHA512Half of HP_LEDGER_MASTER:Node Hash: Same as Index Key: Index Value: LedgerSequence:LedgerSequence:NT_LEDGER:HP_LEDGER_MASTER:Node
Inner Node ¶
This is a node in either the transaction or account state tree which contains up to 16 hashes of other nodes. The position of the hash represents a 4 bit nibble of the index that is being searched for in the tree. An account state inner node may be reused between ledgers, a transaction inner node will never be reused.
Node: Simple big-endian binary encoding of 16 x 32 byte hashes Index: SHA512Half of HP_INNER_NODE:Node Hash: Same as Index Key: Index Value: LedgerSequence:LedgerSequence:NT_ACCOUNT_NODE or NT_TRANSACTION_NODE:HP_INNER_NODE:Node
TransactionWithMetadata Node ¶
This contains a Transaction with Metadata describing how the LedgerEntry nodes were altered. It has the most complex structure of all nodes. A TransactionWithMetadata node is never reused between ledgers. VL is a variable length marker.
Node: Complex encoding of Transaction Index: SHA512Half of HP_TRANSACTION_ID:Node Hash: SHA512Half of HP_TRANSACTION_NODE:VL:Node:VL:Metadata:Index Key: Hash Value: LedgerSequence:LedgerSequence:NT_TRANSACTION_NODE:HP_TRANSACTION_NODE:VL:Node:VL:Metadata:Index
LedgerEntry Node ¶
This contains the state of an account after a transaction has been applied. Ledger Entry nodes may be reused between ledgers.
Node: Complex encoding of LedgerEntry Index: SHA512Half of namespace and a type-specific rule Hash: SHA512Half of HP_LEAF_NODE:Node:Index Key: Hash Value: LedgerSequence:LedgerSequence:NT_ACCOUNT_NODE:HP_LEAF_NODE:Node:Index
Index ¶
- Constants
- Variables
- func CheckSignature(s Signer) (bool, error)
- func GetLedgerEntryFactoryByType(leType string) func() LedgerEntry
- func GetTxFactoryByType(txType string) func() Transaction
- func Sign(s Signer, key crypto.Key, sequence *uint32) error
- type Account
- func (a *Account) Bytes() []byte
- func (a Account) Compare(b Account) int
- func (a Account) Equals(b Account) bool
- func (a Account) Hash() (crypto.Hash, error)
- func (a Account) Hash256() Hash256
- func (a Account) IsZero() bool
- func (a Account) Less(b Account) bool
- func (a *Account) Marshal(w io.Writer) error
- func (a Account) MarshalText() ([]byte, error)
- func (a Account) String() string
- func (a *Account) Unmarshal(r Reader) error
- func (a *Account) UnmarshalText(b []byte) error
- type AccountLine
- type AccountLineSlice
- func (s *AccountLineSlice) Add(account Account, rs *RippleState) bool
- func (s *AccountLineSlice) Delete(account Account, rs *RippleState) bool
- func (s AccountLineSlice) Find(account Account, currency Currency) int
- func (s AccountLineSlice) Get(account Account, currency Currency) *AccountLine
- func (s AccountLineSlice) Len() int
- func (s AccountLineSlice) SortByCurrencyAmount()
- func (s AccountLineSlice) SortbyCurrencyAccount()
- func (s AccountLineSlice) Swap(i, j int)
- func (s AccountLineSlice) Update(account Account, rs *RippleState) bool
- type AccountOffer
- type AccountOfferSlice
- func (s *AccountOfferSlice) Add(offer *Offer) bool
- func (s *AccountOfferSlice) Delete(offer *Offer) bool
- func (s AccountOfferSlice) Find(sequence uint32) int
- func (s AccountOfferSlice) Get(sequence uint32) *AccountOffer
- func (s AccountOfferSlice) GetSequences(pays, gets *Asset) []uint32
- func (s AccountOfferSlice) Len() int
- func (s AccountOfferSlice) Less(i, j int) bool
- func (s AccountOfferSlice) Swap(i, j int)
- func (s AccountOfferSlice) Update(offer *Offer) bool
- type AccountRoot
- func (a *AccountRoot) Affects(account Account) bool
- func (le *AccountRoot) GetHash() *Hash256
- func (le *AccountRoot) GetLedgerEntryType() LedgerEntryType
- func (le *AccountRoot) GetLedgerIndex() *Hash256
- func (le *AccountRoot) GetPreviousTxnId() *Hash256
- func (le *AccountRoot) GetType() string
- func (le *AccountRoot) Ledger() uint32
- func (le *AccountRoot) NodeId() *Hash256
- func (le *AccountRoot) NodeType() NodeType
- func (le *AccountRoot) Prefix() HashPrefix
- type AccountSet
- type AffectedNode
- type Amendment
- type Amendments
- func (a *Amendments) Affects(account Account) bool
- func (le *Amendments) GetHash() *Hash256
- func (le *Amendments) GetLedgerEntryType() LedgerEntryType
- func (le *Amendments) GetLedgerIndex() *Hash256
- func (le *Amendments) GetPreviousTxnId() *Hash256
- func (le *Amendments) GetType() string
- func (le *Amendments) Ledger() uint32
- func (le *Amendments) NodeId() *Hash256
- func (le *Amendments) NodeType() NodeType
- func (le *Amendments) Prefix() HashPrefix
- type Amount
- func (a Amount) Abs() *Amount
- func (a Amount) Add(b *Amount) (*Amount, error)
- func (a Amount) ApplyInterest() (*Amount, error)
- func (a Amount) Asset() *Asset
- func (a Amount) Bytes() []byte
- func (a Amount) Clone() *Amount
- func (a Amount) Divide(b *Amount) (*Amount, error)
- func (a Amount) Equals(b Amount) bool
- func (a Amount) IsPositive() bool
- func (a Amount) Machine() string
- func (a *Amount) Marshal(w io.Writer) error
- func (a Amount) MarshalBinary() ([]byte, error)
- func (a Amount) MarshalJSON() ([]byte, error)
- func (a Amount) Multiply(b *Amount) (*Amount, error)
- func (a Amount) Negate() *Amount
- func (a Amount) Ratio(b Amount) *Value
- func (a Amount) SameValue(b *Amount) bool
- func (a Amount) String() string
- func (a Amount) Subtract(b *Amount) (*Amount, error)
- func (a *Amount) Unmarshal(r Reader) error
- func (a *Amount) UnmarshalBinary(b []byte) error
- func (a *Amount) UnmarshalJSON(b []byte) (err error)
- func (a Amount) ZeroClone() *Amount
- type Asset
- type Balance
- type BalanceMap
- type BalanceSlice
- type Check
- func (p *Check) Affects(account Account) bool
- func (le *Check) GetHash() *Hash256
- func (le *Check) GetLedgerEntryType() LedgerEntryType
- func (le *Check) GetLedgerIndex() *Hash256
- func (le *Check) GetPreviousTxnId() *Hash256
- func (le *Check) GetType() string
- func (le *Check) Ledger() uint32
- func (le *Check) NodeId() *Hash256
- func (le *Check) NodeType() NodeType
- func (le *Check) Prefix() HashPrefix
- type CheckCancel
- type CheckCash
- type CheckCreate
- type CompressedNodeEntry
- type Currency
- func (c *Currency) Bytes() []byte
- func (c Currency) Clone() Currency
- func (a Currency) Compare(b Currency) int
- func (c Currency) Equals(other Currency) bool
- func (c Currency) IsNative() bool
- func (a Currency) Less(b Currency) bool
- func (c Currency) Machine() string
- func (c *Currency) Marshal(w io.Writer) error
- func (c Currency) MarshalText() ([]byte, error)
- func (c Currency) Rate(seconds uint32) float64
- func (c Currency) String() string
- func (c Currency) Type() CurrencyType
- func (c *Currency) Unmarshal(r Reader) error
- func (c *Currency) UnmarshalText(text []byte) error
- type CurrencyType
- type DepositPreAuth
- func (d *DepositPreAuth) Affects(account Account) bool
- func (le *DepositPreAuth) GetHash() *Hash256
- func (le *DepositPreAuth) GetLedgerEntryType() LedgerEntryType
- func (le *DepositPreAuth) GetLedgerIndex() *Hash256
- func (le *DepositPreAuth) GetPreviousTxnId() *Hash256
- func (le *DepositPreAuth) GetType() string
- func (le *DepositPreAuth) Ledger() uint32
- func (le *DepositPreAuth) NodeId() *Hash256
- func (le *DepositPreAuth) NodeType() NodeType
- func (le *DepositPreAuth) Prefix() HashPrefix
- type Directory
- func (d *Directory) Affects(account Account) bool
- func (le *Directory) GetHash() *Hash256
- func (le *Directory) GetLedgerEntryType() LedgerEntryType
- func (le *Directory) GetLedgerIndex() *Hash256
- func (le *Directory) GetPreviousTxnId() *Hash256
- func (le *Directory) GetType() string
- func (le *Directory) Ledger() uint32
- func (le *Directory) NodeId() *Hash256
- func (le *Directory) NodeType() NodeType
- func (le *Directory) Prefix() HashPrefix
- type Escrow
- func (s *Escrow) Affects(account Account) bool
- func (le *Escrow) GetHash() *Hash256
- func (le *Escrow) GetLedgerEntryType() LedgerEntryType
- func (le *Escrow) GetLedgerIndex() *Hash256
- func (le *Escrow) GetPreviousTxnId() *Hash256
- func (le *Escrow) GetType() string
- func (le *Escrow) Ledger() uint32
- func (le *Escrow) NodeId() *Hash256
- func (le *Escrow) NodeType() NodeType
- func (le *Escrow) Prefix() HashPrefix
- type EscrowCancel
- type EscrowCreate
- type EscrowFinish
- type ExchangeRate
- type FeeSettings
- func (f *FeeSettings) Affects(account Account) bool
- func (le *FeeSettings) GetHash() *Hash256
- func (le *FeeSettings) GetLedgerEntryType() LedgerEntryType
- func (le *FeeSettings) GetLedgerIndex() *Hash256
- func (le *FeeSettings) GetPreviousTxnId() *Hash256
- func (le *FeeSettings) GetType() string
- func (le *FeeSettings) Ledger() uint32
- func (le *FeeSettings) NodeId() *Hash256
- func (le *FeeSettings) NodeType() NodeType
- func (le *FeeSettings) Prefix() HashPrefix
- type Hash128
- type Hash160
- func (h *Hash160) Account() *Account
- func (h *Hash160) Bytes() []byte
- func (h *Hash160) Currency() *Currency
- func (h *Hash160) Marshal(w io.Writer) error
- func (h Hash160) MarshalText() ([]byte, error)
- func (h Hash160) String() string
- func (h *Hash160) Unmarshal(r Reader) error
- func (h *Hash160) UnmarshalText(b []byte) error
- type Hash256
- func GetAccountRootIndex(account Account) (*Hash256, error)
- func GetAmendmentsIndex() (*Hash256, error)
- func GetBookIndex(paysCurrency, getsCurrency Hash160, paysIssuer, getsIssuer Hash160) (*Hash256, error)
- func GetDirectoryNodeIndex(root Hash256, index *NodeIndex) (*Hash256, error)
- func GetFeeIndex() (*Hash256, error)
- func GetLedgerHashIndex() (*Hash256, error)
- func GetOfferIndex(account Account, sequence uint32) (*Hash256, error)
- func GetOwnerDirectoryIndex(account Account) (*Hash256, error)
- func GetPreviousLedgerHashIndex(sequence uint32) (*Hash256, error)
- func GetRippleStateIndex(a, b Account, c Currency) (*Hash256, error)
- func LedgerIndex(le LedgerEntry) (*Hash256, error)
- func NewHash256(value interface{}) (*Hash256, error)
- func Node(h Storer) (Hash256, []byte, error)
- func NodeId(h Hashable) (Hash256, error)
- func Raw(h Hashable) (Hash256, []byte, error)
- func SigningHash(s Signer) (Hash256, []byte, error)
- func (h *Hash256) Bytes() []byte
- func (h Hash256) Compare(x Hash256) int
- func (h Hash256) IsZero() bool
- func (h *Hash256) Marshal(w io.Writer) error
- func (h Hash256) MarshalText() ([]byte, error)
- func (h Hash256) String() string
- func (h Hash256) TruncatedString(length int) string
- func (h *Hash256) Unmarshal(r Reader) error
- func (h *Hash256) UnmarshalText(b []byte) error
- func (h Hash256) Xor(x Hash256) Hash256
- type HashPrefix
- type Hashable
- type InnerNode
- func (n InnerNode) Count() int
- func (n InnerNode) Each(f InnerNodeFunc) error
- func (n InnerNode) GetHash() *Hash256
- func (n InnerNode) GetType() string
- func (n InnerNode) Ledger() uint32
- func (n InnerNode) NodeId() *Hash256
- func (n InnerNode) NodeType() NodeType
- func (n InnerNode) Prefix() HashPrefix
- func (n InnerNode) String() string
- type InnerNodeFunc
- type KeyType
- type Ledger
- type LedgerEntry
- type LedgerEntryFlag
- type LedgerEntrySlice
- type LedgerEntryState
- type LedgerEntryType
- type LedgerHashes
- func (l *LedgerHashes) Affects(account Account) bool
- func (le *LedgerHashes) GetHash() *Hash256
- func (le *LedgerHashes) GetLedgerEntryType() LedgerEntryType
- func (le *LedgerHashes) GetLedgerIndex() *Hash256
- func (le *LedgerHashes) GetPreviousTxnId() *Hash256
- func (le *LedgerHashes) GetType() string
- func (le *LedgerHashes) Ledger() uint32
- func (le *LedgerHashes) NodeId() *Hash256
- func (le *LedgerHashes) NodeType() NodeType
- func (le *LedgerHashes) Prefix() HashPrefix
- type LedgerHeader
- type LedgerNamespace
- type LedgerRange
- type LedgerSet
- func (l *LedgerSet) Count() uint32
- func (l *LedgerSet) Extend(i uint32)
- func (l *LedgerSet) Max() uint32
- func (l *LedgerSet) Set(i uint32) time.Duration
- func (l *LedgerSet) String() string
- func (l *LedgerSet) TakeBottom(n uint32) LedgerSlice
- func (l *LedgerSet) TakeMiddle(r *LedgerRange) LedgerSlice
- func (l *LedgerSet) TakeTop(n uint32) LedgerSlice
- func (l *LedgerSet) Taken() uint32
- type LedgerSlice
- type LimitByteReader
- type Majority
- type Memo
- type Memos
- type MetaData
- type NodeEffect
- type NodeEffects
- type NodeFormat
- type NodeHeader
- type NodeIndex
- type NodeType
- type NonNativeValue
- type Offer
- func (o *Offer) Affects(account Account) bool
- func (le *Offer) GetHash() *Hash256
- func (le *Offer) GetLedgerEntryType() LedgerEntryType
- func (le *Offer) GetLedgerIndex() *Hash256
- func (le *Offer) GetPreviousTxnId() *Hash256
- func (le *Offer) GetType() string
- func (le *Offer) Ledger() uint32
- func (le *Offer) NodeId() *Hash256
- func (le *Offer) NodeType() NodeType
- func (le *Offer) Prefix() HashPrefix
- func (o *Offer) Ratio() *Value
- type OfferCancel
- type OfferCreate
- type OrderBookOffer
- func (le *OrderBookOffer) GetHash() *Hash256
- func (le *OrderBookOffer) GetLedgerEntryType() LedgerEntryType
- func (le *OrderBookOffer) GetLedgerIndex() *Hash256
- func (le *OrderBookOffer) GetPreviousTxnId() *Hash256
- func (le *OrderBookOffer) GetType() string
- func (le *OrderBookOffer) Ledger() uint32
- func (le *OrderBookOffer) NodeId() *Hash256
- func (le *OrderBookOffer) NodeType() NodeType
- func (le *OrderBookOffer) Prefix() HashPrefix
- type Path
- type PathElem
- type PathSet
- type PayChannel
- func (p *PayChannel) Affects(account Account) bool
- func (le *PayChannel) GetHash() *Hash256
- func (le *PayChannel) GetLedgerEntryType() LedgerEntryType
- func (le *PayChannel) GetLedgerIndex() *Hash256
- func (le *PayChannel) GetPreviousTxnId() *Hash256
- func (le *PayChannel) GetType() string
- func (le *PayChannel) Ledger() uint32
- func (le *PayChannel) NodeId() *Hash256
- func (le *PayChannel) NodeType() NodeType
- func (le *PayChannel) Prefix() HashPrefix
- type Payment
- type PaymentChannelClaim
- type PaymentChannelCreate
- type PaymentChannelFund
- type Proposal
- func (p *Proposal) GetHash() *Hash256
- func (p *Proposal) GetPublicKey() *PublicKey
- func (p *Proposal) GetSignature() *VariableLength
- func (p Proposal) GetType() string
- func (p *Proposal) InitialiseForSigning()
- func (p *Proposal) Prefix() HashPrefix
- func (p *Proposal) SigningPrefix() HashPrefix
- func (p Proposal) SigningValues() []interface{}
- func (p Proposal) SuppressionId() (Hash256, error)
- type PublicKey
- func (p *PublicKey) Bytes() []byte
- func (p PublicKey) IsZero() bool
- func (k *PublicKey) Marshal(w io.Writer) error
- func (p PublicKey) MarshalText() ([]byte, error)
- func (p PublicKey) NodePublicKey() string
- func (p PublicKey) String() string
- func (k *PublicKey) Unmarshal(r Reader) error
- func (p *PublicKey) UnmarshalText(b []byte) error
- type Reader
- type RegularKey
- func (r *RegularKey) Bytes() []byte
- func (r RegularKey) Hash() (crypto.Hash, error)
- func (k *RegularKey) Marshal(w io.Writer) error
- func (r RegularKey) MarshalText() ([]byte, error)
- func (r RegularKey) String() string
- func (k *RegularKey) Unmarshal(r Reader) error
- func (r *RegularKey) UnmarshalText(b []byte) error
- type RippleState
- func (r *RippleState) Affects(account Account) bool
- func (le *RippleState) GetHash() *Hash256
- func (le *RippleState) GetLedgerEntryType() LedgerEntryType
- func (le *RippleState) GetLedgerIndex() *Hash256
- func (le *RippleState) GetPreviousTxnId() *Hash256
- func (le *RippleState) GetType() string
- func (le *RippleState) Ledger() uint32
- func (le *RippleState) NodeId() *Hash256
- func (le *RippleState) NodeType() NodeType
- func (le *RippleState) Prefix() HashPrefix
- type RippleTime
- func (t RippleTime) MarshalJSON() ([]byte, error)
- func (t *RippleTime) SetString(s string) error
- func (t *RippleTime) SetUint32(n uint32)
- func (t RippleTime) Short() string
- func (t RippleTime) String() string
- func (t RippleTime) Time() time.Time
- func (t RippleTime) Uint32() uint32
- func (t *RippleTime) UnmarshalJSON(b []byte) error
- type Router
- type Seed
- func (s *Seed) AccountId(keyType KeyType, sequence *uint32) Account
- func (s *Seed) Bytes() []byte
- func (s Seed) Hash() (crypto.Hash, error)
- func (s *Seed) Key(keyType KeyType) crypto.Key
- func (s Seed) MarshalText() ([]byte, error)
- func (s Seed) String() string
- func (s *Seed) UnmarshalText(b []byte) error
- type SetFee
- type SetRegularKey
- type Signer
- type SignerEntry
- type SignerList
- func (s *SignerList) Affects(account Account) bool
- func (le *SignerList) GetHash() *Hash256
- func (le *SignerList) GetLedgerEntryType() LedgerEntryType
- func (le *SignerList) GetLedgerIndex() *Hash256
- func (le *SignerList) GetPreviousTxnId() *Hash256
- func (le *SignerList) GetType() string
- func (le *SignerList) Ledger() uint32
- func (le *SignerList) NodeId() *Hash256
- func (le *SignerList) NodeType() NodeType
- func (le *SignerList) Prefix() HashPrefix
- type SignerListSet
- type Storer
- type Ticket
- func (t *Ticket) Affects(account Account) bool
- func (le *Ticket) GetHash() *Hash256
- func (le *Ticket) GetLedgerEntryType() LedgerEntryType
- func (le *Ticket) GetLedgerIndex() *Hash256
- func (le *Ticket) GetPreviousTxnId() *Hash256
- func (le *Ticket) GetType() string
- func (le *Ticket) Ledger() uint32
- func (le *Ticket) NodeId() *Hash256
- func (le *Ticket) NodeType() NodeType
- func (le *Ticket) Prefix() HashPrefix
- type TicketCancel
- type TicketCreate
- type Trade
- type TradeSlice
- type Transaction
- type TransactionFlag
- type TransactionResult
- func (r TransactionResult) Human() string
- func (res *TransactionResult) Marshal(w io.Writer) error
- func (r TransactionResult) MarshalText() ([]byte, error)
- func (r TransactionResult) Queued() bool
- func (r TransactionResult) String() string
- func (r TransactionResult) Success() bool
- func (r TransactionResult) Symbol() string
- func (res *TransactionResult) Unmarshal(r Reader) error
- func (r *TransactionResult) UnmarshalText(b []byte) error
- type TransactionSlice
- type TransactionType
- type TransactionWithMetaData
- func (t *TransactionWithMetaData) Affects(account Account) bool
- func (txm *TransactionWithMetaData) Balances() (BalanceMap, error)
- func (t *TransactionWithMetaData) GetType() string
- func (t *TransactionWithMetaData) Ledger() uint32
- func (txm TransactionWithMetaData) MarshalJSON() ([]byte, error)
- func (t *TransactionWithMetaData) NodeId() *Hash256
- func (t *TransactionWithMetaData) NodeType() NodeType
- func (t *TransactionWithMetaData) Prefix() HashPrefix
- func (txm *TransactionWithMetaData) UnmarshalJSON(b []byte) error
- type Transfer
- type TrustSet
- type TxBase
- func (t *TxBase) Compare(other *TxBase) int
- func (t *TxBase) GetBase() *TxBase
- func (t *TxBase) GetHash() *Hash256
- func (t *TxBase) GetPublicKey() *PublicKey
- func (t *TxBase) GetSignature() *VariableLength
- func (t *TxBase) GetTransactionType() TransactionType
- func (t *TxBase) GetType() string
- func (t *TxBase) InitialiseForSigning()
- func (t *TxBase) PathSet() PathSet
- func (t *TxBase) Prefix() HashPrefix
- func (t *TxBase) SigningPrefix() HashPrefix
- type Uint64Hex
- type Validation
- func (v Validation) GetHash() *Hash256
- func (v Validation) GetPublicKey() *PublicKey
- func (v Validation) GetSignature() *VariableLength
- func (v Validation) GetType() string
- func (v Validation) InitialiseForSigning()
- func (v Validation) Prefix() HashPrefix
- func (v Validation) SigningPrefix() HashPrefix
- func (v Validation) SuppressionId() (Hash256, error)
- type Value
- func (v Value) Abs() *Value
- func (a Value) Add(b Value) (*Value, error)
- func (v *Value) Bytes() []byte
- func (v Value) Clone() *Value
- func (a Value) Compare(b Value) int
- func (num Value) Divide(den Value) (*Value, error)
- func (a Value) Equals(b Value) bool
- func (v Value) Float() float64
- func (v Value) IsNative() bool
- func (v Value) IsNegative() bool
- func (v Value) IsZero() bool
- func (a Value) Less(b Value) bool
- func (v *Value) Marshal(w io.Writer) error
- func (v Value) MarshalBinary() ([]byte, error)
- func (v *Value) MarshalText() ([]byte, error)
- func (a Value) Multiply(b Value) (*Value, error)
- func (v Value) Native() (*Value, error)
- func (v Value) Negate() *Value
- func (v Value) NonNative() (*Value, error)
- func (v Value) Rat() *big.Rat
- func (a Value) Ratio(b Value) (*Value, error)
- func (v Value) String() string
- func (a Value) Subtract(b Value) (*Value, error)
- func (v *Value) Unmarshal(r Reader) error
- func (v *Value) UnmarshalBinary(b []byte) error
- func (v *Value) UnmarshalText(b []byte) error
- func (v Value) ZeroClone() *Value
- type VariableLength
- type Vector256
- type Wire
- type Work
Examples ¶
Constants ¶
const ( // LedgerEntryType values come from rippled's "LedgerFormats.h" SIGNER_LIST LedgerEntryType = 0x53 // 'S' TICKET LedgerEntryType = 0x54 // 'T' ACCOUNT_ROOT LedgerEntryType = 0x61 // 'a' DIRECTORY LedgerEntryType = 0x64 // 'd' AMENDMENTS LedgerEntryType = 0x66 // 'f' LEDGER_HASHES LedgerEntryType = 0x68 // 'h' OFFER LedgerEntryType = 0x6f // 'o' RIPPLE_STATE LedgerEntryType = 0x72 // 'r' FEE_SETTINGS LedgerEntryType = 0x73 // 's' ESCROW LedgerEntryType = 0x75 // 'u' PAY_CHANNEL LedgerEntryType = 0x78 // 'x' CHECK LedgerEntryType = 0x63 // 'C' DEPOSIT_PRE_AUTH LedgerEntryType = 0x70 // 'p' // TransactionType values come from rippled's "TxFormats.h" PAYMENT TransactionType = 0 ESCROW_CREATE TransactionType = 1 ESCROW_FINISH TransactionType = 2 ACCOUNT_SET TransactionType = 3 ESCROW_CANCEL TransactionType = 4 SET_REGULAR_KEY TransactionType = 5 OFFER_CREATE TransactionType = 7 OFFER_CANCEL TransactionType = 8 TICKET_CREATE TransactionType = 10 TICKET_CANCEL TransactionType = 11 SIGNER_LIST_SET TransactionType = 12 PAYCHAN_CREATE TransactionType = 13 PAYCHAN_FUND TransactionType = 14 PAYCHAN_CLAIM TransactionType = 15 CHECK_CREATE TransactionType = 16 CHECK_CASH TransactionType = 17 CHECK_CANCEL TransactionType = 18 TRUST_SET TransactionType = 20 AMENDMENT TransactionType = 100 SET_FEE TransactionType = 101 )
const ( // Hash Prefixes HP_TRANSACTION_ID HashPrefix = 0x54584E00 // 'TXN' transaction HP_TRANSACTION_NODE HashPrefix = 0x534E4400 // 'SND' transaction plus metadata (probably should have been TND!) HP_LEAF_NODE HashPrefix = 0x4D4C4E00 // 'MLN' account state HP_INNER_NODE HashPrefix = 0x4D494E00 // 'MIN' inner node in tree HP_LEDGER_MASTER HashPrefix = 0x4C575200 // 'LWR' ledger master data for signing (probably should have been LGR!) HP_TRANSACTION_SIGN HashPrefix = 0x53545800 // 'STX' inner transaction to sign HP_VALIDATION HashPrefix = 0x56414C00 // 'VAL' validation for signing HP_PROPOSAL HashPrefix = 0x50525000 // 'PRP' proposal for signing // Node Types NT_UNKNOWN NodeType = 0 NT_LEDGER NodeType = 1 NT_TRANSACTION NodeType = 2 NT_ACCOUNT_NODE NodeType = 3 NT_TRANSACTION_NODE NodeType = 4 // Node Formats NF_PREFIX NodeFormat = 1 NF_HASH NodeFormat = 2 NF_WIRE NodeFormat = 3 // Ledger index NameSpaces NS_ACCOUNT LedgerNamespace = 'a' NS_DIRECTORY_NODE LedgerNamespace = 'd' NS_RIPPLE_STATE LedgerNamespace = 'r' NS_OFFER LedgerNamespace = 'o' // Entry for an offer NS_OWNER_DIRECTORY LedgerNamespace = 'O' // Directory of things owned by an account NS_BOOK_DIRECTORY LedgerNamespace = 'B' // Directory of order books NS_SKIP_LIST LedgerNamespace = 's' NS_AMENDMENT LedgerNamespace = 'f' NS_FEE LedgerNamespace = 'e' NS_SUSPAY LedgerNamespace = 'u' NS_TICKET LedgerNamespace = 'T' NS_SIGNER_LIST LedgerNamespace = 'S' NS_XRPU_CHANNEL LedgerNamespace = 'x' )
const ( ST_UINT16 uint8 = 1 ST_UINT32 uint8 = 2 ST_UINT64 uint8 = 3 ST_HASH128 uint8 = 4 ST_HASH256 uint8 = 5 ST_AMOUNT uint8 = 6 ST_VL uint8 = 7 ST_ACCOUNT uint8 = 8 ST_OBJECT uint8 = 14 ST_ARRAY uint8 = 15 ST_UINT8 uint8 = 16 ST_HASH160 uint8 = 17 ST_PATHSET uint8 = 18 ST_VECTOR256 uint8 = 19 )
const ( PATH_BOUNDARY pathEntry = 0xFF PATH_END pathEntry = 0x00 PATH_ACCOUNT pathEntry = 0x01 PATH_REDEEM pathEntry = 0x02 PATH_CURRENCY pathEntry = 0x10 PATH_ISSUER pathEntry = 0x20 )
Variables ¶
var HashableTypes []string
var LedgerEntryFactory = [...]func() LedgerEntry{ ACCOUNT_ROOT: func() LedgerEntry { return &AccountRoot{leBase: leBase{LedgerEntryType: ACCOUNT_ROOT}} }, DIRECTORY: func() LedgerEntry { return &Directory{leBase: leBase{LedgerEntryType: DIRECTORY}} }, AMENDMENTS: func() LedgerEntry { return &Amendments{leBase: leBase{LedgerEntryType: AMENDMENTS}} }, LEDGER_HASHES: func() LedgerEntry { return &LedgerHashes{leBase: leBase{LedgerEntryType: LEDGER_HASHES}} }, OFFER: func() LedgerEntry { return &Offer{leBase: leBase{LedgerEntryType: OFFER}} }, RIPPLE_STATE: func() LedgerEntry { return &RippleState{leBase: leBase{LedgerEntryType: RIPPLE_STATE}} }, FEE_SETTINGS: func() LedgerEntry { return &FeeSettings{leBase: leBase{LedgerEntryType: FEE_SETTINGS}} }, ESCROW: func() LedgerEntry { return &Escrow{leBase: leBase{LedgerEntryType: ESCROW}} }, SIGNER_LIST: func() LedgerEntry { return &SignerList{leBase: leBase{LedgerEntryType: SIGNER_LIST}} }, TICKET: func() LedgerEntry { return &Ticket{leBase: leBase{LedgerEntryType: TICKET}} }, PAY_CHANNEL: func() LedgerEntry { return &PayChannel{leBase: leBase{LedgerEntryType: PAY_CHANNEL}} }, CHECK: func() LedgerEntry { return &Check{leBase: leBase{LedgerEntryType: CHECK}} }, DEPOSIT_PRE_AUTH: func() LedgerEntry { return &DepositPreAuth{leBase: leBase{LedgerEntryType: DEPOSIT_PRE_AUTH}} }, }
var LedgerFactory = [...]func() Hashable{ func() Hashable { return &Ledger{} }, }
var TxFactory = [...]func() Transaction{ PAYMENT: func() Transaction { return &Payment{TxBase: TxBase{TransactionType: PAYMENT}} }, ACCOUNT_SET: func() Transaction { return &AccountSet{TxBase: TxBase{TransactionType: ACCOUNT_SET}} }, SET_REGULAR_KEY: func() Transaction { return &SetRegularKey{TxBase: TxBase{TransactionType: SET_REGULAR_KEY}} }, OFFER_CREATE: func() Transaction { return &OfferCreate{TxBase: TxBase{TransactionType: OFFER_CREATE}} }, OFFER_CANCEL: func() Transaction { return &OfferCancel{TxBase: TxBase{TransactionType: OFFER_CANCEL}} }, TRUST_SET: func() Transaction { return &TrustSet{TxBase: TxBase{TransactionType: TRUST_SET}} }, AMENDMENT: func() Transaction { return &Amendment{TxBase: TxBase{TransactionType: AMENDMENT}} }, SET_FEE: func() Transaction { return &SetFee{TxBase: TxBase{TransactionType: SET_FEE}} }, ESCROW_CREATE: func() Transaction { return &EscrowCreate{TxBase: TxBase{TransactionType: ESCROW_CREATE}} }, ESCROW_FINISH: func() Transaction { return &EscrowFinish{TxBase: TxBase{TransactionType: ESCROW_FINISH}} }, ESCROW_CANCEL: func() Transaction { return &EscrowCancel{TxBase: TxBase{TransactionType: ESCROW_CANCEL}} }, SIGNER_LIST_SET: func() Transaction { return &SignerListSet{TxBase: TxBase{TransactionType: SIGNER_LIST_SET}} }, PAYCHAN_CREATE: func() Transaction { return &PaymentChannelCreate{TxBase: TxBase{TransactionType: PAYCHAN_CREATE}} }, PAYCHAN_FUND: func() Transaction { return &PaymentChannelFund{TxBase: TxBase{TransactionType: PAYCHAN_FUND}} }, PAYCHAN_CLAIM: func() Transaction { return &PaymentChannelClaim{TxBase: TxBase{TransactionType: PAYCHAN_CLAIM}} }, CHECK_CREATE: func() Transaction { return &CheckCreate{TxBase: TxBase{TransactionType: CHECK_CREATE}} }, CHECK_CASH: func() Transaction { return &CheckCash{TxBase: TxBase{TransactionType: CHECK_CASH}} }, CHECK_CANCEL: func() Transaction { return &CheckCancel{TxBase: TxBase{TransactionType: CHECK_CANCEL}} }, }
Functions ¶
func CheckSignature ¶
func GetLedgerEntryFactoryByType ¶
func GetLedgerEntryFactoryByType(leType string) func() LedgerEntry
func GetTxFactoryByType ¶
func GetTxFactoryByType(txType string) func() Transaction
Types ¶
type Account ¶
type Account [20]byte
func NewAccountFromAddress ¶
Expects address in base58 form
func (Account) MarshalText ¶
func (*Account) UnmarshalText ¶
Expects base58-encoded account id
type AccountLine ¶
type AccountLine struct { Account Account `json:"account"` Balance NonNativeValue `json:"balance"` Currency Currency `json:"currency"` Limit NonNativeValue `json:"limit"` LimitPeer NonNativeValue `json:"limit_peer"` NoRipple bool `json:"no_ripple"` NoRipplePeer bool `json:"no_ripple_peer"` QualityIn uint32 `json:"quality_in"` QualityOut uint32 `json:"quality_out"` }
func (*AccountLine) Asset ¶
func (l *AccountLine) Asset() *Asset
func (*AccountLine) CompareByCurrencyAccount ¶
func (l *AccountLine) CompareByCurrencyAccount(other *AccountLine) int
func (*AccountLine) CompareByCurrencyAmount ¶
func (l *AccountLine) CompareByCurrencyAmount(other *AccountLine) int
type AccountLineSlice ¶
type AccountLineSlice []AccountLine
func (*AccountLineSlice) Add ¶
func (s *AccountLineSlice) Add(account Account, rs *RippleState) bool
func (*AccountLineSlice) Delete ¶
func (s *AccountLineSlice) Delete(account Account, rs *RippleState) bool
func (AccountLineSlice) Find ¶
func (s AccountLineSlice) Find(account Account, currency Currency) int
func (AccountLineSlice) Get ¶
func (s AccountLineSlice) Get(account Account, currency Currency) *AccountLine
func (AccountLineSlice) Len ¶
func (s AccountLineSlice) Len() int
func (AccountLineSlice) SortByCurrencyAmount ¶
func (s AccountLineSlice) SortByCurrencyAmount()
func (AccountLineSlice) SortbyCurrencyAccount ¶
func (s AccountLineSlice) SortbyCurrencyAccount()
func (AccountLineSlice) Swap ¶
func (s AccountLineSlice) Swap(i, j int)
func (AccountLineSlice) Update ¶
func (s AccountLineSlice) Update(account Account, rs *RippleState) bool
type AccountOffer ¶
type AccountOffer struct { Flags LedgerEntryFlag `json:"flags"` Quality NonNativeValue `json:"quality"` Sequence uint32 `json:"seq"` TakerGets Amount `json:"taker_gets"` TakerPays Amount `json:"taker_pays"` Expiration *uint32 `json:"expiration"` }
type AccountOfferSlice ¶
type AccountOfferSlice []AccountOffer
func (*AccountOfferSlice) Add ¶
func (s *AccountOfferSlice) Add(offer *Offer) bool
func (*AccountOfferSlice) Delete ¶
func (s *AccountOfferSlice) Delete(offer *Offer) bool
func (AccountOfferSlice) Find ¶
func (s AccountOfferSlice) Find(sequence uint32) int
func (AccountOfferSlice) Get ¶
func (s AccountOfferSlice) Get(sequence uint32) *AccountOffer
func (AccountOfferSlice) GetSequences ¶
func (s AccountOfferSlice) GetSequences(pays, gets *Asset) []uint32
func (AccountOfferSlice) Len ¶
func (s AccountOfferSlice) Len() int
func (AccountOfferSlice) Less ¶
func (s AccountOfferSlice) Less(i, j int) bool
func (AccountOfferSlice) Swap ¶
func (s AccountOfferSlice) Swap(i, j int)
func (AccountOfferSlice) Update ¶
func (s AccountOfferSlice) Update(offer *Offer) bool
type AccountRoot ¶
type AccountRoot struct { Flags *LedgerEntryFlag `json:",omitempty"` Account *Account `json:",omitempty"` Sequence *uint32 `json:",omitempty"` Balance *Value `json:",omitempty"` OwnerCount *uint32 `json:",omitempty"` AccountTxnID *Hash256 `json:",omitempty"` RegularKey *RegularKey `json:",omitempty"` EmailHash *Hash128 `json:",omitempty"` WalletLocator *Hash256 `json:",omitempty"` WalletSize *uint32 `json:",omitempty"` MessageKey *VariableLength `json:",omitempty"` TickSize *uint8 `json:",omitempty"` TransferRate *uint32 `json:",omitempty"` Domain *VariableLength `json:",omitempty"` Signers *VariableLength `json:",omitempty"` // contains filtered or unexported fields }
func (*AccountRoot) Affects ¶
func (a *AccountRoot) Affects(account Account) bool
func (*AccountRoot) GetLedgerEntryType ¶
func (le *AccountRoot) GetLedgerEntryType() LedgerEntryType
func (*AccountRoot) GetLedgerIndex ¶
func (le *AccountRoot) GetLedgerIndex() *Hash256
func (*AccountRoot) GetPreviousTxnId ¶
func (le *AccountRoot) GetPreviousTxnId() *Hash256
func (*AccountRoot) Prefix ¶
func (le *AccountRoot) Prefix() HashPrefix
type AccountSet ¶
type AccountSet struct { TxBase EmailHash *Hash128 `json:",omitempty"` WalletLocator *Hash256 `json:",omitempty"` WalletSize *uint32 `json:",omitempty"` MessageKey *VariableLength `json:",omitempty"` Domain *VariableLength `json:",omitempty"` TransferRate *uint32 `json:",omitempty"` TickSize *uint8 `json:",omitempty"` SetFlag *uint32 `json:",omitempty"` ClearFlag *uint32 `json:",omitempty"` }
type AffectedNode ¶
type AffectedNode struct { FinalFields LedgerEntry `json:",omitempty"` LedgerEntryType LedgerEntryType LedgerIndex *Hash256 `json:",omitempty"` PreviousFields LedgerEntry `json:",omitempty"` NewFields LedgerEntry `json:",omitempty"` PreviousTxnID *Hash256 `json:",omitempty"` PreviousTxnLgrSeq *uint32 `json:",omitempty"` }
func (*AffectedNode) MarshalJSON ¶
func (a *AffectedNode) MarshalJSON() ([]byte, error)
func (*AffectedNode) UnmarshalJSON ¶
func (a *AffectedNode) UnmarshalJSON(b []byte) error
type Amendments ¶
type Amendments struct { Flags *LedgerEntryFlag `json:",omitempty"` Amendments *Vector256 `json:",omitempty"` Majorities []Majority `json:",omitempty"` // contains filtered or unexported fields }
func (*Amendments) Affects ¶
func (a *Amendments) Affects(account Account) bool
func (*Amendments) GetLedgerEntryType ¶
func (le *Amendments) GetLedgerEntryType() LedgerEntryType
func (*Amendments) GetLedgerIndex ¶
func (le *Amendments) GetLedgerIndex() *Hash256
func (*Amendments) GetPreviousTxnId ¶
func (le *Amendments) GetPreviousTxnId() *Hash256
func (*Amendments) Prefix ¶
func (le *Amendments) Prefix() HashPrefix
type Amount ¶
func (Amount) ApplyInterest ¶
func (Amount) IsPositive ¶
func (Amount) MarshalBinary ¶
func (Amount) MarshalJSON ¶
func (Amount) Ratio ¶
Ratio returns the ratio between a and b. Returns a zero value when division is impossible
func (*Amount) UnmarshalBinary ¶
func (*Amount) UnmarshalJSON ¶
type BalanceMap ¶
type BalanceMap map[Account]*BalanceSlice
type BalanceSlice ¶
type BalanceSlice []Balance
func (*BalanceSlice) Add ¶
func (s *BalanceSlice) Add(counterparty *Account, balance, change *Value, currency *Currency)
func (BalanceSlice) Len ¶
func (s BalanceSlice) Len() int
func (BalanceSlice) Less ¶
func (s BalanceSlice) Less(i, j int) bool
func (BalanceSlice) Swap ¶
func (s BalanceSlice) Swap(i, j int)
type Check ¶
type Check struct { Account *Account `json:",omitempty"` Destination *Account `json:",omitempty"` Expiration *uint32 `json:",omitempty"` SendMax *Amount `json:",omitempty"` Sequence *uint32 `json:",omitempty"` // contains filtered or unexported fields }
func (*Check) GetLedgerEntryType ¶
func (le *Check) GetLedgerEntryType() LedgerEntryType
func (*Check) GetLedgerIndex ¶
func (le *Check) GetLedgerIndex() *Hash256
func (*Check) GetPreviousTxnId ¶
func (le *Check) GetPreviousTxnId() *Hash256
func (*Check) Prefix ¶
func (le *Check) Prefix() HashPrefix
type CheckCancel ¶
type CheckCash ¶
type CheckCash struct { TxBase CheckID Hash256 Amount *Amount `json:",omitempty"` DeliverMin *Amount `json:",omitempty"` }
https://ripple.com/build/transactions/#checkcash Must include one of Amount or DeliverMin
type CheckCreate ¶
type CompressedNodeEntry ¶
type Currency ¶
type Currency [20]byte
func NewCurrency ¶
Accepts currency as either a 3 character code or a 40 character hex string
func (Currency) MarshalText ¶
func (Currency) String ¶
Currency in human parsable form Demurrage is formatted, for example, as XAU (0.50%pa)
func (Currency) Type ¶
func (c Currency) Type() CurrencyType
func (*Currency) UnmarshalText ¶
type CurrencyType ¶
type CurrencyType uint8
const ( CT_XRP CurrencyType = 0 CT_STANDARD CurrencyType = 1 CT_DEMURRAGE CurrencyType = 2 CT_HEX CurrencyType = 3 CT_UNKNOWN CurrencyType = 4 )
type DepositPreAuth ¶
type DepositPreAuth struct { Account *Account `json:",omitempty"` Authorize *Account `json:",omitempty"` Flags *LedgerEntryFlag `json:",omitempty"` OwnerNode *NodeIndex `json:",omitempty"` // contains filtered or unexported fields }
func (*DepositPreAuth) Affects ¶
func (d *DepositPreAuth) Affects(account Account) bool
func (*DepositPreAuth) GetLedgerEntryType ¶
func (le *DepositPreAuth) GetLedgerEntryType() LedgerEntryType
func (*DepositPreAuth) GetLedgerIndex ¶
func (le *DepositPreAuth) GetLedgerIndex() *Hash256
func (*DepositPreAuth) GetPreviousTxnId ¶
func (le *DepositPreAuth) GetPreviousTxnId() *Hash256
func (*DepositPreAuth) Prefix ¶
func (le *DepositPreAuth) Prefix() HashPrefix
type Directory ¶
type Directory struct { Flags *LedgerEntryFlag `json:",omitempty"` RootIndex *Hash256 `json:",omitempty"` Indexes *Vector256 `json:",omitempty"` Owner *Account `json:",omitempty"` TakerPaysCurrency *Hash160 `json:",omitempty"` TakerPaysIssuer *Hash160 `json:",omitempty"` TakerGetsCurrency *Hash160 `json:",omitempty"` TakerGetsIssuer *Hash160 `json:",omitempty"` ExchangeRate *ExchangeRate `json:",omitempty"` IndexNext *NodeIndex `json:",omitempty"` IndexPrevious *NodeIndex `json:",omitempty"` // contains filtered or unexported fields }
func (*Directory) GetLedgerEntryType ¶
func (le *Directory) GetLedgerEntryType() LedgerEntryType
func (*Directory) GetLedgerIndex ¶
func (le *Directory) GetLedgerIndex() *Hash256
func (*Directory) GetPreviousTxnId ¶
func (le *Directory) GetPreviousTxnId() *Hash256
func (*Directory) Prefix ¶
func (le *Directory) Prefix() HashPrefix
type Escrow ¶
type Escrow struct { Flags *LedgerEntryFlag `json:",omitempty"` Account Account `json:",omitempty"` Destination Account `json:",omitempty"` Amount Amount `json:",omitempty"` Condition *VariableLength `json:",omitempty"` CancelAfter *uint32 `json:",omitempty"` FinishAfter *uint32 `json:",omitempty"` SourceTag *uint32 `json:",omitempty"` DestinationTag *uint32 `json:",omitempty"` OwnerNode *NodeIndex `json:",omitempty"` DestinationNode *NodeIndex `json:",omitempty"` // contains filtered or unexported fields }
func (*Escrow) GetLedgerEntryType ¶
func (le *Escrow) GetLedgerEntryType() LedgerEntryType
func (*Escrow) GetLedgerIndex ¶
func (le *Escrow) GetLedgerIndex() *Hash256
func (*Escrow) GetPreviousTxnId ¶
func (le *Escrow) GetPreviousTxnId() *Hash256
func (*Escrow) Prefix ¶
func (le *Escrow) Prefix() HashPrefix
type EscrowCancel ¶
type EscrowCreate ¶
type EscrowFinish ¶
type ExchangeRate ¶
type ExchangeRate uint64
func NewExchangeRate ¶
func NewExchangeRate(a, b *Amount) (ExchangeRate, error)
func (*ExchangeRate) Bytes ¶
func (e *ExchangeRate) Bytes() []byte
func (ExchangeRate) MarshalText ¶
func (e ExchangeRate) MarshalText() ([]byte, error)
func (*ExchangeRate) UnmarshalText ¶
func (e *ExchangeRate) UnmarshalText(b []byte) error
type FeeSettings ¶
type FeeSettings struct { Flags *LedgerEntryFlag `json:",omitempty"` BaseFee *Uint64Hex `json:",omitempty"` ReferenceFeeUnits *uint32 `json:",omitempty"` ReserveBase *uint32 `json:",omitempty"` ReserveIncrement *uint32 `json:",omitempty"` // contains filtered or unexported fields }
func (*FeeSettings) Affects ¶
func (f *FeeSettings) Affects(account Account) bool
func (*FeeSettings) GetLedgerEntryType ¶
func (le *FeeSettings) GetLedgerEntryType() LedgerEntryType
func (*FeeSettings) GetLedgerIndex ¶
func (le *FeeSettings) GetLedgerIndex() *Hash256
func (*FeeSettings) GetPreviousTxnId ¶
func (le *FeeSettings) GetPreviousTxnId() *Hash256
func (*FeeSettings) Prefix ¶
func (le *FeeSettings) Prefix() HashPrefix
type Hash256 ¶
type Hash256 [32]byte
func GetAccountRootIndex ¶
func GetAmendmentsIndex ¶
func GetBookIndex ¶
func GetDirectoryNodeIndex ¶
func GetFeeIndex ¶
func GetLedgerHashIndex ¶
func GetOwnerDirectoryIndex ¶
func LedgerIndex ¶
func LedgerIndex(le LedgerEntry) (*Hash256, error)
func NewHash256 ¶
Accepts either a hex string or a byte slice of length 32
func (Hash256) MarshalText ¶
func (Hash256) TruncatedString ¶
func (*Hash256) UnmarshalText ¶
type HashPrefix ¶
type HashPrefix uint32
func (HashPrefix) Bytes ¶
func (h HashPrefix) Bytes() []byte
func (HashPrefix) String ¶
func (h HashPrefix) String() string
type Hashable ¶
type Hashable interface { GetType() string Prefix() HashPrefix GetHash() *Hash256 }
type InnerNode ¶
func (InnerNode) Each ¶
func (n InnerNode) Each(f InnerNodeFunc) error
func (InnerNode) Prefix ¶
func (n InnerNode) Prefix() HashPrefix
type InnerNodeFunc ¶
type Ledger ¶
type Ledger struct { LedgerHeader Hash Hash256 `json:"hash"` Closed bool `json:"closed"` Accepted bool `json:"accepted"` Transactions TransactionSlice `json:"transactions,omitempty"` AccountState LedgerEntrySlice `json:"accountState,omitempty"` }
func NewEmptyLedger ¶
func (Ledger) MarshalJSON ¶
func (Ledger) Prefix ¶
func (l Ledger) Prefix() HashPrefix
func (*Ledger) UnmarshalJSON ¶
type LedgerEntry ¶
type LedgerEntry interface { Storer GetLedgerEntryType() LedgerEntryType GetLedgerIndex() *Hash256 GetPreviousTxnId() *Hash256 Affects(Account) bool }
func ReadLedgerEntry ¶
func ReadLedgerEntry(r Reader, nodeId Hash256) (LedgerEntry, error)
type LedgerEntryFlag ¶
type LedgerEntryFlag uint32
const ( // AccountRoot flags LsPasswordSpent LedgerEntryFlag = 0x00010000 LsRequireDestTag LedgerEntryFlag = 0x00020000 LsRequireAuth LedgerEntryFlag = 0x00040000 LsDisallowXRP LedgerEntryFlag = 0x00080000 LsDisableMaster LedgerEntryFlag = 0x00100000 LsNoFreeze LedgerEntryFlag = 0x00200000 LsGlobalFreeze LedgerEntryFlag = 0x00400000 LsDefaultRipple LedgerEntryFlag = 0x00800000 // Offer flags LsPassive LedgerEntryFlag = 0x00010000 LsSell LedgerEntryFlag = 0x00020000 // RippleState flags LsLowReserve LedgerEntryFlag = 0x00010000 LsHighReserve LedgerEntryFlag = 0x00020000 LsLowAuth LedgerEntryFlag = 0x00040000 LsHighAuth LedgerEntryFlag = 0x00080000 LsLowNoRipple LedgerEntryFlag = 0x00100000 LsHighNoRipple LedgerEntryFlag = 0x00200000 LsLowFreeze LedgerEntryFlag = 0x00400000 LsHighFreeze LedgerEntryFlag = 0x00800000 )
Ledger entry flags
func (LedgerEntryFlag) Explain ¶
func (f LedgerEntryFlag) Explain(le LedgerEntry) []string
func (LedgerEntryFlag) String ¶
func (f LedgerEntryFlag) String() string
type LedgerEntrySlice ¶
type LedgerEntrySlice []LedgerEntry
func (*LedgerEntrySlice) UnmarshalJSON ¶
func (l *LedgerEntrySlice) UnmarshalJSON(b []byte) error
type LedgerEntryState ¶
type LedgerEntryState uint8
const ( Created LedgerEntryState = iota Modified Deleted )
type LedgerEntryType ¶
type LedgerEntryType uint16
func (LedgerEntryType) MarshalText ¶
func (l LedgerEntryType) MarshalText() ([]byte, error)
func (LedgerEntryType) String ¶
func (le LedgerEntryType) String() string
func (*LedgerEntryType) UnmarshalText ¶
func (l *LedgerEntryType) UnmarshalText(b []byte) error
type LedgerHashes ¶
type LedgerHashes struct { Flags *LedgerEntryFlag `json:",omitempty"` FirstLedgerSequence *uint32 `json:",omitempty"` LastLedgerSequence *uint32 `json:",omitempty"` Hashes *Vector256 `json:",omitempty"` // contains filtered or unexported fields }
func (*LedgerHashes) Affects ¶
func (l *LedgerHashes) Affects(account Account) bool
func (*LedgerHashes) GetLedgerEntryType ¶
func (le *LedgerHashes) GetLedgerEntryType() LedgerEntryType
func (*LedgerHashes) GetLedgerIndex ¶
func (le *LedgerHashes) GetLedgerIndex() *Hash256
func (*LedgerHashes) GetPreviousTxnId ¶
func (le *LedgerHashes) GetPreviousTxnId() *Hash256
func (*LedgerHashes) Prefix ¶
func (le *LedgerHashes) Prefix() HashPrefix
type LedgerHeader ¶
type LedgerHeader struct { LedgerSequence uint32 `json:"ledger_index,string"` TotalXRP uint64 `json:"total_coins,string"` PreviousLedger Hash256 `json:"parent_hash"` TransactionHash Hash256 `json:"transaction_hash"` StateHash Hash256 `json:"account_hash"` ParentCloseTime RippleTime `json:"parent_close_time"` CloseTime RippleTime `json:"close_time"` CloseResolution uint8 `json:"close_time_resolution"` CloseFlags uint8 `json:"close_flags"` }
type LedgerNamespace ¶
type LedgerNamespace uint16
type LedgerRange ¶
type LedgerSet ¶
type LedgerSet struct {
// contains filtered or unexported fields
}
func NewLedgerSet ¶
func (*LedgerSet) TakeBottom ¶
func (l *LedgerSet) TakeBottom(n uint32) LedgerSlice
func (*LedgerSet) TakeMiddle ¶
func (l *LedgerSet) TakeMiddle(r *LedgerRange) LedgerSlice
func (*LedgerSet) TakeTop ¶
func (l *LedgerSet) TakeTop(n uint32) LedgerSlice
type LedgerSlice ¶
type LedgerSlice []uint32
func (LedgerSlice) Len ¶
func (s LedgerSlice) Len() int
func (LedgerSlice) Less ¶
func (s LedgerSlice) Less(i, j int) bool
func (LedgerSlice) Sorted ¶
func (s LedgerSlice) Sorted() LedgerSlice
func (LedgerSlice) Swap ¶
func (s LedgerSlice) Swap(i, j int)
type LimitByteReader ¶
func LimitedByteReader ¶
func LimitedByteReader(r Reader, n int64) *LimitByteReader
func (*LimitByteReader) Len ¶
func (l *LimitByteReader) Len() int
func (*LimitByteReader) ReadByte ¶
func (l *LimitByteReader) ReadByte() (c byte, err error)
func (*LimitByteReader) UnreadByte ¶
func (l *LimitByteReader) UnreadByte() error
type Memo ¶
type Memo struct { Memo struct { MemoType VariableLength MemoData VariableLength MemoFormat VariableLength } }
type MetaData ¶
type MetaData struct { AffectedNodes NodeEffects TransactionIndex uint32 TransactionResult TransactionResult DeliveredAmount *Amount `json:"delivered_amount,omitempty"` }
type NodeEffect ¶
type NodeEffect struct { ModifiedNode *AffectedNode `json:",omitempty"` CreatedNode *AffectedNode `json:",omitempty"` DeletedNode *AffectedNode `json:",omitempty"` }
func (*NodeEffect) AffectedNode ¶
func (effect *NodeEffect) AffectedNode() (*AffectedNode, LedgerEntry, LedgerEntry, LedgerEntryState)
AffectedNode returns the AffectedNode, the current LedgerEntry, the previous LedgerEntry (which might be nil) and the LedgerEntryState
type NodeEffects ¶
type NodeEffects []NodeEffect
type NodeFormat ¶
type NodeFormat uint8
type NodeHeader ¶
type NodeIndex ¶
type NodeIndex uint64
func (NodeIndex) MarshalText ¶
func (*NodeIndex) UnmarshalText ¶
type NonNativeValue ¶
type NonNativeValue struct {
Value
}
func (*NonNativeValue) UnmarshalText ¶
func (v *NonNativeValue) UnmarshalText(b []byte) error
type Offer ¶
type Offer struct { Flags *LedgerEntryFlag `json:",omitempty"` Account *Account `json:",omitempty"` Sequence *uint32 `json:",omitempty"` TakerPays *Amount `json:",omitempty"` TakerGets *Amount `json:",omitempty"` BookDirectory *Hash256 `json:",omitempty"` BookNode *NodeIndex `json:",omitempty"` OwnerNode *NodeIndex `json:",omitempty"` Expiration *uint32 `json:",omitempty"` // contains filtered or unexported fields }
func (*Offer) GetLedgerEntryType ¶
func (le *Offer) GetLedgerEntryType() LedgerEntryType
func (*Offer) GetLedgerIndex ¶
func (le *Offer) GetLedgerIndex() *Hash256
func (*Offer) GetPreviousTxnId ¶
func (le *Offer) GetPreviousTxnId() *Hash256
func (*Offer) Prefix ¶
func (le *Offer) Prefix() HashPrefix
type OfferCancel ¶
type OfferCreate ¶
type OfferCreate struct { TxBase OfferSequence *uint32 `json:",omitempty"` TakerPays Amount TakerGets Amount Expiration *uint32 `json:",omitempty"` }
func (*OfferCreate) Ratio ¶
func (o *OfferCreate) Ratio() *Value
type OrderBookOffer ¶
type OrderBookOffer struct { Offer OwnerFunds Value `json:"owner_funds"` Quality NonNativeValue `json:"quality"` TakerGetsFunded *Amount `json:"taker_gets_funded"` TakerPaysFunded *Amount `json:"taker_pays_funded"` }
func (*OrderBookOffer) GetLedgerEntryType ¶
func (le *OrderBookOffer) GetLedgerEntryType() LedgerEntryType
func (*OrderBookOffer) GetLedgerIndex ¶
func (le *OrderBookOffer) GetLedgerIndex() *Hash256
func (*OrderBookOffer) GetPreviousTxnId ¶
func (le *OrderBookOffer) GetPreviousTxnId() *Hash256
func (*OrderBookOffer) Prefix ¶
func (le *OrderBookOffer) Prefix() HashPrefix
type Path ¶
type Path []PathElem
Path represents a single path of liquidity that a transaction may use.
type PathSet ¶
type PathSet []Path
PathSet represents a collection of possible paths that a transaction may use.
type PayChannel ¶
type PayChannel struct { Flags *LedgerEntryFlag `json:",omitempty"` Account *Account `json:",omitempty"` Destination *Account `json:",omitempty"` Amount *Amount `json:",omitempty"` Balance *Amount `json:",omitempty"` PublicKey *PublicKey `json:",omitempty"` SettleDelay *uint32 `json:",omitempty"` OwnerNode *NodeIndex `json:",omitempty"` Expiration *uint32 `json:",omitempty"` CancelAfter *uint32 `json:",omitempty"` DestinationTag *uint32 `json:",omitempty"` SourceTag *uint32 `json:",omitempty"` // contains filtered or unexported fields }
func (*PayChannel) Affects ¶
func (p *PayChannel) Affects(account Account) bool
func (*PayChannel) GetLedgerEntryType ¶
func (le *PayChannel) GetLedgerEntryType() LedgerEntryType
func (*PayChannel) GetLedgerIndex ¶
func (le *PayChannel) GetLedgerIndex() *Hash256
func (*PayChannel) GetPreviousTxnId ¶
func (le *PayChannel) GetPreviousTxnId() *Hash256
func (*PayChannel) Prefix ¶
func (le *PayChannel) Prefix() HashPrefix
type Payment ¶
type PaymentChannelClaim ¶
type PaymentChannelCreate ¶
type PaymentChannelFund ¶
type Proposal ¶
type Proposal struct { Hash Hash256 LedgerHash Hash256 PreviousLedger Hash256 Sequence uint32 CloseTime RippleTime PublicKey PublicKey Signature VariableLength }
func (*Proposal) GetPublicKey ¶
func (*Proposal) GetSignature ¶
func (p *Proposal) GetSignature() *VariableLength
func (*Proposal) InitialiseForSigning ¶
func (p *Proposal) InitialiseForSigning()
func (*Proposal) Prefix ¶
func (p *Proposal) Prefix() HashPrefix
func (*Proposal) SigningPrefix ¶
func (p *Proposal) SigningPrefix() HashPrefix
func (Proposal) SigningValues ¶
func (p Proposal) SigningValues() []interface{}
func (Proposal) SuppressionId ¶
type PublicKey ¶
type PublicKey [33]byte
func (PublicKey) MarshalText ¶
func (PublicKey) NodePublicKey ¶
func (*PublicKey) UnmarshalText ¶
Expects public key hex
type Reader ¶
type Reader interface { io.ByteScanner io.Reader Len() int }
func NewVariableByteReader ¶
type RegularKey ¶
type RegularKey [20]byte
func NewRegularKeyFromAddress ¶
func NewRegularKeyFromAddress(s string) (*RegularKey, error)
Expects address in base58 form
func (*RegularKey) Bytes ¶
func (r *RegularKey) Bytes() []byte
func (RegularKey) MarshalText ¶
func (r RegularKey) MarshalText() ([]byte, error)
func (RegularKey) String ¶
func (r RegularKey) String() string
func (*RegularKey) Unmarshal ¶
func (k *RegularKey) Unmarshal(r Reader) error
func (*RegularKey) UnmarshalText ¶
func (r *RegularKey) UnmarshalText(b []byte) error
Expects base58-encoded account id
type RippleState ¶
type RippleState struct { Flags *LedgerEntryFlag `json:",omitempty"` LowLimit *Amount `json:",omitempty"` HighLimit *Amount `json:",omitempty"` Balance *Amount `json:",omitempty"` LowNode *NodeIndex `json:",omitempty"` HighNode *NodeIndex `json:",omitempty"` LowQualityIn *uint32 `json:",omitempty"` LowQualityOut *uint32 `json:",omitempty"` HighQualityIn *uint32 `json:",omitempty"` HighQualityOut *uint32 `json:",omitempty"` // contains filtered or unexported fields }
func (*RippleState) Affects ¶
func (r *RippleState) Affects(account Account) bool
func (*RippleState) GetLedgerEntryType ¶
func (le *RippleState) GetLedgerEntryType() LedgerEntryType
func (*RippleState) GetLedgerIndex ¶
func (le *RippleState) GetLedgerIndex() *Hash256
func (*RippleState) GetPreviousTxnId ¶
func (le *RippleState) GetPreviousTxnId() *Hash256
func (*RippleState) Prefix ¶
func (le *RippleState) Prefix() HashPrefix
type RippleTime ¶
type RippleTime struct {
T uint32
}
Represents a time as the number of seconds since the Ripple epoch: January 1st, 2000 (00:00 UTC)
func NewRippleTime ¶
func NewRippleTime(t uint32) *RippleTime
func Now ¶
func Now() *RippleTime
func (RippleTime) MarshalJSON ¶
func (t RippleTime) MarshalJSON() ([]byte, error)
func (*RippleTime) SetString ¶
func (t *RippleTime) SetString(s string) error
Accepts time formatted as 2006-Jan-02 15:04:05
func (*RippleTime) SetUint32 ¶
func (t *RippleTime) SetUint32(n uint32)
func (RippleTime) String ¶
func (t RippleTime) String() string
Returns time formatted as 2006-Jan-02 15:04:05
func (RippleTime) Time ¶
func (t RippleTime) Time() time.Time
func (RippleTime) Uint32 ¶
func (t RippleTime) Uint32() uint32
func (*RippleTime) UnmarshalJSON ¶
func (t *RippleTime) UnmarshalJSON(b []byte) error
type Seed ¶
type Seed [16]byte
func NewSeedFromAddress ¶
Expects address in base58 form
func (Seed) MarshalText ¶
func (*Seed) UnmarshalText ¶
Expects base58-encoded account id
type SetRegularKey ¶
type SetRegularKey struct { TxBase RegularKey *RegularKey `json:",omitempty"` }
type Signer ¶
type Signer interface { Hashable InitialiseForSigning() SigningPrefix() HashPrefix GetPublicKey() *PublicKey GetSignature() *VariableLength }
type SignerEntry ¶
type SignerList ¶
type SignerList struct { Flags *LedgerEntryFlag `json:",omitempty"` OwnerNode *NodeIndex `json:",omitempty"` SignerQuorum *uint32 `json:",omitempty"` SignerEntries []SignerEntry `json:",omitempty"` SignerListID *uint32 `json:",omitempty"` // contains filtered or unexported fields }
func (*SignerList) Affects ¶
func (s *SignerList) Affects(account Account) bool
func (*SignerList) GetLedgerEntryType ¶
func (le *SignerList) GetLedgerEntryType() LedgerEntryType
func (*SignerList) GetLedgerIndex ¶
func (le *SignerList) GetLedgerIndex() *Hash256
func (*SignerList) GetPreviousTxnId ¶
func (le *SignerList) GetPreviousTxnId() *Hash256
func (*SignerList) Prefix ¶
func (le *SignerList) Prefix() HashPrefix
type SignerListSet ¶
type SignerListSet struct { TxBase SignerQuorum uint32 `json:",omitempty"` SignerEntries []SignerEntry `json:",omitempty"` }
type Ticket ¶
type Ticket struct { Flags *LedgerEntryFlag `json:",omitempty"` Account *Account `json:",omitempty"` Sequence *uint32 `json:",omitempty"` OwnerNode *NodeIndex `json:",omitempty"` Target *Account `json:",omitempty"` Expiration *uint32 `json:",omitempty"` // contains filtered or unexported fields }
func (*Ticket) GetLedgerEntryType ¶
func (le *Ticket) GetLedgerEntryType() LedgerEntryType
func (*Ticket) GetLedgerIndex ¶
func (le *Ticket) GetLedgerIndex() *Hash256
func (*Ticket) GetPreviousTxnId ¶
func (le *Ticket) GetPreviousTxnId() *Hash256
func (*Ticket) Prefix ¶
func (le *Ticket) Prefix() HashPrefix
type TicketCancel ¶
type TicketCancel struct {
TicketID Hash256
}
type TicketCreate ¶
type Trade ¶
type TradeSlice ¶
type TradeSlice []Trade
func NewTradeSlice ¶
func NewTradeSlice(txm *TransactionWithMetaData) (TradeSlice, error)
func (TradeSlice) Filter ¶
func (s TradeSlice) Filter(account Account) TradeSlice
func (TradeSlice) Len ¶
func (s TradeSlice) Len() int
func (TradeSlice) Less ¶
func (s TradeSlice) Less(i, j int) bool
func (TradeSlice) Sort ¶
func (s TradeSlice) Sort()
func (TradeSlice) Swap ¶
func (s TradeSlice) Swap(i, j int)
type Transaction ¶
type Transaction interface { Signer GetTransactionType() TransactionType GetBase() *TxBase PathSet() PathSet }
func ReadTransaction ¶
func ReadTransaction(r Reader) (Transaction, error)
type TransactionFlag ¶
type TransactionFlag uint32
const ( //Universal flags TxCanonicalSignature TransactionFlag = 0x80000000 // Payment flags TxNoDirectRipple TransactionFlag = 0x00010000 TxPartialPayment TransactionFlag = 0x00020000 TxLimitQuality TransactionFlag = 0x00040000 TxCircle TransactionFlag = 0x00080000 // Not implemented // AccountSet flags TxSetRequireDest TransactionFlag = 0x00000001 TxSetRequireAuth TransactionFlag = 0x00000002 TxSetDisallowXRP TransactionFlag = 0x00000003 TxSetDisableMaster TransactionFlag = 0x00000004 TxSetAccountTxnID TransactionFlag = 0x00000005 TxNoFreeze TransactionFlag = 0x00000006 TxGlobalFreeze TransactionFlag = 0x00000007 TxDefaultRipple TransactionFlag = 0x00000008 TxRequireDestTag TransactionFlag = 0x00010000 TxOptionalDestTag TransactionFlag = 0x00020000 TxRequireAuth TransactionFlag = 0x00040000 TxOptionalAuth TransactionFlag = 0x00080000 TxDisallowXRP TransactionFlag = 0x00100000 TxAllowXRP TransactionFlag = 0x00200000 // OfferCreate flags TxPassive TransactionFlag = 0x00010000 TxImmediateOrCancel TransactionFlag = 0x00020000 TxFillOrKill TransactionFlag = 0x00040000 TxSell TransactionFlag = 0x00080000 // TrustSet flags TxSetAuth TransactionFlag = 0x00010000 TxSetNoRipple TransactionFlag = 0x00020000 TxClearNoRipple TransactionFlag = 0x00040000 TxSetFreeze TransactionFlag = 0x00100000 TxClearFreeze TransactionFlag = 0x00200000 // EnableAmendments flags TxGotMajority TransactionFlag = 0x00010000 TxLostMajority TransactionFlag = 0x00020000 // PaymentChannelClaim flags TxRenew TransactionFlag = 0x00010000 TxClose TransactionFlag = 0x00020000 )
Transaction Flags
func (TransactionFlag) Explain ¶
func (f TransactionFlag) Explain(tx Transaction) []string
func (TransactionFlag) String ¶
func (f TransactionFlag) String() string
type TransactionResult ¶
type TransactionResult int16
func (TransactionResult) Human ¶
func (r TransactionResult) Human() string
func (TransactionResult) MarshalText ¶
func (r TransactionResult) MarshalText() ([]byte, error)
func (TransactionResult) Queued ¶
func (r TransactionResult) Queued() bool
func (TransactionResult) String ¶
func (r TransactionResult) String() string
func (TransactionResult) Success ¶
func (r TransactionResult) Success() bool
func (TransactionResult) Symbol ¶
func (r TransactionResult) Symbol() string
func (*TransactionResult) Unmarshal ¶
func (res *TransactionResult) Unmarshal(r Reader) error
func (*TransactionResult) UnmarshalText ¶
func (r *TransactionResult) UnmarshalText(b []byte) error
type TransactionSlice ¶
type TransactionSlice []*TransactionWithMetaData
func (TransactionSlice) Len ¶
func (s TransactionSlice) Len() int
func (TransactionSlice) Less ¶
func (s TransactionSlice) Less(i, j int) bool
func (TransactionSlice) MarshalJSON ¶
func (s TransactionSlice) MarshalJSON() ([]byte, error)
func (TransactionSlice) Sort ¶
func (s TransactionSlice) Sort()
func (TransactionSlice) Swap ¶
func (s TransactionSlice) Swap(i, j int)
type TransactionType ¶
type TransactionType uint16
func (TransactionType) MarshalText ¶
func (t TransactionType) MarshalText() ([]byte, error)
func (TransactionType) String ¶
func (t TransactionType) String() string
func (*TransactionType) UnmarshalText ¶
func (t *TransactionType) UnmarshalText(b []byte) error
type TransactionWithMetaData ¶
type TransactionWithMetaData struct { Transaction MetaData MetaData `json:"meta"` Date RippleTime `json:"date"` LedgerSequence uint32 `json:"ledger_index"` Id Hash256 `json:"-"` }
func NewTransactionWithMetadata ¶
func NewTransactionWithMetadata(typ TransactionType) *TransactionWithMetaData
func ReadTransactionAndMetadata ¶
func ReadTransactionAndMetadata(tx, meta Reader, hash Hash256, ledger uint32) (*TransactionWithMetaData, error)
ReadTransactionAndMetadata combines the inputs from the two readers into a TransactionWithMetaData
func (*TransactionWithMetaData) Affects ¶
func (t *TransactionWithMetaData) Affects(account Account) bool
func (*TransactionWithMetaData) Balances ¶
func (txm *TransactionWithMetaData) Balances() (BalanceMap, error)
func (*TransactionWithMetaData) GetType ¶
func (t *TransactionWithMetaData) GetType() string
func (*TransactionWithMetaData) Ledger ¶
func (t *TransactionWithMetaData) Ledger() uint32
func (TransactionWithMetaData) MarshalJSON ¶
func (txm TransactionWithMetaData) MarshalJSON() ([]byte, error)
func (*TransactionWithMetaData) NodeId ¶
func (t *TransactionWithMetaData) NodeId() *Hash256
func (*TransactionWithMetaData) NodeType ¶
func (t *TransactionWithMetaData) NodeType() NodeType
func (*TransactionWithMetaData) Prefix ¶
func (t *TransactionWithMetaData) Prefix() HashPrefix
func (*TransactionWithMetaData) UnmarshalJSON ¶
func (txm *TransactionWithMetaData) UnmarshalJSON(b []byte) error
This function is a horrow show, demonstrating the huge inconsistencies in the presentation of a transaction by the rippled API. Indeed.
type Transfer ¶
type Transfer struct { Source Account Destination Account SourceBalance Amount DestinationBalance Amount Change Value TransitFee *Value // Applies to all transfers except XRP -> XRP QualityIn *Value // Applies to IOU -> IOU transfers QualityOut *Value // Applies to IOU -> IOU transfers }
Transfer is a directional representation of a RippleState or AccountRoot balance change. Payments and OfferCreates lead to the creation of zero or more Transfers.
TransitFee is earned by the Issuer QualityIn and QualityOut are earned by the Liquidity Provider and can be negative.
Four scenarios:
- XRP -> XRP
- XRP -> IOU/Issuer Requires an orderbook
- IOU/Issuer -> XRP Requires an orderbook
- IOU/IssuerA <-> IOU/IssuerB Also known as Rippling, requires an account which trusts both currency/issuer pairs
type TxBase ¶
type TxBase struct { TransactionType TransactionType Flags *TransactionFlag `json:",omitempty"` SourceTag *uint32 `json:",omitempty"` Account Account Sequence uint32 Fee Value AccountTxnID *Hash256 `json:",omitempty"` SigningPubKey *PublicKey `json:",omitempty"` TxnSignature *VariableLength `json:",omitempty"` Memos Memos `json:",omitempty"` PreviousTxnID *Hash256 `json:",omitempty"` LastLedgerSequence *uint32 `json:",omitempty"` Hash Hash256 `json:"hash"` }
func (*TxBase) GetPublicKey ¶
func (*TxBase) GetSignature ¶
func (t *TxBase) GetSignature() *VariableLength
func (*TxBase) GetTransactionType ¶
func (t *TxBase) GetTransactionType() TransactionType
func (*TxBase) InitialiseForSigning ¶
func (t *TxBase) InitialiseForSigning()
func (*TxBase) Prefix ¶
func (t *TxBase) Prefix() HashPrefix
func (*TxBase) SigningPrefix ¶
func (t *TxBase) SigningPrefix() HashPrefix
type Uint64Hex ¶
type Uint64Hex uint64
A uint64 which gets represented as a hex string in json
func (Uint64Hex) MarshalText ¶
func (*Uint64Hex) UnmarshalText ¶
type Validation ¶
type Validation struct { Hash Hash256 Flags uint32 LedgerHash Hash256 LedgerSequence uint32 Amendments Vector256 SigningTime RippleTime SigningPubKey PublicKey Signature VariableLength CloseTime *uint32 LoadFee *uint32 BaseFee *uint64 ReserveBase *uint32 ReserveIncrement *uint32 }
func ReadValidation ¶
func ReadValidation(r Reader) (*Validation, error)
func (Validation) GetHash ¶
func (v Validation) GetHash() *Hash256
func (Validation) GetPublicKey ¶
func (v Validation) GetPublicKey() *PublicKey
func (Validation) GetSignature ¶
func (v Validation) GetSignature() *VariableLength
func (Validation) GetType ¶
func (v Validation) GetType() string
func (Validation) InitialiseForSigning ¶
func (v Validation) InitialiseForSigning()
func (Validation) Prefix ¶
func (v Validation) Prefix() HashPrefix
func (Validation) SigningPrefix ¶
func (v Validation) SigningPrefix() HashPrefix
func (Validation) SuppressionId ¶
func (v Validation) SuppressionId() (Hash256, error)
type Value ¶
type Value struct {
// contains filtered or unexported fields
}
Value is the numeric type in Ripple. It can store numbers in two different representations: native and non-native. Non-native numbers are stored as a mantissa (Num) in the range [1e15,1e16) plus an exponent (Offset) in the range [-96,80]. Native values are stored as an integer number of "drips" each representing 1/1000000. Throughout the library, native values are interpreted as drips unless otherwise specified.
func NewNativeValue ¶
NewNativeValue returns a Value with n drops. If the value is impossible an error is returned.
func NewNonNativeValue ¶
NewNonNativeValue returns a Value of n*10^offset.
func NewValue ¶
NewValue accepts a string representation of a value and a flag to indicate if it should be stored as native. If the native flag is set AND a decimal is used, the number is interpreted as XRP. If no decimal is used, it is interpreted as drips.
func (Value) Add ¶
Add adds a to b and returns the sum as a new Value.
Example ¶
v1, _ := NewValue("100", false) v2, _ := NewValue("200.199", false) sum, _ := v1.Add(*v2) fmt.Println(v1.String()) fmt.Println(v2.String()) fmt.Println(sum.String())
Output: 100 200.199 300.199
func (Value) Compare ¶
Compare returns an integer comparing two Values. The result will be 0 if a==b, -1 if a < b, and +1 if a > b.
func (Value) IsNegative ¶
func (Value) MarshalBinary ¶
func (*Value) MarshalText ¶
func (Value) Ratio ¶
Ratio returns the ratio a/b. XRP are interpreted at face value rather than drips. The result of Ratio is always a non-native Value for additional precision.
func (Value) String ¶
String returns the Value as a string for human consumption. Native values are represented as decimal XRP rather than drips.
func (*Value) UnmarshalBinary ¶
func (*Value) UnmarshalText ¶
type VariableLength ¶
type VariableLength []byte
func (*VariableLength) Bytes ¶
func (v *VariableLength) Bytes() []byte
func (VariableLength) MarshalText ¶
func (v VariableLength) MarshalText() ([]byte, error)
func (*VariableLength) String ¶
func (v *VariableLength) String() string
func (*VariableLength) Unmarshal ¶
func (v *VariableLength) Unmarshal(r Reader) error
func (*VariableLength) UnmarshalText ¶
func (v *VariableLength) UnmarshalText(b []byte) error
Expects variable length hex
type Work ¶
type Work struct { *LedgerRange MissingLedgers LedgerSlice MissingNodes []Hash256 }
Source Files ¶
- amount.go
- balance.go
- currency.go
- decoder.go
- doc.go
- encoder.go
- factory.go
- flags.go
- format.go
- hash.go
- index.go
- inner.go
- interface.go
- json.go
- ledger.go
- ledgerentry.go
- ledgerset.go
- memo.go
- metadata.go
- orderbook.go
- path.go
- proposal.go
- reader.go
- result.go
- signing.go
- time.go
- trade.go
- transaction.go
- util.go
- validation.go
- value.go
- wire.go