Documentation ¶
Index ¶
- type AccountInfoCommand
- type AccountInfoResult
- type AccountLinesCommand
- type AccountLinesResult
- type AccountOffersCommand
- type AccountOffersResult
- type AccountTxCommand
- type AccountTxResult
- type BinaryLedgerData
- type BinaryLedgerDataCommand
- type BinaryLedgerDataResult
- type BookOffersCommand
- type BookOffersResult
- type Command
- type CommandError
- type FeeCommand
- type FeeResult
- type LedgerCommand
- type LedgerDataCommand
- type LedgerDataResult
- type LedgerHeaderCommand
- type LedgerHeaderResult
- type LedgerResult
- type LedgerStreamMsg
- type OrderBookSubscription
- type PathFindAlternative
- type PathFindCreateCommand
- type PathFindCreateResult
- type Remote
- func (r *Remote) AccountInfo(a data.Account) (*AccountInfoResult, error)
- func (r *Remote) AccountLines(account data.Account, ledgerIndex interface{}) (*AccountLinesResult, error)
- func (r *Remote) AccountOffers(account data.Account, ledgerIndex interface{}) (*AccountOffersResult, error)
- func (r *Remote) AccountTx(account data.Account, pageSize int, minLedger, maxLedger int64) chan *data.TransactionWithMetaData
- func (r *Remote) BookOffers(taker data.Account, ledgerIndex interface{}, pays, gets data.Asset) (*BookOffersResult, error)
- func (r *Remote) Close()
- func (r *Remote) Fee() (*FeeResult, error)
- func (r *Remote) Ledger(ledger interface{}, transactions bool) (*LedgerResult, error)
- func (r *Remote) LedgerData(ledger interface{}, marker *data.Hash256) (*LedgerDataResult, error)
- func (r *Remote) LedgerHeader(ledger interface{}) (*LedgerHeaderResult, error)
- func (r *Remote) PathFindCreate(src, dest data.Account, amt data.Amount, sendMax *data.Amount, ...) (*PathFindCreateResult, error)
- func (r *Remote) RipplePathFind(src, dest data.Account, amount data.Amount, srcCurr *[]data.Currency) (*RipplePathFindResult, error)
- func (r *Remote) StreamLedgerData(ledger interface{}) chan data.LedgerEntrySlice
- func (r *Remote) Submit(tx data.Transaction) (*SubmitResult, error)
- func (r *Remote) SubmitBatch(txs []data.Transaction) ([]*SubmitResult, error)
- func (r *Remote) SubmitMultiSigned(tx data.Transaction) (*SubmitResult, error)
- func (r *Remote) Subscribe(ledger, transactions, transactionsProposed, server bool) (*SubscribeResult, error)
- func (r *Remote) SubscribeOrderBooks(books []OrderBookSubscription) (*SubscribeResult, error)
- func (r *Remote) Tx(hash data.Hash256) (*TxResult, error)
- type RipplePathFindCommand
- type RipplePathFindResult
- type ServerStreamMsg
- type SourceCurrency
- type SubmitCommand
- type SubmitMultiSignedCommand
- type SubmitResult
- type SubscribeCommand
- type SubscribeResult
- type Syncer
- type TransactionStreamMsg
- type TxCommand
- type TxResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccountInfoCommand ¶
type AccountInfoCommand struct { *Command Account data.Account `json:"account"` SignerLists bool `json:"signer_lists"` Result *AccountInfoResult `json:"result,omitempty"` }
type AccountInfoResult ¶
type AccountInfoResult struct { LedgerSequence uint32 `json:"ledger_current_index"` AccountData data.AccountRoot `json:"account_data"` }
type AccountLinesCommand ¶
type AccountLinesResult ¶
type AccountOffersCommand ¶
type AccountOffersResult ¶
type AccountTxCommand ¶
type AccountTxCommand struct { *Command Account data.Account `json:"account"` MinLedger int64 `json:"ledger_index_min"` MaxLedger int64 `json:"ledger_index_max"` Binary bool `json:"binary,omitempty"` Forward bool `json:"forward,omitempty"` Limit int `json:"limit,omitempty"` Marker map[string]interface{} `json:"marker,omitempty"` Result *AccountTxResult `json:"result,omitempty"` }
type AccountTxResult ¶
type AccountTxResult struct { Marker map[string]interface{} `json:"marker,omitempty"` Transactions data.TransactionSlice `json:"transactions,omitempty"` }
type BinaryLedgerData ¶
type BinaryLedgerDataCommand ¶
type BinaryLedgerDataCommand struct { *Command Ledger interface{} `json:"ledger"` Binary bool `json:"binary"` Marker *data.Hash256 `json:"marker,omitempty"` Result *BinaryLedgerDataResult `json:"result,omitempty"` }
type BinaryLedgerDataResult ¶
type BookOffersCommand ¶
type BookOffersResult ¶
type BookOffersResult struct { LedgerSequence uint32 `json:"ledger_index"` Offers []data.OrderBookOffer `json:"offers"` }
type Command ¶
type Command struct { *CommandError Id uint64 `json:"id"` Name string `json:"command"` Type string `json:"type,omitempty"` Status string `json:"status,omitempty"` Ready chan struct{} `json:"-"` }
func (*Command) IncrementId ¶
func (c *Command) IncrementId()
type CommandError ¶
type CommandError struct { Name string `json:"error"` Code int `json:"error_code"` Message string `json:"error_message"` }
func (*CommandError) Error ¶
func (e *CommandError) Error() string
type FeeCommand ¶
type FeeResult ¶
type FeeResult struct { CurrentLedgerSize uint32 `json:"current_ledger_size,string"` CurrentQueueSize uint32 `json:"current_queue_size,string"` Drops struct { BaseFee data.Value `json:"base_fee"` MedianFee data.Value `json:"median_fee"` MinimumFee data.Value `json:"minimum_fee"` OpenLedgerFee data.Value `json:"open_ledger_fee"` } `json:"drops"` ExpectedLedgerSize uint32 `json:"expected_ledger_size,string"` Levels struct { MedianLevel data.Value `json:"median_level"` MinimumLevel data.Value `json:"minimum_level"` OpenLedgerLevel data.Value `json:"open_ledger_level"` ReferenceLevel data.Value `json:"reference_level"` } `json:"levels"` MaxQueueSize uint32 `json:"max_queue_size,string"` Status string `json:"status"` }
type LedgerCommand ¶
type LedgerCommand struct { *Command LedgerIndex interface{} `json:"ledger_index"` Accounts bool `json:"accounts"` Transactions bool `json:"transactions"` Expand bool `json:"expand"` Result *LedgerResult `json:"result,omitempty"` }
type LedgerDataCommand ¶
type LedgerDataCommand struct { *Command Ledger interface{} `json:"ledger"` Marker *data.Hash256 `json:"marker,omitempty"` Result *LedgerDataResult `json:"result,omitempty"` }
type LedgerDataResult ¶
type LedgerHeaderCommand ¶
type LedgerHeaderCommand struct { *Command Ledger interface{} `json:"ledger"` Result *LedgerHeaderResult }
type LedgerHeaderResult ¶
type LedgerResult ¶
type LedgerStreamMsg ¶
type LedgerStreamMsg struct { FeeBase uint64 `json:"fee_base"` FeeRef uint64 `json:"fee_ref"` LedgerSequence uint32 `json:"ledger_index"` LedgerHash data.Hash256 `json:"ledger_hash"` LedgerTime data.RippleTime `json:"ledger_time"` ReserveBase uint64 `json:"reserve_base"` ReserveIncrement uint64 `json:"reserve_inc"` ValidatedLedgers string `json:"validated_ledgers"` TxnCount uint32 `json:"txn_count"` // Only streamed, not in the subscribe result. }
Fields from subscribed ledger stream messages
type OrderBookSubscription ¶
type PathFindAlternative ¶
type PathFindCreateCommand ¶
type PathFindCreateCommand struct { *Command Subcommand string `json:"subcommand"` SourceAccount data.Account `json:"source_account"` DestinationAccount data.Account `json:"destination_account"` DestinationAmount data.Amount `json:"destination_amount"` SendMax *data.Amount `json:"send_max,omitempty"` SourceCurrencies *[]SourceCurrency `json:"source_currencies,omitempty"` // All commands have Result in their struct? Result *PathFindCreateResult }
https://ripple.com/build/rippled-apis/#path-find
{ "id": 8, "command": "path_find", "subcommand": "create", "source_account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59", "destination_account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59", "destination_amount": { "value": "0.001", "currency": "USD", "issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B" } }
type PathFindCreateResult ¶
type Remote ¶
type Remote struct { Incoming chan interface{} // contains filtered or unexported fields }
func NewRemote ¶
NewRemote returns a new remote session connected to the specified server endpoint URI. To close the connection, use Close().
func (*Remote) AccountInfo ¶
func (r *Remote) AccountInfo(a data.Account) (*AccountInfoResult, error)
Synchronously requests account info
func (*Remote) AccountLines ¶
func (r *Remote) AccountLines(account data.Account, ledgerIndex interface{}) (*AccountLinesResult, error)
Synchronously requests account line info
func (*Remote) AccountOffers ¶
func (r *Remote) AccountOffers(account data.Account, ledgerIndex interface{}) (*AccountOffersResult, error)
Synchronously requests account offers
func (*Remote) AccountTx ¶
func (r *Remote) AccountTx(account data.Account, pageSize int, minLedger, maxLedger int64) chan *data.TransactionWithMetaData
Retrieve all transactions for an account via https://ripple.com/build/rippled-apis/#account-tx. Will call `account_tx` multiple times, if a marker is returned. Transactions are returned asynchonously to the channel returned by this function.
Use minLedger -1 for the earliest ledger available. Use maxLedger -1 for the most recent validated ledger.
func (*Remote) BookOffers ¶
func (*Remote) Close ¶
func (r *Remote) Close()
Close shuts down the Remote session and blocks until all internal goroutines have been cleaned up. Any commands that are pending a response will return with an error.
func (*Remote) Ledger ¶
func (r *Remote) Ledger(ledger interface{}, transactions bool) (*LedgerResult, error)
Synchronously gets a single ledger
func (*Remote) LedgerData ¶
func (r *Remote) LedgerData(ledger interface{}, marker *data.Hash256) (*LedgerDataResult, error)
Synchronously gets ledger entries
func (*Remote) LedgerHeader ¶
func (r *Remote) LedgerHeader(ledger interface{}) (*LedgerHeaderResult, error)
func (*Remote) PathFindCreate ¶
func (r *Remote) PathFindCreate(src, dest data.Account, amt data.Amount, sendMax *data.Amount, sourceCurrencies *[]SourceCurrency) (*PathFindCreateResult, error)
func (*Remote) RipplePathFind ¶
func (r *Remote) RipplePathFind(src, dest data.Account, amount data.Amount, srcCurr *[]data.Currency) (*RipplePathFindResult, error)
Synchronously requests paths
func (*Remote) StreamLedgerData ¶
func (r *Remote) StreamLedgerData(ledger interface{}) chan data.LedgerEntrySlice
Asynchronously retrieve all data for a ledger using the binary form
func (*Remote) Submit ¶
func (r *Remote) Submit(tx data.Transaction) (*SubmitResult, error)
Synchronously submit a single transaction
func (*Remote) SubmitBatch ¶
func (r *Remote) SubmitBatch(txs []data.Transaction) ([]*SubmitResult, error)
Synchronously submit multiple transactions
func (*Remote) SubmitMultiSigned ¶
func (r *Remote) SubmitMultiSigned(tx data.Transaction) (*SubmitResult, error)
Synchronously submit a single transaction
func (*Remote) Subscribe ¶
func (r *Remote) Subscribe(ledger, transactions, transactionsProposed, server bool) (*SubscribeResult, error)
Synchronously subscribe to streams and receive a confirmation message Streams are recived asynchronously over the Incoming channel
func (*Remote) SubscribeOrderBooks ¶
func (r *Remote) SubscribeOrderBooks(books []OrderBookSubscription) (*SubscribeResult, error)
type RipplePathFindCommand ¶
type RipplePathFindCommand struct { *Command SrcAccount data.Account `json:"source_account"` SrcCurrencies *[]data.Currency `json:"source_currencies,omitempty"` DestAccount data.Account `json:"destination_account"` DestAmount data.Amount `json:"destination_amount"` Result *RipplePathFindResult `json:"result,omitempty"` }
type RipplePathFindResult ¶
type RipplePathFindResult struct { Alternatives []struct { SrcAmount data.Amount `json:"source_amount"` PathsComputed data.PathSet `json:"paths_computed,omitempty"` PathsCanonical data.PathSet `json:"paths_canonical,omitempty"` } DestAccount data.Account `json:"destination_account"` DestCurrencies []data.Currency `json:"destination_currencies"` }
type ServerStreamMsg ¶
type ServerStreamMsg struct { Status string `json:"server_status"` BaseFee uint64 `json:"base_fee"` LoadBase uint64 `json:"load_base"` LoadFactor uint64 `json:"load_factor"` LoadFactorFeeEscalation uint64 `json:"load_factor_fee_escalation"` LoadFactorFeeQueue uint64 `json:"load_factor_fee_queue"` LoadFactorFeeReference uint64 `json:"load_factor_fee_reference"` LoadFactorServer uint64 `json:"load_factor_server"` HostID string `json:"hostid"` }
Fields from subscribed server status stream messages
func (*ServerStreamMsg) TransactionCost ¶
func (s *ServerStreamMsg) TransactionCost() uint64
type SourceCurrency ¶
type SourceCurrency struct {
Currency string `json:"currency"`
}
type SubmitCommand ¶
type SubmitCommand struct { *Command TxBlob string `json:"tx_blob"` Result *SubmitResult `json:"result,omitempty"` }
type SubmitMultiSignedCommand ¶
type SubmitMultiSignedCommand struct { *Command TxJson data.Transaction `json:"tx_json"` Result *SubmitResult `json:"result,omitempty"` }
type SubmitResult ¶
type SubmitResult struct { EngineResult data.TransactionResult `json:"engine_result"` EngineResultCode int `json:"engine_result_code"` EngineResultMessage string `json:"engine_result_message"` TxBlob string `json:"tx_blob"` Tx interface{} `json:"tx_json"` }
type SubscribeCommand ¶
type SubscribeCommand struct { *Command Streams []string `json:"streams"` Books []OrderBookSubscription `json:"books,omitempty"` Result *SubscribeResult `json:"result,omitempty"` }
type SubscribeResult ¶
type SubscribeResult struct { // Contains one or both of these, depending what streams were subscribed *LedgerStreamMsg *ServerStreamMsg // Contains "bids" and "asks" when "both" is true. Asks []data.OrderBookOffer Bids []data.OrderBookOffer // Contains "offers" when "both" is false. Offers []data.OrderBookOffer }
type TransactionStreamMsg ¶
type TransactionStreamMsg struct { Transaction data.TransactionWithMetaData `json:"transaction"` EngineResult data.TransactionResult `json:"engine_result"` EngineResultCode int `json:"engine_result_code"` EngineResultMessage string `json:"engine_result_message"` LedgerHash data.Hash256 `json:"ledger_hash"` LedgerSequence uint32 `json:"ledger_index"` Status string Validated bool }
Fields from subscribed transaction stream messages
func (*TransactionStreamMsg) UnmarshalJSON ¶
func (msg *TransactionStreamMsg) UnmarshalJSON(b []byte) error
type TxResult ¶
type TxResult struct { data.TransactionWithMetaData Validated bool `json:"validated"` }
func (*TxResult) UnmarshalJSON ¶
A shim to populate the Validated field before passing control on to TransactionWithMetaData.UnmarshalJSON