Documentation ¶
Index ¶
- Constants
- type Account
- type Client
- func (c *Client) EstablishWS(path string, query url.Values) (*websocket.Conn, error)
- func (c *Client) GetAccount(accountID string) (Account, error)
- func (c *Client) GetContractCode(contractID string) (string, error)
- func (c *Client) GetContractPages(contractID string, index *uint64) (string, error)
- func (c *Client) GetLedgerStatus(senderID *string, creatorID *string, offset *uint64, limit *uint64) (LedgerStatusResponse, error)
- func (c *Client) GetTransaction(txID string) (Transaction, error)
- func (c *Client) ListTransactions(senderID *string, creatorID *string, offset *uint64, limit *uint64) ([]Transaction, error)
- func (c *Client) PollAccounts(stop <-chan struct{}, accountID *string) (<-chan []byte, error)
- func (c *Client) PollContracts(stop <-chan struct{}, contractID *string) (<-chan []byte, error)
- func (c *Client) PollLoggerSink(stop <-chan struct{}, sinkRoute string) (<-chan []byte, error)
- func (c *Client) PollTransactions(stop <-chan struct{}, txID *string, senderID *string, creatorID *string, ...) (<-chan []byte, error)
- func (c *Client) Request(path string, method string, body MarshalableJSON) ([]byte, error)
- func (c *Client) RequestJSON(path string, method string, body MarshalableJSON, out UnmarshalableJSON) error
- func (c *Client) SendTransaction(tag byte, payload []byte) (SendTransactionResponse, error)
- type Config
- type LedgerStatusResponse
- type MarshalableJSON
- type SendTransactionRequest
- type SendTransactionResponse
- type Transaction
- type TransactionList
- type UnmarshalableJSON
Constants ¶
View Source
const ( RouteLedger = "/ledger" RouteAccount = "/accounts" RouteContract = "/contract" RouteTxList = "/tx" RouteTxSend = "/tx/send" RouteWSBroadcaster = "/poll/broadcaster" RouteWSConsensus = "/poll/consensus" RouteWSStake = "/poll/stake" RouteWSAccounts = "/poll/accounts" RouteWSContracts = "/poll/contract" RouteWSTransactions = "/poll/tx" RouteWSMetrics = "/poll/metrics" ReqPost = "POST" ReqGet = "GET" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Account ¶
type Account struct { PublicKey string `json:"public_key"` Balance uint64 `json:"balance"` Stake uint64 `json:"stake"` IsContract bool `json:"is_contract"` NumPages uint64 `json:"num_mem_pages,omitempty"` }
func (*Account) UnmarshalJSON ¶
type Client ¶
type Client struct { Config edwards25519.PrivateKey edwards25519.PublicKey // contains filtered or unexported fields }
func (*Client) EstablishWS ¶
EstablishWS will create a websocket connection.
func (*Client) GetContractCode ¶
func (*Client) GetContractPages ¶
func (*Client) GetLedgerStatus ¶
func (*Client) GetTransaction ¶
func (c *Client) GetTransaction(txID string) (Transaction, error)
func (*Client) ListTransactions ¶
func (*Client) PollAccounts ¶
func (*Client) PollContracts ¶
func (*Client) PollLoggerSink ¶
func (*Client) PollTransactions ¶
func (*Client) RequestJSON ¶
func (c *Client) RequestJSON(path string, method string, body MarshalableJSON, out UnmarshalableJSON) error
Request will make a request to a given path, with a given body and return result in out.
func (*Client) SendTransaction ¶
func (c *Client) SendTransaction(tag byte, payload []byte) (SendTransactionResponse, error)
type Config ¶
type Config struct { APIHost string APIPort uint16 PrivateKey edwards25519.PrivateKey UseHTTPS bool }
type LedgerStatusResponse ¶
type LedgerStatusResponse struct { PublicKey string `json:"public_key"` HostAddress string `json:"address"` PeerAddresses []string `json:"peers"` RootID string `json:"root_id"` RoundID uint64 `json:"round_id"` Difficulty uint64 `json:"difficulty"` }
func (*LedgerStatusResponse) UnmarshalJSON ¶
func (l *LedgerStatusResponse) UnmarshalJSON(b []byte) error
type MarshalableJSON ¶
type SendTransactionRequest ¶
type SendTransactionRequest struct { Sender string `json:"sender"` Tag byte `json:"tag"` Payload string `json:"payload"` Signature string `json:"signature"` }
func (*SendTransactionRequest) MarshalJSON ¶
func (s *SendTransactionRequest) MarshalJSON() ([]byte, error)
type SendTransactionResponse ¶
type SendTransactionResponse struct { ID string `json:"tx_id"` Parents []string `json:"parent_ids"` Critical bool `json:"is_critical"` }
func (*SendTransactionResponse) UnmarshalJSON ¶
func (s *SendTransactionResponse) UnmarshalJSON(b []byte) error
type Transaction ¶
type Transaction struct { ID string `json:"id"` Sender string `json:"sender"` Creator string `json:"creator"` Parents []string `json:"parents"` Timestamp uint64 `json:"timestamp"` Tag byte `json:"tag"` Payload []byte `json:"payload"` AccountsMerkleRoot string `json:"accounts_root"` SenderSignature string `json:"sender_signature"` CreatorSignature string `json:"creator_signature"` Depth uint64 `json:"depth"` }
func (*Transaction) ParseJSON ¶
func (t *Transaction) ParseJSON(v *fastjson.Value)
func (*Transaction) UnmarshalJSON ¶
func (t *Transaction) UnmarshalJSON(b []byte) error
type TransactionList ¶
type TransactionList []Transaction
func (*TransactionList) UnmarshalJSON ¶
func (t *TransactionList) UnmarshalJSON(b []byte) error
type UnmarshalableJSON ¶
Click to show internal directories.
Click to hide internal directories.