Documentation ¶
Index ¶
- type ApiClient
- func (cc *ApiClient) BalanceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (*big.Int, error)
- func (cc *ApiClient) BlockByNumber(ctx context.Context, number *big.Int) (*types.Block, error)
- func (cc *ApiClient) CallContract(ctx context.Context, call cpchain.CallMsg, blockNumber *big.Int) ([]byte, error)
- func (cc *ApiClient) CodeAt(ctx context.Context, account common.Address, blockNumber *big.Int) ([]byte, error)
- func (cc *ApiClient) EstimateGas(ctx context.Context, call cpchain.CallMsg) (gas uint64, err error)
- func (cc *ApiClient) FilterLogs(ctx context.Context, query cpchain.FilterQuery) ([]types.Log, error)
- func (cc *ApiClient) HeaderByNumber(ctx context.Context, number *big.Int) (*types.Header, error)
- func (cc *ApiClient) NonceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (uint64, error)
- func (cc *ApiClient) PendingCallContract(ctx context.Context, call cpchain.CallMsg) ([]byte, error)
- func (cc *ApiClient) PendingCodeAt(ctx context.Context, contract common.Address) ([]byte, error)
- func (cc *ApiClient) PendingNonceAt(ctx context.Context, account common.Address) (uint64, error)
- func (cc *ApiClient) SendTransaction(ctx context.Context, tx *types.Transaction) error
- func (cc *ApiClient) SubscribeFilterLogs(ctx context.Context, q cpchain.FilterQuery, ch chan<- types.Log) (cpchain.Subscription, error)
- func (cc *ApiClient) SuggestGasPrice(ctx context.Context) (*big.Int, error)
- type BackendHolder
- type ChainAPIBackend
- type ChainClient
- type ContractAPIbcakend
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApiClient ¶
type ApiClient struct { ChainBackend ChainAPIBackend ContractBackend ContractAPIbcakend }
func GetChainClient ¶
func GetChainClient() *ApiClient
func (*ApiClient) BalanceAt ¶
func (cc *ApiClient) BalanceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (*big.Int, error)
BalanceAt returns the wei balance of the given account. The block number can be nil, in which case the balance is taken from the latest known block.
func (*ApiClient) BlockByNumber ¶
BlockByNumber returns a block from the current canonical chain. If number is nil, the latest known block is returned.
func (*ApiClient) CallContract ¶
func (*ApiClient) EstimateGas ¶
func (*ApiClient) FilterLogs ¶
func (*ApiClient) HeaderByNumber ¶
HeaderByNumber returns a block header from the current canonical chain. If number is nil, the latest known header is returned.
func (*ApiClient) PendingCallContract ¶
func (*ApiClient) PendingCodeAt ¶
func (*ApiClient) PendingNonceAt ¶
func (*ApiClient) SendTransaction ¶
func (*ApiClient) SubscribeFilterLogs ¶
func (cc *ApiClient) SubscribeFilterLogs(ctx context.Context, q cpchain.FilterQuery, ch chan<- types.Log) (cpchain.Subscription, error)
type BackendHolder ¶
type BackendHolder struct { ChainBackend ChainAPIBackend ContractBackend ContractAPIbcakend }
used to hold *APIBackend
func GetApiBackendHolderInstance ¶
func GetApiBackendHolderInstance() *BackendHolder
func (*BackendHolder) Init ¶
func (rb *BackendHolder) Init(chainBackend ChainAPIBackend, contractBackend ContractAPIbcakend)
type ChainAPIBackend ¶
type ChainAPIBackend interface { StateAndHeaderByNumber(ctx context.Context, blockNr rpc.BlockNumber, isPrivate bool) (*state.StateDB, *types.Header, error) BlockByNumber(ctx context.Context, number rpc.BlockNumber) (*types.Block, error) HeaderByNumber(ctx context.Context, number rpc.BlockNumber) (*types.Header, error) }
type ChainClient ¶
type ChainClient struct {
ChainAPIBackend
}
Click to show internal directories.
Click to hide internal directories.