data

package
v0.0.0-...-6816ca3 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2024 License: ISC Imports: 20 Imported by: 60

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

Examples

Constants

View Source
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 = 0x43 // 'C'
	DEPOSIT_PRE_AUTH LedgerEntryType = 0x70 // 'p'
	NEGATIVE_UNL     LedgerEntryType = 0x4e // 'N'
	NFTOKEN_PAGE     LedgerEntryType = 0x50 // 'P'
	NFTOKEN_OFFER    LedgerEntryType = 0x37 // '7'
	AMM_LT           LedgerEntryType = 0x79

	// 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
	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
	SET_DEPOSIT_PREAUTH  TransactionType = 19
	TRUST_SET            TransactionType = 20
	ACCOUNT_DELETE       TransactionType = 21
	HOOK_SET             TransactionType = 22
	NFTOKEN_MINT         TransactionType = 25
	NFTOKEN_BURN         TransactionType = 26
	NFTOKEN_CREATE_OFFER TransactionType = 27
	NFTOKEN_CANCEL_OFFER TransactionType = 28
	NFTOKEN_ACCEPT_OFFER TransactionType = 29
	CLAWBACK             TransactionType = 30
	AMM_CREATE           TransactionType = 35
	AMM_DEPOSIT          TransactionType = 36
	AMM_WITHDRAW         TransactionType = 37
	AMM_VOTE             TransactionType = 38
	AMM_BID              TransactionType = 39
	AMM_DELETE           TransactionType = 40

	AMENDMENT  TransactionType = 100
	SET_FEE    TransactionType = 101
	UNL_MODIFY TransactionType = 102
)
View Source
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_TRANSACTION_MULTISIGN HashPrefix = 0x534D5400 // 'SMT' inner transaction to multi-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'
	NS_CHECK           LedgerNamespace = 'C'
	NS_DEPOSIT_PREAUTH LedgerNamespace = 'p'
	NS_NEGATIVE_UNL    LedgerNamespace = 'N'
	NS_AMM             LedgerNamespace = 'A'
)
View Source
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
	ST_HASH96        uint8 = 20
	ST_HASH192       uint8 = 21
	ST_HASH384       uint8 = 22
	ST_HASH512       uint8 = 23
	ST_ISSUE         uint8 = 24
	ST_XCHAIN_BRIDGE uint8 = 25
)
View Source
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

View Source
var HashableTypes []string
View Source
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}} },
	NEGATIVE_UNL:     func() LedgerEntry { return &NegativeUNL{leBase: leBase{LedgerEntryType: NEGATIVE_UNL}} },
	NFTOKEN_PAGE:     func() LedgerEntry { return &NFTokenPage{leBase: leBase{LedgerEntryType: NFTOKEN_PAGE}} },
	NFTOKEN_OFFER:    func() LedgerEntry { return &NFTokenOffer{leBase: leBase{LedgerEntryType: NFTOKEN_OFFER}} },
	AMM_LT:           func() LedgerEntry { return &AMM{leBase: leBase{LedgerEntryType: AMM_LT}} },
}
View Source
var LedgerFactory = [...]func() Hashable{
	func() Hashable { return &Ledger{} },
}
View Source
var TxFactory = [...]func() Transaction{
	PAYMENT:              func() Transaction { return &Payment{TxBase: TxBase{TransactionType: PAYMENT}} },
	ACCOUNT_SET:          func() Transaction { return &AccountSet{TxBase: TxBase{TransactionType: ACCOUNT_SET}} },
	ACCOUNT_DELETE:       func() Transaction { return &AccountDelete{TxBase: TxBase{TransactionType: ACCOUNT_DELETE}} },
	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}} },
	UNL_MODIFY:           func() Transaction { return &UNLModify{TxBase: TxBase{TransactionType: UNL_MODIFY}} },
	TICKET_CREATE:        func() Transaction { return &TicketCreate{TxBase: TxBase{TransactionType: TICKET_CREATE}} },
	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}} },
	SET_DEPOSIT_PREAUTH:  func() Transaction { return &SetDepositPreAuth{TxBase: TxBase{TransactionType: SET_DEPOSIT_PREAUTH}} },
	NFTOKEN_MINT:         func() Transaction { return &NFTokenMint{TxBase: TxBase{TransactionType: NFTOKEN_MINT}} },
	NFTOKEN_BURN:         func() Transaction { return &NFTokenBurn{TxBase: TxBase{TransactionType: NFTOKEN_BURN}} },
	NFTOKEN_CREATE_OFFER: func() Transaction { return &NFTokenCreateOffer{TxBase: TxBase{TransactionType: NFTOKEN_CREATE_OFFER}} },
	NFTOKEN_CANCEL_OFFER: func() Transaction { return &NFTCancelOffer{TxBase: TxBase{TransactionType: NFTOKEN_CANCEL_OFFER}} },
	NFTOKEN_ACCEPT_OFFER: func() Transaction { return &NFTAcceptOffer{TxBase: TxBase{TransactionType: NFTOKEN_ACCEPT_OFFER}} },
	CLAWBACK:             func() Transaction { return &Clawback{TxBase: TxBase{TransactionType: CLAWBACK}} },
	AMM_CREATE:           func() Transaction { return &AMMCreate{TxBase: TxBase{TransactionType: AMM_CREATE}} },
	AMM_DEPOSIT:          func() Transaction { return &AMMDeposit{TxBase: TxBase{TransactionType: AMM_DEPOSIT}} },
	AMM_WITHDRAW:         func() Transaction { return &AMMWithdraw{TxBase: TxBase{TransactionType: AMM_WITHDRAW}} },
	AMM_VOTE:             func() Transaction { return &AMMVote{TxBase: TxBase{TransactionType: AMM_VOTE}} },
	AMM_BID:              func() Transaction { return &AMMBid{TxBase: TxBase{TransactionType: AMM_BID}} },
	AMM_DELETE:           func() Transaction { return &AMMDelete{TxBase: TxBase{TransactionType: AMM_DELETE}} },
}

Functions

func CheckSignature

func CheckSignature(s Signable) (bool, error)

func GetLedgerEntryFactoryByType

func GetLedgerEntryFactoryByType(leType string) func() LedgerEntry

func GetTxFactoryByType

func GetTxFactoryByType(txType string) func() Transaction

func MultiSign

func MultiSign(s MultiSignable, key crypto.Key, sequence *uint32, account Account) error

func SetSigners

func SetSigners(s MultiSignable, signers ...Signer) error

func Sign

func Sign(s Signable, key crypto.Key, sequence *uint32) error

Types

type AMM

type AMM struct {
	Flags          *LedgerEntryFlag `json:",omitempty"`
	Account        *Account         `json:",omitempty"`
	TradingFee     *uint16          `json:",omitempty"`
	VoteSlots      []VoteEntry      `json:",omitempty"`
	AuctionSlot    *AuctionSlot     `json:",omitempty"`
	LPTokenBalance *Amount          `json:",omitempty"`
	Asset          *Issue           `json:",omitempty"`
	Asset2         *Issue           `json:",omitempty"`
	OwnerNode      *NodeIndex       `json:",omitempty"`
	// contains filtered or unexported fields
}

func (*AMM) Affects

func (a *AMM) Affects(account Account) bool

