api

package
v0.0.0-...-bde4beb Latest Latest
Warning

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

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

Documentation

Overview

Package api provides a client for Rosetta API servers.

Index

Constants

This section is empty.

Variables

View Source
var HTTPClient = &http.Client{
	Timeout: 30 * time.Second,
}

HTTPClient represents the global HTTP Client used to make all API calls. If necessary, callers should replace this global variable with their own HTTP Client before making any API calls.

Functions

func EncodeNetworkForJSON

func EncodeNetworkForJSON(n NetworkIdentifier) []byte

EncodeNetworkForJSON will create a reusable encoding of the given NetworkIdentifier for use in EncodeJSON calls.

func InNetworkList

func InNetworkList(xs []NetworkIdentifier, n NetworkIdentifier) bool

InNetworkList returns whether the given NetworkIdentifier exists in the given list of NetworkIdentifiers.

Types

type AccountBalanceRequest

type AccountBalanceRequest struct {
	AccountIdentifier AccountIdentifier
	BlockIdentifier   OptionalPartialBlockIdentifierType
	// In some cases, the caller may not want to retrieve all available balances
	// for an AccountIdentifier. If the currencies field is populated, only
	// balances for the specified currencies will be returned. If not populated,
	// all available balances will be returned.
	Currencies []Currency
}

AccountBalanceRequest type.

An AccountBalanceRequest is utilized to make a balance request on the /account/balance endpoint. If the block_identifier is populated, a historical balance query should be performed.

func (AccountBalanceRequest) EncodeJSON

func (v AccountBalanceRequest) EncodeJSON(b []byte, network []byte) []byte

EncodeJSON encodes AccountBalanceRequest into JSON.

func (AccountBalanceRequest) Equal

Equal returns whether two AccountBalanceRequest values are equal.

func (*AccountBalanceRequest) Reset

func (v *AccountBalanceRequest) Reset()

Reset resets AccountBalanceRequest so that it can be reused.

type AccountBalanceResponse

type AccountBalanceResponse struct {
	// A single account may have a balance in multiple currencies.
	Balances        []Amount
	BlockIdentifier BlockIdentifier
	// Account-based blockchains that utilize a nonce or sequence number should
	// include that number in the metadata. This number could be unique to the
	// identifier or global across the account address.
	Metadata MapObject
}

AccountBalanceResponse type.

An AccountBalanceResponse is returned on the /account/balance endpoint. If an account has a balance for each AccountIdentifier describing it (ex: an ERC-20 token balance on a few smart contracts), an account balance request must be made with each AccountIdentifier.

The `coins` field was removed and replaced by by `/account/coins` in `v1.4.7`.

func (AccountBalanceResponse) EncodeJSON

func (v AccountBalanceResponse) EncodeJSON(b []byte) []byte

EncodeJSON encodes AccountBalanceResponse into JSON.

func (AccountBalanceResponse) Equal

Equal returns whether two AccountBalanceResponse values are equal.

func (*AccountBalanceResponse) Reset

func (v *AccountBalanceResponse) Reset()

Reset resets AccountBalanceResponse so that it can be reused.

type AccountCoinsRequest

type AccountCoinsRequest struct {
	AccountIdentifier AccountIdentifier
	// In some cases, the caller may not want to retrieve coins for all
	// currencies for an AccountIdentifier. If the currencies field is
	// populated, only coins for the specified currencies will be returned. If
	// not populated, all unspent coins will be returned.
	Currencies []Currency
	// Include state from the mempool when looking up an account's unspent
	// coins. Note, using this functionality breaks any guarantee of
	// idempotency.
	IncludeMempool bool
}

AccountCoinsRequest is utilized to make a request on the /account/coins endpoint.

func (AccountCoinsRequest) EncodeJSON

func (v AccountCoinsRequest) EncodeJSON(b []byte, network []byte) []byte

EncodeJSON encodes AccountCoinsRequest into JSON.

func (AccountCoinsRequest) Equal

Equal returns whether two AccountCoinsRequest values are equal.

func (*AccountCoinsRequest) Reset

func (v *AccountCoinsRequest) Reset()

Reset resets AccountCoinsRequest so that it can be reused.

type AccountCoinsResponse

type AccountCoinsResponse struct {
	BlockIdentifier BlockIdentifier
	// If a blockchain is UTXO-based, all unspent Coins owned by an
	// account_identifier should be returned alongside the balance. It is highly
	// recommended to populate this field so that users of the Rosetta API
	// implementation don't need to maintain their own indexer to track their
	// UTXOs.
	Coins []Coin
	// Account-based blockchains that utilize a nonce or sequence number should
	// include that number in the metadata. This number could be unique to the
	// identifier or global across the account address.
	Metadata MapObject
}

AccountCoinsResponse is returned on the /account/coins endpoint and includes all unspent Coins owned by an AccountIdentifier.

func (AccountCoinsResponse) EncodeJSON

func (v AccountCoinsResponse) EncodeJSON(b []byte) []byte

EncodeJSON encodes AccountCoinsResponse into JSON.

func (AccountCoinsResponse) Equal

Equal returns whether two AccountCoinsResponse values are equal.

func (*AccountCoinsResponse) Reset

func (v *AccountCoinsResponse) Reset()

Reset resets AccountCoinsResponse so that it can be reused.

type AccountIdentifier

type AccountIdentifier struct {
	// The address may be a cryptographic public key (or some encoding of it) or
	// a provided username.
	Address string
	// Blockchains that utilize a username model (where the address is not a
	// derivative of a cryptographic public key) should specify the public
	// key(s) owned by the address in metadata.
	Metadata   MapObject
	SubAccount OptionalSubAccountIdentifierType
}

AccountIdentifier type.

The account_identifier uniquely identifies an account within a network. All fields in the account_identifier are utilized to determine this uniqueness (including the metadata field, if populated).

func (AccountIdentifier) EncodeJSON

func (v AccountIdentifier) EncodeJSON(b []byte) []byte

EncodeJSON encodes AccountIdentifier into JSON.

func (AccountIdentifier) Equal

Equal returns whether two AccountIdentifier values are equal.

func (*AccountIdentifier) Reset

func (v *AccountIdentifier) Reset()

Reset resets AccountIdentifier so that it can be reused.

type Allow

type Allow struct {
	// BalanceExemptions is an array of BalanceExemption indicating which
	// account balances could change without a corresponding Operation.
	//
	// BalanceExemptions should be used sparingly as they may introduce
	// significant complexity for integrators that attempt to reconcile all
	// account balance changes.
	//
	// If your implementation relies on any BalanceExemptions, you MUST
	// implement historical balance lookup (the ability to query an account
	// balance at any BlockIdentifier).
	BalanceExemptions []BalanceExemption
	// All methods that are supported by the /call endpoint. Communicating which
	// parameters should be provided to /call is the responsibility of the
	// implementer (this is en lieu of defining an entire type system and
	// requiring the implementer to define that in Allow).
	CallMethods []string
	// All Errors that this implementation could return. Any error that is
	// returned during parsing that is not listed here will cause client
	// validation to error.
	Errors []Error
	// Any Rosetta implementation that supports querying the balance of an
	// account at any height in the past should set this to true.
	HistoricalBalanceLookup bool
	// Any Rosetta implementation that can update an AccountIdentifier's unspent
	// coins based on the contents of the mempool should populate this field as
	// true. If false, requests to `/account/coins` that set `include_mempool`
	// as true will be automatically rejected.
	MempoolCoins bool
	// All Operation.Status this implementation supports. Any status that is
	// returned during parsing that is not listed here will cause client
	// validation to error.
	OperationStatuses []OperationStatus
	// All Operation.Type this implementation supports. Any type that is
	// returned during parsing that is not listed here will cause client
	// validation to error.
	OperationTypes []string
	// If populated, `timestamp_start_index` indicates the first block index
	// where block timestamps are considered valid (i.e. all blocks less than
	// `timestamp_start_index` could have invalid timestamps). This is useful
	// when the genesis block (or blocks) of a network have timestamp 0.
	//
	// If not populated, block timestamps are assumed to be valid for all
	// available blocks.
	TimestampStartIndex OptionalInt64Type
}

Allow specifies supported Operation status, Operation types, and all possible error statuses. This Allow object is used by clients to validate the correctness of a Rosetta Server implementation. It is expected that these clients will error if they receive some response that contains any of the above information that is not specified here.

func (Allow) EncodeJSON

func (v Allow) EncodeJSON(b []byte) []byte

EncodeJSON encodes Allow into JSON.

func (Allow) Equal

func (v Allow) Equal(o Allow) bool

Equal returns whether two Allow values are equal.

func (*Allow) Reset

func (v *Allow) Reset()

Reset resets Allow so that it can be reused.

type Amount

type Amount struct {
	Currency Currency
	Metadata MapObject
	// Value of the transaction in atomic units represented as an
	// arbitrary-sized signed integer.
	//
	// For example, 1 BTC would be represented by a value of 100000000.
	Value string
}

Amount is some Value of a Currency. It is considered invalid to specify a Value without a Currency.

func (Amount) EncodeJSON

func (v Amount) EncodeJSON(b []byte) []byte

EncodeJSON encodes Amount into JSON.

func (Amount) Equal

func (v Amount) Equal(o Amount) bool

Equal returns whether two Amount values are equal.

func (*Amount) Reset

func (v *Amount) Reset()

Reset resets Amount so that it can be reused.

type BalanceExemption

type BalanceExemption struct {
	Currency      OptionalCurrencyType
	ExemptionType OptionalExemptionTypeType
	// SubAccountAddress is the SubAccountIdentifier.Address that the
	// BalanceExemption applies to (regardless of the value of
	// SubAccountIdentifier.Metadata).
	SubAccountAddress OptionalStringType
}

BalanceExemption indicates that the balance for an exempt account could change without a corresponding Operation. This typically occurs with staking rewards, vesting balances, and Currencies with a dynamic supply.

