Documentation ¶
Index ¶
- Constants
- func EnableSmartCodes()
- type Configuration
- type Construction
- func (c *Construction) Combine(ctx echo.Context) error
- func (c *Construction) Hash(ctx echo.Context) error
- func (c *Construction) Metadata(ctx echo.Context) error
- func (c *Construction) Parse(ctx echo.Context) error
- func (c *Construction) Payloads(ctx echo.Context) error
- func (c *Construction) Preprocess(ctx echo.Context) error
- func (c *Construction) Submit(ctx echo.Context) error
- type Data
- type Error
- type Retriever
- type Transactor
- type Validator
Constants ¶
const ( HexIDSize = 2 * len(flow.ZeroID) HexAddressSize = 2 * flow.AddressLength )
Sizes are multiplied by two because hex-encoded strings use two characters for every byte.
Variables ¶
This section is empty.
Functions ¶
func EnableSmartCodes ¶ added in v1.3.4
func EnableSmartCodes()
EnableSmartCodes overwrites the global variables that determine which error codes the Rosetta API returns. While we avoid global variables in general, these function more as a proxy to the constants of the HTTP package, with the ability to change their value.
Types ¶
type Configuration ¶
type Configuration interface { Network() identifier.Network Version() meta.Version Operations() []string Statuses() []meta.StatusDefinition Errors() []meta.ErrorDefinition }
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 Construction ¶ added in v1.2.0
type Construction struct {
// contains filtered or unexported fields
}
Construction implements the Rosetta Construction API specification. See https://www.rosetta-api.org/docs/construction_api_introduction.html
func NewConstruction ¶ added in v1.2.0
func NewConstruction(config Configuration, transact Transactor, retrieve Retriever, validate Validator) *Construction
NewConstruction creates a new instance of the Construction API using the given configuration to handle transaction construction requests.
func (*Construction) Combine ¶ added in v1.2.0
func (c *Construction) Combine(ctx echo.Context) error
Combine implements the /construction/combine endpoint of the Rosetta Construction API. It creates a signed transaction by combining an unsigned transaction and a list of signatures. See https://www.rosetta-api.org/docs/ConstructionApi.html#constructioncombine
func (*Construction) Hash ¶ added in v1.2.0
func (c *Construction) Hash(ctx echo.Context) error
Hash implements the /construction/hash endpoint of the Rosetta Construction API. It returns the transaction ID of a signed transaction. See https://www.rosetta-api.org/docs/ConstructionApi.html#constructionhash
func (*Construction) Metadata ¶ added in v1.2.0
func (c *Construction) Metadata(ctx echo.Context) error
Metadata implements the /construction/metadata endpoint of the Rosetta Construction API. Metadata endpoint returns information required for constructing the transaction. For Flow, that information includes the reference block and sequence number. Reference block is the last indexed block, and is used to track transaction expiration. Sequence number is the proposer account's public key sequence number. Sequence number is incremented for each transaction and is used to prevent replay attacks. See https://www.rosetta-api.org/docs/ConstructionApi.html#constructionmetadata
func (*Construction) Parse ¶ added in v1.2.0
func (c *Construction) Parse(ctx echo.Context) error
Parse implements the /construction/parse endpoint of the Rosetta Construction API. Parse endpoint parses both signed and unsigned transactions to understand the transaction's intent. Endpoint returns the list of operations, any relevant metadata, and, in the case of signed transaction, the list of signers. See https://www.rosetta-api.org/docs/ConstructionApi.html#constructionparse
func (*Construction) Payloads ¶ added in v1.2.0
func (c *Construction) Payloads(ctx echo.Context) error
Payloads implements the /construction/payloads endpoint of the Rosetta Construction API. It receives an array of operations and all other relevant information required to construct an unsigned transaction. Operations must deterministically describe the intent of the transaction. Besides the unsigned transaction text, this endpoint also returns the list of payloads that should be signed. See https://www.rosetta-api.org/docs/ConstructionApi.html#constructionpayloads
func (*Construction) Preprocess ¶ added in v1.2.0
func (c *Construction) Preprocess(ctx echo.Context) error
Preprocess implements the /construction/preprocess endpoint of the Rosetta Construction API. Preprocess receives a list of operations that should deterministically specify the intent of the transaction. Preprocess endpoint returns the `options` object that will be sent **unmodified** to /construction/metadata, effectively creating the metadata request. See https://www.rosetta-api.org/docs/ConstructionApi.html#constructionpreprocess
func (*Construction) Submit ¶ added in v1.2.0
func (c *Construction) Submit(ctx echo.Context) error
Submit implements the /construction/submit endpoint of the Rosetta Construction API. Submit endpoint receives the fully constructed, signed transaction and submits it for execution to the Flow network using the SendTransaction API call of the Flow Access API. See https://www.rosetta-api.org/docs/ConstructionApi.html#constructionsubmit
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, validate Validator) *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 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) Sequence(rosBlockID identifier.Block, rosAccountID identifier.Account, index int) (uint64, error) }
type Transactor ¶ added in v1.2.0
type Transactor interface { DeriveIntent(operations []object.Operation) (intent *transactor.Intent, err error) CompileTransaction(refBlockID identifier.Block, intent *transactor.Intent, sequence uint64) (unsigned string, err error) HashPayload(rosBlockID identifier.Block, unsigned string, signer identifier.Account) (algo string, hash string, err error) Parse(payload string) (transactor.Parser, error) AttachSignatures(unsigned string, signatures []object.Signature) (signed string, err error) TransactionIdentifier(signed string) (rosTxID identifier.Transaction, err error) SubmitTransaction(signed string) (rosTxID identifier.Transaction, err error) }
Transactor is used by the Rosetta Construction API to handle transaction related operations.