Documentation ¶
Overview ¶
Helpers to make JSON-RPC calls to rippled.
Index ¶
- Constants
- type AccountInfo
- type AccountInfoParams
- type AccountInfoResult
- type AccountLine
- type AccountLinesParams
- type AccountLinesResult
- type AccountOffersParams
- type AccountOffersResult
- type AccountTxParams
- type AccountTxResult
- type Client
- func (client Client) Close()
- func (client Client) Do(method string, params interface{}, target interface{}) (int, error)
- func (client Client) Request(method string, params ...interface{}) (*Response, error)
- func (c Client) String() string
- func (client Client) Submit(blob string) (ResultSubmit, error)
- type LedgerInfo
- type LedgerParams
- type LedgerResult
- type MetaData
- type PathFind
- type PaymentResultXXX
- type PaymentResultXXXX
- type Request
- type Response
- type Result
- type ResultSubmit
- type ServerInfo
- type ServerInfoResult
- type SubmitParams
- type TxMeta
- type TxMetaData
- type TxMetaRaw
- type TxParams
- type TxResult
- func (tx *TxResult) IsValidated() bool
- func (tx *TxResult) Json() string
- func (tx *TxResult) Memo(i int) (string, bool)
- func (tx TxResult) Payment() (data.Payment, error)
- func (tx *TxResult) Raw() []byte
- func (result *TxResult) String() string
- func (tx *TxResult) Succeeded() bool
- func (tx *TxResult) UnmarshalJSON(data []byte) error
- type TxResultNoRaw
- type TxResultXXX
- type ValidatedLedger
Constants ¶
const (
DropsPerXRP = 1000000
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccountInfo ¶
type AccountInfoParams ¶
type AccountInfoResult ¶
type AccountInfoResult struct { Result Account_data AccountInfo }
account_info {"account_data":{"Account":"rs2GgdxJx34DwwAUsz1wse3yUCnggQpCCg","Balance":"10000000000","Flags":0,"LedgerEntryType":"AccountRoot","OwnerCount":0,"PreviousTxnID":"F295A38531D6808917F6B42A5E583F89D0613C0153096F497648C771EADE183A","PreviousTxnLgrSeq":1918860,"Sequence":1,"index":"3066338D048B57636FA27F4027619FD8910AF9C1E2F2148AECA288B1B85D8E9F"},"ledger_current_index":1974161,"status":"success","validated":false}
type AccountLine ¶
type AccountLine struct { Account string `json:"account"` Balance data.Value `json:"balance"` Currency string `json:"currency"` Limit data.Value `json:"limit"` Limit_peer data.Value `json:"limit_peer"` No_ripple bool `json:"no_ripple"` No_ripple_peer bool `json:"no_ripple_peer"` Quality_in uint32 `json:"quality_in"` Quality_out uint32 `json:"quality_out"` Freeze bool `json:"freeze"` Freeze_peer bool `json:"freeze_peer"` }
type AccountLinesParams ¶
type AccountLinesParams struct {
Account string `json:"account"`
}
type AccountLinesResult ¶
type AccountLinesResult struct { Result Account string `json:"account"` Lines []AccountLine `json:"lines"` }
type AccountOffersParams ¶
type AccountOffersParams struct {
Account string `json:"account"`
}
type AccountOffersResult ¶
type AccountOffersResult struct { Result Account string `json:"account"` Ledger_current_index uint32 `json:"ledger_current_index"` Offers []data.AccountOffer `json:"offers"` }
type AccountTxParams ¶
type AccountTxResult ¶
type AccountTxResult struct { Result Account string `json:"account"` Transactions []TxMeta `json:"transactions"` Marker json.RawMessage `json:"marker, omitempty"` }
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (Client) Do ¶
TODO: re-order params to Do() and allow any number of ...params Do() is being deprecated, use Request() below.
type LedgerInfo ¶
type LedgerParams ¶
type LedgerResult ¶
type LedgerResult struct { Result Ledger LedgerInfo }
type MetaData ¶
type MetaData struct { AffectedNodes data.NodeEffects TransactionIndex uint32 TransactionResult data.TransactionResult DeliveredAmount *data.Amount `json:"delivered_amount,omitempty"` }
type PaymentResultXXX ¶
type PaymentResultXXX struct { TxResultNoRaw Amount data.Amount Address string Destination string InvoiceID *string DestinationTag *uint32 }
Payments are a transaction type that we want to inspect more fields than TxResult provides.
type PaymentResultXXXX ¶
type Request ¶
type Request struct { Method string `json:"method"` Params []interface{} `json:"params"` }
type Response ¶
type Response struct { Result json.RawMessage `json:"result"` Validated *bool `json:"validated"` // Appears in response to "tx" // contains filtered or unexported fields }
JSON-RPC response {"result":{..., "status": "..."}}
func (Response) IsValidated ¶
func (Response) ResultString ¶
func (Response) StatusCode ¶
func (Response) UnmarshalResult ¶
type Result ¶
type Result struct { // Always present: Status string // Present only when error: Error string `json:"error,omitempty"` Error_code int Error_message string Request json.RawMessage // Other errors Error_exception string `json:"error_exception"` // Present sometimes: Ledger_current_index int // type ??? Validated bool }
Examples of potential errors: {"result":{"error":"unknownCmd","error_code":31,"error_message":"Unknown method.","request":{"command":"server_infoX"},"status":"error"}} {"error":"invalidTransaction","error_exception":"Unknown field","request":{"command":"submit","tx_blob":"12000024000000012021000000026880000000000000007321026C80D7F11B33BE4E2794E489295346ACC31F0719DB2FA6C378E6E7BF325873A074473045022100F9123F923267F3E91539397C8353DD1BE55C531DD9F9D18B662A7B3035E0BA5502200F2F2B18DD3277B7575E2792A0FD9A08FC2C3888F0ACE14598AC5F67F05F208C81141C3B11F542BBA14819B579D59FBA1EB17457B2BB"},"status":"error"}
type ResultSubmit ¶
type ResultSubmit struct { Result Engine_result string `json:"engine_result"` Engine_result_message string `json:"engine_result_message"` Tx_json TxResult `json:"tx_json"` // Needed for hash and possibly more Tx_blob string `json:"tx_blob"` }
func (ResultSubmit) String ¶
func (result ResultSubmit) String() string
type ServerInfo ¶
type ServerInfo struct { Result Build_version string Complete_ledgers string Hostid string Load_factor float64 // Not integer! Peers int Pubkey_node string Server_state string Uptime int Validated_ledger *ValidatedLedger }
func (*ServerInfo) Fee ¶
func (server *ServerInfo) Fee() int
Estimates the current transaction fee, in drops. Computed as described in https://ripple.com/build/transaction-cost/#server-info
type ServerInfoResult ¶
type ServerInfoResult struct { Result Info ServerInfo }
"{\"info\":{\"build_version\":\"0.70.0-b8\",\"complete_ledgers\":\"1955521-1967811\",\"hostid\":\"HI\",\"io_latency_ms\":1,\"last_close\":{\"converge_time_s\":1.999,\"proposers\":4},\"load_factor\":1,\"peers\":5,\"pubkey_node\":\"n9KMmZw85d5erkaTv62Vz6SbDJSyeihAEB3jwnb3Bqnr2AydRVep\",\"server_state\":\"proposing\",\"state_accounting\":{\"connected\":{\"duration_us\":\"4999978\",\"transitions\":1},\"disconnected\":{\"duration_us\":\"1262060\",\"transitions\":1},\"full\":{\"duration_us\":\"410736965528\",\"transitions\":1},\"syncing\":{\"duration_us\":\"5002153\",\"transitions\":1},\"tracking\":{\"duration_us\":\"2\",\"transitions\":1}},\"uptime\":410748,\"validated_ledger\":{\"base_fee_xrp\":1e-05,\"hash\":\"77147A57D2351EB97F6F6C709B94364E6B9C47525D0D02E7958575F4AB525BF4\",\"reserve_base_xrp\":20,\"reserve_inc_xrp\":5,\"seq\":1967811},\"validation_quorum\":4},\"status\":\"success\"}",
func (*ServerInfoResult) String ¶
func (info *ServerInfoResult) String() string
type SubmitParams ¶
type TxMeta ¶
type TxMeta struct { Tx TxResult `json:"tx"` // Note this will not have "validated" or "status" //Tx data.Transaction `json:"tx"` // rubblelabs (better?) Meta TxMetaData `json:"meta"` Validated *bool `json:"validated"` }
func (*TxMeta) IsValidated ¶
type TxMetaData ¶
type TxMetaData struct { AffectedNodes data.NodeEffects TransactionIndex uint32 TransactionResult data.TransactionResult DeliveredAmount *data.Amount `json:"delivered_amount,omitempty"` }
Not sure whether rubblelabs metadata.go needs a fix for delivered amount. Should this be deprecated in favor of Metadata in tx.go?
type TxMetaRaw ¶
type TxMetaRaw struct { Tx json.RawMessage `json:"tx"` Meta json.RawMessage `json:"meta"` Validated *bool `json:"validated"` }
type TxResult ¶
type TxResult struct { Result data.TxBase Ledger_index uint32 `json:"ledger_index,omitempty"` // account_tx returns this Meta *MetaData // "tx" returns this. Validated *bool // "tx" returns this. // contains filtered or unexported fields }
func (*TxResult) IsValidated ¶
func (*TxResult) Memo ¶
Decodes a hex memo to string. Index i specificies which memo, starting with zero. Returns ok == false if there is no such memo.
func (*TxResult) UnmarshalJSON ¶
type TxResultNoRaw ¶
type TxResultNoRaw TxResult // Same fields, without methods. Use this when you don't want custom json unmarshalling.
type TxResultXXX ¶
type TxResultXXX struct { Result Account string Fee uint64 `json:",string"` Sequence uint32 TransactionType string Hash string `json:"hash"` Flags *data.TransactionFlag Ledger_index uint32 `json:"ledger_index,omitempty"` // account_tx returns this Meta *MetaData // "tx" returns this. Validated *bool // "tx" returns this. // contains filtered or unexported fields }