Documentation ¶
Index ¶
- func InitMockWallet()
- type Context
- type EthContext
- func (ctx *EthContext) BlockNumber(timeoutCtx context.Context) (uint64, error)
- func (ctx *EthContext) BuildTxOpts(value, gasLimit uint64) (*bind.TransactOpts, error)
- func (ctx *EthContext) CallContract(timeoutCtx context.Context, to ethcommon.Address, input []byte) ([]byte, error)
- func (ctx *EthContext) EstimateGas(timeoutCtx context.Context, to ethcommon.Address, input []byte) (uint64, error)
- func (ctx *EthContext) GetAddress() ethcommon.Address
- func (ctx *EthContext) GetClient() *ethclient.Client
- func (ctx *EthContext) GetLog(timeoutCtx context.Context, toAddr ethcommon.Address, blockNo *big.Int) ([]ethtypes.Log, error)
- func (ctx *EthContext) GetPrivateKey() *ecdsa.PrivateKey
- func (ctx *EthContext) GetPublicKey() *ecdsa.PublicKey
- func (ctx *EthContext) PendingNonceAt(timeoutCtx context.Context) (uint64, error)
- func (ctx *EthContext) SetPrivateKey(privateKey *ecdsa.PrivateKey)
- func (ctx *EthContext) SuggestGasPrice(timeoutCtx context.Context) (*big.Int, error)
- func (ctx *EthContext) WaitReceipt(timeoutCtx context.Context, txHash ethcommon.Hash, interval time.Duration) *ethtypes.Receipt
- type MockWallet
- type WalletWrapper
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitMockWallet ¶
func InitMockWallet()
Types ¶
type Context ¶
type Context interface { SetPrivateKey(*ecdsa.PrivateKey) GetPrivateKey() *ecdsa.PrivateKey GetPublicKey() *ecdsa.PublicKey GetAddress() ethcommon.Address GetClient() *ethclient.Client BlockNumber(timeoutCtx context.Context) (uint64, error) PendingNonceAt(timeoutCtx context.Context) (uint64, error) SuggestGasPrice(timeoutCtx context.Context) (*big.Int, error) EstimateGas(timeoutCtx context.Context, to ethcommon.Address, data []byte) (uint64, error) CallContract(timeoutCtx context.Context, to ethcommon.Address, data []byte) ([]byte, error) BuildTxOpts(value, gasLimit uint64) (*bind.TransactOpts, error) WaitReceipt(timeoutCtx context.Context, txHash ethcommon.Hash, interval time.Duration) *ethtypes.Receipt GetLog(timeoutCtx context.Context, toAddr ethcommon.Address, blockNo *big.Int) ([]ethtypes.Log, error) }
type EthContext ¶
type EthContext struct {
// contains filtered or unexported fields
}
func NewEthClientContext ¶
func NewEthClientContext(chainUrl string, hrp string, wallet WalletWrapper) *EthContext
func (*EthContext) BlockNumber ¶
func (ctx *EthContext) BlockNumber(timeoutCtx context.Context) (uint64, error)
func (*EthContext) BuildTxOpts ¶
func (ctx *EthContext) BuildTxOpts(value, gasLimit uint64) (*bind.TransactOpts, error)
func (*EthContext) CallContract ¶
func (*EthContext) EstimateGas ¶
func (ctx *EthContext) EstimateGas(timeoutCtx context.Context, to ethcommon.Address, input []byte) (uint64, error)
EstimateGas uses context's walletWrapper address as the caller (from)
func (*EthContext) GetAddress ¶
func (ctx *EthContext) GetAddress() ethcommon.Address
func (*EthContext) GetClient ¶
func (ctx *EthContext) GetClient() *ethclient.Client
func (*EthContext) GetPrivateKey ¶
func (ctx *EthContext) GetPrivateKey() *ecdsa.PrivateKey
func (*EthContext) GetPublicKey ¶
func (ctx *EthContext) GetPublicKey() *ecdsa.PublicKey
func (*EthContext) PendingNonceAt ¶
func (ctx *EthContext) PendingNonceAt(timeoutCtx context.Context) (uint64, error)
func (*EthContext) SetPrivateKey ¶
func (ctx *EthContext) SetPrivateKey(privateKey *ecdsa.PrivateKey)
func (*EthContext) SuggestGasPrice ¶
type MockWallet ¶
type MockWallet struct {
// contains filtered or unexported fields
}
func MockWalletInstance ¶
func MockWalletInstance() *MockWallet
func (*MockWallet) GetAddress ¶
func (m *MockWallet) GetAddress() ethcommon.Address
GetAddress returns the organization wallet address
func (*MockWallet) GetPrivateKey ¶
func (m *MockWallet) GetPrivateKey() *ecdsa.PrivateKey
GetPrivateKey returns the organization private key
func (*MockWallet) GetPublicKey ¶
func (m *MockWallet) GetPublicKey() *ecdsa.PublicKey
GetPrivateKey returns the organization private key
func (*MockWallet) SetPrivateKey ¶
func (m *MockWallet) SetPrivateKey(privateKey *ecdsa.PrivateKey)
GetPrivateKey returns the organization private key
type WalletWrapper ¶
type WalletWrapper interface { SetPrivateKey(privateKey *ecdsa.PrivateKey) GetPrivateKey() *ecdsa.PrivateKey GetPublicKey() *ecdsa.PublicKey GetAddress() ethcommon.Address }
Click to show internal directories.
Click to hide internal directories.