func (*AMM) GetHash

func (le *AMM) GetHash() *Hash256

func (*AMM) GetLedgerEntryType

func (le *AMM) GetLedgerEntryType() LedgerEntryType

func (*AMM) GetLedgerIndex

func (le *AMM) GetLedgerIndex() *Hash256

func (*AMM) GetPreviousTxnId

func (le *AMM) GetPreviousTxnId() *Hash256

func (*AMM) GetType

func (le *AMM) GetType() string

func (*AMM) Ledger

func (le *AMM) Ledger() uint32

func (*AMM) NodeId

func (le *AMM) NodeId() *Hash256

func (*AMM) NodeType

func (le *AMM) NodeType() NodeType

func (*AMM) Prefix

func (le *AMM) Prefix() HashPrefix

type AMMBid

type AMMBid struct {
	TxBase
	Asset        Asset
	Asset2       Asset
	BidMin       *Amount       `json:",omitempty"`
	BidMax       *Amount       `json:",omitempty"`
	AuthAccounts []AuthAccount `json:",omitempty"`
}

type AMMCreate

type AMMCreate struct {
	TxBase
	Amount     Amount
	Amount2    Amount
	TradingFee uint16
}

type AMMDelete

type AMMDelete struct {
	TxBase
	Asset  Asset
	Asset2 Asset
}

type AMMDeposit

type AMMDeposit struct {
	TxBase
	Asset      Asset
	Asset2     Asset
	Amount     *Amount `json:",omitempty"`
	Amount2    *Amount `json:",omitempty"`
	EPrice     *Amount `json:",omitempty"`
	LPTokenOut *Amount `json:",omitempty"`
	TradingFee *uint16 `json:",omitempty"`
}

type AMMVote

type AMMVote struct {
	TxBase
	Asset      Asset
	Asset2     Asset
	TradingFee uint16
}

type AMMWithdraw

type AMMWithdraw struct {
	TxBase
	Asset     Asset
	Asset2    Asset
	Amount    *Amount `json:",omitempty"`
	Amount2   *Amount `json:",omitempty"`
	EPrice    *Amount `json:",omitempty"`
	LPTokenIn *Amount `json:",omitempty"`
}

type Account

type Account [20]byte

func NewAccountFromAddress

func NewAccountFromAddress(s string) (*Account, error)

Expects address in base58 form

func (*Account) Bytes

func (a *Account) Bytes() []byte

func (Account) Compare

func (a Account) Compare(b Account) int

func (Account) Equals

func (a Account) Equals(b Account) bool

func (Account) Hash

func (a Account) Hash() (crypto.Hash, error)

func (Account) Hash256

func (a Account) Hash256() Hash256

func (Account) IsZero

func (a Account) IsZero() bool

func (Account) Less

func (a Account) Less(b Account) bool

func (*Account) Marshal

func (a *Account) Marshal(w io.Writer) error

func (Account) MarshalText

func (a Account) MarshalText() ([]byte, error)

func (Account) String

func (a Account) String() string

func (*Account) Unmarshal

func (a *Account) Unmarshal(r Reader) error

func (*Account) UnmarshalText

func (a *Account) UnmarshalText(b []byte) error

Expects base58-encoded account id

type AccountDelete

type AccountDelete struct {
	TxBase
	Destination    Account
	DestinationTag *uint32 `json:",omitempty"`
	TicketSequence *uint32 `json:",omitempty"`
}

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"`
	Authorized     bool           `json:"authorized"`
	AuthorizedPeer bool           `json:"peer_authorized"`
	Freeze         bool           `json:"freeze"`
	FreezePeer     bool           `json:"freeze_peer"`
	QualityIn      uint32         `json:"quality_in"`
	QualityOut     uint32         `json:"quality_out"`
}

func (*AccountLine) Asset

func (l *AccountLine) Asset() *Asset

func (*AccountLine) BalanceAmount

func (l *AccountLine) BalanceAmount() *Amount

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"`
	AMMID                *Hash256         `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"`
	TransferRate         *uint32          `json:",omitempty"`
	Domain               *VariableLength  `json:",omitempty"`
	TickSize             *uint8           `json:",omitempty"`
	TicketCount          *uint32          `json:",omitempty"`
	NFTokenMinter        *Account         `json:",omitempty"`
	MintedNFTokens       *uint32          `json:",omitempty"`
	BurnedNFTokens       *uint32          `json:",omitempty"`
	FirstNFTokenSequence *uint32          `json:",omitempty"`
	// contains filtered or unexported fields
}

func (*AccountRoot) Affects

func (a *AccountRoot) Affects(account Account) bool

func (*AccountRoot) GetHash

func (le *AccountRoot) GetHash() *Hash256

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

func (le *AccountRoot) GetType() string

func (*AccountRoot) Ledger

func (le *AccountRoot) Ledger() uint32

func (*AccountRoot) NodeId

func (le *AccountRoot) NodeId() *Hash256

func (*AccountRoot) NodeType

func (le *AccountRoot) NodeType() NodeType

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"`
	TicketSequence *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 Amendment

type Amendment struct {
	TxBase
	Amendment Hash256
}

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

func (le *Amendments) GetHash() *Hash256

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

func (le *Amendments) GetType() string

func (*Amendments) Ledger

func (le *Amendments) Ledger() uint32

func (*Amendments) NodeId

func (le *Amendments) NodeId() *Hash256

func (*Amendments) NodeType

func (le *Amendments) NodeType() NodeType

func (*Amendments) Prefix

func (le *Amendments) Prefix() HashPrefix

type Amount

type Amount struct {
	*Value
	Currency Currency
	Issuer   Account
}

func NewAmount

func NewAmount(v interface{}) (*Amount, error)

Requires v to be in computer parsable form

func (Amount) Abs

func (a Amount) Abs() *Amount

func (Amount) Add

func (a Amount) Add(b *Amount) (*Amount, error)

func (Amount) ApplyInterest

func (a Amount) ApplyInterest() (*Amount, error)

func (Amount) Asset

func (a Amount) Asset() *Asset

func (Amount) Bytes

func (a Amount) Bytes() []byte

func (Amount) Clone

func (a Amount) Clone() *Amount

func (Amount) Divide

func (a Amount) Divide(b *Amount) (*Amount, error)

func (Amount) Equals

func (a Amount) Equals(b Amount) bool

func (Amount) IsPositive

func (a Amount) IsPositive() bool

func (Amount) Machine

func (a Amount) Machine() string

Amount in computer parsable form

func (*Amount) Marshal

func (a *Amount) Marshal(w io.Writer) error

func (Amount) MarshalBinary

func (a Amount) MarshalBinary() ([]byte, error)

func (Amount) MarshalJSON

func (a Amount) MarshalJSON() ([]byte, error)

func (Amount) Multiply

func (a Amount) Multiply(b *Amount) (*Amount, error)

func (Amount) Negate

func (a Amount) Negate() *Amount

func (Amount) Ratio

func (a Amount) Ratio(b Amount) *Value

Ratio returns the ratio between a and b. Returns a zero value when division is impossible

func (Amount) SameValue

func (a Amount) SameValue(b *Amount) bool

Returns true if the values are equal, but ignores the currency and issuer

func (Amount) String

func (a Amount) String() string

