Documentation
¶
Index ¶
- Constants
- type Chain
- type EthClient
- type EthTx
- type InteropSet
- type InteropSystem
- type LowLevelChain
- type LowLevelSystem
- type RawTransaction
- type System
- type Transaction
- type TransactionData
- type TransactionProcessor
- type TxBuilder
- type TxBuilderOption
- type TxOption
- func WithAccessList(accessList types.AccessList) TxOption
- func WithBlobCommitments(commitments []kzg4844.Commitment) TxOption
- func WithBlobHashes(hashes []common.Hash) TxOption
- func WithBlobProofs(proofs []kzg4844.Proof) TxOption
- func WithBlobs(blobs []kzg4844.Blob) TxOption
- func WithData(data []byte) TxOption
- func WithFrom(from common.Address) TxOption
- func WithGasLimit(gasLimit uint64) TxOption
- func WithTo(to common.Address) TxOption
- func WithValue(value *big.Int) TxOption
- type TxOpts
- type Wallet
Constants ¶
const ( DefaultGasLimitMarginPercent = 20 // 20% margin for gas limit DefaultFeeCapMultiplier = 2 // 2x gas price for fee cap )
Default values for gas calculations
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Chain ¶
type Chain interface {
ID() types.ChainID
Wallets(ctx context.Context) ([]Wallet, error)
ContractsRegistry() interfaces.ContractsRegistry
SupportsEIP(ctx context.Context, eip uint64) bool
GasPrice(ctx context.Context) (*big.Int, error)
GasLimit(ctx context.Context, tx TransactionData) (uint64, error)
PendingNonceAt(ctx context.Context, address common.Address) (uint64, error)
}
Chain represents an Ethereum chain (L1 or L2)
type EthClient ¶ added in v1.11.2
type EthClient interface {
SendTransaction(ctx context.Context, tx *types.Transaction) error
}
EthClient defines the interface for interacting with Ethereum node
type EthTx ¶ added in v1.11.2
type EthTx struct {
// contains filtered or unexported fields
}
EthTx is the default implementation of Transaction that wraps types.Transaction
func (*EthTx) Raw ¶ added in v1.11.2
func (t *EthTx) Raw() *types.Transaction
type InteropSet ¶
type InteropSet interface {
L2s() []Chain
}
InteropSet provides access to L2 chains in an interop environment
type InteropSystem ¶
type InteropSystem interface {
System
InteropSet() InteropSet
}
InteropSystem extends System with interoperability features
type LowLevelChain ¶ added in v1.11.2
LowLevelChain is a Chain that gives direct access to the low level RPC client.
type LowLevelSystem ¶ added in v1.11.2
type LowLevelSystem = genSystem[LowLevelChain]
type RawTransaction ¶ added in v1.11.2
type RawTransaction interface {
Raw() *coreTypes.Transaction
}
RawTransaction is an optional interface that can be implemented by a Transaction to provide access to the raw transaction data. It is currently necessary to perform processing operations (signing, sending) on the transaction. We would need to do better here.
type System ¶
type System = genSystem[Chain]
System represents a complete Optimism system with L1 and L2 chains
func NewSystemFromURL ¶ added in v1.11.1
type Transaction ¶ added in v1.11.2
type Transaction interface {
Type() uint8
Hash() common.Hash
TransactionData
}
Transaction is the instantiated transaction object.
type TransactionData ¶ added in v1.11.2
type TransactionData interface {
From() common.Address
To() *common.Address
Value() *big.Int
Data() []byte
}
TransactionData is the input for a transaction creation.
type TransactionProcessor ¶ added in v1.11.2
type TransactionProcessor interface {
Sign(tx Transaction) (Transaction, error)
Send(ctx context.Context, tx Transaction) error
}
TransactionProcessor is a helper interface for signing and sending transactions.
func NewEthTransactionProcessor ¶ added in v1.11.2
func NewEthTransactionProcessor(client *ethclient.Client, chainID *big.Int) TransactionProcessor
NewEthTransactionProcessor creates a new transaction processor with an ethclient
func NewTransactionProcessor ¶ added in v1.11.2
func NewTransactionProcessor(client EthClient, chainID *big.Int) TransactionProcessor
NewTransactionProcessor creates a new transaction processor
type TxBuilder ¶ added in v1.11.2
type TxBuilder struct {
// contains filtered or unexported fields
}
TxBuilder helps construct Ethereum transactions
func NewTxBuilder ¶ added in v1.11.2
func NewTxBuilder(ctx context.Context, chain Chain, opts ...TxBuilderOption) *TxBuilder
NewTxBuilder creates a new transaction builder
type TxBuilderOption ¶ added in v1.11.2
type TxBuilderOption func(*TxBuilder)
TxBuilderOption is a function that configures a TxBuilder
func WithFeeCapMultiplier ¶ added in v1.11.2
func WithFeeCapMultiplier(multiplier uint64) TxBuilderOption
WithFeeCapMultiplier sets the multiplier for calculating fee cap from gas price
func WithGasLimitMargin ¶ added in v1.11.2
func WithGasLimitMargin(marginPercent uint64) TxBuilderOption
WithGasLimitMargin sets the margin percentage to add to estimated gas limit
func WithTxType ¶ added in v1.11.2
func WithTxType(txType uint8) TxBuilderOption
WithTxType sets the transaction type to use, overriding automatic detection
type TxOption ¶ added in v1.11.2
type TxOption func(*TxOpts)
TxOption is a function that configures TxOpts
func WithAccessList ¶ added in v1.11.2
func WithAccessList(accessList types.AccessList) TxOption
WithAccessList sets the access list for EIP-2930 transactions
func WithBlobCommitments ¶ added in v1.11.2
func WithBlobCommitments(commitments []kzg4844.Commitment) TxOption
WithBlobCommitments sets the blob commitments
func WithBlobHashes ¶ added in v1.11.2
WithBlobHashes sets the blob hashes
func WithBlobProofs ¶ added in v1.11.2
WithBlobProofs sets the blob proofs
func WithGasLimit ¶ added in v1.11.2
WithGasLimit sets an explicit gas limit
type TxOpts ¶ added in v1.11.2
type TxOpts struct {
// contains filtered or unexported fields
}
TxOpts is a struct that holds all transaction options
type Wallet ¶ added in v1.11.2
type Wallet interface {
PrivateKey() types.Key
Address() types.Address
SendETH(to types.Address, amount types.Balance) types.WriteInvocation[any]
Balance() types.Balance
Nonce() uint64
TransactionProcessor
}
Wallet represents a chain wallet. In particular it can process transactions.