Currently, it is possible to exempt an account from strict reconciliation by SubAccountIdentifier.Address or by Currency. This means that any account with SubAccountIdentifier.Address would be exempt or any balance of a particular Currency would be exempt, respectively.

BalanceExemptions should be used sparingly as they may introduce significant complexity for integrators that attempt to reconcile all account balance changes.

If your implementation relies on any BalanceExemptions, you MUST implement historical balance lookup (the ability to query an account balance at any BlockIdentifier).

func (BalanceExemption) EncodeJSON

func (v BalanceExemption) EncodeJSON(b []byte) []byte

EncodeJSON encodes BalanceExemption into JSON.

func (BalanceExemption) Equal

Equal returns whether two BalanceExemption values are equal.

func (*BalanceExemption) Reset

func (v *BalanceExemption) Reset()

Reset resets BalanceExemption so that it can be reused.

type Block

type Block struct {
	BlockIdentifier       BlockIdentifier
	Metadata              MapObject
	ParentBlockIdentifier BlockIdentifier
	Timestamp             Timestamp
	Transactions          []Transaction
}

Block type.

Blocks contain an array of Transactions that occurred at a particular BlockIdentifier.

A hard requirement for blocks returned by Rosetta implementations is that they MUST be _inalterable_: once a client has requested and received a block identified by a specific BlockIndentifier, all future calls for that same BlockIdentifier must return the same block contents.

func (Block) EncodeJSON

func (v Block) EncodeJSON(b []byte) []byte

EncodeJSON encodes Block into JSON.

func (Block) Equal

func (v Block) Equal(o Block) bool

Equal returns whether two Block values are equal.

func (*Block) Reset

func (v *Block) Reset()

Reset resets Block so that it can be reused.

type BlockEvent

type BlockEvent struct {
	BlockIdentifier BlockIdentifier
	// sequence is the unique identifier of a BlockEvent within the context of a
	// NetworkIdentifier.
	Sequence int64
	Type     BlockEventType
}

BlockEvent represents the addition or removal of a BlockIdentifier from storage. Streaming BlockEvents allows lightweight clients to update their own state without needing to implement their own syncing logic.

func (BlockEvent) EncodeJSON

func (v BlockEvent) EncodeJSON(b []byte) []byte

EncodeJSON encodes BlockEvent into JSON.

func (BlockEvent) Equal

func (v BlockEvent) Equal(o BlockEvent) bool

Equal returns whether two BlockEvent values are equal.

func (*BlockEvent) Reset

func (v *BlockEvent) Reset()

Reset resets BlockEvent so that it can be reused.

type BlockEventType

type BlockEventType string

BlockEventType determines if a BlockEvent represents the addition or removal of a block.

const (
	BlockAdded   BlockEventType = "block_added"
	BlockRemoved BlockEventType = "block_removed"
)

BlockEventType values.

func (BlockEventType) Validate

func (v BlockEventType) Validate() error

Validate the BlockEventType value.

type BlockIdentifier

type BlockIdentifier struct {
	Hash string
	// This is also known as the block height.
	Index int64
}

BlockIdentifier type.

The block_identifier uniquely identifies a block in a particular network.

func (BlockIdentifier) EncodeJSON

func (v BlockIdentifier) EncodeJSON(b []byte) []byte

EncodeJSON encodes BlockIdentifier into JSON.

func (BlockIdentifier) Equal

Equal returns whether two BlockIdentifier values are equal.

func (*BlockIdentifier) Reset

func (v *BlockIdentifier) Reset()

Reset resets BlockIdentifier so that it can be reused.

type BlockRequest

type BlockRequest struct {
	BlockIdentifier PartialBlockIdentifier
}

BlockRequest type.

A BlockRequest is utilized to make a block request on the /block endpoint.

func (BlockRequest) EncodeJSON

func (v BlockRequest) EncodeJSON(b []byte, network []byte) []byte

EncodeJSON encodes BlockRequest into JSON.

func (BlockRequest) Equal

func (v BlockRequest) Equal(o BlockRequest) bool

Equal returns whether two BlockRequest values are equal.

func (*BlockRequest) Reset

func (v *BlockRequest) Reset()

Reset resets BlockRequest so that it can be reused.

type BlockResponse

type BlockResponse struct {
	Block OptionalBlockType
	// Some blockchains may require additional transactions to be fetched that
	// weren't returned in the block response (ex: block only returns
	// transaction hashes). For blockchains with a lot of transactions in each
	// block, this can be very useful as consumers can concurrently fetch all
	// transactions returned.
	OtherTransactions []TransactionIdentifier
}

BlockResponse type.

A BlockResponse includes a fully-populated block or a partially-populated block with a list of other transactions to fetch (other_transactions).

As a result of the consensus algorithm of some blockchains, blocks can be omitted (i.e. certain block indices can be skipped). If a query for one of these omitted indices is made, the response should not include a `Block` object.

It is VERY important to note that blocks MUST still form a canonical, connected chain of blocks where each block has a unique index. In other words, the `PartialBlockIdentifier` of a block after an omitted block should reference the last non-omitted block.

func (BlockResponse) EncodeJSON

func (v BlockResponse) EncodeJSON(b []byte) []byte

EncodeJSON encodes BlockResponse into JSON.

func (BlockResponse) Equal

func (v BlockResponse) Equal(o BlockResponse) bool

Equal returns whether two BlockResponse values are equal.

func (*BlockResponse) Reset

func (v *BlockResponse) Reset()

Reset resets BlockResponse so that it can be reused.

type BlockTransaction

type BlockTransaction struct {
	BlockIdentifier BlockIdentifier
	Transaction     Transaction
}

BlockTransaction contains a populated Transaction and the BlockIdentifier that contains it.

func (BlockTransaction) EncodeJSON

func (v BlockTransaction) EncodeJSON(b []byte) []byte

EncodeJSON encodes BlockTransaction into JSON.

func (BlockTransaction) Equal

Equal returns whether two BlockTransaction values are equal.

func (*BlockTransaction) Reset

func (v *BlockTransaction) Reset()

Reset resets BlockTransaction so that it can be reused.

type BlockTransactionRequest

type BlockTransactionRequest struct {
	BlockIdentifier       BlockIdentifier
	TransactionIdentifier TransactionIdentifier
}

BlockTransactionRequest type.

A BlockTransactionRequest is used to fetch a Transaction included in a block that is not returned in a BlockResponse.

func (BlockTransactionRequest) EncodeJSON

func (v BlockTransactionRequest) EncodeJSON(b []byte, network []byte) []byte

EncodeJSON encodes BlockTransactionRequest into JSON.

func (BlockTransactionRequest) Equal

Equal returns whether two BlockTransactionRequest values are equal.

func (*BlockTransactionRequest) Reset

func (v *BlockTransactionRequest) Reset()

Reset resets BlockTransactionRequest so that it can be reused.

type BlockTransactionResponse

type BlockTransactionResponse struct {
	Transaction Transaction
}

BlockTransactionResponse type.

A BlockTransactionResponse contains information about a block transaction.

func (BlockTransactionResponse) EncodeJSON

func (v BlockTransactionResponse) EncodeJSON(b []byte) []byte

EncodeJSON encodes BlockTransactionResponse into JSON.

func (BlockTransactionResponse) Equal

Equal returns whether two BlockTransactionResponse values are equal.

func (*BlockTransactionResponse) Reset

func (v *BlockTransactionResponse) Reset()

Reset resets BlockTransactionResponse so that it can be reused.

type CallRequest

type CallRequest struct {
	// Method is some network-specific procedure call. This method could map to
	// a network-specific RPC endpoint, a method in an SDK generated from a
	// smart contract, or some hybrid of the two.
	//
	// The implementation must define all available methods in the Allow object.
	// However, it is up to the caller to determine which parameters to provide
	// when invoking `/call`.
	Method string
	// Parameters is some network-specific argument for a method. It is up to
	// the caller to determine which parameters to provide when invoking
	// `/call`.
	Parameters MapObject
}

CallRequest is the input to the `/call` endpoint.

func (CallRequest) EncodeJSON

func (v CallRequest) EncodeJSON(b []byte, network []byte) []byte

EncodeJSON encodes CallRequest into JSON.

func (CallRequest) Equal

func (v CallRequest) Equal(o CallRequest) bool

Equal returns whether two CallRequest values are equal.

func (*CallRequest) Reset

func (v *CallRequest) Reset()

Reset resets CallRequest so that it can be reused.

type CallResponse

type CallResponse struct {
	// Idempotent indicates that if `/call` is invoked with the same CallRequest
	// again, at any point in time, it will return the same CallResponse.
	//
	// Integrators may cache the CallResponse if this is set to true to avoid
	// making unnecessary calls to the Rosetta implementation. For this reason,
	// implementers should be very conservative about returning true here or
	// they could cause issues for the caller.
	Idempotent bool
	// Result contains the result of the `/call` invocation. This result will
	// not be inspected or interpreted by Rosetta tooling and is left to the
	// caller to decode.
	Result MapObject
}

CallResponse contains the result of a `/call` invocation.

func (CallResponse) EncodeJSON

func (v CallResponse) EncodeJSON(b []byte) []byte

EncodeJSON encodes CallResponse into JSON.

func (CallResponse) Equal

func (v CallResponse) Equal(o CallResponse) bool

Equal returns whether two CallResponse values are equal.

func (*CallResponse) Reset

func (v *CallResponse) Reset()

Reset resets CallResponse so that it can be reused.

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client handles requests to Rosetta API servers. A Client can only be used to do one API call at a time. That is, do not reuse a Client while a previous call is still being handled.

When making Client API calls, the `resp` value will be automatically Reset before the response JSON is decoded, so it can be reused across multiple Client API calls.

func NewClient

func NewClient(baseURL string) *Client

NewClient instantiates a new Client.

func (*Client) SetNetwork