Amount in human parsable form with demurrage applied

func (Amount) Subtract

func (a Amount) Subtract(b *Amount) (*Amount, error)

func (*Amount) Unmarshal

func (a *Amount) Unmarshal(r Reader) error

func (*Amount) UnmarshalBinary

func (a *Amount) UnmarshalBinary(b []byte) error

func (*Amount) UnmarshalJSON

func (a *Amount) UnmarshalJSON(b []byte) (err error)

func (Amount) ZeroClone

func (a Amount) ZeroClone() *Amount

Returns a new Amount with the same currency and issuer, but a zero value

type Asset

type Asset struct {
	Currency string `json:"currency"`
	Issuer   string `json:"issuer,omitempty"`
}

func NewAsset

func NewAsset(s string) (*Asset, error)

func (*Asset) IsNative

func (a *Asset) IsNative() bool

func (*Asset) Matches

func (a *Asset) Matches(amount *Amount) bool

func (Asset) String

func (a Asset) String() string

type AuctionSlot

type AuctionSlot struct {
	Account       *Account      `json:",omitempty"`
	AuthAccounts  []AuthAccount `json:",omitempty"`
	DiscountedFee *uint16       `json:",omitempty"`
	Price         *Amount       `json:",omitempty"`
	Expiration    *uint32       `json:",omitempty"`
}

type AuthAccount

type AuthAccount struct {
	AuthAccount AuthAccountItem `json:",omitempty"`
}

type AuthAccountItem

type AuthAccountItem struct {
	Account Account `json:",omitempty"`
}

type Balance

type Balance struct {
	CounterParty Account
	Balance      Value
	Change       Value
	Currency     Currency
}

func (Balance) String

func (b Balance) String() string

type BalanceMap

type BalanceMap map[Account]*BalanceSlice

func (*BalanceMap) Add

func (m *BalanceMap) Add(account *Account, counterparty *Account, balance, change *Value, currency *Currency)

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 {
	Flags           *LedgerEntryFlag `json:",omitempty"`
	Account         *Account         `json:",omitempty"`
	Destination     *Account         `json:",omitempty"`
	SendMax         *Amount          `json:",omitempty"`
	Sequence        *uint32          `json:",omitempty"`
	OwnerNode       *NodeIndex       `json:",omitempty"`
	DestinationNode *NodeIndex       `json:",omitempty"`
	Expiration      *uint32          `json:",omitempty"`
	InvoiceID       *Hash256         `json:",omitempty"`
	SourceTag       *uint32          `json:",omitempty"`
	DestinationTag  *uint32          `json:",omitempty"`
	// contains filtered or unexported fields
}

func (*Check) Affects

func (p *Check) Affects(account Account) bool

func (*Check) GetHash

func (le *Check) GetHash() *Hash256

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

func (le *Check) GetType() string

func (*Check) Ledger

func (le *Check) Ledger() uint32

func (*Check) NodeId

func (le *Check) NodeId() *Hash256

func (*Check) NodeType

func (le *Check) NodeType() NodeType

func (*Check) Prefix

func (le *Check) Prefix() HashPrefix

type CheckCancel

type CheckCancel struct {
	TxBase
	CheckID        Hash256
	TicketSequence *uint32 `json:",omitempty"`
}

https://ripple.com/build/transactions/#checkcancel

type CheckCash

type CheckCash struct {
	TxBase
	CheckID        Hash256
	Amount         *Amount `json:",omitempty"`
	DeliverMin     *Amount `json:",omitempty"`
	TicketSequence *uint32 `json:",omitempty"`
}

https://ripple.com/build/transactions/#checkcash Must include one of Amount or DeliverMin

type CheckCreate

type CheckCreate struct {
	TxBase
	Destination    Account
	SendMax        Amount
	DestinationTag *uint32  `json:",omitempty"`
	Expiration     *uint32  `json:",omitempty"`
	InvoiceID      *Hash256 `json:",omitempty"`
	TicketSequence *uint32  `json:",omitempty"`
}

https://ripple.com/build/transactions/#checkcreate

type Clawback

type Clawback struct {
	TxBase
	Amount Amount
}

type CompressedNodeEntry

type CompressedNodeEntry struct {
	Hash Hash256
	Pos  uint8
}

type Currency

type Currency [20]byte

func NewCurrency

func NewCurrency(s string) (Currency, error)

Accepts currency as either a 3 character code or a 40 character hex string

func (*Currency) Bytes

func (c *Currency) Bytes() []byte

func (Currency) Clone

func (c Currency) Clone() Currency

func (Currency) Compare

func (a Currency) Compare(b Currency) int

func (Currency) Equals

func (c Currency) Equals(other Currency) bool

func (Currency) IsNative

func (c Currency) IsNative() bool

func (Currency) Less

func (a Currency) Less(b Currency) bool

func (Currency) Machine

func (c Currency) Machine() string

Currency in computer parsable form

func (*Currency) Marshal

func (c *Currency) Marshal(w io.Writer) error

func (Currency) MarshalText

func (c Currency) MarshalText() ([]byte, error)

func (Currency) Rate

func (c Currency) Rate(seconds uint32) float64

func (Currency) String

func (c Currency) String() 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) Unmarshal

func (c *Currency) Unmarshal(r Reader) error

func (*Currency) UnmarshalText

func (c *Currency) UnmarshalText(text []byte) error

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 {
	Flags     *LedgerEntryFlag `json:",omitempty"`
	Account   *Account         `json:",omitempty"`
	Authorize *Account         `json:",omitempty"`
	OwnerNode *NodeIndex       `json:",omitempty"`
	// contains filtered or unexported fields
}

func (*DepositPreAuth) Affects

func (d *DepositPreAuth) Affects(account Account) bool

func (*DepositPreAuth) GetHash

func (le *DepositPreAuth) GetHash() *Hash256

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

func (le *DepositPreAuth) GetType() string

func (*DepositPreAuth) Ledger

func (le *DepositPreAuth) Ledger() uint32

func (*DepositPreAuth) NodeId

func (le *DepositPreAuth) NodeId() *Hash256

func (*DepositPreAuth) NodeType

func (le *DepositPreAuth) NodeType() NodeType

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"`
	NFTokenID         *Hash256         `json:",omitempty"`
	// contains filtered or unexported fields
}

func (*Directory) Affects

func (d *Directory) Affects(account Account) bool

func (*Directory) GetHash

func (le *Directory) GetHash() *Hash256

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

func (le *Directory) GetType() string

func (*Directory) Ledger

func (le *Directory) Ledger() uint32

func (*Directory) NodeId

func (le *Directory) NodeId() *Hash256

func (*Directory) NodeType

func (le *Directory) NodeType() NodeType

func (*Directory) Prefix

func (le *Directory) Prefix() HashPrefix

type DisabledValidator

type DisabledValidator struct {
	FirstLedgerSequence *uint32    `json:",omitempty"`
	PublicKey           *PublicKey `json:",omitempty"`
}

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

func (s *Escrow) Affects(account Account) bool

func (*Escrow) GetHash

func (le *Escrow) GetHash() *Hash256

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

func (le *Escrow) GetType() string

func (*Escrow) Ledger

func (le *Escrow) Ledger() uint32

func (*Escrow) NodeId

