Documentation ¶
Index ¶
- Variables
- func RPCMarshalBlock(b *types.Block, blockArgs BlockArgs) (map[string]interface{}, error)
- func ReturnWithPagination(hashes []common.Hash, pageIndex uint32, pageSize uint32) []common.Hash
- func SubmitStakingTransaction(ctx context.Context, b Backend, tx *staking.StakingTransaction) (common.Hash, error)
- func SubmitTransaction(ctx context.Context, b Backend, tx *types.Transaction) (common.Hash, error)
- type AddrLocker
- type Backend
- type BlockArgs
- type CallArgs
- type DebugAPI
- type HeaderInformation
- type PublicBlockChainAPI
- func (s *PublicBlockChainAPI) BlockNumber() hexutil.Uint64
- func (s *PublicBlockChainAPI) Call(ctx context.Context, args CallArgs, blockNr rpc.BlockNumber) (hexutil.Bytes, error)
- func (s *PublicBlockChainAPI) EpochLastBlock(epoch uint64) (uint64, error)
- func (s *PublicBlockChainAPI) EstimateGas(ctx context.Context, args CallArgs) (hexutil.Uint64, error)
- func (s *PublicBlockChainAPI) GetAccountNonce(ctx context.Context, address string, blockNr rpc.BlockNumber) (uint64, error)
- func (s *PublicBlockChainAPI) GetAllDelegationInformation(ctx context.Context, page int) ([][]*RPCDelegation, error)
- func (s *PublicBlockChainAPI) GetAllValidatorAddresses() ([]string, error)
- func (s *PublicBlockChainAPI) GetAllValidatorInformation(ctx context.Context, page int) ([]*staking.ValidatorRPCEnchanced, error)
- func (s *PublicBlockChainAPI) GetAllValidatorInformationByBlockNumber(ctx context.Context, page int, blockNr rpc.BlockNumber) ([]*staking.ValidatorRPCEnchanced, error)
- func (s *PublicBlockChainAPI) GetBalance(ctx context.Context, address string, blockNr rpc.BlockNumber) (*hexutil.Big, error)
- func (s *PublicBlockChainAPI) GetBalanceByBlockNumber(ctx context.Context, address string, blockNr rpc.BlockNumber) (*hexutil.Big, error)
- func (s *PublicBlockChainAPI) GetBlockByHash(ctx context.Context, blockHash common.Hash, fullTx bool) (map[string]interface{}, error)
- func (s *PublicBlockChainAPI) GetBlockByHashNew(ctx context.Context, blockHash common.Hash, blockArgs BlockArgs) (map[string]interface{}, error)
- func (s *PublicBlockChainAPI) GetBlockByNumber(ctx context.Context, blockNr rpc.BlockNumber, fullTx bool) (map[string]interface{}, error)
- func (s *PublicBlockChainAPI) GetBlockByNumberNew(ctx context.Context, blockNr rpc.BlockNumber, blockArgs BlockArgs) (map[string]interface{}, error)
- func (s *PublicBlockChainAPI) GetBlockSigners(ctx context.Context, blockNr rpc.BlockNumber) ([]string, error)
- func (s *PublicBlockChainAPI) GetBlocks(ctx context.Context, blockStart rpc.BlockNumber, blockEnd rpc.BlockNumber, ...) ([]map[string]interface{}, error)
- func (s *PublicBlockChainAPI) GetCirculatingSupply() (numeric.Dec, error)
- func (s *PublicBlockChainAPI) GetCode(ctx context.Context, addr string, blockNr rpc.BlockNumber) (hexutil.Bytes, error)
- func (s *PublicBlockChainAPI) GetCurrentBadBlocks() []core.BadBlock
- func (s *PublicBlockChainAPI) GetCurrentUtilityMetrics() (*network.UtilityMetric, error)
- func (s *PublicBlockChainAPI) GetDelegationByDelegatorAndValidator(ctx context.Context, address string, validator string) (*RPCDelegation, error)
- func (s *PublicBlockChainAPI) GetDelegationsByDelegator(ctx context.Context, address string) ([]*RPCDelegation, error)
- func (s *PublicBlockChainAPI) GetDelegationsByValidator(ctx context.Context, address string) ([]*RPCDelegation, error)
- func (s *PublicBlockChainAPI) GetElectedValidatorAddresses() ([]string, error)
- func (s *PublicBlockChainAPI) GetEpoch(ctx context.Context) hexutil.Uint64
- func (s *PublicBlockChainAPI) GetLastCrossLinks() ([]*types.CrossLink, error)
- func (s *PublicBlockChainAPI) GetLatestChainHeaders() *block.HeaderPair
- func (s *PublicBlockChainAPI) GetLeader(ctx context.Context) string
- func (s *PublicBlockChainAPI) GetMedianRawStakeSnapshot() (*committee.CompletedEPoSRound, error)
- func (s *PublicBlockChainAPI) GetShardID(ctx context.Context) (int, error)
- func (s *PublicBlockChainAPI) GetShardingStructure(ctx context.Context) ([]map[string]interface{}, error)
- func (s *PublicBlockChainAPI) GetSignedBlocks(ctx context.Context, address string) hexutil.Uint64
- func (s *PublicBlockChainAPI) GetStakingNetworkInfo(ctx context.Context) (*StakingNetworkInfo, error)
- func (s *PublicBlockChainAPI) GetStorageAt(ctx context.Context, addr string, key string, blockNr rpc.BlockNumber) (hexutil.Bytes, error)
- func (s *PublicBlockChainAPI) GetSuperCommittees() (*quorum.Transition, error)
- func (s *PublicBlockChainAPI) GetTotalStaking() (*big.Int, error)
- func (s *PublicBlockChainAPI) GetTotalSupply() (numeric.Dec, error)
- func (s *PublicBlockChainAPI) GetValidatorInformation(ctx context.Context, address string) (*staking.ValidatorRPCEnchanced, error)
- func (s *PublicBlockChainAPI) GetValidatorInformationByBlockNumber(ctx context.Context, address string, blockNr rpc.BlockNumber) (*staking.ValidatorRPCEnchanced, error)
- func (s *PublicBlockChainAPI) GetValidatorSelfDelegation(ctx context.Context, address string) hexutil.Uint64
- func (s *PublicBlockChainAPI) GetValidatorTotalDelegation(ctx context.Context, address string) hexutil.Uint64
- func (s *PublicBlockChainAPI) GetValidators(ctx context.Context, epoch int64) (map[string]interface{}, error)
- func (s *PublicBlockChainAPI) IsBlockSigner(ctx context.Context, blockNr rpc.BlockNumber, address string) (bool, error)
- func (s *PublicBlockChainAPI) IsLastBlock(blockNum uint64) (bool, error)
- func (s *PublicBlockChainAPI) LatestHeader(ctx context.Context) *HeaderInformation
- func (s *PublicBlockChainAPI) ResendCx(ctx context.Context, txID common.Hash) (bool, error)
- type PublicHarmonyAPI
- type PublicNetAPI
- type PublicTransactionPoolAPI
- func (s *PublicTransactionPoolAPI) GetBlockTransactionCountByHash(ctx context.Context, blockHash common.Hash) *hexutil.Uint
- func (s *PublicTransactionPoolAPI) GetBlockTransactionCountByNumber(ctx context.Context, blockNr rpc.BlockNumber) *hexutil.Uint
- func (s *PublicTransactionPoolAPI) GetCXReceiptByHash(ctx context.Context, hash common.Hash) *RPCCXReceipt
- func (s *PublicTransactionPoolAPI) GetCurrentStakingErrorSink() []staking.RPCTransactionError
- func (s *PublicTransactionPoolAPI) GetCurrentTransactionErrorSink() []types.RPCTransactionError
- func (s *PublicTransactionPoolAPI) GetPendingCXReceipts(ctx context.Context) []*types.CXReceiptsProof
- func (s *PublicTransactionPoolAPI) GetStakingTransactionByBlockHashAndIndex(ctx context.Context, blockHash common.Hash, index hexutil.Uint) *RPCStakingTransaction
- func (s *PublicTransactionPoolAPI) GetStakingTransactionByBlockNumberAndIndex(ctx context.Context, blockNr rpc.BlockNumber, index hexutil.Uint) *RPCStakingTransaction
- func (s *PublicTransactionPoolAPI) GetStakingTransactionByHash(ctx context.Context, hash common.Hash) *RPCStakingTransaction
- func (s *PublicTransactionPoolAPI) GetStakingTransactionsCount(ctx context.Context, address, txType string) (uint64, error)
- func (s *PublicTransactionPoolAPI) GetTransactionByBlockHashAndIndex(ctx context.Context, blockHash common.Hash, index hexutil.Uint) *RPCTransaction
- func (s *PublicTransactionPoolAPI) GetTransactionByBlockNumberAndIndex(ctx context.Context, blockNr rpc.BlockNumber, index hexutil.Uint) *RPCTransaction
- func (s *PublicTransactionPoolAPI) GetTransactionByHash(ctx context.Context, hash common.Hash) *RPCTransaction
- func (s *PublicTransactionPoolAPI) GetTransactionCount(ctx context.Context, addr string, blockNr rpc.BlockNumber) (*hexutil.Uint64, error)
- func (s *PublicTransactionPoolAPI) GetTransactionReceipt(ctx context.Context, hash common.Hash) (map[string]interface{}, error)
- func (s *PublicTransactionPoolAPI) GetTransactionsCount(ctx context.Context, address, txType string) (uint64, error)
- func (s *PublicTransactionPoolAPI) GetTransactionsHistory(ctx context.Context, args TxHistoryArgs) (map[string]interface{}, error)
- func (s *PublicTransactionPoolAPI) PendingStakingTransactions() ([]*RPCStakingTransaction, error)
- func (s *PublicTransactionPoolAPI) PendingTransactions() ([]*RPCTransaction, error)
- func (s *PublicTransactionPoolAPI) SendRawStakingTransaction(ctx context.Context, encodedTx hexutil.Bytes) (common.Hash, error)
- func (s *PublicTransactionPoolAPI) SendRawTransaction(ctx context.Context, encodedTx hexutil.Bytes) (common.Hash, error)
- type RPCBlock
- type RPCCXReceipt
- type RPCDelegation
- type RPCStakingTransaction
- type RPCTransaction
- type RPCUndelegation
- type SendTxArgs
- type StakingNetworkInfo
- type TxHistoryArgs
Constants ¶
This section is empty.
Variables ¶
var ( // ErrIncorrectChainID is an incorrect chain ID. ErrIncorrectChainID = errors.New("incorrect chain ID") )
Functions ¶
func RPCMarshalBlock ¶
RPCMarshalBlock converts the given block to the RPC output which depends on fullTx. If inclTx is true transactions are returned. When fullTx is true the returned block contains full transaction details, otherwise it will only contain transaction hashes.
func ReturnWithPagination ¶
ReturnWithPagination returns result with pagination (offset, page in TxHistoryArgs).
func SubmitStakingTransaction ¶
func SubmitStakingTransaction( ctx context.Context, b Backend, tx *staking.StakingTransaction, ) (common.Hash, error)
SubmitStakingTransaction is a helper function that submits tx to txPool and logs a message.
func SubmitTransaction ¶
func SubmitTransaction( ctx context.Context, b Backend, tx *types.Transaction, ) (common.Hash, error)
SubmitTransaction is a helper function that submits tx to txPool and logs a message.
Types ¶
type AddrLocker ¶
type AddrLocker struct {
// contains filtered or unexported fields
}
AddrLocker ...
func (*AddrLocker) LockAddr ¶
func (l *AddrLocker) LockAddr(address common.Address)
LockAddr locks an account's mutex. This is used to prevent another tx getting the same nonce until the lock is released. The mutex prevents the (an identical nonce) from being read again during the time that the first transaction is being signed.
func (*AddrLocker) UnlockAddr ¶
func (l *AddrLocker) UnlockAddr(address common.Address)
UnlockAddr unlocks the mutex of the given account.
type Backend ¶
type Backend interface { NetVersion() uint64 ProtocolVersion() int ChainDb() ethdb.Database EventMux() *event.TypeMux RPCGasCap() *big.Int // global gas cap for hmy_call over rpc: DoS protection HeaderByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*block.Header, error) BlockByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*types.Block, error) StateAndHeaderByNumber( ctx context.Context, blockNr rpc.BlockNumber, ) (*state.DB, *block.Header, error) GetBlock(ctx context.Context, blockHash common.Hash) (*types.Block, error) GetReceipts(ctx context.Context, blockHash common.Hash) (types.Receipts, error) GetEVM(ctx context.Context, msg core.Message, state *state.DB, header *block.Header) (*vm.EVM, func() error, error) SubscribeChainEvent(ch chan<- core.ChainEvent) event.Subscription SubscribeChainHeadEvent(ch chan<- core.ChainHeadEvent) event.Subscription SubscribeChainSideEvent(ch chan<- core.ChainSideEvent) event.Subscription // TxPool API SendTx(ctx context.Context, signedTx *types.Transaction) error // GetTransaction(ctx context.Context, txHash common.Hash) (*types.Transaction, common.Hash, uint64, uint64, error) GetPoolTransactions() (types.PoolTransactions, error) GetPoolTransaction(txHash common.Hash) types.PoolTransaction GetPoolNonce(ctx context.Context, addr common.Address) (uint64, error) // Get account nonce GetAccountNonce(ctx context.Context, address common.Address, blockNr rpc.BlockNumber) (uint64, error) // Stats() (pending int, queued int) // TxPoolContent() (map[common.Address]types.Transactions, map[common.Address]types.Transactions) SubscribeNewTxsEvent(chan<- core.NewTxsEvent) event.Subscription ChainConfig() *params.ChainConfig CurrentBlock() *types.Block // Get balance GetBalance(ctx context.Context, address common.Address, blockNr rpc.BlockNumber) (*big.Int, error) // Get validators for a particular epoch GetValidators(epoch *big.Int) (*shard.Committee, error) GetShardID() uint32 GetTransactionsHistory(address, txType, order string) ([]common.Hash, error) GetStakingTransactionsHistory(address, txType, order string) ([]common.Hash, error) GetTransactionsCount(address, txType string) (uint64, error) GetStakingTransactionsCount(address, txType string) (uint64, error) // retrieve the blockHash using txID and add blockHash to CxPool for resending ResendCx(ctx context.Context, txID common.Hash) (uint64, bool) IsLeader() bool SendStakingTx(ctx context.Context, newStakingTx *staking.StakingTransaction) error GetElectedValidatorAddresses() []common.Address GetAllValidatorAddresses() []common.Address GetValidatorInformation(addr common.Address, block *types.Block) (*staking.ValidatorRPCEnchanced, error) GetDelegationsByValidator(validator common.Address) []*staking.Delegation GetDelegationsByDelegator(delegator common.Address) ([]common.Address, []*staking.Delegation) GetValidatorSelfDelegation(addr common.Address) *big.Int GetShardState() (*shard.State, error) GetCurrentStakingErrorSink() []staking.RPCTransactionError GetCurrentTransactionErrorSink() []types.RPCTransactionError GetMedianRawStakeSnapshot() (*committee.CompletedEPoSRound, error) GetPendingCXReceipts() []*types.CXReceiptsProof GetCurrentUtilityMetrics() (*network.UtilityMetric, error) GetSuperCommittees() (*quorum.Transition, error) GetTotalStakingSnapshot() *big.Int GetCurrentBadBlocks() []core.BadBlock GetLastCrossLinks() ([]*types.CrossLink, error) GetLatestChainHeaders() *block.HeaderPair GetNodeMetadata() commonRPC.NodeMetadata }
Backend interface provides the common API services (that are provided by both full and light clients) with access to necessary functions. implementations:
- hmy/api_backend.go
type BlockArgs ¶ added in v1.3.0
type BlockArgs struct { WithSigners bool `json:"withSigners"` InclTx bool `json:"inclTx"` FullTx bool `json:"fullTx"` Signers []string `json:"signers"` InclStaking bool `json:"inclStaking"` }
BlockArgs is struct to include optional block formatting params.
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 DebugAPI ¶
type DebugAPI struct {
// contains filtered or unexported fields
}
DebugAPI Internal JSON RPC for debugging purpose
func NewDebugAPI ¶
NewDebugAPI Creates a new DebugAPI instance
func (*DebugAPI) SetLogVerbosity ¶
SetLogVerbosity Sets log verbosity on runtime Example usage:
curl -H "Content-Type: application/json" -d '{"method":"debug_setLogVerbosity","params":[0],"id":1}' http://localhost:9123
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"` }
HeaderInformation represents the latest consensus information
type PublicBlockChainAPI ¶
type PublicBlockChainAPI struct {
// contains filtered or unexported fields
}
PublicBlockChainAPI provides an API to access the Harmony blockchain. It offers only methods that operate on public data that is freely available to anyone.
func NewPublicBlockChainAPI ¶
func NewPublicBlockChainAPI(b Backend) *PublicBlockChainAPI
NewPublicBlockChainAPI creates a new Harmony blockchain API.
func (*PublicBlockChainAPI) BlockNumber ¶
func (s *PublicBlockChainAPI) BlockNumber() hexutil.Uint64
BlockNumber returns the block number of the chain head.
func (*PublicBlockChainAPI) Call ¶
func (s *PublicBlockChainAPI) Call(ctx context.Context, args CallArgs, blockNr rpc.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 (*PublicBlockChainAPI) EpochLastBlock ¶ added in v1.3.2
func (s *PublicBlockChainAPI) EpochLastBlock(epoch uint64) (uint64, error)
EpochLastBlock returns epoch last block.
func (*PublicBlockChainAPI) EstimateGas ¶ added in v1.2.3
func (s *PublicBlockChainAPI) 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 (*PublicBlockChainAPI) GetAccountNonce ¶ added in v1.3.8
func (s *PublicBlockChainAPI) GetAccountNonce(ctx context.Context, address string, blockNr rpc.BlockNumber) (uint64, error)
GetAccountNonce returns the nonce value of the given address for the given block number
func (*PublicBlockChainAPI) GetAllDelegationInformation ¶ added in v1.3.2
func (s *PublicBlockChainAPI) GetAllDelegationInformation(ctx context.Context, page int) ([][]*RPCDelegation, error)
GetAllDelegationInformation returns delegation information about `validatorsPageSize` validators, starting at `page*validatorsPageSize`. If page is -1, return all instead of `validatorsPageSize` elements.
func (*PublicBlockChainAPI) GetAllValidatorAddresses ¶ added in v1.3.0
func (s *PublicBlockChainAPI) GetAllValidatorAddresses() ([]string, error)
GetAllValidatorAddresses returns all validator addresses.
func (*PublicBlockChainAPI) GetAllValidatorInformation ¶ added in v1.3.1
func (s *PublicBlockChainAPI) GetAllValidatorInformation( ctx context.Context, page int, ) ([]*staking.ValidatorRPCEnchanced, error)
GetAllValidatorInformation returns information about all validators. If page is -1, return all instead of `validatorsPageSize` elements.
func (*PublicBlockChainAPI) GetAllValidatorInformationByBlockNumber ¶ added in v1.3.7
func (s *PublicBlockChainAPI) GetAllValidatorInformationByBlockNumber( ctx context.Context, page int, blockNr rpc.BlockNumber, ) ([]*staking.ValidatorRPCEnchanced, error)
GetAllValidatorInformationByBlockNumber returns information about all validators. If page is -1, return all instead of `validatorsPageSize` elements.
func (*PublicBlockChainAPI) GetBalance ¶
func (s *PublicBlockChainAPI) GetBalance(ctx context.Context, address string, blockNr rpc.BlockNumber) (*hexutil.Big, error)
GetBalance returns the amount of Nano for the given address in the state of the given block number. The rpc.LatestBlockNumber and rpc.PendingBlockNumber meta block numbers are also allowed.
func (*PublicBlockChainAPI) GetBalanceByBlockNumber ¶ added in v1.2.4
func (s *PublicBlockChainAPI) GetBalanceByBlockNumber(ctx context.Context, address string, blockNr rpc.BlockNumber) (*hexutil.Big, error)
GetBalanceByBlockNumber returns balance by block number.
func (*PublicBlockChainAPI) GetBlockByHash ¶
func (s *PublicBlockChainAPI) GetBlockByHash(ctx context.Context, blockHash common.Hash, fullTx bool) (map[string]interface{}, 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.
func (*PublicBlockChainAPI) GetBlockByHashNew ¶ added in v1.3.0
func (s *PublicBlockChainAPI) GetBlockByHashNew(ctx context.Context, blockHash common.Hash, blockArgs BlockArgs) (map[string]interface{}, error)
GetBlockByHashNew returns the requested block. When fullTx in blockArgs 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 (*PublicBlockChainAPI) GetBlockByNumber ¶
func (s *PublicBlockChainAPI) GetBlockByNumber(ctx context.Context, blockNr rpc.BlockNumber, fullTx bool) (map[string]interface{}, error)
GetBlockByNumber returns the requested block. When blockNr 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.
func (*PublicBlockChainAPI) GetBlockByNumberNew ¶ added in v1.3.0
func (s *PublicBlockChainAPI) GetBlockByNumberNew(ctx context.Context, blockNr rpc.BlockNumber, blockArgs BlockArgs) (map[string]interface{}, error)
GetBlockByNumberNew returns the requested block. When blockNr is -1 the chain head is returned. When fullTx in blockArgs 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 (*PublicBlockChainAPI) GetBlockSigners ¶ added in v1.2.6
func (s *PublicBlockChainAPI) GetBlockSigners(ctx context.Context, blockNr rpc.BlockNumber) ([]string, error)
GetBlockSigners returns signers for a particular block.
func (*PublicBlockChainAPI) GetBlocks ¶ added in v1.3.0
func (s *PublicBlockChainAPI) GetBlocks(ctx context.Context, blockStart rpc.BlockNumber, blockEnd rpc.BlockNumber, blockArgs BlockArgs) ([]map[string]interface{}, error)
GetBlocks method returns blocks in range blockStart, blockEnd just like GetBlockByNumber but all at once.
func (*PublicBlockChainAPI) GetCirculatingSupply ¶ added in v1.3.2
func (s *PublicBlockChainAPI) GetCirculatingSupply() (numeric.Dec, error)
GetCirculatingSupply ..
func (*PublicBlockChainAPI) GetCode ¶
func (s *PublicBlockChainAPI) GetCode(ctx context.Context, addr string, blockNr rpc.BlockNumber) (hexutil.Bytes, error)
GetCode returns the code stored at the given address in the state for the given block number.
func (*PublicBlockChainAPI) GetCurrentBadBlocks ¶ added in v1.3.4
func (s *PublicBlockChainAPI) GetCurrentBadBlocks() []core.BadBlock
GetCurrentBadBlocks ..
func (*PublicBlockChainAPI) GetCurrentUtilityMetrics ¶ added in v1.3.1
func (s *PublicBlockChainAPI) GetCurrentUtilityMetrics() (*network.UtilityMetric, error)
GetCurrentUtilityMetrics ..
func (*PublicBlockChainAPI) GetDelegationByDelegatorAndValidator ¶ added in v1.3.0
func (s *PublicBlockChainAPI) GetDelegationByDelegatorAndValidator(ctx context.Context, address string, validator string) (*RPCDelegation, error)
GetDelegationByDelegatorAndValidator returns a delegation for delegator and validator.
func (*PublicBlockChainAPI) GetDelegationsByDelegator ¶ added in v1.3.0
func (s *PublicBlockChainAPI) GetDelegationsByDelegator(ctx context.Context, address string) ([]*RPCDelegation, error)
GetDelegationsByDelegator returns list of delegations for a delegator address.
func (*PublicBlockChainAPI) GetDelegationsByValidator ¶ added in v1.3.0
func (s *PublicBlockChainAPI) GetDelegationsByValidator(ctx context.Context, address string) ([]*RPCDelegation, error)
GetDelegationsByValidator returns list of delegations for a validator address.
func (*PublicBlockChainAPI) GetElectedValidatorAddresses ¶ added in v1.3.2
func (s *PublicBlockChainAPI) GetElectedValidatorAddresses() ([]string, error)
GetElectedValidatorAddresses returns elected validator addresses.
func (*PublicBlockChainAPI) GetEpoch ¶ added in v1.3.0
func (s *PublicBlockChainAPI) GetEpoch(ctx context.Context) hexutil.Uint64
GetEpoch returns current epoch.
func (*PublicBlockChainAPI) GetLastCrossLinks ¶ added in v1.3.5
func (s *PublicBlockChainAPI) GetLastCrossLinks() ([]*types.CrossLink, error)
GetLastCrossLinks ..
func (*PublicBlockChainAPI) GetLatestChainHeaders ¶ added in v1.2.7
func (s *PublicBlockChainAPI) GetLatestChainHeaders() *block.HeaderPair
GetLatestChainHeaders ..
func (*PublicBlockChainAPI) GetLeader ¶ added in v1.3.0
func (s *PublicBlockChainAPI) GetLeader(ctx context.Context) string
GetLeader returns current shard leader.
func (*PublicBlockChainAPI) GetMedianRawStakeSnapshot ¶ added in v1.3.0
func (s *PublicBlockChainAPI) GetMedianRawStakeSnapshot() ( *committee.CompletedEPoSRound, error, )
GetMedianRawStakeSnapshot returns the raw median stake, only meant to be called on beaconchain explorer node
func (*PublicBlockChainAPI) GetShardID ¶
func (s *PublicBlockChainAPI) GetShardID(ctx context.Context) (int, error)
GetShardID returns shard ID of the requested node.
func (*PublicBlockChainAPI) GetShardingStructure ¶
func (s *PublicBlockChainAPI) GetShardingStructure(ctx context.Context) ([]map[string]interface{}, error)
GetShardingStructure returns an array of sharding structures.
func (*PublicBlockChainAPI) GetSignedBlocks ¶ added in v1.3.0
GetSignedBlocks returns how many blocks a particular validator signed for last defaultBlocksPeriod (3 hours ~ 1500 blocks).
func (*PublicBlockChainAPI) GetStakingNetworkInfo ¶ added in v1.3.2
func (s *PublicBlockChainAPI) GetStakingNetworkInfo( ctx context.Context, ) (*StakingNetworkInfo, error)
GetStakingNetworkInfo ..
func (*PublicBlockChainAPI) GetStorageAt ¶
func (s *PublicBlockChainAPI) GetStorageAt(ctx context.Context, addr string, key string, blockNr rpc.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.
func (*PublicBlockChainAPI) GetSuperCommittees ¶ added in v1.3.2
func (s *PublicBlockChainAPI) GetSuperCommittees() (*quorum.Transition, error)
GetSuperCommittees ..
func (*PublicBlockChainAPI) GetTotalStaking ¶ added in v1.3.2
func (s *PublicBlockChainAPI) GetTotalStaking() (*big.Int, error)
GetTotalStaking returns total staking by validators, only meant to be called on beaconchain explorer node
func (*PublicBlockChainAPI) GetTotalSupply ¶ added in v1.3.2
func (s *PublicBlockChainAPI) GetTotalSupply() (numeric.Dec, error)
GetTotalSupply ..
func (*PublicBlockChainAPI) GetValidatorInformation ¶ added in v1.3.0
func (s *PublicBlockChainAPI) GetValidatorInformation( ctx context.Context, address string, ) (*staking.ValidatorRPCEnchanced, error)
GetValidatorInformation returns information about a validator.
func (*PublicBlockChainAPI) GetValidatorInformationByBlockNumber ¶ added in v1.3.7
func (s *PublicBlockChainAPI) GetValidatorInformationByBlockNumber( ctx context.Context, address string, blockNr rpc.BlockNumber, ) (*staking.ValidatorRPCEnchanced, error)
GetValidatorInformationByBlockNumber returns information about a validator.
func (*PublicBlockChainAPI) GetValidatorSelfDelegation ¶ added in v1.3.0
func (s *PublicBlockChainAPI) GetValidatorSelfDelegation(ctx context.Context, address string) hexutil.Uint64
GetValidatorSelfDelegation returns validator stake.
func (*PublicBlockChainAPI) GetValidatorTotalDelegation ¶ added in v1.3.0
func (s *PublicBlockChainAPI) GetValidatorTotalDelegation(ctx context.Context, address string) hexutil.Uint64
GetValidatorTotalDelegation returns total balace stacking for validator with delegation.
func (*PublicBlockChainAPI) GetValidators ¶ added in v1.3.0
func (s *PublicBlockChainAPI) GetValidators(ctx context.Context, epoch int64) (map[string]interface{}, error)
GetValidators returns validators list for a particular epoch.
func (*PublicBlockChainAPI) IsBlockSigner ¶ added in v1.3.0
func (s *PublicBlockChainAPI) IsBlockSigner(ctx context.Context, blockNr rpc.BlockNumber, address string) (bool, error)
IsBlockSigner returns true if validator with address signed blockNr block.
func (*PublicBlockChainAPI) IsLastBlock ¶ added in v1.3.2
func (s *PublicBlockChainAPI) IsLastBlock(blockNum uint64) (bool, error)
IsLastBlock checks if block is last epoch block.
func (*PublicBlockChainAPI) LatestHeader ¶
func (s *PublicBlockChainAPI) LatestHeader(ctx context.Context) *HeaderInformation
LatestHeader returns the latest header information
func (*PublicBlockChainAPI) 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 PublicHarmonyAPI ¶
type PublicHarmonyAPI struct {
// contains filtered or unexported fields
}
PublicHarmonyAPI provides an API to access Harmony related information. It offers only methods that operate on public data that is freely available to anyone.
func NewPublicHarmonyAPI ¶
func NewPublicHarmonyAPI(b Backend) *PublicHarmonyAPI
NewPublicHarmonyAPI ...
func (*PublicHarmonyAPI) GetNodeMetadata ¶
func (s *PublicHarmonyAPI) GetNodeMetadata() commonRPC.NodeMetadata
GetNodeMetadata produces a NodeMetadata record, data is from the answering RPC node
func (*PublicHarmonyAPI) ProtocolVersion ¶
func (s *PublicHarmonyAPI) ProtocolVersion() hexutil.Uint
ProtocolVersion returns the current Harmony protocol version this node supports
func (*PublicHarmonyAPI) Syncing ¶
func (s *PublicHarmonyAPI) Syncing() (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 PublicNetAPI ¶
type PublicNetAPI struct {
// contains filtered or unexported fields
}
PublicNetAPI offers network related RPC methods
func NewPublicNetAPI ¶
func NewPublicNetAPI(net p2p.Host, networkVersion uint64) *PublicNetAPI
NewPublicNetAPI creates a new net API instance.
func (*PublicNetAPI) PeerCount ¶
func (s *PublicNetAPI) PeerCount() hexutil.Uint
PeerCount returns the number of connected peers
func (*PublicNetAPI) Version ¶
func (s *PublicNetAPI) Version() string
Version returns the network version, i.e. network ID identifying which network we are using
type PublicTransactionPoolAPI ¶
type PublicTransactionPoolAPI struct {
// contains filtered or unexported fields
}
PublicTransactionPoolAPI exposes methods for the RPC interface
func NewPublicTransactionPoolAPI ¶
func NewPublicTransactionPoolAPI(b Backend, nonceLock *AddrLocker) *PublicTransactionPoolAPI
NewPublicTransactionPoolAPI creates a new RPC service with methods specific for the transaction pool.
func (*PublicTransactionPoolAPI) GetBlockTransactionCountByHash ¶
func (s *PublicTransactionPoolAPI) GetBlockTransactionCountByHash(ctx context.Context, blockHash common.Hash) *hexutil.Uint
GetBlockTransactionCountByHash returns the number of transactions in the block with the given hash.
func (*PublicTransactionPoolAPI) GetBlockTransactionCountByNumber ¶
func (s *PublicTransactionPoolAPI) GetBlockTransactionCountByNumber(ctx context.Context, blockNr rpc.BlockNumber) *hexutil.Uint
GetBlockTransactionCountByNumber returns the number of transactions in the block with the given block number.
func (*PublicTransactionPoolAPI) GetCXReceiptByHash ¶
func (s *PublicTransactionPoolAPI) GetCXReceiptByHash( ctx context.Context, hash common.Hash, ) *RPCCXReceipt
GetCXReceiptByHash returns the transaction for the given hash
func (*PublicTransactionPoolAPI) GetCurrentStakingErrorSink ¶ added in v1.3.0
func (s *PublicTransactionPoolAPI) GetCurrentStakingErrorSink() []staking.RPCTransactionError
GetCurrentStakingErrorSink ..
func (*PublicTransactionPoolAPI) GetCurrentTransactionErrorSink ¶ added in v1.2.2
func (s *PublicTransactionPoolAPI) GetCurrentTransactionErrorSink() []types.RPCTransactionError
GetCurrentTransactionErrorSink ..
func (*PublicTransactionPoolAPI) GetPendingCXReceipts ¶
func (s *PublicTransactionPoolAPI) GetPendingCXReceipts(ctx context.Context) []*types.CXReceiptsProof
GetPendingCXReceipts ..
func (*PublicTransactionPoolAPI) GetStakingTransactionByBlockHashAndIndex ¶ added in v1.3.0
func (s *PublicTransactionPoolAPI) GetStakingTransactionByBlockHashAndIndex(ctx context.Context, blockHash common.Hash, index hexutil.Uint) *RPCStakingTransaction
GetStakingTransactionByBlockHashAndIndex returns the transaction for the given block hash and index.
func (*PublicTransactionPoolAPI) GetStakingTransactionByBlockNumberAndIndex ¶ added in v1.3.0
func (s *PublicTransactionPoolAPI) GetStakingTransactionByBlockNumberAndIndex(ctx context.Context, blockNr rpc.BlockNumber, index hexutil.Uint) *RPCStakingTransaction
GetStakingTransactionByBlockNumberAndIndex returns the transaction for the given block number and index.
func (*PublicTransactionPoolAPI) GetStakingTransactionByHash ¶ added in v1.3.0
func (s *PublicTransactionPoolAPI) GetStakingTransactionByHash(ctx context.Context, hash common.Hash) *RPCStakingTransaction
GetStakingTransactionByHash returns the staking transaction for the given hash
func (*PublicTransactionPoolAPI) GetStakingTransactionsCount ¶ added in v1.3.8
func (s *PublicTransactionPoolAPI) GetStakingTransactionsCount(ctx context.Context, address, txType string) (uint64, error)
GetStakingTransactionsCount returns the number of staking transactions from genesis of input type ("SENT", "RECEIVED", "ALL")
func (*PublicTransactionPoolAPI) GetTransactionByBlockHashAndIndex ¶
func (s *PublicTransactionPoolAPI) GetTransactionByBlockHashAndIndex(ctx context.Context, blockHash common.Hash, index hexutil.Uint) *RPCTransaction
GetTransactionByBlockHashAndIndex returns the transaction for the given block hash and index.
func (*PublicTransactionPoolAPI) GetTransactionByBlockNumberAndIndex ¶
func (s *PublicTransactionPoolAPI) GetTransactionByBlockNumberAndIndex(ctx context.Context, blockNr rpc.BlockNumber, index hexutil.Uint) *RPCTransaction
GetTransactionByBlockNumberAndIndex returns the transaction for the given block number and index.
func (*PublicTransactionPoolAPI) GetTransactionByHash ¶
func (s *PublicTransactionPoolAPI) GetTransactionByHash(ctx context.Context, hash common.Hash) *RPCTransaction
GetTransactionByHash returns the plain transaction for the given hash
func (*PublicTransactionPoolAPI) GetTransactionCount ¶
func (s *PublicTransactionPoolAPI) GetTransactionCount(ctx context.Context, addr string, blockNr rpc.BlockNumber) (*hexutil.Uint64, 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
func (*PublicTransactionPoolAPI) GetTransactionReceipt ¶
func (s *PublicTransactionPoolAPI) GetTransactionReceipt(ctx context.Context, hash common.Hash) (map[string]interface{}, error)
GetTransactionReceipt returns the transaction receipt for the given transaction hash.
func (*PublicTransactionPoolAPI) GetTransactionsCount ¶ added in v1.3.8
func (s *PublicTransactionPoolAPI) GetTransactionsCount(ctx context.Context, address, txType string) (uint64, error)
GetTransactionsCount returns the number of regular transactions from genesis of input type ("SENT", "RECEIVED", "ALL")
func (*PublicTransactionPoolAPI) GetTransactionsHistory ¶
func (s *PublicTransactionPoolAPI) GetTransactionsHistory(ctx context.Context, args TxHistoryArgs) (map[string]interface{}, error)
GetTransactionsHistory returns the list of transactions hashes that involve a particular address.
func (*PublicTransactionPoolAPI) PendingStakingTransactions ¶ added in v1.3.2
func (s *PublicTransactionPoolAPI) PendingStakingTransactions() ([]*RPCStakingTransaction, error)
PendingStakingTransactions returns the staking transactions that are in the transaction pool
func (*PublicTransactionPoolAPI) PendingTransactions ¶
func (s *PublicTransactionPoolAPI) PendingTransactions() ([]*RPCTransaction, error)
PendingTransactions returns the plain transactions that are in the transaction pool
func (*PublicTransactionPoolAPI) SendRawStakingTransaction ¶
func (s *PublicTransactionPoolAPI) 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 (*PublicTransactionPoolAPI) SendRawTransaction ¶
func (s *PublicTransactionPoolAPI) 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 RPCBlock ¶
type RPCBlock struct { Number *hexutil.Big `json:"number"` Hash common.Hash `json:"hash"` ParentHash common.Hash `json:"parentHash"` Nonce types.BlockNonce `json:"nonce"` MixHash common.Hash `json:"mixHash"` LogsBloom ethtypes.Bloom `json:"logsBloom"` StateRoot common.Hash `json:"stateRoot"` Miner common.Address `json:"miner"` Difficulty *hexutil.Big `json:"difficulty"` ExtraData []byte `json:"extraData"` Size hexutil.Uint64 `json:"size"` GasLimit hexutil.Uint64 `json:"gasLimit"` GasUsed hexutil.Uint64 `json:"gasUsed"` Timestamp *big.Int `json:"timestamp"` TransactionsRoot common.Hash `json:"transactionsRoot"` ReceiptsRoot common.Hash `json:"receiptsRoot"` Transactions []interface{} `json:"transactions"` StakingTxs []interface{} `json:"stakingTxs` Uncles []common.Hash `json:"uncles"` TotalDifficulty *big.Int `json:"totalDifficulty"` Signers []string `json:"signers"` }
RPCBlock represents a block that will serialize to the RPC representation of a block
type RPCCXReceipt ¶
type RPCCXReceipt struct { BlockHash common.Hash `json:"blockHash"` BlockNumber *hexutil.Big `json:"blockNumber"` TxHash common.Hash `json:"hash"` From string `json:"from"` To string `json:"to"` ShardID uint32 `json:"shardID"` ToShardID uint32 `json:"toShardID"` Amount *hexutil.Big `json:"value"` }
RPCCXReceipt represents a CXReceipt that will serialize to the RPC representation of a CXReceipt
type RPCDelegation ¶ added in v1.3.0
type RPCDelegation struct { ValidatorAddress string `json:"validator_address"` DelegatorAddress string `json:"delegator_address"` Amount *big.Int `json:"amount"` Reward *big.Int `json:"reward"` Undelegations []RPCUndelegation `json:"Undelegations"` }
RPCDelegation represents a particular delegation to a validator
type RPCStakingTransaction ¶ added in v1.3.0
type RPCStakingTransaction struct { BlockHash common.Hash `json:"blockHash"` BlockNumber *hexutil.Big `json:"blockNumber"` From string `json:"from"` Timestamp hexutil.Uint64 `json:"timestamp"` Gas hexutil.Uint64 `json:"gas"` GasPrice *hexutil.Big `json:"gasPrice"` Hash common.Hash `json:"hash"` Nonce hexutil.Uint64 `json:"nonce"` TransactionIndex hexutil.Uint `json:"transactionIndex"` V *hexutil.Big `json:"v"` R *hexutil.Big `json:"r"` S *hexutil.Big `json:"s"` Type string `json:"type"` Msg map[string]interface{} `json:"msg"` }
RPCStakingTransaction represents a transaction that will serialize to the RPC representation of a staking transaction
type RPCTransaction ¶
type RPCTransaction struct { BlockHash common.Hash `json:"blockHash"` BlockNumber *hexutil.Big `json:"blockNumber"` From string `json:"from"` Timestamp hexutil.Uint64 `json:"timestamp"` Gas hexutil.Uint64 `json:"gas"` GasPrice *hexutil.Big `json:"gasPrice"` Hash common.Hash `json:"hash"` Input hexutil.Bytes `json:"input"` Nonce hexutil.Uint64 `json:"nonce"` To string `json:"to"` TransactionIndex hexutil.Uint `json:"transactionIndex"` Value *hexutil.Big `json:"value"` ShardID uint32 `json:"shardID"` ToShardID uint32 `json:"toShardID"` V *hexutil.Big `json:"v"` R *hexutil.Big `json:"r"` S *hexutil.Big `json:"s"` }
RPCTransaction represents a transaction that will serialize to the RPC representation of a transaction
type RPCUndelegation ¶ added in v1.3.0
RPCUndelegation represents one undelegation entry
type SendTxArgs ¶
type SendTxArgs struct { From common.Address `json:"from"` To *common.Address `json:"to"` ShardID uint32 `json:"shardID"` Gas *hexutil.Uint64 `json:"gas"` GasPrice *hexutil.Big `json:"gasPrice"` Value *hexutil.Big `json:"value"` Nonce *hexutil.Uint64 `json:"nonce"` // We accept "data" and "input" for backwards-compatibility reasons. "input" is the // newer name and should be preferred by clients. Data *hexutil.Bytes `json:"data"` Input *hexutil.Bytes `json:"input"` }
SendTxArgs represents the arguments to sumbit a new transaction into the transaction pool.
type StakingNetworkInfo ¶ added in v1.3.2
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 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 make GetTransactionsHistory request