func (c *Client) SetNetwork(n NetworkIdentifier)

type ClientError

type ClientError struct {
	// CallError indicates network and decoding related errors.
	CallError error
	// RosettaError indicates the Error value sent by the Rosetta API server.
	RosettaError Error
}

ClientError represents the error encountered when making a Client API call. Only one of the CallError or RosettaError fields will be set.

ClientError values must not be retained across Client API calls, as it will be reset and reused by the Client in future calls.

func (ClientError) Error

func (c ClientError) Error() string

Error implements the error interface.

func (ClientError) Retriable

func (c ClientError) Retriable() bool

Retriable indicates whether the error is potentially retriable.

type Coin

type Coin struct {
	Amount         Amount
	CoinIdentifier CoinIdentifier
}

Coin contains its unique identifier and the amount it represents.

func (Coin) EncodeJSON

func (v Coin) EncodeJSON(b []byte) []byte

EncodeJSON encodes Coin into JSON.

func (Coin) Equal

func (v Coin) Equal(o Coin) bool

Equal returns whether two Coin values are equal.

func (*Coin) Reset

func (v *Coin) Reset()

Reset resets Coin so that it can be reused.

type CoinAction

type CoinAction string

CoinAction type.

CoinActions are different state changes that a Coin can undergo. When a Coin is created, it is coin_created. When a Coin is spent, it is coin_spent. It is assumed that a single Coin cannot be created or spent more than once.

const (
	CoinCreated CoinAction = "coin_created"
	CoinSpent   CoinAction = "coin_spent"
)

CoinAction values.

func (CoinAction) Validate

func (v CoinAction) Validate() error

Validate the CoinAction value.

type CoinChange

type CoinChange struct {
	CoinAction     CoinAction
	CoinIdentifier CoinIdentifier
}

CoinChange is used to represent a change in state of a some coin identified by a coin_identifier. This object is part of the Operation model and must be populated for UTXO-based blockchains.