func (le *Escrow) NodeId() *Hash256

func (*Escrow) NodeType

func (le *Escrow) NodeType() NodeType

func (*Escrow) Prefix

func (le *Escrow) Prefix() HashPrefix

type EscrowCancel

type EscrowCancel struct {
	TxBase
	Owner          Account
	OfferSequence  uint32
	TicketSequence *uint32 `json:",omitempty"`
}

type EscrowCreate

type EscrowCreate struct {
	TxBase
	Destination    Account
	Amount         Amount
	Digest         *Hash256 `json:",omitempty"`
	CancelAfter    *uint32  `json:",omitempty"`
	FinishAfter    *uint32  `json:",omitempty"`
	DestinationTag *uint32  `json:",omitempty"`
	TicketSequence *uint32  `json:",omitempty"`
}

type EscrowFinish

type EscrowFinish struct {
	TxBase
	Owner          Account
	OfferSequence  uint32
	Method         *uint8   `json:",omitempty"`
	Digest         *Hash256 `json:",omitempty"`
	Proof          *Hash256 `json:",omitempty"`
	TicketSequence *uint32  `json:",omitempty"`
}

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"`
	BaseFeeDrops          *Amount          `json:",omitempty"`
	ReserveBaseDrops      *Amount          `json:",omitempty"`
	ReserveIncrementDrops *Amount          `json:",omitempty"`
	// contains filtered or unexported fields
}

func (*FeeSettings) Affects

func (f *FeeSettings) Affects(account Account) bool

func (*FeeSettings) GetHash

func (le *FeeSettings) GetHash() *Hash256

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

func (le *FeeSettings) GetType() string

func (*FeeSettings) Ledger

func (le *FeeSettings) Ledger() uint32

func (*FeeSettings) NodeId

func (le *FeeSettings) NodeId() *Hash256

func (*FeeSettings) NodeType

func (le *FeeSettings) NodeType() NodeType

func (*FeeSettings) Prefix

func (le *FeeSettings) Prefix() HashPrefix

type Hash128

type Hash128 [16]byte

func (*Hash128) Bytes

func (h *Hash128) Bytes() []byte

func (*Hash128) Marshal

func (h *Hash128) Marshal(w io.Writer) error

func (Hash128) MarshalText

func (h Hash128) MarshalText() ([]byte, error)

func (Hash128) String

func (h Hash128) String() string

func (*Hash128) Unmarshal

func (h *Hash128) Unmarshal(r Reader) error

func (*Hash128) UnmarshalText

func (h *Hash128) UnmarshalText(b []byte) error

type Hash160

type Hash160 [20]byte

func (*Hash160) Account

func (h *Hash160) Account() *Account

func (*Hash160) Bytes

func (h *Hash160) Bytes() []byte

func (*Hash160) Currency

func (h *Hash160) Currency() *Currency

func (*Hash160) Marshal

func (h *Hash160) Marshal(w io.Writer) error

func (Hash160) MarshalText

func (h Hash160) MarshalText() ([]byte, error)

func (Hash160) String

func (h Hash160) String() string

func (*Hash160) Unmarshal

func (h *Hash160) Unmarshal(r Reader) error

func (*Hash160) UnmarshalText

func (h *Hash160) UnmarshalText(b []byte) error

type Hash256

type Hash256 [32]byte

func GetAccountRootIndex

func GetAccountRootIndex(account Account) (*Hash256, error)

func GetAmendmentsIndex

func GetAmendmentsIndex() (*Hash256, error)

func GetBookIndex

func GetBookIndex(paysCurrency, getsCurrency Hash160, paysIssuer, getsIssuer Hash160) (*Hash256, error)

func GetDirectoryNodeIndex

func GetDirectoryNodeIndex(root Hash256, index *NodeIndex) (*Hash256, error)

func GetFeeIndex

func GetFeeIndex() (*Hash256, error)

func GetLedgerHashIndex

func GetLedgerHashIndex() (*Hash256, error)

func GetOfferIndex

func GetOfferIndex(account Account, sequence uint32) (*Hash256, error)

func GetOwnerDirectoryIndex

func GetOwnerDirectoryIndex(account Account) (*Hash256, error)

func GetPreviousLedgerHashIndex

func GetPreviousLedgerHashIndex(sequence uint32) (*Hash256, error)

func GetRippleStateIndex

func GetRippleStateIndex(a, b Account, c Currency) (*Hash256, error)

func LedgerIndex

func LedgerIndex(le LedgerEntry) (*Hash256, error)

func MultiSigningHash

func MultiSigningHash(s MultiSignable, account Account) (Hash256, []byte, error)

func NewHash256

func NewHash256(value interface{}) (*Hash256, error)

Accepts either a hex string or a byte slice of length 32

func Node

func Node(h Storer) (Hash256, []byte, error)

func NodeId

func NodeId(h Hashable) (Hash256, error)

func Raw

func Raw(h Hashable) (Hash256, []byte, error)

func SigningHash

func SigningHash(s Signable) (Hash256, []byte, error)

func (*Hash256) Bytes

func (h *Hash256) Bytes() []byte

func (Hash256) Compare

func (h Hash256) Compare(x Hash256) int

func (Hash256) IsZero

func (h Hash256) IsZero() bool

func (*Hash256) Marshal

func (h *Hash256) Marshal(w io.Writer) error

func (Hash256) MarshalText

func (h Hash256) MarshalText() ([]byte, error)

func (Hash256) String

func (h Hash256) String() string

func (Hash256) TruncatedString

func (h Hash256) TruncatedString(length int) string

func (*Hash256) Unmarshal

func (h *Hash256) Unmarshal(r Reader) error

func (*Hash256) UnmarshalText

func (h *Hash256) UnmarshalText(b []byte) error

func (Hash256) Xor

func (h Hash256) Xor(x Hash256) Hash256

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
}

func ReadWire

func ReadWire(r Reader, typ NodeType, ledgerSequence uint32, nodeId Hash256) (Hashable, error)

ReadWire parses types received via the peer network

type InnerNode

type InnerNode struct {
	Id       Hash256
	Type     NodeType
	Children [16]Hash256
}

func (InnerNode) Count

func (n InnerNode) Count() int

func (InnerNode) Each

func (n InnerNode) Each(f InnerNodeFunc) error

func (InnerNode) GetHash

func (n InnerNode) GetHash() *Hash256

func (InnerNode) GetType

func (n InnerNode) GetType() string

func (InnerNode) Ledger

func (n InnerNode) Ledger() uint32

func (InnerNode) NodeId

func (n InnerNode) NodeId() *Hash256

func (InnerNode) NodeType

func (n InnerNode) NodeType() NodeType

func (InnerNode) Prefix

func (n InnerNode) Prefix() HashPrefix

func (InnerNode) String

func (n InnerNode) String() string

type InnerNodeFunc

type InnerNodeFunc func(pos int, child Hash256) error

type Issue

type Issue struct {
	Currency Currency `json:"currency"`
	Issuer   Account  `json:"issuer,omitempty"`
}

func (*Issue) Marshal

func (i *Issue) Marshal(w io.Writer) error

func (Issue) String

func (i Issue) String() string

func (*Issue) Unmarshal

func (i *Issue) Unmarshal(r Reader) error

type KeyType

