Documentation ¶
Index ¶
- type AccountManager
- func (m *AccountManager) Create(passphrase string) (address types.Address, err error)
- func (m *AccountManager) CreateEthCompatible(passphrase string) (address types.Address, err error)
- func (m *AccountManager) Delete(address types.Address, passphrase string) error
- func (m *AccountManager) Exists(address types.Address) bool
- func (m *AccountManager) Export(address types.Address, passphrase string) (string, error)
- func (m *AccountManager) GetDefault() (*types.Address, error)
- func (m *AccountManager) Import(keyFile, passphrase, newPassphrase string) (address types.Address, err error)
- func (m *AccountManager) ImportKey(keyString string, passphrase string) (address types.Address, err error)
- func (m *AccountManager) List() []types.Address
- func (m *AccountManager) Lock(address types.Address) error
- func (m *AccountManager) Sign(tx types.UnsignedTransaction, passphrase string) (v byte, r, s []byte, err error)
- func (m *AccountManager) SignAndEcodeTransactionWithPassphrase(tx types.UnsignedTransaction, passphrase string) ([]byte, error)
- func (m *AccountManager) SignTransaction(tx types.UnsignedTransaction) ([]byte, error)
- func (m *AccountManager) SignTransactionWithPassphrase(tx types.UnsignedTransaction, passphrase string) (types.SignedTransaction, error)
- func (m *AccountManager) TimedUnlock(address types.Address, passphrase string, timeout time.Duration) error
- func (m *AccountManager) TimedUnlockDefault(passphrase string, timeout time.Duration) error
- func (m *AccountManager) Unlock(address types.Address, passphrase string) error
- func (m *AccountManager) UnlockDefault(passphrase string) error
- func (m *AccountManager) Update(address types.Address, passphrase, newPassphrase string) error
- type AccountManagerOperator
- type Client
- func (client *Client) ApplyUnsignedTransactionDefault(tx *types.UnsignedTransaction) error
- func (client *Client) BatchCallRPC(b []rpc.BatchElem) error
- func (client *Client) BatchGetBlockConfirmationRisk(blockhashes []types.Hash) (map[types.Hash]*big.Float, error)
- func (client *Client) BatchGetBlockSummarys(blockhashes []types.Hash) (map[types.Hash]*types.BlockSummary, error)
- func (client *Client) BatchGetBlockSummarysByNumber(blocknumbers []hexutil.Uint64) (map[hexutil.Uint64]*types.BlockSummary, error)
- func (client *Client) BatchGetRawBlockConfirmationRisk(blockhashes []types.Hash) (map[types.Hash]*big.Int, error)
- func (client *Client) BatchGetTxByHashes(txhashes []types.Hash) (map[types.Hash]*types.Transaction, error)
- func (client *Client) Call(request types.CallRequest, epoch *types.Epoch) (result hexutil.Bytes, err error)
- func (client *Client) CallRPC(result interface{}, method string, args ...interface{}) error
- func (client *Client) CheckBalanceAgainstTransaction(accountAddress types.Address, contractAddress types.Address, ...) (response types.CheckBalanceAgainstTransactionResponse, err error)
- func (client *Client) CreateUnsignedTransaction(from types.Address, to types.Address, amount *hexutil.Big, data []byte) (types.UnsignedTransaction, error)
- func (client *Client) Debug() RpcDebug
- func (client *Client) DeployContract(option *types.ContractDeployOption, abiJSON []byte, bytecode []byte, ...) *ContractDeployResult
- func (client *Client) EstimateGasAndCollateral(request types.CallRequest, epoch ...*types.Epoch) (estimat types.Estimate, err error)
- func (client *Client) FilterTraces(traceFilter types.TraceFilter) (traces []types.LocalizedTrace, err error)
- func (client *Client) GetAccountInfo(account types.Address, epoch ...*types.Epoch) (accountInfo types.AccountInfo, err error)
- func (client *Client) GetAccountManager() AccountManagerOperator
- func (client *Client) GetAccountPendingInfo(address types.Address) (pendignInfo *types.AccountPendingInfo, err error)
- func (client *Client) GetAccountPendingTransactions(address types.Address, startNonce *hexutil.Big, limit *hexutil.Uint64) (pendingTxs types.AccountPendingTransactions, err error)
- func (client *Client) GetAccumulateInterestRate(epoch ...*types.Epoch) (intersetRate *hexutil.Big, err error)
- func (client *Client) GetAdmin(contractAddress types.Address, epoch ...*types.Epoch) (admin *types.Address, err error)
- func (client *Client) GetBalance(address types.Address, epoch ...*types.Epoch) (balance *hexutil.Big, err error)
- func (client *Client) GetBestBlockHash() (hash types.Hash, err error)
- func (client *Client) GetBlockByBlockNumber(blockNumer hexutil.Uint64) (block *types.Block, err error)
- func (client *Client) GetBlockByEpoch(epoch *types.Epoch) (block *types.Block, err error)
- func (client *Client) GetBlockByHash(blockHash types.Hash) (block *types.Block, err error)
- func (client *Client) GetBlockByHashWithPivotAssumption(blockHash types.Hash, pivotHash types.Hash, epoch hexutil.Uint64) (block types.Block, err error)
- func (client *Client) GetBlockConfirmationRisk(blockHash types.Hash) (*big.Float, error)
- func (client *Client) GetBlockRewardInfo(epoch types.Epoch) (rewardInfo []types.RewardInfo, err error)
- func (client *Client) GetBlockSummaryByBlockNumber(blockNumer hexutil.Uint64) (block *types.BlockSummary, err error)
- func (client *Client) GetBlockSummaryByEpoch(epoch *types.Epoch) (blockSummary *types.BlockSummary, err error)
- func (client *Client) GetBlockSummaryByHash(blockHash types.Hash) (blockSummary *types.BlockSummary, err error)
- func (client *Client) GetBlockTraces(blockHash types.Hash) (traces *types.LocalizedBlockTrace, err error)
- func (client *Client) GetBlocksByEpoch(epoch *types.Epoch) (blockHashes []types.Hash, err error)
- func (client *Client) GetChainID() (uint32, error)
- func (client *Client) GetChainIDCached() uint32
- func (client *Client) GetClientVersion() (clientVersion string, err error)
- func (client *Client) GetCode(address types.Address, epoch ...*types.Epoch) (code hexutil.Bytes, err error)
- func (client *Client) GetCollateralForStorage(account types.Address, epoch ...*types.Epoch) (storage *hexutil.Big, err error)
- func (client *Client) GetContract(abiJSON []byte, deployedAt *types.Address) (*Contract, error)
- func (client *Client) GetDepositList(address types.Address, epoch ...*types.Epoch) (depositInfos []types.DepositInfo, err error)
- func (client *Client) GetEpochNumber(epoch ...*types.Epoch) (epochNumber *hexutil.Big, err error)
- func (client *Client) GetEpochReceipts(epoch types.Epoch) (receipts [][]types.TransactionReceipt, err error)
- func (client *Client) GetEpochReceiptsByPivotBlockHash(hash types.Hash) (receipts [][]types.TransactionReceipt, err error)
- func (client *Client) GetGasPrice() (gasPrice *hexutil.Big, err error)
- func (client *Client) GetInterestRate(epoch ...*types.Epoch) (intersetRate *hexutil.Big, err error)
- func (client *Client) GetLogs(filter types.LogFilter) (logs []types.Log, err error)
- func (client *Client) GetNetworkID() (uint32, error)
- func (client *Client) GetNetworkIDCached() uint32
- func (client *Client) GetNextNonce(address types.Address, epoch ...*types.Epoch) (nonce *hexutil.Big, err error)
- func (client *Client) GetNextUsableNonce(user types.Address) (nonce *hexutil.Big, err error)
- func (client *Client) GetNodeURL() string
- func (client *Client) GetOpenedMethodGroups() (openedGroups []string, err error)
- func (client *Client) GetParamsFromVote(epoch ...*types.Epoch) (info postypes.VoteParamsInfo, err error)
- func (client *Client) GetPoSEconomics(epoch ...*types.Epoch) (posEconomics types.PoSEconomics, err error)
- func (client *Client) GetPoSRewardByEpoch(epoch types.Epoch) (reward *postypes.EpochReward, err error)
- func (client *Client) GetRawBlockConfirmationRisk(blockhash types.Hash) (risk *hexutil.Big, err error)
- func (client *Client) GetSkippedBlocksByEpoch(epoch *types.Epoch) (blockHashs []types.Hash, err error)
- func (client *Client) GetSponsorInfo(contractAddress types.Address, epoch ...*types.Epoch) (sponsor types.SponsorInfo, err error)
- func (client *Client) GetStakingBalance(account types.Address, epoch ...*types.Epoch) (balance *hexutil.Big, err error)
- func (client *Client) GetStatus() (status types.Status, err error)
- func (client *Client) GetStorageAt(address types.Address, position *hexutil.Big, epoch ...*types.Epoch) (storageEntries hexutil.Bytes, err error)
- func (client *Client) GetStorageRoot(address types.Address, epoch ...*types.Epoch) (storageRoot *types.StorageRoot, err error)
- func (client *Client) GetSupplyInfo(epoch ...*types.Epoch) (info types.TokenSupplyInfo, err error)
- func (client *Client) GetTransactionByHash(txHash types.Hash) (tx *types.Transaction, err error)
- func (client *Client) GetTransactionReceipt(txHash types.Hash) (receipt *types.TransactionReceipt, err error)
- func (client *Client) GetTransactionTraces(txHash types.Hash) (traces []types.LocalizedTrace, err error)
- func (client *Client) GetVoteList(address types.Address, epoch ...*types.Epoch) (voteStakeInfos []types.VoteStakeInfo, err error)
- func (client *Client) MustNewAddress(base32OrHex string) types.Address
- func (client *Client) NewAddress(base32OrHex string) (types.Address, error)
- func (client *Client) Pos() RpcPos
- func (client *Client) Provider() *providers.MiddlewarableProvider
- func (client *Client) SendRawTransaction(rawData []byte) (hash types.Hash, err error)
- func (client *Client) SendTransaction(tx types.UnsignedTransaction) (types.Hash, error)
- func (client *Client) SetAccountManager(accountManager AccountManagerOperator)
- func (client *Client) SignEncodedTransactionAndSend(encodedTx []byte, v byte, r, s []byte) (*types.Transaction, error)
- func (client *Client) SubscribeEpochs(channel chan types.WebsocketEpochResponse, ...) (*rpc.ClientSubscription, error)
- func (client *Client) SubscribeLogs(channel chan types.SubscriptionLog, filter types.LogFilter) (*rpc.ClientSubscription, error)
- func (client *Client) SubscribeNewHeads(channel chan types.BlockHeader) (*rpc.ClientSubscription, error)
- func (client *Client) TxPool() RpcTxpool
- func (client *Client) WaitForTransationBePacked(txhash types.Hash, duration time.Duration) (*types.Transaction, error)
- func (client *Client) WaitForTransationReceipt(txhash types.Hash, duration time.Duration) (*types.TransactionReceipt, error)
- type ClientOperator
- type ClientOption
- type Contract
- func (contract *Contract) Call(option *types.ContractMethodCallOption, resultPtr interface{}, method string, ...) error
- func (contract *Contract) DecodeEvent(out interface{}, event string, log types.Log) error
- func (contract *Contract) GetData(method string, args ...interface{}) ([]byte, error)
- func (contract *Contract) SendTransaction(option *types.ContractMethodSendOption, method string, args ...interface{}) (types.Hash, error)
- type ContractDeployResult
- type Contractor
- type HTTPRequester
- type RpcDebug
- type RpcDebugClient
- func (c *RpcDebugClient) GetEpochReceipts(epoch types.Epoch) (receipts [][]types.TransactionReceipt, err error)
- func (c *RpcDebugClient) GetEpochReceiptsByPivotBlockHash(hash types.Hash) (receipts [][]types.TransactionReceipt, err error)
- func (c *RpcDebugClient) TxpoolGetAccountTransactions(address types.Address) (val []types.Transaction, err error)
- type RpcPos
- type RpcPosClient
- func (c *RpcPosClient) GetAccount(address postypes.Address, blockNumber ...hexutil.Uint64) (account postypes.Account, err error)
- func (c *RpcPosClient) GetBlockByHash(hash types.Hash) (block *postypes.Block, err error)
- func (c *RpcPosClient) GetBlockByNumber(blockNumber postypes.BlockNumber) (block *postypes.Block, err error)
- func (c *RpcPosClient) GetCommittee(blockNumber ...hexutil.Uint64) (committee postypes.CommitteeState, err error)
- func (c *RpcPosClient) GetRewardsByEpoch(epochNumber hexutil.Uint64) (reward postypes.EpochReward, err error)
- func (c *RpcPosClient) GetStatus() (status postypes.Status, err error)
- func (c *RpcPosClient) GetTransactionByNumber(txNumber hexutil.Uint64) (transaction *postypes.Transaction, err error)
- type RpcRequester
- type RpcTxpool
- type RpcTxpoolClient
- func (c *RpcTxpoolClient) AccountPendingInfo(address types.Address) (val *types.AccountPendingInfo, err error)
- func (c *RpcTxpoolClient) AccountPendingTransactions(address types.Address, maybeStartNonce *hexutil.Big, ...) (val types.AccountPendingTransactions, err error)
- func (c *RpcTxpoolClient) NextNonce(address types.Address) (val *hexutil.Big, err error)
- func (c *RpcTxpoolClient) PendingNonceRange(address types.Address) (val types.TxPoolPendingNonceRange, err error)
- func (c *RpcTxpoolClient) Status() (val types.TxPoolStatus, err error)
- func (c *RpcTxpoolClient) TransactionByAddressAndNonce(address types.Address, nonce *hexutil.Big) (val *types.Transaction, err error)
- func (c *RpcTxpoolClient) TxWithPoolInfo(hash types.Hash) (val types.TxWithPoolInfo, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccountManager ¶
type AccountManager struct {
// contains filtered or unexported fields
}
AccountManager manages Conflux accounts.
func NewAccountManager ¶
func NewAccountManager(keydir string, networkID uint32) *AccountManager
NewAccountManager creates an instance of AccountManager based on the keystore directory "keydir".
func (*AccountManager) Create ¶
func (m *AccountManager) Create(passphrase string) (address types.Address, err error)
Create creates a new account and puts the keystore file into keystore directory
func (*AccountManager) CreateEthCompatible ¶ added in v0.1.1
func (m *AccountManager) CreateEthCompatible(passphrase string) (address types.Address, err error)
CreateEthCompatible creates a new account compatible with eth and puts the keystore file into keystore directory
func (*AccountManager) Delete ¶
func (m *AccountManager) Delete(address types.Address, passphrase string) error
Delete deletes the specified account and remove the keystore file from keystore directory.
func (*AccountManager) Exists ¶ added in v1.4.2
func (m *AccountManager) Exists(address types.Address) bool
func (*AccountManager) GetDefault ¶
func (m *AccountManager) GetDefault() (*types.Address, error)
GetDefault return first account in keystore directory
func (*AccountManager) Import ¶
func (m *AccountManager) Import(keyFile, passphrase, newPassphrase string) (address types.Address, err error)
Import imports account from external key file to keystore directory. Returns error if the account already exists.
func (*AccountManager) ImportKey ¶ added in v0.1.1
func (m *AccountManager) ImportKey(keyString string, passphrase string) (address types.Address, err error)
ImportKey import account from private key hex string and save to keystore directory
func (*AccountManager) List ¶
func (m *AccountManager) List() []types.Address
List lists all accounts in keystore directory.
func (*AccountManager) Lock ¶
func (m *AccountManager) Lock(address types.Address) error
Lock locks the specified account.
func (*AccountManager) Sign ¶
func (m *AccountManager) Sign(tx types.UnsignedTransaction, passphrase string) (v byte, r, s []byte, err error)
Sign signs tx by passphrase and returns the signature
func (*AccountManager) SignAndEcodeTransactionWithPassphrase ¶
func (m *AccountManager) SignAndEcodeTransactionWithPassphrase(tx types.UnsignedTransaction, passphrase string) ([]byte, error)
SignAndEcodeTransactionWithPassphrase signs tx with given passphrase and return its RLP encoded data.
func (*AccountManager) SignTransaction ¶
func (m *AccountManager) SignTransaction(tx types.UnsignedTransaction) ([]byte, error)
SignTransaction signs tx and returns its RLP encoded data.
func (*AccountManager) SignTransactionWithPassphrase ¶
func (m *AccountManager) SignTransactionWithPassphrase(tx types.UnsignedTransaction, passphrase string) (types.SignedTransaction, error)
SignTransactionWithPassphrase signs tx with given passphrase and returns a transction with signature
func (*AccountManager) TimedUnlock ¶
func (m *AccountManager) TimedUnlock(address types.Address, passphrase string, timeout time.Duration) error
TimedUnlock unlocks the specified account for a period of time.
func (*AccountManager) TimedUnlockDefault ¶
func (m *AccountManager) TimedUnlockDefault(passphrase string, timeout time.Duration) error
TimedUnlockDefault unlocks the specified account for a period of time.
func (*AccountManager) Unlock ¶
func (m *AccountManager) Unlock(address types.Address, passphrase string) error
Unlock unlocks the specified account indefinitely.
func (*AccountManager) UnlockDefault ¶
func (m *AccountManager) UnlockDefault(passphrase string) error
UnlockDefault unlocks the default account indefinitely.
type AccountManagerOperator ¶ added in v0.1.1
type AccountManagerOperator interface { Create(passphrase string) (types.Address, error) Import(keyFile, passphrase, newPassphrase string) (types.Address, error) ImportKey(keyString string, passphrase string) (types.Address, error) Export(address types.Address, passphrase string) (string, error) Delete(address types.Address, passphrase string) error Update(address types.Address, passphrase, newPassphrase string) error List() []types.Address GetDefault() (*types.Address, error) Unlock(address types.Address, passphrase string) error UnlockDefault(passphrase string) error TimedUnlock(address types.Address, passphrase string, timeout time.Duration) error TimedUnlockDefault(passphrase string, timeout time.Duration) error Lock(address types.Address) error SignTransaction(tx types.UnsignedTransaction) ([]byte, error) SignAndEcodeTransactionWithPassphrase(tx types.UnsignedTransaction, passphrase string) ([]byte, error) SignTransactionWithPassphrase(tx types.UnsignedTransaction, passphrase string) (types.SignedTransaction, error) Sign(tx types.UnsignedTransaction, passphrase string) (v byte, r, s []byte, err error) }
AccountManagerOperator is interface of operate actions on account manager
type Client ¶
type Client struct { *providers.MiddlewarableProvider AccountManager AccountManagerOperator // contains filtered or unexported fields }
Client represents a client to interact with Conflux blockchain.
func MustNewClient ¶ added in v0.1.1
func MustNewClient(nodeURL string, option ...ClientOption) *Client
MustNewClient same to NewClient but panic if failed
func NewClient ¶
func NewClient(nodeURL string, option ...ClientOption) (*Client, error)
NewClient creates an instance of Client with specified conflux node url, it will creat account manager if option.KeystorePath not empty.
client, err := sdk.NewClient("https://test.confluxrpc.com", sdk.ClientOption{ KeystorePath: "your keystore folder path", RetryCount : 3, }) // query rpc epoch, err := client.GetEpochNumber() if err != nil { panic(err) } // send transaction chainID, err := client.GetNetworkID() if err!=nil { panic(err) } from, err :=client.AccountManger().GetDefault() if err!=nil { panic(err) } utx, err := client.CreateUnsignedTransaction(*from, cfxaddress.MustNewFromHex("0x1cad0b19bb29d4674531d6f115237e16afce377d", chainID), types.NewBigInt(1), nil) if err!=nil { panic(err) } txhash, err := client.SendTransaction(utx)
func NewClientWithProvider ¶ added in v1.2.2
func NewClientWithProvider(provider interfaces.Provider) (*Client, error)
NewClientWithProvider creates an instance of Client with specified provider, and will wrap it to create a MiddlewarableProvider for be able to hooking CallContext/BatchCallContext/Subscribe
func NewClientWithRPCRequester ¶ added in v0.1.1
func NewClientWithRPCRequester(provider RpcRequester) (*Client, error)
@deperacated use NewClientWithProvider instead NewClientWithRPCRequester creates client with specified rpcRequester
func (*Client) ApplyUnsignedTransactionDefault ¶
func (client *Client) ApplyUnsignedTransactionDefault(tx *types.UnsignedTransaction) error
ApplyUnsignedTransactionDefault set empty fields to value fetched from conflux node.
func (*Client) BatchCallRPC ¶ added in v0.1.1
BatchCallRPC sends all given requests as a single batch and waits for the server to return a response for all of them.
In contrast to Call, BatchCall only returns I/O errors. Any error specific to a request is reported through the Error field of the corresponding BatchElem.
Note that batch calls may not be executed atomically on the server side.
You could use UseBatchCallRpcMiddleware to add middleware for hooking BatchCallRPC
func (*Client) BatchGetBlockConfirmationRisk ¶ added in v0.1.1
func (client *Client) BatchGetBlockConfirmationRisk(blockhashes []types.Hash) (map[types.Hash]*big.Float, error)
BatchGetBlockConfirmationRisk acquires confirmation risk informations in bulk by blockhashes
func (*Client) BatchGetBlockSummarys ¶ added in v0.1.1
func (client *Client) BatchGetBlockSummarys(blockhashes []types.Hash) (map[types.Hash]*types.BlockSummary, error)
BatchGetBlockSummarys requests block summary informations in bulk by blockhashes
func (*Client) BatchGetBlockSummarysByNumber ¶ added in v0.1.1
func (client *Client) BatchGetBlockSummarysByNumber(blocknumbers []hexutil.Uint64) (map[hexutil.Uint64]*types.BlockSummary, error)
BatchGetBlockSummarysByNumber requests block summary informations in bulk by blocknumbers
func (*Client) BatchGetRawBlockConfirmationRisk ¶ added in v0.1.1
func (client *Client) BatchGetRawBlockConfirmationRisk(blockhashes []types.Hash) (map[types.Hash]*big.Int, error)
BatchGetRawBlockConfirmationRisk requests raw confirmation risk informations in bulk by blockhashes
func (*Client) BatchGetTxByHashes ¶ added in v0.1.1
func (client *Client) BatchGetTxByHashes(txhashes []types.Hash) (map[types.Hash]*types.Transaction, error)
BatchGetTxByHashes requests transaction informations in bulk by txhashes
func (*Client) Call ¶
func (client *Client) Call(request types.CallRequest, epoch *types.Epoch) (result hexutil.Bytes, err error)
Call executes a message call transaction "request" at specified epoch, which is directly executed in the VM of the node, but never mined into the block chain and returns the contract execution result.
func (*Client) CallRPC ¶
CallRPC performs a JSON-RPC call with the given arguments and unmarshals into result if no error occurred.
The result must be a pointer so that package json can unmarshal into it. You can also pass nil, in which case the result is ignored.
You could use UseCallRpcMiddleware to add middleware for hooking CallRPC
func (*Client) CheckBalanceAgainstTransaction ¶ added in v0.1.1
func (client *Client) CheckBalanceAgainstTransaction(accountAddress types.Address, contractAddress types.Address, gasLimit *hexutil.Big, gasPrice *hexutil.Big, storageLimit *hexutil.Big, epoch ...*types.Epoch) (response types.CheckBalanceAgainstTransactionResponse, err error)
CheckBalanceAgainstTransaction checks if user balance is enough for the transaction.
func (*Client) CreateUnsignedTransaction ¶
func (client *Client) CreateUnsignedTransaction(from types.Address, to types.Address, amount *hexutil.Big, data []byte) (types.UnsignedTransaction, error)
CreateUnsignedTransaction creates an unsigned transaction by parameters, and the other fields will be set to values fetched from conflux node.
func (*Client) DeployContract ¶
func (client *Client) DeployContract(option *types.ContractDeployOption, abiJSON []byte, bytecode []byte, constroctorParams ...interface{}) *ContractDeployResult
DeployContract deploys a contract by abiJSON, bytecode and consturctor params. It returns a ContractDeployState instance which contains 3 channels for notifying when state changed.
func (*Client) EstimateGasAndCollateral ¶
func (client *Client) EstimateGasAndCollateral(request types.CallRequest, epoch ...*types.Epoch) (estimat types.Estimate, err error)
EstimateGasAndCollateral excutes a message call "request" and returns the amount of the gas used and storage for collateral
func (*Client) FilterTraces ¶ added in v0.1.1
func (client *Client) FilterTraces(traceFilter types.TraceFilter) (traces []types.LocalizedTrace, err error)
GetFilterTraces returns all traces matching the provided filter.
func (*Client) GetAccountInfo ¶ added in v0.1.1
func (client *Client) GetAccountInfo(account types.Address, epoch ...*types.Epoch) (accountInfo types.AccountInfo, err error)
GetAccountInfo returns account related states of the given account
func (*Client) GetAccountManager ¶ added in v0.1.1
func (client *Client) GetAccountManager() AccountManagerOperator
GetAccountManager returns account manager of client
func (*Client) GetAccountPendingInfo ¶ added in v0.1.1
func (client *Client) GetAccountPendingInfo(address types.Address) (pendignInfo *types.AccountPendingInfo, err error)
GetAccountPendingInfo gets transaction pending info by account address
func (*Client) GetAccountPendingTransactions ¶ added in v0.1.1
func (client *Client) GetAccountPendingTransactions(address types.Address, startNonce *hexutil.Big, limit *hexutil.Uint64) (pendingTxs types.AccountPendingTransactions, err error)
GetAccountPendingTransactions get transaction pending info by account address
func (*Client) GetAccumulateInterestRate ¶ added in v0.1.1
func (client *Client) GetAccumulateInterestRate(epoch ...*types.Epoch) (intersetRate *hexutil.Big, err error)
GetAccumulateInterestRate returns accumulate interest rate of the given epoch
func (*Client) GetAdmin ¶ added in v0.1.1
func (client *Client) GetAdmin(contractAddress types.Address, epoch ...*types.Epoch) (admin *types.Address, err error)
GetAdmin returns admin of the given contract, it will return nil if contract not exist
func (*Client) GetBalance ¶
func (client *Client) GetBalance(address types.Address, epoch ...*types.Epoch) (balance *hexutil.Big, err error)
GetBalance returns the balance of specified address at epoch.
func (*Client) GetBestBlockHash ¶
GetBestBlockHash returns the current best block hash.
func (*Client) GetBlockByBlockNumber ¶ added in v0.1.1
func (client *Client) GetBlockByBlockNumber(blockNumer hexutil.Uint64) (block *types.Block, err error)
GetBlockByHash returns the block of specified block number
func (*Client) GetBlockByEpoch ¶
GetBlockByEpoch returns the block of specified epoch. If the epoch is invalid, return the concrete error.
func (*Client) GetBlockByHash ¶
GetBlockByHash returns the block of specified blockHash If the block is not found, return nil.
func (*Client) GetBlockByHashWithPivotAssumption ¶ added in v0.1.1
func (client *Client) GetBlockByHashWithPivotAssumption(blockHash types.Hash, pivotHash types.Hash, epoch hexutil.Uint64) (block types.Block, err error)
GetBlockByHashWithPivotAssumption returns block with given hash and pivot chain assumption.
func (*Client) GetBlockConfirmationRisk ¶ added in v0.1.1
GetBlockConfirmationRisk indicates the probability that the pivot block of the epoch where the block is located becomes a normal block.
it's (raw confirmation risk coefficient/ (2^256-1))
func (*Client) GetBlockRewardInfo ¶ added in v0.1.1
func (client *Client) GetBlockRewardInfo(epoch types.Epoch) (rewardInfo []types.RewardInfo, err error)
GetBlockRewardInfo returns block reward information in an epoch
func (*Client) GetBlockSummaryByBlockNumber ¶ added in v0.1.1
func (client *Client) GetBlockSummaryByBlockNumber(blockNumer hexutil.Uint64) (block *types.BlockSummary, err error)
GetBlockSummaryByBlockNumber returns the block summary of specified block number.
func (*Client) GetBlockSummaryByEpoch ¶
func (client *Client) GetBlockSummaryByEpoch(epoch *types.Epoch) (blockSummary *types.BlockSummary, err error)
GetBlockSummaryByEpoch returns the block summary of specified epoch. If the epoch is invalid, return the concrete error.
func (*Client) GetBlockSummaryByHash ¶
func (client *Client) GetBlockSummaryByHash(blockHash types.Hash) (blockSummary *types.BlockSummary, err error)
GetBlockSummaryByHash returns the block summary of specified blockHash If the block is not found, return nil.
func (*Client) GetBlockTraces ¶ added in v0.1.1
func (client *Client) GetBlockTraces(blockHash types.Hash) (traces *types.LocalizedBlockTrace, err error)
GetBlockTrace returns all traces produced at given block.
func (*Client) GetBlocksByEpoch ¶
GetBlocksByEpoch returns the blocks hash in the specified epoch.
func (*Client) GetChainID ¶ added in v0.1.1
GetNetworkID returns networkID of connecting conflux node
func (*Client) GetChainIDCached ¶ added in v0.1.1
GetChainIDCached returns chached networkID created when new client
func (*Client) GetClientVersion ¶ added in v0.1.1
GetClientVersion returns the client version as a string
func (*Client) GetCode ¶
func (client *Client) GetCode(address types.Address, epoch ...*types.Epoch) (code hexutil.Bytes, err error)
GetCode returns the bytecode in HEX format of specified address at epoch.
func (*Client) GetCollateralForStorage ¶ added in v0.1.1
func (client *Client) GetCollateralForStorage(account types.Address, epoch ...*types.Epoch) (storage *hexutil.Big, err error)
GetCollateralForStorage returns balance of the given account.
func (*Client) GetContract ¶
GetContract creates a contract instance according to abi json and it's deployed address
func (*Client) GetDepositList ¶ added in v0.1.1
func (client *Client) GetDepositList(address types.Address, epoch ...*types.Epoch) (depositInfos []types.DepositInfo, err error)
GetDepositList returns deposit list of the given account.
func (*Client) GetEpochNumber ¶
GetEpochNumber returns the highest or specified epoch number.
func (*Client) GetEpochReceipts ¶ added in v0.1.1
func (*Client) GetEpochReceiptsByPivotBlockHash ¶ added in v0.1.1
func (*Client) GetGasPrice ¶
GetGasPrice returns the recent mean gas price.
func (*Client) GetInterestRate ¶ added in v0.1.1
GetInterestRate returns interest rate of the given epoch
func (*Client) GetNetworkID ¶ added in v0.1.1
GetNetworkID returns networkID of connecting conflux node
func (*Client) GetNetworkIDCached ¶ added in v0.1.1
GetNetworkIDCached returns chached networkID created when new client
func (*Client) GetNextNonce ¶
func (client *Client) GetNextNonce(address types.Address, epoch ...*types.Epoch) (nonce *hexutil.Big, err error)
GetNextNonce returns the next transaction nonce of address
func (*Client) GetNextUsableNonce ¶ added in v0.1.1
func (*Client) GetNodeURL ¶ added in v0.1.1
GetNodeURL returns node url
func (*Client) GetOpenedMethodGroups ¶ added in v0.1.1
GetOpenedMethodGroups returns openning method groups
func (*Client) GetParamsFromVote ¶ added in v1.4.1
func (*Client) GetPoSEconomics ¶ added in v0.1.1
func (client *Client) GetPoSEconomics(epoch ...*types.Epoch) (posEconomics types.PoSEconomics, err error)
GetPoSEconomics returns accumulate interest rate of the given epoch
func (*Client) GetPoSRewardByEpoch ¶ added in v0.1.1
func (client *Client) GetPoSRewardByEpoch(epoch types.Epoch) (reward *postypes.EpochReward, err error)
GetPosRewardByEpoch returns pos rewarded in this epoch
func (*Client) GetRawBlockConfirmationRisk ¶ added in v0.1.1
func (client *Client) GetRawBlockConfirmationRisk(blockhash types.Hash) (risk *hexutil.Big, err error)
GetRawBlockConfirmationRisk indicates the risk coefficient that the pivot block of the epoch where the block is located becomes a normal block. It will return nil if block not exist
func (*Client) GetSkippedBlocksByEpoch ¶ added in v0.1.1
func (client *Client) GetSkippedBlocksByEpoch(epoch *types.Epoch) (blockHashs []types.Hash, err error)
GetSkippedBlocksByEpoch returns skipped block hashes of given epoch
func (*Client) GetSponsorInfo ¶ added in v0.1.1
func (client *Client) GetSponsorInfo(contractAddress types.Address, epoch ...*types.Epoch) (sponsor types.SponsorInfo, err error)
GetSponsorInfo returns sponsor information of the given contract
func (*Client) GetStakingBalance ¶ added in v0.1.1
func (client *Client) GetStakingBalance(account types.Address, epoch ...*types.Epoch) (balance *hexutil.Big, err error)
GetStakingBalance returns balance of the given account.
func (*Client) GetStorageAt ¶ added in v0.1.1
func (client *Client) GetStorageAt(address types.Address, position *hexutil.Big, epoch ...*types.Epoch) (storageEntries hexutil.Bytes, err error)
GetStorageAt returns storage entries from a given contract.
func (*Client) GetStorageRoot ¶ added in v0.1.1
func (client *Client) GetStorageRoot(address types.Address, epoch ...*types.Epoch) (storageRoot *types.StorageRoot, err error)
GetStorageRoot returns storage root of given address
func (*Client) GetSupplyInfo ¶ added in v0.1.1
GetSupplyInfo Return information about total token supply.
func (*Client) GetTransactionByHash ¶
GetTransactionByHash returns transaction for the specified txHash. If the transaction is not found, return nil.
func (*Client) GetTransactionReceipt ¶
func (client *Client) GetTransactionReceipt(txHash types.Hash) (receipt *types.TransactionReceipt, err error)
GetTransactionReceipt returns the receipt of specified transaction hash. If no receipt is found, return nil.
func (*Client) GetTransactionTraces ¶ added in v0.1.1
func (client *Client) GetTransactionTraces(txHash types.Hash) (traces []types.LocalizedTrace, err error)
GetTransactionTraces returns all traces produced at the given transaction.
func (*Client) GetVoteList ¶ added in v0.1.1
func (client *Client) GetVoteList(address types.Address, epoch ...*types.Epoch) (voteStakeInfos []types.VoteStakeInfo, err error)
GetVoteList returns vote list of the given account.
func (*Client) MustNewAddress ¶ added in v0.1.1
MustNewAddress create conflux address by base32 string or hex40 string, if base32OrHex is base32 and networkID is passed it will create cfx Address use networkID of current client. it will painc if error occured.
func (*Client) NewAddress ¶ added in v0.1.1
NewAddress create conflux address by base32 string or hex40 string, if base32OrHex is base32 and networkID is passed it will create cfx Address use networkID of current client.
func (*Client) Provider ¶ added in v1.2.0
func (client *Client) Provider() *providers.MiddlewarableProvider
Provider returns the middlewarable provider
func (*Client) SendRawTransaction ¶
SendRawTransaction sends signed transaction and returns its hash.
func (*Client) SendTransaction ¶
SendTransaction signs and sends transaction to conflux node and returns the transaction hash.
func (*Client) SetAccountManager ¶
func (client *Client) SetAccountManager(accountManager AccountManagerOperator)
SetAccountManager sets account manager for sign transaction
func (*Client) SignEncodedTransactionAndSend ¶
func (client *Client) SignEncodedTransactionAndSend(encodedTx []byte, v byte, r, s []byte) (*types.Transaction, error)
SignEncodedTransactionAndSend signs RLP encoded transaction "encodedTx" by signature "r,s,v" and sends it to node, and returns responsed transaction.
func (*Client) SubscribeEpochs ¶ added in v0.1.1
func (client *Client) SubscribeEpochs(channel chan types.WebsocketEpochResponse, subscriptionEpochType ...types.Epoch) (*rpc.ClientSubscription, error)
SubscribeEpochs subscribes consensus results: the total order of blocks, as expressed by a sequence of epochs. Currently subscriptionEpochType only support "latest_mined" and "latest_state"
func (*Client) SubscribeLogs ¶ added in v0.1.1
func (client *Client) SubscribeLogs(channel chan types.SubscriptionLog, filter types.LogFilter) (*rpc.ClientSubscription, error)
SubscribeLogs subscribes all logs matching a certain filter, in order.
func (*Client) SubscribeNewHeads ¶ added in v0.1.1
func (client *Client) SubscribeNewHeads(channel chan types.BlockHeader) (*rpc.ClientSubscription, error)
SubscribeNewHeads subscribes all new block headers participating in the consensus.
func (*Client) TxPool ¶ added in v0.1.1
TxPool returns RpcTxPoolClient for invoke rpc with txpool namespace
func (*Client) WaitForTransationBePacked ¶ added in v0.1.1
func (client *Client) WaitForTransationBePacked(txhash types.Hash, duration time.Duration) (*types.Transaction, error)
WaitForTransationBePacked returns transaction when it is packed
func (*Client) WaitForTransationReceipt ¶ added in v0.1.1
func (client *Client) WaitForTransationReceipt(txhash types.Hash, duration time.Duration) (*types.TransactionReceipt, error)
WaitForTransationReceipt waits for transaction receipt valid
type ClientOperator ¶
type ClientOperator interface { GetNodeURL() string NewAddress(base32OrHex string) (types.Address, error) MustNewAddress(base32OrHex string) types.Address CallRPC(result interface{}, method string, args ...interface{}) error BatchCallRPC(b []rpc.BatchElem) error SetAccountManager(accountManager AccountManagerOperator) GetAccountManager() AccountManagerOperator Pos() RpcPos TxPool() RpcTxpool Debug() RpcDebug GetGasPrice() (*hexutil.Big, error) GetNextNonce(address types.Address, epoch ...*types.Epoch) (*hexutil.Big, error) GetStatus() (types.Status, error) GetNetworkID() (uint32, error) GetChainID() (uint32, error) GetEpochNumber(epoch ...*types.Epoch) (*hexutil.Big, error) GetBalance(address types.Address, epoch ...*types.Epoch) (*hexutil.Big, error) GetCode(address types.Address, epoch ...*types.Epoch) (hexutil.Bytes, error) GetBlockSummaryByHash(blockHash types.Hash) (*types.BlockSummary, error) GetBlockByHash(blockHash types.Hash) (*types.Block, error) GetBlockSummaryByEpoch(epoch *types.Epoch) (*types.BlockSummary, error) GetBlockByEpoch(epoch *types.Epoch) (*types.Block, error) GetBlockByBlockNumber(blockNumer hexutil.Uint64) (block *types.Block, err error) GetBlockSummaryByBlockNumber(blockNumer hexutil.Uint64) (block *types.BlockSummary, err error) GetBestBlockHash() (types.Hash, error) GetRawBlockConfirmationRisk(blockhash types.Hash) (*hexutil.Big, error) GetBlockConfirmationRisk(blockHash types.Hash) (*big.Float, error) SendTransaction(tx types.UnsignedTransaction) (types.Hash, error) SendRawTransaction(rawData []byte) (types.Hash, error) SignEncodedTransactionAndSend(encodedTx []byte, v byte, r, s []byte) (*types.Transaction, error) Call(request types.CallRequest, epoch *types.Epoch) (hexutil.Bytes, error) GetLogs(filter types.LogFilter) ([]types.Log, error) GetTransactionByHash(txHash types.Hash) (*types.Transaction, error) EstimateGasAndCollateral(request types.CallRequest, epoch ...*types.Epoch) (types.Estimate, error) GetBlocksByEpoch(epoch *types.Epoch) ([]types.Hash, error) GetTransactionReceipt(txHash types.Hash) (*types.TransactionReceipt, error) GetAdmin(contractAddress types.Address, epoch ...*types.Epoch) (admin *types.Address, err error) GetSponsorInfo(contractAddress types.Address, epoch ...*types.Epoch) (sponsor types.SponsorInfo, err error) GetStakingBalance(account types.Address, epoch ...*types.Epoch) (balance *hexutil.Big, err error) GetCollateralForStorage(account types.Address, epoch ...*types.Epoch) (storage *hexutil.Big, err error) GetStorageAt(address types.Address, position *hexutil.Big, epoch ...*types.Epoch) (storageEntries hexutil.Bytes, err error) GetStorageRoot(address types.Address, epoch ...*types.Epoch) (storageRoot *types.StorageRoot, err error) GetBlockByHashWithPivotAssumption(blockHash types.Hash, pivotHash types.Hash, epoch hexutil.Uint64) (block types.Block, err error) CheckBalanceAgainstTransaction(accountAddress types.Address, contractAddress types.Address, gasLimit *hexutil.Big, gasPrice *hexutil.Big, storageLimit *hexutil.Big, epoch ...*types.Epoch) (response types.CheckBalanceAgainstTransactionResponse, err error) GetSkippedBlocksByEpoch(epoch *types.Epoch) (blockHashs []types.Hash, err error) GetAccountInfo(account types.Address, epoch ...*types.Epoch) (accountInfo types.AccountInfo, err error) GetInterestRate(epoch ...*types.Epoch) (intersetRate *hexutil.Big, err error) GetAccumulateInterestRate(epoch ...*types.Epoch) (intersetRate *hexutil.Big, err error) GetBlockRewardInfo(epoch types.Epoch) (rewardInfo []types.RewardInfo, err error) GetClientVersion() (clientVersion string, err error) GetDepositList(address types.Address, epoch ...*types.Epoch) ([]types.DepositInfo, error) GetVoteList(address types.Address, epoch ...*types.Epoch) ([]types.VoteStakeInfo, error) GetSupplyInfo(epoch ...*types.Epoch) (info types.TokenSupplyInfo, err error) GetBlockTraces(blockHash types.Hash) (*types.LocalizedBlockTrace, error) FilterTraces(traceFilter types.TraceFilter) (traces []types.LocalizedTrace, err error) GetTransactionTraces(txHash types.Hash) (traces []types.LocalizedTrace, err error) CreateUnsignedTransaction(from types.Address, to types.Address, amount *hexutil.Big, data []byte) (types.UnsignedTransaction, error) ApplyUnsignedTransactionDefault(tx *types.UnsignedTransaction) error DeployContract(option *types.ContractDeployOption, abiJSON []byte, bytecode []byte, constroctorParams ...interface{}) *ContractDeployResult GetContract(abiJSON []byte, deployedAt *types.Address) (*Contract, error) GetAccountPendingInfo(address types.Address) (pendignInfo *types.AccountPendingInfo, err error) GetAccountPendingTransactions(address types.Address, startNonce *hexutil.Big, limit *hexutil.Uint64) (pendingTxs types.AccountPendingTransactions, err error) GetPoSEconomics(epoch ...*types.Epoch) (posEconomics types.PoSEconomics, err error) GetOpenedMethodGroups() (openedGroups []string, err error) GetPoSRewardByEpoch(epoch types.Epoch) (reward *postypes.EpochReward, err error) GetEpochReceipts(epoch types.Epoch) (receipts [][]types.TransactionReceipt, err error) GetEpochReceiptsByPivotBlockHash(hash types.Hash) (receipts [][]types.TransactionReceipt, err error) GetParamsFromVote(epoch ...*types.Epoch) (info postypes.VoteParamsInfo, err error) BatchGetTxByHashes(txhashes []types.Hash) (map[types.Hash]*types.Transaction, error) BatchGetBlockSummarys(blockhashes []types.Hash) (map[types.Hash]*types.BlockSummary, error) BatchGetBlockSummarysByNumber(blocknumbers []hexutil.Uint64) (map[hexutil.Uint64]*types.BlockSummary, error) BatchGetRawBlockConfirmationRisk(blockhashes []types.Hash) (map[types.Hash]*big.Int, error) BatchGetBlockConfirmationRisk(blockhashes []types.Hash) (map[types.Hash]*big.Float, error) Close() SubscribeNewHeads(channel chan types.BlockHeader) (*rpc.ClientSubscription, error) SubscribeEpochs(channel chan types.WebsocketEpochResponse, subscriptionEpochType ...types.Epoch) (*rpc.ClientSubscription, error) SubscribeLogs(channel chan types.SubscriptionLog, filter types.LogFilter) (*rpc.ClientSubscription, error) WaitForTransationBePacked(txhash types.Hash, duration time.Duration) (*types.Transaction, error) WaitForTransationReceipt(txhash types.Hash, duration time.Duration) (*types.TransactionReceipt, error) GetNextUsableNonce(user types.Address) (nonce *hexutil.Big, err error) GetChainIDCached() uint32 GetNetworkIDCached() uint32 }
ClientOperator is interface of operate actions on client
type ClientOption ¶ added in v0.1.1
type ClientOption struct { KeystorePath string // retry RetryCount int RetryInterval time.Duration `default:"1s"` // timeout of request RequestTimeout time.Duration `default:"30s"` // Maximum number of connections may be established. The default value is 512. It's only useful for http(s) prococal MaxConnectionPerHost int Logger io.Writer }
ClientOption for set keystore path and flags for retry and timeout
The simplest way to set logger is to use the types.DefaultCallRpcLog and types.DefaultBatchCallRPCLog
type Contract ¶
type Contract struct { ABI abi.ABI Client ClientOperator Address *types.Address }
Contract represents a smart contract. You can conveniently create contract by Client.GetContract or Client.DeployContract.
func NewContract ¶ added in v0.1.1
NewContract creates contract by abi and deployed address
func (*Contract) Call ¶
func (contract *Contract) Call(option *types.ContractMethodCallOption, resultPtr interface{}, method string, args ...interface{}) error
Call calls to the contract method with args and fills the excuted result to the "resultPtr".
the resultPtr should be a pointer of the method output struct type.
please refer https://github.com/Conflux-Chain/go-conflux-sdk/blob/master/README.md to get the mappings of solidity types to go types
func (*Contract) DecodeEvent ¶ added in v0.1.1
DecodeEvent unpacks a retrieved log into the provided output structure.
please refer https://github.com/Conflux-Chain/go-conflux-sdk/blob/master/README.md to get the mappings of solidity types to go types
func (*Contract) GetData ¶
GetData packs the given method name to conform the ABI of the contract. Method call's data will consist of method_id, args0, arg1, ... argN. Method id consists of 4 bytes and arguments are all 32 bytes. Method ids are created from the first 4 bytes of the hash of the methods string signature. (signature = baz(uint32,string32))
please refer https://github.com/Conflux-Chain/go-conflux-sdk/blob/master/README.md to get the mappings of solidity types to go types
func (*Contract) SendTransaction ¶
func (contract *Contract) SendTransaction(option *types.ContractMethodSendOption, method string, args ...interface{}) (types.Hash, error)
SendTransaction sends a transaction to the contract method with args and returns its transaction hash
please refer https://github.com/Conflux-Chain/go-conflux-sdk/blob/master/README.md to get the mappings of solidity types to go types
type ContractDeployResult ¶ added in v0.1.1
type ContractDeployResult struct { //DoneChannel channel for notifying when contract deployed done DoneChannel <-chan struct{} TransactionHash *types.Hash Error error DeployedContract *Contract }
ContractDeployResult for state change notification when deploying contract
type Contractor ¶
type Contractor interface { GetData(method string, args ...interface{}) ([]byte, error) Call(option *types.ContractMethodCallOption, resultPtr interface{}, method string, args ...interface{}) error SendTransaction(option *types.ContractMethodSendOption, method string, args ...interface{}) (types.Hash, error) DecodeEvent(out interface{}, event string, log types.Log) error }
Contractor is interface of contract operator
type HTTPRequester ¶
HTTPRequester is interface for emitting a http requester
type RpcDebug ¶ added in v0.1.1
type RpcDebug interface { // TxpoolGetAccountTransactions(address types.Address) (val []types.Transaction, err error) GetEpochReceipts(epoch types.Epoch) (receipts [][]types.TransactionReceipt, err error) GetEpochReceiptsByPivotBlockHash(hash types.Hash) (receipts [][]types.TransactionReceipt, err error) }
type RpcDebugClient ¶ added in v0.1.1
type RpcDebugClient struct {
// contains filtered or unexported fields
}
RpcDebugClient used to access debug namespace RPC of Conflux blockchain.
func NewRpcDebugClient ¶ added in v0.1.1
func NewRpcDebugClient(core *Client) RpcDebugClient
NewRpcDebugClient creates a new RpcDebugClient instance.
func (*RpcDebugClient) GetEpochReceipts ¶ added in v0.1.1
func (c *RpcDebugClient) GetEpochReceipts(epoch types.Epoch) (receipts [][]types.TransactionReceipt, err error)
GetEpochReceiptsByEpochNumber returns epoch receipts by epoch number
func (*RpcDebugClient) GetEpochReceiptsByPivotBlockHash ¶ added in v0.1.1
func (c *RpcDebugClient) GetEpochReceiptsByPivotBlockHash(hash types.Hash) (receipts [][]types.TransactionReceipt, err error)
GetEpochReceiptsByPivotBlockHash returns epoch receipts by pivot block hash
func (*RpcDebugClient) TxpoolGetAccountTransactions ¶ added in v0.1.1
func (c *RpcDebugClient) TxpoolGetAccountTransactions(address types.Address) (val []types.Transaction, err error)
TxpoolGetAccountTransactions returns account ready + deferred transactions
type RpcPos ¶ added in v0.1.1
type RpcPos interface { GetStatus() (postypes.Status, error) GetAccount(address postypes.Address, blockNumber ...hexutil.Uint64) (postypes.Account, error) GetCommittee(blockNumber ...hexutil.Uint64) (postypes.CommitteeState, error) GetBlockByHash(types.Hash) (*postypes.Block, error) GetBlockByNumber(blockNumber postypes.BlockNumber) (*postypes.Block, error) GetTransactionByNumber(txNumber hexutil.Uint64) (*postypes.Transaction, error) GetRewardsByEpoch(epochNumber hexutil.Uint64) (postypes.EpochReward, error) }
type RpcPosClient ¶ added in v0.1.1
type RpcPosClient struct {
// contains filtered or unexported fields
}
RpcPosClient used to access pos namespace RPC of Conflux blockchain.
func NewRpcPosClient ¶ added in v0.1.1
func NewRpcPosClient(core *Client) RpcPosClient
NewRpcPosClient creates a new RpcPosClient instance.
func (*RpcPosClient) GetAccount ¶ added in v0.1.1
func (c *RpcPosClient) GetAccount(address postypes.Address, blockNumber ...hexutil.Uint64) (account postypes.Account, err error)
GetAccount returns account info at block
func (*RpcPosClient) GetBlockByHash ¶ added in v0.1.1
GetBlockByHash returns block info of block hash
func (*RpcPosClient) GetBlockByNumber ¶ added in v0.1.1
func (c *RpcPosClient) GetBlockByNumber(blockNumber postypes.BlockNumber) (block *postypes.Block, err error)
GetBlockByHash returns block at block number
func (*RpcPosClient) GetCommittee ¶ added in v0.1.1
func (c *RpcPosClient) GetCommittee(blockNumber ...hexutil.Uint64) (committee postypes.CommitteeState, err error)
GetCommittee returns committee info at block
func (*RpcPosClient) GetRewardsByEpoch ¶ added in v0.1.1
func (c *RpcPosClient) GetRewardsByEpoch(epochNumber hexutil.Uint64) (reward postypes.EpochReward, err error)
GetRewardsByEpoch returns rewards of epoch
func (*RpcPosClient) GetStatus ¶ added in v0.1.1
func (c *RpcPosClient) GetStatus() (status postypes.Status, err error)
GetStatus returns pos chain status
func (*RpcPosClient) GetTransactionByNumber ¶ added in v0.1.1
func (c *RpcPosClient) GetTransactionByNumber(txNumber hexutil.Uint64) (transaction *postypes.Transaction, err error)
GetTransactionByNumber returns transaction info of transaction number
type RpcRequester ¶ added in v0.1.1
type RpcRequester = interfaces.Provider
reserve for forward compatbility
type RpcTxpool ¶ added in v0.1.1
type RpcTxpool interface { Status() (val types.TxPoolStatus, err error) NextNonce(address types.Address) (val *hexutil.Big, err error) TransactionByAddressAndNonce(address types.Address, nonce *hexutil.Big) (val *types.Transaction, err error) PendingNonceRange(address types.Address) (val types.TxPoolPendingNonceRange, err error) TxWithPoolInfo(hash types.Hash) (val types.TxWithPoolInfo, err error) AccountPendingInfo(address types.Address) (val *types.AccountPendingInfo, err error) AccountPendingTransactions(address types.Address, maybeStartNonce *hexutil.Big, maybeLimit *hexutil.Uint64) (val types.AccountPendingTransactions, err error) }
type RpcTxpoolClient ¶ added in v0.1.1
type RpcTxpoolClient struct {
// contains filtered or unexported fields
}
RpcTxpoolClient used to access txpool namespace RPC of Conflux blockchain.
func NewRpcTxpoolClient ¶ added in v0.1.1
func NewRpcTxpoolClient(core *Client) RpcTxpoolClient
NewRpcTxpoolClient creates a new RpcTxpoolClient instance.
func (*RpcTxpoolClient) AccountPendingInfo ¶ added in v0.1.1
func (c *RpcTxpoolClient) AccountPendingInfo(address types.Address) (val *types.AccountPendingInfo, err error)
/ Get transaction pending info by account address
func (*RpcTxpoolClient) AccountPendingTransactions ¶ added in v0.1.1
func (c *RpcTxpoolClient) AccountPendingTransactions(address types.Address, maybeStartNonce *hexutil.Big, maybeLimit *hexutil.Uint64) (val types.AccountPendingTransactions, err error)
/ Get transaction pending info by account address
func (*RpcTxpoolClient) NextNonce ¶ added in v0.1.1
NextNonce returns next nonce of account, including pending transactions
func (*RpcTxpoolClient) PendingNonceRange ¶ added in v0.1.1
func (c *RpcTxpoolClient) PendingNonceRange(address types.Address) (val types.TxPoolPendingNonceRange, err error)
PendingNonceRange returns pending nonce range in txpool of account
func (*RpcTxpoolClient) Status ¶ added in v0.1.1
func (c *RpcTxpoolClient) Status() (val types.TxPoolStatus, err error)
Status returns txpool status
func (*RpcTxpoolClient) TransactionByAddressAndNonce ¶ added in v0.1.1
func (c *RpcTxpoolClient) TransactionByAddressAndNonce(address types.Address, nonce *hexutil.Big) (val *types.Transaction, err error)
TransactionByAddressAndNonce returns transaction info in txpool by account address and nonce
func (*RpcTxpoolClient) TxWithPoolInfo ¶ added in v0.1.1
func (c *RpcTxpoolClient) TxWithPoolInfo(hash types.Hash) (val types.TxWithPoolInfo, err error)
TxWithPoolInfo returns transaction with txpool info by transaction hash
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package bind generates Ethereum contract Go bindings.
|
Package bind generates Ethereum contract Go bindings. |
cfxclient
|
|
cmd
|
|
contract_meta
|
|
internal
|
|