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
Constants ¶
This section is empty.
Variables ¶
var (
// UserOpType is the ABI type of a UserOperation.
UserOpType, _ = abi.NewType("tuple", "userOp", []abi.ArgumentMarshaling{
{Name: "Sender", Type: "address"},
{Name: "Nonce", Type: "uint256"},
{Name: "InitCode", Type: "bytes"},
{Name: "CallData", Type: "bytes"},
{Name: "CallGasLimit", Type: "uint256"},
{Name: "VerificationGasLimit", Type: "uint256"},
{Name: "PreVerificationGas", Type: "uint256"},
{Name: "MaxFeePerGas", Type: "uint256"},
{Name: "MaxPriorityFeePerGas", Type: "uint256"},
{Name: "PaymasterAndData", Type: "bytes"},
{Name: "Signature", Type: "bytes"},
})
)
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.