type KeyType int
const (
	ECDSA   KeyType = 0
	Ed25519 KeyType = 1
)

func (KeyType) MarshalText

func (keyType KeyType) MarshalText() ([]byte, error)

func (KeyType) String

func (keyType KeyType) String() string

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 NewEmptyLedger(sequence uint32) *Ledger

func ReadLedger

func ReadLedger(r Reader, nodeId Hash256) (*Ledger, error)

func (Ledger) GetHash

func (l Ledger) GetHash() *Hash256

func (Ledger) GetType

func (l Ledger) GetType() string

func (Ledger) Ledger

func (l Ledger) Ledger() uint32

func (Ledger) MarshalJSON

func (l Ledger) MarshalJSON() ([]byte, error)

func (Ledger) NodeId

func (l Ledger) NodeId() *Hash256

func (Ledger) NodeType

func (l Ledger) NodeType() NodeType

func (Ledger) Prefix

func (l Ledger) Prefix() HashPrefix

func (*Ledger) UnmarshalJSON

func (l *Ledger) UnmarshalJSON(b []byte) error

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

	// SignerList flags
	LsOneOwnerCount LedgerEntryFlag = 0x00010000

	// DirNode flags
	LsNFTokenBuyOffers  LedgerEntryFlag = 0x00000001
	LsNFTokenSellOffers LedgerEntryFlag = 0x00000002

	// TokenOffer flags
	LsSellNFToken LedgerEntryFlag = 0x00000001
)

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

func (le *LedgerHashes) GetHash() *Hash256

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

func (le *LedgerHashes) GetType() string

func (*LedgerHashes) Ledger

func (le *LedgerHashes) Ledger() uint32

func (*LedgerHashes) NodeId

func (le *LedgerHashes) NodeId() *Hash256

func (*LedgerHashes) NodeType

func (le *LedgerHashes) NodeType() NodeType

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,omitempty"`
	CloseTime       *RippleTime `json:"close_time"`
	CloseResolution uint8       `json:"close_time_resolution"`
	CloseFlags      uint8       `json:"close_flags,omitempty"`
}

type LedgerNamespace

type LedgerNamespace uint16

type LedgerRange

type LedgerRange struct {
	Start uint32
	End   uint32
	Max   uint32
}

type LedgerSet

type LedgerSet struct {
	// contains filtered or unexported fields
}

func NewLedgerSet

func NewLedgerSet(start, capacity uint32) *LedgerSet

func (*LedgerSet) Count

func (l *LedgerSet) Count() uint32

func (*LedgerSet) Extend

func (l *LedgerSet) Extend(i uint32)

func (*LedgerSet) Max

func (l *LedgerSet) Max() uint32

func (*LedgerSet) Set

func (l *LedgerSet) Set(i uint32) time.Duration

func (*LedgerSet) String

func (l *LedgerSet) String() string

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

func (*LedgerSet) Taken

func (l *LedgerSet) Taken() uint32

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

type LimitByteReader struct {
	R Reader // underlying reader
	N int64  // max bytes remaining
}

func LimitedByteReader

func LimitedByteReader(r Reader, n int64) *LimitByteReader

func (*LimitByteReader) Len

func (l *LimitByteReader) Len() int

func (*LimitByteReader) Read

func (l *LimitByteReader) Read(p []byte) (n int, err error)

func (*LimitByteReader) ReadByte

func (l *LimitByteReader) ReadByte() (c byte, err error)

func (*LimitByteReader) UnreadByte

func (l *LimitByteReader) UnreadByte() error

type Majority

type Majority struct {
	Amendment *Hash256 `json:",omitempty"`
	CloseTime *uint32  `json:",omitempty"`
}

type Memo

type Memo struct {
	Memo MemoItem
}

type MemoItem

type MemoItem struct {
	MemoType   VariableLength
	MemoData   VariableLength
	MemoFormat VariableLength
}

type Memos

type Memos []Memo

type MetaData

type MetaData struct {
	AffectedNodes     NodeEffects
	TransactionIndex  uint32
	TransactionResult TransactionResult
	DeliveredAmount   *Amount `json:"delivered_amount,omitempty"`
}

type MultiSignable

type MultiSignable interface {
	Hashable
	InitialiseForSigning()
	MultiSigningPrefix() HashPrefix
	GetPublicKey() *PublicKey
	GetSignature() *VariableLength
	SetSigners([]Signer)
}

type NFTAcceptOffer

type NFTAcceptOffer struct {
	TxBase
	NFTokenBuyOffer  *Hash256 `json:",omitempty"`
	NFTokenSellOffer *Hash256 `json:",omitempty"`
	NFTokenBrokerFee *Amount  `json:",omitempty"`
	TicketSequence   *uint32  `json:",omitempty"`
}

type NFTCancelOffer

type NFTCancelOffer struct {
	TxBase
	NFTokenOffers  *Vector256 `json:",omitempty"`
	TicketSequence *uint32    `json:",omitempty"`
}

type NFToken

type NFToken struct {
	NFTokenID *Hash256        `json:",omitempty"`
	URI       *VariableLength `json:",omitempty"`
}

type NFTokenBurn

type NFTokenBurn struct {
	TxBase
	Owner          *Account `json:",omitempty"`
	TicketSequence *uint32  `json:",omitempty"`
}

type NFTokenCreateOffer

type NFTokenCreateOffer struct {
	TxBase
	NFTokenID      *Hash256 `json:",omitempty"`
	Amount         *Amount  `json:",omitempty"`
	Destination    *Account `json:",omitempty"`
	Owner          *Account `json:",omitempty"`
	Expiration     *uint32  `json:",omitempty"`
	TicketSequence *uint32  `json:",omitempty"`
}

type NFTokenMint

type NFTokenMint struct {
	TxBase
	NFTokenTaxon   *uint32         `json:",omitempty"`
	TransferFee    *uint16         `json:",omitempty"`
	Issuer         *Account        `json:",omitempty"`
	URI            *VariableLength `json:",omitempty"`
	TicketSequence *uint32         `json:",omitempty"`
}

type NFTokenOffer

type NFTokenOffer struct {
	Flags            *LedgerEntryFlag `json:",omitempty"`
	Owner            *Account         `json:",omitempty"`
	NFTokenID        *Hash256         `json:",omitempty"`
	Amount           *Amount          `json:",omitempty"`
	OwnerNode        *NodeIndex       `json:",omitempty"`
	NFTokenOfferNode *NodeIndex       `json:",omitempty"`
	Destination      *Account         `json:",omitempty"`
	Expiration       *uint32          `json:",omitempty"`
	// contains filtered or unexported fields
}

func (*NFTokenOffer) Affects

func (to *NFTokenOffer) Affects(account Account) bool

func (*NFTokenOffer) GetHash

func (le *NFTokenOffer) GetHash() *Hash256

func (*NFTokenOffer) GetLedgerEntryType

func (le *NFTokenOffer) GetLedgerEntryType() LedgerEntryType

func (*NFTokenOffer) GetLedgerIndex

func (le *NFTokenOffer) GetLedgerIndex() *Hash256

func (*NFTokenOffer) GetPreviousTxnId

func (le *NFTokenOffer) GetPreviousTxnId() *Hash256

func (*NFTokenOffer) GetType

