primitive_backend

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2019 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

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

func (cc *ApiClient) BlockByNumber(ctx context.Context, number *big.Int) (*types.Block, error)

BlockByNumber returns a block from the current canonical chain. If number is nil, the latest known block is returned.

func (*ApiClient) CallContract

func (cc *ApiClient) CallContract(ctx context.Context, call cpchain.CallMsg, blockNumber *big.Int) ([]byte, error)

func (*ApiClient) CodeAt

func (cc *ApiClient) CodeAt(ctx context.Context, account common.Address, blockNumber *big.Int) ([]byte, error)

func (*ApiClient) EstimateGas

func (cc *ApiClient) EstimateGas(ctx context.Context, call cpchain.CallMsg) (gas uint64, err error)

func (*ApiClient) FilterLogs

func (cc *ApiClient) FilterLogs(ctx context.Context, query cpchain.FilterQuery) ([]types.Log, error)

func (*ApiClient) HeaderByNumber

func (cc *ApiClient) HeaderByNumber(ctx context.Context, number *big.Int) (*types.Header, error)

HeaderByNumber returns a block header from the current canonical chain. If number is nil, the latest known header is returned.

func (*ApiClient) NonceAt

func (cc *ApiClient) NonceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (uint64, error)

func (*ApiClient) PendingCallContract

func (cc *ApiClient) PendingCallContract(ctx context.Context, call cpchain.CallMsg) ([]byte, error)

func (*ApiClient) PendingCodeAt

func (cc *ApiClient) PendingCodeAt(ctx context.Context, contract common.Address) ([]byte, error)

func (*ApiClient) PendingNonceAt

func (cc *ApiClient) PendingNonceAt(ctx context.Context, account common.Address) (uint64, error)

func (*ApiClient) SendTransaction

func (cc *ApiClient) SendTransaction(ctx context.Context, tx *types.Transaction) error

func (*ApiClient) SubscribeFilterLogs

func (cc *ApiClient) SubscribeFilterLogs(ctx context.Context, q cpchain.FilterQuery, ch chan<- types.Log) (cpchain.Subscription, error)

func (*ApiClient) SuggestGasPrice

func (cc *ApiClient) SuggestGasPrice(ctx context.Context) (*big.Int, 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
}

type ContractAPIbcakend

type ContractAPIbcakend interface {
	Call(ctx context.Context, args cpcapi.CallArgs, blockNr rpc.BlockNumber) (hexutil.Bytes, error)
}

Jump to

Keyboard shortcuts

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