fees

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2024 License: MPL-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FeeHistory

type FeeHistory struct {
	BaseFeePerGas []string `json:"baseFeePerGas"`
}

type FeeManager

type FeeManager struct {
	RPCClient *rpc.Client
}

func (*FeeManager) GetL1Fee

func (f *FeeManager) GetL1Fee(ctx context.Context, chainID uint64, input []byte) (uint64, error)

Returns L1 fee for placing a transaction to L1 chain, appicable only for txs made from L2.

func (*FeeManager) SuggestedFees

func (f *FeeManager) SuggestedFees(ctx context.Context, chainID uint64) (*SuggestedFees, error)

func (*FeeManager) SuggestedFeesGwei

func (f *FeeManager) SuggestedFeesGwei(ctx context.Context, chainID uint64) (*SuggestedFeesGwei, error)

func (*FeeManager) TransactionEstimatedTime

func (f *FeeManager) TransactionEstimatedTime(ctx context.Context, chainID uint64, maxFeePerGas *big.Int) TransactionEstimation

type GasFeeMode

type GasFeeMode int
const (
	GasFeeLow GasFeeMode = iota
	GasFeeMedium
	GasFeeHigh
)

type MaxFeesLevels

type MaxFeesLevels struct {
	Low    *hexutil.Big `json:"low"`
	Medium *hexutil.Big `json:"medium"`
	High   *hexutil.Big `json:"high"`
}

func (*MaxFeesLevels) FeeFor

func (m *MaxFeesLevels) FeeFor(mode GasFeeMode) *big.Int

type SuggestedFees

type SuggestedFees struct {
	GasPrice             *big.Int       `json:"gasPrice"`
	BaseFee              *big.Int       `json:"baseFee"`
	MaxFeesLevels        *MaxFeesLevels `json:"maxFeesLevels"`
	MaxPriorityFeePerGas *big.Int       `json:"maxPriorityFeePerGas"`
	L1GasFee             *big.Float     `json:"l1GasFee,omitempty"`
	EIP1559Enabled       bool           `json:"eip1559Enabled"`
}

func (*SuggestedFees) FeeFor

func (s *SuggestedFees) FeeFor(mode GasFeeMode) *big.Int

type SuggestedFeesGwei

type SuggestedFeesGwei struct {
	GasPrice             *big.Float `json:"gasPrice"`
	BaseFee              *big.Float `json:"baseFee"`
	MaxPriorityFeePerGas *big.Float `json:"maxPriorityFeePerGas"`
	MaxFeePerGasLow      *big.Float `json:"maxFeePerGasLow"`
	MaxFeePerGasMedium   *big.Float `json:"maxFeePerGasMedium"`
	MaxFeePerGasHigh     *big.Float `json:"maxFeePerGasHigh"`
	L1GasFee             *big.Float `json:"l1GasFee,omitempty"`
	EIP1559Enabled       bool       `json:"eip1559Enabled"`
}

////////////////////////////////////////////////////////////////////////////// TODO: remove `SuggestedFeesGwei` struct once new router is in place //////////////////////////////////////////////////////////////////////////////

type TransactionEstimation

type TransactionEstimation int
const (
	Unknown TransactionEstimation = iota
	LessThanOneMinute
	LessThanThreeMinutes
	LessThanFiveMinutes
	MoreThanFiveMinutes
)

Jump to

Keyboard shortcuts

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