backends

package
v0.0.0-...-39cdb81 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2019 License: GPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SimulatedBackend

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

Simulatedbackend实现bind.contractbackend,在 背景。其主要目的是允许轻松测试合同绑定。

func NewSimulatedBackend

func NewSimulatedBackend(alloc core.GenesisAlloc, gasLimit uint64) *SimulatedBackend

NewSimulatedBackend使用模拟区块链创建新的绑定后端 用于测试。

func (*SimulatedBackend) AdjustTime

func (b *SimulatedBackend) AdjustTime(adjustment time.Duration) error

AdjustTime为模拟时钟增加了一个时间偏移。

func (*SimulatedBackend) BalanceAt

func (b *SimulatedBackend) BalanceAt(ctx context.Context, contract common.Address, blockNumber *big.Int) (*big.Int, error)

balanceat返回区块链中某个账户的wei余额。

func (*SimulatedBackend) CallContract

func (b *SimulatedBackend) CallContract(ctx context.Context, call ethereum.CallMsg, blockNumber *big.Int) ([]byte, error)

CallContract执行合同调用。

func (*SimulatedBackend) CodeAt

func (b *SimulatedBackend) CodeAt(ctx context.Context, contract common.Address, blockNumber *big.Int) ([]byte, error)

codeat返回与区块链中某个帐户关联的代码。

func (*SimulatedBackend) Commit

func (b *SimulatedBackend) Commit()

commit将所有挂起的事务作为单个块导入并启动 新的状态。

func (*SimulatedBackend) EstimateGas

func (b *SimulatedBackend) EstimateGas(ctx context.Context, call ethereum.CallMsg) (uint64, error)

EstimateGas针对当前挂起的块/状态执行请求的代码,并且 返回使用的气体量。

func (*SimulatedBackend) FilterLogs

func (b *SimulatedBackend) FilterLogs(ctx context.Context, query ethereum.FilterQuery) ([]types.Log, error)

filterlogs执行日志筛选操作,在执行期间阻塞,以及 一批返回所有结果。

TODO(karalabe):当订阅可以返回过去的数据时,取消预测。

func (*SimulatedBackend) NonceAt

func (b *SimulatedBackend) NonceAt(ctx context.Context, contract common.Address, blockNumber *big.Int) (uint64, error)

nonceat返回区块链中某个帐户的nonce。

func (*SimulatedBackend) PendingCallContract

func (b *SimulatedBackend) PendingCallContract(ctx context.Context, call ethereum.CallMsg) ([]byte, error)

PendingCallContract对挂起状态执行合同调用。

func (*SimulatedBackend) PendingCodeAt

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

PendingCodeAt返回与处于挂起状态的帐户关联的代码。

func (*SimulatedBackend) PendingNonceAt

func (b *SimulatedBackend) PendingNonceAt(ctx context.Context, account common.Address) (uint64, error)

PendingOnCate实现PendingStateReader.PendingOnCate,检索 当前为帐户挂起的非现金。

func (*SimulatedBackend) Rollback

func (b *SimulatedBackend) Rollback()

回滚将中止所有挂起的事务,恢复到上一次提交的状态。

func (*SimulatedBackend) SendTransaction

func (b *SimulatedBackend) SendTransaction(ctx context.Context, tx *types.Transaction) error

sendTransaction更新挂起块以包括给定的事务。 如果事务无效,它会恐慌。

func (*SimulatedBackend) StorageAt

func (b *SimulatedBackend) StorageAt(ctx context.Context, contract common.Address, key common.Hash, blockNumber *big.Int) ([]byte, error)

storageat返回在区块链中存储帐户的密钥的值。

func (*SimulatedBackend) SubscribeFilterLogs

func (b *SimulatedBackend) SubscribeFilterLogs(ctx context.Context, query ethereum.FilterQuery, ch chan<- types.Log) (ethereum.Subscription, error)

subscribeBilterLogs创建后台日志筛选操作,返回 立即订阅,可用于流式处理找到的事件。

func (*SimulatedBackend) SuggestGasPrice

func (b *SimulatedBackend) SuggestGasPrice(ctx context.Context) (*big.Int, error)

Suggestgasprice执行ContractTransactor.Suggestgasprice。自从模拟 这家连锁店没有矿工,我们只要回电1美元就可以了。

func (*SimulatedBackend) TransactionReceipt

func (b *SimulatedBackend) TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error)

TransactionReceipt返回交易的收据。

Jump to

Keyboard shortcuts

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