@owlprotocol/contracts-account-abstraction
Version:
ERC4337 Account Abstraction support for deploying relevant smart contracts and interacting with UserOps.
565 lines (564 loc) • 19.8 kB
JavaScript
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var IEntryPointSimulations_exports = {};
__export(IEntryPointSimulations_exports, {
AccountDeployed: () => AccountDeployed,
BeforeExecution: () => BeforeExecution,
DelegateAndRevert: () => DelegateAndRevert,
Deposited: () => Deposited,
FailedOp: () => FailedOp,
FailedOpWithRevert: () => FailedOpWithRevert,
IEntryPointSimulations: () => IEntryPointSimulations,
PostOpRevertReason: () => PostOpRevertReason,
PostOpReverted: () => PostOpReverted,
SenderAddressResult: () => SenderAddressResult,
SignatureAggregatorChanged: () => SignatureAggregatorChanged,
SignatureValidationFailed: () => SignatureValidationFailed,
StakeLocked: () => StakeLocked,
StakeUnlocked: () => StakeUnlocked,
StakeWithdrawn: () => StakeWithdrawn,
UserOperationEvent: () => UserOperationEvent,
UserOperationPrefundTooLow: () => UserOperationPrefundTooLow,
UserOperationRevertReason: () => UserOperationRevertReason,
Withdrawn: () => Withdrawn,
abi: () => abi,
addStake: () => addStake,
balanceOf: () => balanceOf,
delegateAndRevert: () => delegateAndRevert,
depositTo: () => depositTo,
errors: () => errors,
events: () => events,
functions: () => functions,
getDepositInfo: () => getDepositInfo,
getNonce: () => getNonce,
getSenderAddress: () => getSenderAddress,
getUserOpHash: () => getUserOpHash,
handleAggregatedOps: () => handleAggregatedOps,
handleOps: () => handleOps,
incrementNonce: () => incrementNonce,
simulateHandleOp: () => simulateHandleOp,
simulateValidation: () => simulateValidation,
unlockStake: () => unlockStake,
withdrawStake: () => withdrawStake,
withdrawTo: () => withdrawTo
});
module.exports = __toCommonJS(IEntryPointSimulations_exports);
const DelegateAndRevert = {
inputs: [
{ internalType: "bool", name: "success", type: "bool" },
{ internalType: "bytes", name: "ret", type: "bytes" }
],
name: "DelegateAndRevert",
type: "error"
};
const FailedOp = {
inputs: [
{ internalType: "uint256", name: "opIndex", type: "uint256" },
{ internalType: "string", name: "reason", type: "string" }
],
name: "FailedOp",
type: "error"
};
const FailedOpWithRevert = {
inputs: [
{ internalType: "uint256", name: "opIndex", type: "uint256" },
{ internalType: "string", name: "reason", type: "string" },
{ internalType: "bytes", name: "inner", type: "bytes" }
],
name: "FailedOpWithRevert",
type: "error"
};
const PostOpReverted = {
inputs: [{ internalType: "bytes", name: "returnData", type: "bytes" }],
name: "PostOpReverted",
type: "error"
};
const SenderAddressResult = {
inputs: [{ internalType: "address", name: "sender", type: "address" }],
name: "SenderAddressResult",
type: "error"
};
const SignatureValidationFailed = {
inputs: [{ internalType: "address", name: "aggregator", type: "address" }],
name: "SignatureValidationFailed",
type: "error"
};
const AccountDeployed = {
anonymous: false,
inputs: [
{ indexed: true, internalType: "bytes32", name: "userOpHash", type: "bytes32" },
{ indexed: true, internalType: "address", name: "sender", type: "address" },
{ indexed: false, internalType: "address", name: "factory", type: "address" },
{ indexed: false, internalType: "address", name: "paymaster", type: "address" }
],
name: "AccountDeployed",
type: "event"
};
const BeforeExecution = { anonymous: false, inputs: [], name: "BeforeExecution", type: "event" };
const Deposited = {
anonymous: false,
inputs: [
{ indexed: true, internalType: "address", name: "account", type: "address" },
{ indexed: false, internalType: "uint256", name: "totalDeposit", type: "uint256" }
],
name: "Deposited",
type: "event"
};
const PostOpRevertReason = {
anonymous: false,
inputs: [
{ indexed: true, internalType: "bytes32", name: "userOpHash", type: "bytes32" },
{ indexed: true, internalType: "address", name: "sender", type: "address" },
{ indexed: false, internalType: "uint256", name: "nonce", type: "uint256" },
{ indexed: false, internalType: "bytes", name: "revertReason", type: "bytes" }
],
name: "PostOpRevertReason",
type: "event"
};
const SignatureAggregatorChanged = {
anonymous: false,
inputs: [{ indexed: true, internalType: "address", name: "aggregator", type: "address" }],
name: "SignatureAggregatorChanged",
type: "event"
};
const StakeLocked = {
anonymous: false,
inputs: [
{ indexed: true, internalType: "address", name: "account", type: "address" },
{ indexed: false, internalType: "uint256", name: "totalStaked", type: "uint256" },
{ indexed: false, internalType: "uint256", name: "unstakeDelaySec", type: "uint256" }
],
name: "StakeLocked",
type: "event"
};
const StakeUnlocked = {
anonymous: false,
inputs: [
{ indexed: true, internalType: "address", name: "account", type: "address" },
{ indexed: false, internalType: "uint256", name: "withdrawTime", type: "uint256" }
],
name: "StakeUnlocked",
type: "event"
};
const StakeWithdrawn = {
anonymous: false,
inputs: [
{ indexed: true, internalType: "address", name: "account", type: "address" },
{ indexed: false, internalType: "address", name: "withdrawAddress", type: "address" },
{ indexed: false, internalType: "uint256", name: "amount", type: "uint256" }
],
name: "StakeWithdrawn",
type: "event"
};
const UserOperationEvent = {
anonymous: false,
inputs: [
{ indexed: true, internalType: "bytes32", name: "userOpHash", type: "bytes32" },
{ indexed: true, internalType: "address", name: "sender", type: "address" },
{ indexed: true, internalType: "address", name: "paymaster", type: "address" },
{ indexed: false, internalType: "uint256", name: "nonce", type: "uint256" },
{ indexed: false, internalType: "bool", name: "success", type: "bool" },
{ indexed: false, internalType: "uint256", name: "actualGasCost", type: "uint256" },
{ indexed: false, internalType: "uint256", name: "actualGasUsed", type: "uint256" }
],
name: "UserOperationEvent",
type: "event"
};
const UserOperationPrefundTooLow = {
anonymous: false,
inputs: [
{ indexed: true, internalType: "bytes32", name: "userOpHash", type: "bytes32" },
{ indexed: true, internalType: "address", name: "sender", type: "address" },
{ indexed: false, internalType: "uint256", name: "nonce", type: "uint256" }
],
name: "UserOperationPrefundTooLow",
type: "event"
};
const UserOperationRevertReason = {
anonymous: false,
inputs: [
{ indexed: true, internalType: "bytes32", name: "userOpHash", type: "bytes32" },
{ indexed: true, internalType: "address", name: "sender", type: "address" },
{ indexed: false, internalType: "uint256", name: "nonce", type: "uint256" },
{ indexed: false, internalType: "bytes", name: "revertReason", type: "bytes" }
],
name: "UserOperationRevertReason",
type: "event"
};
const Withdrawn = {
anonymous: false,
inputs: [
{ indexed: true, internalType: "address", name: "account", type: "address" },
{ indexed: false, internalType: "address", name: "withdrawAddress", type: "address" },
{ indexed: false, internalType: "uint256", name: "amount", type: "uint256" }
],
name: "Withdrawn",
type: "event"
};
const addStake = {
inputs: [{ internalType: "uint32", name: "_unstakeDelaySec", type: "uint32" }],
name: "addStake",
outputs: [],
stateMutability: "payable",
type: "function"
};
const balanceOf = {
inputs: [{ internalType: "address", name: "account", type: "address" }],
name: "balanceOf",
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
stateMutability: "view",
type: "function"
};
const delegateAndRevert = {
inputs: [
{ internalType: "address", name: "target", type: "address" },
{ internalType: "bytes", name: "data", type: "bytes" }
],
name: "delegateAndRevert",
outputs: [],
stateMutability: "nonpayable",
type: "function"
};
const depositTo = {
inputs: [{ internalType: "address", name: "account", type: "address" }],
name: "depositTo",
outputs: [],
stateMutability: "payable",
type: "function"
};
const getDepositInfo = {
inputs: [{ internalType: "address", name: "account", type: "address" }],
name: "getDepositInfo",
outputs: [
{
components: [
{ internalType: "uint256", name: "deposit", type: "uint256" },
{ internalType: "bool", name: "staked", type: "bool" },
{ internalType: "uint112", name: "stake", type: "uint112" },
{ internalType: "uint32", name: "unstakeDelaySec", type: "uint32" },
{ internalType: "uint48", name: "withdrawTime", type: "uint48" }
],
internalType: "struct IStakeManager.DepositInfo",
name: "info",
type: "tuple"
}
],
stateMutability: "view",
type: "function"
};
const getNonce = {
inputs: [
{ internalType: "address", name: "sender", type: "address" },
{ internalType: "uint192", name: "key", type: "uint192" }
],
name: "getNonce",
outputs: [{ internalType: "uint256", name: "nonce", type: "uint256" }],
stateMutability: "view",
type: "function"
};
const getSenderAddress = {
inputs: [{ internalType: "bytes", name: "initCode", type: "bytes" }],
name: "getSenderAddress",
outputs: [],
stateMutability: "nonpayable",
type: "function"
};
const getUserOpHash = {
inputs: [
{
components: [
{ internalType: "address", name: "sender", type: "address" },
{ internalType: "uint256", name: "nonce", type: "uint256" },
{ internalType: "bytes", name: "initCode", type: "bytes" },
{ internalType: "bytes", name: "callData", type: "bytes" },
{ internalType: "bytes32", name: "accountGasLimits", type: "bytes32" },
{ internalType: "uint256", name: "preVerificationGas", type: "uint256" },
{ internalType: "bytes32", name: "gasFees", type: "bytes32" },
{ internalType: "bytes", name: "paymasterAndData", type: "bytes" },
{ internalType: "bytes", name: "signature", type: "bytes" }
],
internalType: "struct PackedUserOperation",
name: "userOp",
type: "tuple"
}
],
name: "getUserOpHash",
outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
stateMutability: "view",
type: "function"
};
const handleAggregatedOps = {
inputs: [
{
components: [
{
components: [
{ internalType: "address", name: "sender", type: "address" },
{ internalType: "uint256", name: "nonce", type: "uint256" },
{ internalType: "bytes", name: "initCode", type: "bytes" },
{ internalType: "bytes", name: "callData", type: "bytes" },
{ internalType: "bytes32", name: "accountGasLimits", type: "bytes32" },
{ internalType: "uint256", name: "preVerificationGas", type: "uint256" },
{ internalType: "bytes32", name: "gasFees", type: "bytes32" },
{ internalType: "bytes", name: "paymasterAndData", type: "bytes" },
{ internalType: "bytes", name: "signature", type: "bytes" }
],
internalType: "struct PackedUserOperation[]",
name: "userOps",
type: "tuple[]"
},
{ internalType: "contract IAggregator", name: "aggregator", type: "address" },
{ internalType: "bytes", name: "signature", type: "bytes" }
],
internalType: "struct IEntryPoint.UserOpsPerAggregator[]",
name: "opsPerAggregator",
type: "tuple[]"
},
{ internalType: "address payable", name: "beneficiary", type: "address" }
],
name: "handleAggregatedOps",
outputs: [],
stateMutability: "nonpayable",
type: "function"
};
const handleOps = {
inputs: [
{
components: [
{ internalType: "address", name: "sender", type: "address" },
{ internalType: "uint256", name: "nonce", type: "uint256" },
{ internalType: "bytes", name: "initCode", type: "bytes" },
{ internalType: "bytes", name: "callData", type: "bytes" },
{ internalType: "bytes32", name: "accountGasLimits", type: "bytes32" },
{ internalType: "uint256", name: "preVerificationGas", type: "uint256" },
{ internalType: "bytes32", name: "gasFees", type: "bytes32" },
{ internalType: "bytes", name: "paymasterAndData", type: "bytes" },
{ internalType: "bytes", name: "signature", type: "bytes" }
],
internalType: "struct PackedUserOperation[]",
name: "ops",
type: "tuple[]"
},
{ internalType: "address payable", name: "beneficiary", type: "address" }
],
name: "handleOps",
outputs: [],
stateMutability: "nonpayable",
type: "function"
};
const incrementNonce = {
inputs: [{ internalType: "uint192", name: "key", type: "uint192" }],
name: "incrementNonce",
outputs: [],
stateMutability: "nonpayable",
type: "function"
};
const simulateHandleOp = {
inputs: [
{
components: [
{ internalType: "address", name: "sender", type: "address" },
{ internalType: "uint256", name: "nonce", type: "uint256" },
{ internalType: "bytes", name: "initCode", type: "bytes" },
{ internalType: "bytes", name: "callData", type: "bytes" },
{ internalType: "bytes32", name: "accountGasLimits", type: "bytes32" },
{ internalType: "uint256", name: "preVerificationGas", type: "uint256" },
{ internalType: "bytes32", name: "gasFees", type: "bytes32" },
{ internalType: "bytes", name: "paymasterAndData", type: "bytes" },
{ internalType: "bytes", name: "signature", type: "bytes" }
],
internalType: "struct PackedUserOperation",
name: "op",
type: "tuple"
}
],
name: "simulateHandleOp",
outputs: [
{
components: [
{ internalType: "uint256", name: "preOpGas", type: "uint256" },
{ internalType: "uint256", name: "paid", type: "uint256" },
{ internalType: "uint256", name: "accountValidationData", type: "uint256" },
{ internalType: "uint256", name: "paymasterValidationData", type: "uint256" },
{ internalType: "bool", name: "targetSuccess", type: "bool" },
{ internalType: "bytes", name: "targetResult", type: "bytes" }
],
internalType: "struct IEntryPointSimulations.ExecutionResult",
name: "",
type: "tuple"
}
],
stateMutability: "nonpayable",
type: "function"
};
const simulateValidation = {
inputs: [
{
components: [
{ internalType: "address", name: "sender", type: "address" },
{ internalType: "uint256", name: "nonce", type: "uint256" },
{ internalType: "bytes", name: "initCode", type: "bytes" },
{ internalType: "bytes", name: "callData", type: "bytes" },
{ internalType: "bytes32", name: "accountGasLimits", type: "bytes32" },
{ internalType: "uint256", name: "preVerificationGas", type: "uint256" },
{ internalType: "bytes32", name: "gasFees", type: "bytes32" },
{ internalType: "bytes", name: "paymasterAndData", type: "bytes" },
{ internalType: "bytes", name: "signature", type: "bytes" }
],
internalType: "struct PackedUserOperation",
name: "userOp",
type: "tuple"
}
],
name: "simulateValidation",
outputs: [
{
components: [
{
components: [
{ internalType: "uint256", name: "preOpGas", type: "uint256" },
{ internalType: "uint256", name: "prefund", type: "uint256" },
{ internalType: "uint256", name: "accountValidationData", type: "uint256" },
{ internalType: "uint256", name: "paymasterValidationData", type: "uint256" },
{ internalType: "bytes", name: "paymasterContext", type: "bytes" }
],
internalType: "struct IEntryPoint.ReturnInfo",
name: "returnInfo",
type: "tuple"
},
{
components: [
{ internalType: "uint256", name: "stake", type: "uint256" },
{ internalType: "uint256", name: "unstakeDelaySec", type: "uint256" }
],
internalType: "struct IStakeManager.StakeInfo",
name: "senderInfo",
type: "tuple"
},
{
components: [
{ internalType: "uint256", name: "stake", type: "uint256" },
{ internalType: "uint256", name: "unstakeDelaySec", type: "uint256" }
],
internalType: "struct IStakeManager.StakeInfo",
name: "factoryInfo",
type: "tuple"
},
{
components: [
{ internalType: "uint256", name: "stake", type: "uint256" },
{ internalType: "uint256", name: "unstakeDelaySec", type: "uint256" }
],
internalType: "struct IStakeManager.StakeInfo",
name: "paymasterInfo",
type: "tuple"
},
{
components: [
{ internalType: "address", name: "aggregator", type: "address" },
{
components: [
{ internalType: "uint256", name: "stake", type: "uint256" },
{ internalType: "uint256", name: "unstakeDelaySec", type: "uint256" }
],
internalType: "struct IStakeManager.StakeInfo",
name: "stakeInfo",
type: "tuple"
}
],
internalType: "struct IEntryPoint.AggregatorStakeInfo",
name: "aggregatorInfo",
type: "tuple"
}
],
internalType: "struct IEntryPointSimulations.ValidationResult",
name: "",
type: "tuple"
}
],
stateMutability: "nonpayable",
type: "function"
};
const unlockStake = {
inputs: [],
name: "unlockStake",
outputs: [],
stateMutability: "nonpayable",
type: "function"
};
const withdrawStake = {
inputs: [{ internalType: "address payable", name: "withdrawAddress", type: "address" }],
name: "withdrawStake",
outputs: [],
stateMutability: "nonpayable",
type: "function"
};
const withdrawTo = {
inputs: [
{ internalType: "address payable", name: "withdrawAddress", type: "address" },
{ internalType: "uint256", name: "withdrawAmount", type: "uint256" }
],
name: "withdrawTo",
outputs: [],
stateMutability: "nonpayable",
type: "function"
};
const functions = [
addStake,
balanceOf,
delegateAndRevert,
depositTo,
getDepositInfo,
getNonce,
getSenderAddress,
getUserOpHash,
handleAggregatedOps,
handleOps,
incrementNonce,
simulateHandleOp,
simulateValidation,
unlockStake,
withdrawStake,
withdrawTo
];
const events = [
AccountDeployed,
BeforeExecution,
Deposited,
PostOpRevertReason,
SignatureAggregatorChanged,
StakeLocked,
StakeUnlocked,
StakeWithdrawn,
UserOperationEvent,
UserOperationPrefundTooLow,
UserOperationRevertReason,
Withdrawn
];
const errors = [
DelegateAndRevert,
FailedOp,
FailedOpWithRevert,
PostOpReverted,
SenderAddressResult,
SignatureValidationFailed
];
const abi = [...functions, ...events, ...errors];
const IEntryPointSimulations = {
abi
};