backend

package
v0.0.0-...-f395faf Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2018 License: GPL-3.0 Imports: 19 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNoCode is returned by call and transact operations for which the requested
	// recipient contract to operate on does not exist in the state db or does not
	// have any code associated with it (i.e. suicided).
	ErrNoCode = errors.New("no contract code at given address")

	// This error is raised when attempting to perform a pending state action
	// on a backend that doesn't implement PendingContractCaller.
	ErrNoPendingState = errors.New("backend does not support pending state")

	// This error is returned by WaitDeployed if contract creation leaves an
	// empty contract behind.
	ErrNoCodeAfterDeploy = errors.New("no contract code after deployment")
)

Functions

This section is empty.

Types

type BlockConsumer

type BlockConsumer func(hashs []common.Hash) (bool, error)

type BoundContract

type BoundContract struct {
	Address common.Address // Deployment address of the contract on the Ethereum blockchain
	Abi     abi.ABI        // Reflect based ABI to access the correct Ethereum methods

}

BoundContract is the base wrapper object that reflects a contract on the Ethereum network. It contains a collection of methods that are used by the higher level contract bindings to operate.

type CallMsg

type CallMsg struct {
	From common.Address
	To   *common.Address
	Data []byte
}

type Cita

type Cita interface {
	GetBlockNumber() (*big.Int, error)
	GetBlockMetadata(blockNumber *big.Int) (*types.BlockMetadata, error)
	TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error)
}

See https://cryptape.github.io/cita/zh/usage-guide/rpc/index.html

type ContractCaller

type ContractCaller interface {
	CodeAt(ctx context.Context, contract common.Address, blockNumber *big.Int) (string, error)
	AbiAt(ctx context.Context, contract common.Address, blockNumber *big.Int) (abi.ABI, error)
	// ContractCall executes an Ethereum contract call with the specified data as the
	// input.
	CallContract(ctx context.Context, result interface{}, call CallMsg, blockNumber *big.Int) error
}

ContractCaller defines the methods needed to allow operating with contract on a read only basis.

type ContractFilterer

type ContractFilterer interface {
	// SubscribeFilterLogs creates a background log filtering operation, returning
	// a subscription immediately, which can be used to stream the found events.
	SubscribeLogFilter(ctx context.Context, query ethereum.FilterQuery, consumer LogConsumer) (Subscription, error)
	SubscribeBlockFilter(ctx context.Context, consumer BlockConsumer) (Subscription, error)
}

ContractFilterer defines the methods needed to access log events using one-off queries or continuous event subscriptions.

type ContractTransactor

type ContractTransactor interface {
	// SendTransaction injects the transaction into the pending pool for execution.
	SendTransaction(ctx context.Context, tx *types.Transaction, hexPrivateKey string) (common.Hash, error)
	// DeployContract deploys a contract onto the Ethereum blockchain and binds the
	// deployment address with a Go wrapper.
	DeployContract(ctx context.Context, params *types.TransactParams, abi, code string) (common.Hash, *BoundContract, error)
}

ContractTransactor defines the methods needed to allow operating with contract on a write only basis. Beside the transacting method, the remainder are helpers used when the user does not provide some needed values, but rather leaves it up to the transactor to decide.

type Interface

Interface defines the methods needed to work with contracts on a read-write basis.

func New

func New(provider providers.Interface) Interface

type LogConsumer

type LogConsumer func(logs []types.Log) (bool, error)

type Subscription

type Subscription interface {
	Quit() error
	Unsubscription()
}

Jump to

Keyboard shortcuts

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