func (le *NFTokenOffer) GetType() string

func (*NFTokenOffer) Ledger

func (le *NFTokenOffer) Ledger() uint32

func (*NFTokenOffer) NodeId

func (le *NFTokenOffer) NodeId() *Hash256

func (*NFTokenOffer) NodeType

func (le *NFTokenOffer) NodeType() NodeType

func (*NFTokenOffer) Prefix

func (le *NFTokenOffer) Prefix() HashPrefix

type NFTokenPage

type NFTokenPage struct {
	Flags           *LedgerEntryFlag `json:",omitempty"`
	PreviousPageMin *Hash256         `json:",omitempty"`
	NextPageMin     *Hash256         `json:",omitempty"`
	NFTokens        []NFToken        `json:",omitempty"`
	// contains filtered or unexported fields
}

func (*NFTokenPage) Affects

func (tp *NFTokenPage) Affects(account Account) bool

func (*NFTokenPage) GetHash

func (le *NFTokenPage) GetHash() *Hash256

func (*NFTokenPage) GetLedgerEntryType

func (le *NFTokenPage) GetLedgerEntryType() LedgerEntryType

func (*NFTokenPage) GetLedgerIndex

func (le *NFTokenPage) GetLedgerIndex() *Hash256

func (*NFTokenPage) GetPreviousTxnId

func (le *NFTokenPage) GetPreviousTxnId() *Hash256

func (*NFTokenPage) GetType

func (le *NFTokenPage) GetType() string

func (*NFTokenPage) Ledger

func (le *NFTokenPage) Ledger() uint32

func (*NFTokenPage) NodeId

func (le *NFTokenPage) NodeId() *Hash256

func (*NFTokenPage) NodeType

func (le *NFTokenPage) NodeType() NodeType

func (*NFTokenPage) Prefix

func (le *NFTokenPage) Prefix() HashPrefix

type NegativeUNL

type NegativeUNL struct {
	Flags               *LedgerEntryFlag    `json:",omitempty"`
	DisabledValidators  []DisabledValidator `json:",omitempty"`
	ValidatorToDisable  *VariableLength     `json:",omitempty"`
	ValidatorToReEnable *VariableLength     `json:",omitempty"`
	// contains filtered or unexported fields
}

func (*NegativeUNL) Affects

func (n *NegativeUNL) Affects(account Account) bool

func (*NegativeUNL) GetHash

func (le *NegativeUNL) GetHash() *Hash256

func (*NegativeUNL) GetLedgerEntryType

func (le *NegativeUNL) GetLedgerEntryType() LedgerEntryType

func (*NegativeUNL) GetLedgerIndex

func (le *NegativeUNL) GetLedgerIndex() *Hash256

func (*NegativeUNL) GetPreviousTxnId

func (le *NegativeUNL) GetPreviousTxnId() *Hash256

func (*NegativeUNL) GetType

func (le *NegativeUNL) GetType() string

func (*NegativeUNL) Ledger

func (le *NegativeUNL) Ledger() uint32

func (*NegativeUNL) NodeId

func (le *NegativeUNL) NodeId() *Hash256

func (*NegativeUNL) NodeType

func (le *NegativeUNL) NodeType() NodeType

func (*NegativeUNL) Prefix

func (le *NegativeUNL) Prefix() HashPrefix

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 NodeHeader struct {
	LedgerSequence uint32

	NodeType NodeType
	// contains filtered or unexported fields
}

type NodeIndex

type NodeIndex uint64

func (NodeIndex) MarshalText

func (i NodeIndex) MarshalText() ([]byte, error)

func (*NodeIndex) Next

func (i *NodeIndex) Next() *NodeIndex

func (*NodeIndex) Previous

func (i *NodeIndex) Previous() *NodeIndex

func (*NodeIndex) UnmarshalText

func (i *NodeIndex) UnmarshalText(b []byte) error

type NodeType

type NodeType uint8

func (NodeType) String

func (n NodeType) String() string

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

func (o *Offer) Affects(account Account) bool

func (*Offer) GetHash

func (le *Offer) GetHash() *Hash256

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

func (le *Offer) GetType() string

func (*Offer) Ledger

func (le *Offer) Ledger() uint32

func (*Offer) NodeId

func (le *Offer) NodeId() *Hash256

func (*Offer) NodeType

func (le *Offer) NodeType() NodeType

func (*Offer) Prefix

func (le *Offer) Prefix() HashPrefix

func (*Offer) Ratio

func (o *Offer) Ratio() *Value

type OfferCancel

type OfferCancel struct {
	TxBase
	OfferSequence  uint32
	TicketSequence *uint32 `json:",omitempty"`
}

type OfferCreate

type OfferCreate struct {
	TxBase
	OfferSequence  *uint32 `json:",omitempty"`
	TakerPays      Amount
	TakerGets      Amount
	Expiration     *uint32 `json:",omitempty"`
	TicketSequence *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) GetHash

func (le *OrderBookOffer) GetHash() *Hash256

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

func (le *OrderBookOffer) GetType() string

func (*OrderBookOffer) Ledger

func (le *OrderBookOffer) Ledger() uint32

func (*OrderBookOffer) NodeId

func (le *OrderBookOffer) NodeId() *Hash256

func (*OrderBookOffer) NodeType

func (le *OrderBookOffer) NodeType() NodeType

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.

func NewPath

func NewPath(s string) (Path, error)

NewPath accepts a path consisting of hops delimited by "=>" where each hop is either "<currency>/<issuer>" or "<account>". Whitespace around the delimiter is acceptable and is ignored.

func (Path) Signature

func (p Path) Signature() (uint32, error)

func (Path) String

func (p Path) String() string

type PathElem

type PathElem struct {
	Account  *Account
	Currency *Currency
	Issuer   *Account
}

PathElem represents one link in a path.

func (PathElem) MarshalJSON

func (p PathElem) MarshalJSON() ([]byte, error)

func (PathElem) String

func (p PathElem) String() string

type PathSet

type PathSet []Path

PathSet represents a collection of possible paths that a transaction may use.

func (*PathSet) Marshal

func (p *PathSet) Marshal(w io.Writer) error

func (*PathSet) Unmarshal

func (p *PathSet) Unmarshal(r Reader) error

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"`
	Expiration      *uint32          `json:",omitempty"`
	CancelAfter     *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 (*PayChannel) Affects

func (p *PayChannel) Affects(account Account) bool

func (*PayChannel) GetHash

func (le *PayChannel) GetHash() *Hash256

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

func (le *PayChannel) GetType() string

func (*PayChannel) Ledger

func (le *PayChannel) Ledger() uint32

func (*PayChannel) NodeId

func (le *PayChannel) NodeId() *Hash256

func (*PayChannel) NodeType

func (le *PayChannel) NodeType() NodeType

func (*PayChannel) Prefix

func (le *PayChannel) Prefix() HashPrefix

type Payment

type Payment struct {
	TxBase
	Destination    Account
	Amount         Amount
	SendMax        *Amount  `json:",omitempty"`
	DeliverMin     *Amount  `json:",omitempty"`
	Paths          *PathSet `json:",omitempty"`
	DestinationTag *uint32  `json:",omitempty"`
	InvoiceID      *Hash256 `json:",omitempty"`
	TicketSequence *uint32  `json:",omitempty"`
}

