Documentation ¶
Overview ¶
Package userop provides the base transaction object used throughout the stackup-bundler.
Index ¶
- type UserOperation
- 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
Constants ¶
This section is empty.
Variables ¶
This section is empty.
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) 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.