Documentation ¶
Index ¶
- Variables
- func GetAPIs(b Backend) []rpc.API
- func RPCMarshalBlock(b *types.Block, blockArgs BlockArgs) (map[string]interface{}, error)
- func ReturnWithPagination(hashes []common.Hash, args TxHistoryArgs) []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 NodeMetadata
- type PrivateAccountAPI
- type PublicAccountAPI
- 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) GetActiveValidatorAddresses() ([]string, error)
- func (s *PublicBlockChainAPI) GetAllValidatorAddresses() ([]string, error)
- func (s *PublicBlockChainAPI) GetBalance(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) GetCode(ctx context.Context, addr string, blockNr rpc.BlockNumber) (hexutil.Bytes, 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) GetEpoch(ctx context.Context) hexutil.Uint64
- func (s *PublicBlockChainAPI) GetLeader(ctx context.Context) string
- func (s *PublicBlockChainAPI) GetMedianRawStakeSnapshot() (uint64, 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) GetStorageAt(ctx context.Context, addr string, key string, blockNr rpc.BlockNumber) (hexutil.Bytes, error)
- func (s *PublicBlockChainAPI) GetValidatorInformation(ctx context.Context, address string) (*staking.Validator, error)
- func (s *PublicBlockChainAPI) GetValidatorMetrics(ctx context.Context, address string) (*staking.ValidatorStats, 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) LatestHeader(ctx context.Context) *HeaderInformation
- func (s *PublicBlockChainAPI) ResendCx(ctx context.Context, txID common.Hash) (bool, error)
- type PublicHarmonyAPI
- func (s *PublicHarmonyAPI) GasPrice(ctx context.Context) (*hexutil.Big, error)
- func (s *PublicHarmonyAPI) GetCurrentStakingErrorSink() []staking.RPCTransactionError
- func (s *PublicHarmonyAPI) GetCurrentTransactionErrorSink() []types.RPCTransactionError
- func (s *PublicHarmonyAPI) GetNodeMetadata() NodeMetadata
- func (s *PublicHarmonyAPI) ProtocolVersion() hexutil.Uint
- func (s *PublicHarmonyAPI) Syncing() (interface{}, error)
- 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) 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) 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) GetTransactionsHistory(ctx context.Context, args TxHistoryArgs) (map[string]interface{}, 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)
- func (s *PublicTransactionPoolAPI) SendTransaction(ctx context.Context, args SendTxArgs) (common.Hash, error)
- type RPCBlock
- type RPCCXReceipt
- type RPCDelegation
- type RPCStakingTransaction
- type RPCTransaction
- type RPCUndelegation
- type SendTxArgs
- 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 ¶
func ReturnWithPagination(hashes []common.Hash, args TxHistoryArgs) []common.Hash
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 { // NOTE(ricl): this is not in ETH Backend inteface. They put it directly in eth object. NetVersion() uint64 // General Ethereum API // Downloader() *downloader.Downloader ProtocolVersion() int // SuggestPrice(ctx context.Context) (*big.Int, error) ChainDb() ethdb.Database EventMux() *event.TypeMux AccountManager() *accounts.Manager // ExtRPCEnabled() bool RPCGasCap() *big.Int // global gas cap for hmy_call over rpc: DoS protection // BlockChain API // SetHead(number uint64) 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) // GetTd(blockHash common.Hash) *big.Int 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.Transactions, error) GetPoolTransaction(txHash common.Hash) *types.Transaction GetPoolNonce(ctx context.Context, addr common.Address) (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(address common.Address) (*hexutil.Big, error) // Get validators for a particular epoch GetValidators(epoch *big.Int) (*shard.Committee, error) GetShardID() uint32 // Get transactions history for an address GetTransactionsHistory(address, txType, order string) ([]common.Hash, 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 GetActiveValidatorAddresses() []common.Address GetAllValidatorAddresses() []common.Address GetValidatorInformation(addr common.Address) *staking.Validator GetValidatorStats(addr common.Address) *staking.ValidatorStats 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 IsBeaconChainExplorerNode() bool GetMedianRawStakeSnapshot() *big.Int }
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.9.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 NodeMetadata ¶
type NodeMetadata struct { BLSPublicKey string `json:"blskey"` Version string `json:"version"` NetworkType string `json:"network"` ChainID string `json:"chainid"` IsLeader bool `json:"is-leader"` ShardID uint32 `json:"shard-id"` Role string `json:"role"` }
NodeMetadata captures select metadata of the RPC answering node
type PrivateAccountAPI ¶
type PrivateAccountAPI struct {
// contains filtered or unexported fields
}
PrivateAccountAPI provides an API to access accounts managed by this node. It offers methods to create, (un)lock en list accounts. Some methods accept passwords and are therefore considered private by default.
func (*PrivateAccountAPI) NewAccount ¶
func (s *PrivateAccountAPI) NewAccount(password string) (common.Address, error)
NewAccount will create a new account and returns the address for the new account.
func (*PrivateAccountAPI) SendTransaction ¶
func (s *PrivateAccountAPI) SendTransaction(ctx context.Context, args SendTxArgs, passwd string) (common.Hash, error)
SendTransaction will create a transaction from the given arguments and tries to sign it with the key associated with args.To. If the given passwd isn't able to decrypt the key it fails.
type PublicAccountAPI ¶
type PublicAccountAPI struct {
// contains filtered or unexported fields
}
PublicAccountAPI provides an API to access accounts managed by this node. It offers only methods that can retrieve accounts.
func NewPublicAccountAPI ¶
func NewPublicAccountAPI(am *accounts.Manager) *PublicAccountAPI
NewPublicAccountAPI creates a new PublicAccountAPI.
func (*PublicAccountAPI) Accounts ¶
func (s *PublicAccountAPI) Accounts() []common.Address
Accounts returns the collection of accounts this node manages
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) GetActiveValidatorAddresses ¶ added in v1.9.0
func (s *PublicBlockChainAPI) GetActiveValidatorAddresses() ([]string, error)
GetActiveValidatorAddresses returns active validator addresses.
func (*PublicBlockChainAPI) GetAllValidatorAddresses ¶ added in v1.9.0
func (s *PublicBlockChainAPI) GetAllValidatorAddresses() ([]string, error)
GetAllValidatorAddresses returns all validator addresses.
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) 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.9.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.9.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.9.0
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.9.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) 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) GetDelegationByDelegatorAndValidator ¶ added in v1.9.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.9.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.9.0
func (s *PublicBlockChainAPI) GetDelegationsByValidator(ctx context.Context, address string) ([]*RPCDelegation, error)
GetDelegationsByValidator returns list of delegations for a validator address.
func (*PublicBlockChainAPI) GetEpoch ¶ added in v1.9.0
func (s *PublicBlockChainAPI) GetEpoch(ctx context.Context) hexutil.Uint64
GetEpoch returns current epoch.
func (*PublicBlockChainAPI) GetLeader ¶ added in v1.9.0
func (s *PublicBlockChainAPI) GetLeader(ctx context.Context) string
GetLeader returns current shard leader.
func (*PublicBlockChainAPI) GetMedianRawStakeSnapshot ¶ added in v1.9.0
func (s *PublicBlockChainAPI) GetMedianRawStakeSnapshot() (uint64, 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.9.0
GetSignedBlocks returns how many blocks a particular validator signed for last defaultBlocksPeriod (3 hours ~ 1500 blocks).
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) GetValidatorInformation ¶ added in v1.9.0
func (s *PublicBlockChainAPI) GetValidatorInformation(ctx context.Context, address string) (*staking.Validator, error)
GetValidatorInformation returns information about a validator.
func (*PublicBlockChainAPI) GetValidatorMetrics ¶ added in v1.9.0
func (s *PublicBlockChainAPI) GetValidatorMetrics(ctx context.Context, address string) (*staking.ValidatorStats, error)
GetValidatorMetrics ..
func (*PublicBlockChainAPI) GetValidatorSelfDelegation ¶ added in v1.9.0
func (s *PublicBlockChainAPI) GetValidatorSelfDelegation(ctx context.Context, address string) hexutil.Uint64
GetValidatorSelfDelegation returns validator stake.
func (*PublicBlockChainAPI) GetValidatorTotalDelegation ¶ added in v1.9.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.9.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.9.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) 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) GetCurrentStakingErrorSink ¶ added in v1.9.0
func (s *PublicHarmonyAPI) GetCurrentStakingErrorSink() []staking.RPCTransactionError
GetCurrentStakingErrorSink ..
func (*PublicHarmonyAPI) GetCurrentTransactionErrorSink ¶
func (s *PublicHarmonyAPI) GetCurrentTransactionErrorSink() []types.RPCTransactionError
GetCurrentTransactionErrorSink ..
func (*PublicHarmonyAPI) GetNodeMetadata ¶
func (s *PublicHarmonyAPI) GetNodeMetadata() 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) GetStakingTransactionByBlockHashAndIndex ¶ added in v1.9.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.9.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.9.0
func (s *PublicTransactionPoolAPI) GetStakingTransactionByHash(ctx context.Context, hash common.Hash) *RPCStakingTransaction
GetStakingTransactionByHash returns the transaction for the given hash
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 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
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) 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) PendingTransactions ¶
func (s *PublicTransactionPoolAPI) PendingTransactions() ([]*RPCTransaction, error)
PendingTransactions returns the 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.
func (*PublicTransactionPoolAPI) SendTransaction ¶
func (s *PublicTransactionPoolAPI) SendTransaction(ctx context.Context, args SendTxArgs) (common.Hash, error)
SendTransaction creates a transaction for the given argument, sign it and submit it to the transaction pool.
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.9.0
type RPCDelegation struct { ValidatorAddress string `json:"validator_address" yaml:"validator_address"` DelegatorAddress string `json:"delegator_address" yaml:"delegator_address"` Amount *big.Int `json:"amount" yaml:"amount"` Reward *big.Int `json:"reward" yaml:"reward"` Undelegations []RPCUndelegation `json:"Undelegations" yaml:"Undelegations"` }
RPCDelegation represents a particular delegation to a validator
type RPCStakingTransaction ¶ added in v1.9.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.9.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 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