Documentation ¶
Overview ¶
Package aiop provides the base transaction object used throughout the aiops-bundler.
Index ¶
- Variables
- type AiOperation
- func (op *AiOperation) GetAiOpHash(aiMiddleware common.Address, chainID *big.Int) common.Hash
- func (op *AiOperation) GetDynamicGasPrice(basefee *big.Int) *big.Int
- func (op *AiOperation) GetFactory() common.Address
- func (op *AiOperation) GetFactoryData() []byte
- func (op *AiOperation) GetMaxGasAvailable() *big.Int
- func (op *AiOperation) GetMaxPrefund() *big.Int
- func (op *AiOperation) GetPaymaster() common.Address
- func (op *AiOperation) MarshalJSON() ([]byte, error)
- func (op *AiOperation) Pack() []byte
- func (op *AiOperation) PackForSignature() []byte
- func (op *AiOperation) ToMap() (map[string]any, error)
Constants ¶
This section is empty.
Variables ¶
var ( // AiOpPrimitives is the primitive ABI types for each AiOperation field. AiOpPrimitives = []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"}, } // AiOpType is the ABI type of a AiOperation. AiOpType, _ = abi.NewType("tuple", "op", AiOpPrimitives) // AiOpArr is the ABI type for an array of AiOperations. AiOpArr, _ = abi.NewType("tuple[]", "ops", AiOpPrimitives) )
var (
ErrBadAiOperationData = errors.New("cannot decode AiOperation")
)
Functions ¶
This section is empty.
Types ¶
type AiOperation ¶
type AiOperation 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"` PaymasterAndData []byte `json:"paymasterAndData" mapstructure:"paymasterAndData" validate:"required"` Signature []byte `json:"signature" mapstructure:"signature" validate:"required"` }
AiOperation represents an EIP-4337 style transaction for a smart contract account.
func New ¶
func New(data map[string]any) (*AiOperation, error)
New decodes a map into a AiOperation object and validates all the fields are correctly typed.
func (*AiOperation) GetAiOpHash ¶
GetAiOpHash returns the hash of the aiOp + aiMiddleware address + chainID.
func (*AiOperation) GetDynamicGasPrice ¶
func (op *AiOperation) GetDynamicGasPrice(basefee *big.Int) *big.Int
GetDynamicGasPrice returns the effective gas price paid by the AiOperation given a basefee. If basefee is nil, it will assume a value of 0.
func (*AiOperation) GetFactory ¶
func (op *AiOperation) GetFactory() common.Address
GetFactory returns the address portion of InitCode if applicable. Otherwise it returns the zero address.
func (*AiOperation) GetFactoryData ¶
func (op *AiOperation) GetFactoryData() []byte
GetFactoryData returns the data portion of InitCode if applicable. Otherwise it returns an empty byte array.
func (*AiOperation) GetMaxGasAvailable ¶
func (op *AiOperation) GetMaxGasAvailable() *big.Int
GetMaxGasAvailable returns the max amount of gas that can be consumed by this AiOperation.
func (*AiOperation) GetMaxPrefund ¶
func (op *AiOperation) GetMaxPrefund() *big.Int
GetMaxPrefund returns the max amount of wei required to pay for gas fees by either the sender or paymaster.
func (*AiOperation) GetPaymaster ¶
func (op *AiOperation) GetPaymaster() common.Address
GetPaymaster returns the address portion of PaymasterAndData if applicable. Otherwise it returns the zero address.
func (*AiOperation) MarshalJSON ¶
func (op *AiOperation) MarshalJSON() ([]byte, error)
MarshalJSON returns a JSON encoding of the AiOperation.
func (*AiOperation) Pack ¶
func (op *AiOperation) Pack() []byte
Pack returns a standard message of the aiOp. This cannot be used to generate a aiOpHash.
func (*AiOperation) PackForSignature ¶
func (op *AiOperation) PackForSignature() []byte
PackForSignature returns a minimal message of the aiOp. This can be used to generate a aiOpHash.