func (*Payment) PathSet

func (p *Payment) PathSet() PathSet

type PaymentChannelClaim

type PaymentChannelClaim struct {
	TxBase
	Channel        Hash256
	Balance        *Amount         `json:",omitempty"`
	Amount         *Amount         `json:",omitempty"`
	Signature      *VariableLength `json:",omitempty"`
	PublicKey      *PublicKey      `json:",omitempty"`
	TicketSequence *uint32         `json:",omitempty"`
}

type PaymentChannelCreate

type PaymentChannelCreate struct {
	TxBase
	Amount         Amount
	Destination    Account
	SettleDelay    uint32
	PublicKey      PublicKey
	CancelAfter    *uint32 `json:",omitempty"`
	DestinationTag *uint32 `json:",omitempty"`
	SourceTag      *uint32 `json:",omitempty"`
	TicketSequence *uint32 `json:",omitempty"`
}

type PaymentChannelFund

type PaymentChannelFund struct {
	TxBase
	Channel        Hash256
	Amount         Amount
	Expiration     *uint32 `json:",omitempty"`
	TicketSequence *uint32 `json:",omitempty"`
}

type Proposal

type Proposal struct {
	Hash           Hash256
	LedgerHash     Hash256
	PreviousLedger Hash256
	Sequence       uint32
	CloseTime      RippleTime
	PublicKey      PublicKey
	Signature      VariableLength
}

func (*Proposal) GetHash

func (p *Proposal) GetHash() *Hash256

func (*Proposal) GetPublicKey

func (p *Proposal) GetPublicKey() *PublicKey

func (*Proposal) GetSignature

func (p *Proposal) GetSignature() *VariableLength

func (Proposal) GetType

func (p Proposal) GetType() string

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

func (p Proposal) SuppressionId() (Hash256, error)

type PublicKey

type PublicKey [33]byte

func (*PublicKey) Bytes

func (p *PublicKey) Bytes() []byte

func (PublicKey) IsZero

func (p PublicKey) IsZero() bool

func (*PublicKey) Marshal

func (k *PublicKey) Marshal(w io.Writer) error

func (PublicKey) MarshalText

func (p PublicKey) MarshalText() ([]byte, error)

func (PublicKey) NodePublicKey

func (p PublicKey) NodePublicKey() string

func (PublicKey) String

func (p PublicKey) String() string

func (*PublicKey) Unmarshal

func (k *PublicKey) Unmarshal(r Reader) error

func (*PublicKey) UnmarshalText

func (p *PublicKey) UnmarshalText(b []byte) error

Expects public key hex

type Reader

type Reader interface {
	io.ByteScanner
	io.Reader
	Len() int
}

func NewVariableByteReader

func NewVariableByteReader(r Reader) (Reader, error)

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

func (r RegularKey) Hash() (crypto.Hash, error)

func (*RegularKey) Marshal

func (k *RegularKey) Marshal(w io.Writer) error

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

func (le *RippleState) GetHash() *Hash256

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

func (le *RippleState) GetType() string

func (*RippleState) Ledger

func (le *RippleState) Ledger() uint32

func (*RippleState) NodeId

func (le *RippleState) NodeId() *Hash256

func (*RippleState) NodeType

func (le *RippleState) NodeType() NodeType

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

func (t RippleTime) Short() string

Returns time formatted as 15:04:05

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 Router

type Router interface {
	Hashable
	SuppressionId() Hash256
}

type Seed

type Seed [16]byte

func NewSeedFromAddress

func NewSeedFromAddress(s string) (*Seed, error)

Expects address in base58 form

func (*Seed) AccountId

func (s *Seed) AccountId(keyType KeyType, sequence *uint32) Account

func (*Seed) Bytes

func (s *Seed) Bytes() []byte

func (Seed) Hash

func (s Seed) Hash() (crypto.Hash, error)

func (*Seed) Key

func (s *Seed) Key(keyType KeyType) crypto.Key

func (Seed) MarshalText

func (s Seed) MarshalText() ([]byte, error)

func (Seed) String

func (s Seed) String() string

func (*Seed) UnmarshalText

func (s *Seed) UnmarshalText(b []byte) error

Expects base58-encoded account id

type SetDepositPreAuth

type SetDepositPreAuth struct {
	TxBase
	Authorize      *Account `json:",omitempty"`
	Unauthorize    *Account `json:",omitempty"`
	TicketSequence *uint32  `json:",omitempty"`
}

type SetFee

type SetFee struct {
	TxBase
	BaseFee               Uint64Hex
	ReferenceFeeUnits     uint32
	ReserveBase           uint32
	ReserveIncrement      uint32
	BaseFeeDrops          *Amount `json:",omitempty"`
	ReserveBaseDrops      *Amount `json:",omitempty"`
	ReserveIncrementDrops *Amount `json:",omitempty"`
}

type SetRegularKey

type SetRegularKey struct {
	TxBase
	RegularKey     *RegularKey `json:",omitempty"`
	TicketSequence *uint32     `json:",omitempty"`
}

type Signable

type Signable interface {
	Hashable
	InitialiseForSigning()
	SigningPrefix() HashPrefix
	GetPublicKey() *PublicKey
	GetSignature() *VariableLength
}

type Signer

type Signer struct {
	Signer SignerItem
}

type SignerEntry

type SignerEntry struct {
	SignerEntry SignerEntryItem
}

type SignerEntryItem

type SignerEntryItem struct {
	Account       *Account `json:",omitempty"`
	SignerWeight  *uint16  `json:",omitempty"`
	WalletLocator *Hash256 `json:",omitempty"`
}

type SignerItem

type SignerItem struct {
	Account       Account
	TxnSignature  *VariableLength `json:",omitempty"`
	SigningPubKey *PublicKey      `json:",omitempty"`
}

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

func (le *SignerList) GetHash() *Hash256

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

func (le *SignerList) GetType() string

func (*SignerList) Ledger

func (le *SignerList) Ledger() uint32

func (*SignerList) NodeId

func (le *SignerList) NodeId() *Hash256

func (*SignerList) NodeType

func (le *SignerList) NodeType() NodeType

func (*SignerList) Prefix

func (le *SignerList) Prefix() HashPrefix

type SignerListSet

type SignerListSet struct {
	TxBase
	SignerQuorum   uint32        `json:",omitempty"`
	SignerEntries  []SignerEntry `json:",omitempty"`
	TicketSequence *uint32       `json:",omitempty"`
}

type Storer

type Storer interface {
	Hashable
	Ledger() uint32
	NodeType() NodeType
	NodeId() *Hash256
}

func ReadPrefix

func ReadPrefix(r Reader, nodeId Hash256) (Storer, error)

ReadPrefix parses types received from the nodestore

type Ticket

type Ticket struct {
	Flags          *LedgerEntryFlag `json:",omitempty"`
	Account        *Account         `json:",omitempty"`
	TicketSequence *uint32          `json:",omitempty"`
	OwnerNode      *NodeIndex       `json:",omitempty"`
	// contains filtered or unexported fields
}

func (*Ticket) Affects

func (t *Ticket) Affects(account Account) bool

func (*Ticket) GetHash

func (le *Ticket) GetHash() *Hash256

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

