aa

package
v0.0.0-...-828d3b4 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// UserOpPrimitives is the primitive ABI types for each UserOperation field.
	UserOpPrimitives = []abi.ArgumentMarshaling{
		{Name: "sender", InternalType: "Sender", Type: "address"},
		{Name: "nonce", InternalType: "Nonce", Type: "uint256"},
		{Name: "initCode", InternalType: "InitCode", Type: "bytes"},
		{Name: "callData", InternalType: "CallData", Type: "bytes"},
		{Name: "callGasLimit", InternalType: "CallGasLimit", Type: "uint256"},
		{Name: "verificationGasLimit", InternalType: "VerificationGasLimit", Type: "uint256"},
		{Name: "preVerificationGas", InternalType: "PreVerificationGas", Type: "uint256"},
		{Name: "maxFeePerGas", InternalType: "MaxFeePerGas", Type: "uint256"},
		{Name: "maxPriorityFeePerGas", InternalType: "MaxPriorityFeePerGas", Type: "uint256"},
		{Name: "paymasterAndData", InternalType: "PaymasterAndData", Type: "bytes"},
		{Name: "signature", InternalType: "Signature", Type: "bytes"},
	}

	// UserOpType is the ABI type of a UserOperation.
	UserOpType, _ = abi.NewType("tuple", "op", UserOpPrimitives)

	// UserOpArr is the ABI type for an array of UserOperations.
	UserOpArr, _ = abi.NewType("tuple[]", "ops", UserOpPrimitives)
)

Functions

This section is empty.

Types

type Log

type Log struct {
	Data                string   `json:"data"`
	Topics              []string `json:"topics"`
	Address             string   `json:"address"`
	Removed             bool     `json:"removed"`
	LogIndex            int64    `json:"logIndex"`
	BlockHash           string   `json:"blockHash"`
	BlockNumber         int64    `json:"blockNumber"`
	LogIndexRaw         string   `json:"logIndexRaw"`
	BlockNumberRaw      string   `json:"blockNumberRaw"`
	TransactionHash     string   `json:"transactionHash"`
	TransactionIndex    int64    `json:"transactionIndex"`
	TransactionIndexRaw string   `json:"transactionIndexRaw"`
}

type UserOperation

type UserOperation struct {
	Sender               common.Address `json:"sender"               mapstructure:"sender"               validate:"required"`
	Nonce                *big.Int       `json:"nonce"                mapstructure:"nonce"                validate:"required"`
	InitCode             []byte         `json:"initCode"             mapstructure:"initCode"             validate:"required"`
	CallData             []byte         `json:"callData"             mapstructure:"callData"             validate:"required"`
	CallGasLimit         *big.Int       `json:"callGasLimit"         mapstructure:"callGasLimit"         validate:"required"`
	VerificationGasLimit *big.Int       `json:"verificationGasLimit" mapstructure:"verificationGasLimit" validate:"required"`
	PreVerificationGas   *big.Int       `json:"preVerificationGas"   mapstructure:"preVerificationGas"   validate:"required"`
	MaxFeePerGas         *big.Int       `json:"maxFeePerGas"         mapstructure:"maxFeePerGas"         validate:"required"`
	MaxPriorityFeePerGas *big.Int       `json:"maxPriorityFeePerGas" mapstructure:"maxPriorityFeePerGas" validate:"required"`
	Paymaster            common.Address `json:"paymaster"            mapstructure:"paymaster"            validate:"required"`
	PaymasterAndData     []byte         `json:"paymasterAndData"     mapstructure:"paymasterAndData"     validate:"required"`
	UserOpHash           []byte         `json:"userOpHash"           mapstructure:"userOpHash"           validate:"required"`
	Signature            []byte         `json:"signature"            mapstructure:"signature"            validate:"required"`
}

UserOperation represents an EIP-4337 style transaction for a smart contract account.

func (*UserOperation) GetDynamicGasPrice

func (op *UserOperation) GetDynamicGasPrice(basefee *big.Int) *big.Int

GetDynamicGasPrice returns the effective gas price paid by the UserOperation given a basefee. If basefee is nil, it will assume a value of 0.

func (*UserOperation) GetFactory

func (op *UserOperation) GetFactory() common.Address

GetFactory returns the address portion of InitCode if applicable. Otherwise it returns the zero address.

func (*UserOperation) GetMaxGasAvailable

func (op *UserOperation) GetMaxGasAvailable() *big.Int

GetMaxGasAvailable returns the max amount of gas that can be consumed by this UserOperation.

func (*UserOperation) GetMaxPrefund

func (op *UserOperation) GetMaxPrefund() *big.Int

GetMaxPrefund returns the max amount of wei required to pay for gas fees by either the sender or paymaster.

func (*UserOperation) GetPaymaster

func (op *UserOperation) GetPaymaster() common.Address

GetPaymaster returns the address portion of PaymasterAndData if applicable. Otherwise it returns the zero address.

func (*UserOperation) GetUserOpHash

func (op *UserOperation) GetUserOpHash(entryPoint common.Address, chainID *big.Int) string

GetUserOpHash returns the hash of the userOp + entryPoint address + chainID.

func (*UserOperation) MarshalJSON

func (op *UserOperation) MarshalJSON() ([]byte, error)

MarshalJSON returns a JSON encoding of the UserOperation.

func (*UserOperation) Pack

func (op *UserOperation) Pack() []byte

Pack returns a standard message of the userOp. This cannot be used to generate a userOpHash.

func (*UserOperation) PackForSignature

func (op *UserOperation) PackForSignature() []byte

PackForSignature returns a minimal message of the userOp. This can be used to generate a userOpHash.

func (*UserOperation) ToMap

func (op *UserOperation) ToMap() (map[string]any, error)

ToMap returns the current UserOp struct as a map type.

type UserOperationV07

type UserOperationV07 struct {
	Sender             common.Address `json:"sender"               mapstructure:"sender"               validate:"required"`
	Nonce              *big.Int       `json:"nonce"                mapstructure:"nonce"                validate:"required"`
	InitCode           []byte         `json:"initCode"             mapstructure:"initCode"             validate:"required"`
	CallData           []byte         `json:"callData"             mapstructure:"callData"             validate:"required"`
	PreVerificationGas *big.Int       `json:"preVerificationGas"   mapstructure:"preVerificationGas"   validate:"required"`
	PaymasterAndData   []byte         `json:"paymasterAndData"     mapstructure:"paymasterAndData"     validate:"required"`
	Signature          []byte         `json:"signature"            mapstructure:"signature"            validate:"required"`
	GasFees            []byte         `json:"gasFees"              mapstructure:"gasFees"              validate:"required"`
	AccountGasLimits   []byte         `json:"accountGasLimits"     mapstructure:"accountGasLimits"     validate:"required"`
}

func (*UserOperationV07) UnpackAccountGasLimits

func (up *UserOperationV07) UnpackAccountGasLimits() (callGasLimit *big.Int, verificationGasLimit *big.Int)

func (*UserOperationV07) UnpackGasFees

func (up *UserOperationV07) UnpackGasFees() (maxFeePerGas *big.Int, maxPriorityFeePerGas *big.Int)

Jump to

Keyboard shortcuts

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