Documentation
¶
Index ¶
- Constants
- func NewWallet(pk string, addr types.Address, chain Chain) (*wallet, error)
- func NewWalletV2(ctx context.Context, rpcURL string, priv *ecdsa.PrivateKey, ...) (*walletV2, error)
- type AddressMap
- type Chain
- type EthClient
- type EthReceipt
- type EthTx
- type InteropSet
- type InteropSystem
- type L2Chain
- type Node
- type RawTransaction
- type Receipt
- type Supervisor
- 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
- type WalletMap
- type WalletV2
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 ¶
func NewWalletV2 ¶ added in v1.13.0
func NewWalletV2(ctx context.Context, rpcURL string, priv *ecdsa.PrivateKey, clCfg *sources.EthClientConfig, log log.Logger) (*walletV2, error)
Types ¶
type AddressMap ¶ added in v1.12.2
type AddressMap descriptors.AddressMap
type Chain ¶
type Chain interface { ID() types.ChainID Nodes() []Node // The node at index 0 will always be the sequencer node Config() (*params.ChainConfig, error) // The wallets and addresses below are for use on the chain that the instance represents. // If the instance also implements L2Chain, then the wallets and addresses below are still for the L2. Wallets() WalletMap Addresses() AddressMap }
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 EthReceipt ¶ added in v1.12.2
type EthReceipt struct {
// contains filtered or unexported fields
}
EthReceipt is the default implementation of Receipt that wraps types.Receipt
func (*EthReceipt) BlockNumber ¶ added in v1.12.2
func (t *EthReceipt) BlockNumber() *big.Int
func (*EthReceipt) Logs ¶ added in v1.12.2
func (t *EthReceipt) Logs() []*types.Log
func (*EthReceipt) TxHash ¶ added in v1.12.2
func (t *EthReceipt) TxHash() common.Hash
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) AccessList ¶ added in v1.12.2
func (t *EthTx) AccessList() types.AccessList
func (*EthTx) Raw ¶ added in v1.11.2
func (t *EthTx) Raw() *types.Transaction
type InteropSet ¶
type InteropSet interface {
L2s() []L2Chain
}
InteropSet provides access to L2 chains in an interop environment
type InteropSystem ¶
type InteropSystem interface { System InteropSet() InteropSet Supervisor(context.Context) (Supervisor, error) }
InteropSystem extends System with interoperability features
type L2Chain ¶ added in v1.12.2
type L2Chain interface { Chain // The wallets and addresses below are for use on the L1 chain that this L2Chain instance settles to. L1Addresses() AddressMap L1Wallets() WalletMap }
type Node ¶ added in v1.12.0
type Node interface { Name() string GasPrice(ctx context.Context) (*big.Int, error) GasLimit(ctx context.Context, tx TransactionData) (uint64, error) PendingNonceAt(ctx context.Context, address common.Address) (uint64, error) BlockByNumber(ctx context.Context, number *big.Int) (eth.BlockInfo, error) ContractsRegistry() interfaces.ContractsRegistry SupportsEIP(ctx context.Context, eip uint64) bool RPCURL() string Client() (*sources.EthClient, error) GethClient() (*ethclient.Client, error) }
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 Supervisor ¶ added in v1.12.2
type Supervisor interface { LocalUnsafe(context.Context, eth.ChainID) (eth.BlockID, error) CrossSafe(context.Context, eth.ChainID) (supervisorTypes.DerivedIDPair, error) Finalized(context.Context, eth.ChainID) (eth.BlockID, error) FinalizedL1(context.Context) (eth.BlockRef, error) CrossDerivedToSource(context.Context, eth.ChainID, eth.BlockID) (eth.BlockRef, error) UpdateLocalUnsafe(context.Context, eth.ChainID, eth.BlockRef) error UpdateLocalSafe(context.Context, eth.ChainID, eth.L1BlockRef, eth.BlockRef) error SuperRootAtTimestamp(context.Context, hexutil.Uint64) (eth.SuperRootResponse, error) AllSafeDerivedAt(context.Context, eth.BlockID) (derived map[eth.ChainID]eth.BlockID, err error) SyncStatus(context.Context) (eth.SupervisorSyncStatus, error) }
Supervisor provides access to the query interface of the supervisor
type System ¶
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 AccessList() coreTypes.AccessList }
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
func (*TxOpts) AccessList ¶ added in v1.12.2
func (opts *TxOpts) AccessList() types.AccessList
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] InitiateMessage(chainID types.ChainID, target common.Address, message []byte) types.WriteInvocation[any] ExecuteMessage(identifier bindings.Identifier, sentMessage []byte) types.WriteInvocation[any] Balance() types.Balance Nonce() uint64 TransactionProcessor }
Wallet represents a chain wallet. In particular it can process transactions.