etherman

package
v0.1.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 12, 2024 License: AGPL-3.0, AGPL-3.0-or-later Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HashLength  = 32
	ProofLength = 24
)

Variables

View Source
var (
	// ErrGasRequiredExceedsAllowance gas required exceeds the allowance
	ErrGasRequiredExceedsAllowance = errors.New("gas required exceeds allowance")
	// ErrContentLengthTooLarge content length is too large
	ErrContentLengthTooLarge = errors.New("content length too large")
	//ErrTimestampMustBeInsideRange Timestamp must be inside range
	ErrTimestampMustBeInsideRange = errors.New("timestamp must be inside range")
	//ErrInsufficientAllowance insufficient allowance
	ErrInsufficientAllowance = errors.New("insufficient allowance")
	// ErrBothGasPriceAndMaxFeeGasAreSpecified both gasPrice and (maxFeePerGas or maxPriorityFeePerGas) specified
	ErrBothGasPriceAndMaxFeeGasAreSpecified = errors.New("both gasPrice and (maxFeePerGas or maxPriorityFeePerGas) specified")
	// ErrMaxFeeGasAreSpecifiedButLondonNotActive maxFeePerGas or maxPriorityFeePerGas specified but london is not active yet
	ErrMaxFeeGasAreSpecifiedButLondonNotActive = errors.New("maxFeePerGas or maxPriorityFeePerGas specified but london is not active yet")
	// ErrNoSigner no signer to authorize the transaction with
	ErrNoSigner = errors.New("no signer to authorize the transaction with")
	// ErrMissingTrieNode means that a node is missing on the trie
	ErrMissingTrieNode = errors.New("missing trie node")
)

Functions

This section is empty.

Types

type Etherman

type Etherman struct {
	// contains filtered or unexported fields
}

func New

func New(ethClient IEthereumClient, auth bind.TransactOpts, cfg *config.Config) (Etherman, error)

func (*Etherman) BuildTrustedVerifyBatchesTxData

func (e *Etherman) BuildTrustedVerifyBatchesTxData(
	lastVerifiedBatch,
	newVerifiedBatch uint64,
	proof tx.ZKP,
	rollupId uint32,
) (data []byte, err error)

func (*Etherman) CallContract

func (e *Etherman) CallContract(ctx context.Context, call ethereum.CallMsg, blockNumber *big.Int) ([]byte, error)

func (*Etherman) CheckTxWasMined

func (e *Etherman) CheckTxWasMined(ctx context.Context, txHash common.Hash) (bool, *types.Receipt, error)

CheckTxWasMined check if a tx was already mined

func (*Etherman) CurrentNonce

func (e *Etherman) CurrentNonce(ctx context.Context, account common.Address) (uint64, error)

CurrentNonce returns the current nonce for the provided account

func (*Etherman) EstimateGas

func (e *Etherman) EstimateGas(ctx context.Context, from common.Address, to *common.Address, value *big.Int, data []byte) (uint64, error)

EstimateGas returns the estimated gas for the tx

func (*Etherman) GetLastBlock

func (e *Etherman) GetLastBlock(ctx context.Context, dbTx pgx.Tx) (*state.Block, error)

func (*Etherman) GetRevertMessage

func (e *Etherman) GetRevertMessage(ctx context.Context, tx *types.Transaction) (string, error)

GetRevertMessage tries to get a revert message of a transaction

func (*Etherman) GetSequencerAddr

func (e *Etherman) GetSequencerAddr(rollupId uint32) (common.Address, error)

func (*Etherman) GetTx

func (e *Etherman) GetTx(ctx context.Context, txHash common.Hash) (*types.Transaction, bool, error)

GetTx function get ethereum tx

func (*Etherman) GetTxReceipt

func (e *Etherman) GetTxReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error)

GetTxReceipt function gets ethereum tx receipt

func (*Etherman) PendingNonce added in v0.1.0

func (e *Etherman) PendingNonce(ctx context.Context, account common.Address) (uint64, error)

PendingNonce returns the pending nonce for the provided account

func (*Etherman) SendTx

func (e *Etherman) SendTx(ctx context.Context, tx *types.Transaction) error

SendTx sends a tx to L1

func (*Etherman) SignTx

func (e *Etherman) SignTx(ctx context.Context, sender common.Address, tx *types.Transaction) (*types.Transaction, error)

SignTx tries to sign a transaction accordingly to the provided sender

func (*Etherman) SuggestedGasPrice

func (e *Etherman) SuggestedGasPrice(ctx context.Context) (*big.Int, error)

SuggestedGasPrice returns the suggest nonce for the network at the moment

func (*Etherman) WaitTxToBeMined

func (e *Etherman) WaitTxToBeMined(ctx context.Context, tx *types.Transaction, timeout time.Duration) (bool, error)

WaitTxToBeMined waits for an L1 tx to be mined. It will return error if the tx is reverted or timeout is exceeded

type IEthereumClient

type IEthereumClient interface {
	ethereum.ChainReader
	ethereum.ChainStateReader
	ethereum.ContractCaller
	ethereum.GasEstimator
	ethereum.GasPricer
	ethereum.LogFilterer
	ethereum.TransactionReader
	ethereum.TransactionSender

	bind.ContractTransactor
	bind.ContractFilterer
	bind.DeployBackend
}

type Proof

type Proof [ProofLength][HashLength]byte

func BytesToProof

func BytesToProof(data []byte) (Proof, error)

func ConvertProof

func ConvertProof(p string) (Proof, error)

func (Proof) Equals

func (p Proof) Equals(other Proof) bool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL