Documentation ¶
Overview ¶
Package client provides a client for the FISCO BCOS RPC API.
Package client provides a client for the FISCO BCOS RPC API.
Index ¶
- Constants
- type APIHandler
- func (api *APIHandler) AsyncSendRawTransaction(ctx context.Context, groupID int, tx *types.Transaction, ...) error
- func (api *APIHandler) BroadcastAMOPMsg(topic string, data []byte) error
- func (api *APIHandler) BroadcastAMOPPrivateMsg(topic string, data []byte) error
- func (api *APIHandler) Call(ctx context.Context, groupID int, msg ethereum.CallMsg) ([]byte, error)
- func (api *APIHandler) GetBlockByHash(ctx context.Context, groupID int, blockHash common.Hash, includeTx bool) ([]byte, error)
- func (api *APIHandler) GetBlockByNumber(ctx context.Context, groupID int, blockNumber int64, includeTx bool) ([]byte, error)
- func (api *APIHandler) GetBlockHashByNumber(ctx context.Context, groupID int, blockNumber int64) (*common.Hash, error)
- func (api *APIHandler) GetBlockLimit(ctx context.Context, groupID int) (*big.Int, error)
- func (api *APIHandler) GetBlockNumber(ctx context.Context, groupID int) (int64, error)
- func (api *APIHandler) GetChainID(ctx context.Context) (*big.Int, error)
- func (api *APIHandler) GetClientVersion(ctx context.Context) ([]byte, error)
- func (api *APIHandler) GetCode(ctx context.Context, groupID int, address common.Address) ([]byte, error)
- func (api *APIHandler) GetConsensusStatus(ctx context.Context, groupID int) ([]byte, error)
- func (api *APIHandler) GetContractAddress(ctx context.Context, groupID int, txHash common.Hash) (common.Address, error)
- func (api *APIHandler) GetGroupList(ctx context.Context) ([]byte, error)
- func (api *APIHandler) GetGroupPeers(ctx context.Context, groupID int) ([]byte, error)
- func (api *APIHandler) GetNodeIDList(ctx context.Context, groupID int) ([]byte, error)
- func (api *APIHandler) GetObserverList(ctx context.Context, groupID int) ([]byte, error)
- func (api *APIHandler) GetPBFTView(ctx context.Context, groupID int) ([]byte, error)
- func (api *APIHandler) GetPeers(ctx context.Context, groupID int) ([]byte, error)
- func (api *APIHandler) GetPendingTransactions(ctx context.Context, groupID int) ([]byte, error)
- func (api *APIHandler) GetPendingTxSize(ctx context.Context, groupID int) ([]byte, error)
- func (api *APIHandler) GetSealerList(ctx context.Context, groupID int) ([]byte, error)
- func (api *APIHandler) GetSyncStatus(ctx context.Context, groupID int) ([]byte, error)
- func (api *APIHandler) GetSystemConfigByKey(ctx context.Context, groupID int, configKey string) ([]byte, error)
- func (api *APIHandler) GetTotalTransactionCount(ctx context.Context, groupID int) ([]byte, error)
- func (api *APIHandler) GetTransactionByBlockHashAndIndex(ctx context.Context, groupID int, blockHash common.Hash, txIndex int) ([]byte, error)
- func (api *APIHandler) GetTransactionByBlockNumberAndIndex(ctx context.Context, groupID int, blockNumber int64, txIndex int) ([]byte, error)
- func (api *APIHandler) GetTransactionByHash(ctx context.Context, groupID int, txHash common.Hash) ([]byte, error)
- func (api *APIHandler) GetTransactionReceipt(ctx context.Context, groupID int, txHash common.Hash) (*types.Receipt, error)
- func (api *APIHandler) PublishPrivateTopic(topic string, publicKey []*ecdsa.PublicKey) error
- func (api *APIHandler) SendAMOPMsg(topic string, data []byte) ([]byte, error)
- func (api *APIHandler) SendAMOPPrivateMsg(topic string, data []byte) ([]byte, error)
- func (api *APIHandler) SendRawTransaction(ctx context.Context, groupID int, tx *types.Transaction) (*types.Receipt, error)
- func (api *APIHandler) SubscribeBlockNumberNotify(groupID uint64, handler func(int64)) error
- func (api *APIHandler) SubscribePrivateTopic(topic string, privateKey *ecdsa.PrivateKey, handler func([]byte, *[]byte)) error
- func (api *APIHandler) SubscribeTopic(topic string, handler func([]byte, *[]byte)) error
- func (api *APIHandler) TransactionReceipt(ctx context.Context, groupID int, txHash common.Hash) (*types.Receipt, error)
- func (api *APIHandler) UnsubscribeBlockNumberNotify(groupID uint64) error
- func (api *APIHandler) UnsubscribePrivateTopic(topic string) error
- func (api *APIHandler) UnsubscribeTopic(topic string) error
- type Client
- func (c *Client) AsyncSendTransaction(ctx context.Context, tx *types.Transaction, ...) error
- func (c *Client) BroadcastAMOPMsg(topic string, data []byte) error
- func (c *Client) BroadcastAMOPPrivateMsg(topic string, data []byte) error
- func (c *Client) CallContract(ctx context.Context, msg ethereum.CallMsg, blockNumber *big.Int) ([]byte, error)
- func (c *Client) Close()
- func (c *Client) CodeAt(ctx context.Context, account common.Address, blockNumber *big.Int) ([]byte, error)
- func (c *Client) FilterLogs(ctx context.Context, q ethereum.FilterQuery) ([]types.Log, error)
- func (c *Client) GetBlockByHash(ctx context.Context, blockHash common.Hash, includeTx bool) ([]byte, error)
- func (c *Client) GetBlockByNumber(ctx context.Context, blockNumber int64, includeTx bool) ([]byte, error)
- func (c *Client) GetBlockHashByNumber(ctx context.Context, blockNumber int64) (*common.Hash, error)
- func (c *Client) GetBlockLimit(ctx context.Context) (*big.Int, error)
- func (c *Client) GetBlockNumber(ctx context.Context) (int64, error)
- func (c *Client) GetCallOpts() *bind.CallOpts
- func (c *Client) GetChainID(ctx context.Context) (*big.Int, error)
- func (c *Client) GetClientVersion(ctx context.Context) ([]byte, error)
- func (c *Client) GetCode(ctx context.Context, address common.Address) ([]byte, error)
- func (c *Client) GetCompatibleVersion() int
- func (c *Client) GetConsensusStatus(ctx context.Context) ([]byte, error)
- func (c *Client) GetContractAddress(ctx context.Context, txHash common.Hash) (common.Address, error)
- func (c *Client) GetGroupID() *big.Int
- func (c *Client) GetGroupList(ctx context.Context) ([]byte, error)
- func (c *Client) GetGroupPeers(ctx context.Context) ([]byte, error)
- func (c *Client) GetNodeIDList(ctx context.Context) ([]byte, error)
- func (c *Client) GetObserverList(ctx context.Context) ([]byte, error)
- func (c *Client) GetPBFTView(ctx context.Context) ([]byte, error)
- func (c *Client) GetPeers(ctx context.Context) ([]byte, error)
- func (c *Client) GetPendingTransactions(ctx context.Context) ([]byte, error)
- func (c *Client) GetPendingTxSize(ctx context.Context) ([]byte, error)
- func (c *Client) GetSealerList(ctx context.Context) ([]byte, error)
- func (c *Client) GetSyncStatus(ctx context.Context) ([]byte, error)
- func (c *Client) GetSystemConfigByKey(ctx context.Context, configKey string) ([]byte, error)
- func (c *Client) GetTotalTransactionCount(ctx context.Context) ([]byte, error)
- func (c *Client) GetTransactOpts() *bind.TransactOpts
- func (c *Client) GetTransactionByBlockHashAndIndex(ctx context.Context, blockHash common.Hash, txIndex int) ([]byte, error)
- func (c *Client) GetTransactionByBlockNumberAndIndex(ctx context.Context, blockNumber int64, txIndex int) ([]byte, error)
- func (c *Client) GetTransactionByHash(ctx context.Context, txHash common.Hash) ([]byte, error)
- func (c *Client) GetTransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error)
- func (c *Client) IsClosed() bool
- func (c *Client) PendingCallContract(ctx context.Context, msg ethereum.CallMsg) ([]byte, error)
- func (c *Client) PendingCodeAt(ctx context.Context, account common.Address) ([]byte, error)
- func (c *Client) PublishPrivateTopic(topic string, publicKey []*ecdsa.PublicKey) error
- func (c *Client) SMCrypto() bool
- func (c *Client) SendAMOPMsg(topic string, data []byte) ([]byte, error)
- func (c *Client) SendAMOPPrivateMsg(topic string, data []byte) ([]byte, error)
- func (c *Client) SendTransaction(ctx context.Context, tx *types.Transaction) (*types.Receipt, error)
- func (c *Client) SetGroupID(newID int)
- func (c *Client) SubscribeBlockNumberNotify(handler func(int64)) error
- func (c *Client) SubscribeFilterLogs(ctx context.Context, q ethereum.FilterQuery, ch chan<- types.Log) (ethereum.Subscription, error)
- func (c *Client) SubscribePrivateTopic(topic string, privateKey *ecdsa.PrivateKey, handler func([]byte, *[]byte)) error
- func (c *Client) SubscribeTopic(topic string, handler func([]byte, *[]byte)) error
- func (c *Client) TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error)
- func (c *Client) UnsubscribeBlockNumberNotify() error
- func (c *Client) UnsubscribePrivateTopic(topic string) error
- func (c *Client) UnsubscribeTopic(topic string) error
- func (c *Client) WaitMined(tx *types.Transaction) (*types.Receipt, error)
Constants ¶
const (
BlockLimit int64 = 600
)
const ( //V2_5_0 is node version v2.5.0 V2_5_0 int = 0x02050000 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIHandler ¶
type APIHandler struct {
*conn.Connection
}
APIHandler defines typed wrappers for the FISCO BCOS RPC API.
func NewAPIHandler ¶
func NewAPIHandler(c *conn.Connection) *APIHandler
NewAPIHandler create a new API handler
func (*APIHandler) AsyncSendRawTransaction ¶
func (api *APIHandler) AsyncSendRawTransaction(ctx context.Context, groupID int, tx *types.Transaction, handler func(*types.Receipt, error)) error
AsyncSendRawTransaction send a transaction async
func (*APIHandler) BroadcastAMOPMsg ¶
func (api *APIHandler) BroadcastAMOPMsg(topic string, data []byte) error
func (*APIHandler) BroadcastAMOPPrivateMsg ¶
func (api *APIHandler) BroadcastAMOPPrivateMsg(topic string, data []byte) error
func (*APIHandler) GetBlockByHash ¶
func (api *APIHandler) GetBlockByHash(ctx context.Context, groupID int, blockHash common.Hash, includeTx bool) ([]byte, error)
GetBlockByHash returns the block information according to the given block hash
func (*APIHandler) GetBlockByNumber ¶
func (api *APIHandler) GetBlockByNumber(ctx context.Context, groupID int, blockNumber int64, includeTx bool) ([]byte, error)
GetBlockByNumber returns the block information according to the given block number(hex format)
func (*APIHandler) GetBlockHashByNumber ¶
func (api *APIHandler) GetBlockHashByNumber(ctx context.Context, groupID int, blockNumber int64) (*common.Hash, error)
GetBlockHashByNumber returns the block hash according to the given block number
func (*APIHandler) GetBlockLimit ¶
GetBlockLimit returns the blocklimit for current blocknumber
func (*APIHandler) GetBlockNumber ¶
GetBlockNumber returns the latest block height(hex format) on a given groupID.
func (*APIHandler) GetChainID ¶
GetChainID returns the Chain ID of the FISCO BCOS running on the nodes.
func (*APIHandler) GetClientVersion ¶
func (api *APIHandler) GetClientVersion(ctx context.Context) ([]byte, error)
GetClientVersion returns the version of FISCO BCOS running on the nodes.
func (*APIHandler) GetCode ¶
func (api *APIHandler) GetCode(ctx context.Context, groupID int, address common.Address) ([]byte, error)
GetCode returns the contract code according to the contract address
func (*APIHandler) GetConsensusStatus ¶
GetConsensusStatus returns the status information about the consensus algorithm on a specific groupID
func (*APIHandler) GetContractAddress ¶
func (api *APIHandler) GetContractAddress(ctx context.Context, groupID int, txHash common.Hash) (common.Address, error)
GetContractAddress returns a contract address according to the transaction hash
func (*APIHandler) GetGroupList ¶
func (api *APIHandler) GetGroupList(ctx context.Context) ([]byte, error)
GetGroupList returns the groupID list that the node belongs to
func (*APIHandler) GetGroupPeers ¶
GetGroupPeers returns the nodes and the overser nodes list on a specific group
func (*APIHandler) GetNodeIDList ¶
GetNodeIDList returns the ID information of the connected peers and itself
func (*APIHandler) GetObserverList ¶
GetObserverList returns the list of observer nodes' ID according to the groupID
func (*APIHandler) GetPBFTView ¶
GetPBFTView returns the latest PBFT view(hex format) of the specific group and it will returns a wrong sentence if the consensus algorithm is not the PBFT.
func (*APIHandler) GetPendingTransactions ¶
GetPendingTransactions returns information of the pending transactions
func (*APIHandler) GetPendingTxSize ¶
GetPendingTxSize returns amount of the pending transactions
func (*APIHandler) GetSealerList ¶
GetSealerList returns the list of consensus nodes' ID according to the groupID
func (*APIHandler) GetSyncStatus ¶
GetSyncStatus returns the synchronization status of the group
func (*APIHandler) GetSystemConfigByKey ¶
func (api *APIHandler) GetSystemConfigByKey(ctx context.Context, groupID int, configKey string) ([]byte, error)
GetSystemConfigByKey returns value according to the key(only tx_count_limit, tx_gas_limit could work)
func (*APIHandler) GetTotalTransactionCount ¶
GetTotalTransactionCount returns the total amount of transactions and the block height at present
func (*APIHandler) GetTransactionByBlockHashAndIndex ¶
func (api *APIHandler) GetTransactionByBlockHashAndIndex(ctx context.Context, groupID int, blockHash common.Hash, txIndex int) ([]byte, error)
GetTransactionByBlockHashAndIndex returns the transaction information according to the given block hash and transaction index
func (*APIHandler) GetTransactionByBlockNumberAndIndex ¶
func (api *APIHandler) GetTransactionByBlockNumberAndIndex(ctx context.Context, groupID int, blockNumber int64, txIndex int) ([]byte, error)
GetTransactionByBlockNumberAndIndex returns the transaction information according to the given block number and transaction index
func (*APIHandler) GetTransactionByHash ¶
func (api *APIHandler) GetTransactionByHash(ctx context.Context, groupID int, txHash common.Hash) ([]byte, error)
GetTransactionByHash returns the transaction information according to the given transaction hash
func (*APIHandler) GetTransactionReceipt ¶
func (api *APIHandler) GetTransactionReceipt(ctx context.Context, groupID int, txHash common.Hash) (*types.Receipt, error)
GetTransactionReceipt returns the transaction receipt according to the given transaction hash
func (*APIHandler) PublishPrivateTopic ¶
func (api *APIHandler) PublishPrivateTopic(topic string, publicKey []*ecdsa.PublicKey) error
func (*APIHandler) SendAMOPMsg ¶
func (api *APIHandler) SendAMOPMsg(topic string, data []byte) ([]byte, error)
func (*APIHandler) SendAMOPPrivateMsg ¶
func (api *APIHandler) SendAMOPPrivateMsg(topic string, data []byte) ([]byte, error)
func (*APIHandler) SendRawTransaction ¶
func (api *APIHandler) SendRawTransaction(ctx context.Context, groupID int, tx *types.Transaction) (*types.Receipt, error)
SendRawTransaction injects a signed transaction into the pending pool for execution.
If the transaction was a contract creation use the TransactionReceipt method to get the contract address after the transaction has been mined.
func (*APIHandler) SubscribeBlockNumberNotify ¶
func (api *APIHandler) SubscribeBlockNumberNotify(groupID uint64, handler func(int64)) error
func (*APIHandler) SubscribePrivateTopic ¶
func (api *APIHandler) SubscribePrivateTopic(topic string, privateKey *ecdsa.PrivateKey, handler func([]byte, *[]byte)) error
func (*APIHandler) SubscribeTopic ¶
func (api *APIHandler) SubscribeTopic(topic string, handler func([]byte, *[]byte)) error
func (*APIHandler) TransactionReceipt ¶
func (api *APIHandler) TransactionReceipt(ctx context.Context, groupID int, txHash common.Hash) (*types.Receipt, error)
TransactionReceipt returns the receipt of a transaction by transaction hash. Note that the receipt is not available for pending transactions.
func (*APIHandler) UnsubscribeBlockNumberNotify ¶
func (api *APIHandler) UnsubscribeBlockNumberNotify(groupID uint64) error
func (*APIHandler) UnsubscribePrivateTopic ¶
func (api *APIHandler) UnsubscribePrivateTopic(topic string) error
func (*APIHandler) UnsubscribeTopic ¶
func (api *APIHandler) UnsubscribeTopic(topic string) error
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client defines typed wrappers for the Ethereum RPC API.
func DialContext ¶
DialContext pass the context to the rpc client
func (*Client) AsyncSendTransaction ¶
func (c *Client) AsyncSendTransaction(ctx context.Context, tx *types.Transaction, handler func(*types.Receipt, error)) error
AsyncSendTransaction send transaction async
func (*Client) BroadcastAMOPMsg ¶
func (*Client) BroadcastAMOPPrivateMsg ¶
func (*Client) CallContract ¶
func (c *Client) CallContract(ctx context.Context, msg ethereum.CallMsg, blockNumber *big.Int) ([]byte, error)
CallContract invoke the call method of rpc api
func (*Client) CodeAt ¶
func (c *Client) CodeAt(ctx context.Context, account common.Address, blockNumber *big.Int) ([]byte, error)
CodeAt returns the contract code of the given account. The block number can be nil, in which case the code is taken from the latest known block.
func (*Client) FilterLogs ¶
FilterLogs executes a filter query.
func (*Client) GetBlockByHash ¶
func (c *Client) GetBlockByHash(ctx context.Context, blockHash common.Hash, includeTx bool) ([]byte, error)
GetBlockByHash returns the block information according to the given block hash
func (*Client) GetBlockByNumber ¶
func (c *Client) GetBlockByNumber(ctx context.Context, blockNumber int64, includeTx bool) ([]byte, error)
GetBlockByNumber returns the block information according to the given block number(hex format)
func (*Client) GetBlockHashByNumber ¶
GetBlockHashByNumber returns the block hash according to the given block number
func (*Client) GetBlockLimit ¶
GetBlockLimit returns the blocklimit for current blocknumber
func (*Client) GetBlockNumber ¶
GetBlockNumber returns the latest block height(hex format) on a given groupID.
func (*Client) GetCallOpts ¶
GetCallOpts return *bind.CallOpts
func (*Client) GetChainID ¶
GetChainID returns the Chain ID of the FISCO BCOS running on the nodes.
func (*Client) GetClientVersion ¶
GetClientVersion returns the version of FISCO BCOS running on the nodes.
func (*Client) GetCompatibleVersion ¶
GetCompatibleVersion returns the compatible version of FISCO BCOS
func (*Client) GetConsensusStatus ¶
GetConsensusStatus returns the status information about the consensus algorithm on a specific groupID
func (*Client) GetContractAddress ¶
func (c *Client) GetContractAddress(ctx context.Context, txHash common.Hash) (common.Address, error)
GetContractAddress returns a contract address according to the transaction hash
func (*Client) GetGroupID ¶
GetGroupID returns the groupID of the client
func (*Client) GetGroupList ¶
GetGroupList returns the groupID list that the node belongs to
func (*Client) GetGroupPeers ¶
GetGroupPeers returns the nodes and the overser nodes list on a specific group
func (*Client) GetNodeIDList ¶
GetNodeIDList returns the ID information of the connected peers and itself
func (*Client) GetObserverList ¶
GetObserverList returns the list of observer nodes' ID according to the groupID
func (*Client) GetPBFTView ¶
GetPBFTView returns the latest PBFT view(hex format) of the specific group and it will returns a wrong sentence if the consensus algorithm is not the PBFT.
func (*Client) GetPendingTransactions ¶
GetPendingTransactions returns information of the pending transactions
func (*Client) GetPendingTxSize ¶
GetPendingTxSize returns amount of the pending transactions
func (*Client) GetSealerList ¶
GetSealerList returns the list of consensus nodes' ID according to the groupID
func (*Client) GetSyncStatus ¶
GetSyncStatus returns the synchronization status of the group
func (*Client) GetSystemConfigByKey ¶
GetSystemConfigByKey returns value according to the key(only tx_count_limit, tx_gas_limit could work)
func (*Client) GetTotalTransactionCount ¶
GetTotalTransactionCount returns the total amount of transactions and the block height at present
func (*Client) GetTransactOpts ¶
func (c *Client) GetTransactOpts() *bind.TransactOpts
GetTransactOpts return *bind.TransactOpts
func (*Client) GetTransactionByBlockHashAndIndex ¶
func (c *Client) GetTransactionByBlockHashAndIndex(ctx context.Context, blockHash common.Hash, txIndex int) ([]byte, error)
GetTransactionByBlockHashAndIndex returns the transaction information according to the given block hash and transaction index
func (*Client) GetTransactionByBlockNumberAndIndex ¶
func (c *Client) GetTransactionByBlockNumberAndIndex(ctx context.Context, blockNumber int64, txIndex int) ([]byte, error)
GetTransactionByBlockNumberAndIndex returns the transaction information according to the given block number and transaction index
func (*Client) GetTransactionByHash ¶
GetTransactionByHash returns the transaction information according to the given transaction hash
func (*Client) GetTransactionReceipt ¶
func (c *Client) GetTransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error)
GetTransactionReceipt returns the transaction receipt according to the given transaction hash
func (*Client) PendingCallContract ¶
PendingCallContract executes a message call transaction using the EVM. The state seen by the contract call is the pending state.
func (*Client) PendingCodeAt ¶
PendingCodeAt returns the contract code of the given account in the pending state.
func (*Client) PublishPrivateTopic ¶
func (*Client) SendAMOPMsg ¶
func (*Client) SendAMOPPrivateMsg ¶
func (*Client) SendTransaction ¶
func (c *Client) SendTransaction(ctx context.Context, tx *types.Transaction) (*types.Receipt, error)
SendTransaction injects a signed transaction into the pending pool for execution.
If the transaction was a contract creation use the TransactionReceipt method to get the contract address after the transaction has been mined.
func (*Client) SetGroupID ¶
SetGroupID sets the groupID of the client
func (*Client) SubscribeBlockNumberNotify ¶
func (*Client) SubscribeFilterLogs ¶
func (c *Client) SubscribeFilterLogs(ctx context.Context, q ethereum.FilterQuery, ch chan<- types.Log) (ethereum.Subscription, error)
SubscribeFilterLogs subscribes to the results of a streaming filter query.
func (*Client) SubscribePrivateTopic ¶
func (*Client) SubscribeTopic ¶
func (*Client) TransactionReceipt ¶
func (c *Client) TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error)
TransactionReceipt returns the receipt of a transaction by transaction hash. Note that the receipt is not available for pending transactions.