Documentation ¶
Overview ¶
Package userop provides the base transaction object used throughout the stackup-bundler.
Index ¶
- Variables
- type UserOperation
- func (op *UserOperation) GetFactory() common.Address
- func (op *UserOperation) GetMaxPrefund() *big.Int
- func (op *UserOperation) GetPaymaster() common.Address
- func (op *UserOperation) GetUserOpHash(entryPoint common.Address, chainID *big.Int) common.Hash
- func (op *UserOperation) MarshalJSON() ([]byte, error)
- func (op *UserOperation) Pack() []byte
- func (op *UserOperation) PackForSignature() []byte
- func (op *UserOperation) ToMap() (map[string]any, error)
Constants ¶
This section is empty.
Variables ¶
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 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"` PaymasterAndData []byte `json:"paymasterAndData" mapstructure:"paymasterAndData" validate:"required"` Signature []byte `json:"signature" mapstructure:"signature" validate:"required"` }
UserOperation represents an EIP-4337 style transaction for a smart contract account.
func New ¶
func New(data map[string]any) (*UserOperation, error)
New decodes a map into a UserOperation object and validates all the fields are correctly typed.
func (*UserOperation) GetFactory ¶ added in v0.1.1
func (op *UserOperation) GetFactory() common.Address
GetFactory returns the address portion of InitCode if applicable. Otherwise it returns the zero address.
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 ¶
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.