Documentation ¶
Index ¶
- type AccountBalance
- type AccountHistory
- type AccountHistoryRaw
- type AccountInfo
- type AccountReceivable
- type Block
- type BlockHash
- type BlockInfo
- type Client
- func (c *Client) AccountBalance(account string) (balance, receivable *RawAmount, err error)
- func (c *Client) AccountBlockCount(account string) (blockCount uint64, err error)
- func (c *Client) AccountHistory(account string, count int64, head BlockHash) (history []AccountHistory, previous BlockHash, err error)
- func (c *Client) AccountHistoryRaw(account string, count int64, head BlockHash) (history []AccountHistoryRaw, previous BlockHash, err error)
- func (c *Client) AccountInfo(account string) (info AccountInfo, err error)
- func (c *Client) AccountRepresentative(account string) (representative string, err error)
- func (c *Client) AccountWeight(account string) (weight *RawAmount, err error)
- func (c *Client) AccountsBalances(accounts []string) (balances map[string]*AccountBalance, err error)
- func (c *Client) AccountsFrontiers(accounts []string) (frontiers map[string]BlockHash, err error)
- func (c *Client) AccountsReceivable(accounts []string, count int64) (receivable map[string]HashToReceivableMap, err error)
- func (c *Client) AvailableSupply() (available *RawAmount, err error)
- func (c *Client) BlockAccount(hash BlockHash) (account string, err error)
- func (c *Client) BlockConfirm(hash BlockHash) (started bool, err error)
- func (c *Client) BlockCount() (cemented, count, unchecked uint64, err error)
- func (c *Client) BlockInfo(hash BlockHash) (info BlockInfo, err error)
- func (c *Client) Blocks(hashes []BlockHash) (blocks map[string]*Block, err error)
- func (c *Client) BlocksInfo(hashes []BlockHash) (blocks map[string]*BlockInfo, err error)
- func (c *Client) Chain(block BlockHash, count int64) (blocks []BlockHash, err error)
- func (c *Client) Delegators(account string) (delegators map[string]*RawAmount, err error)
- func (c *Client) DelegatorsCount(account string) (count uint64, err error)
- func (c *Client) FrontierCount() (count uint64, err error)
- func (c *Client) Frontiers(account string, count int64) (frontiers map[string]BlockHash, err error)
- func (c *Client) Ledger(account string, count int64, modifiedSince time.Time) (accounts map[string]AccountInfo, err error)
- func (c *Client) Process(block *Block, subtype string) (hash BlockHash, err error)
- func (c *Client) Receivable(account string, count int64, includeActive bool, threshold string) (receivable HashToReceivableMap, err error)
- func (c *Client) Representatives(count int64) (representatives map[string]*RawAmount, err error)
- func (c *Client) RepresentativesOnline() (representatives map[string]Representative, err error)
- func (c *Client) Republish(hash BlockHash, count, sources, destinations int64) (blocks []BlockHash, err error)
- func (c *Client) Successors(block BlockHash, count int64) (blocks []BlockHash, err error)
- func (c *Client) WorkCancel(hash BlockHash) (err error)
- func (c *Client) WorkGenerate(hash BlockHash, difficulty HexData) (work, difficulty2 HexData, multiplier float64, err error)
- func (c *Client) WorkValidate(hash BlockHash, work HexData) (validAll, validReceive bool, difficulty HexData, multiplier float64, err error)
- type HashToReceivableMap
- type HexData
- type RawAmount
- type Representative
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccountBalance ¶
type AccountBalance struct {
Balance, Receivable *RawAmount
}
AccountBalance returns how many RAW is owned and how many have not yet been received.
type AccountHistory ¶
type AccountHistory struct { Type string `json:"type"` Account string `json:"account"` Amount *RawAmount `json:"amount"` LocalTimestamp uint64 `json:"local_timestamp,string"` Height uint64 `json:"height,string"` Hash BlockHash `json:"hash"` }
AccountHistory reports send/receive information within a block.
type AccountHistoryRaw ¶
type AccountHistoryRaw struct { Type string `json:"type"` Representative string `json:"representative"` Link BlockHash `json:"link"` Balance *RawAmount `json:"balance"` Previous BlockHash `json:"previous"` Subtype string `json:"subtype"` Account string `json:"account"` Amount *RawAmount `json:"amount"` LocalTimestamp uint64 `json:"local_timestamp,string"` Height uint64 `json:"height,string"` Hash BlockHash `json:"hash"` Work HexData `json:"work"` Signature HexData `json:"signature"` }
AccountHistoryRaw reports all parameters of the block itself as seen in BlockCreate or other APIs returning blocks.
type AccountInfo ¶
type AccountInfo struct { Frontier BlockHash `json:"frontier"` OpenBlock BlockHash `json:"open_block"` RepresentativeBlock BlockHash `json:"representative_block"` Balance *RawAmount `json:"balance"` ModifiedTimestamp uint64 `json:"modified_timestamp,string"` BlockCount uint64 `json:"block_count,string"` ConfirmationHeight uint64 `json:"confirmation_height,string"` ConfirmationHeightFrontier BlockHash `json:"confirmation_height_frontier"` AccountVersion uint64 `json:"account_version,string"` Representative string `json:"representative"` Weight *RawAmount `json:"weight"` Receivable *RawAmount `json:"receivable"` }
AccountInfo returns frontier, open block, change representative block, balance, last modified timestamp from local database & block count for account.
type AccountReceivable ¶
AccountReceivable returns amount and source account.
type Block ¶
type Block struct { Type string `json:"type"` Account string `json:"account"` Previous BlockHash `json:"previous"` Representative string `json:"representative"` Balance *RawAmount `json:"balance"` Link BlockHash `json:"link"` LinkAsAccount string `json:"link_as_account"` Signature HexData `json:"signature"` Work HexData `json:"work"` }
Block corresponds to the JSON representation of a block.
type BlockHash ¶
type BlockHash []byte
BlockHash represents a block hash.
func (BlockHash) MarshalJSON ¶
MarshalJSON returns the JSON encoding of h.
func (*BlockHash) UnmarshalJSON ¶
UnmarshalJSON sets *h to a copy of data.
type BlockInfo ¶
type BlockInfo struct { BlockAccount string `json:"block_account"` Amount *RawAmount `json:"amount"` Balance *RawAmount `json:"balance"` Height uint64 `json:"height,string"` LocalTimestamp uint64 `json:"local_timestamp,string"` Confirmed bool `json:"confirmed,string"` Contents *Block `json:"contents"` Subtype string `json:"subtype"` }
BlockInfo retrieves a json representation of a block.
type Client ¶
Client is used for connecting to http rpc endpoints.
func (*Client) AccountBalance ¶
AccountBalance returns how many RAW is owned and how many have not yet been received by account.
func (*Client) AccountBlockCount ¶
AccountBlockCount gets the number of blocks for a specific account.
func (*Client) AccountHistory ¶
func (c *Client) AccountHistory(account string, count int64, head BlockHash) (history []AccountHistory, previous BlockHash, err error)
AccountHistory reports send/receive information for an account.
func (*Client) AccountHistoryRaw ¶
func (c *Client) AccountHistoryRaw(account string, count int64, head BlockHash) (history []AccountHistoryRaw, previous BlockHash, err error)
AccountHistoryRaw reports all parameters of the block itself as seen in BlockCreate or other APIs returning blocks.
func (*Client) AccountInfo ¶
func (c *Client) AccountInfo(account string) (info AccountInfo, err error)
AccountInfo returns frontier, open block, change representative block, balance, last modified timestamp from local database & block count for account.
func (*Client) AccountRepresentative ¶
AccountRepresentative returns the representative for account.
func (*Client) AccountWeight ¶
AccountWeight returns the voting weight for account.
func (*Client) AccountsBalances ¶
func (c *Client) AccountsBalances(accounts []string) (balances map[string]*AccountBalance, err error)
AccountsBalances returns how many RAW is owned and how many have not yet been received by accounts list.
func (*Client) AccountsFrontiers ¶
AccountsFrontiers returns a list of pairs of account and block hash representing the head block for accounts list.
func (*Client) AccountsReceivable ¶
func (c *Client) AccountsReceivable(accounts []string, count int64) (receivable map[string]HashToReceivableMap, err error)
AccountsReceivable returns a list of receivable block hashes with amount and source accounts.
func (*Client) AvailableSupply ¶
AvailableSupply returns how many raw are in the public supply.
func (*Client) BlockAccount ¶
BlockAccount returns the account containing block.
func (*Client) BlockConfirm ¶
BlockConfirm requests confirmation for block from known online representative nodes.
func (*Client) BlockCount ¶
BlockCount reports the number of blocks in the ledger and unchecked synchronizing blocks.
func (*Client) BlocksInfo ¶
BlocksInfo retrieves a json representations of blocks in contents.
func (*Client) Chain ¶
Chain returns a consecutive list of block hashes in the account chain starting at block back to count (direction from frontier back to open block, from newer blocks to older). Will list all blocks back to the open block of this chain when count is set to "-1". The requested block hash is included in the answer.
func (*Client) Delegators ¶
Delegators returns a list of pairs of delegator names given a representative account and its balance.
func (*Client) DelegatorsCount ¶
DelegatorsCount gets number of delegators for a specific representative account.
func (*Client) FrontierCount ¶
FrontierCount reports the number of accounts in the ledger.
func (*Client) Frontiers ¶
Frontiers returns a list of pairs of account and block hash representing the head block starting at account up to count.
func (*Client) Ledger ¶
func (c *Client) Ledger(account string, count int64, modifiedSince time.Time) (accounts map[string]AccountInfo, err error)
Ledger returns frontier, open block, change representative block, balance, last modified timestamp from local database & block count starting at account up to count.
func (*Client) Receivable ¶
func (c *Client) Receivable( account string, count int64, includeActive bool, threshold string, ) (receivable HashToReceivableMap, err error)
Receivable returns a list of block hashes which have not yet been received by this account.
func (*Client) Representatives ¶
Representatives returns a list of pairs of representative and its voting weight.
func (*Client) RepresentativesOnline ¶
func (c *Client) RepresentativesOnline() (representatives map[string]Representative, err error)
RepresentativesOnline returns a list of online representative accounts that have voted recently.
func (*Client) Republish ¶
func (c *Client) Republish(hash BlockHash, count, sources, destinations int64) (blocks []BlockHash, err error)
Republish rebroadcasts blocks starting at hash to the network.
func (*Client) Successors ¶
Successors returns a consecutive list of block hashes in the account chain starting at block up to count (direction from open block up to frontier, from older blocks to newer). Will list all blocks up to frontier (latest block) of this chain when count is set to "-1". The requested block hash is included in the answer.
func (*Client) WorkCancel ¶
WorkCancel stops generating work for block.
func (*Client) WorkGenerate ¶
func (c *Client) WorkGenerate(hash BlockHash, difficulty HexData) ( work, difficulty2 HexData, multiplier float64, err error, )
WorkGenerate generates work for block. hash is the frontier of the account or in the case of an open block, the public key representation of the account.
func (*Client) WorkValidate ¶
func (c *Client) WorkValidate(hash BlockHash, work HexData) ( validAll, validReceive bool, difficulty HexData, multiplier float64, err error, )
WorkValidate checks whether work is valid for block. Provides two values: validAll is true if the work is valid at the current network difficulty (work can be used for any block). validReceive is true if the work is valid for use in a receive block.
type HashToReceivableMap ¶
type HashToReceivableMap map[string]AccountReceivable
HashToReceivableMap maps receivable block hashes to amount and source account.
func (*HashToReceivableMap) UnmarshalJSON ¶
func (h *HashToReceivableMap) UnmarshalJSON(data []byte) (err error)
UnmarshalJSON sets *h to a copy of data.
type HexData ¶
type HexData []byte
HexData represents generic hex data.
func (HexData) MarshalJSON ¶
MarshalJSON returns the JSON encoding of h.
func (*HexData) UnmarshalJSON ¶
UnmarshalJSON sets *h to a copy of data.
type RawAmount ¶
RawAmount represents an amount of nano in RAWs.
func (*RawAmount) MarshalJSON ¶
MarshalJSON returns the JSON encoding of r.
func (*RawAmount) UnmarshalJSON ¶
UnmarshalJSON sets *r to a copy of data.
type Representative ¶
type Representative struct{ Weight *RawAmount }
Representative returns the weight of a representative.