func (le *Ticket) GetType() string

func (*Ticket) Ledger

func (le *Ticket) Ledger() uint32

func (*Ticket) NodeId

func (le *Ticket) NodeId() *Hash256

func (*Ticket) NodeType

func (le *Ticket) NodeType() NodeType

func (*Ticket) Prefix

func (le *Ticket) Prefix() HashPrefix

type TicketCreate

type TicketCreate struct {
	TxBase
	TicketCount    *uint32 `json:",omitempty"`
	TicketSequence *uint32 `json:",omitempty"`
}

type Trade

type Trade struct {
	LedgerSequence   uint32
	TransactionIndex uint32
	TransactionType  string
	Op               string
	Paid             *Amount
	Got              *Amount
	Giver            Account
	Taker            Account
}

func (*Trade) Rate

func (t *Trade) Rate() float64

func (Trade) String

func (t Trade) String() string

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 {
	Signable
	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) Marshal

func (res *TransactionResult) Marshal(w io.Writer) error

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:

  1. XRP -> XRP
  2. XRP -> IOU/Issuer Requires an orderbook
  3. IOU/Issuer -> XRP Requires an orderbook
  4. IOU/IssuerA <-> IOU/IssuerB Also known as Rippling, requires an account which trusts both currency/issuer pairs

type TrustSet

type TrustSet struct {
	TxBase
	LimitAmount    Amount
	QualityIn      *uint32 `json:",omitempty"`
	QualityOut     *uint32 `json:",omitempty"`
	TicketSequence *uint32 `json:",omitempty"`
}

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"`
	Signers            []Signer        `json:",omitempty"`
	Memos              Memos           `json:",omitempty"`
	PreviousTxnID      *Hash256        `json:",omitempty"`
	LastLedgerSequence *uint32         `json:",omitempty"`
	Hash               Hash256         `json:"hash"`
}

func (*TxBase) Compare

func (t *TxBase) Compare(other *TxBase) int

func (*TxBase) GetBase

func (t *TxBase) GetBase() *TxBase

func (*TxBase) GetHash

func (t *TxBase) GetHash() *Hash256

func (*TxBase) GetPublicKey

func (t *TxBase) GetPublicKey() *PublicKey

func (*TxBase) GetSignature

func (t *TxBase) GetSignature() *VariableLength

func (*TxBase) GetTransactionType

func (t *TxBase) GetTransactionType() TransactionType

func (*TxBase) GetType

func (t *TxBase) GetType() string

func (*TxBase) InitialiseForSigning

func (t *TxBase) InitialiseForSigning()

func (*TxBase) MultiSigningPrefix

func (t *TxBase) MultiSigningPrefix() HashPrefix

func (*TxBase) PathSet

func (t *TxBase) PathSet() PathSet

func (*TxBase) Prefix

func (t *TxBase) Prefix() HashPrefix

func (*TxBase) SetSigners

func (t *TxBase) SetSigners(signers []Signer)

func (*TxBase) SigningPrefix

func (t *TxBase) SigningPrefix() HashPrefix

type UNLModify

type UNLModify struct {
	TxBase
	UNLModifyDisabling uint8           `json:",omitempty"`
	UNLModifyValidator *VariableLength `json:",omitempty"`
}

type Uint64Hex

type Uint64Hex uint64

A uint64 which gets represented as a hex string in json

func (Uint64Hex) MarshalText

func (h Uint64Hex) MarshalText() ([]byte, error)

func (*Uint64Hex) UnmarshalText

func (h *Uint64Hex) UnmarshalText(b []byte) error

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

func NewNativeValue(n int64) (*Value, error)

NewNativeValue returns a Value with n drops. If the value is impossible an error is returned.

func NewNonNativeValue

func NewNonNativeValue(n int64, offset int64) (*Value, error)

NewNonNativeValue returns a Value of n*10^offset.

func NewValue

func NewValue(s string, native bool) (*Value, error)

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

func (v Value) Abs() *Value

Abs returns a copy of v with a positive sign.

func (Value) Add

func (a Value) Add(b Value) (*Value, error)

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

func (v *Value) Bytes() []byte

func (Value) Clone

func (v Value) Clone() *Value

Clone returns a Value which is a copy of v.

func (Value) Compare

func (a Value) Compare(b Value) int

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

func (num Value) Divide(den Value) (*Value, error)

func (Value) Equals

func (a Value) Equals(b Value) bool

func (Value) Float

func (v Value) Float() float64

func (Value) IsNative

func (v Value) IsNative() bool

func (Value) IsNegative

func (v Value) IsNegative() bool

func (Value) IsZero

func (v Value) IsZero() bool

func (Value) Less

func (a Value) Less(b Value) bool

Less compares values and returns true if a is less than b.

func (*Value) Marshal

func (v *Value) Marshal(w io.Writer) error

func (Value) MarshalBinary

func (v Value) MarshalBinary() ([]byte, error)

func (*Value) MarshalText

func (v *Value) MarshalText() ([]byte, error)

func (Value) Multiply

func (a Value) Multiply(b Value) (*Value, error)

func (Value) Native

func (v Value) Native() (*Value, error)

Native returns a clone of the value in native format.

func (Value) Negate

func (v Value) Negate() *Value

Negate returns a new Value with the opposite sign of v.

func (Value) NonNative

func (v Value) NonNative() (*Value, error)

NonNative returns a clone of the value in non-native format.

func (Value) Rat

func (v Value) Rat() *big.Rat

Rat returns the value as a big.Rat.

func (Value) Ratio

func (a Value) Ratio(b Value) (*Value, error)

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

func (v Value) String() string

String returns the Value as a string for human consumption. Native values are represented as decimal XRP rather than drips.

func (Value) Subtract

func (a Value) Subtract(b Value) (*Value, error)

func (*Value) Unmarshal

func (v *Value) Unmarshal(r Reader) error

func (*Value) UnmarshalBinary

func (v *Value) UnmarshalBinary(b []byte) error

func (*Value) UnmarshalText

func (v *Value) UnmarshalText(b []byte) error

func (Value) ZeroClone

func (v Value) ZeroClone() *Value

ZeroClone returns a zero Value, native or non-native depending on v's setting.

type VariableLength

type VariableLength []byte

func (*VariableLength) Bytes

func (v *VariableLength) Bytes() []byte

func (*VariableLength) Marshal

func (v *VariableLength) Marshal(w io.Writer) error

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 Vector256

type Vector256 []Hash256

func (*Vector256) Marshal

func (v *Vector256) Marshal(w io.Writer) error

func (Vector256) String

func (v Vector256) String() string

func (*Vector256) Unmarshal

func (v *Vector256) Unmarshal(r Reader) error

type VoteEntry

type VoteEntry struct {
	VoteEntry VoteEntryItem `json:",omitempty"`
}

type VoteEntryItem

type VoteEntryItem struct {
	Account    *Account `json:",omitempty"`
	TradingFee *uint16  `json:",omitempty"`
	VoteWeight *uint32  `json:",omitempty"`
}

type Wire

type Wire interface {
	Unmarshal(Reader) error
	Marshal(io.Writer) error
}

type Work

type Work struct {
	*LedgerRange
	MissingLedgers LedgerSlice
	MissingNodes   []Hash256
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL