Documentation
¶
Index ¶
- Constants
- type BackendClient
- type Key
- type Option
- type Token
- type TokenInfoGetterFn
- type TokenWallet
- type TransactionSender
- type Wallet
- func (w *Wallet) BalanceERC20(ctx context.Context, addr common.Address, token Token) (*big.Int, error)
- func (w *Wallet) BalanceNative(ctx context.Context, addr common.Address) (*big.Int, error)
- func (w *Wallet) ChainID(ctx context.Context) (int64, error)
- func (w *Wallet) ERC20() TokenWallet
- func (w *Wallet) Native() TokenWallet
- func (w *Wallet) PublicAddress() common.Address
- func (w *Wallet) TransferERC20(ctx context.Context, toAddr common.Address, amount *big.Int, token Token) error
- func (w *Wallet) TransferNative(ctx context.Context, toAddr common.Address, amount *big.Int) error
Constants ¶
const ( SwarmTokenDecimals = 16 LocalnetChainID = 12345 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BackendClient ¶
type BackendClient interface {
ChainID(ctx context.Context) (*big.Int, error)
CallContract(ctx context.Context, call ethereum.CallMsg, blockNumber *big.Int) ([]byte, error)
PendingNonceAt(ctx context.Context, account common.Address) (uint64, error)
SuggestGasPrice(ctx context.Context) (*big.Int, error)
SuggestGasTipCap(ctx context.Context) (*big.Int, error)
EstimateGas(ctx context.Context, call ethereum.CallMsg) (gas uint64, err error)
SendTransaction(ctx context.Context, tx *types.Transaction) error
TransactionByHash(ctx context.Context, hash common.Hash) (*types.Transaction, bool, error)
BalanceAt(ctx context.Context, address common.Address, block *big.Int) (*big.Int, error)
}
type Key ¶
type Key string
func GenerateKey ¶
func (Key) PrivateECDSA ¶
func (k Key) PrivateECDSA() (*ecdsa.PrivateKey, error)
type Option ¶ added in v0.4.0
type Option func(*options)
Option configures a Wallet.
func WithLookup ¶ added in v0.4.0
WithLookup sets how long, and how often, the chain is asked for a transaction whose send failed before the send is reported as failed. The defaults are 15s and 1s. A timeout at or below zero uses the default, an interval at or below zero asks once. Some nodes reject a transaction they did keep, e.g. Nethermind answers "replacement transaction underpriced" for one already in its pool.
func WithRetry ¶ added in v0.4.0
WithRetry sets how many times a failed send is retried, waiting delay between attempts. The default is 0, which sends once; negative values count as 0. Every attempt re-sends the same signed transaction, so at most one can be mined. A transaction the node rejected is not retried.
type TokenInfoGetterFn ¶
type TokenWallet ¶
type TransactionSender ¶
type Wallet ¶
type Wallet struct {
// contains filtered or unexported fields
}
func (*Wallet) BalanceERC20 ¶
func (*Wallet) BalanceNative ¶
func (*Wallet) ERC20 ¶
func (w *Wallet) ERC20() TokenWallet
func (*Wallet) Native ¶
func (w *Wallet) Native() TokenWallet