Documentation
¶
Index ¶
- type Allow
- type BalanceRequest
- type BalanceResponse
- type BlockRequest
- type BlockResponse
- type Configuration
- type Data
- type Error
- type NetworksRequest
- type NetworksResponse
- type OptionsRequest
- type OptionsResponse
- type Retriever
- type StatusRequest
- type StatusResponse
- type TransactionRequest
- type TransactionResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Allow ¶
type Allow struct {
OperationStatuses []meta.StatusDefinition `json:"operation_statuses"`
OperationTypes []string `json:"operation_types"`
Errors []meta.ErrorDefinition `json:"errors"`
HistoricalBalanceLookup bool `json:"historical_balance_lookup"`
CallMethods []string `json:"call_methods"` // not used
BalanceExemptions []struct{} `json:"balance_exemptions"` // not used
MempoolCoins bool `json:"mempool_coins"`
}
type BalanceRequest ¶
type BalanceRequest struct {
NetworkID identifier.Network `json:"network_identifier"`
BlockID identifier.Block `json:"block_identifier"`
AccountID identifier.Account `json:"account_identifier"`
Currencies []identifier.Currency `json:"currencies"`
}
BalanceRequest implements the request schema for /account/balance. See https://www.rosetta-api.org/docs/AccountApi.html#request
type BalanceResponse ¶
type BalanceResponse struct {
BlockID identifier.Block `json:"block_identifier"`
Balances []object.Amount `json:"balances"`
}
BalanceResponse implements the successful response schema for /account/balance. See https://www.rosetta-api.org/docs/AccountApi.html#200---ok
type BlockRequest ¶
type BlockRequest struct {
NetworkID identifier.Network `json:"network_identifier"`
BlockID identifier.Block `json:"block_identifier"`
}
BlockRequest implements the request schema for /block. See https://www.rosetta-api.org/docs/BlockApi.html#request
type BlockResponse ¶
type BlockResponse struct {
Block *object.Block `json:"block"`
OtherTransactions []identifier.Transaction `json:"other_transactions,omitempty"`
}
BlockResponse implements the response schema for /block. See https://www.rosetta-api.org/docs/BlockApi.html#200---ok
type Configuration ¶
type Configuration interface {
Network() identifier.Network
Version() meta.Version
Operations() []string
Statuses() []meta.StatusDefinition
Errors() []meta.ErrorDefinition
Check(rosNetID identifier.Network) error
}
Configuration represents the configuration parameters of a particular blockchain from the Rosetta API's perspective. It details some blockchain metadata, its supported operations, errors, and more. See https://www.rosetta-api.org/docs/NetworkApi.html#networkoptions
type Data ¶
type Data struct {
// contains filtered or unexported fields
}
Data implements the Rosetta Data API specification. See https://www.rosetta-api.org/docs/data_api_introduction.html
func NewData ¶
func NewData(config Configuration, retrieve Retriever) *Data
NewData creates a new instance of the Data API using the given configuration to answer configuration queries and the given retriever to answer blockchain data queries.
func (*Data) Balance ¶
Balance implements the /account/balance endpoint of the Rosetta Data API. See https://www.rosetta-api.org/docs/AccountApi.html#accountbalance
func (*Data) Block ¶
Block implements the /block endpoint of the Rosetta Data API. See https://www.rosetta-api.org/docs/BlockApi.html#block
func (*Data) Networks ¶
Networks implements the /network/list endpoint of the Rosetta Data API. See https://www.rosetta-api.org/docs/NetworkApi.html#networklist
func (*Data) Options ¶
Options implements the /network/options endpoint of the Rosetta Data API. See https://www.rosetta-api.org/docs/NetworkApi.html#networkoptions
func (*Data) Status ¶
Status implements the /network/status endpoint of the Rosetta Data API. See https://www.rosetta-api.org/docs/NetworkApi.html#networkstatus
func (*Data) Transaction ¶
Transaction implements the /block/transaction endpoint of the Rosetta Data API. See https://www.rosetta-api.org/docs/BlockApi.html#blocktransaction
type Error ¶
type Error struct {
meta.ErrorDefinition
Description string `json:"description"`
Details map[string]interface{} `json:"details,omitempty"`
}
Error represents an error as defined by the Rosetta API specification. It contains an error definition, which has an error code, error message and retriable flag that never change, as well as a description and a list of details to provide more granular error information. See: https://www.rosetta-api.org/docs/api_objects.html#error
type NetworksRequest ¶
type NetworksRequest struct {
}
NetworksRequest implements the empty request schema for the /network/list endpoint. See https://www.rosetta-api.org/docs/NetworkApi.html#request
type NetworksResponse ¶
type NetworksResponse struct {
NetworkIDs []identifier.Network `json:"network_identifiers"`
}
NetworksResponse implements the successful response schema for the /network/list endpoint. See https://www.rosetta-api.org/docs/NetworkApi.html#200---ok
type OptionsRequest ¶
type OptionsRequest struct {
NetworkID identifier.Network `json:"network_identifier"`
}
OptionsRequest implements the empty request schema for the /network/options endpoint. See https://www.rosetta-api.org/docs/NetworkApi.html#request-1
type OptionsResponse ¶
OptionsResponse implements the successful response schema for the /network/options endpoint. See https://www.rosetta-api.org/docs/NetworkApi.html#200---ok-1
type Retriever ¶
type Retriever interface {
Oldest() (identifier.Block, time.Time, error)
Current() (identifier.Block, time.Time, error)
Block(rosBlockID identifier.Block) (*object.Block, []identifier.Transaction, error)
Transaction(rosBlockID identifier.Block, rosTxID identifier.Transaction) (*object.Transaction, error)
Balances(rosBlockID identifier.Block, rosAccountID identifier.Account, rosCurrencies []identifier.Currency) (identifier.Block, []object.Amount, error)
}
type StatusRequest ¶
type StatusRequest struct {
NetworkID identifier.Network `json:"network_identifier"`
}
StatusRequest implements the request schema for /network/status. See https://www.rosetta-api.org/docs/NetworkApi.html#request-2
type StatusResponse ¶
type StatusResponse struct {
CurrentBlockID identifier.Block `json:"current_block_identifier"`
CurrentBlockTimestamp int64 `json:"current_block_timestamp"`
OldestBlockID identifier.Block `json:"oldest_block_identifier"`
GenesisBlockID identifier.Block `json:"genesis_block_identifier"`
Peers []struct{} `json:"peers"` // not used
}
StatusResponse implements the successful response schema for /network/status. See https://www.rosetta-api.org/docs/NetworkApi.html#200---ok-2
type TransactionRequest ¶
type TransactionRequest struct {
NetworkID identifier.Network `json:"network_identifier"`
BlockID identifier.Block `json:"block_identifier"`
TransactionID identifier.Transaction `json:"transaction_identifier"`
}
TransactionRequest implements the request schema for /block/transaction. See https://www.rosetta-api.org/docs/BlockApi.html#request-1
type TransactionResponse ¶
type TransactionResponse struct {
Transaction *object.Transaction `json:"transaction"`
}
TransactionResponse implements the successful response schema for /block/transaction. See https://www.rosetta-api.org/docs/BlockApi.html#200---ok-1