Coincidentally, this abstraction of UTXOs allows for supporting both account-based transfers and UTXO-based transfers on the same blockchain (when a transfer is account-based, don't populate this model).

func (CoinChange) EncodeJSON

func (v CoinChange) EncodeJSON(b []byte) []byte

EncodeJSON encodes CoinChange into JSON.

func (CoinChange) Equal

func (v CoinChange) Equal(o CoinChange) bool

Equal returns whether two CoinChange values are equal.

func (*CoinChange) Reset

func (v *CoinChange) Reset()

Reset resets CoinChange so that it can be reused.

type CoinIdentifier

type CoinIdentifier struct {
	// Identifier should be populated with a globally unique identifier of a
	// Coin. In Bitcoin, this identifier would be transaction_hash:index.
	Identifier string
}

CoinIdentifier uniquely identifies a Coin.

func (CoinIdentifier) EncodeJSON

func (v CoinIdentifier) EncodeJSON(b []byte) []byte

EncodeJSON encodes CoinIdentifier into JSON.

func (CoinIdentifier) Equal

func (v CoinIdentifier) Equal(o CoinIdentifier) bool

Equal returns whether two CoinIdentifier values are equal.

func (*CoinIdentifier) Reset

func (v *CoinIdentifier) Reset()

Reset resets CoinIdentifier so that it can be reused.

type ConstructionCombineRequest

type ConstructionCombineRequest struct {
	Signatures          []Signature
	UnsignedTransaction string
}

ConstructionCombineRequest is the input to the `/construction/combine` endpoint. It contains the unsigned transaction blob returned by `/construction/payloads` and all required signatures to create a network transaction.

func (ConstructionCombineRequest) EncodeJSON

func (v ConstructionCombineRequest) EncodeJSON(b []byte, network []byte) []byte

EncodeJSON encodes ConstructionCombineRequest into JSON.

func (ConstructionCombineRequest) Equal

Equal returns whether two ConstructionCombineRequest values are equal.

func (*ConstructionCombineRequest) Reset

func (v *ConstructionCombineRequest) Reset()

Reset resets ConstructionCombineRequest so that it can be reused.

type ConstructionCombineResponse

type ConstructionCombineResponse struct {
	SignedTransaction string
}

ConstructionCombineResponse is returned by `/construction/combine`. The network payload will be sent directly to the `construction/submit` endpoint.

func (ConstructionCombineResponse) EncodeJSON

func (v ConstructionCombineResponse) EncodeJSON(b []byte) []byte

EncodeJSON encodes ConstructionCombineResponse into JSON.

func (ConstructionCombineResponse) Equal

Equal returns whether two ConstructionCombineResponse values are equal.

func (*ConstructionCombineResponse) Reset

func (v *ConstructionCombineResponse) Reset()

Reset resets ConstructionCombineResponse so that it can be reused.

type ConstructionDeriveRequest

type ConstructionDeriveRequest struct {
	Metadata  MapObject
	PublicKey PublicKey
}

ConstructionDeriveRequest is passed to the `/construction/derive` endpoint. Network is provided in the request because some blockchains have different address formats for different networks. Metadata is provided in the request because some blockchains allow for multiple address types (i.e. different address for validators vs normal accounts).

func (ConstructionDeriveRequest) EncodeJSON

func (v ConstructionDeriveRequest) EncodeJSON(b []byte, network []byte) []byte

EncodeJSON encodes ConstructionDeriveRequest into JSON.

func (ConstructionDeriveRequest) Equal

Equal returns whether two ConstructionDeriveRequest values are equal.

func (*ConstructionDeriveRequest) Reset

func (v *ConstructionDeriveRequest) Reset()

Reset resets ConstructionDeriveRequest so that it can be reused.

type ConstructionDeriveResponse

type ConstructionDeriveResponse struct {
	AccountIdentifier OptionalAccountIdentifierType
	// [DEPRECATED by `account_identifier` in `v1.4.4`] Address in
	// network-specific format.
	Address  OptionalStringType
	Metadata MapObject
}

ConstructionDeriveResponse is returned by the `/construction/derive` endpoint.

func (ConstructionDeriveResponse) EncodeJSON

func (v ConstructionDeriveResponse) EncodeJSON(b []byte) []byte

EncodeJSON encodes ConstructionDeriveResponse into JSON.

func (ConstructionDeriveResponse) Equal

Equal returns whether two ConstructionDeriveResponse values are equal.

func (*ConstructionDeriveResponse) Reset

func (v *ConstructionDeriveResponse) Reset()

Reset resets ConstructionDeriveResponse so that it can be reused.

type ConstructionHashRequest

type ConstructionHashRequest struct {
	SignedTransaction string
}

ConstructionHashRequest is the input to the `/construction/hash` endpoint.

func (ConstructionHashRequest) EncodeJSON

func (v ConstructionHashRequest) EncodeJSON(b []byte, network []byte) []byte

EncodeJSON encodes ConstructionHashRequest into JSON.

func (ConstructionHashRequest) Equal

Equal returns whether two ConstructionHashRequest values are equal.

func (*ConstructionHashRequest) Reset

func (v *ConstructionHashRequest) Reset()

Reset resets ConstructionHashRequest so that it can be reused.

type ConstructionMetadataRequest

type ConstructionMetadataRequest struct {
	// Some blockchains require different metadata for different types of
	// transaction construction (ex: delegation versus a transfer). Instead of
	// requiring a blockchain node to return all possible types of metadata for
	// construction (which may require multiple node fetches), the client can
	// populate an options object to limit the metadata returned to only the
	// subset required.
	Options    MapObject
	PublicKeys []PublicKey
}

ConstructionMetadataRequest type.

A ConstructionMetadataRequest is utilized to get information required to construct a transaction.

The Options object used to specify which metadata to return is left purposely unstructured to allow flexibility for implementers. Options is not required in the case that there is network-wide metadata of interest.

Optionally, the request can also include an array of PublicKeys associated with the AccountIdentifiers returned in ConstructionPreprocessResponse.

func (ConstructionMetadataRequest) EncodeJSON

func (v ConstructionMetadataRequest) EncodeJSON(b []byte, network []byte) []byte

EncodeJSON encodes ConstructionMetadataRequest into JSON.

func (ConstructionMetadataRequest) Equal

Equal returns whether two ConstructionMetadataRequest values are equal.

func (*ConstructionMetadataRequest) Reset

func (v *ConstructionMetadataRequest) Reset()

Reset resets ConstructionMetadataRequest so that it can be reused.

type ConstructionMetadataResponse

type ConstructionMetadataResponse struct {
	Metadata     MapObject
	SuggestedFee []Amount
}

ConstructionMetadataResponse type.

The ConstructionMetadataResponse returns network-specific metadata used for transaction construction.

Optionally, the implementer can return the suggested fee associated with the transaction being constructed. The caller may use this info to adjust the intent of the transaction or to create a transaction with a different account that can pay the suggested fee. Suggested fee is an array in case fee payment must occur in multiple currencies.

func (ConstructionMetadataResponse) EncodeJSON

func (v ConstructionMetadataResponse) EncodeJSON(b []byte) []byte

EncodeJSON encodes ConstructionMetadataResponse into JSON.

func (ConstructionMetadataResponse) Equal

Equal returns whether two ConstructionMetadataResponse values are equal.

func (*ConstructionMetadataResponse) Reset

func (v *ConstructionMetadataResponse) Reset()

Reset resets ConstructionMetadataResponse so that it can be reused.

type ConstructionParseRequest

type ConstructionParseRequest struct {
	// Signed is a boolean indicating whether the transaction is signed.
	Signed bool
	// This must be either the unsigned transaction blob returned by
	// `/construction/payloads` or the signed transaction blob returned by
	// `/construction/combine`.
	Transaction string
}

ConstructionParseRequest is the input to the `/construction/parse` endpoint. It allows the caller to parse either an unsigned or signed transaction.

func (ConstructionParseRequest) EncodeJSON

func (v ConstructionParseRequest) EncodeJSON(b []byte, network []byte) []byte

EncodeJSON encodes ConstructionParseRequest into JSON.

func (ConstructionParseRequest) Equal

Equal returns whether two ConstructionParseRequest values are equal.

func (*ConstructionParseRequest) Reset

func (v *ConstructionParseRequest) Reset()

Reset resets ConstructionParseRequest so that it can be reused.

type ConstructionParseResponse

type ConstructionParseResponse struct {
	AccountIdentifierSigners []AccountIdentifier
	Metadata                 MapObject
	Operations               []Operation
	// [DEPRECATED by `account_identifier_signers` in `v1.4.4`] All signers
	// (addresses) of a particular transaction. If the transaction is unsigned,
	// it should be empty.
	Signers []string
}

ConstructionParseResponse contains an array of operations that occur in a transaction blob. This should match the array of operations provided to `/construction/preprocess` and `/construction/payloads`.

func (ConstructionParseResponse) EncodeJSON

func (v ConstructionParseResponse) EncodeJSON(b []byte) []byte

EncodeJSON encodes ConstructionParseResponse into JSON.

func (ConstructionParseResponse) Equal

Equal returns whether two ConstructionParseResponse values are equal.

func (*ConstructionParseResponse) Reset

func (v *ConstructionParseResponse) Reset()

Reset resets ConstructionParseResponse so that it can be reused.

type ConstructionPayloadsRequest

type ConstructionPayloadsRequest struct {
	Metadata   MapObject
	Operations []Operation
	PublicKeys []PublicKey
}

ConstructionPayloadsRequest is the request to `/construction/payloads`. It contains the network, a slice of operations, and arbitrary metadata that was returned by the call to `/construction/metadata`.

Optionally, the request can also include an array of PublicKeys associated with the AccountIdentifiers returned in ConstructionPreprocessResponse.

func (ConstructionPayloadsRequest) EncodeJSON

func (v ConstructionPayloadsRequest) EncodeJSON(b []byte, network []byte) []byte

EncodeJSON encodes ConstructionPayloadsRequest into JSON.

func (ConstructionPayloadsRequest) Equal

Equal returns whether two ConstructionPayloadsRequest values are equal.

func (*ConstructionPayloadsRequest) Reset

func (v *ConstructionPayloadsRequest) Reset()

Reset resets ConstructionPayloadsRequest so that it can be reused.

type ConstructionPayloadsResponse

type ConstructionPayloadsResponse struct {
	Payloads            []SigningPayload
	UnsignedTransaction string
}

ConstructionPayloadsResponse type.

ConstructionTransactionResponse is returned by `/construction/payloads`. It contains an unsigned transaction blob (that is usually needed to construct the a network transaction from a collection of signatures) and an array of payloads that must be signed by the caller.

func (ConstructionPayloadsResponse) EncodeJSON

func (v ConstructionPayloadsResponse) EncodeJSON(b []byte) []byte

EncodeJSON encodes ConstructionPayloadsResponse into JSON.

func (ConstructionPayloadsResponse) Equal

Equal returns whether two ConstructionPayloadsResponse values are equal.

func (*ConstructionPayloadsResponse) Reset

func (v *ConstructionPayloadsResponse) Reset()

Reset resets ConstructionPayloadsResponse so that it can be reused.

type ConstructionPreprocessRequest

type ConstructionPreprocessRequest struct {
	MaxFee                 []Amount
	Metadata               MapObject
	Operations             []Operation
	SuggestedFeeMultiplier OptionalFloat64Type
}

ConstructionPreprocessRequest is passed to the `/construction/preprocess` endpoint so that a Rosetta implementation can determine which metadata it needs to request for construction.

Metadata provided in this object should NEVER be a product of live data (i.e. the caller must follow some network-specific data fetching strategy outside of the Construction API to populate required Metadata). If live data is required for construction, it MUST be fetched in the call to `/construction/metadata`.

The caller can provide a max fee they are willing to pay for a transaction. This is an array in the case fees must be paid in multiple currencies.

The caller can also provide a suggested fee multiplier to indicate that the suggested fee should be scaled. This may be used to set higher fees for urgent transactions or to pay lower fees when there is less urgency. It is assumed that providing a very low multiplier (like 0.0001) will never lead to a transaction being created with a fee less than the minimum network fee (if applicable).

In the case that the caller provides both a max fee and a suggested fee multiplier, the max fee will set an upper bound on the suggested fee (regardless of the multiplier provided).

func (ConstructionPreprocessRequest) EncodeJSON

func (v ConstructionPreprocessRequest) EncodeJSON(b []byte, network []byte) []byte

EncodeJSON encodes ConstructionPreprocessRequest into JSON.

func (ConstructionPreprocessRequest) Equal

Equal returns whether two ConstructionPreprocessRequest values are equal.

func (*ConstructionPreprocessRequest) Reset

func (v *ConstructionPreprocessRequest) Reset()

Reset resets ConstructionPreprocessRequest so that it can be reused.

type ConstructionPreprocessResponse

type ConstructionPreprocessResponse struct {
	// The options that will be sent directly to `/construction/metadata` by the
	// caller.
	Options            MapObject
	RequiredPublicKeys []AccountIdentifier
}

ConstructionPreprocessResponse contains `options` that will be sent unmodified to `/construction/metadata`. If it is not necessary to make a request to `/construction/metadata`, `options` should be omitted.

Some blockchains require the PublicKey of particular AccountIdentifiers to construct a valid transaction. To fetch these PublicKeys, populate `required_public_keys` with the AccountIdentifiers associated with the desired PublicKeys. If it is not necessary to retrieve any PublicKeys for construction, `required_public_keys` should be omitted.

func (ConstructionPreprocessResponse) EncodeJSON

func (v ConstructionPreprocessResponse) EncodeJSON(b []byte) []byte

EncodeJSON encodes ConstructionPreprocessResponse into JSON.

func (ConstructionPreprocessResponse) Equal

Equal returns whether two ConstructionPreprocessResponse values are equal.

func (*ConstructionPreprocessResponse) Reset

func (v *ConstructionPreprocessResponse) Reset()

Reset resets ConstructionPreprocessResponse so that it can be reused.

type ConstructionSubmitRequest

type ConstructionSubmitRequest struct {
	SignedTransaction string
}

ConstructionSubmitRequest type.

The transaction submission request includes a signed transaction.

func (ConstructionSubmitRequest) EncodeJSON

func (v ConstructionSubmitRequest) EncodeJSON(b []byte, network []byte) []byte

EncodeJSON encodes ConstructionSubmitRequest into JSON.

func (ConstructionSubmitRequest) Equal

Equal returns whether two ConstructionSubmitRequest values are equal.

func (*ConstructionSubmitRequest) Reset

func (v *ConstructionSubmitRequest) Reset()

Reset resets ConstructionSubmitRequest so that it can be reused.

type Currency

type Currency struct {
	// Number of decimal places in the standard unit representation of the
	// amount.
	//
	// For example, BTC has 8 decimals. Note that it is not possible to
	// represent the value of some currency in atomic units that is not base 10.
	Decimals int32
	// Any additional information related to the currency itself.
	//
	// For example, it would be useful to populate this object with the contract
	// address of an ERC-20 token.
	Metadata MapObject
	// Canonical symbol associated with a currency.
	Symbol string
}

Currency is composed of a canonical Symbol and Decimals. This Decimals value is used to convert an Amount.Value from atomic units (Satoshis) to standard units (Bitcoins).

func (Currency) EncodeJSON

func (v Currency) EncodeJSON(b []byte) []byte

EncodeJSON encodes Currency into JSON.

func (Currency) Equal

func (v Currency) Equal(o Currency) bool

Equal returns whether two Currency values are equal.

func (*Currency) Reset

func (v *Currency) Reset()

Reset resets Currency so that it can be reused.

type CurveType

type CurveType string

CurveType is the type of cryptographic curve associated with a PublicKey.

* secp256k1: SEC compressed - `33 bytes` (https://secg.org/sec1-v2.pdf#subsubsection.2.3.3) * secp256r1: SEC compressed - `33 bytes` (https://secg.org/sec1-v2.pdf#subsubsection.2.3.3) * edwards25519: `y (255-bits) || x-sign-bit (1-bit)` - `32 bytes` (https://ed25519.cr.yp.to/ed25519-20110926.pdf) * tweedle: 1st pk : Fq.t (32 bytes) || 2nd pk : Fq.t (32 bytes) (https://github.com/CodaProtocol/coda/blob/develop/rfcs/0038-rosetta-construction-api.md#marshal-keys)

const (
	Edwards25519 CurveType = "edwards25519"
	Secp256k1    CurveType = "secp256k1"
	Secp256r1    CurveType = "secp256r1"
	Tweedle      CurveType = "tweedle"
)

CurveType values.

func (CurveType) Validate

func (v CurveType) Validate() error

Validate the CurveType value.

type Direction

type Direction string

Direction type.

Used by RelatedTransaction to indicate the direction of the relation (i.e. cross-shard/cross-network sends may reference `backward` to an earlier transaction and async execution may reference `forward`). Can be used to indicate if a transaction relation is from child to parent or the reverse.

const (
	Backward Direction = "backward"
	Forward  Direction = "forward"
)

Direction values.

func (Direction) Validate

func (v Direction) Validate() error

Validate the Direction value.

type Error

type Error struct {
	// Code is a network-specific error code. If desired, this code can be
	// equivalent to an HTTP status code.
	Code int32
	// Description allows the implementer to optionally provide additional
	// information about an error. In many cases, the content of this field will
	// be a copy-and-paste from existing developer documentation.
	//
	// Description can ONLY be populated with generic information about a
	// particular type of error. It MUST NOT be populated with information about
	// a particular instantiation of an error (use `details` for this).
	//
	// Whereas the content of Error.Message should stay stable across releases,
	// the content of Error.Description will likely change across releases (as
	// implementers improve error documentation). For this reason, the content
	// in this field is not part of any type assertion (unlike Error.Message).
	Description OptionalStringType
	// Often times it is useful to return context specific to the request that
	// caused the error (i.e. a sample of the stack trace or impacted account)
	// in addition to the standard error message.
	Details MapObject
	// Message is a network-specific error message.
	//
	// The message MUST NOT change for a given code. In particular, this means
	// that any contextual information should be included in the details field.
	Message string
	// An error is retriable if the same request may succeed if submitted again.
	Retriable bool
}

Error type.

Instead of utilizing HTTP status codes to describe node errors (which often do not have a good analog), rich errors are returned using this object.

Both the code and message fields can be individually used to correctly identify an error. Implementations MUST use unique values for both fields.

func (Error) EncodeJSON

func (v Error) EncodeJSON(b []byte) []byte

EncodeJSON encodes Error into JSON.

func (Error) Equal

func (v Error) Equal(o Error) bool

Equal returns whether two Error values are equal.

func (*Error) Reset

func (v *Error) Reset()

Reset resets Error so that it can be reused.

type EventsBlocksRequest

type EventsBlocksRequest struct {
	// limit is the maximum number of events to fetch in one call. The
	// implementation may return <= limit events.
	Limit OptionalInt64Type
	// offset is the offset into the event stream to sync events from. If this
	// field is not populated, we return the limit events backwards from tip. If
	// this is set to 0, we start from the beginning.
	Offset OptionalInt64Type
}

EventsBlocksRequest is utilized to fetch a sequence of BlockEvents indicating which blocks were added and removed from storage to reach the current state.

func (EventsBlocksRequest) EncodeJSON

func (v EventsBlocksRequest) EncodeJSON(b []byte, network []byte) []byte

EncodeJSON encodes EventsBlocksRequest into JSON.

func (EventsBlocksRequest) Equal

Equal returns whether two EventsBlocksRequest values are equal.

func (*EventsBlocksRequest) Reset

func (v *EventsBlocksRequest) Reset()

Reset resets EventsBlocksRequest so that it can be reused.

type EventsBlocksResponse

type EventsBlocksResponse struct {
	// events is an array of BlockEvents indicating the order to add and remove
	// blocks to maintain a canonical view of blockchain state. Lightweight
	// clients can use this event stream to update state without implementing
	// their own block syncing logic.
	Events []BlockEvent
	// max_sequence is the maximum available sequence number to fetch.
	MaxSequence int64
}

EventsBlocksResponse contains an ordered collection of BlockEvents and the max retrievable sequence.

func (EventsBlocksResponse) EncodeJSON

func (v EventsBlocksResponse) EncodeJSON(b []byte) []byte

EncodeJSON encodes EventsBlocksResponse into JSON.

func (EventsBlocksResponse) Equal

Equal returns whether two EventsBlocksResponse values are equal.

func (*EventsBlocksResponse) Reset

func (v *EventsBlocksResponse) Reset()

Reset resets EventsBlocksResponse so that it can be reused.

type ExemptionType

type ExemptionType string

ExemptionType is used to indicate if the live balance for an account subject to a BalanceExemption could increase above, decrease below, or equal the computed balance.

* greater_or_equal: The live balance may increase above or equal the computed balance. This typically occurs with staking rewards that accrue on each block. * less_or_equal: The live balance may decrease below or equal the computed balance. This typically occurs as balance moves from locked to spendable on a vesting account. * dynamic: The live balance may increase above, decrease below, or equal the computed balance. This typically occurs with tokens that have a dynamic supply.

const (
	Dynamic        ExemptionType = "dynamic"
	GreaterOrEqual ExemptionType = "greater_or_equal"
	LessOrEqual    ExemptionType = "less_or_equal"
)

ExemptionType values.

func (ExemptionType) Validate

func (v ExemptionType) Validate() error

Validate the ExemptionType value.

type MapObject

type MapObject []byte

MapObject represents a canonical encoding of a raw map value that is used to represent metadata and options within the Rosetta API.

func MapObjectFrom

func MapObjectFrom(v map[string]interface{}) (MapObject, error)

MapObjectFrom encodes a raw map value into a MapObject.

func (MapObject) Equal

func (m MapObject) Equal(o MapObject) bool

Equal returns whether two MapObject values are equal.

func (MapObject) MarshalJSON

func (m MapObject) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (MapObject) Raw

func (m MapObject) Raw() (map[string]interface{}, error)

Raw returns the raw map value encoded within a MapObject.

func (MapObject) RawWithJSONNumber

func (m MapObject) RawWithJSONNumber() (map[string]interface{}, error)

RawWithJSONNumber returns the raw map value encoded within a MapObject, decoding all numeric values as json.Number instead of float64.

type MempoolResponse

type MempoolResponse struct {
	TransactionIdentifiers []TransactionIdentifier
}

MempoolResponse type.

A MempoolResponse contains all transaction identifiers in the mempool for a particular network_identifier.

func (MempoolResponse) EncodeJSON

func (v MempoolResponse) EncodeJSON(b []byte) []byte

EncodeJSON encodes MempoolResponse into JSON.

func (MempoolResponse) Equal

Equal returns whether two MempoolResponse values are equal.

func (*MempoolResponse) Reset

func (v *MempoolResponse) Reset()

Reset resets MempoolResponse so that it can be reused.

type MempoolTransactionRequest

type MempoolTransactionRequest struct {
	TransactionIdentifier TransactionIdentifier
}

MempoolTransactionRequest type.

A MempoolTransactionRequest is utilized to retrieve a transaction from the mempool.

func (MempoolTransactionRequest) EncodeJSON

func (v MempoolTransactionRequest) EncodeJSON(b []byte, network []byte) []byte

EncodeJSON encodes MempoolTransactionRequest into JSON.

func (MempoolTransactionRequest) Equal

Equal returns whether two MempoolTransactionRequest values are equal.

func (*MempoolTransactionRequest) Reset

func (v *MempoolTransactionRequest) Reset()

Reset resets MempoolTransactionRequest so that it can be reused.

type MempoolTransactionResponse

type MempoolTransactionResponse struct {
	Metadata    MapObject
	Transaction Transaction
}

MempoolTransactionResponse type.

A MempoolTransactionResponse contains an estimate of a mempool transaction. It may not be possible to know the full impact of a transaction in the mempool (ex: fee paid).

func (MempoolTransactionResponse) EncodeJSON

func (v MempoolTransactionResponse) EncodeJSON(b []byte) []byte

EncodeJSON encodes MempoolTransactionResponse into JSON.

func (MempoolTransactionResponse) Equal

Equal returns whether two MempoolTransactionResponse values are equal.

func (*MempoolTransactionResponse) Reset

func (v *MempoolTransactionResponse) Reset()

Reset resets MempoolTransactionResponse so that it can be reused.

type MetadataRequest

type MetadataRequest struct {
	Metadata MapObject
}

MetadataRequest type.

A MetadataRequest is utilized in any request where the only argument is optional metadata.

func (MetadataRequest) EncodeJSON

func (v MetadataRequest) EncodeJSON(b []byte) []byte

EncodeJSON encodes MetadataRequest into JSON.

func (MetadataRequest) Equal

Equal returns whether two MetadataRequest values are equal.

func (*MetadataRequest) Reset

func (v *MetadataRequest) Reset()

Reset resets MetadataRequest so that it can be reused.

type NetworkIdentifier

type NetworkIdentifier struct {
	Blockchain string
	// If a blockchain has a specific chain-id or network identifier, it should
	// go in this field. It is up to the client to determine which
	// network-specific identifier is mainnet or testnet.
	Network              string
	SubNetworkIdentifier OptionalSubNetworkIdentifierType
}

NetworkIdentifier type.

The network_identifier specifies which network a particular object is associated with.

func (NetworkIdentifier) EncodeJSON

func (v NetworkIdentifier) EncodeJSON(b []byte) []byte

EncodeJSON encodes NetworkIdentifier into JSON.

func (NetworkIdentifier) Equal

Equal returns whether two NetworkIdentifier values are equal.

func (*NetworkIdentifier) Reset

func (v *NetworkIdentifier) Reset()

Reset resets NetworkIdentifier so that it can be reused.

type NetworkListResponse

type NetworkListResponse struct {
	NetworkIdentifiers []NetworkIdentifier
}

NetworkListResponse type.

A NetworkListResponse contains all NetworkIdentifiers that the node can serve information for.

func (NetworkListResponse) EncodeJSON

func (v NetworkListResponse) EncodeJSON(b []byte) []byte

EncodeJSON encodes NetworkListResponse into JSON.

func (NetworkListResponse) Equal

Equal returns whether two NetworkListResponse values are equal.

func (*NetworkListResponse) Reset

func (v *NetworkListResponse) Reset()

Reset resets NetworkListResponse so that it can be reused.

type NetworkOptionsResponse

type NetworkOptionsResponse struct {
	Allow   Allow
	Version Version
}

NetworkOptionsResponse contains information about the versioning of the node and the allowed operation statuses, operation types, and errors.

func (NetworkOptionsResponse) EncodeJSON

func (v NetworkOptionsResponse) EncodeJSON(b []byte) []byte

EncodeJSON encodes NetworkOptionsResponse into JSON.

func (NetworkOptionsResponse) Equal

Equal returns whether two NetworkOptionsResponse values are equal.

func (*NetworkOptionsResponse) Reset

func (v *NetworkOptionsResponse) Reset()

Reset resets NetworkOptionsResponse so that it can be reused.

type NetworkRequest

type NetworkRequest struct {
	Metadata MapObject
}

NetworkRequest type.

A NetworkRequest is utilized to retrieve some data specific exclusively to a NetworkIdentifier.

func (NetworkRequest) EncodeJSON

func (v NetworkRequest) EncodeJSON(b []byte, network []byte) []byte

EncodeJSON encodes NetworkRequest into JSON.

func (NetworkRequest) Equal

func (v NetworkRequest) Equal(o NetworkRequest) bool

Equal returns whether two NetworkRequest values are equal.

func (*NetworkRequest) Reset

func (v *NetworkRequest) Reset()

Reset resets NetworkRequest so that it can be reused.

type NetworkStatusResponse

type NetworkStatusResponse struct {
	CurrentBlockIdentifier BlockIdentifier
	CurrentBlockTimestamp  Timestamp
	GenesisBlockIdentifier BlockIdentifier
	OldestBlockIdentifier  OptionalBlockIdentifierType
	Peers                  []Peer
	SyncStatus             OptionalSyncStatusType
}

NetworkStatusResponse contains basic information about the node's view of a blockchain network. It is assumed that any BlockIdentifier.Index less than or equal to CurrentBlockIdentifier.Index can be queried.

If a Rosetta implementation prunes historical state, it should populate the optional `oldest_block_identifier` field with the oldest block available to query. If this is not populated, it is assumed that the `genesis_block_identifier` is the oldest queryable block.

If a Rosetta implementation performs some pre-sync before it is possible to query blocks, sync_status should be populated so that clients can still monitor healthiness. Without this field, it may appear that the implementation is stuck syncing and needs to be terminated.

func (NetworkStatusResponse) EncodeJSON

func (v NetworkStatusResponse) EncodeJSON(b []byte) []byte

EncodeJSON encodes NetworkStatusResponse into JSON.

func (NetworkStatusResponse) Equal

Equal returns whether two NetworkStatusResponse values are equal.

func (*NetworkStatusResponse) Reset

func (v *NetworkStatusResponse) Reset()

Reset resets NetworkStatusResponse so that it can be reused.

type Operation

type Operation struct {
	Account             OptionalAccountIdentifierType
	Amount              OptionalAmountType
	CoinChange          OptionalCoinChangeType
	Metadata            MapObject
	OperationIdentifier OperationIdentifier
	// Restrict referenced related_operations to identifier indices < the
	// current operation_identifier.index. This ensures there exists a clear
	// DAG-structure of relations.
	//
	// Since operations are one-sided, one could imagine relating operations in
	// a single transfer or linking operations in a call tree.
	RelatedOperations []OperationIdentifier
	// Status is the network-specific status of the operation. Status is not
	// defined on the transaction object because blockchains with smart
	// contracts may have transactions that partially apply (some operations are
	// successful and some are not). Blockchains with atomic transactions (all
	// operations succeed or all operations fail) will have the same status for
	// each operation.
	//
	// On-chain operations (operations retrieved in the `/block` and
	// `/block/transaction` endpoints) MUST have a populated status field
	// (anything on-chain must have succeeded or failed). However, operations
	// provided during transaction construction (often times called "intent" in
	// the documentation) MUST NOT have a populated status field (operations yet
	// to be included on-chain have not yet succeeded or failed).
	Status OptionalStringType
	// Type is the network-specific type of the operation. Ensure that any type
	// that can be returned here is also specified in the
	// NetworkOptionsResponse. This can be very useful to downstream consumers
	// that parse all block data.
	Type string
}

Operation type.

Operations contain all balance-changing information within a transaction. They are always one-sided (only affect 1 AccountIdentifier) and can succeed or fail independently from a Transaction.

Operations are used both to represent on-chain data (Data API) and to construct new transactions (Construction API), creating a standard interface for reading and writing to blockchains.

func (Operation) EncodeJSON

func (v Operation) EncodeJSON(b []byte) []byte

EncodeJSON encodes Operation into JSON.

func (Operation) Equal

func (v Operation) Equal(o Operation) bool

Equal returns whether two Operation values are equal.

func (*Operation) Reset

func (v *Operation) Reset()

Reset resets Operation so that it can be reused.

type OperationIdentifier

type OperationIdentifier struct {
	// The operation index is used to ensure each operation has a unique
	// identifier within a transaction. This index is only relative to the
	// transaction and NOT GLOBAL. The operations in each transaction should
	// start from index 0.
	//
	// To clarify, there may not be any notion of an operation index in the
	// blockchain being described.
	Index int64
	// Some blockchains specify an operation index that is essential for client
	// use. For example, Bitcoin uses a network_index to identify which UTXO was
	// used in a transaction.
	//
	// network_index should not be populated if there is no notion of an
	// operation index in a blockchain (typically most account-based
	// blockchains).
	NetworkIndex OptionalInt64Type
}

OperationIdentifier type.

The operation_identifier uniquely identifies an operation within a transaction.

func (OperationIdentifier) EncodeJSON

func (v OperationIdentifier) EncodeJSON(b []byte) []byte

EncodeJSON encodes OperationIdentifier into JSON.

func (OperationIdentifier) Equal

Equal returns whether two OperationIdentifier values are equal.

func (*OperationIdentifier) Reset

func (v *OperationIdentifier) Reset()

Reset resets OperationIdentifier so that it can be reused.

type OperationStatus

type OperationStatus struct {
	// The status is the network-specific status of the operation.
	Status string
	// An Operation is considered successful if the Operation.Amount should
	// affect the Operation.Account. Some blockchains (like Bitcoin) only
	// include successful operations in blocks but other blockchains (like
	// Ethereum) include unsuccessful operations that incur a fee.
	//
	// To reconcile the computed balance from the stream of Operations, it is
	// critical to understand which Operation.Status indicate an Operation is
	// successful and should affect an Account.
	Successful bool
}

OperationStatus is utilized to indicate which Operation status are considered successful.

func (OperationStatus) EncodeJSON

func (v OperationStatus) EncodeJSON(b []byte) []byte

EncodeJSON encodes OperationStatus into JSON.

func (OperationStatus) Equal

Equal returns whether two OperationStatus values are equal.

func (*OperationStatus) Reset

func (v *OperationStatus) Reset()

Reset resets OperationStatus so that it can be reused.

type Operator

type Operator string

Operator is used by query-related endpoints to determine how to apply conditions.

If this field is not populated, the default `and` value will be used.

const (
	And Operator = "and"
	Or  Operator = "or"
)

Operator values.

func (Operator) Validate

func (v Operator) Validate() error

Validate the Operator value.

type OptionalAccountIdentifierType

type OptionalAccountIdentifierType struct {
	Set   bool
	Value AccountIdentifier
}

OptionalAccountIdentifierType encapsulates an optional AccountIdentifier value.

func OptionalAccountIdentifier

func OptionalAccountIdentifier(v AccountIdentifier) OptionalAccountIdentifierType

OptionalAccountIdentifier creates an optional AccountIdentifier value.

type OptionalAmountType

type OptionalAmountType struct {
	Set   bool
	Value Amount
}

OptionalAmountType encapsulates an optional Amount value.

func OptionalAmount

func OptionalAmount(v Amount) OptionalAmountType

OptionalAmount creates an optional Amount value.

type OptionalBlockIdentifierType

type OptionalBlockIdentifierType struct {
	Set   bool
	Value BlockIdentifier
}

OptionalBlockIdentifierType encapsulates an optional BlockIdentifier value.

func OptionalBlockIdentifier

func OptionalBlockIdentifier(v BlockIdentifier) OptionalBlockIdentifierType

OptionalBlockIdentifier creates an optional BlockIdentifier value.

type OptionalBlockType

type OptionalBlockType struct {
	Set   bool
	Value Block
}

OptionalBlockType encapsulates an optional Block value.

func OptionalBlock

func OptionalBlock(v Block) OptionalBlockType

OptionalBlock creates an optional Block value.

type OptionalBoolType

type OptionalBoolType struct {
	Set   bool
	Value bool
}

OptionalBoolType encapsulates an optional bool value.

func OptionalBool

func OptionalBool(v bool) OptionalBoolType

OptionalBool creates an optional bool value.

type OptionalCoinChangeType

type OptionalCoinChangeType struct {
	Set   bool
	Value CoinChange
}

OptionalCoinChangeType encapsulates an optional CoinChange value.

func OptionalCoinChange

func OptionalCoinChange(v CoinChange) OptionalCoinChangeType

OptionalCoinChange creates an optional CoinChange value.

type OptionalCoinIdentifierType

type OptionalCoinIdentifierType struct {
	Set   bool
	Value CoinIdentifier
}

OptionalCoinIdentifierType encapsulates an optional CoinIdentifier value.

func OptionalCoinIdentifier

func OptionalCoinIdentifier(v CoinIdentifier) OptionalCoinIdentifierType

OptionalCoinIdentifier creates an optional CoinIdentifier value.

type OptionalCurrencyType

type OptionalCurrencyType struct {
	Set   bool
	Value Currency
}

OptionalCurrencyType encapsulates an optional Currency value.

func OptionalCurrency

func OptionalCurrency(v Currency) OptionalCurrencyType

OptionalCurrency creates an optional Currency value.

type OptionalExemptionTypeType

type OptionalExemptionTypeType struct {
	Set   bool
	Value ExemptionType
}

OptionalExemptionTypeType encapsulates an optional ExemptionType value.

func OptionalExemptionType

func OptionalExemptionType(v ExemptionType) OptionalExemptionTypeType

OptionalExemptionType creates an optional ExemptionType value.

type OptionalFloat64Type

type OptionalFloat64Type struct {
	Set   bool
	Value float64
}

OptionalFloat64Type encapsulates an optional float64 value.

func OptionalFloat64

func OptionalFloat64(v float64) OptionalFloat64Type

OptionalFloat64 creates an optional float64 value.

type OptionalInt64Type

type OptionalInt64Type struct {
	Set   bool
	Value int64
}

OptionalInt64Type encapsulates an optional int64 value.

func OptionalInt64

func OptionalInt64(v int64) OptionalInt64Type

OptionalInt64 creates an optional int64 value.

type OptionalNetworkIdentifierType

type OptionalNetworkIdentifierType struct {
	Set   bool
	Value NetworkIdentifier
}

OptionalNetworkIdentifierType encapsulates an optional NetworkIdentifier value.

func OptionalNetworkIdentifier

func OptionalNetworkIdentifier(v NetworkIdentifier) OptionalNetworkIdentifierType

OptionalNetworkIdentifier creates an optional NetworkIdentifier value.

type OptionalOperatorType

type OptionalOperatorType struct {
	Set   bool
	Value Operator
}

OptionalOperatorType encapsulates an optional Operator value.

func OptionalOperator

func OptionalOperator(v Operator) OptionalOperatorType

OptionalOperator creates an optional Operator value.

type OptionalPartialBlockIdentifierType

type OptionalPartialBlockIdentifierType struct {
	Set   bool
	Value PartialBlockIdentifier
}

OptionalPartialBlockIdentifierType encapsulates an optional PartialBlockIdentifier value.

func OptionalPartialBlockIdentifier

func OptionalPartialBlockIdentifier(v PartialBlockIdentifier) OptionalPartialBlockIdentifierType

OptionalPartialBlockIdentifier creates an optional PartialBlockIdentifier value.

type OptionalSignatureTypeType

type OptionalSignatureTypeType struct {
	Set   bool
	Value SignatureType
}

OptionalSignatureTypeType encapsulates an optional SignatureType value.

func OptionalSignatureType

func OptionalSignatureType(v SignatureType) OptionalSignatureTypeType

OptionalSignatureType creates an optional SignatureType value.

type OptionalStringType

type OptionalStringType struct {
	Set   bool
	Value string
}

OptionalStringType encapsulates an optional string value.

func OptionalString

func OptionalString(v string) OptionalStringType

OptionalString creates an optional string value.

type OptionalSubAccountIdentifierType

type OptionalSubAccountIdentifierType struct {
	Set   bool
	Value SubAccountIdentifier
}

OptionalSubAccountIdentifierType encapsulates an optional SubAccountIdentifier value.

func OptionalSubAccountIdentifier

func OptionalSubAccountIdentifier(v SubAccountIdentifier) OptionalSubAccountIdentifierType

OptionalSubAccountIdentifier creates an optional SubAccountIdentifier value.

type OptionalSubNetworkIdentifierType

type OptionalSubNetworkIdentifierType struct {
	Set   bool
	Value SubNetworkIdentifier
}

OptionalSubNetworkIdentifierType encapsulates an optional SubNetworkIdentifier value.

func OptionalSubNetworkIdentifier

func OptionalSubNetworkIdentifier(v SubNetworkIdentifier) OptionalSubNetworkIdentifierType

OptionalSubNetworkIdentifier creates an optional SubNetworkIdentifier value.

type OptionalSyncStatusType

type OptionalSyncStatusType struct {
	Set   bool
	Value SyncStatus
}

OptionalSyncStatusType encapsulates an optional SyncStatus value.

func OptionalSyncStatus

func OptionalSyncStatus(v SyncStatus) OptionalSyncStatusType

OptionalSyncStatus creates an optional SyncStatus value.

type OptionalTransactionIdentifierType

type OptionalTransactionIdentifierType struct {
	Set   bool
	Value TransactionIdentifier
}

OptionalTransactionIdentifierType encapsulates an optional TransactionIdentifier value.

func OptionalTransactionIdentifier

func OptionalTransactionIdentifier(v TransactionIdentifier) OptionalTransactionIdentifierType

OptionalTransactionIdentifier creates an optional TransactionIdentifier value.

type PartialBlockIdentifier

type PartialBlockIdentifier struct {
	Hash  OptionalStringType
	Index OptionalInt64Type
}

PartialBlockIdentifier type.

When fetching data by BlockIdentifier, it may be possible to only specify the index or hash. If neither property is specified, it is assumed that the client is making a request at the current block.

func (PartialBlockIdentifier) EncodeJSON

func (v PartialBlockIdentifier) EncodeJSON(b []byte) []byte

EncodeJSON encodes PartialBlockIdentifier into JSON.

func (PartialBlockIdentifier) Equal

Equal returns whether two PartialBlockIdentifier values are equal.

func (*PartialBlockIdentifier) Reset

func (v *PartialBlockIdentifier) Reset()

Reset resets PartialBlockIdentifier so that it can be reused.

type Peer

type Peer struct {
	Metadata MapObject
	PeerID   string
}

Peer type.

A Peer is a representation of a node's peer.

func (Peer) EncodeJSON

func (v Peer) EncodeJSON(b []byte) []byte

EncodeJSON encodes Peer into JSON.

func (Peer) Equal

func (v Peer) Equal(o Peer) bool

Equal returns whether two Peer values are equal.

func (*Peer) Reset

func (v *Peer) Reset()

Reset resets Peer so that it can be reused.

type PublicKey

type PublicKey struct {
	// Hex-encoded public key bytes in the format specified by the CurveType.
	Bytes     []byte
	CurveType CurveType
}

PublicKey contains a public key byte array for a particular CurveType encoded in hex.

Note that there is no PrivateKey struct as this is NEVER the concern of an implementation.

func (PublicKey) EncodeJSON

func (v PublicKey) EncodeJSON(b []byte) []byte

EncodeJSON encodes PublicKey into JSON.

func (PublicKey) Equal

func (v PublicKey) Equal(o PublicKey) bool

Equal returns whether two PublicKey values are equal.

func (*PublicKey) Reset

func (v *PublicKey) Reset()

Reset resets PublicKey so that it can be reused.

type RelatedTransaction

type RelatedTransaction struct {
	Direction             Direction
	NetworkIdentifier     OptionalNetworkIdentifierType
	TransactionIdentifier TransactionIdentifier
}

RelatedTransaction type.

The related_transaction allows implementations to link together multiple transactions. An unpopulated network identifier indicates that the related transaction is on the same network.

func (RelatedTransaction) EncodeJSON

func (v RelatedTransaction) EncodeJSON(b []byte) []byte

EncodeJSON encodes RelatedTransaction into JSON.

func (RelatedTransaction) Equal

Equal returns whether two RelatedTransaction values are equal.

func (*RelatedTransaction) Reset

func (v *RelatedTransaction) Reset()

Reset resets RelatedTransaction so that it can be reused.

type SearchTransactionsRequest

type SearchTransactionsRequest struct {
	AccountIdentifier OptionalAccountIdentifierType
	// address is AccountIdentifier.Address. This is used to get all
	// transactions related to an AccountIdentifier.Address, regardless of
	// SubAccountIdentifier.
	Address        OptionalStringType
	CoinIdentifier OptionalCoinIdentifierType
	Currency       OptionalCurrencyType
	// limit is the maximum number of transactions to return in one call. The
	// implementation may return <= limit transactions.
	Limit OptionalInt64Type
	// max_block is the largest block index to consider when searching for
	// transactions. If this field is not populated, the current block is
	// considered the max_block.
	//
	// If you do not specify a max_block, it is possible a newly synced block
	// will interfere with paginated transaction queries (as the offset could
	// become invalid with newly added rows).
	MaxBlock OptionalInt64Type
	// offset is the offset into the query result to start returning
	// transactions.
	//
	// If any search conditions are changed, the query offset will change and
	// you must restart your search iteration.
	Offset   OptionalInt64Type
	Operator OptionalOperatorType
	// status is the network-specific operation type.
	Status OptionalStringType
	// success is a synthetic condition populated by parsing network-specific
	// operation statuses (using the mapping provided in `/network/options`).
	Success               OptionalBoolType
	TransactionIdentifier OptionalTransactionIdentifierType
	// type is the network-specific operation type.
	Type OptionalStringType
}

SearchTransactionsRequest is used to search for transactions matching a set of provided conditions in canonical blocks.

func (SearchTransactionsRequest) EncodeJSON

func (v SearchTransactionsRequest) EncodeJSON(b []byte, network []byte) []byte

EncodeJSON encodes SearchTransactionsRequest into JSON.

func (SearchTransactionsRequest) Equal

Equal returns whether two SearchTransactionsRequest values are equal.

func (*SearchTransactionsRequest) Reset

func (v *SearchTransactionsRequest) Reset()

Reset resets SearchTransactionsRequest so that it can be reused.

type SearchTransactionsResponse

type SearchTransactionsResponse struct {
	// next_offset is the next offset to use when paginating through transaction
	// results. If this field is not populated, there are no more transactions
	// to query.
	NextOffset OptionalInt64Type
	// total_count is the number of results for a given search. Callers
	// typically use this value to concurrently fetch results by offset or to
	// display a virtual page number associated with results.
	TotalCount int64
	// transactions is an array of BlockTransactions sorted by most recent
	// BlockIdentifier (meaning that transactions in recent blocks appear
	// first).
	//
	// If there are many transactions for a particular search, transactions may
	// not contain all matching transactions. It is up to the caller to paginate
	// these transactions using the max_block field.
	Transactions []BlockTransaction
}

SearchTransactionsResponse contains an ordered collection of BlockTransactions that match the query in SearchTransactionsRequest. These BlockTransactions are sorted from most recent block to oldest block.

func (SearchTransactionsResponse) EncodeJSON

func (v SearchTransactionsResponse) EncodeJSON(b []byte) []byte

EncodeJSON encodes SearchTransactionsResponse into JSON.

func (SearchTransactionsResponse) Equal

Equal returns whether two SearchTransactionsResponse values are equal.

func (*SearchTransactionsResponse) Reset

func (v *SearchTransactionsResponse) Reset()

Reset resets SearchTransactionsResponse so that it can be reused.

type Signature

type Signature struct {
	Bytes          []byte
	PublicKey      PublicKey
	SignatureType  SignatureType
	SigningPayload SigningPayload
}

Signature contains the payload that was signed, the public keys of the keypairs used to produce the signature, the signature (encoded in hex), and the SignatureType.

PublicKey is often times not known during construction of the signing payloads but may be needed to combine signatures properly.

func (Signature) EncodeJSON

func (v Signature) EncodeJSON(b []byte) []byte

EncodeJSON encodes Signature into JSON.

func (Signature) Equal

func (v Signature) Equal(o Signature) bool

Equal returns whether two Signature values are equal.

func (*Signature) Reset

func (v *Signature) Reset()

Reset resets Signature so that it can be reused.

type SignatureType

type SignatureType string

SignatureType is the type of a cryptographic signature.

* ecdsa: `r (32-bytes) || s (32-bytes)` - `64 bytes` * ecdsa_recovery: `r (32-bytes) || s (32-bytes) || v (1-byte)` - `65 bytes` * ed25519: `R (32-byte) || s (32-bytes)` - `64 bytes` * schnorr_1: `r (32-bytes) || s (32-bytes)` - `64 bytes` (schnorr signature implemented by Zilliqa where both `r` and `s` are scalars encoded as `32-bytes` values, most significant byte first.) * schnorr_poseidon: `r (32-bytes) || s (32-bytes)` where s = Hash(1st pk || 2nd pk || r) - `64 bytes` (schnorr signature w/ Poseidon hash function implemented by O(1) Labs where both `r` and `s` are scalars encoded as `32-bytes` values, least significant byte first. https://github.com/CodaProtocol/signer-reference/blob/master/schnorr.ml )

const (
	ECDSA           SignatureType = "ecdsa"
	ECDSARecovery   SignatureType = "ecdsa_recovery"
	Ed25519         SignatureType = "ed25519"
	Schnorr1        SignatureType = "schnorr_1"
	SchnorrPoseidon SignatureType = "schnorr_poseidon"
)

SignatureType values.

func (SignatureType) Validate

func (v SignatureType) Validate() error

Validate the SignatureType value.

type SigningPayload

type SigningPayload struct {
	AccountIdentifier OptionalAccountIdentifierType
	// [DEPRECATED by `account_identifier` in `v1.4.4`] The network-specific
	// address of the account that should sign the payload.
	Address       OptionalStringType
	Bytes         []byte
	SignatureType OptionalSignatureTypeType
}

SigningPayload is signed by the client with the keypair associated with an AccountIdentifier using the specified SignatureType.

SignatureType can be optionally populated if there is a restriction on the signature scheme that can be used to sign the payload.

func (SigningPayload) EncodeJSON

func (v SigningPayload) EncodeJSON(b []byte) []byte

EncodeJSON encodes SigningPayload into JSON.

func (SigningPayload) Equal

func (v SigningPayload) Equal(o SigningPayload) bool

Equal returns whether two SigningPayload values are equal.

func (*SigningPayload) Reset

func (v *SigningPayload) Reset()

Reset resets SigningPayload so that it can be reused.

type SubAccountIdentifier

type SubAccountIdentifier struct {
	// The SubAccount address may be a cryptographic value or some other
	// identifier (ex: bonded) that uniquely specifies a SubAccount.
	Address string
	// If the SubAccount address is not sufficient to uniquely specify a
	// SubAccount, any other identifying information can be stored here.
	//
	// It is important to note that two SubAccounts with identical addresses but
	// differing metadata will not be considered equal by clients.
	Metadata MapObject
}

SubAccountIdentifier type.

An account may have state specific to a contract address (ERC-20 token) and/or a stake (delegated balance). The sub_account_identifier should specify which state (if applicable) an account instantiation refers to.

func (SubAccountIdentifier) EncodeJSON

func (v SubAccountIdentifier) EncodeJSON(b []byte) []byte

EncodeJSON encodes SubAccountIdentifier into JSON.

func (SubAccountIdentifier) Equal

Equal returns whether two SubAccountIdentifier values are equal.

func (*SubAccountIdentifier) Reset

func (v *SubAccountIdentifier) Reset()

Reset resets SubAccountIdentifier so that it can be reused.

type SubNetworkIdentifier

type SubNetworkIdentifier struct {
	Metadata MapObject
	Network  string
}

SubNetworkIdentifier type.

In blockchains with sharded state, the SubNetworkIdentifier is required to query some object on a specific shard. This identifier is optional for all non-sharded blockchains.

func (SubNetworkIdentifier) EncodeJSON

func (v SubNetworkIdentifier) EncodeJSON(b []byte) []byte

EncodeJSON encodes SubNetworkIdentifier into JSON.

func (SubNetworkIdentifier) Equal

Equal returns whether two SubNetworkIdentifier values are equal.

func (*SubNetworkIdentifier) Reset

func (v *SubNetworkIdentifier) Reset()

Reset resets SubNetworkIdentifier so that it can be reused.

type SyncStatus

type SyncStatus struct {
	// CurrentIndex is the index of the last synced block in the current stage.
	//
	// This is a separate field from current_block_identifier in
	// NetworkStatusResponse because blocks with indices up to and including the
	// current_index may not yet be queryable by the caller. To reiterate, all
	// indices up to and including current_block_identifier in
	// NetworkStatusResponse must be queryable via the /block endpoint
	// (excluding indices less than oldest_block_identifier).
	CurrentIndex OptionalInt64Type
	// Stage is the phase of the sync process.
	Stage OptionalStringType
	// sycned is a boolean that indicates if an implementation has synced up to
	// the most recent block. If this field is not populated, the caller should
	// rely on a traditional tip timestamp comparison to determine if an
	// implementation is synced.
	//
	// This field is particularly useful for quiescent blockchains (blocks only
	// produced when there are pending transactions). In these blockchains, the
	// most recent block could have a timestamp far behind the current time but
	// the node could be healthy and at tip.
	Synced OptionalBoolType
	// TargetIndex is the index of the block that the implementation is
	// attempting to sync to in the current stage.
	TargetIndex OptionalInt64Type
}

SyncStatus is used to provide additional context about an implementation's sync status.

This object is often used by implementations to indicate healthiness when block data cannot be queried until some sync phase completes or cannot be determined by comparing the timestamp of the most recent block with the current time.

func (SyncStatus) EncodeJSON

func (v SyncStatus) EncodeJSON(b []byte) []byte

EncodeJSON encodes SyncStatus into JSON.

func (SyncStatus) Equal

func (v SyncStatus) Equal(o SyncStatus) bool

Equal returns whether two SyncStatus values are equal.

func (*SyncStatus) Reset

func (v *SyncStatus) Reset()

Reset resets SyncStatus so that it can be reused.

type Timestamp

type Timestamp int64

Timestamp type.

The timestamp of the block in milliseconds since the Unix Epoch. The timestamp is stored in milliseconds because some blockchains produce blocks more often than once a second.

func (Timestamp) Validate

func (v Timestamp) Validate() error

Validate the Timestamp value.

type Transaction

type Transaction struct {
	// Transactions that are related to other transactions (like a cross-shard
	// transaction) should include the tranaction_identifier of these
	// transactions in the metadata.
	Metadata              MapObject
	Operations            []Operation
	RelatedTransactions   []RelatedTransaction
	TransactionIdentifier TransactionIdentifier
}

Transaction type.

Transactions contain an array of Operations that are attributable to the same TransactionIdentifier.

func (Transaction) EncodeJSON

func (v Transaction) EncodeJSON(b []byte) []byte

EncodeJSON encodes Transaction into JSON.

func (Transaction) Equal

func (v Transaction) Equal(o Transaction) bool

Equal returns whether two Transaction values are equal.

func (*Transaction) Reset

func (v *Transaction) Reset()

Reset resets Transaction so that it can be reused.

type TransactionIdentifier

type TransactionIdentifier struct {
	// Any transactions that are attributable only to a block (ex: a block
	// event) should use the hash of the block as the identifier.
	Hash string
}

TransactionIdentifier type.

The transaction_identifier uniquely identifies a transaction in a particular network and block or in the mempool.

func (TransactionIdentifier) EncodeJSON

func (v TransactionIdentifier) EncodeJSON(b []byte) []byte

EncodeJSON encodes TransactionIdentifier into JSON.

func (TransactionIdentifier) Equal

Equal returns whether two TransactionIdentifier values are equal.

func (*TransactionIdentifier) Reset

func (v *TransactionIdentifier) Reset()

Reset resets TransactionIdentifier so that it can be reused.

type TransactionIdentifierResponse

type TransactionIdentifierResponse struct {
	Metadata              MapObject
	TransactionIdentifier TransactionIdentifier
}

TransactionIdentifierResponse contains the transaction_identifier of a transaction that was submitted to either `/construction/hash` or `/construction/submit`.

func (TransactionIdentifierResponse) EncodeJSON

func (v TransactionIdentifierResponse) EncodeJSON(b []byte) []byte

EncodeJSON encodes TransactionIdentifierResponse into JSON.

func (TransactionIdentifierResponse) Equal

Equal returns whether two TransactionIdentifierResponse values are equal.

func (*TransactionIdentifierResponse) Reset

func (v *TransactionIdentifierResponse) Reset()

Reset resets TransactionIdentifierResponse so that it can be reused.

type Version

type Version struct {
	// Any other information that may be useful about versioning of dependent
	// services should be returned here.
	Metadata MapObject
	// When a middleware server is used to adhere to the Rosetta interface, it
	// should return its version here. This can help clients manage deployments.
	MiddlewareVersion OptionalStringType
	// The node_version is the canonical version of the node runtime. This can
	// help clients manage deployments.
	NodeVersion string
	// The rosetta_version is the version of the Rosetta interface the
	// implementation adheres to. This can be useful for clients looking to
	// reliably parse responses.
	RosettaVersion string
}

Version type.

The Version object is utilized to inform the client of the versions of different components of the Rosetta implementation.

func (Version) EncodeJSON

func (v Version) EncodeJSON(b []byte) []byte

EncodeJSON encodes Version into JSON.

func (Version) Equal

func (v Version) Equal(o Version) bool

Equal returns whether two Version values are equal.

func (*Version) Reset

func (v *Version) Reset()

Reset resets Version so that it can be reused.

Jump to

Keyboard shortcuts

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