Documentation ¶
Index ¶
- Constants
- func RPCMarshalBlock(b *types.Block, inclTx bool, fullTx bool) (map[string]interface{}, error)
- type AdminAPI
- type Backend
- type BlockChainAPI
- func (s *BlockChainAPI) ExportBlocks(args ExportBlocksArgs, reply *map[string]interface{}) error
- func (s *BlockChainAPI) GetBlockByHash(args GetBlockByHashArgs, reply *map[string]interface{}) error
- func (s *BlockChainAPI) GetBlockByHeight(args GetBlockByHeightArgs, reply *map[string]interface{}) error
- func (s *BlockChainAPI) GetLatestBlock(args GetLatestBlockArgs, reply *map[string]interface{}) error
- func (s *BlockChainAPI) GetLatestBlockHeight(ingore string, reply *utils.Uint64) error
- func (s *BlockChainAPI) GetTransactionByHash(Hash utils.Hash, reply *RPCTransaction) error
- func (s *BlockChainAPI) GetTransactionReceipt(Hash utils.Hash, reply *map[string]interface{}) error
- func (s *BlockChainAPI) ImportBlocks(filename string, reply *map[string]interface{}) error
- type BlockHeight
- type CallArgs
- type CandidateArgs
- type CandidateInfo
- type CandidateInfos
- type DeleteArgs
- type DposAPI
- func (api *DposAPI) GetBFTConfirmedBlockNumber(ignore string, reply *utils.Big) error
- func (api *DposAPI) GetCandidates(number *BlockHeight, reply *[]*CandidateInfo) error
- func (api *DposAPI) GetConfirmedBlockNumber(ignore string, reply *utils.Big) error
- func (api *DposAPI) GetDelegators(args *CandidateArgs, reply *[]*VoterInfo) error
- func (api *DposAPI) GetValidators(number *BlockHeight, reply *[]utils.Address) error
- func (api *DposAPI) GetVoter(args *VoterInfoArgs, reply *VoterInfo) error
- func (api *DposAPI) GetVoters(number *BlockHeight, reply *[]*VoterInfo) error
- type ExportBlocksArgs
- type ExportRawKeyArgs
- type GetBalanceArgs
- type GetBlockByHashArgs
- type GetBlockByHeightArgs
- type GetCodeArgs
- type GetLatestBlockArgs
- type GetNonceArgs
- type ImportRawKeyArgs
- type MinerAPI
- type RPCTransaction
- type SendTxArgs
- type TransactionPoolAPI
- type UpdateArgs
- type UranusAPI
- func (u *UranusAPI) Call(args CallArgs, reply *map[string]interface{}) error
- func (u *UranusAPI) GetBalance(args GetBalanceArgs, reply *utils.Big) error
- func (u *UranusAPI) GetCode(args GetCodeArgs, reply *utils.Bytes) error
- func (u *UranusAPI) GetDelegateTimestamp(args GetBalanceArgs, reply *utils.Big) error
- func (u *UranusAPI) GetLockedBalance(args GetBalanceArgs, reply *utils.Big) error
- func (u *UranusAPI) GetNonce(args GetNonceArgs, reply *utils.Uint64) error
- func (u *UranusAPI) GetUnDelegateTimestamp(args GetBalanceArgs, reply *utils.Big) error
- func (u *UranusAPI) GetUnLockedBalance(args GetBalanceArgs, reply *utils.Big) error
- func (u *UranusAPI) SendRawTransaction(encodedTx utils.Bytes, reply *utils.Hash) error
- func (u *UranusAPI) SignAndSendTransaction(args SendTxArgs, reply *utils.Hash) error
- func (u *UranusAPI) SuggestGasPrice(ignore string, reply *utils.Big) error
- type VoterInfo
- type VoterInfoArgs
- type WalletAPI
- func (w *WalletAPI) Accounts(ignore string, reply *wallet.Accounts) error
- func (w *WalletAPI) Delete(args DeleteArgs, reply *bool) error
- func (w *WalletAPI) ExportRawKey(args ExportRawKeyArgs, reply *string) error
- func (w *WalletAPI) ImportRawKey(args ImportRawKeyArgs, reply *utils.Address) error
- func (w *WalletAPI) NewAccount(passphrase string, reply *utils.Address) error
- func (w *WalletAPI) Update(args UpdateArgs, reply *bool) error
Constants ¶
const ( PendingBlockHeight = BlockHeight(-2) LatestBlockHeight = BlockHeight(-1) EarliestBlockHeight = BlockHeight(0) )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AdminAPI ¶
type AdminAPI struct {
// contains filtered or unexported fields
}
AdminAPI exposes methods for the RPC interface
func NewAdminAPI ¶
NewAdminAPI creates a new API definition for admin methods of the node itself.
func (*AdminAPI) NodeInfo ¶
NodeInfo retrieves all the information we know about the host node at the protocol granularity.
type Backend ¶
type Backend interface { // blockchain backend BlockChain() *core.BlockChain CurrentBlock() *types.Block BlockByHeight(ctx context.Context, height BlockHeight) (*types.Block, error) BlockByHash(ctx context.Context, blockHash utils.Hash) (*types.Block, error) GetReceipts(ctx context.Context, blockHash utils.Hash) (types.Receipts, error) GetReceipt(ctx context.Context, txHash utils.Hash) (*types.Receipt, error) GetLogs(ctx context.Context, blockHash utils.Hash) ([][]*types.Log, error) GetTd(blockHash utils.Hash) *big.Int GetTransaction(txHash utils.Hash) *types.StorageTx // txpool backend SendTx(ctx context.Context, signedTx *types.Transaction) error GetPoolTransactions() (types.Transactions, error) GetPoolTransaction(txHash utils.Hash) *types.Transaction GetPoolNonce(ctx context.Context, addr utils.Address) (uint64, error) TxPoolStats() (pending int, queued int) TxPoolContent() (map[utils.Address]types.Transactions, map[utils.Address]types.Transactions) // wallet backend NewAccount(passphrase string) (wallet.Account, error) Delete(address utils.Address, passphrase string) error Update(address utils.Address, passphrase, newPassphrase string) error SignTx(addr utils.Address, tx *types.Transaction, passphrase string) (*types.Transaction, error) Accounts() (wallet.Accounts, error) ImportRawKey(privkey string, passphrase string) (utils.Address, error) ExportRawKey(addr utils.Address, passphrase string) (string, error) // forecast backend SuggestGasPrice(ctx context.Context) (*big.Int, error) // evm GetEVM(ctx context.Context, from utils.Address, tx *types.Transaction, state *state.StateDB, bheader *types.BlockHeader, vmCfg vm.Config) (*vm.EVM, func() error, error) // p2p AddPeer(url string) error RemovePeer(url string) error Peers() ([]*p2p.PeerInfo, error) NodeInfo() (*p2p.NodeInfo, error) //miner Start(int32) error Stop() error SetCoinbase(utils.Address) error GetConfirmedBlockNumber() (*big.Int, error) GetBFTConfirmedBlockNumber() (*big.Int, error) }
Backend for rpc api
type BlockChainAPI ¶
type BlockChainAPI struct {
// contains filtered or unexported fields
}
BlockChainAPI exposes methods for the RPC interface
func NewBlockChainAPI ¶
func NewBlockChainAPI(b Backend) *BlockChainAPI
NewBlockChainAPI creates a new RPC service with methods specific for the blockchain.
func (*BlockChainAPI) ExportBlocks ¶
func (s *BlockChainAPI) ExportBlocks(args ExportBlocksArgs, reply *map[string]interface{}) error
ExportBlocks export block
func (*BlockChainAPI) GetBlockByHash ¶
func (s *BlockChainAPI) GetBlockByHash(args GetBlockByHashArgs, reply *map[string]interface{}) error
GetBlockByHash returns the requested block.
func (*BlockChainAPI) GetBlockByHeight ¶
func (s *BlockChainAPI) GetBlockByHeight(args GetBlockByHeightArgs, reply *map[string]interface{}) error
GetBlockByHeight returns the requested block.
func (*BlockChainAPI) GetLatestBlock ¶
func (s *BlockChainAPI) GetLatestBlock(args GetLatestBlockArgs, reply *map[string]interface{}) error
GetLatestBlock returns the latest block.
func (*BlockChainAPI) GetLatestBlockHeight ¶
func (s *BlockChainAPI) GetLatestBlockHeight(ingore string, reply *utils.Uint64) error
GetLatestBlockHeight returns the latest block height.
func (*BlockChainAPI) GetTransactionByHash ¶
func (s *BlockChainAPI) GetTransactionByHash(Hash utils.Hash, reply *RPCTransaction) error
GetTransactionByHash returns the transaction for the given hash
func (*BlockChainAPI) GetTransactionReceipt ¶
func (s *BlockChainAPI) GetTransactionReceipt(Hash utils.Hash, reply *map[string]interface{}) error
GetTransactionReceipt returns the transaction receipt for the given transaction hash.
func (*BlockChainAPI) ImportBlocks ¶
func (s *BlockChainAPI) ImportBlocks(filename string, reply *map[string]interface{}) error
ImportBlocks import blocks
type BlockHeight ¶
type BlockHeight int64
func (BlockHeight) Int64 ¶
func (bn BlockHeight) Int64() int64
func (*BlockHeight) MarshalJSON ¶
func (bn *BlockHeight) MarshalJSON() (b []byte, err error)
func (*BlockHeight) UnmarshalJSON ¶
func (bn *BlockHeight) UnmarshalJSON(data []byte) error
type CallArgs ¶
type CallArgs struct { From utils.Address Tos []*utils.Address Gas utils.Uint64 GasPrice utils.Big Value utils.Big Data utils.Bytes TxType uint8 BlockHeight *BlockHeight }
CallArgs represents the arguments for a call.
type CandidateArgs ¶
type CandidateArgs struct { BlockHeight *BlockHeight Candidate utils.Address }
type CandidateInfo ¶
type CandidateInfos ¶
type CandidateInfos []*CandidateInfo
func (CandidateInfos) Len ¶
func (p CandidateInfos) Len() int
func (CandidateInfos) Less ¶
func (p CandidateInfos) Less(i, j int) bool
func (CandidateInfos) Swap ¶
func (p CandidateInfos) Swap(i, j int)
type DeleteArgs ¶
type DposAPI ¶
type DposAPI struct {
// contains filtered or unexported fields
}
DposAPI exposes methods for the RPC interface
func NewDposAPI ¶
NewDposAPI creates a new API definition for dpos methods of the node itself.
func (*DposAPI) GetBFTConfirmedBlockNumber ¶
GetBFTConfirmedBlockNumber retrieves the bft latest irreversible block
func (*DposAPI) GetCandidates ¶
func (api *DposAPI) GetCandidates(number *BlockHeight, reply *[]*CandidateInfo) error
GetCandidates retrieves the list of the candidate at specified block
func (*DposAPI) GetConfirmedBlockNumber ¶
GetConfirmedBlockNumber retrieves the latest irreversible block
func (*DposAPI) GetDelegators ¶
func (api *DposAPI) GetDelegators(args *CandidateArgs, reply *[]*VoterInfo) error
GetDelegators retrieves the list of the delegators of specified candidate at specified block
func (*DposAPI) GetValidators ¶
func (api *DposAPI) GetValidators(number *BlockHeight, reply *[]utils.Address) error
GetValidators retrieves the list of the validators at specified block
type ExportBlocksArgs ¶
type ExportBlocksArgs struct { FileName string FirstHeight *BlockHeight LastHeight *BlockHeight }
ExportBlocksArgs export blocks
type ExportRawKeyArgs ¶
type GetBalanceArgs ¶
type GetBalanceArgs struct { Address utils.Address BlockHeight *BlockHeight }
type GetBlockByHashArgs ¶
type GetBlockByHeightArgs ¶
type GetBlockByHeightArgs struct { BlockHeight *BlockHeight FullTx bool }
type GetCodeArgs ¶
type GetCodeArgs struct {
GetBalanceArgs
}
type GetLatestBlockArgs ¶
type GetLatestBlockArgs struct {
FullTx bool
}
type GetNonceArgs ¶
type GetNonceArgs struct {
GetBalanceArgs
}
type ImportRawKeyArgs ¶
type MinerAPI ¶
type MinerAPI struct {
// contains filtered or unexported fields
}
MinerAPI exposes methods for the RPC interface
func NewMinerAPI ¶
NewMinerAPI creates a new API definition for admin methods of the node itself.
func (*MinerAPI) SetCoinbase ¶
SetCoinbase the coinbase of the miner
type RPCTransaction ¶
type RPCTransaction struct { BlockHash utils.Hash `json:"blockHash"` BlockHeight *utils.Big `json:"blockHeight"` Type utils.Uint64 `json:"type"` From utils.Address `json:"from"` Gas utils.Uint64 `json:"gas"` GasPrice *utils.Big `json:"gasPrice"` Hash utils.Hash `json:"hash"` Input utils.Bytes `json:"input"` Nonce utils.Uint64 `json:"nonce"` Tos []*utils.Address `json:"tos"` TransactionIndex utils.Uint `json:"transactionIndex"` Value *utils.Big `json:"value"` Signature utils.Bytes `json:"signature"` }
type SendTxArgs ¶
type SendTxArgs struct { From utils.Address Tos []*utils.Address Gas *utils.Uint64 GasPrice *utils.Big Value *utils.Big Nonce *utils.Uint64 Data *utils.Bytes TxType *utils.Uint64 Passphrase string }
SendTxArgs represents the arguments to sumbit a new transaction into the transaction pool.
type TransactionPoolAPI ¶
type TransactionPoolAPI struct {
// contains filtered or unexported fields
}
TransactionPoolAPI exposes methods for the RPC interface
func NewTransactionPoolAPI ¶
func NewTransactionPoolAPI(b Backend) *TransactionPoolAPI
NewTransactionPoolAPI creates a new RPC service with methods specific for the transaction pool.
func (*TransactionPoolAPI) Content ¶
func (s *TransactionPoolAPI) Content(ignore string, reply *map[string]map[string]map[string]*RPCTransaction) error
Content returns the transactions contained within the transaction pool.
type UpdateArgs ¶
type UranusAPI ¶
type UranusAPI struct {
// contains filtered or unexported fields
}
UranusAPI exposes methods for the RPC interface
func NewUranusAPI ¶
NewUranusAPI creates a new RPC service with methods specific for the uranus.
func (*UranusAPI) Call ¶
Call executes the given transaction on the state for the given block number.
func (*UranusAPI) GetBalance ¶
func (u *UranusAPI) GetBalance(args GetBalanceArgs, reply *utils.Big) error
GetBalance returns the amount of wei for the given address in the state of the given block number
func (*UranusAPI) GetCode ¶
func (u *UranusAPI) GetCode(args GetCodeArgs, reply *utils.Bytes) error
GetCode returns code for the given address
func (*UranusAPI) GetDelegateTimestamp ¶
func (u *UranusAPI) GetDelegateTimestamp(args GetBalanceArgs, reply *utils.Big) error
GetDelegateTimestamp returns the locked amount of wei for the given address in the state of the given block number
func (*UranusAPI) GetLockedBalance ¶
func (u *UranusAPI) GetLockedBalance(args GetBalanceArgs, reply *utils.Big) error
GetLockedBalance returns the locked amount of wei for the given address in the state of the given block number
func (*UranusAPI) GetNonce ¶
func (u *UranusAPI) GetNonce(args GetNonceArgs, reply *utils.Uint64) error
GetNonce returns nonce for the given address
func (*UranusAPI) GetUnDelegateTimestamp ¶
func (u *UranusAPI) GetUnDelegateTimestamp(args GetBalanceArgs, reply *utils.Big) error
GetUnDelegateTimestamp returns the unlocked amount of wei for the given address in the state of the given block number
func (*UranusAPI) GetUnLockedBalance ¶
func (u *UranusAPI) GetUnLockedBalance(args GetBalanceArgs, reply *utils.Big) error
GetUnLockedBalance returns the unlocked amount of wei for the given address in the state of the given block number
func (*UranusAPI) SendRawTransaction ¶
SendRawTransaction will add the signed transaction to the transaction pool.
func (*UranusAPI) SignAndSendTransaction ¶
func (u *UranusAPI) SignAndSendTransaction(args SendTxArgs, reply *utils.Hash) error
SignAndSendTransaction sign and send transaction .
type VoterInfoArgs ¶
type VoterInfoArgs struct { BlockHeight *BlockHeight Delegator utils.Address }
type WalletAPI ¶
type WalletAPI struct {
// contains filtered or unexported fields
}
WalletAPI exposes methods for the RPC interface
func NewWalletAPI ¶
NewWalletAPI creates a new RPC service with methods specific for the wallet.
func (*WalletAPI) Delete ¶
func (w *WalletAPI) Delete(args DeleteArgs, reply *bool) error
Delete delete a account by address and passphrase, at the same time, delete keyfile.
func (*WalletAPI) ExportRawKey ¶
func (w *WalletAPI) ExportRawKey(args ExportRawKeyArgs, reply *string) error
ExportRawKey returns key hex.
func (*WalletAPI) ImportRawKey ¶
func (w *WalletAPI) ImportRawKey(args ImportRawKeyArgs, reply *utils.Address) error
ImportRawKey import raw PrivateKey into walet.
func (*WalletAPI) NewAccount ¶
NewAccount create a new account, and generate keyfile in keystore dir.