Documentation
¶
Index ¶
- Constants
- func NewDefaultListOptionsFromQuery(v neturl.Values) (options *storage.DefaultListOptions, err error)
- type Account
- type Client
- func (c *Client) Get(path string, headers http.Header) (response *http.Response, err error)
- func (c *Client) LoadAFrozenAccounts(id string, queries ...Q) (fPage FrozenAccountsPage, err error)
- func (c *Client) LoadAccount(id string, queries ...Q) (account Account, err error)
- func (c *Client) LoadFrozenAccountsByLinked(id string, queries ...Q) (fPage FrozenAccountsPage, err error)
- func (c *Client) LoadOperationsByAccount(id string, queries ...Q) (oPage OperationsPage, err error)
- func (c *Client) LoadOperationsByTransaction(id string, queries ...Q) (oPage OperationsPage, err error)
- func (c *Client) LoadTransaction(id string, queries ...Q) (transaction Transaction, err error)
- func (c *Client) LoadTransactionStatus(id string, queries ...Q) (transactionHistory TransactionStatus, err error)
- func (c *Client) LoadTransactions(queries ...Q) (tPage TransactionsPage, err error)
- func (c *Client) LoadTransactionsByAccount(id string, queries ...Q) (tPage TransactionsPage, err error)
- func (c *Client) Post(path string, body []byte, headers http.Header) (response *http.Response, err error)
- func (c *Client) StreamAccount(ctx context.Context, handler func(Account), ids ...string) error
- func (c *Client) StreamTransactionStatus(ctx context.Context, id string, handler func(TransactionStatus)) (err error)
- func (c *Client) StreamTransactions(ctx context.Context, handler func(Transaction), ids ...string) error
- func (c *Client) StreamTransactionsByAccount(ctx context.Context, id string, handler func(Transaction)) (err error)
- func (c *Client) SubmitTransaction(tx []byte) (TransactionPostError, error)
- func (c *Client) SubmitTransactionAndWait(hash string, tx []byte) (pTransaction TransactionPostError, err error)
- func (c *Client) ToResponse(resp *http.Response, response interface{}) (err error)
- type CollectTxFee
- type CongressVoting
- type CongressVotingResult
- type CreateAccount
- type Error
- type FrozenAccount
- type FrozenAccountsPage
- type Inflation
- type Link
- type Operation
- type OperationsPage
- type Payment
- type Problem
- type Q
- type Queries
- type QueryKey
- type Transaction
- type TransactionPostError
- type TransactionStatus
- type TransactionsPage
Constants ¶
View Source
const ( UrlPrefixForAPIV1 = "/api/v1" UrlAccountTransactions = "/accounts/{id}/transactions" UrlAccount = "/accounts/{id}" UrlAccountOperations = "/accounts/{id}/operations" UrlAccountFrozenAccounts = "/accounts/{id}/frozen-accounts" UrlFrozenAccounts = "/frozen-accounts" UrlTransactions = "/transactions" UrlTransactionByHash = "/transactions/{id}" UrlTransactionStatus = "/transactions/{id}/status" UrlTransactionOperations = "/transactions/{id}/operations" UrlSubscribe = "/subscribe" )
Variables ¶
This section is empty.
Functions ¶
func NewDefaultListOptionsFromQuery ¶
func NewDefaultListOptionsFromQuery(v neturl.Values) (options *storage.DefaultListOptions, err error)
NewDefaultListOptionsFromQuery makes ListOptions from url.Query.
Types ¶
type Client ¶
type Client struct {
URL string
HTTP *common.HTTP2Client
}
func MustNewClient ¶
Calls `NewClient` and panic if an `error` is returned
func NewClient ¶
Create a new Client object
Params:
url = The url of the node, e.g. "https://127.0.0.1:1234"
Returns:
error = An error object, if the client could not be created.
`nil` otherwise.
Client* = If `error == nil`, the constructed `Client`
func (*Client) LoadAFrozenAccounts ¶
func (c *Client) LoadAFrozenAccounts(id string, queries ...Q) (fPage FrozenAccountsPage, err error)
func (*Client) LoadAccount ¶
func (*Client) LoadFrozenAccountsByLinked ¶
func (c *Client) LoadFrozenAccountsByLinked(id string, queries ...Q) (fPage FrozenAccountsPage, err error)
func (*Client) LoadOperationsByAccount ¶
func (c *Client) LoadOperationsByAccount(id string, queries ...Q) (oPage OperationsPage, err error)
func (*Client) LoadOperationsByTransaction ¶
func (c *Client) LoadOperationsByTransaction(id string, queries ...Q) (oPage OperationsPage, err error)
func (*Client) LoadTransaction ¶
func (c *Client) LoadTransaction(id string, queries ...Q) (transaction Transaction, err error)
func (*Client) LoadTransactionStatus ¶
func (c *Client) LoadTransactionStatus(id string, queries ...Q) (transactionHistory TransactionStatus, err error)
func (*Client) LoadTransactions ¶
func (c *Client) LoadTransactions(queries ...Q) (tPage TransactionsPage, err error)
func (*Client) LoadTransactionsByAccount ¶
func (c *Client) LoadTransactionsByAccount(id string, queries ...Q) (tPage TransactionsPage, err error)
func (*Client) StreamAccount ¶
Stream account updates from the node
Params:
ctx = Context to use. The streaming starts a goroutine and doesn't stop.
A common pattern is to pass `context.WithCancel(context.Background())`.
See go's `context` package for more details.
handler = The handler function that will be called every time an account is updated.
Returns: An `error` object, or `nil`
func (*Client) StreamTransactionStatus ¶
func (*Client) StreamTransactions ¶
func (c *Client) StreamTransactions(ctx context.Context, handler func(Transaction), ids ...string) error
Stream transactions from the node
Params:
ctx = Context to use. The streaming starts a goroutine and doesn't stop.
A common pattern is to pass `context.WithCancel(context.Background())`.
See go's `context` package for more details.
handler = The handler function that will be called every time a transaction is received.
ids = An (optional) list of transaction hashes to listen to.
If `nil`, all transactions will be streamed to the handler.
Returns: An `error` object, or `nil`
func (*Client) StreamTransactionsByAccount ¶
func (*Client) SubmitTransaction ¶
func (c *Client) SubmitTransaction(tx []byte) (TransactionPostError, error)
Submit a transaction to the node (via POST `UrlTransactions`)
Params:
tx = JSON serialized Transaction that will be sent as body
Returns:
TransactionPostError = An object describing the node's answer if there's an error error = An error object, or `nil`
func (*Client) SubmitTransactionAndWait ¶
func (c *Client) SubmitTransactionAndWait(hash string, tx []byte) (pTransaction TransactionPostError, err error)
Submit a transaction to the node (via POST `UrlTransactions`)
Params:
hash = the hash of the transaction tx = JSON serialized Transaction that will be sent as body
Returns:
TransactionPostError = An object describing the node's answer if there's an error error = An error object, or `nil`
type CollectTxFee ¶
type CongressVoting ¶
type CongressVotingResult ¶
type CongressVotingResult struct {
BallotStamps struct {
Hash string `json:"hash"`
Urls []string `json:"urls"`
} `json:"ballot_stamps"`
Voters struct {
Hash string `json:"hash"`
Urls []string `json:"urls"`
} `json:"voters"`
Membership struct {
Hash string `json:"hash"`
Urls []string `json:"urls"`
} `json:"membership"`
Result struct {
Count uint64 `json:"count"`
Yes uint64 `json:"yes"`
No uint64 `json:"no"`
ABS uint64 `json:"abs"`
} `json:"result"`
CongressVotingHash string `json:"congress_voting_hash"`
}
type CreateAccount ¶
type FrozenAccount ¶
type FrozenAccount struct {
Links struct {
Self Link `json:"self"`
} `json:"_links"`
Address string `json:"address"`
Linked string `json:"linked"`
CreateBlockHeight uint64 `json:"create_block_height"`
CreateOpHash string `json:"create_op_hash"`
SequenceID uint64 `json:"sequence_id"`
Amount common.Amount `json:"amount"`
State resource.FrozenAccountState `json:"state"`
UnfreezingBlockHeight uint64 `json:"unfreezing_block_height"`
UnfreezingOpHash string `json:"unfreezing_op_hash"`
UnfreezingRemainingBlockes uint64 `json:"unfreezing_remaining_blockheight"`
PaymentOpHash string `json:"payment_op_hash"`
}
type FrozenAccountsPage ¶
type FrozenAccountsPage struct {
Links struct {
Self Link `json:"self"`
} `json:"_links"`
Embedded struct {
Records []FrozenAccount `json:"records"`
} `json:"_embedded"`
}
type Inflation ¶
type Inflation struct {
Target string `json:"target"`
Amount []byte `json:"amount"`
InitialBalance []byte `json:"initial-balance"`
Ratio string `json:"ratio"`
Height uint64 `json:"block-height"`
BlockHash string `json:"block-hash"`
TotalTxs uint64 `json:"total-txs"`
TotalOps uint64 `json:"total-ops"`
}
type Operation ¶
type Operation struct {
Links struct {
Self Link `json:"self"`
Transaction Link `json:"transaction"`
} `json:"_links"`
Hash string `json:"hash"`
Source string `json:"source"`
Target string `json:"target"`
Type string `json:"type"`
TxHash string `json:"tx_hash"`
BlockHeight uint64 `json:"block_height"`
Index uint64 `json:"index"`
Body interface{} `json:"body"`
}
type OperationsPage ¶
type Transaction ¶
type Transaction struct {
Links struct {
Self Link `json:"self"`
Account Link `json:"account"`
Operations Link `json:"operations"`
} `json:"_links"`
Hash string `json:"hash"`
Source string `json:"source"`
Fee string `json:"fee"`
SequenceID uint64 `json:"sequence_id"`
Created string `json:"created"`
OperationCount uint64 `json:"operation_count"`
}
type TransactionPostError ¶
type TransactionStatus ¶
type TransactionsPage ¶
type TransactionsPage struct {
Links struct {
Self Link `json:"self"`
Next Link `json:"next"`
Prev Link `json:"prev"`
} `json:"_links"`
Embedded struct {
Records []Transaction `json:"records"`
} `json:"_embedded"`
}
Click to show internal directories.
Click to hide internal directories.