Documentation ¶
Index ¶
- func NewTestBlock(number *big.Int, txs []*types.Transaction, trx []*types.Receipt) *types.Block
- func WaitSync(ctx context.Context, client Client, pauseTime time.Duration) error
- type Client
- type GethClient
- func (c *GethClient) Accounts(ctx context.Context) ([]string, error)
- func (c *GethClient) BalanceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (*big.Int, error)
- func (c *GethClient) BlockByNumber(ctx context.Context, number *big.Int) (*types.Block, error)
- func (c *GethClient) Close()
- func (c *GethClient) NetworkID(ctx context.Context) (*big.Int, error)
- func (c *GethClient) SendTransaction(ctx context.Context, from, to common.Address, amount *big.Int) (result *string, err error)
- func (c *GethClient) SyncProgress(ctx context.Context) (*ethereum.SyncProgress, error)
- func (c *GethClient) TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error)
- type MockClient
- func (c *MockClient) Accounts(ctx context.Context) (result []string, err error)
- func (c *MockClient) BalanceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (*big.Int, error)
- func (c *MockClient) BlockByNumber(ctx context.Context, number *big.Int) (*types.Block, error)
- func (c *MockClient) NetworkID(ctx context.Context) (*big.Int, error)
- func (c *MockClient) SendTransaction(ctx context.Context, from, to common.Address, amount *big.Int) (result *string, err error)
- func (c *MockClient) SyncProgress(ctx context.Context) (*ethereum.SyncProgress, error)
- func (c *MockClient) TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error)
- type SendTxArgs
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewTestBlock ¶
NewTestBlock creates a new test block.
Types ¶
type Client ¶
type Client interface { Accounts(ctx context.Context) ([]string, error) SendTransaction(ctx context.Context, from, to common.Address, amount *big.Int) (*string, error) NetworkID(ctx context.Context) (*big.Int, error) BlockByNumber(ctx context.Context, number *big.Int) (*types.Block, error) TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error) BalanceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (*big.Int, error) SyncProgress(ctx context.Context) (*ethereum.SyncProgress, error) }
Client describes Ethereum client interface.
type GethClient ¶
type GethClient struct {
// contains filtered or unexported fields
}
GethClient is an Ethereum JSON-RPC client.
func NewClient ¶
func NewClient(ctx context.Context, url string) (*GethClient, error)
NewClient creates a new Ethereum JSON-RPC client.
func (*GethClient) Accounts ¶
func (c *GethClient) Accounts(ctx context.Context) ([]string, error)
Accounts gets accounts from Geth node.
func (*GethClient) BlockByNumber ¶
func (*GethClient) SendTransaction ¶
func (c *GethClient) SendTransaction(ctx context.Context, from, to common.Address, amount *big.Int) (result *string, err error)
SendTransaction sends a transaction through Geth node. Account must be unlocked.
func (*GethClient) SyncProgress ¶
func (c *GethClient) SyncProgress( ctx context.Context) (*ethereum.SyncProgress, error)
func (*GethClient) TransactionReceipt ¶
type MockClient ¶
type MockClient struct { Acc map[string]*bind.TransactOpts NetID *big.Int Block *types.Block Backend *backends.SimulatedBackend }
MockClient is a mock for Ethereum client.
func (*MockClient) Accounts ¶
func (c *MockClient) Accounts( ctx context.Context) (result []string, err error)
Accounts is a mock for Accounts function.
func (*MockClient) BalanceAt ¶
func (c *MockClient) BalanceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (*big.Int, error)
BalanceAt is a mock for BalanceAt function.
func (*MockClient) BlockByNumber ¶
BlockByNumber is a mock for BlockByNumber function.
func (*MockClient) SendTransaction ¶
func (c *MockClient) SendTransaction(ctx context.Context, from, to common.Address, amount *big.Int) (result *string, err error)
SendTransaction is a mock for SendTransaction function.
func (*MockClient) SyncProgress ¶
func (c *MockClient) SyncProgress( ctx context.Context) (*ethereum.SyncProgress, error)
SyncProgress is a mock for SyncProgress function.
func (*MockClient) TransactionReceipt ¶
func (c *MockClient) TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error)
TransactionReceipt is a mock for TransactionReceipt function.
Click to show internal directories.
Click to hide internal directories.