rosetta

package
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 22, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

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"`
}

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(network 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

func (d *Data) Balance(ctx echo.Context) error

Balance implements the /account/balance endpoint of the Rosetta Data API. See https://www.rosetta-api.org/docs/AccountApi.html#accountbalance

func (*Data) Block

func (d *Data) Block(ctx echo.Context) error

Block implements the /block endpoint of the Rosetta Data API. See https://www.rosetta-api.org/docs/BlockApi.html#block

func (*Data) Networks

func (d *Data) Networks(ctx echo.Context) error

Networks implements the /network/list endpoint of the Rosetta Data API. See https://www.rosetta-api.org/docs/NetworkApi.html#networklist

func (*Data) Options

func (d *Data) Options(ctx echo.Context) error

Options implements the /network/options endpoint of the Rosetta Data API. See https://www.rosetta-api.org/docs/NetworkApi.html#networkoptions

func (*Data) Status

func (d *Data) Status(ctx echo.Context) error

Status implements the /network/status endpoint of the Rosetta Data API. See https://www.rosetta-api.org/docs/NetworkApi.html#networkstatus

func (*Data) Transaction

func (d *Data) Transaction(ctx echo.Context) error

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

type OptionsResponse struct {
	Version meta.Version `json:"version"`
	Allow   Allow        `json:"allow"`
}

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(block identifier.Block) (*object.Block, []identifier.Transaction, error)
	Transaction(block identifier.Block, transaction identifier.Transaction) (*object.Transaction, error)
	Balances(block identifier.Block, account identifier.Account, currencies []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"`
}

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL