bulk

package
v1.5.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 25, 2024 License: LGPL-3.0 Imports: 13 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckIfUser1stTxIsPending added in v1.5.3

func CheckIfUser1stTxIsPending(bulkCaller *BulkCaller, user []cfxaddress.Address) (map[string]bool, error)

Check if user's 1st tx in tx pool is pending, pending means not on "ready" state, maybe notEnoughCash/outdatedStatus/nonceFuture/epochHeightOutBound.

Types

type BulkCaller

type BulkCaller struct {
	BulkCallerCore

	*BulkCfxCaller
	// contains filtered or unexported fields
}

BulkCaller used for bulk call rpc in one request to improve efficiency

func NewBulkCaller

func NewBulkCaller(rpcCaller sdk.ClientOperator) *BulkCaller

NewBulkCaller creates new bulk caller instance

func (*BulkCaller) Cfx

func (b *BulkCaller) Cfx() *BulkCfxCaller

Cfx returns BulkCfxCaller for genereating "cfx" namespace relating rpc request

func (*BulkCaller) Clear

func (b *BulkCaller) Clear()

Clear clear requests and errors in queue for new bulk call action

func (*BulkCaller) Customer

func (b *BulkCaller) Customer() *BulkCustomCaller

Customer returns BulkCustomCaller for genereating contract relating rpc request which mainly for decoding contract call result with type *hexutil.Big to ABI defined types

func (*BulkCaller) Debug

func (b *BulkCaller) Debug() *BulkDebugCaller

Debug returns BulkDebugCaller for genereating "debug" namespace relating rpc request

func (*BulkCaller) Execute

func (b *BulkCaller) Execute() error

Execute sends all rpc requests in queue by rpc call "batch" on one request

func (*BulkCaller) Pos

func (b *BulkCaller) Pos() *BulkPosCaller

Pos returns BulkTraceCaller for genereating "pos" namespace relating rpc request

func (*BulkCaller) Trace

func (b *BulkCaller) Trace() *BulkTraceCaller

Trace returns BulkTraceCaller for genereating "trace" namespace relating rpc request

func (*BulkCaller) Txpool

func (b *BulkCaller) Txpool() *BulkTxpoolCaller

TxPool returns BulkTxpoolCaller for genereating "txpool" namespace relating rpc request

type BulkCallerCore

type BulkCallerCore struct {
	// contains filtered or unexported fields
}

func NewBulkCallerCore

func NewBulkCallerCore(rpcCaller sdk.ClientOperator) BulkCallerCore

type BulkCfxCaller

type BulkCfxCaller BulkCallerCore

BulkCfxCaller used for bulk call rpc in one request to improve efficiency

func NewBulkCfxCaller

func NewBulkCfxCaller(core BulkCallerCore) *BulkCfxCaller

NewBulkCfxCaller creates new BulkCfxCaller instance

func (*BulkCfxCaller) Call

func (client *BulkCfxCaller) Call(request types.CallRequest, epoch *types.Epoch) (*hexutil.Bytes, *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 (*BulkCfxCaller) CheckBalanceAgainstTransaction

func (client *BulkCfxCaller) CheckBalanceAgainstTransaction(accountAddress types.Address,
	contractAddress types.Address,
	gasLimit *hexutil.Big,
	gasPrice *hexutil.Big,
	storageLimit *hexutil.Big,
	epoch ...*types.Epoch) (*types.CheckBalanceAgainstTransactionResponse, *error)

CheckBalanceAgainstTransaction checks if user balance is enough for the transaction.

func (*BulkCfxCaller) EstimateGasAndCollateral

func (client *BulkCfxCaller) EstimateGasAndCollateral(request types.CallRequest, epoch ...*types.Epoch) (*types.Estimate, *error)

EstimateGasAndCollateral excutes a message call "request" and returns the amount of the gas used and storage for collateral

func (*BulkCfxCaller) Execute

func (b *BulkCfxCaller) Execute() ([]error, error)

Execute sends all rpc requests in queue by rpc call "batch" on one request

func (*BulkCfxCaller) GetAccountInfo

func (client *BulkCfxCaller) GetAccountInfo(account types.Address, epoch ...*types.Epoch) (*types.AccountInfo, *error)

GetAccountInfo returns account related states of the given account

func (*BulkCfxCaller) GetAccountPendingInfo

func (client *BulkCfxCaller) GetAccountPendingInfo(address types.Address) (*types.AccountPendingInfo, *error)

GetAccountPendingInfo gets transaction pending info by account address

func (*BulkCfxCaller) GetAccountPendingTransactions

func (client *BulkCfxCaller) GetAccountPendingTransactions(address types.Address, startNonce *hexutil.Big, limit *hexutil.Uint64) (*types.AccountPendingTransactions, *error)

GetAccountPendingTransactions get transaction pending info by account address

func (*BulkCfxCaller) GetAccumulateInterestRate

func (client *BulkCfxCaller) GetAccumulateInterestRate(epoch ...*types.Epoch) (*hexutil.Big, *error)

GetAccumulateInterestRate returns accumulate interest rate of the given epoch

func (*BulkCfxCaller) GetAdmin

func (client *BulkCfxCaller) GetAdmin(contractAddress types.Address, epoch ...*types.Epoch) (*types.Address, *error)

GetAdmin returns admin of the given contract, it will return nil if contract not exist

func (*BulkCfxCaller) GetBalance

func (client *BulkCfxCaller) GetBalance(address types.Address, epoch ...*types.Epoch) (*hexutil.Big, *error)

GetBalance returns the balance of specified address at epoch.

func (*BulkCfxCaller) GetBestBlockHash

func (client *BulkCfxCaller) GetBestBlockHash() (*types.Hash, *error)

GetBestBlockHash returns the current best block hash.

func (*BulkCfxCaller) GetBlockByBlockNumber

func (client *BulkCfxCaller) GetBlockByBlockNumber(blockNumer hexutil.Uint64) (*types.Block, *error)

GetBlockByHash returns the block of specified block number

func (*BulkCfxCaller) GetBlockByEpoch

func (client *BulkCfxCaller) GetBlockByEpoch(epoch *types.Epoch) (*types.Block, *error)

GetBlockByEpoch returns the block of specified epoch. If the epoch is invalid, return the concrete error.

func (*BulkCfxCaller) GetBlockByHash

func (client *BulkCfxCaller) GetBlockByHash(blockHash types.Hash) (*types.Block, *error)

GetBlockByHash returns the block of specified blockHash If the block is not found, return nil.

func (*BulkCfxCaller) GetBlockByHashWithPivotAssumption

func (client *BulkCfxCaller) GetBlockByHashWithPivotAssumption(blockHash types.Hash, pivotHash types.Hash, epoch hexutil.Uint64) (*types.Block, *error)

GetBlockByHashWithPivotAssumption returns block with given hash and pivot chain assumption.

func (*BulkCfxCaller) GetBlockRewardInfo

func (client *BulkCfxCaller) GetBlockRewardInfo(epoch types.Epoch) ([]types.RewardInfo, *error)

GetBlockRewardInfo returns block reward information in an epoch

func (*BulkCfxCaller) GetBlockSummaryByBlockNumber

func (client *BulkCfxCaller) GetBlockSummaryByBlockNumber(blockNumer hexutil.Uint64) (*types.BlockSummary, *error)

GetBlockSummaryByBlockNumber returns the block summary of specified block number.

func (*BulkCfxCaller) GetBlockSummaryByEpoch

func (client *BulkCfxCaller) GetBlockSummaryByEpoch(epoch *types.Epoch) (*types.BlockSummary, *error)

GetBlockSummaryByEpoch returns the block summary of specified epoch. If the epoch is invalid, return the concrete error.

func (*BulkCfxCaller) GetBlockSummaryByHash

func (client *BulkCfxCaller) GetBlockSummaryByHash(blockHash types.Hash) (*types.BlockSummary, *error)

GetBlockSummaryByHash returns the block summary of specified blockHash If the block is not found, return nil.

func (*BulkCfxCaller) GetBlocksByEpoch

func (client *BulkCfxCaller) GetBlocksByEpoch(epoch *types.Epoch) ([]types.Hash, *error)

GetBlocksByEpoch returns the blocks hash in the specified epoch.

func (*BulkCfxCaller) GetClientVersion

func (client *BulkCfxCaller) GetClientVersion() (*string, *error)

GetClientVersion returns the client version as a string

func (*BulkCfxCaller) GetCode

func (client *BulkCfxCaller) GetCode(address types.Address, epoch ...*types.Epoch) (*hexutil.Bytes, *error)

GetCode returns the bytecode in HEX format of specified address at epoch.

func (*BulkCfxCaller) GetCollateralForStorage

func (client *BulkCfxCaller) GetCollateralForStorage(account types.Address, epoch ...*types.Epoch) (*hexutil.Big, *error)

GetCollateralForStorage returns balance of the given account.

func (*BulkCfxCaller) GetDepositList

func (client *BulkCfxCaller) GetDepositList(address types.Address, epoch ...*types.Epoch) ([]types.DepositInfo, *error)

GetDepositList returns deposit list of the given account.

func (*BulkCfxCaller) GetEpochNumber

func (client *BulkCfxCaller) GetEpochNumber(epoch ...*types.Epoch) (*hexutil.Big, *error)

GetEpochNumber returns the highest or specified epoch number.

func (*BulkCfxCaller) GetGasPrice

func (client *BulkCfxCaller) GetGasPrice() (*hexutil.Big, *error)

GetGasPrice returns the recent mean gas price.

func (*BulkCfxCaller) GetInterestRate

func (client *BulkCfxCaller) GetInterestRate(epoch ...*types.Epoch) (*hexutil.Big, *error)

GetInterestRate returns interest rate of the given epoch

func (*BulkCfxCaller) GetLogs

func (client *BulkCfxCaller) GetLogs(filter types.LogFilter) ([]types.Log, *error)

GetLogs returns logs that matching the specified filter.

func (*BulkCfxCaller) GetNextNonce

func (client *BulkCfxCaller) GetNextNonce(address types.Address, epoch ...*types.Epoch) (*hexutil.Big, *error)

GetNextNonce returns the next transaction nonce of address

func (*BulkCfxCaller) GetOpenedMethodGroups

func (client *BulkCfxCaller) GetOpenedMethodGroups() (*[]string, *error)

GetOpenedMethodGroups returns openning method groups

func (*BulkCfxCaller) GetParamsFromVote added in v1.4.1

func (client *BulkCfxCaller) GetParamsFromVote(epoch ...*types.Epoch) (*postypes.VoteParamsInfo, *error)

GetPoSRewardByEpoch returns PoS reward in the epoch

func (*BulkCfxCaller) GetPoSEconomics

func (client *BulkCfxCaller) GetPoSEconomics(epoch ...*types.Epoch) (*types.PoSEconomics, *error)

GetPoSEconomics returns accumulate interest rate of the given epoch

func (*BulkCfxCaller) GetRawBlockConfirmationRisk

func (client *BulkCfxCaller) GetRawBlockConfirmationRisk(blockhash types.Hash) (*hexutil.Big, *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 (*BulkCfxCaller) GetSkippedBlocksByEpoch

func (client *BulkCfxCaller) GetSkippedBlocksByEpoch(epoch *types.Epoch) ([]types.Hash, *error)

GetSkippedBlocksByEpoch returns skipped block hashes of given epoch

func (*BulkCfxCaller) GetSponsorInfo

func (client *BulkCfxCaller) GetSponsorInfo(contractAddress types.Address, epoch ...*types.Epoch) (*types.SponsorInfo, *error)

GetSponsorInfo returns sponsor information of the given contract

func (*BulkCfxCaller) GetStakingBalance

func (client *BulkCfxCaller) GetStakingBalance(account types.Address, epoch ...*types.Epoch) (*hexutil.Big, *error)

GetStakingBalance returns balance of the given account.

func (*BulkCfxCaller) GetStatus

func (client *BulkCfxCaller) GetStatus() (*types.Status, *error)

GetStatus returns status of connecting conflux node

func (*BulkCfxCaller) GetStorageAt

func (client *BulkCfxCaller) GetStorageAt(address types.Address, position types.Hash, epoch ...*types.Epoch) (*hexutil.Bytes, *error)

GetStorageAt returns storage entries from a given contract.

func (*BulkCfxCaller) GetStorageRoot

func (client *BulkCfxCaller) GetStorageRoot(address types.Address, epoch ...*types.Epoch) (*types.StorageRoot, *error)

GetStorageRoot returns storage root of given address

func (*BulkCfxCaller) GetSupplyInfo

func (client *BulkCfxCaller) GetSupplyInfo(epoch ...*types.Epoch) (*types.TokenSupplyInfo, *error)

GetSupplyInfo Return information about total token supply.

func (*BulkCfxCaller) GetTransactionByHash

func (client *BulkCfxCaller) GetTransactionByHash(txHash types.Hash) (*types.Transaction, *error)

GetTransactionByHash returns transaction for the specified txHash. If the transaction is not found, return nil.

func (*BulkCfxCaller) GetTransactionReceipt

func (client *BulkCfxCaller) GetTransactionReceipt(txHash types.Hash) (*types.TransactionReceipt, *error)

GetTransactionReceipt returns the receipt of specified transaction hash. If no receipt is found, return nil.

func (*BulkCfxCaller) GetVoteList

func (client *BulkCfxCaller) GetVoteList(address types.Address, epoch ...*types.Epoch) ([]types.VoteStakeInfo, *error)

GetVoteList returns vote list of the given account.

func (*BulkCfxCaller) SendRawTransaction

func (client *BulkCfxCaller) SendRawTransaction(rawData []byte) (*types.Hash, *error)

type BulkCustomCaller

type BulkCustomCaller struct {
	BulkCallerCore
	// contains filtered or unexported fields
}

func NewBulkCustomCaller

func NewBulkCustomCaller(core BulkCallerCore,
	outHandlers map[int]*OutputHandler,
) *BulkCustomCaller

func (*BulkCustomCaller) ContractCall

func (client *BulkCustomCaller) ContractCall(request types.CallRequest,
	epoch *types.Epoch,
	outDecoder OutputHandler,
	errPtr *error,
)

type BulkDebugCaller

type BulkDebugCaller BulkCallerCore

BulkDebugCaller used for bulk call rpc in one request to improve efficiency

func NewBulkDebugCaller

func NewBulkDebugCaller(core BulkCallerCore) *BulkDebugCaller

NewBulkDebugCaller creates new BulkDebugCaller instance

func (*BulkDebugCaller) Execute

func (b *BulkDebugCaller) Execute() ([]error, error)

Execute sends all rpc requests in queue by rpc call "batch" on one request

func (*BulkDebugCaller) GetEpochReceipts

func (client *BulkDebugCaller) GetEpochReceipts(epoch types.EpochOrBlockHash, include_eth_recepits ...bool) (*[][]types.TransactionReceipt, *error)

GetEpochReceiptsByEpochNumber returns epoch receipts by epoch number

func (*BulkDebugCaller) GetEpochReceiptsByPivotBlockHash deprecated

func (client *BulkDebugCaller) GetEpochReceiptsByPivotBlockHash(hash types.Hash) (*[][]types.TransactionReceipt, *error)

GetEpochReceiptsByPivotBlockHash returns epoch receipts by pivot block hash

Deprecated: Replace by GetEpochReceipts

type BulkPosCaller

type BulkPosCaller BulkCallerCore

BulkPosCaller used for bulk call rpc in one request to improve efficiency

func NewBulkPosCaller

func NewBulkPosCaller(core BulkCallerCore) *BulkPosCaller

NewBulkPosCaller creates new BulkPosCaller instance

func (*BulkPosCaller) Execute

func (b *BulkPosCaller) Execute() ([]error, error)

Execute sends all rpc requests in queue by rpc call "batch" on one request

func (*BulkPosCaller) GetAccount

func (client *BulkPosCaller) GetAccount(address postypes.Address, blockNumber ...uint64) (*postypes.Account, *error)

GetAccount returns account info at block

func (*BulkPosCaller) GetBlockByHash

func (client *BulkPosCaller) GetBlockByHash(hash types.Hash) (*postypes.Block, *error)

GetBlockByHash returns block info of block hash

func (*BulkPosCaller) GetBlockByNumber

func (client *BulkPosCaller) GetBlockByNumber(blockNumber postypes.BlockNumber) (*postypes.Block, *error)

GetBlockByHash returns block at block number

func (*BulkPosCaller) GetCommittee

func (client *BulkPosCaller) GetCommittee(blockNumber ...uint64) (*postypes.CommitteeState, *error)

GetCommittee returns committee info at block

func (*BulkPosCaller) GetRewardsByEpoch

func (client *BulkPosCaller) GetRewardsByEpoch(epochNumber uint64) (*postypes.EpochReward, *error)

GetRewardsByEpoch returns rewards of epoch

func (*BulkPosCaller) GetStatus

func (client *BulkPosCaller) GetStatus() (*postypes.Status, *error)

GetStatus returns pos chain status

func (*BulkPosCaller) GetTransactionByNumber

func (client *BulkPosCaller) GetTransactionByNumber(txNumber uint64) (*postypes.Transaction, *error)

GetTransactionByNumber returns transaction info of transaction number

type BulkSender

type BulkSender struct {
	// contains filtered or unexported fields
}

BulkSender used for bulk send unsigned tranactions in one request to improve efficiency, it will auto populate missing fields and nonce of unsigned transactions in queue before send.

func NewBulkSender added in v1.4.3

func NewBulkSender(signableClient sdk.Client) *BulkSender

NewBulkSender creates new bulk sender instance

func (*BulkSender) AppendTransaction

func (b *BulkSender) AppendTransaction(tx *types.UnsignedTransaction) *BulkSender

AppendTransaction append unsigned transaction to queue

func (*BulkSender) Clear

func (b *BulkSender) Clear()

Clear clear batch elems and errors in queue for new bulk call action

func (*BulkSender) IsPopulated added in v1.4.3

func (b *BulkSender) IsPopulated() bool

func (*BulkSender) PopulateTransactions

func (b *BulkSender) PopulateTransactions(nonceSource types.NonceType) ([]*types.UnsignedTransaction, error)

PopulateTransactions fill missing fields and nonce for unsigned transactions in queue. nonceSouce means use pending nonce or nonce be the nonce of first tx not setted nonce. if set NONCE_TYPE_AUTO, it will use nonce when exist pending txs because of notEnoughCash/notEnoughCash/outDatedStatus/outOfEpochHeight/noncefuture and use pending nonce when no pending txs.

func (*BulkSender) SignAndSend

func (b *BulkSender) SignAndSend() (txHashes []*types.Hash, txErrors []error, err error)

SignAndSend signs and sends all unsigned transactions in queue by rpc call "batch" on one request and returns the result of sending transactions. If there is any error on rpc "batch", it will be returned with err not nil. If there is no error on rpc "batch", it will return the txHashes or txErrors of sending transactions.

type BulkTraceCaller

type BulkTraceCaller BulkCallerCore

BulkTraceCaller used for bulk call rpc in one request to improve efficiency

func NewBulkTraceCaller

func NewBulkTraceCaller(core BulkCallerCore) *BulkTraceCaller

NewBulkTraceCaller creates new BulkTraceCaller instance

func (*BulkTraceCaller) Execute

func (b *BulkTraceCaller) Execute() ([]error, error)

Execute sends all rpc requests in queue by rpc call "batch" on one request

func (*BulkTraceCaller) FilterTraces

func (client *BulkTraceCaller) FilterTraces(traceFilter types.TraceFilter) (*[]types.LocalizedTrace, *error)

GetFilterTraces returns all traces matching the provided filter.

func (*BulkTraceCaller) GetBlockTraces

func (client *BulkTraceCaller) GetBlockTraces(blockHash types.Hash) (*types.LocalizedBlockTrace, *error)

func (*BulkTraceCaller) GetTransactionTraces

func (client *BulkTraceCaller) GetTransactionTraces(txHash types.Hash) (*[]types.LocalizedTrace, *error)

GetTransactionTraces returns all traces produced at the given transaction.

type BulkTxpoolCaller

type BulkTxpoolCaller BulkCallerCore

BulkTxpoolCaller used for bulk call rpc in one request to improve efficiency

func NewBulkTxpoolCaller

func NewBulkTxpoolCaller(core BulkCallerCore) *BulkTxpoolCaller

NewBulkTxpoolCaller creates new BulkTxpoolCaller instance

func (*BulkTxpoolCaller) AccountPendingInfo

func (client *BulkTxpoolCaller) AccountPendingInfo(address types.Address) (*types.AccountPendingInfo, *error)

/ Get transaction pending info by account address

func (*BulkTxpoolCaller) AccountPendingTransactions

func (client *BulkTxpoolCaller) AccountPendingTransactions(address types.Address, maybeStartNonce *hexutil.Big, maybeLimit *hexutil.Uint64) (*types.AccountPendingTransactions, *error)

/ Get transaction pending info by account address

func (*BulkTxpoolCaller) Execute

func (b *BulkTxpoolCaller) Execute() ([]error, error)

Execute sends all rpc requests in queue by rpc call "batch" on one request

func (*BulkTxpoolCaller) NextNonce

func (client *BulkTxpoolCaller) NextNonce(address types.Address) (*hexutil.Big, *error)

func (*BulkTxpoolCaller) PendingNonceRange

func (client *BulkTxpoolCaller) PendingNonceRange(address types.Address) (*types.TxPoolPendingNonceRange, *error)

func (*BulkTxpoolCaller) Status

func (client *BulkTxpoolCaller) Status() (*types.TxPoolStatus, *error)

func (*BulkTxpoolCaller) TransactionByAddressAndNonce

func (client *BulkTxpoolCaller) TransactionByAddressAndNonce(address types.Address, nonce *hexutil.Big) (*types.Transaction, *error)

func (*BulkTxpoolCaller) TxWithPoolInfo

func (client *BulkTxpoolCaller) TxWithPoolInfo(hash types.Hash) (*types.TxWithPoolInfo, *error)

type ErrBulkEstimate added in v1.4.3

type ErrBulkEstimate map[int]*ErrEstimate

func (ErrBulkEstimate) Error added in v1.4.3

func (e ErrBulkEstimate) Error() string

type ErrEstimate added in v1.4.3

type ErrEstimate struct {
	Inner error
}

func (ErrEstimate) Error added in v1.4.3

func (e ErrEstimate) Error() string

type OutputHandler

type OutputHandler func(out []byte) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL