Documentation ¶
Index ¶
- Constants
- Variables
- func ConstructTransaction(components *OperationComponents, metadata *ConstructMetadata, ...) (response hmyTypes.PoolTransaction, rosettaError *types.Error)
- func FormatCrossShardReceiverTransaction(cxReceipt *hmytypes.CXReceipt) (txs *types.Transaction, rosettaError *types.Error)
- func FormatTransaction(tx hmytypes.PoolTransaction, receipt *hmytypes.Receipt, ...) (fmtTx *types.Transaction, rosettaError *types.Error)
- func GetNativeOperationsFromStakingTransaction(tx *stakingTypes.StakingTransaction, receipt *hmytypes.Receipt, signed bool) ([]*types.Operation, *types.Error)
- func GetNativeOperationsFromTransaction(tx *hmytypes.Transaction, receipt *hmytypes.Receipt, ...) ([]*types.Operation, *types.Error)
- func GetSideEffectOperationsFromGenesisSpec(spec *core.Genesis, startingOperationIndex *int64) ([]*types.Operation, *types.Error)
- func GetSideEffectOperationsFromPreStakingRewards(rewards hmy.PreStakingBlockRewards, startingOperationIndex *int64) ([]*types.Operation, *types.Error)
- func GetTransactionStatus(tx hmytypes.PoolTransaction, receipt *hmytypes.Receipt) *string
- func NewAccountAPI(hmy *hmy.Harmony) server.AccountAPIServicer
- func NewBlockAPI(hmy *hmy.Harmony) server.BlockAPIServicer
- func NewCallAPIService(hmy *hmy.Harmony, limiterEnable bool, rateLimit int) server.CallAPIServicer
- func NewConstructionAPI(hmy *hmy.Harmony) server.ConstructionAPIServicer
- func NewMempoolAPI(hmy *hmy.Harmony) server.MempoolAPIServicer
- func NewNetworkAPI(hmy *hmy.Harmony) server.NetworkAPIServicer
- type AccountAPI
- type AccountMetadata
- type BlockAPI
- type BlockMetadata
- type CallAPIService
- type CallRequest
- type ConstructAPI
- func (s *ConstructAPI) ConstructionCombine(ctx context.Context, request *types.ConstructionCombineRequest) (*types.ConstructionCombineResponse, *types.Error)
- func (s *ConstructAPI) ConstructionDerive(ctx context.Context, request *types.ConstructionDeriveRequest) (*types.ConstructionDeriveResponse, *types.Error)
- func (s *ConstructAPI) ConstructionHash(ctx context.Context, request *types.ConstructionHashRequest) (*types.TransactionIdentifierResponse, *types.Error)
- func (s *ConstructAPI) ConstructionMetadata(ctx context.Context, request *types.ConstructionMetadataRequest) (*types.ConstructionMetadataResponse, *types.Error)
- func (s *ConstructAPI) ConstructionParse(ctx context.Context, request *types.ConstructionParseRequest) (*types.ConstructionParseResponse, *types.Error)
- func (s *ConstructAPI) ConstructionPayloads(ctx context.Context, request *types.ConstructionPayloadsRequest) (*types.ConstructionPayloadsResponse, *types.Error)
- func (s *ConstructAPI) ConstructionPreprocess(ctx context.Context, request *types.ConstructionPreprocessRequest) (*types.ConstructionPreprocessResponse, *types.Error)
- func (s *ConstructAPI) ConstructionSubmit(ctx context.Context, request *types.ConstructionSubmitRequest) (*types.TransactionIdentifierResponse, *types.Error)
- type ConstructMetadata
- type ConstructMetadataOptions
- type ContractInfo
- type EventAPI
- type GetAllValidatorInformationByBlockNumberRequest
- type GetAllValidatorInformationRequest
- type GetCodeRequest
- type GetDelegationByDelegatorAddrAndBlockNumRequest
- type GetDelegationsByDelegatorAddrRequest
- type GetDelegationsByValidatorRequest
- type GetStorageAtRequest
- type GetValidatorInformationRequest
- type MempoolAPI
- type NetworkAPI
- func (s *NetworkAPI) NetworkList(ctx context.Context, request *types.MetadataRequest) (*types.NetworkListResponse, *types.Error)
- func (s *NetworkAPI) NetworkOptions(ctx context.Context, request *types.NetworkRequest) (*types.NetworkOptionsResponse, *types.Error)
- func (s *NetworkAPI) NetworkStatus(ctx context.Context, request *types.NetworkRequest) (*types.NetworkStatusResponse, *types.Error)
- type OperationComponents
- type SearchAPI
- type TransactionMetadata
- type WrappedTransaction
Constants ¶
const ( SubAccountMetadataKey = "type" Delegation = "delegation" UnDelegation = "undelegation" UndelegationPayout = "UndelegationPayout" )
const ( // DefaultGasPrice .. DefaultGasPrice = 30 * denominations.Nano )
const ( // SideEffectTransactionSuffix is use in the transaction identifier for each block that contains // side-effect operations. SideEffectTransactionSuffix = "side_effect" )
const (
// SignedPayloadLength is the required length of the ECDSA payload
SignedPayloadLength = 65
)
Variables ¶
var CallMethod = []string{
"hmyv2_call",
"hmyv2_getCode",
"hmyv2_getStorageAt",
"hmyv2_getDelegationsByDelegator",
"hmyv2_getDelegationsByDelegatorByBlockNumber",
"hmyv2_getDelegationsByValidator",
"hmyv2_getAllValidatorAddresses",
"hmyv2_getAllValidatorInformation",
"hmyv2_getAllValidatorInformationByBlockNumber",
"hmyv2_getElectedValidatorAddresses",
"hmyv2_getValidatorInformation",
"hmyv2_getCurrentUtilityMetrics",
"hmyv2_getMedianRawStakeSnapshot",
"hmyv2_getStakingNetworkInfo",
"hmyv2_getSuperCommittees",
}
var ( // FormatDefaultSenderAddress .. FormatDefaultSenderAddress = ethcommon.HexToAddress("0xEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE") )
Functions ¶
func ConstructTransaction ¶
func ConstructTransaction( components *OperationComponents, metadata *ConstructMetadata, sourceShardID uint32, ) (response hmyTypes.PoolTransaction, rosettaError *types.Error)
ConstructTransaction object (unsigned).
func FormatCrossShardReceiverTransaction ¶
func FormatCrossShardReceiverTransaction( cxReceipt *hmytypes.CXReceipt, ) (txs *types.Transaction, rosettaError *types.Error)
FormatCrossShardReceiverTransaction for cross-shard payouts on destination shard
func FormatTransaction ¶
func FormatTransaction( tx hmytypes.PoolTransaction, receipt *hmytypes.Receipt, contractInfo *ContractInfo, signed bool, ) (fmtTx *types.Transaction, rosettaError *types.Error)
FormatTransaction for staking, cross-shard sender, and plain transactions
func GetNativeOperationsFromStakingTransaction ¶
func GetNativeOperationsFromStakingTransaction( tx *stakingTypes.StakingTransaction, receipt *hmytypes.Receipt, signed bool, ) ([]*types.Operation, *types.Error)
GetNativeOperationsFromStakingTransaction for all staking directives Note that only native token operations can come from staking transactions.
func GetNativeOperationsFromTransaction ¶
func GetNativeOperationsFromTransaction( tx *hmytypes.Transaction, receipt *hmytypes.Receipt, contractInfo *ContractInfo, ) ([]*types.Operation, *types.Error)
GetNativeOperationsFromTransaction for one of the following transactions: contract creation, cross-shard sender, same-shard transfer with and without code execution. Native operations only include operations that affect the native currency balance of an account.
func GetSideEffectOperationsFromGenesisSpec ¶
func GetSideEffectOperationsFromGenesisSpec( spec *core.Genesis, startingOperationIndex *int64, ) ([]*types.Operation, *types.Error)
GetSideEffectOperationsFromGenesisSpec for the given spec. If the startingOperationIndex is provided, all operations will be indexed starting from the given operation index.
func GetSideEffectOperationsFromPreStakingRewards ¶
func GetSideEffectOperationsFromPreStakingRewards( rewards hmy.PreStakingBlockRewards, startingOperationIndex *int64, ) ([]*types.Operation, *types.Error)
GetSideEffectOperationsFromPreStakingRewards from the given rewards. If the startingOperationIndex is provided, all operations will be indexed starting from the given operation index.
func GetTransactionStatus ¶
func GetTransactionStatus(tx hmytypes.PoolTransaction, receipt *hmytypes.Receipt) *string
GetTransactionStatus for any valid harmony transaction given its receipt.
func NewAccountAPI ¶
func NewAccountAPI(hmy *hmy.Harmony) server.AccountAPIServicer
NewAccountAPI creates a new instance of a BlockAPI.
func NewBlockAPI ¶
func NewBlockAPI(hmy *hmy.Harmony) server.BlockAPIServicer
NewBlockAPI creates a new instance of a BlockAPI.
func NewCallAPIService ¶
func NewConstructionAPI ¶
func NewConstructionAPI(hmy *hmy.Harmony) server.ConstructionAPIServicer
NewConstructionAPI creates a new instance of a ConstructAPI.
func NewMempoolAPI ¶
func NewMempoolAPI(hmy *hmy.Harmony) server.MempoolAPIServicer
NewMempoolAPI creates a new instance of MempoolAPI
func NewNetworkAPI ¶
func NewNetworkAPI(hmy *hmy.Harmony) server.NetworkAPIServicer
NewNetworkAPI creates a new instance of a NetworkAPI.
Types ¶
type AccountAPI ¶
type AccountAPI struct {
// contains filtered or unexported fields
}
AccountAPI implements the server.AccountAPIServicer interface.
func (*AccountAPI) AccountBalance ¶
func (s *AccountAPI) AccountBalance( ctx context.Context, request *types.AccountBalanceRequest, ) (*types.AccountBalanceResponse, *types.Error)
AccountBalance implements the /account/balance endpoint
func (*AccountAPI) AccountCoins ¶
func (s *AccountAPI) AccountCoins(ctx context.Context, request *types.AccountCoinsRequest) (*types.AccountCoinsResponse, *types.Error)
type AccountMetadata ¶
type AccountMetadata struct {
Address string `json:"hex_address"`
}
AccountMetadata used for account identifiers
type BlockAPI ¶
type BlockAPI struct {
// contains filtered or unexported fields
}
BlockAPI implements the server.BlockAPIServicer interface.
func (*BlockAPI) Block ¶
func (s *BlockAPI) Block( ctx context.Context, request *types.BlockRequest, ) (response *types.BlockResponse, rosettaError *types.Error)
Block implements the /block endpoint
func (*BlockAPI) BlockTransaction ¶
func (s *BlockAPI) BlockTransaction( ctx context.Context, request *types.BlockTransactionRequest, ) (*types.BlockTransactionResponse, *types.Error)
BlockTransaction implements the /block/transaction endpoint
type CallAPIService ¶
type CallAPIService struct {
// contains filtered or unexported fields
}
func (*CallAPIService) Call ¶
func (c *CallAPIService) Call( ctx context.Context, request *types.CallRequest, ) (*types.CallResponse, *types.Error)
Call implements the /call endpoint.
type CallRequest ¶
func (*CallRequest) UnmarshalFromInterface ¶
func (cr *CallRequest) UnmarshalFromInterface(args interface{}) error
type ConstructAPI ¶
type ConstructAPI struct {
// contains filtered or unexported fields
}
ConstructAPI implements the server.ConstructAPIServicer interface.
func (*ConstructAPI) ConstructionCombine ¶
func (s *ConstructAPI) ConstructionCombine( ctx context.Context, request *types.ConstructionCombineRequest, ) (*types.ConstructionCombineResponse, *types.Error)
ConstructionCombine implements the /construction/combine endpoint.
func (*ConstructAPI) ConstructionDerive ¶
func (s *ConstructAPI) ConstructionDerive( ctx context.Context, request *types.ConstructionDeriveRequest, ) (*types.ConstructionDeriveResponse, *types.Error)
ConstructionDerive implements the /construction/derive endpoint.
func (*ConstructAPI) ConstructionHash ¶
func (s *ConstructAPI) ConstructionHash( ctx context.Context, request *types.ConstructionHashRequest, ) (*types.TransactionIdentifierResponse, *types.Error)
ConstructionHash implements the /construction/hash endpoint.
func (*ConstructAPI) ConstructionMetadata ¶
func (s *ConstructAPI) ConstructionMetadata( ctx context.Context, request *types.ConstructionMetadataRequest, ) (*types.ConstructionMetadataResponse, *types.Error)
ConstructionMetadata implements the /construction/metadata endpoint.
func (*ConstructAPI) ConstructionParse ¶
func (s *ConstructAPI) ConstructionParse( ctx context.Context, request *types.ConstructionParseRequest, ) (*types.ConstructionParseResponse, *types.Error)
ConstructionParse implements the /construction/parse endpoint.
func (*ConstructAPI) ConstructionPayloads ¶
func (s *ConstructAPI) ConstructionPayloads( ctx context.Context, request *types.ConstructionPayloadsRequest, ) (*types.ConstructionPayloadsResponse, *types.Error)
ConstructionPayloads implements the /construction/payloads endpoint.
func (*ConstructAPI) ConstructionPreprocess ¶
func (s *ConstructAPI) ConstructionPreprocess( ctx context.Context, request *types.ConstructionPreprocessRequest, ) (*types.ConstructionPreprocessResponse, *types.Error)
ConstructionPreprocess implements the /construction/preprocess endpoint. Note that `request.MaxFee` is never considered for this construction implementation.
func (*ConstructAPI) ConstructionSubmit ¶
func (s *ConstructAPI) ConstructionSubmit( ctx context.Context, request *types.ConstructionSubmitRequest, ) (*types.TransactionIdentifierResponse, *types.Error)
ConstructionSubmit implements the /construction/submit endpoint.
type ConstructMetadata ¶
type ConstructMetadata struct { Nonce uint64 `json:"nonce"` GasLimit uint64 `json:"gas_limit"` GasPrice *big.Int `json:"gas_price"` ContractCode hexutil.Bytes `json:"contract_code"` EvmReturn hexutil.Bytes `json:"evm_return"` EvmErrorMessage string `json:"evm_error_message"` Transaction *TransactionMetadata `json:"transaction_metadata"` }
ConstructMetadata with a set of operations will construct a valid transaction
func (*ConstructMetadata) UnmarshalFromInterface ¶
func (m *ConstructMetadata) UnmarshalFromInterface(blockArgs interface{}) error
UnmarshalFromInterface ..
type ConstructMetadataOptions ¶
type ConstructMetadataOptions struct { TransactionMetadata *TransactionMetadata `json:"transaction_metadata"` OperationType string `json:"operation_type,omitempty"` GasPriceMultiplier *float64 `json:"gas_price_multiplier,omitempty"` }
ConstructMetadataOptions is constructed by ConstructionPreprocess for ConstructionMetadata options
func (*ConstructMetadataOptions) UnmarshalFromInterface ¶
func (m *ConstructMetadataOptions) UnmarshalFromInterface(metadata interface{}) error
UnmarshalFromInterface ..
type ContractInfo ¶
type ContractInfo struct { // ContractAddress is the address of the primary (or first) contract related to the tx. ContractAddress *ethcommon.Address `json:"contract_hex_address"` // ContractCode is the code of the primary (or first) contract related to the tx. ContractCode []byte `json:"contract_code"` ExecutionResult []*tracers.RosettaLogItem `json:"execution_result"` }
ContractInfo contains all relevant data for formatting/inspecting transactions involving contracts
type EventAPI ¶
type EventAPI struct {
// contains filtered or unexported fields
}
EventAPI implements the server.EventsAPIServicer interface.
func NewEventAPI ¶
func (*EventAPI) EventsBlocks ¶
func (e *EventAPI) EventsBlocks(ctx context.Context, request *types.EventsBlocksRequest) (resp *types.EventsBlocksResponse, err *types.Error)
EventsBlocks implements the /events/blocks endpoint
type GetAllValidatorInformationByBlockNumberRequest ¶
type GetAllValidatorInformationByBlockNumberRequest struct { PageNumber int `json:"page_number"` BlockNumber int64 `json:"block_number"` }
func (*GetAllValidatorInformationByBlockNumberRequest) UnmarshalFromInterface ¶
func (r *GetAllValidatorInformationByBlockNumberRequest) UnmarshalFromInterface(args interface{}) error
type GetAllValidatorInformationRequest ¶
type GetAllValidatorInformationRequest struct {
PageNumber int `json:"page_number"`
}
func (*GetAllValidatorInformationRequest) UnmarshalFromInterface ¶
func (r *GetAllValidatorInformationRequest) UnmarshalFromInterface(args interface{}) error
type GetCodeRequest ¶
func (*GetCodeRequest) UnmarshalFromInterface ¶
func (cr *GetCodeRequest) UnmarshalFromInterface(args interface{}) error
type GetDelegationByDelegatorAddrAndBlockNumRequest ¶
type GetDelegationByDelegatorAddrAndBlockNumRequest struct { DelegatorAddr string `json:"delegator_addr"` BlockNum int64 `json:"block_num"` }
func (*GetDelegationByDelegatorAddrAndBlockNumRequest) UnmarshalFromInterface ¶
func (r *GetDelegationByDelegatorAddrAndBlockNumRequest) UnmarshalFromInterface(args interface{}) error
type GetDelegationsByDelegatorAddrRequest ¶
type GetDelegationsByDelegatorAddrRequest struct {
DelegatorAddr string `json:"delegator_addr"`
}
func (*GetDelegationsByDelegatorAddrRequest) UnmarshalFromInterface ¶
func (r *GetDelegationsByDelegatorAddrRequest) UnmarshalFromInterface(args interface{}) error
type GetDelegationsByValidatorRequest ¶
type GetDelegationsByValidatorRequest struct {
ValidatorAddr string `json:"validator_addr"`
}
func (*GetDelegationsByValidatorRequest) UnmarshalFromInterface ¶
func (r *GetDelegationsByValidatorRequest) UnmarshalFromInterface(args interface{}) error
type GetStorageAtRequest ¶
type GetStorageAtRequest struct { Addr string `json:"addr"` Key string `json:"key"` BlockNum int64 `json:"block_num"` }
func (*GetStorageAtRequest) UnmarshalFromInterface ¶
func (sr *GetStorageAtRequest) UnmarshalFromInterface(args interface{}) error
type GetValidatorInformationRequest ¶
type GetValidatorInformationRequest struct {
ValidatorAddr string `json:"validator_addr"`
}
func (*GetValidatorInformationRequest) UnmarshalFromInterface ¶
func (r *GetValidatorInformationRequest) UnmarshalFromInterface(args interface{}) error
type MempoolAPI ¶
type MempoolAPI struct {
// contains filtered or unexported fields
}
MempoolAPI implements the server.MempoolAPIServicer interface
func (*MempoolAPI) Mempool ¶
func (s *MempoolAPI) Mempool( ctx context.Context, req *types.NetworkRequest, ) (*types.MempoolResponse, *types.Error)
Mempool implements the /mempool endpoint.
func (*MempoolAPI) MempoolTransaction ¶
func (s *MempoolAPI) MempoolTransaction( ctx context.Context, req *types.MempoolTransactionRequest, ) (*types.MempoolTransactionResponse, *types.Error)
MempoolTransaction implements the /mempool/transaction endpoint.
type NetworkAPI ¶
type NetworkAPI struct {
// contains filtered or unexported fields
}
NetworkAPI implements the server.NetworkAPIServicer interface.
func (*NetworkAPI) NetworkList ¶
func (s *NetworkAPI) NetworkList( ctx context.Context, request *types.MetadataRequest, ) (*types.NetworkListResponse, *types.Error)
NetworkList implements the /network/list endpoint TODO (dm): Update Node API to support multiple shards...
func (*NetworkAPI) NetworkOptions ¶
func (s *NetworkAPI) NetworkOptions( ctx context.Context, request *types.NetworkRequest, ) (*types.NetworkOptionsResponse, *types.Error)
NetworkOptions implements the /network/options endpoint
func (*NetworkAPI) NetworkStatus ¶
func (s *NetworkAPI) NetworkStatus( ctx context.Context, request *types.NetworkRequest, ) (*types.NetworkStatusResponse, *types.Error)
NetworkStatus implements the /network/status endpoint
type OperationComponents ¶
type OperationComponents struct { Type string `json:"type"` From *types.AccountIdentifier `json:"from"` To *types.AccountIdentifier `json:"to"` Amount *big.Int `json:"amount"` StakingMessage interface{} `json:"staking_message,omitempty"` }
OperationComponents are components from a set of operations to construct a valid transaction
func GetOperationComponents ¶
func GetOperationComponents( operations []*types.Operation, ) (*OperationComponents, *types.Error)
GetOperationComponents ensures the provided operations creates a valid transaction and returns the OperationComponents of the resulting transaction.
Providing a gas expenditure operation is INVALID. All staking & cross-shard operations require metadata matching the operation type to be a valid. All other operations do not require metadata.
type SearchAPI ¶
type SearchAPI struct {
// contains filtered or unexported fields
}
SearchAPI implements the server.SearchAPIServicer interface.
func NewSearchAPI ¶
func (*SearchAPI) SearchTransactions ¶
func (s *SearchAPI) SearchTransactions(ctx context.Context, request *types.SearchTransactionsRequest) (resp *types.SearchTransactionsResponse, err *types.Error)
SearchTransactions implements the /search/transactions endpoint
type TransactionMetadata ¶
type TransactionMetadata struct { // CrossShardIdentifier is the transaction identifier on the from/source shard CrossShardIdentifier *types.TransactionIdentifier `json:"cross_shard_transaction_identifier,omitempty"` ToShardID *uint32 `json:"to_shard,omitempty"` FromShardID *uint32 `json:"from_shard,omitempty"` // ContractAccountIdentifier is the 'main' contract account ID associated with a transaction ContractAccountIdentifier *types.AccountIdentifier `json:"contract_account_identifier,omitempty"` Data *string `json:"data,omitempty"` Logs []*hmyTypes.Log `json:"logs,omitempty"` // SlotPubKeys SlotPubKeyToAdd SlotPubKeyToRemove are all hex representation of bls public key SlotPubKeys []string `json:"slot_pub_keys,omitempty"` SlotKeySigs []string `json:"slot_key_sigs,omitempty"` SlotKeyToAddSig string `json:"slot_key_to_add_sig,omitempty"` SlotPubKeyToAdd string `json:"slot_pub_key_to_add,omitempty"` SlotPubKeyToRemove string `json:"slot_pub_key_to_remove,omitempty"` }
TransactionMetadata contains all (optional) information for a transaction.
func (*TransactionMetadata) UnmarshalFromInterface ¶
func (t *TransactionMetadata) UnmarshalFromInterface(metaData interface{}) error
UnmarshalFromInterface ..
type WrappedTransaction ¶
type WrappedTransaction struct { RLPBytes []byte `json:"rlp_bytes"` IsStaking bool `json:"is_staking"` ContractCode hexutil.Bytes `json:"contract_code"` From *types.AccountIdentifier `json:"from"` }
WrappedTransaction is a wrapper for a transaction that includes all relevant data to parse a transaction.