Documentation ¶
Index ¶
- Constants
- Variables
- func DoEVMCall(ctx context.Context, hmy *hmy.Harmony, args CallArgs, blockNum rpc.BlockNumber, ...) (core.ExecutionResult, error)
- func EstimateGas(ctx context.Context, hmy *hmy.Harmony, args CallArgs, gasCap *big.Int) (uint64, error)
- func NewPrivateDebugAPI(hmy *hmy.Harmony, version Version) rpc.API
- func NewPublicBlockchainAPI(hmy *hmy.Harmony, version Version) rpc.API
- func NewPublicContractAPI(hmy *hmy.Harmony, version Version) rpc.API
- func NewPublicHarmonyAPI(hmy *hmy.Harmony, version Version) rpc.API
- func NewPublicNetAPI(net p2p.Host, chainID uint64, version Version) rpc.API
- func NewPublicPoolAPI(hmy *hmy.Harmony, version Version) rpc.API
- func NewPublicStakingAPI(hmy *hmy.Harmony, version Version) rpc.API
- func NewPublicTracerAPI(hmy *hmy.Harmony, version Version) rpc.API
- func NewPublicTransactionAPI(hmy *hmy.Harmony, version Version) rpc.API
- func StartServers(hmy *hmy.Harmony, apis []rpc.API, config nodeconfig.RPCServerConfig) error
- func StopServers() error
- type BlockNumber
- type CallArgs
- type Delegation
- type HeaderInformation
- type PrivateDebugService
- func (s *PrivateDebugService) ConsensusCurViewID(ctx context.Context) uint64
- func (s *PrivateDebugService) ConsensusViewChangingID(ctx context.Context) uint64
- func (s *PrivateDebugService) GetConsensusMode(ctx context.Context) string
- func (s *PrivateDebugService) GetConsensusPhase(ctx context.Context) string
- func (s *PrivateDebugService) SetLogVerbosity(ctx context.Context, level int) (map[string]interface{}, error)
- type PublicBlockchainService
- func (s *PublicBlockchainService) BeaconInSync(ctx context.Context) (bool, error)
- func (s *PublicBlockchainService) BlockNumber(ctx context.Context) (interface{}, error)
- func (s *PublicBlockchainService) ChainId(ctx context.Context) (interface{}, error)
- func (s *PublicBlockchainService) EpochLastBlock(ctx context.Context, epoch uint64) (uint64, error)
- func (s *PublicBlockchainService) GetBalanceByBlockNumber(ctx context.Context, address string, blockNumber BlockNumber) (interface{}, error)
- func (s *PublicBlockchainService) GetBlockByHash(ctx context.Context, blockHash common.Hash, opts interface{}) (response StructuredResponse, err error)
- func (s *PublicBlockchainService) GetBlockByHashNew(ctx context.Context, blockHash common.Hash, blockArgs *rpc_common.BlockArgs) (StructuredResponse, error)
- func (s *PublicBlockchainService) GetBlockByNumber(ctx context.Context, blockNumber BlockNumber, opts interface{}) (response StructuredResponse, err error)
- func (s *PublicBlockchainService) GetBlockByNumberNew(ctx context.Context, blockNum BlockNumber, blockArgs *rpc_common.BlockArgs) (StructuredResponse, error)
- func (s *PublicBlockchainService) GetBlockSignerKeys(ctx context.Context, blockNumber BlockNumber) ([]string, error)
- func (s *PublicBlockchainService) GetBlockSigners(ctx context.Context, blockNumber BlockNumber) ([]string, error)
- func (s *PublicBlockchainService) GetBlocks(ctx context.Context, blockNumberStart BlockNumber, blockNumberEnd BlockNumber, ...) ([]StructuredResponse, error)
- func (s *PublicBlockchainService) GetCirculatingSupply(ctx context.Context) (numeric.Dec, error)
- func (s *PublicBlockchainService) GetCurrentBadBlocks(ctx context.Context) ([]StructuredResponse, error)
- func (s *PublicBlockchainService) GetCurrentUtilityMetrics(ctx context.Context) (StructuredResponse, error)
- func (s *PublicBlockchainService) GetEpoch(ctx context.Context) (interface{}, error)
- func (s *PublicBlockchainService) GetHeaderByNumber(ctx context.Context, blockNumber BlockNumber) (StructuredResponse, error)
- func (s *PublicBlockchainService) GetLastCrossLinks(ctx context.Context) ([]StructuredResponse, error)
- func (s *PublicBlockchainService) GetLatestChainHeaders(ctx context.Context) (StructuredResponse, error)
- func (s *PublicBlockchainService) GetLeader(ctx context.Context) (string, error)
- func (s *PublicBlockchainService) GetShardID(ctx context.Context) (int, error)
- func (s *PublicBlockchainService) GetShardingStructure(ctx context.Context) ([]StructuredResponse, error)
- func (s *PublicBlockchainService) GetSignedBlocks(ctx context.Context, address string) (interface{}, error)
- func (s *PublicBlockchainService) GetStakingNetworkInfo(ctx context.Context) (StructuredResponse, error)
- func (s *PublicBlockchainService) GetSuperCommittees(ctx context.Context) (StructuredResponse, error)
- func (s *PublicBlockchainService) GetTotalSupply(ctx context.Context) (numeric.Dec, error)
- func (s *PublicBlockchainService) InSync(ctx context.Context) (bool, error)
- func (s *PublicBlockchainService) IsBlockSigner(ctx context.Context, blockNumber BlockNumber, address string) (bool, error)
- func (s *PublicBlockchainService) IsLastBlock(ctx context.Context, blockNum uint64) (bool, error)
- func (s *PublicBlockchainService) LatestHeader(ctx context.Context) (StructuredResponse, error)
- type PublicContractService
- func (s *PublicContractService) Call(ctx context.Context, args CallArgs, blockNumber BlockNumber) (hexutil.Bytes, error)
- func (s *PublicContractService) GetCode(ctx context.Context, addr string, blockNumber BlockNumber) (hexutil.Bytes, error)
- func (s *PublicContractService) GetStorageAt(ctx context.Context, addr string, key string, blockNumber BlockNumber) (hexutil.Bytes, error)
- type PublicHarmonyService
- func (s *PublicHarmonyService) GasPrice(ctx context.Context) (interface{}, error)
- func (s *PublicHarmonyService) GetNodeMetadata(ctx context.Context) (StructuredResponse, error)
- func (s *PublicHarmonyService) GetPeerInfo(ctx context.Context) (StructuredResponse, error)
- func (s *PublicHarmonyService) ProtocolVersion(ctx context.Context) (interface{}, error)
- func (s *PublicHarmonyService) Syncing(ctx context.Context) (interface{}, error)
- type PublicNetService
- type PublicPoolService
- func (s *PublicPoolService) GetCurrentStakingErrorSink(ctx context.Context) ([]StructuredResponse, error)
- func (s *PublicPoolService) GetCurrentTransactionErrorSink(ctx context.Context) ([]StructuredResponse, error)
- func (s *PublicPoolService) GetPendingCXReceipts(ctx context.Context) ([]StructuredResponse, error)
- func (s *PublicPoolService) GetPoolStats(ctx context.Context) (StructuredResponse, error)
- func (s *PublicPoolService) PendingStakingTransactions(ctx context.Context) ([]StructuredResponse, error)
- func (s *PublicPoolService) PendingTransactions(ctx context.Context) ([]StructuredResponse, error)
- func (s *PublicPoolService) SendRawStakingTransaction(ctx context.Context, encodedTx hexutil.Bytes) (common.Hash, error)
- func (s *PublicPoolService) SendRawTransaction(ctx context.Context, encodedTx hexutil.Bytes) (common.Hash, error)
- type PublicStakingService
- func (s *PublicStakingService) GetAllDelegationInformation(ctx context.Context, page int) ([][]StructuredResponse, error)
- func (s *PublicStakingService) GetAllValidatorAddresses(ctx context.Context) ([]string, error)
- func (s *PublicStakingService) GetAllValidatorInformation(ctx context.Context, page int) ([]StructuredResponse, error)
- func (s *PublicStakingService) GetAllValidatorInformationByBlockNumber(ctx context.Context, page int, blockNumber BlockNumber) ([]StructuredResponse, error)
- func (s *PublicStakingService) GetAvailableRedelegationBalance(ctx context.Context, address string) (*big.Int, error)
- func (s *PublicStakingService) GetDelegationByDelegatorAndValidator(ctx context.Context, address string, validator string) (StructuredResponse, error)
- func (s *PublicStakingService) GetDelegationsByDelegator(ctx context.Context, address string) ([]StructuredResponse, error)
- func (s *PublicStakingService) GetDelegationsByDelegatorByBlockNumber(ctx context.Context, address string, blockNumber BlockNumber) ([]StructuredResponse, error)
- func (s *PublicStakingService) GetDelegationsByValidator(ctx context.Context, address string) ([]StructuredResponse, error)
- func (s *PublicStakingService) GetElectedValidatorAddresses(ctx context.Context) ([]string, error)
- func (s *PublicStakingService) GetMedianRawStakeSnapshot(ctx context.Context) (StructuredResponse, error)
- func (s *PublicStakingService) GetTotalStaking(ctx context.Context) (*big.Int, error)
- func (s *PublicStakingService) GetValidatorInformation(ctx context.Context, address string) (StructuredResponse, error)
- func (s *PublicStakingService) GetValidatorInformationByBlockNumber(ctx context.Context, address string, blockNumber BlockNumber) (StructuredResponse, error)
- func (s *PublicStakingService) GetValidatorKeys(ctx context.Context, epoch int64) ([]string, error)
- func (s *PublicStakingService) GetValidatorSelfDelegation(ctx context.Context, address string) (interface{}, error)
- func (s *PublicStakingService) GetValidatorTotalDelegation(ctx context.Context, address string) (interface{}, error)
- func (s *PublicStakingService) GetValidators(ctx context.Context, epoch int64) (StructuredResponse, error)
- type PublicTracerService
- func (s *PublicTracerService) TraceBlock(ctx context.Context, blob []byte, config *hmy.TraceConfig) ([]*hmy.TxTraceResult, error)
- func (s *PublicTracerService) TraceBlockByHash(ctx context.Context, hash common.Hash, config *hmy.TraceConfig) ([]*hmy.TxTraceResult, error)
- func (s *PublicTracerService) TraceBlockByNumber(ctx context.Context, number rpc.BlockNumber, config *hmy.TraceConfig) ([]*hmy.TxTraceResult, error)
- func (s *PublicTracerService) TraceCall(ctx context.Context, args CallArgs, blockNr rpc.BlockNumber, ...) (interface{}, error)
- func (s *PublicTracerService) TraceChain(ctx context.Context, start, end rpc.BlockNumber, config *hmy.TraceConfig) (*rpc.Subscription, error)
- func (s *PublicTracerService) TraceTransaction(ctx context.Context, hash common.Hash, config *hmy.TraceConfig) (interface{}, error)
- type PublicTransactionService
- func (s *PublicTransactionService) EstimateGas(ctx context.Context, args CallArgs) (hexutil.Uint64, error)
- func (s *PublicTransactionService) GetAccountNonce(ctx context.Context, address string, blockNumber BlockNumber) (uint64, error)
- func (s *PublicTransactionService) GetBlockStakingTransactionCountByHash(ctx context.Context, blockHash common.Hash) (interface{}, error)
- func (s *PublicTransactionService) GetBlockStakingTransactionCountByNumber(ctx context.Context, blockNumber BlockNumber) (interface{}, error)
- func (s *PublicTransactionService) GetBlockTransactionCountByHash(ctx context.Context, blockHash common.Hash) (interface{}, error)
- func (s *PublicTransactionService) GetBlockTransactionCountByNumber(ctx context.Context, blockNumber BlockNumber) (interface{}, error)
- func (s *PublicTransactionService) GetCXReceiptByHash(ctx context.Context, hash common.Hash) (StructuredResponse, error)
- func (s *PublicTransactionService) GetStakingTransactionByBlockHashAndIndex(ctx context.Context, blockHash common.Hash, index TransactionIndex) (StructuredResponse, error)
- func (s *PublicTransactionService) GetStakingTransactionByBlockNumberAndIndex(ctx context.Context, blockNumber BlockNumber, index TransactionIndex) (StructuredResponse, error)
- func (s *PublicTransactionService) GetStakingTransactionByHash(ctx context.Context, hash common.Hash) (StructuredResponse, error)
- func (s *PublicTransactionService) GetStakingTransactionsCount(ctx context.Context, address, txType string) (count uint64, err error)
- func (s *PublicTransactionService) GetStakingTransactionsHistory(ctx context.Context, args TxHistoryArgs) (StructuredResponse, error)
- func (s *PublicTransactionService) GetTransactionByBlockHashAndIndex(ctx context.Context, blockHash common.Hash, index TransactionIndex) (StructuredResponse, error)
- func (s *PublicTransactionService) GetTransactionByBlockNumberAndIndex(ctx context.Context, blockNumber BlockNumber, index TransactionIndex) (StructuredResponse, error)
- func (s *PublicTransactionService) GetTransactionByHash(ctx context.Context, hash common.Hash) (StructuredResponse, error)
- func (s *PublicTransactionService) GetTransactionCount(ctx context.Context, addr string, blockNumber BlockNumber) (response interface{}, err error)
- func (s *PublicTransactionService) GetTransactionReceipt(ctx context.Context, hash common.Hash) (StructuredResponse, error)
- func (s *PublicTransactionService) GetTransactionsCount(ctx context.Context, address, txType string) (count uint64, err error)
- func (s *PublicTransactionService) GetTransactionsHistory(ctx context.Context, args TxHistoryArgs) (StructuredResponse, error)
- func (s *PublicTransactionService) ResendCx(ctx context.Context, txID common.Hash) (bool, error)
- type StakingNetworkInfo
- type StructuredResponse
- type TransactionIndex
- type TxHistoryArgs
- type Undelegation
- type Version
Constants ¶
const ( // APIVersion used for DApp's, bumped after RPC refactor (7/2020) APIVersion = "1.1" // CallTimeout is the timeout given to all contract calls CallTimeout = 5 * time.Second // LogTag is the tag found in the log for all RPC logs LogTag = "[RPC]" // HTTPPortOffset .. HTTPPortOffset = 500 // WSPortOffset .. WSPortOffset = 800 )
Variables ¶
var ( // ErrInvalidLogLevel when invalid log level is provided ErrInvalidLogLevel = errors.New("invalid log level") // ErrIncorrectChainID when ChainID does not match running node ErrIncorrectChainID = errors.New("incorrect chain id") // ErrInvalidChainID when ChainID of signer does not match that of running node ErrInvalidChainID = errors.New("invalid chain id for signer") // ErrNotBeaconShard when rpc is called on not beacon chain node ErrNotBeaconShard = errors.New("cannot call this rpc on non beaconchain node") // ErrRequestedBlockTooHigh when given block is greater than latest block number ErrRequestedBlockTooHigh = errors.New("requested block number greater than current block number") // ErrUnknownRPCVersion when rpc method has an unknown or unhandled version ErrUnknownRPCVersion = errors.New("API service has an unknown version") // ErrTransactionNotFound when attempting to get a transaction that does not exist or has not been finalized ErrTransactionNotFound = errors.New("transaction not found") )
var ( // HTTPModules .. HTTPModules = []string{"hmy", "hmyv2", "eth", "debug", netNamespace, netV1Namespace, netV2Namespace, "explorer"} // WSModules .. WSModules = []string{"hmy", "hmyv2", "eth", "debug", netNamespace, netV1Namespace, netV2Namespace, "web3"} )
var ( // ErrNotAvailable to indicate the RPC is not ready for public use ErrNotAvailable = errors.New("RPC not available yet") )
Functions ¶
func DoEVMCall ¶
func DoEVMCall( ctx context.Context, hmy *hmy.Harmony, args CallArgs, blockNum rpc.BlockNumber, timeout time.Duration, ) (core.ExecutionResult, error)
DoEVMCall executes an EVM call
func EstimateGas ¶
func EstimateGas( ctx context.Context, hmy *hmy.Harmony, args CallArgs, gasCap *big.Int, ) (uint64, error)
EstimateGas .. TODO: fix contract creation gas estimation, it currently underestimates.
func NewPrivateDebugAPI ¶
NewPrivateDebugAPI creates a new API for the RPC interface TODO(dm): expose public via config
func NewPublicBlockchainAPI ¶
NewPublicBlockchainAPI creates a new API for the RPC interface
func NewPublicContractAPI ¶
NewPublicContractAPI creates a new API for the RPC interface
func NewPublicHarmonyAPI ¶
NewPublicHarmonyAPI creates a new API for the RPC interface
func NewPublicNetAPI ¶
NewPublicNetAPI creates a new net API instance.
func NewPublicPoolAPI ¶
NewPublicPoolAPI creates a new API for the RPC interface
func NewPublicStakingAPI ¶
NewPublicStakingAPI creates a new API for the RPC interface
func NewPublicTracerAPI ¶
NewPublicTracerAPI creates a new API for the RPC interface
func NewPublicTransactionAPI ¶
NewPublicTransactionAPI creates a new API for the RPC interface
func StartServers ¶
func StartServers(hmy *hmy.Harmony, apis []rpc.API, config nodeconfig.RPCServerConfig) error
StartServers starts the http & ws servers
Types ¶
type BlockNumber ¶
type BlockNumber rpc.BlockNumber
BlockNumber ..
func (BlockNumber) EthBlockNumber ¶
func (bn BlockNumber) EthBlockNumber() rpc.BlockNumber
EthBlockNumber ..
func (*BlockNumber) UnmarshalJSON ¶
func (bn *BlockNumber) UnmarshalJSON(data []byte) error
UnmarshalJSON converts a hex string or integer to a block number
type CallArgs ¶
type CallArgs struct { From *common.Address `json:"from"` To *common.Address `json:"to"` Gas *hexutil.Uint64 `json:"gas"` GasPrice *hexutil.Big `json:"gasPrice"` Value *hexutil.Big `json:"value"` Data *hexutil.Bytes `json:"data"` }
CallArgs represents the arguments for a call.
type Delegation ¶
type Delegation struct { ValidatorAddress string `json:"validator_address"` DelegatorAddress string `json:"delegator_address"` Amount *big.Int `json:"amount"` Reward *big.Int `json:"reward"` Undelegations []Undelegation `json:"Undelegations"` }
Delegation represents a particular delegation to a validator
type HeaderInformation ¶
type HeaderInformation struct { BlockHash common.Hash `json:"blockHash"` BlockNumber uint64 `json:"blockNumber"` ShardID uint32 `json:"shardID"` Leader string `json:"leader"` ViewID uint64 `json:"viewID"` Epoch uint64 `json:"epoch"` Timestamp string `json:"timestamp"` UnixTime uint64 `json:"unixtime"` LastCommitSig string `json:"lastCommitSig"` LastCommitBitmap string `json:"lastCommitBitmap"` CrossLinks *types.CrossLinks `json:"crossLinks,omitempty"` }
HeaderInformation represents the latest consensus information
func NewHeaderInformation ¶
func NewHeaderInformation(header *block.Header, leader string) *HeaderInformation
NewHeaderInformation returns the header information that will serialize to the RPC representation.
type PrivateDebugService ¶
type PrivateDebugService struct {
// contains filtered or unexported fields
}
PrivateDebugService Internal JSON RPC for debugging purpose
func (*PrivateDebugService) ConsensusCurViewID ¶
func (s *PrivateDebugService) ConsensusCurViewID( ctx context.Context, ) uint64
ConsensusCurViewID return the current view ID to RPC
func (*PrivateDebugService) ConsensusViewChangingID ¶
func (s *PrivateDebugService) ConsensusViewChangingID( ctx context.Context, ) uint64
ConsensusViewChangingID return the current view changing ID to RPC
func (*PrivateDebugService) GetConsensusMode ¶
func (s *PrivateDebugService) GetConsensusMode( ctx context.Context, ) string
GetConsensusMode return the current consensus mode
func (*PrivateDebugService) GetConsensusPhase ¶
func (s *PrivateDebugService) GetConsensusPhase( ctx context.Context, ) string
GetConsensusPhase return the current consensus mode
func (*PrivateDebugService) SetLogVerbosity ¶
func (s *PrivateDebugService) SetLogVerbosity(ctx context.Context, level int) (map[string]interface{}, error)
SetLogVerbosity Sets log verbosity on runtime
type PublicBlockchainService ¶
type PublicBlockchainService struct {
// contains filtered or unexported fields
}
PublicBlockchainService provides an API to access the Harmony blockchain. It offers only methods that operate on public data that is freely available to anyone.
func (*PublicBlockchainService) BeaconInSync ¶
func (s *PublicBlockchainService) BeaconInSync(ctx context.Context) (bool, error)
BeaconInSync returns if beacon chain is syncing
func (*PublicBlockchainService) BlockNumber ¶
func (s *PublicBlockchainService) BlockNumber(ctx context.Context) (interface{}, error)
BlockNumber returns the block number of the chain head.
func (*PublicBlockchainService) ChainId ¶ added in v1.10.2
func (s *PublicBlockchainService) ChainId(ctx context.Context) (interface{}, error)
ChainId returns the chain id of the chain - required by MetaMask
func (*PublicBlockchainService) EpochLastBlock ¶
EpochLastBlock returns epoch last block.
func (*PublicBlockchainService) GetBalanceByBlockNumber ¶
func (s *PublicBlockchainService) GetBalanceByBlockNumber( ctx context.Context, address string, blockNumber BlockNumber, ) (interface{}, error)
GetBalanceByBlockNumber returns balance by block number
func (*PublicBlockchainService) GetBlockByHash ¶
func (s *PublicBlockchainService) GetBlockByHash( ctx context.Context, blockHash common.Hash, opts interface{}, ) (response StructuredResponse, err error)
GetBlockByHash returns the requested block. When fullTx is true all transactions in the block are returned in full detail, otherwise only the transaction hash is returned. When withSigners in BlocksArgs is true it shows block signers for this block in list of one addresses.
func (*PublicBlockchainService) GetBlockByHashNew ¶
func (s *PublicBlockchainService) GetBlockByHashNew( ctx context.Context, blockHash common.Hash, blockArgs *rpc_common.BlockArgs, ) (StructuredResponse, error)
GetBlockByHashNew is an alias for GetBlocksByHash using rpc_common.BlockArgs
func (*PublicBlockchainService) GetBlockByNumber ¶
func (s *PublicBlockchainService) GetBlockByNumber( ctx context.Context, blockNumber BlockNumber, opts interface{}, ) (response StructuredResponse, err error)
GetBlockByNumber returns the requested block. When blockNum is -1 the chain head is returned. When fullTx is true all transactions in the block are returned in full detail, otherwise only the transaction hash is returned. When withSigners in BlocksArgs is true it shows block signers for this block in list of one addresses.
func (*PublicBlockchainService) GetBlockByNumberNew ¶
func (s *PublicBlockchainService) GetBlockByNumberNew( ctx context.Context, blockNum BlockNumber, blockArgs *rpc_common.BlockArgs, ) (StructuredResponse, error)
GetBlockByNumberNew is an alias for GetBlockByNumber using rpc_common.BlockArgs
func (*PublicBlockchainService) GetBlockSignerKeys ¶
func (s *PublicBlockchainService) GetBlockSignerKeys( ctx context.Context, blockNumber BlockNumber, ) ([]string, error)
GetBlockSignerKeys returns bls public keys that signed the block.
func (*PublicBlockchainService) GetBlockSigners ¶
func (s *PublicBlockchainService) GetBlockSigners( ctx context.Context, blockNumber BlockNumber, ) ([]string, error)
GetBlockSigners returns signers for a particular block.
func (*PublicBlockchainService) GetBlocks ¶
func (s *PublicBlockchainService) GetBlocks( ctx context.Context, blockNumberStart BlockNumber, blockNumberEnd BlockNumber, blockArgs *rpc_common.BlockArgs, ) ([]StructuredResponse, error)
GetBlocks method returns blocks in range blockStart, blockEnd just like GetBlockByNumber but all at once.
func (*PublicBlockchainService) GetCirculatingSupply ¶
GetCirculatingSupply ...
func (*PublicBlockchainService) GetCurrentBadBlocks ¶
func (s *PublicBlockchainService) GetCurrentBadBlocks( ctx context.Context, ) ([]StructuredResponse, error)
GetCurrentBadBlocks ..
func (*PublicBlockchainService) GetCurrentUtilityMetrics ¶
func (s *PublicBlockchainService) GetCurrentUtilityMetrics( ctx context.Context, ) (StructuredResponse, error)
GetCurrentUtilityMetrics ..
func (*PublicBlockchainService) GetEpoch ¶
func (s *PublicBlockchainService) GetEpoch(ctx context.Context) (interface{}, error)
GetEpoch returns current epoch.
func (*PublicBlockchainService) GetHeaderByNumber ¶
func (s *PublicBlockchainService) GetHeaderByNumber( ctx context.Context, blockNumber BlockNumber, ) (StructuredResponse, error)
GetHeaderByNumber returns block header at given number
func (*PublicBlockchainService) GetLastCrossLinks ¶
func (s *PublicBlockchainService) GetLastCrossLinks( ctx context.Context, ) ([]StructuredResponse, error)
GetLastCrossLinks ..
func (*PublicBlockchainService) GetLatestChainHeaders ¶
func (s *PublicBlockchainService) GetLatestChainHeaders( ctx context.Context, ) (StructuredResponse, error)
GetLatestChainHeaders ..
func (*PublicBlockchainService) GetLeader ¶
func (s *PublicBlockchainService) GetLeader(ctx context.Context) (string, error)
GetLeader returns current shard leader.
func (*PublicBlockchainService) GetShardID ¶
func (s *PublicBlockchainService) GetShardID(ctx context.Context) (int, error)
GetShardID returns shard ID of the requested node.
func (*PublicBlockchainService) GetShardingStructure ¶
func (s *PublicBlockchainService) GetShardingStructure( ctx context.Context, ) ([]StructuredResponse, error)
GetShardingStructure returns an array of sharding structures.
func (*PublicBlockchainService) GetSignedBlocks ¶
func (s *PublicBlockchainService) GetSignedBlocks( ctx context.Context, address string, ) (interface{}, error)
GetSignedBlocks returns how many blocks a particular validator signed for last blocksPeriod (1 epoch's worth of blocks).
func (*PublicBlockchainService) GetStakingNetworkInfo ¶
func (s *PublicBlockchainService) GetStakingNetworkInfo( ctx context.Context, ) (StructuredResponse, error)
GetStakingNetworkInfo ..
func (*PublicBlockchainService) GetSuperCommittees ¶
func (s *PublicBlockchainService) GetSuperCommittees( ctx context.Context, ) (StructuredResponse, error)
GetSuperCommittees ..
func (*PublicBlockchainService) GetTotalSupply ¶
GetTotalSupply ..
func (*PublicBlockchainService) InSync ¶
func (s *PublicBlockchainService) InSync(ctx context.Context) (bool, error)
InSync returns if shard chain is syncing
func (*PublicBlockchainService) IsBlockSigner ¶
func (s *PublicBlockchainService) IsBlockSigner( ctx context.Context, blockNumber BlockNumber, address string, ) (bool, error)
IsBlockSigner returns true if validator with address signed blockNum block.
func (*PublicBlockchainService) IsLastBlock ¶
IsLastBlock checks if block is last epoch block.
func (*PublicBlockchainService) LatestHeader ¶
func (s *PublicBlockchainService) LatestHeader(ctx context.Context) (StructuredResponse, error)
LatestHeader returns the latest header information
type PublicContractService ¶
type PublicContractService struct {
// contains filtered or unexported fields
}
PublicContractService provides an API to access Harmony's contract services. It offers only methods that operate on public data that is freely available to anyone.
func (*PublicContractService) Call ¶
func (s *PublicContractService) Call( ctx context.Context, args CallArgs, blockNumber BlockNumber, ) (hexutil.Bytes, error)
Call executes the given transaction on the state for the given block number. It doesn't make and changes in the state/blockchain and is useful to execute and retrieve values.
func (*PublicContractService) GetCode ¶
func (s *PublicContractService) GetCode( ctx context.Context, addr string, blockNumber BlockNumber, ) (hexutil.Bytes, error)
GetCode returns the code stored at the given address in the state for the given block number.
func (*PublicContractService) GetStorageAt ¶
func (s *PublicContractService) GetStorageAt( ctx context.Context, addr string, key string, blockNumber BlockNumber, ) (hexutil.Bytes, error)
GetStorageAt returns the storage from the state at the given address, key and block number. The rpc.LatestBlockNumber and rpc.PendingBlockNumber meta block numbers are also allowed.
type PublicHarmonyService ¶
type PublicHarmonyService struct {
// contains filtered or unexported fields
}
PublicHarmonyService provides an API to access Harmony related information. It offers only methods that operate on public data that is freely available to anyone.
func (*PublicHarmonyService) GasPrice ¶
func (s *PublicHarmonyService) GasPrice(ctx context.Context) (interface{}, error)
GasPrice returns a suggestion for a gas price. Note that the return type is an interface to account for the different versions
func (*PublicHarmonyService) GetNodeMetadata ¶
func (s *PublicHarmonyService) GetNodeMetadata( ctx context.Context, ) (StructuredResponse, error)
GetNodeMetadata produces a NodeMetadata record, data is from the answering RPC node
func (*PublicHarmonyService) GetPeerInfo ¶
func (s *PublicHarmonyService) GetPeerInfo( ctx context.Context, ) (StructuredResponse, error)
GetPeerInfo produces a NodePeerInfo record
func (*PublicHarmonyService) ProtocolVersion ¶
func (s *PublicHarmonyService) ProtocolVersion( ctx context.Context, ) (interface{}, error)
ProtocolVersion returns the current Harmony protocol version this node supports Note that the return type is an interface to account for the different versions
func (*PublicHarmonyService) Syncing ¶
func (s *PublicHarmonyService) Syncing( ctx context.Context, ) (interface{}, error)
Syncing returns false in case the node is currently not syncing with the network. It can be up to date or has not yet received the latest block headers from its pears. In case it is synchronizing: - startingBlock: block number this node started to synchronise from - currentBlock: block number this node is currently importing - highestBlock: block number of the highest block header this node has received from peers - pulledStates: number of state entries processed until now - knownStates: number of known state entries that still need to be pulled
type PublicNetService ¶
type PublicNetService struct {
// contains filtered or unexported fields
}
PublicNetService offers network related RPC methods
func (*PublicNetService) PeerCount ¶
func (s *PublicNetService) PeerCount(ctx context.Context) (interface{}, error)
PeerCount returns the number of connected peers Note that the return type is an interface to account for the different versions
func (*PublicNetService) Version ¶
func (s *PublicNetService) Version(ctx context.Context) interface{}
Version returns the network version, i.e. ChainID identifying which network we are using
type PublicPoolService ¶
type PublicPoolService struct {
// contains filtered or unexported fields
}
PublicPoolService provides an API to access the Harmony node's transaction pool. It offers only methods that operate on public data that is freely available to anyone.
func (*PublicPoolService) GetCurrentStakingErrorSink ¶
func (s *PublicPoolService) GetCurrentStakingErrorSink( ctx context.Context, ) ([]StructuredResponse, error)
GetCurrentStakingErrorSink ..
func (*PublicPoolService) GetCurrentTransactionErrorSink ¶
func (s *PublicPoolService) GetCurrentTransactionErrorSink( ctx context.Context, ) ([]StructuredResponse, error)
GetCurrentTransactionErrorSink ..
func (*PublicPoolService) GetPendingCXReceipts ¶
func (s *PublicPoolService) GetPendingCXReceipts( ctx context.Context, ) ([]StructuredResponse, error)
GetPendingCXReceipts ..
func (*PublicPoolService) GetPoolStats ¶
func (s *PublicPoolService) GetPoolStats( ctx context.Context, ) (StructuredResponse, error)
GetPoolStats returns stats for the tx-pool
func (*PublicPoolService) PendingStakingTransactions ¶
func (s *PublicPoolService) PendingStakingTransactions( ctx context.Context, ) ([]StructuredResponse, error)
PendingStakingTransactions returns the staking transactions that are in the transaction pool
func (*PublicPoolService) PendingTransactions ¶
func (s *PublicPoolService) PendingTransactions( ctx context.Context, ) ([]StructuredResponse, error)
PendingTransactions returns the plain transactions that are in the transaction pool
func (*PublicPoolService) SendRawStakingTransaction ¶
func (s *PublicPoolService) SendRawStakingTransaction( ctx context.Context, encodedTx hexutil.Bytes, ) (common.Hash, error)
SendRawStakingTransaction will add the signed transaction to the transaction pool. The sender is responsible for signing the transaction and using the correct nonce.
func (*PublicPoolService) SendRawTransaction ¶
func (s *PublicPoolService) SendRawTransaction( ctx context.Context, encodedTx hexutil.Bytes, ) (common.Hash, error)
SendRawTransaction will add the signed transaction to the transaction pool. The sender is responsible for signing the transaction and using the correct nonce.
type PublicStakingService ¶
type PublicStakingService struct {
// contains filtered or unexported fields
}
PublicStakingService provides an API to access Harmony's staking services. It offers only methods that operate on public data that is freely available to anyone.
func (*PublicStakingService) GetAllDelegationInformation ¶
func (s *PublicStakingService) GetAllDelegationInformation( ctx context.Context, page int, ) ([][]StructuredResponse, error)
GetAllDelegationInformation returns delegation information about `validatorsPageSize` validators, starting at `page*validatorsPageSize`. If page is -1, return all instead of `validatorsPageSize` elements. TODO(dm): optimize with single flight
func (*PublicStakingService) GetAllValidatorAddresses ¶
func (s *PublicStakingService) GetAllValidatorAddresses( ctx context.Context, ) ([]string, error)
GetAllValidatorAddresses returns all validator addresses.
func (*PublicStakingService) GetAllValidatorInformation ¶
func (s *PublicStakingService) GetAllValidatorInformation( ctx context.Context, page int, ) ([]StructuredResponse, error)
GetAllValidatorInformation returns information about all validators. If page is -1, return all instead of `validatorsPageSize` elements.
func (*PublicStakingService) GetAllValidatorInformationByBlockNumber ¶
func (s *PublicStakingService) GetAllValidatorInformationByBlockNumber( ctx context.Context, page int, blockNumber BlockNumber, ) ([]StructuredResponse, error)
GetAllValidatorInformationByBlockNumber returns information about all validators. If page is -1, return all instead of `validatorsPageSize` elements.
func (*PublicStakingService) GetAvailableRedelegationBalance ¶
func (s *PublicStakingService) GetAvailableRedelegationBalance( ctx context.Context, address string, ) (*big.Int, error)
GetAvailableRedelegationBalance returns the amount of locked undelegated tokens
func (*PublicStakingService) GetDelegationByDelegatorAndValidator ¶
func (s *PublicStakingService) GetDelegationByDelegatorAndValidator( ctx context.Context, address string, validator string, ) (StructuredResponse, error)
GetDelegationByDelegatorAndValidator returns a delegation for delegator and validator.
func (*PublicStakingService) GetDelegationsByDelegator ¶
func (s *PublicStakingService) GetDelegationsByDelegator( ctx context.Context, address string, ) ([]StructuredResponse, error)
GetDelegationsByDelegator returns list of delegations for a delegator address.
func (*PublicStakingService) GetDelegationsByDelegatorByBlockNumber ¶
func (s *PublicStakingService) GetDelegationsByDelegatorByBlockNumber( ctx context.Context, address string, blockNumber BlockNumber, ) ([]StructuredResponse, error)
GetDelegationsByDelegatorByBlockNumber returns list of delegations for a delegator address at given block number
func (*PublicStakingService) GetDelegationsByValidator ¶
func (s *PublicStakingService) GetDelegationsByValidator( ctx context.Context, address string, ) ([]StructuredResponse, error)
GetDelegationsByValidator returns list of delegations for a validator address.
func (*PublicStakingService) GetElectedValidatorAddresses ¶
func (s *PublicStakingService) GetElectedValidatorAddresses( ctx context.Context, ) ([]string, error)
GetElectedValidatorAddresses returns elected validator addresses.
func (*PublicStakingService) GetMedianRawStakeSnapshot ¶
func (s *PublicStakingService) GetMedianRawStakeSnapshot( ctx context.Context, ) (StructuredResponse, error)
GetMedianRawStakeSnapshot returns the raw median stake, only meant to be called on beaconchain explorer node
func (*PublicStakingService) GetTotalStaking ¶
GetTotalStaking returns total staking by validators, only meant to be called on beaconchain explorer node
func (*PublicStakingService) GetValidatorInformation ¶
func (s *PublicStakingService) GetValidatorInformation( ctx context.Context, address string, ) (StructuredResponse, error)
GetValidatorInformation returns information about a validator.
func (*PublicStakingService) GetValidatorInformationByBlockNumber ¶
func (s *PublicStakingService) GetValidatorInformationByBlockNumber( ctx context.Context, address string, blockNumber BlockNumber, ) (StructuredResponse, error)
GetValidatorInformationByBlockNumber returns information about a validator.
func (*PublicStakingService) GetValidatorKeys ¶
func (s *PublicStakingService) GetValidatorKeys( ctx context.Context, epoch int64, ) ([]string, error)
GetValidatorKeys returns list of bls public keys in the committee for a particular epoch.
func (*PublicStakingService) GetValidatorSelfDelegation ¶
func (s *PublicStakingService) GetValidatorSelfDelegation( ctx context.Context, address string, ) (interface{}, error)
GetValidatorSelfDelegation returns validator stake.
func (*PublicStakingService) GetValidatorTotalDelegation ¶
func (s *PublicStakingService) GetValidatorTotalDelegation( ctx context.Context, address string, ) (interface{}, error)
GetValidatorTotalDelegation returns total balance stacking for validator with delegation.
func (*PublicStakingService) GetValidators ¶
func (s *PublicStakingService) GetValidators( ctx context.Context, epoch int64, ) (StructuredResponse, error)
GetValidators returns validators list for a particular epoch.
type PublicTracerService ¶
type PublicTracerService struct {
// contains filtered or unexported fields
}
PublicTracerService provides an API to access Harmony's staking services. It offers only methods that operate on public data that is freely available to anyone.
func (*PublicTracerService) TraceBlock ¶
func (s *PublicTracerService) TraceBlock(ctx context.Context, blob []byte, config *hmy.TraceConfig) ([]*hmy.TxTraceResult, error)
TraceBlock returns the structured logs created during the execution of EVM and returns them as a JSON object.
func (*PublicTracerService) TraceBlockByHash ¶
func (s *PublicTracerService) TraceBlockByHash(ctx context.Context, hash common.Hash, config *hmy.TraceConfig) ([]*hmy.TxTraceResult, error)
TraceBlockByHash returns the structured logs created during the execution of EVM and returns them as a JSON object.
func (*PublicTracerService) TraceBlockByNumber ¶
func (s *PublicTracerService) TraceBlockByNumber(ctx context.Context, number rpc.BlockNumber, config *hmy.TraceConfig) ([]*hmy.TxTraceResult, error)
TraceBlockByNumber returns the structured logs created during the execution of EVM and returns them as a JSON object.
func (*PublicTracerService) TraceCall ¶
func (s *PublicTracerService) TraceCall(ctx context.Context, args CallArgs, blockNr rpc.BlockNumber, config *hmy.TraceConfig) (interface{}, error)
TraceCall lets you trace a given eth_call. It collects the structured logs created during the execution of EVM if the given transaction was added on top of the provided block and returns them as a JSON object. You can provide -2 as a block number to trace on top of the pending block. NOTE: Our version only supports block number as an input
func (*PublicTracerService) TraceChain ¶
func (s *PublicTracerService) TraceChain(ctx context.Context, start, end rpc.BlockNumber, config *hmy.TraceConfig) (*rpc.Subscription, error)
TraceChain returns the structured logs created during the execution of EVM between two blocks (excluding start) and returns them as a JSON object.
func (*PublicTracerService) TraceTransaction ¶
func (s *PublicTracerService) TraceTransaction(ctx context.Context, hash common.Hash, config *hmy.TraceConfig) (interface{}, error)
TraceTransaction returns the structured logs created during the execution of EVM and returns them as a JSON object.
type PublicTransactionService ¶
type PublicTransactionService struct {
// contains filtered or unexported fields
}
PublicTransactionService provides an API to access Harmony's transaction service. It offers only methods that operate on public data that is freely available to anyone.
func (*PublicTransactionService) EstimateGas ¶
func (s *PublicTransactionService) EstimateGas( ctx context.Context, args CallArgs, ) (hexutil.Uint64, error)
EstimateGas returns an estimate of the amount of gas needed to execute the given transaction against the current pending block.
func (*PublicTransactionService) GetAccountNonce ¶
func (s *PublicTransactionService) GetAccountNonce( ctx context.Context, address string, blockNumber BlockNumber, ) (uint64, error)
GetAccountNonce returns the nonce value of the given address for the given block number
func (*PublicTransactionService) GetBlockStakingTransactionCountByHash ¶
func (s *PublicTransactionService) GetBlockStakingTransactionCountByHash( ctx context.Context, blockHash common.Hash, ) (interface{}, error)
GetBlockStakingTransactionCountByHash returns the number of staking transactions in the block with the given hash. Note that the return type is an interface to account for the different versions
func (*PublicTransactionService) GetBlockStakingTransactionCountByNumber ¶
func (s *PublicTransactionService) GetBlockStakingTransactionCountByNumber( ctx context.Context, blockNumber BlockNumber, ) (interface{}, error)
GetBlockStakingTransactionCountByNumber returns the number of staking transactions in the block with the given block number. Note that the return type is an interface to account for the different versions
func (*PublicTransactionService) GetBlockTransactionCountByHash ¶
func (s *PublicTransactionService) GetBlockTransactionCountByHash( ctx context.Context, blockHash common.Hash, ) (interface{}, error)
GetBlockTransactionCountByHash returns the number of transactions in the block with the given hash. Note that the return type is an interface to account for the different versions
func (*PublicTransactionService) GetBlockTransactionCountByNumber ¶
func (s *PublicTransactionService) GetBlockTransactionCountByNumber( ctx context.Context, blockNumber BlockNumber, ) (interface{}, error)
GetBlockTransactionCountByNumber returns the number of transactions in the block with the given block number. Note that the return type is an interface to account for the different versions
func (*PublicTransactionService) GetCXReceiptByHash ¶
func (s *PublicTransactionService) GetCXReceiptByHash( ctx context.Context, hash common.Hash, ) (StructuredResponse, error)
GetCXReceiptByHash returns the transaction for the given hash
func (*PublicTransactionService) GetStakingTransactionByBlockHashAndIndex ¶
func (s *PublicTransactionService) GetStakingTransactionByBlockHashAndIndex( ctx context.Context, blockHash common.Hash, index TransactionIndex, ) (StructuredResponse, error)
GetStakingTransactionByBlockHashAndIndex returns the transaction for the given block hash and index.
func (*PublicTransactionService) GetStakingTransactionByBlockNumberAndIndex ¶
func (s *PublicTransactionService) GetStakingTransactionByBlockNumberAndIndex( ctx context.Context, blockNumber BlockNumber, index TransactionIndex, ) (StructuredResponse, error)
GetStakingTransactionByBlockNumberAndIndex returns the staking transaction for the given block number and index.
func (*PublicTransactionService) GetStakingTransactionByHash ¶
func (s *PublicTransactionService) GetStakingTransactionByHash( ctx context.Context, hash common.Hash, ) (StructuredResponse, error)
GetStakingTransactionByHash returns the staking transaction for the given hash
func (*PublicTransactionService) GetStakingTransactionsCount ¶
func (s *PublicTransactionService) GetStakingTransactionsCount( ctx context.Context, address, txType string, ) (count uint64, err error)
GetStakingTransactionsCount returns the number of staking transactions from genesis of input type ("SENT", "RECEIVED", "ALL")
func (*PublicTransactionService) GetStakingTransactionsHistory ¶
func (s *PublicTransactionService) GetStakingTransactionsHistory( ctx context.Context, args TxHistoryArgs, ) (StructuredResponse, error)
GetStakingTransactionsHistory returns the list of transactions hashes that involve a particular address.
func (*PublicTransactionService) GetTransactionByBlockHashAndIndex ¶
func (s *PublicTransactionService) GetTransactionByBlockHashAndIndex( ctx context.Context, blockHash common.Hash, index TransactionIndex, ) (StructuredResponse, error)
GetTransactionByBlockHashAndIndex returns the transaction for the given block hash and index.
func (*PublicTransactionService) GetTransactionByBlockNumberAndIndex ¶
func (s *PublicTransactionService) GetTransactionByBlockNumberAndIndex( ctx context.Context, blockNumber BlockNumber, index TransactionIndex, ) (StructuredResponse, error)
GetTransactionByBlockNumberAndIndex returns the transaction for the given block number and index.
func (*PublicTransactionService) GetTransactionByHash ¶
func (s *PublicTransactionService) GetTransactionByHash( ctx context.Context, hash common.Hash, ) (StructuredResponse, error)
GetTransactionByHash returns the plain transaction for the given hash
func (*PublicTransactionService) GetTransactionCount ¶
func (s *PublicTransactionService) GetTransactionCount( ctx context.Context, addr string, blockNumber BlockNumber, ) (response interface{}, err error)
GetTransactionCount returns the number of transactions the given address has sent for the given block number. Legacy for apiv1. For apiv2, please use getAccountNonce/getPoolNonce/getTransactionsCount/getStakingTransactionsCount apis for more granular transaction counts queries Note that the return type is an interface to account for the different versions
func (*PublicTransactionService) GetTransactionReceipt ¶
func (s *PublicTransactionService) GetTransactionReceipt( ctx context.Context, hash common.Hash, ) (StructuredResponse, error)
GetTransactionReceipt returns the transaction receipt for the given transaction hash.
func (*PublicTransactionService) GetTransactionsCount ¶
func (s *PublicTransactionService) GetTransactionsCount( ctx context.Context, address, txType string, ) (count uint64, err error)
GetTransactionsCount returns the number of regular transactions from genesis of input type ("SENT", "RECEIVED", "ALL")
func (*PublicTransactionService) GetTransactionsHistory ¶
func (s *PublicTransactionService) GetTransactionsHistory( ctx context.Context, args TxHistoryArgs, ) (StructuredResponse, error)
GetTransactionsHistory returns the list of transactions hashes that involve a particular address.
func (*PublicTransactionService) ResendCx ¶
ResendCx requests that the egress receipt for the given cross-shard transaction be sent to the destination shard for credit. This is used for unblocking a half-complete cross-shard transaction whose fund has been withdrawn already from the source shard but not credited yet in the destination account due to transient failures.
type StakingNetworkInfo ¶
type StakingNetworkInfo struct { TotalSupply numeric.Dec `json:"total-supply"` CirculatingSupply numeric.Dec `json:"circulating-supply"` EpochLastBlock uint64 `json:"epoch-last-block"` TotalStaking *big.Int `json:"total-staking"` MedianRawStake numeric.Dec `json:"median-raw-stake"` }
StakingNetworkInfo returns global staking info.
type StructuredResponse ¶
type StructuredResponse = map[string]interface{}
StructuredResponse type of RPCs
func NewStructuredResponse ¶
func NewStructuredResponse(input interface{}) (StructuredResponse, error)
NewStructuredResponse creates a structured response from the given input
type TransactionIndex ¶
type TransactionIndex uint64
TransactionIndex ..
func (*TransactionIndex) UnmarshalJSON ¶
func (i *TransactionIndex) UnmarshalJSON(data []byte) (err error)
UnmarshalJSON converts a hex string or integer to a Transaction index
type TxHistoryArgs ¶
type TxHistoryArgs struct { Address string `json:"address"` PageIndex uint32 `json:"pageIndex"` PageSize uint32 `json:"pageSize"` FullTx bool `json:"fullTx"` TxType string `json:"txType"` Order string `json:"order"` }
TxHistoryArgs is struct to include optional transaction formatting params.
func (*TxHistoryArgs) UnmarshalFromInterface ¶
func (ta *TxHistoryArgs) UnmarshalFromInterface(blockArgs interface{}) error
UnmarshalFromInterface ..
type Undelegation ¶
Undelegation represents one undelegation entry