Documentation ¶
Index ¶
- Constants
- func GetAccount(node *Client, addr address.Address) (*backing.AccountData, error)
- func GetAccountHistory(node *Client, params search.AccountHistoryParams) (*search.AccountHistoryResponse, error)
- func GetAccountList(node *Client, after string, limit int) (*query.AccountListQueryResponse, error)
- func GetAccountListBatch(node *Client) ([]address.Address, error)
- func GetCurrencySeats(node *Client) ([]address.Address, error)
- func GetDelegates(node *Client) (map[address.Address][]address.Address, error)
- func GetSIB(node *Client) (*routes.PriceInfo, error)
- func GetSequence(node *Client, addr address.Address) (uint64, error)
- func GetSummary(node *Client) (*routes.PriceInfo, error)
- func Info(node *Client) (status *rpctypes.ResultStatus, err error)
- func Prevalidate(node *Client, tx metatx.Transactable) (fee math.Ndau, sib math.Ndau, err error)
- func SendCommit(node *Client, tx metatx.Transactable) (result *routes.SubmitResult, err error)
- func Sysvar(node *Client, name string, example msgp.Unmarshaler) error
- func SysvarHistory(node *Client, name string, after uint64, limit int) (*query.SysvarHistoryResponse, error)
- func Sysvars(node *Client, vars ...string) (map[string][]byte, error)
- func Version(node *Client) (*routes.VersionResult, error)
- type Client
- func (c *Client) ABCIInfo() (abci *rpctypes.ResultABCIInfo, err error)
- func (c *Client) Consensus() (cs *rpctypes.ResultConsensusState, err error)
- func (c *Client) EAIRate(query ...routes.EAIRateRequest) (response []routes.EAIRateResponse, err error)
- func (c *Client) Genesis() (g *rpctypes.ResultGenesis, err error)
- func (c *Client) GetAccount(addr address.Address) (*backing.AccountData, error)
- func (c *Client) GetAccountHistory(ahparams search.AccountHistoryParams) (*search.AccountHistoryResponse, error)
- func (c *Client) GetAccountList(after string, limit int) (*query.AccountListQueryResponse, error)
- func (c *Client) GetAccountListBatch() ([]address.Address, error)
- func (c *Client) GetBlock(hash string) (block *rpctypes.ResultBlock, err error)
- func (c *Client) GetBlockAt(height uint64) (block *rpctypes.ResultBlock, err error)
- func (c *Client) GetBlocksByDaterange(first, last time.Time, noempty bool, after time.Time, limit int) (blocks *rpctypes.ResultBlockchainInfo, err error)
- func (c *Client) GetBlocksByHeight(before, after uint64, noempty bool) (blocks *rpctypes.ResultBlockchainInfo, err error)
- func (c *Client) GetBlocksByRange(before, after uint64, noempty bool) (blocks *rpctypes.ResultBlockchainInfo, err error)
- func (c *Client) GetCurrencySeats() (seats []address.Address, err error)
- func (c *Client) GetCurrentBlock() (*rpctypes.ResultBlock, error)
- func (c *Client) GetDelegates() (delegates map[address.Address][]address.Address, err error)
- func (c *Client) GetSequence(addr address.Address) (uint64, error)
- func (c *Client) Health() (resp *routes.HealthResponse, err error)
- func (c *Client) Info() (status *rpctypes.ResultStatus, err error)
- func (c *Client) MarketPriceHistory(params srch.PriceQueryParams) ([]srch.PriceQueryResult, error)
- func (c *Client) NetInfo() (ni *rpctypes.ResultNetInfo, err error)
- func (c *Client) Prevalidate(tx metatx.Transactable) (fee math.Ndau, sib math.Ndau, err error)
- func (c *Client) PriceInfo() (info *routes.PriceInfo, err error)
- func (c *Client) Send(tx metatx.Transactable) (result *routes.SubmitResult, err error)
- func (c *Client) SetTimeout(timeout time.Duration)
- func (c *Client) Sysvar(name string, example msgp.Unmarshaler) error
- func (c *Client) SysvarHistory(name string, after uint64, limit int) (resp *query.SysvarHistoryResponse, err error)
- func (c *Client) Sysvars(vars ...string) (svs map[string][]byte, err error)
- func (c *Client) TargetPriceHistory(params srch.PriceQueryParams) ([]srch.PriceQueryResult, error)
- func (c *Client) URL(path string, args ...interface{}) string
- func (c *Client) URLP(params params, path string, args ...interface{}) string
- func (c *Client) Version() (version *routes.VersionResult, err error)
Constants ¶
const JSON = "application/json"
JSON is the expected data format of requests and responses
Variables ¶
This section is empty.
Functions ¶
func GetAccount ¶
GetAccount gets the account data associated with a given address
func GetAccountHistory ¶
func GetAccountHistory(node *Client, params search.AccountHistoryParams) (*search.AccountHistoryResponse, error)
GetAccountHistory gets account data history associated with a given address.
func GetAccountList ¶
GetAccountList gets a list of account names, paged according to the params Pass in after = "" (which is less than all nonempty strings) and limit = 0 to get all results. (Note that the ndauapi will enforce a limit of 100 items.)
func GetAccountListBatch ¶
GetAccountListBatch abstracts over the process of repeatedly calling GetAccountList in order to get a complete list of all known addresses.
This function makes a best-effort attempt to return a complete and current list of accounts known to the node, but true consistency is impossible using a sequential paged API; as we cannot lock the node, there may be updates during paging which cause addresses to appear in pages we have already visited. This is unavoidable.
func GetCurrencySeats ¶
GetCurrencySeats gets a list of ndau currency seats
func GetDelegates ¶
GetDelegates gets the set of nodes with delegates, and the list of accounts delegated to each
func GetSequence ¶
GetSequence gets the current sequence number of a particular account
func GetSummary ¶
GetSummary exists for compatibility; it delegates to node.PriceInfo()
func Info ¶
func Info(node *Client) (status *rpctypes.ResultStatus, err error)
Info gets the node's current status
func Prevalidate ¶
Prevalidate prevalidates the provided transactable
func SendCommit ¶
func SendCommit(node *Client, tx metatx.Transactable) (result *routes.SubmitResult, err error)
SendCommit broadcasts and commits a transaction
func Sysvar ¶
func Sysvar(node *Client, name string, example msgp.Unmarshaler) error
Sysvar gets a single system variable given its name and an example of its type
The example is populated with the appropriate data
func SysvarHistory ¶
func SysvarHistory(node *Client, name string, after uint64, limit int) (*query.SysvarHistoryResponse, error)
SysvarHistory gets the value history of the given sysvar.
Pass in 0,0 for the paging params to get the entire history.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
A Client is a client for the ndau REST API.
func TestClient ¶
TestClient creates an SDKClient suitable for testing
func (*Client) ABCIInfo ¶
func (c *Client) ABCIInfo() (abci *rpctypes.ResultABCIInfo, err error)
ABCIInfo returns the node's ABCI data
func (*Client) Consensus ¶
func (c *Client) Consensus() (cs *rpctypes.ResultConsensusState, err error)
Consensus return's the node's current Tendermint consensus state
func (*Client) EAIRate ¶
func (c *Client) EAIRate(query ...routes.EAIRateRequest) (response []routes.EAIRateResponse, err error)
EAIRate returns EAI rates given certain account states
The address field is just to correlate request fields with response fields; account data is not checked.
func (*Client) Genesis ¶
func (c *Client) Genesis() (g *rpctypes.ResultGenesis, err error)
Genesis returns the genesis document of the node
func (*Client) GetAccount ¶
GetAccount gets the account data associated with a given address
func (*Client) GetAccountHistory ¶
func (c *Client) GetAccountHistory(ahparams search.AccountHistoryParams) (*search.AccountHistoryResponse, error)
GetAccountHistory gets account data history associated with a given address.
func (*Client) GetAccountList ¶
GetAccountList gets a list of account names, paged according to the params Pass in after = "" (which is less than all nonempty strings) and limit = 0 to get all results. (Note that the ndauapi will enforce a limit of 100 items.)
func (*Client) GetAccountListBatch ¶
GetAccountListBatch abstracts over the process of repeatedly calling GetAccountList in order to get a complete list of all known addresses.
This function makes a best-effort attempt to return a complete and current list of accounts known to the node, but true consistency is impossible using a sequential paged API; as we cannot lock the node, there may be updates during paging which cause addresses to appear in pages we have already visited. This is unavoidable.
func (*Client) GetBlock ¶
func (c *Client) GetBlock(hash string) (block *rpctypes.ResultBlock, err error)
GetBlock returns a block with a particular hash
func (*Client) GetBlockAt ¶
func (c *Client) GetBlockAt(height uint64) (block *rpctypes.ResultBlock, err error)
GetBlockAt returns a block at a given height
If height is 0, get the current block
func (*Client) GetBlocksByDaterange ¶
func (c *Client) GetBlocksByDaterange(first, last time.Time, noempty bool, after time.Time, limit int) (blocks *rpctypes.ResultBlockchainInfo, err error)
GetBlocksByDaterange returns a sequence of block metadata for blocks with block times in the specified range.
If noempty is set, exclude blocks containing no transactions. after should be the last value from the previous page, or a zero value to exclude
func (*Client) GetBlocksByHeight ¶
func (c *Client) GetBlocksByHeight(before, after uint64, noempty bool) (blocks *rpctypes.ResultBlockchainInfo, err error)
GetBlocksByHeight returns a sequence of block metadata for blocks with heights in the specified range.
If noempty is set, exclude blocks containing no transactions
func (*Client) GetBlocksByRange ¶
func (c *Client) GetBlocksByRange(before, after uint64, noempty bool) (blocks *rpctypes.ResultBlockchainInfo, err error)
GetBlocksByRange returns a sequence of block metadata for blocks with heights in the specified range.
If noempty is set, exclude blocks containing no transactions
func (*Client) GetCurrencySeats ¶
GetCurrencySeats gets a list of ndau currency seats
func (*Client) GetCurrentBlock ¶
func (c *Client) GetCurrentBlock() (*rpctypes.ResultBlock, error)
GetCurrentBlock returns the current block
func (*Client) GetDelegates ¶
GetDelegates gets the set of nodes with delegates, and the list of accounts delegated to each
func (*Client) GetSequence ¶
GetSequence gets the current sequence number of a particular account
func (*Client) Health ¶
func (c *Client) Health() (resp *routes.HealthResponse, err error)
Health is a simple check of a node's health
func (*Client) Info ¶
func (c *Client) Info() (status *rpctypes.ResultStatus, err error)
Info gets the node's current status
func (*Client) MarketPriceHistory ¶
func (c *Client) MarketPriceHistory(params srch.PriceQueryParams) ([]srch.PriceQueryResult, error)
MarketPriceHistory returns historical market price data
func (*Client) NetInfo ¶
func (c *Client) NetInfo() (ni *rpctypes.ResultNetInfo, err error)
NetInfo returns the network information of the node
func (*Client) Prevalidate ¶
Prevalidate prevalidates the provided transactable
func (*Client) Send ¶
func (c *Client) Send(tx metatx.Transactable) (result *routes.SubmitResult, err error)
Send broadcasts and commits a transaction
func (*Client) Sysvar ¶
func (c *Client) Sysvar(name string, example msgp.Unmarshaler) error
Sysvar gets a single system variable given its name and an example of its type
The example is populated with the appropriate data
func (*Client) SysvarHistory ¶
func (c *Client) SysvarHistory(name string, after uint64, limit int) (resp *query.SysvarHistoryResponse, err error)
SysvarHistory gets the value history of the given sysvar.
Pass in 0,0 for the paging params to get the entire history.
func (*Client) TargetPriceHistory ¶
func (c *Client) TargetPriceHistory(params srch.PriceQueryParams) ([]srch.PriceQueryResult, error)
TargetPriceHistory returns historical target price data
func (*Client) URL ¶
URL constructs a URL from a path
It constructs the path from the supplied path and arguments using fmt.Sprintf.