Documentation
¶
Index ¶
- func AccountString(account *AccountIdentifier) string
- func AddValues(a string, b string) (string, error)
- func AmountValue(amount *Amount) (*big.Int, error)
- func BigInt(value string) (*big.Int, error)
- func CurrencyString(currency *Currency) string
- func Hash(i interface{}) string
- func MarshalMap(input interface{}) (map[string]interface{}, error)
- func NegateValue(val string) (string, error)
- func PrettyPrintStruct(val interface{}) string
- func SubtractValues(a string, b string) (string, error)
- func UnmarshalMap(metadata map[string]interface{}, output interface{}) error
- type AccountBalanceRequest
- type AccountBalanceResponse
- type AccountIdentifier
- type Allow
- type Amount
- type Block
- type BlockIdentifier
- type BlockRequest
- type BlockResponse
- type BlockTransactionRequest
- type BlockTransactionResponse
- type ConstructionCombineRequest
- type ConstructionCombineResponse
- type ConstructionDeriveRequest
- type ConstructionDeriveResponse
- type ConstructionHashRequest
- type ConstructionHashResponse
- type ConstructionMetadataRequest
- type ConstructionMetadataResponse
- type ConstructionParseRequest
- type ConstructionParseResponse
- type ConstructionPayloadsRequest
- type ConstructionPayloadsResponse
- type ConstructionPreprocessRequest
- type ConstructionPreprocessResponse
- type ConstructionSubmitRequest
- type ConstructionSubmitResponse
- type Currency
- type CurveType
- type Error
- type MempoolResponse
- type MempoolTransactionRequest
- type MempoolTransactionResponse
- type MetadataRequest
- type NetworkIdentifier
- type NetworkListResponse
- type NetworkOptionsResponse
- type NetworkRequest
- type NetworkStatusResponse
- type Operation
- type OperationIdentifier
- type OperationStatus
- type PartialBlockIdentifier
- type Peer
- type PublicKey
- type Signature
- type SignatureType
- type SigningPayload
- type SubAccountIdentifier
- type SubNetworkIdentifier
- type Transaction
- type TransactionIdentifier
- type Version
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AccountString ¶ added in v0.1.7
func AccountString(account *AccountIdentifier) string
AccountString returns a human-readable representation of a *types.AccountIdentifier.
func AmountValue ¶ added in v0.3.0
AmountValue returns a *big.Int representation of an Amount.Value or an error.
func CurrencyString ¶ added in v0.1.7
CurrencyString returns a human-readable representation of a *types.Currency.
func Hash ¶ added in v0.1.7
func Hash(i interface{}) string
Hash returns a deterministic hash for any interface. This works because Golang's JSON marshaler sorts all map keys, recursively. Source: https://golang.org/pkg/encoding/json/#Marshal Inspiration: https://github.com/onsi/gomega/blob/c0be49994280db30b6b68390f67126d773bc5558/matchers/match_json_matcher.go#L16
It is important to note that any interface that is a slice or contains slices will not be equal if the slice ordering is different.
func MarshalMap ¶ added in v0.1.8
MarshalMap attempts to marshal an interface into a map[string]interface{}. This function is used similarly to json.Marshal.
func NegateValue ¶ added in v0.1.9
NegateValue flips the sign of a value.
func PrettyPrintStruct ¶ added in v0.1.7
func PrettyPrintStruct(val interface{}) string
PrettyPrintStruct marshals a struct to JSON and returns it as a string.
func SubtractValues ¶ added in v0.1.7
SubtractValues subtracts a-b using big.Int.
func UnmarshalMap ¶ added in v0.1.8
UnmarshalMap attempts to unmarshal a map[string]interface{} into an interface. This function is used similarly to json.Unmarshal.
Types ¶
type AccountBalanceRequest ¶
type AccountBalanceRequest struct { NetworkIdentifier *NetworkIdentifier `json:"network_identifier"` AccountIdentifier *AccountIdentifier `json:"account_identifier"` BlockIdentifier *PartialBlockIdentifier `json:"block_identifier,omitempty"` }
AccountBalanceRequest 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.
type AccountBalanceResponse ¶
type AccountBalanceResponse struct { BlockIdentifier *BlockIdentifier `json:"block_identifier"` // A single account may have a balance in multiple currencies. Balances []*Amount `json:"balances"` // 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 map[string]interface{} `json:"metadata,omitempty"` }
AccountBalanceResponse 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.
type AccountIdentifier ¶
type AccountIdentifier struct { // The address may be a cryptographic public key (or some encoding of it) or a provided // username. Address string `json:"address"` SubAccount *SubAccountIdentifier `json:"sub_account,omitempty"` // 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 map[string]interface{} `json:"metadata,omitempty"` }
AccountIdentifier 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).
type Allow ¶ added in v0.1.2
type Allow struct { // 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 `json:"operation_statuses"` // 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 `json:"operation_types"` // 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 `json:"errors"` // Any Rosetta implementation that supports querying the balance of an account at any height in // the past should set this to true. HistoricalBalanceLookup bool `json:"historical_balance_lookup"` }
Allow 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.
type Amount ¶
type Amount struct { // 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 `json:"value"` Currency *Currency `json:"currency"` Metadata map[string]interface{} `json:"metadata,omitempty"` }
Amount Amount is some Value of a Currency. It is considered invalid to specify a Value without a Currency.
type Block ¶
type Block struct { BlockIdentifier *BlockIdentifier `json:"block_identifier"` ParentBlockIdentifier *BlockIdentifier `json:"parent_block_identifier"` // 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. Timestamp int64 `json:"timestamp"` Transactions []*Transaction `json:"transactions"` Metadata map[string]interface{} `json:"metadata,omitempty"` }
Block Blocks contain an array of Transactions that occurred at a particular BlockIdentifier.
type BlockIdentifier ¶
type BlockIdentifier struct { // This is also known as the block height. Index int64 `json:"index"` Hash string `json:"hash"` }
BlockIdentifier The block_identifier uniquely identifies a block in a particular network.
type BlockRequest ¶
type BlockRequest struct { NetworkIdentifier *NetworkIdentifier `json:"network_identifier"` BlockIdentifier *PartialBlockIdentifier `json:"block_identifier"` }
BlockRequest A BlockRequest is utilized to make a block request on the /block endpoint.
type BlockResponse ¶
type BlockResponse struct { Block *Block `json:"block"` // 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 `json:"other_transactions,omitempty"` }
BlockResponse A BlockResponse includes a fully-populated block or a partially-populated block with a list of other transactions to fetch (other_transactions).
type BlockTransactionRequest ¶
type BlockTransactionRequest struct { NetworkIdentifier *NetworkIdentifier `json:"network_identifier"` BlockIdentifier *BlockIdentifier `json:"block_identifier"` TransactionIdentifier *TransactionIdentifier `json:"transaction_identifier"` }
BlockTransactionRequest A BlockTransactionRequest is used to fetch a Transaction included in a block that is not returned in a BlockResponse.
type BlockTransactionResponse ¶
type BlockTransactionResponse struct {
Transaction *Transaction `json:"transaction"`
}
BlockTransactionResponse A BlockTransactionResponse contains information about a block transaction.
type ConstructionCombineRequest ¶ added in v0.3.0
type ConstructionCombineRequest struct { NetworkIdentifier *NetworkIdentifier `json:"network_identifier"` UnsignedTransaction string `json:"unsigned_transaction"` Signatures []*Signature `json:"signatures"` }
ConstructionCombineRequest 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.
type ConstructionCombineResponse ¶ added in v0.3.0
type ConstructionCombineResponse struct {
SignedTransaction string `json:"signed_transaction"`
}
ConstructionCombineResponse ConstructionCombineResponse is returned by `/construction/combine`. The network payload will be sent directly to the `construction/submit` endpoint.
type ConstructionDeriveRequest ¶ added in v0.3.0
type ConstructionDeriveRequest struct { NetworkIdentifier *NetworkIdentifier `json:"network_identifier"` PublicKey *PublicKey `json:"public_key"` Metadata map[string]interface{} `json:"metadata,omitempty"` }
ConstructionDeriveRequest 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).
type ConstructionDeriveResponse ¶ added in v0.3.0
type ConstructionDeriveResponse struct { // Address in network-specific format. Address string `json:"address"` Metadata map[string]interface{} `json:"metadata,omitempty"` }
ConstructionDeriveResponse ConstructionDeriveResponse is returned by the `/construction/derive` endpoint.
type ConstructionHashRequest ¶ added in v0.3.0
type ConstructionHashRequest struct { NetworkIdentifier *NetworkIdentifier `json:"network_identifier"` SignedTransaction string `json:"signed_transaction"` }
ConstructionHashRequest ConstructionHashRequest is the input to the `/construction/hash` endpoint.
type ConstructionHashResponse ¶ added in v0.3.0
type ConstructionHashResponse struct {
TransactionHash string `json:"transaction_hash"`
}
ConstructionHashResponse ConstructionHashResponse is the output of the `/construction/hash` endpoint.
type ConstructionMetadataRequest ¶ added in v0.1.2
type ConstructionMetadataRequest struct { NetworkIdentifier *NetworkIdentifier `json:"network_identifier"` // 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 map[string]interface{} `json:"options"` }
ConstructionMetadataRequest 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.
type ConstructionMetadataResponse ¶ added in v0.1.2
type ConstructionMetadataResponse struct {
Metadata map[string]interface{} `json:"metadata"`
}
ConstructionMetadataResponse The ConstructionMetadataResponse returns network-specific metadata used for transaction construction.
type ConstructionParseRequest ¶ added in v0.3.0
type ConstructionParseRequest struct { NetworkIdentifier *NetworkIdentifier `json:"network_identifier"` // Signed is a boolean indicating whether the transaction is signed. Signed bool `json:"signed"` // This must be either the unsigned transaction blob returned by `/construction/payloads` or the // signed transaction blob returned by `/construction/combine`. Transaction string `json:"transaction"` }
ConstructionParseRequest ConstructionParseRequest is the input to the `/construction/parse` endpoint. It allows the caller to parse either an unsigned or signed transaction.
type ConstructionParseResponse ¶ added in v0.3.0
type ConstructionParseResponse struct { Operations []*Operation `json:"operations"` // All signers of a particular transaction. If the transaction is unsigned, it should be empty. Signers []string `json:"signers"` Metadata map[string]interface{} `json:"metadata,omitempty"` }
ConstructionParseResponse 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`.
type ConstructionPayloadsRequest ¶ added in v0.3.0
type ConstructionPayloadsRequest struct { NetworkIdentifier *NetworkIdentifier `json:"network_identifier"` Operations []*Operation `json:"operations"` Metadata map[string]interface{} `json:"metadata,omitempty"` }
ConstructionPayloadsRequest 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`.
type ConstructionPayloadsResponse ¶ added in v0.3.0
type ConstructionPayloadsResponse struct { UnsignedTransaction string `json:"unsigned_transaction"` Payloads []*SigningPayload `json:"payloads"` }
ConstructionPayloadsResponse 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.
type ConstructionPreprocessRequest ¶ added in v0.3.0
type ConstructionPreprocessRequest struct { NetworkIdentifier *NetworkIdentifier `json:"network_identifier"` Operations []*Operation `json:"operations"` Metadata map[string]interface{} `json:"metadata,omitempty"` }
ConstructionPreprocessRequest ConstructionPreprocessRequest is passed to the `/construction/preprocess` endpoint so that a Rosetta implementation can determine which metadata it needs to request for construction.
type ConstructionPreprocessResponse ¶ added in v0.3.0
type ConstructionPreprocessResponse struct { // The options that will be sent directly to `/construction/metadata` by the caller. Options map[string]interface{} `json:"options,omitempty"` }
ConstructionPreprocessResponse ConstructionPreprocessResponse contains the request that will be sent directly to `/construction/metadata`. If it is not necessary to make a request to `/construction/metadata`, options should be null.
type ConstructionSubmitRequest ¶ added in v0.1.2
type ConstructionSubmitRequest struct { NetworkIdentifier *NetworkIdentifier `json:"network_identifier"` SignedTransaction string `json:"signed_transaction"` }
ConstructionSubmitRequest The transaction submission request includes a signed transaction.
type ConstructionSubmitResponse ¶ added in v0.1.2
type ConstructionSubmitResponse struct { TransactionIdentifier *TransactionIdentifier `json:"transaction_identifier"` Metadata map[string]interface{} `json:"metadata,omitempty"` }
ConstructionSubmitResponse A TransactionSubmitResponse contains the transaction_identifier of a submitted transaction that was accepted into the mempool.
type Currency ¶
type Currency struct { // Canonical symbol associated with a currency. Symbol string `json:"symbol"` // 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 `json:"decimals"` // 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 map[string]interface{} `json:"metadata,omitempty"` }
Currency 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).
type CurveType ¶ added in v0.3.0
type CurveType string
CurveType 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) * edwards25519: `y (255-bits) || x-sign-bit (1-bit)` - `32 bytes` (https://ed25519.cr.yp.to/ed25519-20110926.pdf)
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 `json:"code"` // Message is a network-specific error message. Message string `json:"message"` // An error is retriable if the same request may succeed if submitted again. Retriable bool `json:"retriable"` // 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 map[string]interface{} `json:"details,omitempty"` }
Error 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.
type MempoolResponse ¶
type MempoolResponse struct {
TransactionIdentifiers []*TransactionIdentifier `json:"transaction_identifiers"`
}
MempoolResponse A MempoolResponse contains all transaction identifiers in the mempool for a particular network_identifier.
type MempoolTransactionRequest ¶
type MempoolTransactionRequest struct { NetworkIdentifier *NetworkIdentifier `json:"network_identifier"` TransactionIdentifier *TransactionIdentifier `json:"transaction_identifier"` }
MempoolTransactionRequest A MempoolTransactionRequest is utilized to retrieve a transaction from the mempool.
type MempoolTransactionResponse ¶
type MempoolTransactionResponse struct { Transaction *Transaction `json:"transaction"` Metadata map[string]interface{} `json:"metadata,omitempty"` }
MempoolTransactionResponse 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).
type MetadataRequest ¶ added in v0.1.2
type MetadataRequest struct {
Metadata map[string]interface{} `json:"metadata,omitempty"`
}
MetadataRequest A MetadataRequest is utilized in any request where the only argument is optional metadata.
type NetworkIdentifier ¶
type NetworkIdentifier struct { Blockchain string `json:"blockchain"` // 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 `json:"network"` SubNetworkIdentifier *SubNetworkIdentifier `json:"sub_network_identifier,omitempty"` }
NetworkIdentifier The network_identifier specifies which network a particular object is associated with.
type NetworkListResponse ¶ added in v0.1.2
type NetworkListResponse struct {
NetworkIdentifiers []*NetworkIdentifier `json:"network_identifiers"`
}
NetworkListResponse A NetworkListResponse contains all NetworkIdentifiers that the node can serve information for.
type NetworkOptionsResponse ¶ added in v0.1.2
type NetworkOptionsResponse struct { Version *Version `json:"version"` Allow *Allow `json:"allow"` }
NetworkOptionsResponse NetworkOptionsResponse contains information about the versioning of the node and the allowed operation statuses, operation types, and errors.
type NetworkRequest ¶ added in v0.1.2
type NetworkRequest struct { NetworkIdentifier *NetworkIdentifier `json:"network_identifier"` Metadata map[string]interface{} `json:"metadata,omitempty"` }
NetworkRequest A NetworkRequest is utilized to retrieve some data specific exclusively to a NetworkIdentifier.
type NetworkStatusResponse ¶
type NetworkStatusResponse struct { CurrentBlockIdentifier *BlockIdentifier `json:"current_block_identifier"` // 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. CurrentBlockTimestamp int64 `json:"current_block_timestamp"` GenesisBlockIdentifier *BlockIdentifier `json:"genesis_block_identifier"` OldestBlockIdentifier *BlockIdentifier `json:"oldest_block_identifier,omitempty"` Peers []*Peer `json:"peers"` }
NetworkStatusResponse NetworkStatusResponse contains basic information about the node's view of a blockchain network. 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.
type Operation ¶
type Operation struct { OperationIdentifier *OperationIdentifier `json:"operation_identifier"` // Restrict referenced related_operations to identifier indexes < 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 `json:"related_operations,omitempty"` // The network-specific type of the operation. Ensure that any type that can be returned here is // also specified in the NetworkStatus. This can be very useful to downstream consumers that // parse all block data. Type string `json:"type"` // 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. // Blockchains with atomic transactions (all operations succeed or all operations fail) will // have the same status for each operation. Status string `json:"status"` Account *AccountIdentifier `json:"account,omitempty"` Amount *Amount `json:"amount,omitempty"` Metadata map[string]interface{} `json:"metadata,omitempty"` }
Operation 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.
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 `json:"index"` // 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 *int64 `json:"network_index,omitempty"` }
OperationIdentifier The operation_identifier uniquely identifies an operation within a transaction.
type OperationStatus ¶
type OperationStatus struct { // The status is the network-specific status of the operation. Status string `json:"status"` // 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 `json:"successful"` }
OperationStatus OperationStatus is utilized to indicate which Operation status are considered successful.
type PartialBlockIdentifier ¶
type PartialBlockIdentifier struct { Index *int64 `json:"index,omitempty"` Hash *string `json:"hash,omitempty"` }
PartialBlockIdentifier 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 ConstructPartialBlockIdentifier ¶ added in v0.1.2
func ConstructPartialBlockIdentifier( blockIdentifier *BlockIdentifier, ) *PartialBlockIdentifier
ConstructPartialBlockIdentifier constructs a *PartialBlockIdentifier from a *BlockIdentifier.
It is useful to have this helper when making block requests with the fetcher.
type Peer ¶
type Peer struct { PeerID string `json:"peer_id"` Metadata map[string]interface{} `json:"metadata,omitempty"` }
Peer A Peer is a representation of a node's peer.
type PublicKey ¶ added in v0.3.0
PublicKey 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) MarshalJSON ¶ added in v0.3.0
MarshalJSON overrides the default JSON marshaler and encodes bytes as hex instead of base64.
func (*PublicKey) UnmarshalJSON ¶ added in v0.3.0
UnmarshalJSON overrides the default JSON unmarshaler and decodes bytes from hex instead of base64.
type Signature ¶ added in v0.3.0
type Signature struct { SigningPayload *SigningPayload `json:"signing_payload"` PublicKey *PublicKey `json:"public_key"` SignatureType SignatureType `json:"signature_type"` Bytes []byte `json:"hex_bytes"` }
Signature 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) MarshalJSON ¶ added in v0.3.0
MarshalJSON overrides the default JSON marshaler and encodes bytes as hex instead of base64.
func (*Signature) UnmarshalJSON ¶ added in v0.3.0
UnmarshalJSON overrides the default JSON unmarshaler and decodes bytes from hex instead of base64.
type SignatureType ¶ added in v0.3.0
type SignatureType string
SignatureType 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`
const ( Ecdsa SignatureType = "ecdsa" EcdsaRecovery SignatureType = "ecdsa_recovery" Ed25519 SignatureType = "ed25519" )
List of SignatureType
type SigningPayload ¶ added in v0.3.0
type SigningPayload struct { // The network-specific address of the account that should sign the payload. Address string `json:"address"` Bytes []byte `json:"hex_bytes"` SignatureType SignatureType `json:"signature_type,omitempty"` }
SigningPayload SigningPayload is signed by the client with the keypair associated with an address 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) MarshalJSON ¶ added in v0.3.0
func (s *SigningPayload) MarshalJSON() ([]byte, error)
MarshalJSON overrides the default JSON marshaler and encodes bytes as hex instead of base64.
func (*SigningPayload) UnmarshalJSON ¶ added in v0.3.0
func (s *SigningPayload) UnmarshalJSON(b []byte) error
UnmarshalJSON overrides the default JSON unmarshaler and decodes bytes from hex instead of base64.
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 `json:"address"` // 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 map[string]interface{} `json:"metadata,omitempty"` }
SubAccountIdentifier 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.
type SubNetworkIdentifier ¶
type SubNetworkIdentifier struct { Network string `json:"network"` Metadata map[string]interface{} `json:"metadata,omitempty"` }
SubNetworkIdentifier 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.
type Transaction ¶
type Transaction struct { TransactionIdentifier *TransactionIdentifier `json:"transaction_identifier"` Operations []*Operation `json:"operations"` // Transactions that are related to other transactions (like a cross-shard transaction) should // include the tranaction_identifier of these transactions in the metadata. Metadata map[string]interface{} `json:"metadata,omitempty"` }
Transaction Transactions contain an array of Operations that are attributable to the same TransactionIdentifier.
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 `json:"hash"` }
TransactionIdentifier The transaction_identifier uniquely identifies a transaction in a particular network and block or in the mempool.
type Version ¶
type Version struct { // 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 `json:"rosetta_version"` // The node_version is the canonical version of the node runtime. This can help clients manage // deployments. NodeVersion string `json:"node_version"` // 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 *string `json:"middleware_version,omitempty"` // Any other information that may be useful about versioning of dependent services should be // returned here. Metadata map[string]interface{} `json:"metadata,omitempty"` }
Version The Version object is utilized to inform the client of the versions of different components of the Rosetta implementation.
Source Files
¶
- account_balance_request.go
- account_balance_response.go
- account_identifier.go
- allow.go
- amount.go
- block.go
- block_identifier.go
- block_request.go
- block_response.go
- block_transaction_request.go
- block_transaction_response.go
- construction_combine_request.go
- construction_combine_response.go
- construction_derive_request.go
- construction_derive_response.go
- construction_hash_request.go
- construction_hash_response.go
- construction_metadata_request.go
- construction_metadata_response.go
- construction_parse_request.go
- construction_parse_response.go
- construction_payloads_request.go
- construction_payloads_response.go
- construction_preprocess_request.go
- construction_preprocess_response.go
- construction_submit_request.go
- construction_submit_response.go
- currency.go
- curve_type.go
- error.go
- mempool_response.go
- mempool_transaction_request.go
- mempool_transaction_response.go
- metadata_request.go
- network_identifier.go
- network_list_response.go
- network_options_response.go
- network_request.go
- network_status_response.go
- operation.go
- operation_identifier.go
- operation_status.go
- partial_block_identifier.go
- peer.go
- public_key.go
- signature.go
- signature_type.go
- signing_payload.go
- sub_account_identifier.go
- sub_network_identifier.go
- transaction.go
- transaction_identifier.go
- utils.go
- version.go