FRE-600: Fix code review blockers

- Consolidated duplicate UndoManagers to single instance
- Fixed connection promise to only resolve on 'connected' status
- Fixed WebSocketProvider import (WebsocketProvider)
- Added proper doc.destroy() cleanup
- Renamed isPresenceInitialized property to avoid conflict

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
2026-04-25 00:08:01 -04:00
parent 65b552bb08
commit 7c684a42cc
48450 changed files with 5679671 additions and 383 deletions

View File

@@ -0,0 +1,14 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createWebAuthnCredential = createWebAuthnCredential;
const PublicKey = require("ox/PublicKey");
const WebAuthnP256 = require("ox/WebAuthnP256");
async function createWebAuthnCredential(parameters) {
const credential = await WebAuthnP256.createCredential(parameters);
return {
id: credential.id,
publicKey: PublicKey.toHex(credential.publicKey, { includePrefix: false }),
raw: credential.raw,
};
}
//# sourceMappingURL=createWebAuthnCredential.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"createWebAuthnCredential.js","sourceRoot":"","sources":["../../../account-abstraction/accounts/createWebAuthnCredential.ts"],"names":[],"mappings":";;AAiBA,4DASC;AAzBD,0CAAyC;AACzC,gDAA+C;AAexC,KAAK,UAAU,wBAAwB,CAC5C,UAA8C;IAE9C,MAAM,UAAU,GAAG,MAAM,YAAY,CAAC,gBAAgB,CAAC,UAAU,CAAC,CAAA;IAClE,OAAO;QACL,EAAE,EAAE,UAAU,CAAC,EAAE;QACjB,SAAS,EAAE,SAAS,CAAC,KAAK,CAAC,UAAU,CAAC,SAAS,EAAE,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC;QAC1E,GAAG,EAAE,UAAU,CAAC,GAAG;KACpB,CAAA;AACH,CAAC"}

View File

@@ -0,0 +1,730 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.toCoinbaseSmartAccount = toCoinbaseSmartAccount;
exports.signTypedData = signTypedData;
exports.sign = sign;
exports.toReplaySafeTypedData = toReplaySafeTypedData;
exports.toWebAuthnSignature = toWebAuthnSignature;
exports.wrapSignature = wrapSignature;
const Signature = require("ox/Signature");
const readContract_js_1 = require("../../../actions/public/readContract.js");
const base_js_1 = require("../../../errors/base.js");
const decodeFunctionData_js_1 = require("../../../utils/abi/decodeFunctionData.js");
const encodeAbiParameters_js_1 = require("../../../utils/abi/encodeAbiParameters.js");
const encodeFunctionData_js_1 = require("../../../utils/abi/encodeFunctionData.js");
const encodePacked_js_1 = require("../../../utils/abi/encodePacked.js");
const pad_js_1 = require("../../../utils/data/pad.js");
const size_js_1 = require("../../../utils/data/size.js");
const toHex_js_1 = require("../../../utils/encoding/toHex.js");
const hashMessage_js_1 = require("../../../utils/signature/hashMessage.js");
const hashTypedData_js_1 = require("../../../utils/signature/hashTypedData.js");
const parseSignature_js_1 = require("../../../utils/signature/parseSignature.js");
const abis_js_1 = require("../../constants/abis.js");
const address_js_1 = require("../../constants/address.js");
const getUserOperationHash_js_1 = require("../../utils/userOperation/getUserOperationHash.js");
const toSmartAccount_js_1 = require("../toSmartAccount.js");
const factoryAddress = {
'1.1': '0xba5ed110efdba3d005bfc882d75358acbbb85842',
'1': '0x0ba5ed0c6aa8c49038f819e587e2633c4a9f428a',
};
async function toCoinbaseSmartAccount(parameters) {
const { client, ownerIndex = 0, owners, nonce = 0n, version = '1', } = parameters;
let address = parameters.address;
const entryPoint = {
abi: abis_js_1.entryPoint06Abi,
address: address_js_1.entryPoint06Address,
version: '0.6',
};
const factory = {
abi: factoryAbi,
address: factoryAddress[version],
};
const owners_bytes = owners.map((owner) => {
if (typeof owner === 'string')
return (0, pad_js_1.pad)(owner);
if (owner.type === 'webAuthn')
return owner.publicKey;
if (owner.type === 'local')
return (0, pad_js_1.pad)(owner.address);
throw new base_js_1.BaseError('invalid owner type');
});
const owner = (() => {
const owner = owners[ownerIndex] ?? owners[0];
if (typeof owner === 'string')
return { address: owner, type: 'address' };
return owner;
})();
return (0, toSmartAccount_js_1.toSmartAccount)({
client,
entryPoint,
extend: { abi, factory },
async decodeCalls(data) {
const result = (0, decodeFunctionData_js_1.decodeFunctionData)({
abi,
data,
});
if (result.functionName === 'execute')
return [
{ to: result.args[0], value: result.args[1], data: result.args[2] },
];
if (result.functionName === 'executeBatch')
return result.args[0].map((arg) => ({
to: arg.target,
value: arg.value,
data: arg.data,
}));
throw new base_js_1.BaseError(`unable to decode calls for "${result.functionName}"`);
},
async encodeCalls(calls) {
if (calls.length === 1)
return (0, encodeFunctionData_js_1.encodeFunctionData)({
abi,
functionName: 'execute',
args: [calls[0].to, calls[0].value ?? 0n, calls[0].data ?? '0x'],
});
return (0, encodeFunctionData_js_1.encodeFunctionData)({
abi,
functionName: 'executeBatch',
args: [
calls.map((call) => ({
data: call.data ?? '0x',
target: call.to,
value: call.value ?? 0n,
})),
],
});
},
async getAddress() {
address ??= await (0, readContract_js_1.readContract)(client, {
...factory,
functionName: 'getAddress',
args: [owners_bytes, nonce],
});
return address;
},
async getFactoryArgs() {
const factoryData = (0, encodeFunctionData_js_1.encodeFunctionData)({
abi: factory.abi,
functionName: 'createAccount',
args: [owners_bytes, nonce],
});
return { factory: factory.address, factoryData };
},
async getStubSignature() {
if (owner.type === 'webAuthn')
return '0x0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000170000000000000000000000000000000000000000000000000000000000000001949fc7c88032b9fcb5f6efc7a7b8c63668eae9871b765e23123bb473ff57aa831a7c0d9276168ebcc29f2875a0239cffdf2a9cd1c2007c5c77c071db9264df1d000000000000000000000000000000000000000000000000000000000000002549960de5880e8c687434170f6476605b8fe4aeb9a28632c7995cf3ba831d97630500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008a7b2274797065223a22776562617574686e2e676574222c226368616c6c656e6765223a2273496a396e6164474850596759334b7156384f7a4a666c726275504b474f716d59576f4d57516869467773222c226f726967696e223a2268747470733a2f2f7369676e2e636f696e626173652e636f6d222c2263726f73734f726967696e223a66616c73657d00000000000000000000000000000000000000000000';
return wrapSignature({
ownerIndex,
signature: '0xfffffffffffffffffffffffffffffff0000000000000000000000000000000007aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1c',
});
},
async sign(parameters) {
const address = await this.getAddress();
const typedData = toReplaySafeTypedData({
address,
chainId: client.chain.id,
hash: parameters.hash,
});
if (owner.type === 'address')
throw new Error('owner cannot sign');
const signature = await signTypedData({ owner, typedData });
return wrapSignature({
ownerIndex,
signature,
});
},
async signMessage(parameters) {
const { message } = parameters;
const address = await this.getAddress();
const typedData = toReplaySafeTypedData({
address,
chainId: client.chain.id,
hash: (0, hashMessage_js_1.hashMessage)(message),
});
if (owner.type === 'address')
throw new Error('owner cannot sign');
const signature = await signTypedData({ owner, typedData });
return wrapSignature({
ownerIndex,
signature,
});
},
async signTypedData(parameters) {
const { domain, types, primaryType, message } = parameters;
const address = await this.getAddress();
const typedData = toReplaySafeTypedData({
address,
chainId: client.chain.id,
hash: (0, hashTypedData_js_1.hashTypedData)({
domain,
message,
primaryType,
types,
}),
});
if (owner.type === 'address')
throw new Error('owner cannot sign');
const signature = await signTypedData({ owner, typedData });
return wrapSignature({
ownerIndex,
signature,
});
},
async signUserOperation(parameters) {
const { chainId = client.chain.id, ...userOperation } = parameters;
const address = await this.getAddress();
const hash = (0, getUserOperationHash_js_1.getUserOperationHash)({
chainId,
entryPointAddress: entryPoint.address,
entryPointVersion: entryPoint.version,
userOperation: {
...userOperation,
sender: address,
},
});
if (owner.type === 'address')
throw new Error('owner cannot sign');
const signature = await sign({ hash, owner });
return wrapSignature({
ownerIndex,
signature,
});
},
userOperation: {
async estimateGas(userOperation) {
if (owner.type !== 'webAuthn')
return;
return {
verificationGasLimit: BigInt(Math.max(Number(userOperation.verificationGasLimit ?? 0n), 800_000)),
};
},
},
});
}
async function signTypedData({ typedData, owner, }) {
if (owner.type === 'local' && owner.signTypedData)
return owner.signTypedData(typedData);
const hash = (0, hashTypedData_js_1.hashTypedData)(typedData);
return sign({ hash, owner });
}
async function sign({ hash, owner, }) {
if (owner.type === 'webAuthn') {
const { signature, webauthn } = await owner.sign({
hash,
});
return toWebAuthnSignature({ signature, webauthn });
}
if (owner.sign)
return owner.sign({ hash });
throw new base_js_1.BaseError('`owner` does not support raw sign.');
}
function toReplaySafeTypedData({ address, chainId, hash, }) {
return {
domain: {
chainId,
name: 'Coinbase Smart Wallet',
verifyingContract: address,
version: '1',
},
types: {
CoinbaseSmartWalletMessage: [
{
name: 'hash',
type: 'bytes32',
},
],
},
primaryType: 'CoinbaseSmartWalletMessage',
message: {
hash,
},
};
}
function toWebAuthnSignature({ webauthn, signature, }) {
const { r, s } = Signature.fromHex(signature);
return (0, encodeAbiParameters_js_1.encodeAbiParameters)([
{
components: [
{
name: 'authenticatorData',
type: 'bytes',
},
{ name: 'clientDataJSON', type: 'bytes' },
{ name: 'challengeIndex', type: 'uint256' },
{ name: 'typeIndex', type: 'uint256' },
{
name: 'r',
type: 'uint256',
},
{
name: 's',
type: 'uint256',
},
],
type: 'tuple',
},
], [
{
authenticatorData: webauthn.authenticatorData,
clientDataJSON: (0, toHex_js_1.stringToHex)(webauthn.clientDataJSON),
challengeIndex: BigInt(webauthn.challengeIndex ?? 0n),
typeIndex: BigInt(webauthn.typeIndex ?? 0n),
r,
s,
},
]);
}
function wrapSignature(parameters) {
const { ownerIndex = 0 } = parameters;
const signatureData = (() => {
if ((0, size_js_1.size)(parameters.signature) !== 65)
return parameters.signature;
const signature = (0, parseSignature_js_1.parseSignature)(parameters.signature);
return (0, encodePacked_js_1.encodePacked)(['bytes32', 'bytes32', 'uint8'], [signature.r, signature.s, signature.yParity === 0 ? 27 : 28]);
})();
return (0, encodeAbiParameters_js_1.encodeAbiParameters)([
{
components: [
{
name: 'ownerIndex',
type: 'uint8',
},
{
name: 'signatureData',
type: 'bytes',
},
],
type: 'tuple',
},
], [
{
ownerIndex,
signatureData,
},
]);
}
const abi = [
{ inputs: [], stateMutability: 'nonpayable', type: 'constructor' },
{
inputs: [{ name: 'owner', type: 'bytes' }],
name: 'AlreadyOwner',
type: 'error',
},
{ inputs: [], name: 'Initialized', type: 'error' },
{
inputs: [{ name: 'owner', type: 'bytes' }],
name: 'InvalidEthereumAddressOwner',
type: 'error',
},
{
inputs: [{ name: 'key', type: 'uint256' }],
name: 'InvalidNonceKey',
type: 'error',
},
{
inputs: [{ name: 'owner', type: 'bytes' }],
name: 'InvalidOwnerBytesLength',
type: 'error',
},
{ inputs: [], name: 'LastOwner', type: 'error' },
{
inputs: [{ name: 'index', type: 'uint256' }],
name: 'NoOwnerAtIndex',
type: 'error',
},
{
inputs: [{ name: 'ownersRemaining', type: 'uint256' }],
name: 'NotLastOwner',
type: 'error',
},
{
inputs: [{ name: 'selector', type: 'bytes4' }],
name: 'SelectorNotAllowed',
type: 'error',
},
{ inputs: [], name: 'Unauthorized', type: 'error' },
{ inputs: [], name: 'UnauthorizedCallContext', type: 'error' },
{ inputs: [], name: 'UpgradeFailed', type: 'error' },
{
inputs: [
{ name: 'index', type: 'uint256' },
{ name: 'expectedOwner', type: 'bytes' },
{ name: 'actualOwner', type: 'bytes' },
],
name: 'WrongOwnerAtIndex',
type: 'error',
},
{
anonymous: false,
inputs: [
{
indexed: true,
name: 'index',
type: 'uint256',
},
{ indexed: false, name: 'owner', type: 'bytes' },
],
name: 'AddOwner',
type: 'event',
},
{
anonymous: false,
inputs: [
{
indexed: true,
name: 'index',
type: 'uint256',
},
{ indexed: false, name: 'owner', type: 'bytes' },
],
name: 'RemoveOwner',
type: 'event',
},
{
anonymous: false,
inputs: [
{
indexed: true,
name: 'implementation',
type: 'address',
},
],
name: 'Upgraded',
type: 'event',
},
{ stateMutability: 'payable', type: 'fallback' },
{
inputs: [],
name: 'REPLAYABLE_NONCE_KEY',
outputs: [{ name: '', type: 'uint256' }],
stateMutability: 'view',
type: 'function',
},
{
inputs: [{ name: 'owner', type: 'address' }],
name: 'addOwnerAddress',
outputs: [],
stateMutability: 'nonpayable',
type: 'function',
},
{
inputs: [
{ name: 'x', type: 'bytes32' },
{ name: 'y', type: 'bytes32' },
],
name: 'addOwnerPublicKey',
outputs: [],
stateMutability: 'nonpayable',
type: 'function',
},
{
inputs: [{ name: 'functionSelector', type: 'bytes4' }],
name: 'canSkipChainIdValidation',
outputs: [{ name: '', type: 'bool' }],
stateMutability: 'pure',
type: 'function',
},
{
inputs: [],
name: 'domainSeparator',
outputs: [{ name: '', type: 'bytes32' }],
stateMutability: 'view',
type: 'function',
},
{
inputs: [],
name: 'eip712Domain',
outputs: [
{ name: 'fields', type: 'bytes1' },
{ name: 'name', type: 'string' },
{ name: 'version', type: 'string' },
{ name: 'chainId', type: 'uint256' },
{ name: 'verifyingContract', type: 'address' },
{ name: 'salt', type: 'bytes32' },
{ name: 'extensions', type: 'uint256[]' },
],
stateMutability: 'view',
type: 'function',
},
{
inputs: [],
name: 'entryPoint',
outputs: [{ name: '', type: 'address' }],
stateMutability: 'view',
type: 'function',
},
{
inputs: [
{ name: 'target', type: 'address' },
{ name: 'value', type: 'uint256' },
{ name: 'data', type: 'bytes' },
],
name: 'execute',
outputs: [],
stateMutability: 'payable',
type: 'function',
},
{
inputs: [
{
components: [
{ name: 'target', type: 'address' },
{ name: 'value', type: 'uint256' },
{ name: 'data', type: 'bytes' },
],
name: 'calls',
type: 'tuple[]',
},
],
name: 'executeBatch',
outputs: [],
stateMutability: 'payable',
type: 'function',
},
{
inputs: [{ name: 'calls', type: 'bytes[]' }],
name: 'executeWithoutChainIdValidation',
outputs: [],
stateMutability: 'payable',
type: 'function',
},
{
inputs: [
{
components: [
{ 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' },
],
name: 'userOp',
type: 'tuple',
},
],
name: 'getUserOpHashWithoutChainId',
outputs: [{ name: '', type: 'bytes32' }],
stateMutability: 'view',
type: 'function',
},
{
inputs: [],
name: 'implementation',
outputs: [{ name: '$', type: 'address' }],
stateMutability: 'view',
type: 'function',
},
{
inputs: [{ name: 'owners', type: 'bytes[]' }],
name: 'initialize',
outputs: [],
stateMutability: 'payable',
type: 'function',
},
{
inputs: [{ name: 'account', type: 'address' }],
name: 'isOwnerAddress',
outputs: [{ name: '', type: 'bool' }],
stateMutability: 'view',
type: 'function',
},
{
inputs: [{ name: 'account', type: 'bytes' }],
name: 'isOwnerBytes',
outputs: [{ name: '', type: 'bool' }],
stateMutability: 'view',
type: 'function',
},
{
inputs: [
{ name: 'x', type: 'bytes32' },
{ name: 'y', type: 'bytes32' },
],
name: 'isOwnerPublicKey',
outputs: [{ name: '', type: 'bool' }],
stateMutability: 'view',
type: 'function',
},
{
inputs: [
{ name: 'hash', type: 'bytes32' },
{ name: 'signature', type: 'bytes' },
],
name: 'isValidSignature',
outputs: [{ name: 'result', type: 'bytes4' }],
stateMutability: 'view',
type: 'function',
},
{
inputs: [],
name: 'nextOwnerIndex',
outputs: [{ name: '', type: 'uint256' }],
stateMutability: 'view',
type: 'function',
},
{
inputs: [{ name: 'index', type: 'uint256' }],
name: 'ownerAtIndex',
outputs: [{ name: '', type: 'bytes' }],
stateMutability: 'view',
type: 'function',
},
{
inputs: [],
name: 'ownerCount',
outputs: [{ name: '', type: 'uint256' }],
stateMutability: 'view',
type: 'function',
},
{
inputs: [],
name: 'proxiableUUID',
outputs: [{ name: '', type: 'bytes32' }],
stateMutability: 'view',
type: 'function',
},
{
inputs: [
{ name: 'index', type: 'uint256' },
{ name: 'owner', type: 'bytes' },
],
name: 'removeLastOwner',
outputs: [],
stateMutability: 'nonpayable',
type: 'function',
},
{
inputs: [
{ name: 'index', type: 'uint256' },
{ name: 'owner', type: 'bytes' },
],
name: 'removeOwnerAtIndex',
outputs: [],
stateMutability: 'nonpayable',
type: 'function',
},
{
inputs: [],
name: 'removedOwnersCount',
outputs: [{ name: '', type: 'uint256' }],
stateMutability: 'view',
type: 'function',
},
{
inputs: [{ name: 'hash', type: 'bytes32' }],
name: 'replaySafeHash',
outputs: [{ name: '', type: 'bytes32' }],
stateMutability: 'view',
type: 'function',
},
{
inputs: [
{ name: 'newImplementation', type: 'address' },
{ name: 'data', type: 'bytes' },
],
name: 'upgradeToAndCall',
outputs: [],
stateMutability: 'payable',
type: 'function',
},
{
inputs: [
{
components: [
{ 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' },
],
name: 'userOp',
type: 'tuple',
},
{ name: 'userOpHash', type: 'bytes32' },
{ name: 'missingAccountFunds', type: 'uint256' },
],
name: 'validateUserOp',
outputs: [{ name: 'validationData', type: 'uint256' }],
stateMutability: 'nonpayable',
type: 'function',
},
{ stateMutability: 'payable', type: 'receive' },
];
const factoryAbi = [
{
inputs: [{ name: 'implementation_', type: 'address' }],
stateMutability: 'payable',
type: 'constructor',
},
{ inputs: [], name: 'OwnerRequired', type: 'error' },
{
inputs: [
{ name: 'owners', type: 'bytes[]' },
{ name: 'nonce', type: 'uint256' },
],
name: 'createAccount',
outputs: [
{
name: 'account',
type: 'address',
},
],
stateMutability: 'payable',
type: 'function',
},
{
inputs: [
{ name: 'owners', type: 'bytes[]' },
{ name: 'nonce', type: 'uint256' },
],
name: 'getAddress',
outputs: [{ name: '', type: 'address' }],
stateMutability: 'view',
type: 'function',
},
{
inputs: [],
name: 'implementation',
outputs: [{ name: '', type: 'address' }],
stateMutability: 'view',
type: 'function',
},
{
inputs: [],
name: 'initCodeHash',
outputs: [{ name: '', type: 'bytes32' }],
stateMutability: 'view',
type: 'function',
},
];
//# sourceMappingURL=toCoinbaseSmartAccount.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,274 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.toSimple7702SmartAccount = toSimple7702SmartAccount;
const base_js_1 = require("../../../errors/base.js");
const decodeFunctionData_js_1 = require("../../../utils/abi/decodeFunctionData.js");
const encodeFunctionData_js_1 = require("../../../utils/abi/encodeFunctionData.js");
const abis_js_1 = require("../../constants/abis.js");
const address_js_1 = require("../../constants/address.js");
const getUserOperationTypedData_js_1 = require("../../utils/userOperation/getUserOperationTypedData.js");
const toSmartAccount_js_1 = require("../toSmartAccount.js");
async function toSimple7702SmartAccount(parameters) {
const { client, getNonce, owner } = parameters;
const entryPoint = (() => {
if (parameters.entryPoint === '0.9')
return {
abi: abis_js_1.entryPoint09Abi,
address: address_js_1.entryPoint09Address,
version: '0.9',
};
if (typeof parameters.entryPoint === 'object')
return parameters.entryPoint;
return {
abi: abis_js_1.entryPoint08Abi,
address: address_js_1.entryPoint08Address,
version: '0.8',
};
})();
const implementation = (() => {
if (parameters.implementation)
return parameters.implementation;
if (parameters.entryPoint === '0.9')
return '0xa46cc63eBF4Bd77888AA327837d20b23A63a56B5';
return '0xe6Cae83BdE06E4c305530e199D7217f42808555B';
})();
return (0, toSmartAccount_js_1.toSmartAccount)({
authorization: { account: owner, address: implementation },
abi,
client,
extend: { abi, owner },
entryPoint,
getNonce,
async decodeCalls(data) {
const result = (0, decodeFunctionData_js_1.decodeFunctionData)({
abi,
data,
});
if (result.functionName === 'execute')
return [
{ to: result.args[0], value: result.args[1], data: result.args[2] },
];
if (result.functionName === 'executeBatch')
return result.args[0].map((arg) => ({
to: arg.target,
value: arg.value,
data: arg.data,
}));
throw new base_js_1.BaseError(`unable to decode calls for "${result.functionName}"`);
},
async encodeCalls(calls) {
if (calls.length === 1)
return (0, encodeFunctionData_js_1.encodeFunctionData)({
abi,
functionName: 'execute',
args: [calls[0].to, calls[0].value ?? 0n, calls[0].data ?? '0x'],
});
return (0, encodeFunctionData_js_1.encodeFunctionData)({
abi,
functionName: 'executeBatch',
args: [
calls.map((call) => ({
data: call.data ?? '0x',
target: call.to,
value: call.value ?? 0n,
})),
],
});
},
async getAddress() {
return owner.address;
},
async getFactoryArgs() {
return { factory: '0x7702', factoryData: '0x' };
},
async getStubSignature() {
return '0xfffffffffffffffffffffffffffffff0000000000000000000000000000000007aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1c';
},
async signMessage(parameters) {
const { message } = parameters;
return await owner.signMessage({ message });
},
async signTypedData(parameters) {
const { domain, types, primaryType, message } = parameters;
return await owner.signTypedData({
domain,
message,
primaryType,
types,
});
},
async signUserOperation(parameters) {
const { chainId = client.chain.id, ...userOperation } = parameters;
const address = await this.getAddress();
const typedData = (0, getUserOperationTypedData_js_1.getUserOperationTypedData)({
chainId,
entryPointAddress: entryPoint.address,
userOperation: {
...userOperation,
sender: address,
},
});
return await owner.signTypedData(typedData);
},
});
}
const abi = [
{ inputs: [], name: 'ECDSAInvalidSignature', type: 'error' },
{
inputs: [{ internalType: 'uint256', name: 'length', type: 'uint256' }],
name: 'ECDSAInvalidSignatureLength',
type: 'error',
},
{
inputs: [{ internalType: 'bytes32', name: 's', type: 'bytes32' }],
name: 'ECDSAInvalidSignatureS',
type: 'error',
},
{
inputs: [
{ internalType: 'uint256', name: 'index', type: 'uint256' },
{ internalType: 'bytes', name: 'error', type: 'bytes' },
],
name: 'ExecuteError',
type: 'error',
},
{ stateMutability: 'payable', type: 'fallback' },
{
inputs: [],
name: 'entryPoint',
outputs: [
{ internalType: 'contract IEntryPoint', name: '', type: 'address' },
],
stateMutability: 'pure',
type: 'function',
},
{
inputs: [
{ internalType: 'address', name: 'target', type: 'address' },
{ internalType: 'uint256', name: 'value', type: 'uint256' },
{ internalType: 'bytes', name: 'data', type: 'bytes' },
],
name: 'execute',
outputs: [],
stateMutability: 'nonpayable',
type: 'function',
},
{
inputs: [
{
components: [
{ internalType: 'address', name: 'target', type: 'address' },
{ internalType: 'uint256', name: 'value', type: 'uint256' },
{ internalType: 'bytes', name: 'data', type: 'bytes' },
],
internalType: 'struct BaseAccount.Call[]',
name: 'calls',
type: 'tuple[]',
},
],
name: 'executeBatch',
outputs: [],
stateMutability: 'nonpayable',
type: 'function',
},
{
inputs: [],
name: 'getNonce',
outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
stateMutability: 'view',
type: 'function',
},
{
inputs: [
{ internalType: 'bytes32', name: 'hash', type: 'bytes32' },
{ internalType: 'bytes', name: 'signature', type: 'bytes' },
],
name: 'isValidSignature',
outputs: [{ internalType: 'bytes4', name: 'magicValue', type: 'bytes4' }],
stateMutability: 'view',
type: 'function',
},
{
inputs: [
{ internalType: 'address', name: '', type: 'address' },
{ internalType: 'address', name: '', type: 'address' },
{ internalType: 'uint256[]', name: '', type: 'uint256[]' },
{ internalType: 'uint256[]', name: '', type: 'uint256[]' },
{ internalType: 'bytes', name: '', type: 'bytes' },
],
name: 'onERC1155BatchReceived',
outputs: [{ internalType: 'bytes4', name: '', type: 'bytes4' }],
stateMutability: 'nonpayable',
type: 'function',
},
{
inputs: [
{ internalType: 'address', name: '', type: 'address' },
{ internalType: 'address', name: '', type: 'address' },
{ internalType: 'uint256', name: '', type: 'uint256' },
{ internalType: 'uint256', name: '', type: 'uint256' },
{ internalType: 'bytes', name: '', type: 'bytes' },
],
name: 'onERC1155Received',
outputs: [{ internalType: 'bytes4', name: '', type: 'bytes4' }],
stateMutability: 'nonpayable',
type: 'function',
},
{
inputs: [
{ internalType: 'address', name: '', type: 'address' },
{ internalType: 'address', name: '', type: 'address' },
{ internalType: 'uint256', name: '', type: 'uint256' },
{ internalType: 'bytes', name: '', type: 'bytes' },
],
name: 'onERC721Received',
outputs: [{ internalType: 'bytes4', name: '', type: 'bytes4' }],
stateMutability: 'nonpayable',
type: 'function',
},
{
inputs: [{ internalType: 'bytes4', name: 'id', type: 'bytes4' }],
name: 'supportsInterface',
outputs: [{ internalType: 'bool', name: '', type: 'bool' }],
stateMutability: 'pure',
type: 'function',
},
{
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',
},
{ internalType: 'bytes32', name: 'userOpHash', type: 'bytes32' },
{ internalType: 'uint256', name: 'missingAccountFunds', type: 'uint256' },
],
name: 'validateUserOp',
outputs: [
{ internalType: 'uint256', name: 'validationData', type: 'uint256' },
],
stateMutability: 'nonpayable',
type: 'function',
},
{ stateMutability: 'payable', type: 'receive' },
];
//# sourceMappingURL=toSimple7702SmartAccount.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,703 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.toSoladySmartAccount = toSoladySmartAccount;
const parseAccount_js_1 = require("../../../accounts/utils/parseAccount.js");
const readContract_js_1 = require("../../../actions/public/readContract.js");
const signMessage_js_1 = require("../../../actions/wallet/signMessage.js");
const base_js_1 = require("../../../errors/base.js");
const signMessage_js_2 = require("../../../experimental/erc7739/actions/signMessage.js");
const signTypedData_js_1 = require("../../../experimental/erc7739/actions/signTypedData.js");
const decodeFunctionData_js_1 = require("../../../utils/abi/decodeFunctionData.js");
const encodeFunctionData_js_1 = require("../../../utils/abi/encodeFunctionData.js");
const pad_js_1 = require("../../../utils/data/pad.js");
const getAction_js_1 = require("../../../utils/getAction.js");
const abis_js_1 = require("../../constants/abis.js");
const address_js_1 = require("../../constants/address.js");
const getUserOperationHash_js_1 = require("../../utils/userOperation/getUserOperationHash.js");
const toSmartAccount_js_1 = require("../toSmartAccount.js");
async function toSoladySmartAccount(parameters) {
const { address, client, entryPoint: entryPoint_ = {
abi: abis_js_1.entryPoint07Abi,
address: address_js_1.entryPoint07Address,
version: '0.7',
}, factoryAddress = '0x5d82735936c6Cd5DE57cC3c1A799f6B2E6F933Df', getNonce, salt = '0x0', } = parameters;
const entryPoint = {
abi: entryPoint_.abi,
address: entryPoint_.address,
version: entryPoint_.version,
};
const factory = {
abi: factoryAbi,
address: factoryAddress,
};
const owner = (0, parseAccount_js_1.parseAccount)(parameters.owner);
return (0, toSmartAccount_js_1.toSmartAccount)({
client,
entryPoint,
getNonce,
extend: { abi, factory },
async decodeCalls(data) {
const result = (0, decodeFunctionData_js_1.decodeFunctionData)({
abi,
data,
});
if (result.functionName === 'execute')
return [
{ to: result.args[0], value: result.args[1], data: result.args[2] },
];
if (result.functionName === 'executeBatch')
return result.args[0].map((arg) => ({
to: arg.target,
value: arg.value,
data: arg.data,
}));
throw new base_js_1.BaseError(`unable to decode calls for "${result.functionName}"`);
},
async encodeCalls(calls) {
if (calls.length === 1)
return (0, encodeFunctionData_js_1.encodeFunctionData)({
abi,
functionName: 'execute',
args: [calls[0].to, calls[0].value ?? 0n, calls[0].data ?? '0x'],
});
return (0, encodeFunctionData_js_1.encodeFunctionData)({
abi,
functionName: 'executeBatch',
args: [
calls.map((call) => ({
data: call.data ?? '0x',
target: call.to,
value: call.value ?? 0n,
})),
],
});
},
async getAddress() {
if (address)
return address;
return await (0, readContract_js_1.readContract)(client, {
...factory,
functionName: 'getAddress',
args: [(0, pad_js_1.pad)(salt)],
});
},
async getFactoryArgs() {
const factoryData = (0, encodeFunctionData_js_1.encodeFunctionData)({
abi: factory.abi,
functionName: 'createAccount',
args: [owner.address, (0, pad_js_1.pad)(salt)],
});
return { factory: factory.address, factoryData };
},
async getStubSignature() {
return '0xfffffffffffffffffffffffffffffff0000000000000000000000000000000007aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1c';
},
async signMessage(parameters) {
const { message } = parameters;
const [address, { factory, factoryData }] = await Promise.all([
this.getAddress(),
this.getFactoryArgs(),
]);
return await (0, signMessage_js_2.signMessage)(client, {
account: owner,
factory,
factoryData,
message,
verifier: address,
});
},
async signTypedData(parameters) {
const { domain, types, primaryType, message } = parameters;
const [address, { factory, factoryData }] = await Promise.all([
this.getAddress(),
this.getFactoryArgs(),
]);
return await (0, signTypedData_js_1.signTypedData)(client, {
account: owner,
domain,
message,
factory,
factoryData,
primaryType,
types,
verifier: address,
});
},
async signUserOperation(parameters) {
const { chainId = client.chain.id, ...userOperation } = parameters;
const address = await this.getAddress();
const userOpHash = (0, getUserOperationHash_js_1.getUserOperationHash)({
chainId,
entryPointAddress: entryPoint.address,
entryPointVersion: entryPoint.version,
userOperation: {
...userOperation,
sender: address,
},
});
const signature = await (0, getAction_js_1.getAction)(client, signMessage_js_1.signMessage, 'signMessage')({
account: owner,
message: {
raw: userOpHash,
},
});
return signature;
},
});
}
const abi = [
{
type: 'fallback',
stateMutability: 'payable',
},
{
type: 'receive',
stateMutability: 'payable',
},
{
type: 'function',
name: 'addDeposit',
inputs: [],
outputs: [],
stateMutability: 'payable',
},
{
type: 'function',
name: 'cancelOwnershipHandover',
inputs: [],
outputs: [],
stateMutability: 'payable',
},
{
type: 'function',
name: 'completeOwnershipHandover',
inputs: [
{
name: 'pendingOwner',
type: 'address',
},
],
outputs: [],
stateMutability: 'payable',
},
{
type: 'function',
name: 'delegateExecute',
inputs: [
{
name: 'delegate',
type: 'address',
},
{
name: 'data',
type: 'bytes',
},
],
outputs: [
{
name: 'result',
type: 'bytes',
},
],
stateMutability: 'payable',
},
{
type: 'function',
name: 'eip712Domain',
inputs: [],
outputs: [
{
name: 'name',
type: 'string',
},
{
name: 'version',
type: 'string',
},
{
name: 'chainId',
type: 'uint256',
},
{
name: 'verifyingContract',
type: 'address',
},
{
name: 'salt',
type: 'bytes32',
},
],
stateMutability: 'view',
},
{
type: 'function',
name: 'entryPoint',
inputs: [],
outputs: [
{
name: '',
type: 'address',
},
],
stateMutability: 'view',
},
{
type: 'function',
name: 'execute',
inputs: [
{
name: 'target',
type: 'address',
},
{
name: 'value',
type: 'uint256',
},
{
name: 'data',
type: 'bytes',
},
],
outputs: [
{
name: 'result',
type: 'bytes',
},
],
stateMutability: 'payable',
},
{
type: 'function',
name: 'executeBatch',
inputs: [
{
name: 'calls',
type: 'tuple[]',
components: [
{
name: 'target',
type: 'address',
},
{
name: 'value',
type: 'uint256',
},
{
name: 'data',
type: 'bytes',
},
],
},
],
outputs: [
{
name: 'results',
type: 'bytes[]',
},
],
stateMutability: 'payable',
},
{
type: 'function',
name: 'getDeposit',
inputs: [],
outputs: [
{
name: 'result',
type: 'uint256',
},
],
stateMutability: 'view',
},
{
type: 'function',
name: 'initialize',
inputs: [
{
name: 'newOwner',
type: 'address',
},
],
outputs: [],
stateMutability: 'payable',
},
{
type: 'function',
name: 'isValidSignature',
inputs: [
{
name: 'hash',
type: 'bytes32',
},
{
name: 'signature',
type: 'bytes',
},
],
outputs: [
{
name: 'result',
type: 'bytes4',
},
],
stateMutability: 'view',
},
{
type: 'function',
name: 'owner',
inputs: [],
outputs: [
{
name: 'result',
type: 'address',
},
],
stateMutability: 'view',
},
{
type: 'function',
name: 'ownershipHandoverExpiresAt',
inputs: [
{
name: 'pendingOwner',
type: 'address',
},
],
outputs: [
{
name: 'result',
type: 'uint256',
},
],
stateMutability: 'view',
},
{
type: 'function',
name: 'proxiableUUID',
inputs: [],
outputs: [
{
name: '',
type: 'bytes32',
},
],
stateMutability: 'view',
},
{
type: 'function',
name: 'renounceOwnership',
inputs: [],
outputs: [],
stateMutability: 'payable',
},
{
type: 'function',
name: 'requestOwnershipHandover',
inputs: [],
outputs: [],
stateMutability: 'payable',
},
{
type: 'function',
name: 'storageLoad',
inputs: [
{
name: 'storageSlot',
type: 'bytes32',
},
],
outputs: [
{
name: 'result',
type: 'bytes32',
},
],
stateMutability: 'view',
},
{
type: 'function',
name: 'storageStore',
inputs: [
{
name: 'storageSlot',
type: 'bytes32',
},
{
name: 'storageValue',
type: 'bytes32',
},
],
outputs: [],
stateMutability: 'payable',
},
{
type: 'function',
name: 'transferOwnership',
inputs: [
{
name: 'newOwner',
type: 'address',
},
],
outputs: [],
stateMutability: 'payable',
},
{
type: 'function',
name: 'upgradeToAndCall',
inputs: [
{
name: 'newImplementation',
type: 'address',
},
{
name: 'data',
type: 'bytes',
},
],
outputs: [],
stateMutability: 'payable',
},
{
type: 'function',
name: 'validateUserOp',
inputs: [
{
name: 'userOp',
type: 'tuple',
components: [
{
name: 'sender',
type: 'address',
},
{
name: 'nonce',
type: 'uint256',
},
{
name: 'initCode',
type: 'bytes',
},
{
name: 'callData',
type: 'bytes',
},
{
name: 'accountGasLimits',
type: 'bytes32',
},
{
name: 'preVerificationGas',
type: 'uint256',
},
{
name: 'gasFees',
type: 'bytes32',
},
{
name: 'paymasterAndData',
type: 'bytes',
},
{
name: 'signature',
type: 'bytes',
},
],
},
{
name: 'userOpHash',
type: 'bytes32',
},
{
name: 'missingAccountFunds',
type: 'uint256',
},
],
outputs: [
{
name: 'validationData',
type: 'uint256',
},
],
stateMutability: 'payable',
},
{
type: 'function',
name: 'withdrawDepositTo',
inputs: [
{
name: 'to',
type: 'address',
},
{
name: 'amount',
type: 'uint256',
},
],
outputs: [],
stateMutability: 'payable',
},
{
type: 'event',
name: 'OwnershipHandoverCanceled',
inputs: [
{
name: 'pendingOwner',
type: 'address',
indexed: true,
},
],
anonymous: false,
},
{
type: 'event',
name: 'OwnershipHandoverRequested',
inputs: [
{
name: 'pendingOwner',
type: 'address',
indexed: true,
},
],
anonymous: false,
},
{
type: 'event',
name: 'OwnershipTransferred',
inputs: [
{
name: 'oldOwner',
type: 'address',
indexed: true,
},
{
name: 'newOwner',
type: 'address',
indexed: true,
},
],
anonymous: false,
},
{
type: 'event',
name: 'Upgraded',
inputs: [
{
name: 'implementation',
type: 'address',
indexed: true,
},
],
anonymous: false,
},
{
type: 'error',
name: 'AlreadyInitialized',
inputs: [],
},
{
type: 'error',
name: 'FnSelectorNotRecognized',
inputs: [],
},
{
type: 'error',
name: 'NewOwnerIsZeroAddress',
inputs: [],
},
{
type: 'error',
name: 'NoHandoverRequest',
inputs: [],
},
{
type: 'error',
name: 'Unauthorized',
inputs: [],
},
{
type: 'error',
name: 'UnauthorizedCallContext',
inputs: [],
},
{
type: 'error',
name: 'UpgradeFailed',
inputs: [],
},
];
const factoryAbi = [
{
type: 'constructor',
inputs: [
{
name: 'erc4337',
type: 'address',
},
],
stateMutability: 'nonpayable',
},
{
type: 'function',
name: 'createAccount',
inputs: [
{
name: 'owner',
type: 'address',
},
{
name: 'salt',
type: 'bytes32',
},
],
outputs: [
{
name: '',
type: 'address',
},
],
stateMutability: 'payable',
},
{
type: 'function',
name: 'getAddress',
inputs: [
{
name: 'salt',
type: 'bytes32',
},
],
outputs: [
{
name: '',
type: 'address',
},
],
stateMutability: 'view',
},
{
type: 'function',
name: 'implementation',
inputs: [],
outputs: [
{
name: '',
type: 'address',
},
],
stateMutability: 'view',
},
{
type: 'function',
name: 'initCodeHash',
inputs: [],
outputs: [
{
name: '',
type: 'bytes32',
},
],
stateMutability: 'view',
},
];
//# sourceMappingURL=toSoladySmartAccount.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,104 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.toSmartAccount = toSmartAccount;
const abitype_1 = require("abitype");
const getCode_js_1 = require("../../actions/public/getCode.js");
const readContract_js_1 = require("../../actions/public/readContract.js");
const getAction_js_1 = require("../../utils/getAction.js");
const nonceManager_js_1 = require("../../utils/nonceManager.js");
const serializeErc6492Signature_js_1 = require("../../utils/signature/serializeErc6492Signature.js");
async function toSmartAccount(implementation) {
const { extend, nonceKeyManager = (0, nonceManager_js_1.createNonceManager)({
source: {
get() {
return Date.now();
},
set() { },
},
}), ...rest } = implementation;
let deployed = false;
const address = await implementation.getAddress();
return {
...extend,
...rest,
address,
async getFactoryArgs() {
if ('isDeployed' in this && (await this.isDeployed()))
return { factory: undefined, factoryData: undefined };
return implementation.getFactoryArgs();
},
async getNonce(parameters) {
const key = parameters?.key ??
BigInt(await nonceKeyManager.consume({
address,
chainId: implementation.client.chain.id,
client: implementation.client,
}));
if (implementation.getNonce)
return await implementation.getNonce({ ...parameters, key });
const nonce = await (0, readContract_js_1.readContract)(implementation.client, {
abi: (0, abitype_1.parseAbi)([
'function getNonce(address, uint192) pure returns (uint256)',
]),
address: implementation.entryPoint.address,
functionName: 'getNonce',
args: [address, key],
});
return nonce;
},
async isDeployed() {
if (deployed)
return true;
const code = await (0, getAction_js_1.getAction)(implementation.client, getCode_js_1.getCode, 'getCode')({
address,
});
deployed = Boolean(code);
return deployed;
},
...(implementation.sign
? {
async sign(parameters) {
const [{ factory, factoryData }, signature] = await Promise.all([
this.getFactoryArgs(),
implementation.sign(parameters),
]);
if (factory && factoryData)
return (0, serializeErc6492Signature_js_1.serializeErc6492Signature)({
address: factory,
data: factoryData,
signature,
});
return signature;
},
}
: {}),
async signMessage(parameters) {
const [{ factory, factoryData }, signature] = await Promise.all([
this.getFactoryArgs(),
implementation.signMessage(parameters),
]);
if (factory && factoryData && factory !== '0x7702')
return (0, serializeErc6492Signature_js_1.serializeErc6492Signature)({
address: factory,
data: factoryData,
signature,
});
return signature;
},
async signTypedData(parameters) {
const [{ factory, factoryData }, signature] = await Promise.all([
this.getFactoryArgs(),
implementation.signTypedData(parameters),
]);
if (factory && factoryData && factory !== '0x7702')
return (0, serializeErc6492Signature_js_1.serializeErc6492Signature)({
address: factory,
data: factoryData,
signature,
});
return signature;
},
type: 'smart',
};
}
//# sourceMappingURL=toSmartAccount.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"toSmartAccount.js","sourceRoot":"","sources":["../../../account-abstraction/accounts/toSmartAccount.ts"],"names":[],"mappings":"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"}

View File

@@ -0,0 +1,36 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.toWebAuthnAccount = toWebAuthnAccount;
const Signature = require("ox/Signature");
const WebAuthnP256 = require("ox/WebAuthnP256");
const hashMessage_js_1 = require("../../utils/signature/hashMessage.js");
const hashTypedData_js_1 = require("../../utils/signature/hashTypedData.js");
function toWebAuthnAccount(parameters) {
const { getFn, rpId } = parameters;
const { id, publicKey } = parameters.credential;
return {
id,
publicKey,
async sign({ hash }) {
const { metadata, raw, signature } = await WebAuthnP256.sign({
credentialId: id,
getFn,
challenge: hash,
rpId,
});
return {
signature: Signature.toHex(signature),
raw,
webauthn: metadata,
};
},
async signMessage({ message }) {
return this.sign({ hash: (0, hashMessage_js_1.hashMessage)(message) });
},
async signTypedData(parameters) {
return this.sign({ hash: (0, hashTypedData_js_1.hashTypedData)(parameters) });
},
type: 'webAuthn',
};
}
//# sourceMappingURL=toWebAuthnAccount.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"toWebAuthnAccount.js","sourceRoot":"","sources":["../../../account-abstraction/accounts/toWebAuthnAccount.ts"],"names":[],"mappings":";;AAuCA,8CA6BC;AApED,0CAAyC;AACzC,gDAA+C;AAG/C,yEAAkE;AAClE,6EAAsE;AAkCtE,SAAgB,iBAAiB,CAC/B,UAAuC;IAEvC,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,UAAU,CAAA;IAClC,MAAM,EAAE,EAAE,EAAE,SAAS,EAAE,GAAG,UAAU,CAAC,UAAU,CAAA;IAC/C,OAAO;QACL,EAAE;QACF,SAAS;QACT,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE;YACjB,MAAM,EAAE,QAAQ,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,MAAM,YAAY,CAAC,IAAI,CAAC;gBAC3D,YAAY,EAAE,EAAE;gBAChB,KAAK;gBACL,SAAS,EAAE,IAAI;gBACf,IAAI;aACL,CAAC,CAAA;YACF,OAAO;gBACL,SAAS,EAAE,SAAS,CAAC,KAAK,CAAC,SAAS,CAAC;gBACrC,GAAG;gBACH,QAAQ,EAAE,QAAQ;aACnB,CAAA;QACH,CAAC;QACD,KAAK,CAAC,WAAW,CAAC,EAAE,OAAO,EAAE;YAC3B,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAA,4BAAW,EAAC,OAAO,CAAC,EAAE,CAAC,CAAA;QAClD,CAAC;QACD,KAAK,CAAC,aAAa,CAAC,UAAU;YAC5B,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAA,gCAAa,EAAC,UAAU,CAAC,EAAE,CAAC,CAAA;QACvD,CAAC;QACD,IAAI,EAAE,UAAU;KACjB,CAAA;AACH,CAAC"}

View File

@@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=types.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../account-abstraction/accounts/types.ts"],"names":[],"mappings":""}

View File

@@ -0,0 +1,49 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.estimateUserOperationGas = estimateUserOperationGas;
const parseAccount_js_1 = require("../../../accounts/utils/parseAccount.js");
const account_js_1 = require("../../../errors/account.js");
const getAction_js_1 = require("../../../utils/getAction.js");
const stateOverride_js_1 = require("../../../utils/stateOverride.js");
const getUserOperationError_js_1 = require("../../utils/errors/getUserOperationError.js");
const userOperationGas_js_1 = require("../../utils/formatters/userOperationGas.js");
const userOperationRequest_js_1 = require("../../utils/formatters/userOperationRequest.js");
const prepareUserOperation_js_1 = require("./prepareUserOperation.js");
async function estimateUserOperationGas(client, parameters) {
const { account: account_ = client.account, entryPointAddress, stateOverride, } = parameters;
if (!account_ && !parameters.sender)
throw new account_js_1.AccountNotFoundError();
const account = account_ ? (0, parseAccount_js_1.parseAccount)(account_) : undefined;
const rpcStateOverride = (0, stateOverride_js_1.serializeStateOverride)(stateOverride);
const request = account
? await (0, getAction_js_1.getAction)(client, prepareUserOperation_js_1.prepareUserOperation, 'prepareUserOperation')({
...parameters,
parameters: [
'authorization',
'factory',
'nonce',
'paymaster',
'signature',
],
})
: parameters;
try {
const params = [
(0, userOperationRequest_js_1.formatUserOperationRequest)(request),
(entryPointAddress ?? account?.entryPoint?.address),
];
const result = await client.request({
method: 'eth_estimateUserOperationGas',
params: rpcStateOverride ? [...params, rpcStateOverride] : [...params],
});
return (0, userOperationGas_js_1.formatUserOperationGas)(result);
}
catch (error) {
const calls = parameters.calls;
throw (0, getUserOperationError_js_1.getUserOperationError)(error, {
...request,
...(calls ? { calls } : {}),
});
}
}
//# sourceMappingURL=estimateUserOperationGas.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"estimateUserOperationGas.js","sourceRoot":"","sources":["../../../../account-abstraction/actions/bundler/estimateUserOperationGas.ts"],"names":[],"mappings":";;AAkJA,4DA6DC;AA9MD,6EAGgD;AAGhD,2DAAiE;AAcjE,8DAAuD;AACvD,sEAAwE;AAgBxE,0FAAmF;AACnF,oFAGmD;AACnD,4FAGuD;AACvD,uEAIkC;AA+F3B,KAAK,UAAU,wBAAwB,CAK5C,MAAqD,EACrD,UAIC;IAED,MAAM,EACJ,OAAO,EAAE,QAAQ,GAAG,MAAM,CAAC,OAAO,EAClC,iBAAiB,EACjB,aAAa,GACd,GAAG,UAAU,CAAA;IAEd,IAAI,CAAC,QAAQ,IAAI,CAAC,UAAU,CAAC,MAAM;QAAE,MAAM,IAAI,iCAAoB,EAAE,CAAA;IACrE,MAAM,OAAO,GAAG,QAAQ,CAAC,CAAC,CAAC,IAAA,8BAAY,EAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;IAE7D,MAAM,gBAAgB,GAAG,IAAA,yCAAsB,EAAC,aAAa,CAAC,CAAA;IAE9D,MAAM,OAAO,GAAG,OAAO;QACrB,CAAC,CAAC,MAAM,IAAA,wBAAS,EACb,MAAM,EACN,8CAAoB,EACpB,sBAAsB,CACvB,CAAC;YACA,GAAG,UAAU;YACb,UAAU,EAAE;gBACV,eAAe;gBACf,SAAS;gBACT,OAAO;gBACP,WAAW;gBACX,WAAW;aACZ;SAC2C,CAAC;QACjD,CAAC,CAAC,UAAU,CAAA;IAEd,IAAI,CAAC;QACH,MAAM,MAAM,GAAG;YACb,IAAA,oDAA0B,EAAC,OAAwB,CAAC;YACpD,CAAC,iBAAiB,IAAI,OAAO,EAAE,UAAU,EAAE,OAAO,CAAE;SAC5C,CAAA;QAEV,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC;YAClC,MAAM,EAAE,8BAA8B;YACtC,MAAM,EAAE,gBAAgB,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,EAAE,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC;SACvE,CAAC,CAAA;QACF,OAAO,IAAA,4CAAsB,EAAC,MAAM,CAGnC,CAAA;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,KAAK,GAAI,UAAkB,CAAC,KAAK,CAAA;QACvC,MAAM,IAAA,gDAAqB,EAAC,KAAkB,EAAE;YAC9C,GAAI,OAAyB;YAC7B,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC5B,CAAC,CAAA;IACJ,CAAC;AACH,CAAC"}

View File

@@ -0,0 +1,7 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getSupportedEntryPoints = getSupportedEntryPoints;
function getSupportedEntryPoints(client) {
return client.request({ method: 'eth_supportedEntryPoints' });
}
//# sourceMappingURL=getSupportedEntryPoints.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"getSupportedEntryPoints.js","sourceRoot":"","sources":["../../../../account-abstraction/actions/bundler/getSupportedEntryPoints.ts"],"names":[],"mappings":";;AA8BA,0DAEC;AAFD,SAAgB,uBAAuB,CAAC,MAAyB;IAC/D,OAAO,MAAM,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,0BAA0B,EAAE,CAAC,CAAA;AAC/D,CAAC"}

View File

@@ -0,0 +1,22 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getUserOperation = getUserOperation;
const userOperation_js_1 = require("../../errors/userOperation.js");
const userOperation_js_2 = require("../../utils/formatters/userOperation.js");
async function getUserOperation(client, { hash }) {
const result = await client.request({
method: 'eth_getUserOperationByHash',
params: [hash],
}, { dedupe: true });
if (!result)
throw new userOperation_js_1.UserOperationNotFoundError({ hash });
const { blockHash, blockNumber, entryPoint, transactionHash, userOperation } = result;
return {
blockHash,
blockNumber: BigInt(blockNumber),
entryPoint,
transactionHash,
userOperation: (0, userOperation_js_2.formatUserOperation)(userOperation),
};
}
//# sourceMappingURL=getUserOperation.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"getUserOperation.js","sourceRoot":"","sources":["../../../../account-abstraction/actions/bundler/getUserOperation.ts"],"names":[],"mappings":";;AA4DA,4CAwBC;AA7ED,oEAGsC;AAEtC,8EAA6E;AAgDtE,KAAK,UAAU,gBAAgB,CACpC,MAAyB,EACzB,EAAE,IAAI,EAA8B;IAEpC,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,OAAO,CACjC;QACE,MAAM,EAAE,4BAA4B;QACpC,MAAM,EAAE,CAAC,IAAI,CAAC;KACf,EACD,EAAE,MAAM,EAAE,IAAI,EAAE,CACjB,CAAA;IAED,IAAI,CAAC,MAAM;QAAE,MAAM,IAAI,6CAA0B,CAAC,EAAE,IAAI,EAAE,CAAC,CAAA;IAE3D,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,UAAU,EAAE,eAAe,EAAE,aAAa,EAAE,GAC1E,MAAM,CAAA;IAER,OAAO;QACL,SAAS;QACT,WAAW,EAAE,MAAM,CAAC,WAAW,CAAC;QAChC,UAAU;QACV,eAAe;QACf,aAAa,EAAE,IAAA,sCAAmB,EAAC,aAAa,CAAC;KAClD,CAAA;AACH,CAAC"}

View File

@@ -0,0 +1,15 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getUserOperationReceipt = getUserOperationReceipt;
const userOperation_js_1 = require("../../errors/userOperation.js");
const userOperationReceipt_js_1 = require("../../utils/formatters/userOperationReceipt.js");
async function getUserOperationReceipt(client, { hash }) {
const receipt = await client.request({
method: 'eth_getUserOperationReceipt',
params: [hash],
}, { dedupe: true });
if (!receipt)
throw new userOperation_js_1.UserOperationReceiptNotFoundError({ hash });
return (0, userOperationReceipt_js_1.formatUserOperationReceipt)(receipt);
}
//# sourceMappingURL=getUserOperationReceipt.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"getUserOperationReceipt.js","sourceRoot":"","sources":["../../../../account-abstraction/actions/bundler/getUserOperationReceipt.ts"],"names":[],"mappings":";;AAgDA,0DAeC;AAzDD,oEAGsC;AAEtC,4FAA2F;AAqCpF,KAAK,UAAU,uBAAuB,CAC3C,MAAyB,EACzB,EAAE,IAAI,EAAqC;IAE3C,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,OAAO,CAClC;QACE,MAAM,EAAE,6BAA6B;QACrC,MAAM,EAAE,CAAC,IAAI,CAAC;KACf,EACD,EAAE,MAAM,EAAE,IAAI,EAAE,CACjB,CAAA;IAED,IAAI,CAAC,OAAO;QAAE,MAAM,IAAI,oDAAiC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAA;IAEnE,OAAO,IAAA,oDAA0B,EAAC,OAAO,CAAC,CAAA;AAC5C,CAAC"}

View File

@@ -0,0 +1,271 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.prepareUserOperation = prepareUserOperation;
const parseAccount_js_1 = require("../../../accounts/utils/parseAccount.js");
const index_js_1 = require("../../../actions/index.js");
const estimateFeesPerGas_js_1 = require("../../../actions/public/estimateFeesPerGas.js");
const getChainId_js_1 = require("../../../actions/public/getChainId.js");
const account_js_1 = require("../../../errors/account.js");
const encodeFunctionData_js_1 = require("../../../utils/abi/encodeFunctionData.js");
const concat_js_1 = require("../../../utils/data/concat.js");
const getAction_js_1 = require("../../../utils/getAction.js");
const getPaymasterData_js_1 = require("../paymaster/getPaymasterData.js");
const getPaymasterStubData_js_1 = require("../paymaster/getPaymasterStubData.js");
const estimateUserOperationGas_js_1 = require("./estimateUserOperationGas.js");
const defaultParameters = [
'factory',
'fees',
'gas',
'paymaster',
'nonce',
'signature',
'authorization',
];
async function prepareUserOperation(client, parameters_) {
const parameters = parameters_;
const { account: account_ = client.account, dataSuffix = typeof client.dataSuffix === 'string'
? client.dataSuffix
: client.dataSuffix?.value, parameters: properties = defaultParameters, stateOverride, } = parameters;
if (!account_)
throw new account_js_1.AccountNotFoundError();
const account = (0, parseAccount_js_1.parseAccount)(account_);
const bundlerClient = client;
const paymaster = parameters.paymaster ?? bundlerClient?.paymaster;
const paymasterAddress = typeof paymaster === 'string' ? paymaster : undefined;
const { getPaymasterStubData, getPaymasterData } = (() => {
if (paymaster === true)
return {
getPaymasterStubData: (parameters) => (0, getAction_js_1.getAction)(bundlerClient, getPaymasterStubData_js_1.getPaymasterStubData, 'getPaymasterStubData')(parameters),
getPaymasterData: (parameters) => (0, getAction_js_1.getAction)(bundlerClient, getPaymasterData_js_1.getPaymasterData, 'getPaymasterData')(parameters),
};
if (typeof paymaster === 'object') {
const { getPaymasterStubData, getPaymasterData } = paymaster;
return {
getPaymasterStubData: (getPaymasterData && getPaymasterStubData
? getPaymasterStubData
: getPaymasterData),
getPaymasterData: getPaymasterData && getPaymasterStubData
? getPaymasterData
: undefined,
};
}
return {
getPaymasterStubData: undefined,
getPaymasterData: undefined,
};
})();
const paymasterContext = parameters.paymasterContext
? parameters.paymasterContext
: bundlerClient?.paymasterContext;
let request = {
...parameters,
paymaster: paymasterAddress,
sender: account.address,
};
const [callData, factory, fees, nonce, authorization] = await Promise.all([
(async () => {
if (parameters.calls)
return account.encodeCalls(parameters.calls.map((call_) => {
const call = call_;
if (call.abi)
return {
data: (0, encodeFunctionData_js_1.encodeFunctionData)(call),
to: call.to,
value: call.value,
};
return call;
}));
return parameters.callData;
})(),
(async () => {
if (!properties.includes('factory'))
return undefined;
if (parameters.initCode)
return { initCode: parameters.initCode };
if (parameters.factory && parameters.factoryData) {
return {
factory: parameters.factory,
factoryData: parameters.factoryData,
};
}
const { factory, factoryData } = await account.getFactoryArgs();
if (account.entryPoint.version === '0.6')
return {
initCode: factory && factoryData ? (0, concat_js_1.concat)([factory, factoryData]) : undefined,
};
return {
factory,
factoryData,
};
})(),
(async () => {
if (!properties.includes('fees'))
return undefined;
if (typeof parameters.maxFeePerGas === 'bigint' &&
typeof parameters.maxPriorityFeePerGas === 'bigint')
return request;
if (bundlerClient?.userOperation?.estimateFeesPerGas) {
const fees = await bundlerClient.userOperation.estimateFeesPerGas({
account,
bundlerClient,
userOperation: request,
});
return {
...request,
...fees,
};
}
try {
const client_ = bundlerClient.client ?? client;
const fees = await (0, getAction_js_1.getAction)(client_, estimateFeesPerGas_js_1.estimateFeesPerGas, 'estimateFeesPerGas')({
chain: client_.chain,
type: 'eip1559',
});
return {
maxFeePerGas: typeof parameters.maxFeePerGas === 'bigint'
? parameters.maxFeePerGas
: BigInt(2n * fees.maxFeePerGas),
maxPriorityFeePerGas: typeof parameters.maxPriorityFeePerGas === 'bigint'
? parameters.maxPriorityFeePerGas
: BigInt(2n * fees.maxPriorityFeePerGas),
};
}
catch {
return undefined;
}
})(),
(async () => {
if (!properties.includes('nonce'))
return undefined;
if (typeof parameters.nonce === 'bigint')
return parameters.nonce;
return account.getNonce();
})(),
(async () => {
if (!properties.includes('authorization'))
return undefined;
if (typeof parameters.authorization === 'object')
return parameters.authorization;
if (account.authorization && !(await account.isDeployed())) {
const authorization = await (0, index_js_1.prepareAuthorization)(account.client, account.authorization);
return {
...authorization,
r: '0xfffffffffffffffffffffffffffffff000000000000000000000000000000000',
s: '0x7aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
yParity: 1,
};
}
return undefined;
})(),
]);
if (typeof callData !== 'undefined')
request.callData = dataSuffix ? (0, concat_js_1.concat)([callData, dataSuffix]) : callData;
if (typeof factory !== 'undefined')
request = { ...request, ...factory };
if (typeof fees !== 'undefined')
request = { ...request, ...fees };
if (typeof nonce !== 'undefined')
request.nonce = nonce;
if (typeof authorization !== 'undefined')
request.authorization = authorization;
if (properties.includes('signature')) {
if (typeof parameters.signature !== 'undefined')
request.signature = parameters.signature;
else
request.signature = await account.getStubSignature(request);
}
if (account.entryPoint.version === '0.6' && !request.initCode)
request.initCode = '0x';
let chainId;
async function getChainId() {
if (chainId)
return chainId;
if (client.chain)
return client.chain.id;
const chainId_ = await (0, getAction_js_1.getAction)(client, getChainId_js_1.getChainId, 'getChainId')({});
chainId = chainId_;
return chainId;
}
let isPaymasterPopulated = false;
if (properties.includes('paymaster') &&
getPaymasterStubData &&
!paymasterAddress &&
!parameters.paymasterAndData) {
const { isFinal = false, sponsor: _, ...paymasterArgs } = await getPaymasterStubData({
chainId: await getChainId(),
entryPointAddress: account.entryPoint.address,
context: paymasterContext,
...request,
});
isPaymasterPopulated = isFinal;
request = {
...request,
...paymasterArgs,
};
}
if (account.entryPoint.version === '0.6' && !request.paymasterAndData)
request.paymasterAndData = '0x';
if (properties.includes('gas')) {
if (account.userOperation?.estimateGas) {
const gas = await account.userOperation.estimateGas(request);
request = {
...request,
...gas,
};
}
if (typeof request.callGasLimit === 'undefined' ||
typeof request.preVerificationGas === 'undefined' ||
typeof request.verificationGasLimit === 'undefined' ||
(request.paymaster &&
typeof request.paymasterPostOpGasLimit === 'undefined') ||
(request.paymaster &&
typeof request.paymasterVerificationGasLimit === 'undefined')) {
const gas = await (0, getAction_js_1.getAction)(bundlerClient, estimateUserOperationGas_js_1.estimateUserOperationGas, 'estimateUserOperationGas')({
account,
callGasLimit: 0n,
preVerificationGas: 0n,
verificationGasLimit: 0n,
stateOverride,
...(request.paymaster
? {
paymasterPostOpGasLimit: 0n,
paymasterVerificationGasLimit: 0n,
}
: {}),
...request,
});
request = {
...request,
callGasLimit: request.callGasLimit ?? gas.callGasLimit,
preVerificationGas: request.preVerificationGas ?? gas.preVerificationGas,
verificationGasLimit: request.verificationGasLimit ?? gas.verificationGasLimit,
paymasterPostOpGasLimit: request.paymasterPostOpGasLimit ?? gas.paymasterPostOpGasLimit,
paymasterVerificationGasLimit: request.paymasterVerificationGasLimit ??
gas.paymasterVerificationGasLimit,
};
}
}
if (properties.includes('paymaster') &&
getPaymasterData &&
!paymasterAddress &&
!parameters.paymasterAndData &&
!isPaymasterPopulated) {
const paymaster = await getPaymasterData({
chainId: await getChainId(),
entryPointAddress: account.entryPoint.address,
context: paymasterContext,
...request,
});
request = {
...request,
...paymaster,
};
}
delete request.calls;
delete request.parameters;
delete request.paymasterContext;
if (typeof request.paymaster !== 'string')
delete request.paymaster;
return request;
}
//# sourceMappingURL=prepareUserOperation.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,42 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.sendUserOperation = sendUserOperation;
const parseAccount_js_1 = require("../../../accounts/utils/parseAccount.js");
const account_js_1 = require("../../../errors/account.js");
const getAction_js_1 = require("../../../utils/getAction.js");
const getUserOperationError_js_1 = require("../../utils/errors/getUserOperationError.js");
const userOperationRequest_js_1 = require("../../utils/formatters/userOperationRequest.js");
const prepareUserOperation_js_1 = require("./prepareUserOperation.js");
async function sendUserOperation(client, parameters) {
const { account: account_ = client.account, entryPointAddress } = parameters;
if (!account_ && !parameters.sender)
throw new account_js_1.AccountNotFoundError();
const account = account_ ? (0, parseAccount_js_1.parseAccount)(account_) : undefined;
const request = account
? await (0, getAction_js_1.getAction)(client, prepareUserOperation_js_1.prepareUserOperation, 'prepareUserOperation')(parameters)
: parameters;
const signature = (parameters.signature ||
(await account?.signUserOperation?.(request)));
const rpcParameters = (0, userOperationRequest_js_1.formatUserOperationRequest)({
...request,
signature,
});
try {
return await client.request({
method: 'eth_sendUserOperation',
params: [
rpcParameters,
(entryPointAddress ?? account?.entryPoint?.address),
],
}, { retryCount: 0 });
}
catch (error) {
const calls = parameters.calls;
throw (0, getUserOperationError_js_1.getUserOperationError)(error, {
...request,
...(calls ? { calls } : {}),
signature,
});
}
}
//# sourceMappingURL=sendUserOperation.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"sendUserOperation.js","sourceRoot":"","sources":["../../../../account-abstraction/actions/bundler/sendUserOperation.ts"],"names":[],"mappings":";;AAqHA,8CAgDC;AApKD,6EAAsE;AAGtE,2DAAiE;AAQjE,8DAAuD;AAevD,0FAAmF;AACnF,4FAGuD;AACvD,uEAIkC;AAiF3B,KAAK,UAAU,iBAAiB,CAKrC,MAAqD,EACrD,UAAwE;IAExE,MAAM,EAAE,OAAO,EAAE,QAAQ,GAAG,MAAM,CAAC,OAAO,EAAE,iBAAiB,EAAE,GAAG,UAAU,CAAA;IAE5E,IAAI,CAAC,QAAQ,IAAI,CAAC,UAAU,CAAC,MAAM;QAAE,MAAM,IAAI,iCAAoB,EAAE,CAAA;IACrE,MAAM,OAAO,GAAG,QAAQ,CAAC,CAAC,CAAC,IAAA,8BAAY,EAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;IAE7D,MAAM,OAAO,GAAG,OAAO;QACrB,CAAC,CAAC,MAAM,IAAA,wBAAS,EACb,MAAM,EACN,8CAAoB,EACpB,sBAAsB,CACvB,CAAC,UAAuD,CAAC;QAC5D,CAAC,CAAC,UAAU,CAAA;IAEd,MAAM,SAAS,GAAG,CAAC,UAAU,CAAC,SAAS;QACrC,CAAC,MAAM,OAAO,EAAE,iBAAiB,EAAE,CAAC,OAAwB,CAAC,CAAC,CAAE,CAAA;IAElE,MAAM,aAAa,GAAG,IAAA,oDAA0B,EAAC;QAC/C,GAAG,OAAO;QACV,SAAS;KACO,CAAC,CAAA;IAEnB,IAAI,CAAC;QACH,OAAO,MAAM,MAAM,CAAC,OAAO,CACzB;YACE,MAAM,EAAE,uBAAuB;YAC/B,MAAM,EAAE;gBACN,aAAa;gBACb,CAAC,iBAAiB,IAAI,OAAO,EAAE,UAAU,EAAE,OAAO,CAAE;aACrD;SACF,EACD,EAAE,UAAU,EAAE,CAAC,EAAE,CAClB,CAAA;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,KAAK,GAAI,UAAkB,CAAC,KAAK,CAAA;QACvC,MAAM,IAAA,gDAAqB,EAAC,KAAkB,EAAE;YAC9C,GAAI,OAAyB;YAC7B,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC3B,SAAS;SACV,CAAC,CAAA;IACJ,CAAC;AACH,CAAC"}

View File

@@ -0,0 +1,54 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.waitForUserOperationReceipt = waitForUserOperationReceipt;
const getAction_js_1 = require("../../../utils/getAction.js");
const observe_js_1 = require("../../../utils/observe.js");
const poll_js_1 = require("../../../utils/poll.js");
const stringify_js_1 = require("../../../utils/stringify.js");
const userOperation_js_1 = require("../../errors/userOperation.js");
const getUserOperationReceipt_js_1 = require("./getUserOperationReceipt.js");
function waitForUserOperationReceipt(client, parameters) {
const { hash, pollingInterval = client.pollingInterval, retryCount, timeout = 120_000, } = parameters;
let count = 0;
const observerId = (0, stringify_js_1.stringify)([
'waitForUserOperationReceipt',
client.uid,
hash,
]);
return new Promise((resolve, reject) => {
const unobserve = (0, observe_js_1.observe)(observerId, { resolve, reject }, (emit) => {
const done = (fn) => {
unpoll();
fn();
unobserve();
};
const timeoutId = timeout
? setTimeout(() => done(() => emit.reject(new userOperation_js_1.WaitForUserOperationReceiptTimeoutError({ hash }))), timeout)
: undefined;
const unpoll = (0, poll_js_1.poll)(async () => {
if (retryCount && count >= retryCount) {
clearTimeout(timeoutId);
done(() => emit.reject(new userOperation_js_1.WaitForUserOperationReceiptTimeoutError({ hash })));
}
try {
const receipt = await (0, getAction_js_1.getAction)(client, getUserOperationReceipt_js_1.getUserOperationReceipt, 'getUserOperationReceipt')({ hash });
clearTimeout(timeoutId);
done(() => emit.resolve(receipt));
}
catch (err) {
const error = err;
if (error.name !== 'UserOperationReceiptNotFoundError') {
clearTimeout(timeoutId);
done(() => emit.reject(error));
}
}
count++;
}, {
emitOnBegin: true,
interval: pollingInterval,
});
return unpoll;
});
});
}
//# sourceMappingURL=waitForUserOperationReceipt.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"waitForUserOperationReceipt.js","sourceRoot":"","sources":["../../../../account-abstraction/actions/bundler/waitForUserOperationReceipt.ts"],"names":[],"mappings":";;AAoEA,kEA4EC;AA3ID,8DAAuD;AACvD,0DAA0E;AAC1E,oDAAiE;AACjE,8DAAuD;AACvD,oEAGsC;AAEtC,6EAGqC;AAmDrC,SAAgB,2BAA2B,CACzC,MAAyB,EACzB,UAAiD;IAEjD,MAAM,EACJ,IAAI,EACJ,eAAe,GAAG,MAAM,CAAC,eAAe,EACxC,UAAU,EACV,OAAO,GAAG,OAAO,GAClB,GAAG,UAAU,CAAA;IAEd,IAAI,KAAK,GAAG,CAAC,CAAA;IACb,MAAM,UAAU,GAAG,IAAA,wBAAS,EAAC;QAC3B,6BAA6B;QAC7B,MAAM,CAAC,GAAG;QACV,IAAI;KACL,CAAC,CAAA;IAEF,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,SAAS,GAAG,IAAA,oBAAO,EAAC,UAAU,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,CAAC,IAAI,EAAE,EAAE;YAClE,MAAM,IAAI,GAAG,CAAC,EAAc,EAAE,EAAE;gBAC9B,MAAM,EAAE,CAAA;gBACR,EAAE,EAAE,CAAA;gBACJ,SAAS,EAAE,CAAA;YACb,CAAC,CAAA;YAED,MAAM,SAAS,GAAG,OAAO;gBACvB,CAAC,CAAC,UAAU,CACR,GAAG,EAAE,CACH,IAAI,CAAC,GAAG,EAAE,CACR,IAAI,CAAC,MAAM,CACT,IAAI,0DAAuC,CAAC,EAAE,IAAI,EAAE,CAAC,CACtD,CACF,EACH,OAAO,CACR;gBACH,CAAC,CAAC,SAAS,CAAA;YAEb,MAAM,MAAM,GAAG,IAAA,cAAI,EACjB,KAAK,IAAI,EAAE;gBACT,IAAI,UAAU,IAAI,KAAK,IAAI,UAAU,EAAE,CAAC;oBACtC,YAAY,CAAC,SAAS,CAAC,CAAA;oBACvB,IAAI,CAAC,GAAG,EAAE,CACR,IAAI,CAAC,MAAM,CACT,IAAI,0DAAuC,CAAC,EAAE,IAAI,EAAE,CAAC,CACtD,CACF,CAAA;gBACH,CAAC;gBAED,IAAI,CAAC;oBACH,MAAM,OAAO,GAAG,MAAM,IAAA,wBAAS,EAC7B,MAAM,EACN,oDAAuB,EACvB,yBAAyB,CAC1B,CAAC,EAAE,IAAI,EAAE,CAAC,CAAA;oBACX,YAAY,CAAC,SAAS,CAAC,CAAA;oBACvB,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAA;gBACnC,CAAC;gBAAC,OAAO,GAAG,EAAE,CAAC;oBACb,MAAM,KAAK,GAAG,GAAuC,CAAA;oBACrD,IAAI,KAAK,CAAC,IAAI,KAAK,mCAAmC,EAAE,CAAC;wBACvD,YAAY,CAAC,SAAS,CAAC,CAAA;wBACvB,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAA;oBAChC,CAAC;gBACH,CAAC;gBAED,KAAK,EAAE,CAAA;YACT,CAAC,EACD;gBACE,WAAW,EAAE,IAAI;gBACjB,QAAQ,EAAE,eAAe;aAC1B,CACF,CAAA;YAED,OAAO,MAAM,CAAA;QACf,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC"}

View File

@@ -0,0 +1,34 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getPaymasterData = getPaymasterData;
const fromHex_js_1 = require("../../../utils/encoding/fromHex.js");
const toHex_js_1 = require("../../../utils/encoding/toHex.js");
const userOperationRequest_js_1 = require("../../utils/formatters/userOperationRequest.js");
async function getPaymasterData(client, parameters) {
const { chainId, entryPointAddress, context, ...userOperation } = parameters;
const request = (0, userOperationRequest_js_1.formatUserOperationRequest)(userOperation);
const { paymasterPostOpGasLimit, paymasterVerificationGasLimit, ...rest } = await client.request({
method: 'pm_getPaymasterData',
params: [
{
...request,
callGasLimit: request.callGasLimit ?? '0x0',
verificationGasLimit: request.verificationGasLimit ?? '0x0',
preVerificationGas: request.preVerificationGas ?? '0x0',
},
entryPointAddress,
(0, toHex_js_1.numberToHex)(chainId),
context,
],
});
return {
...rest,
...(paymasterPostOpGasLimit && {
paymasterPostOpGasLimit: (0, fromHex_js_1.hexToBigInt)(paymasterPostOpGasLimit),
}),
...(paymasterVerificationGasLimit && {
paymasterVerificationGasLimit: (0, fromHex_js_1.hexToBigInt)(paymasterVerificationGasLimit),
}),
};
}
//# sourceMappingURL=getPaymasterData.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"getPaymasterData.js","sourceRoot":"","sources":["../../../../account-abstraction/actions/paymaster/getPaymasterData.ts"],"names":[],"mappings":";;AAkIA,4CA8BC;AA1JD,mEAAgE;AAChE,+DAA8D;AAE9D,4FAGuD;AAsHhD,KAAK,UAAU,gBAAgB,CACpC,MAAyB,EACzB,UAAsC;IAEtC,MAAM,EAAE,OAAO,EAAE,iBAAiB,EAAE,OAAO,EAAE,GAAG,aAAa,EAAE,GAAG,UAAU,CAAA;IAC5E,MAAM,OAAO,GAAG,IAAA,oDAA0B,EAAC,aAAa,CAAC,CAAA;IACzD,MAAM,EAAE,uBAAuB,EAAE,6BAA6B,EAAE,GAAG,IAAI,EAAE,GACvE,MAAM,MAAM,CAAC,OAAO,CAAC;QACnB,MAAM,EAAE,qBAAqB;QAC7B,MAAM,EAAE;YACN;gBACE,GAAG,OAAO;gBACV,YAAY,EAAE,OAAO,CAAC,YAAY,IAAI,KAAK;gBAC3C,oBAAoB,EAAE,OAAO,CAAC,oBAAoB,IAAI,KAAK;gBAC3D,kBAAkB,EAAE,OAAO,CAAC,kBAAkB,IAAI,KAAK;aACxD;YACD,iBAAiB;YACjB,IAAA,sBAAW,EAAC,OAAO,CAAC;YACpB,OAAO;SACR;KACF,CAAC,CAAA;IACJ,OAAO;QACL,GAAG,IAAI;QACP,GAAG,CAAC,uBAAuB,IAAI;YAC7B,uBAAuB,EAAE,IAAA,wBAAW,EAAC,uBAAuB,CAAC;SAC9D,CAAC;QACF,GAAG,CAAC,6BAA6B,IAAI;YACnC,6BAA6B,EAAE,IAAA,wBAAW,EAAC,6BAA6B,CAAC;SAC1E,CAAC;KACsC,CAAA;AAC5C,CAAC"}

View File

@@ -0,0 +1,34 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getPaymasterStubData = getPaymasterStubData;
const fromHex_js_1 = require("../../../utils/encoding/fromHex.js");
const toHex_js_1 = require("../../../utils/encoding/toHex.js");
const userOperationRequest_js_1 = require("../../utils/formatters/userOperationRequest.js");
async function getPaymasterStubData(client, parameters) {
const { chainId, entryPointAddress, context, ...userOperation } = parameters;
const request = (0, userOperationRequest_js_1.formatUserOperationRequest)(userOperation);
const { paymasterPostOpGasLimit, paymasterVerificationGasLimit, ...rest } = await client.request({
method: 'pm_getPaymasterStubData',
params: [
{
...request,
callGasLimit: request.callGasLimit ?? '0x0',
verificationGasLimit: request.verificationGasLimit ?? '0x0',
preVerificationGas: request.preVerificationGas ?? '0x0',
},
entryPointAddress,
(0, toHex_js_1.numberToHex)(chainId),
context,
],
});
return {
...rest,
...(paymasterPostOpGasLimit && {
paymasterPostOpGasLimit: (0, fromHex_js_1.hexToBigInt)(paymasterPostOpGasLimit),
}),
...(paymasterVerificationGasLimit && {
paymasterVerificationGasLimit: (0, fromHex_js_1.hexToBigInt)(paymasterVerificationGasLimit),
}),
};
}
//# sourceMappingURL=getPaymasterStubData.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"getPaymasterStubData.js","sourceRoot":"","sources":["../../../../account-abstraction/actions/paymaster/getPaymasterStubData.ts"],"names":[],"mappings":";;AA2GA,oDA8BC;AAnID,mEAAgE;AAChE,+DAA8D;AAE9D,4FAGuD;AA+FhD,KAAK,UAAU,oBAAoB,CACxC,MAAyB,EACzB,UAA0C;IAE1C,MAAM,EAAE,OAAO,EAAE,iBAAiB,EAAE,OAAO,EAAE,GAAG,aAAa,EAAE,GAAG,UAAU,CAAA;IAC5E,MAAM,OAAO,GAAG,IAAA,oDAA0B,EAAC,aAAa,CAAC,CAAA;IACzD,MAAM,EAAE,uBAAuB,EAAE,6BAA6B,EAAE,GAAG,IAAI,EAAE,GACvE,MAAM,MAAM,CAAC,OAAO,CAAC;QACnB,MAAM,EAAE,yBAAyB;QACjC,MAAM,EAAE;YACN;gBACE,GAAG,OAAO;gBACV,YAAY,EAAE,OAAO,CAAC,YAAY,IAAI,KAAK;gBAC3C,oBAAoB,EAAE,OAAO,CAAC,oBAAoB,IAAI,KAAK;gBAC3D,kBAAkB,EAAE,OAAO,CAAC,kBAAkB,IAAI,KAAK;aACxD;YACD,iBAAiB;YACjB,IAAA,sBAAW,EAAC,OAAO,CAAC;YACpB,OAAO;SACR;KACF,CAAC,CAAA;IACJ,OAAO;QACL,GAAG,IAAI;QACP,GAAG,CAAC,uBAAuB,IAAI;YAC7B,uBAAuB,EAAE,IAAA,wBAAW,EAAC,uBAAuB,CAAC;SAC9D,CAAC;QACF,GAAG,CAAC,6BAA6B,IAAI;YACnC,6BAA6B,EAAE,IAAA,wBAAW,EAAC,6BAA6B,CAAC;SAC1E,CAAC;KAC0C,CAAA;AAChD,CAAC"}

View File

@@ -0,0 +1,24 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createBundlerClient = createBundlerClient;
const createClient_js_1 = require("../../clients/createClient.js");
const bundler_js_1 = require("./decorators/bundler.js");
function createBundlerClient(parameters) {
const { client: client_, dataSuffix, key = 'bundler', name = 'Bundler Client', paymaster, paymasterContext, transport, userOperation, } = parameters;
const client = Object.assign((0, createClient_js_1.createClient)({
...parameters,
chain: parameters.chain ?? client_?.chain,
key,
name,
transport,
type: 'bundlerClient',
}), {
client: client_,
dataSuffix: dataSuffix ?? client_?.dataSuffix,
paymaster,
paymasterContext,
userOperation,
});
return client.extend(bundler_js_1.bundlerActions);
}
//# sourceMappingURL=createBundlerClient.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"createBundlerClient.js","sourceRoot":"","sources":["../../../account-abstraction/clients/createBundlerClient.ts"],"names":[],"mappings":";;AAqIA,kDA+BC;AAnKD,mEAKsC;AAStC,wDAA6E;AAsH7E,SAAgB,mBAAmB,CACjC,UAA+B;IAE/B,MAAM,EACJ,MAAM,EAAE,OAAO,EACf,UAAU,EACV,GAAG,GAAG,SAAS,EACf,IAAI,GAAG,gBAAgB,EACvB,SAAS,EACT,gBAAgB,EAChB,SAAS,EACT,aAAa,GACd,GAAG,UAAU,CAAA;IACd,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAC1B,IAAA,8BAAY,EAAC;QACX,GAAG,UAAU;QACb,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,OAAO,EAAE,KAAK;QACzC,GAAG;QACH,IAAI;QACJ,SAAS;QACT,IAAI,EAAE,eAAe;KACtB,CAAC,EACF;QACE,MAAM,EAAE,OAAO;QACf,UAAU,EAAE,UAAU,IAAI,OAAO,EAAE,UAAU;QAC7C,SAAS;QACT,gBAAgB;QAChB,aAAa;KACd,CACF,CAAA;IACD,OAAO,MAAM,CAAC,MAAM,CAAC,2BAAc,CAAQ,CAAA;AAC7C,CAAC"}

View File

@@ -0,0 +1,17 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createPaymasterClient = createPaymasterClient;
const createClient_js_1 = require("../../clients/createClient.js");
const paymaster_js_1 = require("./decorators/paymaster.js");
function createPaymasterClient(parameters) {
const { key = 'bundler', name = 'Bundler Client', transport } = parameters;
const client = (0, createClient_js_1.createClient)({
...parameters,
key,
name,
transport,
type: 'PaymasterClient',
});
return client.extend(paymaster_js_1.paymasterActions);
}
//# sourceMappingURL=createPaymasterClient.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"createPaymasterClient.js","sourceRoot":"","sources":["../../../account-abstraction/clients/createPaymasterClient.ts"],"names":[],"mappings":";;AAiEA,sDAYC;AA7ED,mEAKsC;AAKtC,4DAGkC;AAoDlC,SAAgB,qBAAqB,CACnC,UAAiC;IAEjC,MAAM,EAAE,GAAG,GAAG,SAAS,EAAE,IAAI,GAAG,gBAAgB,EAAE,SAAS,EAAE,GAAG,UAAU,CAAA;IAC1E,MAAM,MAAM,GAAG,IAAA,8BAAY,EAAC;QAC1B,GAAG,UAAU;QACb,GAAG;QACH,IAAI;QACJ,SAAS;QACT,IAAI,EAAE,iBAAiB;KACxB,CAAC,CAAA;IACF,OAAO,MAAM,CAAC,MAAM,CAAC,+BAAgB,CAAC,CAAA;AACxC,CAAC"}

View File

@@ -0,0 +1,24 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.bundlerActions = bundlerActions;
const getChainId_js_1 = require("../../../actions/public/getChainId.js");
const estimateUserOperationGas_js_1 = require("../../actions/bundler/estimateUserOperationGas.js");
const getSupportedEntryPoints_js_1 = require("../../actions/bundler/getSupportedEntryPoints.js");
const getUserOperation_js_1 = require("../../actions/bundler/getUserOperation.js");
const getUserOperationReceipt_js_1 = require("../../actions/bundler/getUserOperationReceipt.js");
const prepareUserOperation_js_1 = require("../../actions/bundler/prepareUserOperation.js");
const sendUserOperation_js_1 = require("../../actions/bundler/sendUserOperation.js");
const waitForUserOperationReceipt_js_1 = require("../../actions/bundler/waitForUserOperationReceipt.js");
function bundlerActions(client) {
return {
estimateUserOperationGas: (parameters) => (0, estimateUserOperationGas_js_1.estimateUserOperationGas)(client, parameters),
getChainId: () => (0, getChainId_js_1.getChainId)(client),
getSupportedEntryPoints: () => (0, getSupportedEntryPoints_js_1.getSupportedEntryPoints)(client),
getUserOperation: (parameters) => (0, getUserOperation_js_1.getUserOperation)(client, parameters),
getUserOperationReceipt: (parameters) => (0, getUserOperationReceipt_js_1.getUserOperationReceipt)(client, parameters),
prepareUserOperation: (parameters) => (0, prepareUserOperation_js_1.prepareUserOperation)(client, parameters),
sendUserOperation: (parameters) => (0, sendUserOperation_js_1.sendUserOperation)(client, parameters),
waitForUserOperationReceipt: (parameters) => (0, waitForUserOperationReceipt_js_1.waitForUserOperationReceipt)(client, parameters),
};
}
//# sourceMappingURL=bundler.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"bundler.js","sourceRoot":"","sources":["../../../../account-abstraction/clients/decorators/bundler.ts"],"names":[],"mappings":";;AAoRA,wCAmBC;AAvSD,yEAG8C;AAK9C,mGAI0D;AAC1D,iGAGyD;AACzD,mFAIkD;AAClD,iGAIyD;AACzD,2FAKsD;AACtD,qFAImD;AACnD,yGAI6D;AA0O7D,SAAgB,cAAc,CAI5B,MAAyC;IACzC,OAAO;QACL,wBAAwB,EAAE,CAAC,UAAU,EAAE,EAAE,CACvC,IAAA,sDAAwB,EAAC,MAAM,EAAE,UAAU,CAAC;QAC9C,UAAU,EAAE,GAAG,EAAE,CAAC,IAAA,0BAAU,EAAC,MAAM,CAAC;QACpC,uBAAuB,EAAE,GAAG,EAAE,CAAC,IAAA,oDAAuB,EAAC,MAAM,CAAC;QAC9D,gBAAgB,EAAE,CAAC,UAAU,EAAE,EAAE,CAAC,IAAA,sCAAgB,EAAC,MAAM,EAAE,UAAU,CAAC;QACtE,uBAAuB,EAAE,CAAC,UAAU,EAAE,EAAE,CACtC,IAAA,oDAAuB,EAAC,MAAM,EAAE,UAAU,CAAC;QAC7C,oBAAoB,EAAE,CAAC,UAAU,EAAE,EAAE,CACnC,IAAA,8CAAoB,EAAC,MAAM,EAAE,UAAU,CAAC;QAC1C,iBAAiB,EAAE,CAAC,UAAU,EAAE,EAAE,CAAC,IAAA,wCAAiB,EAAC,MAAM,EAAE,UAAU,CAAC;QACxE,2BAA2B,EAAE,CAAC,UAAU,EAAE,EAAE,CAC1C,IAAA,4DAA2B,EAAC,MAAM,EAAE,UAAU,CAAC;KAClD,CAAA;AACH,CAAC"}

View File

@@ -0,0 +1,12 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.paymasterActions = paymasterActions;
const getPaymasterData_js_1 = require("../../actions/paymaster/getPaymasterData.js");
const getPaymasterStubData_js_1 = require("../../actions/paymaster/getPaymasterStubData.js");
function paymasterActions(client) {
return {
getPaymasterData: (parameters) => (0, getPaymasterData_js_1.getPaymasterData)(client, parameters),
getPaymasterStubData: (parameters) => (0, getPaymasterStubData_js_1.getPaymasterStubData)(client, parameters),
};
}
//# sourceMappingURL=paymaster.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"paymaster.js","sourceRoot":"","sources":["../../../../account-abstraction/clients/decorators/paymaster.ts"],"names":[],"mappings":";;AAwEA,4CAQC;AA9ED,qFAIoD;AACpD,6FAIwD;AA6DxD,SAAgB,gBAAgB,CAC9B,MAAyB;IAEzB,OAAO;QACL,gBAAgB,EAAE,CAAC,UAAU,EAAE,EAAE,CAAC,IAAA,sCAAgB,EAAC,MAAM,EAAE,UAAU,CAAC;QACtE,oBAAoB,EAAE,CAAC,UAAU,EAAE,EAAE,CACnC,IAAA,8CAAoB,EAAC,MAAM,EAAE,UAAU,CAAC;KAC3C,CAAA;AACH,CAAC"}

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,8 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.entryPoint09Address = exports.entryPoint08Address = exports.entryPoint07Address = exports.entryPoint06Address = void 0;
exports.entryPoint06Address = '0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789';
exports.entryPoint07Address = '0x0000000071727De22E5E9d8BAf0edAc6f37da032';
exports.entryPoint08Address = '0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108';
exports.entryPoint09Address = '0x433709009B8330FDa32311DF1C2AFA402eD8D009';
//# sourceMappingURL=address.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"address.js","sourceRoot":"","sources":["../../../account-abstraction/constants/address.ts"],"names":[],"mappings":";;;AAAa,QAAA,mBAAmB,GAC9B,4CAAqD,CAAA;AAC1C,QAAA,mBAAmB,GAC9B,4CAAqD,CAAA;AAC1C,QAAA,mBAAmB,GAC9B,4CAAqD,CAAA;AAC1C,QAAA,mBAAmB,GAC9B,4CAAqD,CAAA"}

View File

@@ -0,0 +1,640 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.VerificationGasLimitTooLowError = exports.VerificationGasLimitExceededError = exports.UnknownBundlerError = exports.UserOperationOutOfTimeRangeError = exports.UserOperationRejectedByOpCodeError = exports.UserOperationRejectedByPaymasterError = exports.UserOperationRejectedByEntryPointError = exports.UserOperationPaymasterSignatureError = exports.UserOperationSignatureError = exports.UserOperationPaymasterExpiredError = exports.UserOperationExpiredError = exports.UnsupportedSignatureAggregatorError = exports.SmartAccountFunctionRevertedError = exports.SignatureCheckFailedError = exports.SenderAlreadyConstructedError = exports.PaymasterPostOpFunctionRevertedError = exports.PaymasterStakeTooLowError = exports.PaymasterRateLimitError = exports.PaymasterNotDeployedError = exports.PaymasterFunctionRevertedError = exports.PaymasterDepositTooLowError = exports.InvalidPaymasterAndDataError = exports.InvalidFieldsError = exports.InvalidBeneficiaryError = exports.InvalidAccountNonceError = exports.InvalidAggregatorError = exports.InternalCallOnlyError = exports.InsufficientPrefundError = exports.InitCodeMustReturnSenderError = exports.InitCodeMustCreateSenderError = exports.InitCodeFailedError = exports.HandleOpsOutOfGasError = exports.GasValuesOverflowError = exports.FailedToSendToBeneficiaryError = exports.ExecutionRevertedError = exports.AccountNotDeployedError = void 0;
const base_js_1 = require("../../errors/base.js");
class AccountNotDeployedError extends base_js_1.BaseError {
constructor({ cause, }) {
super('Smart Account is not deployed.', {
cause,
metaMessages: [
'This could arise when:',
'- No `factory`/`factoryData` or `initCode` properties are provided for Smart Account deployment.',
'- An incorrect `sender` address is provided.',
],
name: 'AccountNotDeployedError',
});
}
}
exports.AccountNotDeployedError = AccountNotDeployedError;
Object.defineProperty(AccountNotDeployedError, "message", {
enumerable: true,
configurable: true,
writable: true,
value: /aa20/
});
class ExecutionRevertedError extends base_js_1.BaseError {
constructor({ cause, data, message, } = {}) {
const reason = message
?.replace('execution reverted: ', '')
?.replace('execution reverted', '');
super(`Execution reverted ${reason ? `with reason: ${reason}` : 'for an unknown reason'}.`, {
cause,
name: 'ExecutionRevertedError',
});
Object.defineProperty(this, "data", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
this.data = data;
}
}
exports.ExecutionRevertedError = ExecutionRevertedError;
Object.defineProperty(ExecutionRevertedError, "code", {
enumerable: true,
configurable: true,
writable: true,
value: -32521
});
Object.defineProperty(ExecutionRevertedError, "message", {
enumerable: true,
configurable: true,
writable: true,
value: /execution reverted/
});
class FailedToSendToBeneficiaryError extends base_js_1.BaseError {
constructor({ cause, }) {
super('Failed to send funds to beneficiary.', {
cause,
name: 'FailedToSendToBeneficiaryError',
});
}
}
exports.FailedToSendToBeneficiaryError = FailedToSendToBeneficiaryError;
Object.defineProperty(FailedToSendToBeneficiaryError, "message", {
enumerable: true,
configurable: true,
writable: true,
value: /aa91/
});
class GasValuesOverflowError extends base_js_1.BaseError {
constructor({ cause, }) {
super('Gas value overflowed.', {
cause,
metaMessages: [
'This could arise when:',
'- one of the gas values exceeded 2**120 (uint120)',
].filter(Boolean),
name: 'GasValuesOverflowError',
});
}
}
exports.GasValuesOverflowError = GasValuesOverflowError;
Object.defineProperty(GasValuesOverflowError, "message", {
enumerable: true,
configurable: true,
writable: true,
value: /aa94/
});
class HandleOpsOutOfGasError extends base_js_1.BaseError {
constructor({ cause, }) {
super('The `handleOps` function was called by the Bundler with a gas limit too low.', {
cause,
name: 'HandleOpsOutOfGasError',
});
}
}
exports.HandleOpsOutOfGasError = HandleOpsOutOfGasError;
Object.defineProperty(HandleOpsOutOfGasError, "message", {
enumerable: true,
configurable: true,
writable: true,
value: /aa95/
});
class InitCodeFailedError extends base_js_1.BaseError {
constructor({ cause, factory, factoryData, initCode, }) {
super('Failed to simulate deployment for Smart Account.', {
cause,
metaMessages: [
'This could arise when:',
'- Invalid `factory`/`factoryData` or `initCode` properties are present',
'- Smart Account deployment execution ran out of gas (low `verificationGasLimit` value)',
'- Smart Account deployment execution reverted with an error\n',
factory && `factory: ${factory}`,
factoryData && `factoryData: ${factoryData}`,
initCode && `initCode: ${initCode}`,
].filter(Boolean),
name: 'InitCodeFailedError',
});
}
}
exports.InitCodeFailedError = InitCodeFailedError;
Object.defineProperty(InitCodeFailedError, "message", {
enumerable: true,
configurable: true,
writable: true,
value: /aa13/
});
class InitCodeMustCreateSenderError extends base_js_1.BaseError {
constructor({ cause, factory, factoryData, initCode, }) {
super('Smart Account initialization implementation did not create an account.', {
cause,
metaMessages: [
'This could arise when:',
'- `factory`/`factoryData` or `initCode` properties are invalid',
'- Smart Account initialization implementation is incorrect\n',
factory && `factory: ${factory}`,
factoryData && `factoryData: ${factoryData}`,
initCode && `initCode: ${initCode}`,
].filter(Boolean),
name: 'InitCodeMustCreateSenderError',
});
}
}
exports.InitCodeMustCreateSenderError = InitCodeMustCreateSenderError;
Object.defineProperty(InitCodeMustCreateSenderError, "message", {
enumerable: true,
configurable: true,
writable: true,
value: /aa15/
});
class InitCodeMustReturnSenderError extends base_js_1.BaseError {
constructor({ cause, factory, factoryData, initCode, sender, }) {
super('Smart Account initialization implementation does not return the expected sender.', {
cause,
metaMessages: [
'This could arise when:',
'Smart Account initialization implementation does not return a sender address\n',
factory && `factory: ${factory}`,
factoryData && `factoryData: ${factoryData}`,
initCode && `initCode: ${initCode}`,
sender && `sender: ${sender}`,
].filter(Boolean),
name: 'InitCodeMustReturnSenderError',
});
}
}
exports.InitCodeMustReturnSenderError = InitCodeMustReturnSenderError;
Object.defineProperty(InitCodeMustReturnSenderError, "message", {
enumerable: true,
configurable: true,
writable: true,
value: /aa14/
});
class InsufficientPrefundError extends base_js_1.BaseError {
constructor({ cause, }) {
super('Smart Account does not have sufficient funds to execute the User Operation.', {
cause,
metaMessages: [
'This could arise when:',
'- the Smart Account does not have sufficient funds to cover the required prefund, or',
'- a Paymaster was not provided',
].filter(Boolean),
name: 'InsufficientPrefundError',
});
}
}
exports.InsufficientPrefundError = InsufficientPrefundError;
Object.defineProperty(InsufficientPrefundError, "message", {
enumerable: true,
configurable: true,
writable: true,
value: /aa21/
});
class InternalCallOnlyError extends base_js_1.BaseError {
constructor({ cause, }) {
super('Bundler attempted to call an invalid function on the EntryPoint.', {
cause,
name: 'InternalCallOnlyError',
});
}
}
exports.InternalCallOnlyError = InternalCallOnlyError;
Object.defineProperty(InternalCallOnlyError, "message", {
enumerable: true,
configurable: true,
writable: true,
value: /aa92/
});
class InvalidAggregatorError extends base_js_1.BaseError {
constructor({ cause, }) {
super('Bundler used an invalid aggregator for handling aggregated User Operations.', {
cause,
name: 'InvalidAggregatorError',
});
}
}
exports.InvalidAggregatorError = InvalidAggregatorError;
Object.defineProperty(InvalidAggregatorError, "message", {
enumerable: true,
configurable: true,
writable: true,
value: /aa96/
});
class InvalidAccountNonceError extends base_js_1.BaseError {
constructor({ cause, nonce, }) {
super('Invalid Smart Account nonce used for User Operation.', {
cause,
metaMessages: [nonce && `nonce: ${nonce}`].filter(Boolean),
name: 'InvalidAccountNonceError',
});
}
}
exports.InvalidAccountNonceError = InvalidAccountNonceError;
Object.defineProperty(InvalidAccountNonceError, "message", {
enumerable: true,
configurable: true,
writable: true,
value: /aa25/
});
class InvalidBeneficiaryError extends base_js_1.BaseError {
constructor({ cause, }) {
super('Bundler has not set a beneficiary address.', {
cause,
name: 'InvalidBeneficiaryError',
});
}
}
exports.InvalidBeneficiaryError = InvalidBeneficiaryError;
Object.defineProperty(InvalidBeneficiaryError, "message", {
enumerable: true,
configurable: true,
writable: true,
value: /aa90/
});
class InvalidFieldsError extends base_js_1.BaseError {
constructor({ cause, }) {
super('Invalid fields set on User Operation.', {
cause,
name: 'InvalidFieldsError',
});
}
}
exports.InvalidFieldsError = InvalidFieldsError;
Object.defineProperty(InvalidFieldsError, "code", {
enumerable: true,
configurable: true,
writable: true,
value: -32602
});
class InvalidPaymasterAndDataError extends base_js_1.BaseError {
constructor({ cause, paymasterAndData, }) {
super('Paymaster properties provided are invalid.', {
cause,
metaMessages: [
'This could arise when:',
'- the `paymasterAndData` property is of an incorrect length\n',
paymasterAndData && `paymasterAndData: ${paymasterAndData}`,
].filter(Boolean),
name: 'InvalidPaymasterAndDataError',
});
}
}
exports.InvalidPaymasterAndDataError = InvalidPaymasterAndDataError;
Object.defineProperty(InvalidPaymasterAndDataError, "message", {
enumerable: true,
configurable: true,
writable: true,
value: /aa93/
});
class PaymasterDepositTooLowError extends base_js_1.BaseError {
constructor({ cause, }) {
super('Paymaster deposit for the User Operation is too low.', {
cause,
metaMessages: [
'This could arise when:',
'- the Paymaster has deposited less than the expected amount via the `deposit` function',
].filter(Boolean),
name: 'PaymasterDepositTooLowError',
});
}
}
exports.PaymasterDepositTooLowError = PaymasterDepositTooLowError;
Object.defineProperty(PaymasterDepositTooLowError, "code", {
enumerable: true,
configurable: true,
writable: true,
value: -32508
});
Object.defineProperty(PaymasterDepositTooLowError, "message", {
enumerable: true,
configurable: true,
writable: true,
value: /aa31/
});
class PaymasterFunctionRevertedError extends base_js_1.BaseError {
constructor({ cause, }) {
super('The `validatePaymasterUserOp` function on the Paymaster reverted.', {
cause,
name: 'PaymasterFunctionRevertedError',
});
}
}
exports.PaymasterFunctionRevertedError = PaymasterFunctionRevertedError;
Object.defineProperty(PaymasterFunctionRevertedError, "message", {
enumerable: true,
configurable: true,
writable: true,
value: /aa33/
});
class PaymasterNotDeployedError extends base_js_1.BaseError {
constructor({ cause, }) {
super('The Paymaster contract has not been deployed.', {
cause,
name: 'PaymasterNotDeployedError',
});
}
}
exports.PaymasterNotDeployedError = PaymasterNotDeployedError;
Object.defineProperty(PaymasterNotDeployedError, "message", {
enumerable: true,
configurable: true,
writable: true,
value: /aa30/
});
class PaymasterRateLimitError extends base_js_1.BaseError {
constructor({ cause }) {
super('UserOperation rejected because paymaster (or signature aggregator) is throttled/banned.', {
cause,
name: 'PaymasterRateLimitError',
});
}
}
exports.PaymasterRateLimitError = PaymasterRateLimitError;
Object.defineProperty(PaymasterRateLimitError, "code", {
enumerable: true,
configurable: true,
writable: true,
value: -32504
});
class PaymasterStakeTooLowError extends base_js_1.BaseError {
constructor({ cause }) {
super('UserOperation rejected because paymaster (or signature aggregator) stake or unstake-delay is too low.', {
cause,
name: 'PaymasterStakeTooLowError',
});
}
}
exports.PaymasterStakeTooLowError = PaymasterStakeTooLowError;
Object.defineProperty(PaymasterStakeTooLowError, "code", {
enumerable: true,
configurable: true,
writable: true,
value: -32505
});
class PaymasterPostOpFunctionRevertedError extends base_js_1.BaseError {
constructor({ cause, }) {
super('Paymaster `postOp` function reverted.', {
cause,
name: 'PaymasterPostOpFunctionRevertedError',
});
}
}
exports.PaymasterPostOpFunctionRevertedError = PaymasterPostOpFunctionRevertedError;
Object.defineProperty(PaymasterPostOpFunctionRevertedError, "message", {
enumerable: true,
configurable: true,
writable: true,
value: /aa50/
});
class SenderAlreadyConstructedError extends base_js_1.BaseError {
constructor({ cause, factory, factoryData, initCode, }) {
super('Smart Account has already been deployed.', {
cause,
metaMessages: [
'Remove the following properties and try again:',
factory && '`factory`',
factoryData && '`factoryData`',
initCode && '`initCode`',
].filter(Boolean),
name: 'SenderAlreadyConstructedError',
});
}
}
exports.SenderAlreadyConstructedError = SenderAlreadyConstructedError;
Object.defineProperty(SenderAlreadyConstructedError, "message", {
enumerable: true,
configurable: true,
writable: true,
value: /aa10/
});
class SignatureCheckFailedError extends base_js_1.BaseError {
constructor({ cause }) {
super('UserOperation rejected because account signature check failed (or paymaster signature, if the paymaster uses its data as signature).', {
cause,
name: 'SignatureCheckFailedError',
});
}
}
exports.SignatureCheckFailedError = SignatureCheckFailedError;
Object.defineProperty(SignatureCheckFailedError, "code", {
enumerable: true,
configurable: true,
writable: true,
value: -32507
});
class SmartAccountFunctionRevertedError extends base_js_1.BaseError {
constructor({ cause, }) {
super('The `validateUserOp` function on the Smart Account reverted.', {
cause,
name: 'SmartAccountFunctionRevertedError',
});
}
}
exports.SmartAccountFunctionRevertedError = SmartAccountFunctionRevertedError;
Object.defineProperty(SmartAccountFunctionRevertedError, "message", {
enumerable: true,
configurable: true,
writable: true,
value: /aa23/
});
class UnsupportedSignatureAggregatorError extends base_js_1.BaseError {
constructor({ cause }) {
super('UserOperation rejected because account specified unsupported signature aggregator.', {
cause,
name: 'UnsupportedSignatureAggregatorError',
});
}
}
exports.UnsupportedSignatureAggregatorError = UnsupportedSignatureAggregatorError;
Object.defineProperty(UnsupportedSignatureAggregatorError, "code", {
enumerable: true,
configurable: true,
writable: true,
value: -32506
});
class UserOperationExpiredError extends base_js_1.BaseError {
constructor({ cause, }) {
super('User Operation expired.', {
cause,
metaMessages: [
'This could arise when:',
'- the `validAfter` or `validUntil` values returned from `validateUserOp` on the Smart Account are not satisfied',
].filter(Boolean),
name: 'UserOperationExpiredError',
});
}
}
exports.UserOperationExpiredError = UserOperationExpiredError;
Object.defineProperty(UserOperationExpiredError, "message", {
enumerable: true,
configurable: true,
writable: true,
value: /aa22/
});
class UserOperationPaymasterExpiredError extends base_js_1.BaseError {
constructor({ cause, }) {
super('Paymaster for User Operation expired.', {
cause,
metaMessages: [
'This could arise when:',
'- the `validAfter` or `validUntil` values returned from `validatePaymasterUserOp` on the Paymaster are not satisfied',
].filter(Boolean),
name: 'UserOperationPaymasterExpiredError',
});
}
}
exports.UserOperationPaymasterExpiredError = UserOperationPaymasterExpiredError;
Object.defineProperty(UserOperationPaymasterExpiredError, "message", {
enumerable: true,
configurable: true,
writable: true,
value: /aa32/
});
class UserOperationSignatureError extends base_js_1.BaseError {
constructor({ cause, }) {
super('Signature provided for the User Operation is invalid.', {
cause,
metaMessages: [
'This could arise when:',
'- the `signature` for the User Operation is incorrectly computed, and unable to be verified by the Smart Account',
].filter(Boolean),
name: 'UserOperationSignatureError',
});
}
}
exports.UserOperationSignatureError = UserOperationSignatureError;
Object.defineProperty(UserOperationSignatureError, "message", {
enumerable: true,
configurable: true,
writable: true,
value: /aa24/
});
class UserOperationPaymasterSignatureError extends base_js_1.BaseError {
constructor({ cause, }) {
super('Signature provided for the User Operation is invalid.', {
cause,
metaMessages: [
'This could arise when:',
'- the `signature` for the User Operation is incorrectly computed, and unable to be verified by the Paymaster',
].filter(Boolean),
name: 'UserOperationPaymasterSignatureError',
});
}
}
exports.UserOperationPaymasterSignatureError = UserOperationPaymasterSignatureError;
Object.defineProperty(UserOperationPaymasterSignatureError, "message", {
enumerable: true,
configurable: true,
writable: true,
value: /aa34/
});
class UserOperationRejectedByEntryPointError extends base_js_1.BaseError {
constructor({ cause }) {
super("User Operation rejected by EntryPoint's `simulateValidation` during account creation or validation.", {
cause,
name: 'UserOperationRejectedByEntryPointError',
});
}
}
exports.UserOperationRejectedByEntryPointError = UserOperationRejectedByEntryPointError;
Object.defineProperty(UserOperationRejectedByEntryPointError, "code", {
enumerable: true,
configurable: true,
writable: true,
value: -32500
});
class UserOperationRejectedByPaymasterError extends base_js_1.BaseError {
constructor({ cause }) {
super("User Operation rejected by Paymaster's `validatePaymasterUserOp`.", {
cause,
name: 'UserOperationRejectedByPaymasterError',
});
}
}
exports.UserOperationRejectedByPaymasterError = UserOperationRejectedByPaymasterError;
Object.defineProperty(UserOperationRejectedByPaymasterError, "code", {
enumerable: true,
configurable: true,
writable: true,
value: -32501
});
class UserOperationRejectedByOpCodeError extends base_js_1.BaseError {
constructor({ cause }) {
super('User Operation rejected with op code validation error.', {
cause,
name: 'UserOperationRejectedByOpCodeError',
});
}
}
exports.UserOperationRejectedByOpCodeError = UserOperationRejectedByOpCodeError;
Object.defineProperty(UserOperationRejectedByOpCodeError, "code", {
enumerable: true,
configurable: true,
writable: true,
value: -32502
});
class UserOperationOutOfTimeRangeError extends base_js_1.BaseError {
constructor({ cause }) {
super('UserOperation out of time-range: either wallet or paymaster returned a time-range, and it is already expired (or will expire soon).', {
cause,
name: 'UserOperationOutOfTimeRangeError',
});
}
}
exports.UserOperationOutOfTimeRangeError = UserOperationOutOfTimeRangeError;
Object.defineProperty(UserOperationOutOfTimeRangeError, "code", {
enumerable: true,
configurable: true,
writable: true,
value: -32503
});
class UnknownBundlerError extends base_js_1.BaseError {
constructor({ cause }) {
super(`An error occurred while executing user operation: ${cause?.shortMessage}`, {
cause,
name: 'UnknownBundlerError',
});
}
}
exports.UnknownBundlerError = UnknownBundlerError;
class VerificationGasLimitExceededError extends base_js_1.BaseError {
constructor({ cause, }) {
super('User Operation verification gas limit exceeded.', {
cause,
metaMessages: [
'This could arise when:',
'- the gas used for verification exceeded the `verificationGasLimit`',
].filter(Boolean),
name: 'VerificationGasLimitExceededError',
});
}
}
exports.VerificationGasLimitExceededError = VerificationGasLimitExceededError;
Object.defineProperty(VerificationGasLimitExceededError, "message", {
enumerable: true,
configurable: true,
writable: true,
value: /aa40/
});
class VerificationGasLimitTooLowError extends base_js_1.BaseError {
constructor({ cause, }) {
super('User Operation verification gas limit is too low.', {
cause,
metaMessages: [
'This could arise when:',
'- the `verificationGasLimit` is too low to verify the User Operation',
].filter(Boolean),
name: 'VerificationGasLimitTooLowError',
});
}
}
exports.VerificationGasLimitTooLowError = VerificationGasLimitTooLowError;
Object.defineProperty(VerificationGasLimitTooLowError, "message", {
enumerable: true,
configurable: true,
writable: true,
value: /aa41/
});
//# sourceMappingURL=bundler.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,70 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.WaitForUserOperationReceiptTimeoutError = exports.UserOperationNotFoundError = exports.UserOperationReceiptNotFoundError = exports.UserOperationExecutionError = void 0;
const base_js_1 = require("../../errors/base.js");
const transaction_js_1 = require("../../errors/transaction.js");
const index_js_1 = require("../../utils/index.js");
class UserOperationExecutionError extends base_js_1.BaseError {
constructor(cause, { callData, callGasLimit, docsPath, factory, factoryData, initCode, maxFeePerGas, maxPriorityFeePerGas, nonce, paymaster, paymasterAndData, paymasterData, paymasterPostOpGasLimit, paymasterVerificationGasLimit, preVerificationGas, sender, signature, verificationGasLimit, }) {
const prettyArgs = (0, transaction_js_1.prettyPrint)({
callData,
callGasLimit,
factory,
factoryData,
initCode,
maxFeePerGas: typeof maxFeePerGas !== 'undefined' &&
`${(0, index_js_1.formatGwei)(maxFeePerGas)} gwei`,
maxPriorityFeePerGas: typeof maxPriorityFeePerGas !== 'undefined' &&
`${(0, index_js_1.formatGwei)(maxPriorityFeePerGas)} gwei`,
nonce,
paymaster,
paymasterAndData,
paymasterData,
paymasterPostOpGasLimit,
paymasterVerificationGasLimit,
preVerificationGas,
sender,
signature,
verificationGasLimit,
});
super(cause.shortMessage, {
cause,
docsPath,
metaMessages: [
...(cause.metaMessages ? [...cause.metaMessages, ' '] : []),
'Request Arguments:',
prettyArgs,
].filter(Boolean),
name: 'UserOperationExecutionError',
});
Object.defineProperty(this, "cause", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
this.cause = cause;
}
}
exports.UserOperationExecutionError = UserOperationExecutionError;
class UserOperationReceiptNotFoundError extends base_js_1.BaseError {
constructor({ hash }) {
super(`User Operation receipt with hash "${hash}" could not be found. The User Operation may not have been processed yet.`, { name: 'UserOperationReceiptNotFoundError' });
}
}
exports.UserOperationReceiptNotFoundError = UserOperationReceiptNotFoundError;
class UserOperationNotFoundError extends base_js_1.BaseError {
constructor({ hash }) {
super(`User Operation with hash "${hash}" could not be found.`, {
name: 'UserOperationNotFoundError',
});
}
}
exports.UserOperationNotFoundError = UserOperationNotFoundError;
class WaitForUserOperationReceiptTimeoutError extends base_js_1.BaseError {
constructor({ hash }) {
super(`Timed out while waiting for User Operation with hash "${hash}" to be confirmed.`, { name: 'WaitForUserOperationReceiptTimeoutError' });
}
}
exports.WaitForUserOperationReceiptTimeoutError = WaitForUserOperationReceiptTimeoutError;
//# sourceMappingURL=userOperation.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"userOperation.js","sourceRoot":"","sources":["../../../account-abstraction/errors/userOperation.ts"],"names":[],"mappings":";;;AAAA,kDAAgD;AAChD,gEAAyD;AAEzD,mDAAiD;AAMjD,MAAa,2BAA4B,SAAQ,mBAAS;IAGxD,YACE,KAAgB,EAChB,EACE,QAAQ,EACR,YAAY,EACZ,QAAQ,EACR,OAAO,EACP,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,oBAAoB,EACpB,KAAK,EACL,SAAS,EACT,gBAAgB,EAChB,aAAa,EACb,uBAAuB,EACvB,6BAA6B,EAC7B,kBAAkB,EAClB,MAAM,EACN,SAAS,EACT,oBAAoB,GAGrB;QAED,MAAM,UAAU,GAAG,IAAA,4BAAW,EAAC;YAC7B,QAAQ;YACR,YAAY;YACZ,OAAO;YACP,WAAW;YACX,QAAQ;YACR,YAAY,EACV,OAAO,YAAY,KAAK,WAAW;gBACnC,GAAG,IAAA,qBAAU,EAAC,YAAY,CAAC,OAAO;YACpC,oBAAoB,EAClB,OAAO,oBAAoB,KAAK,WAAW;gBAC3C,GAAG,IAAA,qBAAU,EAAC,oBAAoB,CAAC,OAAO;YAC5C,KAAK;YACL,SAAS;YACT,gBAAgB;YAChB,aAAa;YACb,uBAAuB;YACvB,6BAA6B;YAC7B,kBAAkB;YAClB,MAAM;YACN,SAAS;YACT,oBAAoB;SACrB,CAAC,CAAA;QAEF,KAAK,CAAC,KAAK,CAAC,YAAY,EAAE;YACxB,KAAK;YACL,QAAQ;YACR,YAAY,EAAE;gBACZ,GAAG,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,YAAY,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;gBAC3D,oBAAoB;gBACpB,UAAU;aACX,CAAC,MAAM,CAAC,OAAO,CAAa;YAC7B,IAAI,EAAE,6BAA6B;SACpC,CAAC,CAAA;QA5DK;;;;;WAAgB;QA6DvB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;IACpB,CAAC;CACF;AAhED,kEAgEC;AAMD,MAAa,iCAAkC,SAAQ,mBAAS;IAC9D,YAAY,EAAE,IAAI,EAAkB;QAClC,KAAK,CACH,qCAAqC,IAAI,2EAA2E,EACpH,EAAE,IAAI,EAAE,mCAAmC,EAAE,CAC9C,CAAA;IACH,CAAC;CACF;AAPD,8EAOC;AAKD,MAAa,0BAA2B,SAAQ,mBAAS;IACvD,YAAY,EAAE,IAAI,EAAkB;QAClC,KAAK,CAAC,6BAA6B,IAAI,uBAAuB,EAAE;YAC9D,IAAI,EAAE,4BAA4B;SACnC,CAAC,CAAA;IACJ,CAAC;CACF;AAND,gEAMC;AAMD,MAAa,uCAAwC,SAAQ,mBAAS;IACpE,YAAY,EAAE,IAAI,EAAkB;QAClC,KAAK,CACH,yDAAyD,IAAI,oBAAoB,EACjF,EAAE,IAAI,EAAE,yCAAyC,EAAE,CACpD,CAAA;IACH,CAAC;CACF;AAPD,0FAOC"}

106
node_modules/viem/_cjs/account-abstraction/index.js generated vendored Normal file
View File

@@ -0,0 +1,106 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.UserOperationSignatureError = exports.UserOperationPaymasterSignatureError = exports.UserOperationPaymasterExpiredError = exports.UserOperationExpiredError = exports.UnknownBundlerError = exports.SmartAccountFunctionRevertedError = exports.SenderAlreadyConstructedError = exports.PaymasterPostOpFunctionRevertedError = exports.PaymasterNotDeployedError = exports.PaymasterFunctionRevertedError = exports.PaymasterDepositTooLowError = exports.InvalidPaymasterAndDataError = exports.InvalidBeneficiaryError = exports.InvalidAggregatorError = exports.InternalCallOnlyError = exports.InsufficientPrefundError = exports.InitCodeMustReturnSenderError = exports.InitCodeMustCreateSenderError = exports.InitCodeFailedError = exports.HandleOpsOutOfGasError = exports.GasValuesOverflowError = exports.FailedToSendToBeneficiaryError = exports.AccountNotDeployedError = exports.entryPoint09Address = exports.entryPoint08Address = exports.entryPoint07Address = exports.entryPoint06Address = exports.entryPoint09Abi = exports.entryPoint08Abi = exports.entryPoint07Abi = exports.entryPoint06Abi = exports.paymasterActions = exports.bundlerActions = exports.createPaymasterClient = exports.createBundlerClient = exports.getPaymasterStubData = exports.getPaymasterData = exports.waitForUserOperationReceipt = exports.sendUserOperation = exports.prepareUserOperation = exports.getUserOperationReceipt = exports.getUserOperation = exports.getSupportedEntryPoints = exports.estimateUserOperationGas = exports.toWebAuthnAccount = exports.toSmartAccount = exports.toSoladySmartAccount = exports.toSimple7702SmartAccount = exports.toCoinbaseSmartAccount = exports.createWebAuthnCredential = void 0;
exports.toUserOperation = exports.toPackedUserOperation = exports.getUserOperationTypedData = exports.getUserOperationHash = exports.getInitCode = exports.formatUserOperationRequest = exports.formatUserOperationReceipt = exports.formatUserOperationGas = exports.formatUserOperation = exports.getUserOperationError = exports.getBundlerError = exports.WaitForUserOperationReceiptTimeoutError = exports.UserOperationReceiptNotFoundError = exports.UserOperationNotFoundError = exports.UserOperationExecutionError = exports.VerificationGasLimitTooLowError = exports.VerificationGasLimitExceededError = void 0;
var createWebAuthnCredential_js_1 = require("./accounts/createWebAuthnCredential.js");
Object.defineProperty(exports, "createWebAuthnCredential", { enumerable: true, get: function () { return createWebAuthnCredential_js_1.createWebAuthnCredential; } });
var toCoinbaseSmartAccount_js_1 = require("./accounts/implementations/toCoinbaseSmartAccount.js");
Object.defineProperty(exports, "toCoinbaseSmartAccount", { enumerable: true, get: function () { return toCoinbaseSmartAccount_js_1.toCoinbaseSmartAccount; } });
var toSimple7702SmartAccount_js_1 = require("./accounts/implementations/toSimple7702SmartAccount.js");
Object.defineProperty(exports, "toSimple7702SmartAccount", { enumerable: true, get: function () { return toSimple7702SmartAccount_js_1.toSimple7702SmartAccount; } });
var toSoladySmartAccount_js_1 = require("./accounts/implementations/toSoladySmartAccount.js");
Object.defineProperty(exports, "toSoladySmartAccount", { enumerable: true, get: function () { return toSoladySmartAccount_js_1.toSoladySmartAccount; } });
var toSmartAccount_js_1 = require("./accounts/toSmartAccount.js");
Object.defineProperty(exports, "toSmartAccount", { enumerable: true, get: function () { return toSmartAccount_js_1.toSmartAccount; } });
var toWebAuthnAccount_js_1 = require("./accounts/toWebAuthnAccount.js");
Object.defineProperty(exports, "toWebAuthnAccount", { enumerable: true, get: function () { return toWebAuthnAccount_js_1.toWebAuthnAccount; } });
var estimateUserOperationGas_js_1 = require("./actions/bundler/estimateUserOperationGas.js");
Object.defineProperty(exports, "estimateUserOperationGas", { enumerable: true, get: function () { return estimateUserOperationGas_js_1.estimateUserOperationGas; } });
var getSupportedEntryPoints_js_1 = require("./actions/bundler/getSupportedEntryPoints.js");
Object.defineProperty(exports, "getSupportedEntryPoints", { enumerable: true, get: function () { return getSupportedEntryPoints_js_1.getSupportedEntryPoints; } });
var getUserOperation_js_1 = require("./actions/bundler/getUserOperation.js");
Object.defineProperty(exports, "getUserOperation", { enumerable: true, get: function () { return getUserOperation_js_1.getUserOperation; } });
var getUserOperationReceipt_js_1 = require("./actions/bundler/getUserOperationReceipt.js");
Object.defineProperty(exports, "getUserOperationReceipt", { enumerable: true, get: function () { return getUserOperationReceipt_js_1.getUserOperationReceipt; } });
var prepareUserOperation_js_1 = require("./actions/bundler/prepareUserOperation.js");
Object.defineProperty(exports, "prepareUserOperation", { enumerable: true, get: function () { return prepareUserOperation_js_1.prepareUserOperation; } });
var sendUserOperation_js_1 = require("./actions/bundler/sendUserOperation.js");
Object.defineProperty(exports, "sendUserOperation", { enumerable: true, get: function () { return sendUserOperation_js_1.sendUserOperation; } });
var waitForUserOperationReceipt_js_1 = require("./actions/bundler/waitForUserOperationReceipt.js");
Object.defineProperty(exports, "waitForUserOperationReceipt", { enumerable: true, get: function () { return waitForUserOperationReceipt_js_1.waitForUserOperationReceipt; } });
var getPaymasterData_js_1 = require("./actions/paymaster/getPaymasterData.js");
Object.defineProperty(exports, "getPaymasterData", { enumerable: true, get: function () { return getPaymasterData_js_1.getPaymasterData; } });
var getPaymasterStubData_js_1 = require("./actions/paymaster/getPaymasterStubData.js");
Object.defineProperty(exports, "getPaymasterStubData", { enumerable: true, get: function () { return getPaymasterStubData_js_1.getPaymasterStubData; } });
var createBundlerClient_js_1 = require("./clients/createBundlerClient.js");
Object.defineProperty(exports, "createBundlerClient", { enumerable: true, get: function () { return createBundlerClient_js_1.createBundlerClient; } });
var createPaymasterClient_js_1 = require("./clients/createPaymasterClient.js");
Object.defineProperty(exports, "createPaymasterClient", { enumerable: true, get: function () { return createPaymasterClient_js_1.createPaymasterClient; } });
var bundler_js_1 = require("./clients/decorators/bundler.js");
Object.defineProperty(exports, "bundlerActions", { enumerable: true, get: function () { return bundler_js_1.bundlerActions; } });
var paymaster_js_1 = require("./clients/decorators/paymaster.js");
Object.defineProperty(exports, "paymasterActions", { enumerable: true, get: function () { return paymaster_js_1.paymasterActions; } });
var abis_js_1 = require("./constants/abis.js");
Object.defineProperty(exports, "entryPoint06Abi", { enumerable: true, get: function () { return abis_js_1.entryPoint06Abi; } });
Object.defineProperty(exports, "entryPoint07Abi", { enumerable: true, get: function () { return abis_js_1.entryPoint07Abi; } });
Object.defineProperty(exports, "entryPoint08Abi", { enumerable: true, get: function () { return abis_js_1.entryPoint08Abi; } });
Object.defineProperty(exports, "entryPoint09Abi", { enumerable: true, get: function () { return abis_js_1.entryPoint09Abi; } });
var address_js_1 = require("./constants/address.js");
Object.defineProperty(exports, "entryPoint06Address", { enumerable: true, get: function () { return address_js_1.entryPoint06Address; } });
Object.defineProperty(exports, "entryPoint07Address", { enumerable: true, get: function () { return address_js_1.entryPoint07Address; } });
Object.defineProperty(exports, "entryPoint08Address", { enumerable: true, get: function () { return address_js_1.entryPoint08Address; } });
Object.defineProperty(exports, "entryPoint09Address", { enumerable: true, get: function () { return address_js_1.entryPoint09Address; } });
var bundler_js_2 = require("./errors/bundler.js");
Object.defineProperty(exports, "AccountNotDeployedError", { enumerable: true, get: function () { return bundler_js_2.AccountNotDeployedError; } });
Object.defineProperty(exports, "FailedToSendToBeneficiaryError", { enumerable: true, get: function () { return bundler_js_2.FailedToSendToBeneficiaryError; } });
Object.defineProperty(exports, "GasValuesOverflowError", { enumerable: true, get: function () { return bundler_js_2.GasValuesOverflowError; } });
Object.defineProperty(exports, "HandleOpsOutOfGasError", { enumerable: true, get: function () { return bundler_js_2.HandleOpsOutOfGasError; } });
Object.defineProperty(exports, "InitCodeFailedError", { enumerable: true, get: function () { return bundler_js_2.InitCodeFailedError; } });
Object.defineProperty(exports, "InitCodeMustCreateSenderError", { enumerable: true, get: function () { return bundler_js_2.InitCodeMustCreateSenderError; } });
Object.defineProperty(exports, "InitCodeMustReturnSenderError", { enumerable: true, get: function () { return bundler_js_2.InitCodeMustReturnSenderError; } });
Object.defineProperty(exports, "InsufficientPrefundError", { enumerable: true, get: function () { return bundler_js_2.InsufficientPrefundError; } });
Object.defineProperty(exports, "InternalCallOnlyError", { enumerable: true, get: function () { return bundler_js_2.InternalCallOnlyError; } });
Object.defineProperty(exports, "InvalidAggregatorError", { enumerable: true, get: function () { return bundler_js_2.InvalidAggregatorError; } });
Object.defineProperty(exports, "InvalidBeneficiaryError", { enumerable: true, get: function () { return bundler_js_2.InvalidBeneficiaryError; } });
Object.defineProperty(exports, "InvalidPaymasterAndDataError", { enumerable: true, get: function () { return bundler_js_2.InvalidPaymasterAndDataError; } });
Object.defineProperty(exports, "PaymasterDepositTooLowError", { enumerable: true, get: function () { return bundler_js_2.PaymasterDepositTooLowError; } });
Object.defineProperty(exports, "PaymasterFunctionRevertedError", { enumerable: true, get: function () { return bundler_js_2.PaymasterFunctionRevertedError; } });
Object.defineProperty(exports, "PaymasterNotDeployedError", { enumerable: true, get: function () { return bundler_js_2.PaymasterNotDeployedError; } });
Object.defineProperty(exports, "PaymasterPostOpFunctionRevertedError", { enumerable: true, get: function () { return bundler_js_2.PaymasterPostOpFunctionRevertedError; } });
Object.defineProperty(exports, "SenderAlreadyConstructedError", { enumerable: true, get: function () { return bundler_js_2.SenderAlreadyConstructedError; } });
Object.defineProperty(exports, "SmartAccountFunctionRevertedError", { enumerable: true, get: function () { return bundler_js_2.SmartAccountFunctionRevertedError; } });
Object.defineProperty(exports, "UnknownBundlerError", { enumerable: true, get: function () { return bundler_js_2.UnknownBundlerError; } });
Object.defineProperty(exports, "UserOperationExpiredError", { enumerable: true, get: function () { return bundler_js_2.UserOperationExpiredError; } });
Object.defineProperty(exports, "UserOperationPaymasterExpiredError", { enumerable: true, get: function () { return bundler_js_2.UserOperationPaymasterExpiredError; } });
Object.defineProperty(exports, "UserOperationPaymasterSignatureError", { enumerable: true, get: function () { return bundler_js_2.UserOperationPaymasterSignatureError; } });
Object.defineProperty(exports, "UserOperationSignatureError", { enumerable: true, get: function () { return bundler_js_2.UserOperationSignatureError; } });
Object.defineProperty(exports, "VerificationGasLimitExceededError", { enumerable: true, get: function () { return bundler_js_2.VerificationGasLimitExceededError; } });
Object.defineProperty(exports, "VerificationGasLimitTooLowError", { enumerable: true, get: function () { return bundler_js_2.VerificationGasLimitTooLowError; } });
var userOperation_js_1 = require("./errors/userOperation.js");
Object.defineProperty(exports, "UserOperationExecutionError", { enumerable: true, get: function () { return userOperation_js_1.UserOperationExecutionError; } });
Object.defineProperty(exports, "UserOperationNotFoundError", { enumerable: true, get: function () { return userOperation_js_1.UserOperationNotFoundError; } });
Object.defineProperty(exports, "UserOperationReceiptNotFoundError", { enumerable: true, get: function () { return userOperation_js_1.UserOperationReceiptNotFoundError; } });
Object.defineProperty(exports, "WaitForUserOperationReceiptTimeoutError", { enumerable: true, get: function () { return userOperation_js_1.WaitForUserOperationReceiptTimeoutError; } });
var getBundlerError_js_1 = require("./utils/errors/getBundlerError.js");
Object.defineProperty(exports, "getBundlerError", { enumerable: true, get: function () { return getBundlerError_js_1.getBundlerError; } });
var getUserOperationError_js_1 = require("./utils/errors/getUserOperationError.js");
Object.defineProperty(exports, "getUserOperationError", { enumerable: true, get: function () { return getUserOperationError_js_1.getUserOperationError; } });
var userOperation_js_2 = require("./utils/formatters/userOperation.js");
Object.defineProperty(exports, "formatUserOperation", { enumerable: true, get: function () { return userOperation_js_2.formatUserOperation; } });
var userOperationGas_js_1 = require("./utils/formatters/userOperationGas.js");
Object.defineProperty(exports, "formatUserOperationGas", { enumerable: true, get: function () { return userOperationGas_js_1.formatUserOperationGas; } });
var userOperationReceipt_js_1 = require("./utils/formatters/userOperationReceipt.js");
Object.defineProperty(exports, "formatUserOperationReceipt", { enumerable: true, get: function () { return userOperationReceipt_js_1.formatUserOperationReceipt; } });
var userOperationRequest_js_1 = require("./utils/formatters/userOperationRequest.js");
Object.defineProperty(exports, "formatUserOperationRequest", { enumerable: true, get: function () { return userOperationRequest_js_1.formatUserOperationRequest; } });
var getInitCode_js_1 = require("./utils/userOperation/getInitCode.js");
Object.defineProperty(exports, "getInitCode", { enumerable: true, get: function () { return getInitCode_js_1.getInitCode; } });
var getUserOperationHash_js_1 = require("./utils/userOperation/getUserOperationHash.js");
Object.defineProperty(exports, "getUserOperationHash", { enumerable: true, get: function () { return getUserOperationHash_js_1.getUserOperationHash; } });
var getUserOperationTypedData_js_1 = require("./utils/userOperation/getUserOperationTypedData.js");
Object.defineProperty(exports, "getUserOperationTypedData", { enumerable: true, get: function () { return getUserOperationTypedData_js_1.getUserOperationTypedData; } });
var toPackedUserOperation_js_1 = require("./utils/userOperation/toPackedUserOperation.js");
Object.defineProperty(exports, "toPackedUserOperation", { enumerable: true, get: function () { return toPackedUserOperation_js_1.toPackedUserOperation; } });
var toUserOperation_js_1 = require("./utils/userOperation/toUserOperation.js");
Object.defineProperty(exports, "toUserOperation", { enumerable: true, get: function () { return toUserOperation_js_1.toUserOperation; } });
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../account-abstraction/index.ts"],"names":[],"mappings":"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"}

View File

@@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=account.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"account.js","sourceRoot":"","sources":["../../../account-abstraction/types/account.ts"],"names":[],"mappings":""}

View File

@@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=entryPointVersion.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"entryPointVersion.js","sourceRoot":"","sources":["../../../account-abstraction/types/entryPointVersion.ts"],"names":[],"mappings":""}

View File

@@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=rpc.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"rpc.js","sourceRoot":"","sources":["../../../account-abstraction/types/rpc.ts"],"names":[],"mappings":""}

View File

@@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=userOperation.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"userOperation.js","sourceRoot":"","sources":["../../../account-abstraction/types/userOperation.ts"],"names":[],"mappings":""}

View File

@@ -0,0 +1,187 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getBundlerError = getBundlerError;
const bundler_js_1 = require("../../errors/bundler.js");
const bundlerErrors = [
bundler_js_1.ExecutionRevertedError,
bundler_js_1.InvalidFieldsError,
bundler_js_1.PaymasterDepositTooLowError,
bundler_js_1.PaymasterRateLimitError,
bundler_js_1.PaymasterStakeTooLowError,
bundler_js_1.SignatureCheckFailedError,
bundler_js_1.UnsupportedSignatureAggregatorError,
bundler_js_1.UserOperationOutOfTimeRangeError,
bundler_js_1.UserOperationRejectedByEntryPointError,
bundler_js_1.UserOperationRejectedByPaymasterError,
bundler_js_1.UserOperationRejectedByOpCodeError,
];
function getBundlerError(err, args) {
const message = (err.details || '').toLowerCase();
if (bundler_js_1.AccountNotDeployedError.message.test(message))
return new bundler_js_1.AccountNotDeployedError({
cause: err,
});
if (bundler_js_1.FailedToSendToBeneficiaryError.message.test(message))
return new bundler_js_1.FailedToSendToBeneficiaryError({
cause: err,
});
if (bundler_js_1.GasValuesOverflowError.message.test(message))
return new bundler_js_1.GasValuesOverflowError({
cause: err,
});
if (bundler_js_1.HandleOpsOutOfGasError.message.test(message))
return new bundler_js_1.HandleOpsOutOfGasError({
cause: err,
});
if (bundler_js_1.InitCodeFailedError.message.test(message))
return new bundler_js_1.InitCodeFailedError({
cause: err,
factory: args.factory,
factoryData: args.factoryData,
initCode: args.initCode,
});
if (bundler_js_1.InitCodeMustCreateSenderError.message.test(message))
return new bundler_js_1.InitCodeMustCreateSenderError({
cause: err,
factory: args.factory,
factoryData: args.factoryData,
initCode: args.initCode,
});
if (bundler_js_1.InitCodeMustReturnSenderError.message.test(message))
return new bundler_js_1.InitCodeMustReturnSenderError({
cause: err,
factory: args.factory,
factoryData: args.factoryData,
initCode: args.initCode,
sender: args.sender,
});
if (bundler_js_1.InsufficientPrefundError.message.test(message))
return new bundler_js_1.InsufficientPrefundError({
cause: err,
});
if (bundler_js_1.InternalCallOnlyError.message.test(message))
return new bundler_js_1.InternalCallOnlyError({
cause: err,
});
if (bundler_js_1.InvalidAccountNonceError.message.test(message))
return new bundler_js_1.InvalidAccountNonceError({
cause: err,
nonce: args.nonce,
});
if (bundler_js_1.InvalidAggregatorError.message.test(message))
return new bundler_js_1.InvalidAggregatorError({
cause: err,
});
if (bundler_js_1.InvalidBeneficiaryError.message.test(message))
return new bundler_js_1.InvalidBeneficiaryError({
cause: err,
});
if (bundler_js_1.InvalidPaymasterAndDataError.message.test(message))
return new bundler_js_1.InvalidPaymasterAndDataError({
cause: err,
});
if (bundler_js_1.PaymasterDepositTooLowError.message.test(message))
return new bundler_js_1.PaymasterDepositTooLowError({
cause: err,
});
if (bundler_js_1.PaymasterFunctionRevertedError.message.test(message))
return new bundler_js_1.PaymasterFunctionRevertedError({
cause: err,
});
if (bundler_js_1.PaymasterNotDeployedError.message.test(message))
return new bundler_js_1.PaymasterNotDeployedError({
cause: err,
});
if (bundler_js_1.PaymasterPostOpFunctionRevertedError.message.test(message))
return new bundler_js_1.PaymasterPostOpFunctionRevertedError({
cause: err,
});
if (bundler_js_1.SmartAccountFunctionRevertedError.message.test(message))
return new bundler_js_1.SmartAccountFunctionRevertedError({
cause: err,
});
if (bundler_js_1.SenderAlreadyConstructedError.message.test(message))
return new bundler_js_1.SenderAlreadyConstructedError({
cause: err,
factory: args.factory,
factoryData: args.factoryData,
initCode: args.initCode,
});
if (bundler_js_1.UserOperationExpiredError.message.test(message))
return new bundler_js_1.UserOperationExpiredError({
cause: err,
});
if (bundler_js_1.UserOperationPaymasterExpiredError.message.test(message))
return new bundler_js_1.UserOperationPaymasterExpiredError({
cause: err,
});
if (bundler_js_1.UserOperationPaymasterSignatureError.message.test(message))
return new bundler_js_1.UserOperationPaymasterSignatureError({
cause: err,
});
if (bundler_js_1.UserOperationSignatureError.message.test(message))
return new bundler_js_1.UserOperationSignatureError({
cause: err,
});
if (bundler_js_1.VerificationGasLimitExceededError.message.test(message))
return new bundler_js_1.VerificationGasLimitExceededError({
cause: err,
});
if (bundler_js_1.VerificationGasLimitTooLowError.message.test(message))
return new bundler_js_1.VerificationGasLimitTooLowError({
cause: err,
});
const error = err.walk((e) => bundlerErrors.some((error) => error.code === e.code));
if (error) {
if (error.code === bundler_js_1.ExecutionRevertedError.code)
return new bundler_js_1.ExecutionRevertedError({
cause: err,
data: error.data,
message: error.details,
});
if (error.code === bundler_js_1.InvalidFieldsError.code)
return new bundler_js_1.InvalidFieldsError({
cause: err,
});
if (error.code === bundler_js_1.PaymasterDepositTooLowError.code)
return new bundler_js_1.PaymasterDepositTooLowError({
cause: err,
});
if (error.code === bundler_js_1.PaymasterRateLimitError.code)
return new bundler_js_1.PaymasterRateLimitError({
cause: err,
});
if (error.code === bundler_js_1.PaymasterStakeTooLowError.code)
return new bundler_js_1.PaymasterStakeTooLowError({
cause: err,
});
if (error.code === bundler_js_1.SignatureCheckFailedError.code)
return new bundler_js_1.SignatureCheckFailedError({
cause: err,
});
if (error.code === bundler_js_1.UnsupportedSignatureAggregatorError.code)
return new bundler_js_1.UnsupportedSignatureAggregatorError({
cause: err,
});
if (error.code === bundler_js_1.UserOperationOutOfTimeRangeError.code)
return new bundler_js_1.UserOperationOutOfTimeRangeError({
cause: err,
});
if (error.code === bundler_js_1.UserOperationRejectedByEntryPointError.code)
return new bundler_js_1.UserOperationRejectedByEntryPointError({
cause: err,
});
if (error.code === bundler_js_1.UserOperationRejectedByPaymasterError.code)
return new bundler_js_1.UserOperationRejectedByPaymasterError({
cause: err,
});
if (error.code === bundler_js_1.UserOperationRejectedByOpCodeError.code)
return new bundler_js_1.UserOperationRejectedByOpCodeError({
cause: err,
});
}
return new bundler_js_1.UnknownBundlerError({
cause: err,
});
}
//# sourceMappingURL=getBundlerError.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,87 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getUserOperationError = getUserOperationError;
const base_js_1 = require("../../../errors/base.js");
const contract_js_1 = require("../../../errors/contract.js");
const decodeErrorResult_js_1 = require("../../../utils/abi/decodeErrorResult.js");
const bundler_js_1 = require("../../errors/bundler.js");
const userOperation_js_1 = require("../../errors/userOperation.js");
const getBundlerError_js_1 = require("./getBundlerError.js");
function getUserOperationError(err, { calls, docsPath, ...args }) {
const cause = (() => {
const cause = (0, getBundlerError_js_1.getBundlerError)(err, args);
if (calls && cause instanceof bundler_js_1.ExecutionRevertedError) {
const revertData = getRevertData(cause);
const contractCalls = calls?.filter((call) => call.abi);
if (revertData && contractCalls.length > 0)
return getContractError({ calls: contractCalls, revertData });
}
return cause;
})();
return new userOperation_js_1.UserOperationExecutionError(cause, {
docsPath,
...args,
});
}
function getRevertData(error) {
let revertData;
error.walk((e) => {
const error = e;
if (typeof error.data === 'string' ||
typeof error.data?.revertData === 'string' ||
(!(error instanceof base_js_1.BaseError) && typeof error.message === 'string')) {
const match = (error.data?.revertData ||
error.data ||
error.message).match?.(/(0x[A-Za-z0-9]*)/);
if (match) {
revertData = match[1];
return true;
}
}
return false;
});
return revertData;
}
function getContractError(parameters) {
const { calls, revertData } = parameters;
const { abi, functionName, args, to } = (() => {
const contractCalls = calls?.filter((call) => Boolean(call.abi));
if (contractCalls.length === 1)
return contractCalls[0];
const compatContractCalls = contractCalls.filter((call) => {
try {
return Boolean((0, decodeErrorResult_js_1.decodeErrorResult)({
abi: call.abi,
data: revertData,
}));
}
catch {
return false;
}
});
if (compatContractCalls.length === 1)
return compatContractCalls[0];
return {
abi: [],
functionName: contractCalls.reduce((acc, call) => `${acc ? `${acc} | ` : ''}${call.functionName}`, ''),
args: undefined,
to: undefined,
};
})();
const cause = (() => {
if (revertData === '0x')
return new contract_js_1.ContractFunctionZeroDataError({ functionName });
return new contract_js_1.ContractFunctionRevertedError({
abi,
data: revertData,
functionName,
});
})();
return new contract_js_1.ContractFunctionExecutionError(cause, {
abi,
args,
contractAddress: to,
functionName,
});
}
//# sourceMappingURL=getUserOperationError.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"getUserOperationError.js","sourceRoot":"","sources":["../../../../account-abstraction/utils/errors/getUserOperationError.ts"],"names":[],"mappings":"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"}

View File

@@ -0,0 +1,24 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.formatUserOperation = formatUserOperation;
function formatUserOperation(parameters) {
const userOperation = { ...parameters };
if (parameters.callGasLimit)
userOperation.callGasLimit = BigInt(parameters.callGasLimit);
if (parameters.maxFeePerGas)
userOperation.maxFeePerGas = BigInt(parameters.maxFeePerGas);
if (parameters.maxPriorityFeePerGas)
userOperation.maxPriorityFeePerGas = BigInt(parameters.maxPriorityFeePerGas);
if (parameters.nonce)
userOperation.nonce = BigInt(parameters.nonce);
if (parameters.paymasterPostOpGasLimit)
userOperation.paymasterPostOpGasLimit = BigInt(parameters.paymasterPostOpGasLimit);
if (parameters.paymasterVerificationGasLimit)
userOperation.paymasterVerificationGasLimit = BigInt(parameters.paymasterVerificationGasLimit);
if (parameters.preVerificationGas)
userOperation.preVerificationGas = BigInt(parameters.preVerificationGas);
if (parameters.verificationGasLimit)
userOperation.verificationGasLimit = BigInt(parameters.verificationGasLimit);
return userOperation;
}
//# sourceMappingURL=userOperation.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"userOperation.js","sourceRoot":"","sources":["../../../../account-abstraction/utils/formatters/userOperation.ts"],"names":[],"mappings":";;AAMA,kDAwBC;AAxBD,SAAgB,mBAAmB,CAAC,UAA4B;IAC9D,MAAM,aAAa,GAAG,EAAE,GAAG,UAAU,EAA8B,CAAA;IAEnE,IAAI,UAAU,CAAC,YAAY;QACzB,aAAa,CAAC,YAAY,GAAG,MAAM,CAAC,UAAU,CAAC,YAAY,CAAC,CAAA;IAC9D,IAAI,UAAU,CAAC,YAAY;QACzB,aAAa,CAAC,YAAY,GAAG,MAAM,CAAC,UAAU,CAAC,YAAY,CAAC,CAAA;IAC9D,IAAI,UAAU,CAAC,oBAAoB;QACjC,aAAa,CAAC,oBAAoB,GAAG,MAAM,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAA;IAC9E,IAAI,UAAU,CAAC,KAAK;QAAE,aAAa,CAAC,KAAK,GAAG,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAA;IACpE,IAAI,UAAU,CAAC,uBAAuB;QACpC,aAAa,CAAC,uBAAuB,GAAG,MAAM,CAC5C,UAAU,CAAC,uBAAuB,CACnC,CAAA;IACH,IAAI,UAAU,CAAC,6BAA6B;QAC1C,aAAa,CAAC,6BAA6B,GAAG,MAAM,CAClD,UAAU,CAAC,6BAA6B,CACzC,CAAA;IACH,IAAI,UAAU,CAAC,kBAAkB;QAC/B,aAAa,CAAC,kBAAkB,GAAG,MAAM,CAAC,UAAU,CAAC,kBAAkB,CAAC,CAAA;IAC1E,IAAI,UAAU,CAAC,oBAAoB;QACjC,aAAa,CAAC,oBAAoB,GAAG,MAAM,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAA;IAE9E,OAAO,aAAa,CAAA;AACtB,CAAC"}

View File

@@ -0,0 +1,18 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.formatUserOperationGas = formatUserOperationGas;
function formatUserOperationGas(parameters) {
const gas = {};
if (parameters.callGasLimit)
gas.callGasLimit = BigInt(parameters.callGasLimit);
if (parameters.preVerificationGas)
gas.preVerificationGas = BigInt(parameters.preVerificationGas);
if (parameters.verificationGasLimit)
gas.verificationGasLimit = BigInt(parameters.verificationGasLimit);
if (parameters.paymasterPostOpGasLimit)
gas.paymasterPostOpGasLimit = BigInt(parameters.paymasterPostOpGasLimit);
if (parameters.paymasterVerificationGasLimit)
gas.paymasterVerificationGasLimit = BigInt(parameters.paymasterVerificationGasLimit);
return gas;
}
//# sourceMappingURL=userOperationGas.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"userOperationGas.js","sourceRoot":"","sources":["../../../../account-abstraction/utils/formatters/userOperationGas.ts"],"names":[],"mappings":";;AAMA,wDAmBC;AAnBD,SAAgB,sBAAsB,CACpC,UAAiD;IAEjD,MAAM,GAAG,GAAG,EAAwC,CAAA;IAEpD,IAAI,UAAU,CAAC,YAAY;QACzB,GAAG,CAAC,YAAY,GAAG,MAAM,CAAC,UAAU,CAAC,YAAY,CAAC,CAAA;IACpD,IAAI,UAAU,CAAC,kBAAkB;QAC/B,GAAG,CAAC,kBAAkB,GAAG,MAAM,CAAC,UAAU,CAAC,kBAAkB,CAAC,CAAA;IAChE,IAAI,UAAU,CAAC,oBAAoB;QACjC,GAAG,CAAC,oBAAoB,GAAG,MAAM,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAA;IACpE,IAAI,UAAU,CAAC,uBAAuB;QACpC,GAAG,CAAC,uBAAuB,GAAG,MAAM,CAAC,UAAU,CAAC,uBAAuB,CAAC,CAAA;IAC1E,IAAI,UAAU,CAAC,6BAA6B;QAC1C,GAAG,CAAC,6BAA6B,GAAG,MAAM,CACxC,UAAU,CAAC,6BAA6B,CACzC,CAAA;IAEH,OAAO,GAAG,CAAA;AACZ,CAAC"}

View File

@@ -0,0 +1,18 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.formatUserOperationReceipt = formatUserOperationReceipt;
const log_js_1 = require("../../../utils/formatters/log.js");
const transactionReceipt_js_1 = require("../../../utils/formatters/transactionReceipt.js");
function formatUserOperationReceipt(parameters) {
const receipt = { ...parameters };
if (parameters.actualGasCost)
receipt.actualGasCost = BigInt(parameters.actualGasCost);
if (parameters.actualGasUsed)
receipt.actualGasUsed = BigInt(parameters.actualGasUsed);
if (parameters.logs)
receipt.logs = parameters.logs.map((log) => (0, log_js_1.formatLog)(log));
if (parameters.receipt)
receipt.receipt = (0, transactionReceipt_js_1.formatTransactionReceipt)(receipt.receipt);
return receipt;
}
//# sourceMappingURL=userOperationReceipt.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"userOperationReceipt.js","sourceRoot":"","sources":["../../../../account-abstraction/utils/formatters/userOperationReceipt.ts"],"names":[],"mappings":";;AAQA,gEAeC;AAtBD,6DAA4D;AAC5D,2FAA0F;AAM1F,SAAgB,0BAA0B,CACxC,UAAmC;IAEnC,MAAM,OAAO,GAAG,EAAE,GAAG,UAAU,EAAqC,CAAA;IAEpE,IAAI,UAAU,CAAC,aAAa;QAC1B,OAAO,CAAC,aAAa,GAAG,MAAM,CAAC,UAAU,CAAC,aAAa,CAAC,CAAA;IAC1D,IAAI,UAAU,CAAC,aAAa;QAC1B,OAAO,CAAC,aAAa,GAAG,MAAM,CAAC,UAAU,CAAC,aAAa,CAAC,CAAA;IAC1D,IAAI,UAAU,CAAC,IAAI;QACjB,OAAO,CAAC,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAA,kBAAS,EAAC,GAAG,CAAC,CAAQ,CAAA;IACpE,IAAI,UAAU,CAAC,OAAO;QACpB,OAAO,CAAC,OAAO,GAAG,IAAA,gDAAwB,EAAC,OAAO,CAAC,OAAc,CAAC,CAAA;IAEpE,OAAO,OAAO,CAAA;AAChB,CAAC"}

View File

@@ -0,0 +1,64 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.formatUserOperationRequest = formatUserOperationRequest;
const toHex_js_1 = require("../../../utils/encoding/toHex.js");
const index_js_1 = require("../../../utils/index.js");
function formatUserOperationRequest(request) {
const rpcRequest = {};
if (typeof request.callData !== 'undefined')
rpcRequest.callData = request.callData;
if (typeof request.callGasLimit !== 'undefined')
rpcRequest.callGasLimit = (0, toHex_js_1.numberToHex)(request.callGasLimit);
if (typeof request.factory !== 'undefined')
rpcRequest.factory = request.factory;
if (typeof request.factoryData !== 'undefined')
rpcRequest.factoryData = request.factoryData;
if (typeof request.initCode !== 'undefined')
rpcRequest.initCode = request.initCode;
if (typeof request.maxFeePerGas !== 'undefined')
rpcRequest.maxFeePerGas = (0, toHex_js_1.numberToHex)(request.maxFeePerGas);
if (typeof request.maxPriorityFeePerGas !== 'undefined')
rpcRequest.maxPriorityFeePerGas = (0, toHex_js_1.numberToHex)(request.maxPriorityFeePerGas);
if (typeof request.nonce !== 'undefined')
rpcRequest.nonce = (0, toHex_js_1.numberToHex)(request.nonce);
if (typeof request.paymaster !== 'undefined')
rpcRequest.paymaster = request.paymaster;
if (typeof request.paymasterAndData !== 'undefined')
rpcRequest.paymasterAndData = request.paymasterAndData || '0x';
if (typeof request.paymasterData !== 'undefined')
rpcRequest.paymasterData = request.paymasterData;
if (typeof request.paymasterPostOpGasLimit !== 'undefined')
rpcRequest.paymasterPostOpGasLimit = (0, toHex_js_1.numberToHex)(request.paymasterPostOpGasLimit);
if (typeof request.paymasterSignature !== 'undefined')
rpcRequest.paymasterSignature = request.paymasterSignature;
if (typeof request.paymasterVerificationGasLimit !== 'undefined')
rpcRequest.paymasterVerificationGasLimit = (0, toHex_js_1.numberToHex)(request.paymasterVerificationGasLimit);
if (typeof request.preVerificationGas !== 'undefined')
rpcRequest.preVerificationGas = (0, toHex_js_1.numberToHex)(request.preVerificationGas);
if (typeof request.sender !== 'undefined')
rpcRequest.sender = request.sender;
if (typeof request.signature !== 'undefined')
rpcRequest.signature = request.signature;
if (typeof request.verificationGasLimit !== 'undefined')
rpcRequest.verificationGasLimit = (0, toHex_js_1.numberToHex)(request.verificationGasLimit);
if (typeof request.authorization !== 'undefined')
rpcRequest.eip7702Auth = formatAuthorization(request.authorization);
return rpcRequest;
}
function formatAuthorization(authorization) {
return {
address: authorization.address,
chainId: (0, toHex_js_1.numberToHex)(authorization.chainId),
nonce: (0, toHex_js_1.numberToHex)(authorization.nonce),
r: authorization.r
? (0, toHex_js_1.numberToHex)(BigInt(authorization.r), { size: 32 })
: (0, index_js_1.pad)('0x', { size: 32 }),
s: authorization.s
? (0, toHex_js_1.numberToHex)(BigInt(authorization.s), { size: 32 })
: (0, index_js_1.pad)('0x', { size: 32 }),
yParity: authorization.yParity
? (0, toHex_js_1.numberToHex)(authorization.yParity, { size: 1 })
: (0, index_js_1.pad)('0x', { size: 32 }),
};
}
//# sourceMappingURL=userOperationRequest.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"userOperationRequest.js","sourceRoot":"","sources":["../../../../account-abstraction/utils/formatters/userOperationRequest.ts"],"names":[],"mappings":"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"}

View File

@@ -0,0 +1,19 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getInitCode = getInitCode;
const concat_js_1 = require("../../../utils/data/concat.js");
function getInitCode(userOperation, options = {}) {
const { forHash } = options;
const { authorization, factory, factoryData } = userOperation;
if (forHash &&
(factory === '0x7702' ||
factory === '0x7702000000000000000000000000000000000000')) {
if (!authorization)
return '0x7702000000000000000000000000000000000000';
return (0, concat_js_1.concat)([authorization.address, factoryData ?? '0x']);
}
if (!factory)
return '0x';
return (0, concat_js_1.concat)([factory, factoryData ?? '0x']);
}
//# sourceMappingURL=getInitCode.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"getInitCode.js","sourceRoot":"","sources":["../../../../account-abstraction/utils/userOperation/getInitCode.ts"],"names":[],"mappings":";;AAQA,kCAmBC;AA3BD,6DAAsD;AAQtD,SAAgB,WAAW,CACzB,aAGC,EACD,UAA8B,EAAE;IAEhC,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAA;IAC3B,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,WAAW,EAAE,GAAG,aAAa,CAAA;IAC7D,IACE,OAAO;QACP,CAAC,OAAO,KAAK,QAAQ;YACnB,OAAO,KAAK,4CAA4C,CAAC,EAC3D,CAAC;QACD,IAAI,CAAC,aAAa;YAAE,OAAO,4CAA4C,CAAA;QACvE,OAAO,IAAA,kBAAM,EAAC,CAAC,aAAa,CAAC,OAAO,EAAE,WAAW,IAAI,IAAI,CAAC,CAAC,CAAA;IAC7D,CAAC;IACD,IAAI,CAAC,OAAO;QAAE,OAAO,IAAI,CAAA;IACzB,OAAO,IAAA,kBAAM,EAAC,CAAC,OAAO,EAAE,WAAW,IAAI,IAAI,CAAC,CAAC,CAAA;AAC/C,CAAC"}

View File

@@ -0,0 +1,81 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getUserOperationHash = getUserOperationHash;
const encodeAbiParameters_js_1 = require("../../../utils/abi/encodeAbiParameters.js");
const keccak256_js_1 = require("../../../utils/hash/keccak256.js");
const hashTypedData_js_1 = require("../../../utils/signature/hashTypedData.js");
const getInitCode_js_1 = require("./getInitCode.js");
const getUserOperationTypedData_js_1 = require("./getUserOperationTypedData.js");
const toPackedUserOperation_js_1 = require("./toPackedUserOperation.js");
function getUserOperationHash(parameters) {
const { chainId, entryPointAddress, entryPointVersion } = parameters;
const userOperation = parameters.userOperation;
const { authorization, callData = '0x', callGasLimit, maxFeePerGas, maxPriorityFeePerGas, nonce, paymasterAndData = '0x', preVerificationGas, sender, verificationGasLimit, } = userOperation;
if (entryPointVersion === '0.8' || entryPointVersion === '0.9')
return (0, hashTypedData_js_1.hashTypedData)((0, getUserOperationTypedData_js_1.getUserOperationTypedData)({
chainId,
entryPointAddress,
userOperation,
}));
const packedUserOp = (() => {
if (entryPointVersion === '0.6') {
const factory = userOperation.initCode?.slice(0, 42);
const factoryData = userOperation.initCode?.slice(42);
const initCode = (0, getInitCode_js_1.getInitCode)({
authorization,
factory,
factoryData,
}, { forHash: true });
return (0, encodeAbiParameters_js_1.encodeAbiParameters)([
{ type: 'address' },
{ type: 'uint256' },
{ type: 'bytes32' },
{ type: 'bytes32' },
{ type: 'uint256' },
{ type: 'uint256' },
{ type: 'uint256' },
{ type: 'uint256' },
{ type: 'uint256' },
{ type: 'bytes32' },
], [
sender,
nonce,
(0, keccak256_js_1.keccak256)(initCode),
(0, keccak256_js_1.keccak256)(callData),
callGasLimit,
verificationGasLimit,
preVerificationGas,
maxFeePerGas,
maxPriorityFeePerGas,
(0, keccak256_js_1.keccak256)(paymasterAndData),
]);
}
if (entryPointVersion === '0.7') {
const packedUserOp = (0, toPackedUserOperation_js_1.toPackedUserOperation)(userOperation, {
forHash: true,
});
return (0, encodeAbiParameters_js_1.encodeAbiParameters)([
{ type: 'address' },
{ type: 'uint256' },
{ type: 'bytes32' },
{ type: 'bytes32' },
{ type: 'bytes32' },
{ type: 'uint256' },
{ type: 'bytes32' },
{ type: 'bytes32' },
], [
packedUserOp.sender,
packedUserOp.nonce,
(0, keccak256_js_1.keccak256)(packedUserOp.initCode),
(0, keccak256_js_1.keccak256)(packedUserOp.callData),
packedUserOp.accountGasLimits,
packedUserOp.preVerificationGas,
packedUserOp.gasFees,
(0, keccak256_js_1.keccak256)(packedUserOp.paymasterAndData),
]);
}
throw new Error(`entryPointVersion "${entryPointVersion}" not supported.`);
})();
return (0, keccak256_js_1.keccak256)((0, encodeAbiParameters_js_1.encodeAbiParameters)([{ type: 'bytes32' }, { type: 'address' }, { type: 'uint256' }], [(0, keccak256_js_1.keccak256)(packedUserOp), entryPointAddress, BigInt(chainId)]));
}
//# sourceMappingURL=getUserOperationHash.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"getUserOperationHash.js","sourceRoot":"","sources":["../../../../account-abstraction/utils/userOperation/getUserOperationHash.ts"],"names":[],"mappings":"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"}

View File

@@ -0,0 +1,32 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getUserOperationTypedData = getUserOperationTypedData;
const toPackedUserOperation_js_1 = require("./toPackedUserOperation.js");
const types = {
PackedUserOperation: [
{ type: 'address', name: 'sender' },
{ type: 'uint256', name: 'nonce' },
{ type: 'bytes', name: 'initCode' },
{ type: 'bytes', name: 'callData' },
{ type: 'bytes32', name: 'accountGasLimits' },
{ type: 'uint256', name: 'preVerificationGas' },
{ type: 'bytes32', name: 'gasFees' },
{ type: 'bytes', name: 'paymasterAndData' },
],
};
function getUserOperationTypedData(parameters) {
const { chainId, entryPointAddress, userOperation } = parameters;
const packedUserOp = (0, toPackedUserOperation_js_1.toPackedUserOperation)(userOperation, { forHash: true });
return {
types,
primaryType: 'PackedUserOperation',
domain: {
name: 'ERC4337',
version: '1',
chainId,
verifyingContract: entryPointAddress,
},
message: packedUserOp,
};
}
//# sourceMappingURL=getUserOperationTypedData.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"getUserOperationTypedData.js","sourceRoot":"","sources":["../../../../account-abstraction/utils/userOperation/getUserOperationTypedData.ts"],"names":[],"mappings":";;AA8BA,8DAkBC;AA5CD,yEAAkE;AAalE,MAAM,KAAK,GAAG;IACZ,mBAAmB,EAAE;QACnB,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE;QACnC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE;QAClC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE;QACnC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE;QACnC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,kBAAkB,EAAE;QAC7C,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,oBAAoB,EAAE;QAC/C,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE;QACpC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,kBAAkB,EAAE;KAC5C;CACO,CAAA;AAEV,SAAgB,yBAAyB,CACvC,UAA+C;IAE/C,MAAM,EAAE,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,GAAG,UAAU,CAAA;IAEhE,MAAM,YAAY,GAAG,IAAA,gDAAqB,EAAC,aAAa,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAA;IAE5E,OAAO;QACL,KAAK;QACL,WAAW,EAAE,qBAAqB;QAClC,MAAM,EAAE;YACN,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,GAAG;YACZ,OAAO;YACP,iBAAiB,EAAE,iBAAiB;SACrC;QACD,OAAO,EAAE,YAAY;KACtB,CAAA;AACH,CAAC"}

View File

@@ -0,0 +1,56 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.toPackedUserOperation = toPackedUserOperation;
const concat_js_1 = require("../../../utils/data/concat.js");
const pad_js_1 = require("../../../utils/data/pad.js");
const size_js_1 = require("../../../utils/data/size.js");
const index_js_1 = require("../../../utils/index.js");
const getInitCode_js_1 = require("./getInitCode.js");
const paymasterSignatureMagic = '0x22e325a297439656';
function toPackedUserOperation(userOperation, options = {}) {
const { callGasLimit, callData, maxPriorityFeePerGas, maxFeePerGas, paymaster, paymasterData, paymasterPostOpGasLimit, paymasterSignature, paymasterVerificationGasLimit, sender, signature = '0x', verificationGasLimit, } = userOperation;
const accountGasLimits = (0, concat_js_1.concat)([
(0, pad_js_1.pad)((0, index_js_1.numberToHex)(verificationGasLimit || 0n), { size: 16 }),
(0, pad_js_1.pad)((0, index_js_1.numberToHex)(callGasLimit || 0n), { size: 16 }),
]);
const initCode = (0, getInitCode_js_1.getInitCode)(userOperation, options);
const gasFees = (0, concat_js_1.concat)([
(0, pad_js_1.pad)((0, index_js_1.numberToHex)(maxPriorityFeePerGas || 0n), { size: 16 }),
(0, pad_js_1.pad)((0, index_js_1.numberToHex)(maxFeePerGas || 0n), { size: 16 }),
]);
const nonce = userOperation.nonce ?? 0n;
const paymasterAndData = paymaster
? (0, concat_js_1.concat)([
paymaster,
(0, pad_js_1.pad)((0, index_js_1.numberToHex)(paymasterVerificationGasLimit || 0n), {
size: 16,
}),
(0, pad_js_1.pad)((0, index_js_1.numberToHex)(paymasterPostOpGasLimit || 0n), {
size: 16,
}),
paymasterData || '0x',
...(paymasterSignature
? options.forHash
? [paymasterSignatureMagic]
: [
paymasterSignature,
(0, pad_js_1.pad)((0, index_js_1.numberToHex)((0, size_js_1.size)(paymasterSignature)), { size: 2 }),
paymasterSignatureMagic,
]
: []),
])
: '0x';
const preVerificationGas = userOperation.preVerificationGas ?? 0n;
return {
accountGasLimits,
callData,
initCode,
gasFees,
nonce,
paymasterAndData,
preVerificationGas,
sender,
signature,
};
}
//# sourceMappingURL=toPackedUserOperation.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"toPackedUserOperation.js","sourceRoot":"","sources":["../../../../account-abstraction/utils/userOperation/toPackedUserOperation.ts"],"names":[],"mappings":";;AAkBA,sDAqEC;AAvFD,6DAAsD;AACtD,uDAAgD;AAChD,yDAAkD;AAClD,sDAAqD;AAKrD,qDAA8C;AAG9C,MAAM,uBAAuB,GAAG,oBAA6B,CAAA;AAO7D,SAAgB,qBAAqB,CACnC,aAA4B,EAC5B,UAAwC,EAAE;IAE1C,MAAM,EACJ,YAAY,EACZ,QAAQ,EACR,oBAAoB,EACpB,YAAY,EACZ,SAAS,EACT,aAAa,EACb,uBAAuB,EACvB,kBAAkB,EAClB,6BAA6B,EAC7B,MAAM,EACN,SAAS,GAAG,IAAI,EAChB,oBAAoB,GACrB,GAAG,aAAgE,CAAA;IAEpE,MAAM,gBAAgB,GAAG,IAAA,kBAAM,EAAC;QAC9B,IAAA,YAAG,EAAC,IAAA,sBAAW,EAAC,oBAAoB,IAAI,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC;QAC1D,IAAA,YAAG,EAAC,IAAA,sBAAW,EAAC,YAAY,IAAI,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC;KACnD,CAAC,CAAA;IACF,MAAM,QAAQ,GAAG,IAAA,4BAAW,EAAC,aAAa,EAAE,OAAO,CAAC,CAAA;IAEpD,MAAM,OAAO,GAAG,IAAA,kBAAM,EAAC;QACrB,IAAA,YAAG,EAAC,IAAA,sBAAW,EAAC,oBAAoB,IAAI,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC;QAC1D,IAAA,YAAG,EAAC,IAAA,sBAAW,EAAC,YAAY,IAAI,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC;KACnD,CAAC,CAAA;IACF,MAAM,KAAK,GAAG,aAAa,CAAC,KAAK,IAAI,EAAE,CAAA;IAMvC,MAAM,gBAAgB,GAAG,SAAS;QAChC,CAAC,CAAC,IAAA,kBAAM,EAAC;YACL,SAAS;YACT,IAAA,YAAG,EAAC,IAAA,sBAAW,EAAC,6BAA6B,IAAI,EAAE,CAAC,EAAE;gBACpD,IAAI,EAAE,EAAE;aACT,CAAC;YACF,IAAA,YAAG,EAAC,IAAA,sBAAW,EAAC,uBAAuB,IAAI,EAAE,CAAC,EAAE;gBAC9C,IAAI,EAAE,EAAE;aACT,CAAC;YACF,aAAa,IAAI,IAAI;YACrB,GAAG,CAAC,kBAAkB;gBACpB,CAAC,CAAC,OAAO,CAAC,OAAO;oBACf,CAAC,CAAC,CAAC,uBAAuB,CAAC;oBAC3B,CAAC,CAAC;wBACE,kBAAmC;wBACnC,IAAA,YAAG,EAAC,IAAA,sBAAW,EAAC,IAAA,cAAI,EAAC,kBAAkB,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;wBACvD,uBAAuB;qBACxB;gBACL,CAAC,CAAC,EAAE,CAAC;SACR,CAAC;QACJ,CAAC,CAAC,IAAI,CAAA;IACR,MAAM,kBAAkB,GAAG,aAAa,CAAC,kBAAkB,IAAI,EAAE,CAAA;IAEjE,OAAO;QACL,gBAAgB;QAChB,QAAQ;QACR,QAAQ;QACR,OAAO;QACP,KAAK;QACL,gBAAgB;QAChB,kBAAkB;QAClB,MAAM;QACN,SAAS;KACV,CAAA;AACH,CAAC"}

View File

@@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.toUserOperation = void 0;
const erc4337_1 = require("ox/erc4337");
exports.toUserOperation = erc4337_1.UserOperation.from;
//# sourceMappingURL=toUserOperation.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"toUserOperation.js","sourceRoot":"","sources":["../../../../account-abstraction/utils/userOperation/toUserOperation.ts"],"names":[],"mappings":";;;AAAA,wCAA0C;AAE7B,QAAA,eAAe,GAAG,uBAAa,CAAC,IAAI,CAAA"}

8
node_modules/viem/_cjs/accounts/generateMnemonic.js generated vendored Normal file
View File

@@ -0,0 +1,8 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.generateMnemonic = generateMnemonic;
const bip39_1 = require("@scure/bip39");
function generateMnemonic(wordlist, strength) {
return (0, bip39_1.generateMnemonic)(wordlist, strength);
}
//# sourceMappingURL=generateMnemonic.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"generateMnemonic.js","sourceRoot":"","sources":["../../accounts/generateMnemonic.ts"],"names":[],"mappings":";;AAaA,4CAKC;AAlBD,wCAAoE;AAapE,SAAgB,gBAAgB,CAC9B,QAAkB,EAClB,QAA6B;IAE7B,OAAO,IAAA,wBAAiB,EAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;AAC9C,CAAC"}

View File

@@ -0,0 +1,9 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.generatePrivateKey = generatePrivateKey;
const secp256k1_1 = require("@noble/curves/secp256k1");
const toHex_js_1 = require("../utils/encoding/toHex.js");
function generatePrivateKey() {
return (0, toHex_js_1.toHex)(secp256k1_1.secp256k1.utils.randomPrivateKey());
}
//# sourceMappingURL=generatePrivateKey.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"generatePrivateKey.js","sourceRoot":"","sources":["../../accounts/generatePrivateKey.ts"],"names":[],"mappings":";;AAaA,gDAEC;AAfD,uDAAmD;AAInD,yDAAuE;AASvE,SAAgB,kBAAkB;IAChC,OAAO,IAAA,gBAAK,EAAC,qBAAS,CAAC,KAAK,CAAC,gBAAgB,EAAE,CAAC,CAAA;AAClD,CAAC"}

15
node_modules/viem/_cjs/accounts/hdKeyToAccount.js generated vendored Normal file
View File

@@ -0,0 +1,15 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.hdKeyToAccount = hdKeyToAccount;
const toHex_js_1 = require("../utils/encoding/toHex.js");
const privateKeyToAccount_js_1 = require("./privateKeyToAccount.js");
function hdKeyToAccount(hdKey_, { accountIndex = 0, addressIndex = 0, changeIndex = 0, path, ...options } = {}) {
const hdKey = hdKey_.derive(path || `m/44'/60'/${accountIndex}'/${changeIndex}/${addressIndex}`);
const account = (0, privateKeyToAccount_js_1.privateKeyToAccount)((0, toHex_js_1.toHex)(hdKey.privateKey), options);
return {
...account,
getHdKey: () => hdKey,
source: 'hd',
};
}
//# sourceMappingURL=hdKeyToAccount.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"hdKeyToAccount.js","sourceRoot":"","sources":["../../accounts/hdKeyToAccount.ts"],"names":[],"mappings":";;AAsBA,wCAmBC;AAvCD,yDAAuE;AACvE,qEAIiC;AAejC,SAAgB,cAAc,CAC5B,MAAa,EACb,EACE,YAAY,GAAG,CAAC,EAChB,YAAY,GAAG,CAAC,EAChB,WAAW,GAAG,CAAC,EACf,IAAI,EACJ,GAAG,OAAO,KACe,EAAE;IAE7B,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CACzB,IAAI,IAAI,aAAa,YAAY,KAAK,WAAW,IAAI,YAAY,EAAE,CACpE,CAAA;IACD,MAAM,OAAO,GAAG,IAAA,4CAAmB,EAAC,IAAA,gBAAK,EAAC,KAAK,CAAC,UAAW,CAAC,EAAE,OAAO,CAAC,CAAA;IACtE,OAAO;QACL,GAAG,OAAO;QACV,QAAQ,EAAE,GAAG,EAAE,CAAC,KAAK;QACrB,MAAM,EAAE,IAAI;KACb,CAAA;AACH,CAAC"}

52
node_modules/viem/_cjs/accounts/index.js generated vendored Normal file
View File

@@ -0,0 +1,52 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.traditionalChinese = exports.spanish = exports.simplifiedChinese = exports.portuguese = exports.korean = exports.japanese = exports.italian = exports.french = exports.english = exports.czech = exports.signTypedData = exports.signTransaction = exports.signMessage = exports.signAuthorization = exports.sign = exports.setSignEntropy = exports.publicKeyToAddress = exports.privateKeyToAddress = exports.parseAccount = exports.toAccount = exports.privateKeyToAccount = exports.mnemonicToAccount = exports.hdKeyToAccount = exports.generatePrivateKey = exports.generateMnemonic = exports.serializeSignature = exports.signatureToHex = exports.nonceManager = exports.createNonceManager = exports.HDKey = void 0;
var bip32_1 = require("@scure/bip32");
Object.defineProperty(exports, "HDKey", { enumerable: true, get: function () { return bip32_1.HDKey; } });
var nonceManager_js_1 = require("../utils/nonceManager.js");
Object.defineProperty(exports, "createNonceManager", { enumerable: true, get: function () { return nonceManager_js_1.createNonceManager; } });
Object.defineProperty(exports, "nonceManager", { enumerable: true, get: function () { return nonceManager_js_1.nonceManager; } });
var serializeSignature_js_1 = require("../utils/signature/serializeSignature.js");
Object.defineProperty(exports, "signatureToHex", { enumerable: true, get: function () { return serializeSignature_js_1.serializeSignature; } });
Object.defineProperty(exports, "serializeSignature", { enumerable: true, get: function () { return serializeSignature_js_1.serializeSignature; } });
var generateMnemonic_js_1 = require("./generateMnemonic.js");
Object.defineProperty(exports, "generateMnemonic", { enumerable: true, get: function () { return generateMnemonic_js_1.generateMnemonic; } });
var generatePrivateKey_js_1 = require("./generatePrivateKey.js");
Object.defineProperty(exports, "generatePrivateKey", { enumerable: true, get: function () { return generatePrivateKey_js_1.generatePrivateKey; } });
var hdKeyToAccount_js_1 = require("./hdKeyToAccount.js");
Object.defineProperty(exports, "hdKeyToAccount", { enumerable: true, get: function () { return hdKeyToAccount_js_1.hdKeyToAccount; } });
var mnemonicToAccount_js_1 = require("./mnemonicToAccount.js");
Object.defineProperty(exports, "mnemonicToAccount", { enumerable: true, get: function () { return mnemonicToAccount_js_1.mnemonicToAccount; } });
var privateKeyToAccount_js_1 = require("./privateKeyToAccount.js");
Object.defineProperty(exports, "privateKeyToAccount", { enumerable: true, get: function () { return privateKeyToAccount_js_1.privateKeyToAccount; } });
var toAccount_js_1 = require("./toAccount.js");
Object.defineProperty(exports, "toAccount", { enumerable: true, get: function () { return toAccount_js_1.toAccount; } });
var parseAccount_js_1 = require("./utils/parseAccount.js");
Object.defineProperty(exports, "parseAccount", { enumerable: true, get: function () { return parseAccount_js_1.parseAccount; } });
var privateKeyToAddress_js_1 = require("./utils/privateKeyToAddress.js");
Object.defineProperty(exports, "privateKeyToAddress", { enumerable: true, get: function () { return privateKeyToAddress_js_1.privateKeyToAddress; } });
var publicKeyToAddress_js_1 = require("./utils/publicKeyToAddress.js");
Object.defineProperty(exports, "publicKeyToAddress", { enumerable: true, get: function () { return publicKeyToAddress_js_1.publicKeyToAddress; } });
var sign_js_1 = require("./utils/sign.js");
Object.defineProperty(exports, "setSignEntropy", { enumerable: true, get: function () { return sign_js_1.setSignEntropy; } });
Object.defineProperty(exports, "sign", { enumerable: true, get: function () { return sign_js_1.sign; } });
var signAuthorization_js_1 = require("./utils/signAuthorization.js");
Object.defineProperty(exports, "signAuthorization", { enumerable: true, get: function () { return signAuthorization_js_1.signAuthorization; } });
var signMessage_js_1 = require("./utils/signMessage.js");
Object.defineProperty(exports, "signMessage", { enumerable: true, get: function () { return signMessage_js_1.signMessage; } });
var signTransaction_js_1 = require("./utils/signTransaction.js");
Object.defineProperty(exports, "signTransaction", { enumerable: true, get: function () { return signTransaction_js_1.signTransaction; } });
var signTypedData_js_1 = require("./utils/signTypedData.js");
Object.defineProperty(exports, "signTypedData", { enumerable: true, get: function () { return signTypedData_js_1.signTypedData; } });
var wordlists_js_1 = require("./wordlists.js");
Object.defineProperty(exports, "czech", { enumerable: true, get: function () { return wordlists_js_1.czech; } });
Object.defineProperty(exports, "english", { enumerable: true, get: function () { return wordlists_js_1.english; } });
Object.defineProperty(exports, "french", { enumerable: true, get: function () { return wordlists_js_1.french; } });
Object.defineProperty(exports, "italian", { enumerable: true, get: function () { return wordlists_js_1.italian; } });
Object.defineProperty(exports, "japanese", { enumerable: true, get: function () { return wordlists_js_1.japanese; } });
Object.defineProperty(exports, "korean", { enumerable: true, get: function () { return wordlists_js_1.korean; } });
Object.defineProperty(exports, "portuguese", { enumerable: true, get: function () { return wordlists_js_1.portuguese; } });
Object.defineProperty(exports, "simplifiedChinese", { enumerable: true, get: function () { return wordlists_js_1.simplifiedChinese; } });
Object.defineProperty(exports, "spanish", { enumerable: true, get: function () { return wordlists_js_1.spanish; } });
Object.defineProperty(exports, "traditionalChinese", { enumerable: true, get: function () { return wordlists_js_1.traditionalChinese; } });
//# sourceMappingURL=index.js.map

1
node_modules/viem/_cjs/accounts/index.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../accounts/index.ts"],"names":[],"mappings":";;;AACA,sCAAoC;AAA3B,8FAAA,KAAK,OAAA;AAEd,4DAMiC;AAJ/B,qHAAA,kBAAkB,OAAA;AAGlB,+GAAA,YAAY,OAAA;AAEd,kFAOiD;AAF/C,uHAAA,kBAAkB,OAAkB;AACpC,2HAAA,kBAAkB,OAAA;AAEpB,6DAG8B;AAD5B,uHAAA,gBAAgB,OAAA;AAElB,iEAGgC;AAD9B,2HAAA,kBAAkB,OAAA;AAEpB,yDAI4B;AAD1B,mHAAA,cAAc,OAAA;AAEhB,+DAI+B;AAD7B,yHAAA,iBAAiB,OAAA;AAEnB,mEAIiC;AAD/B,6HAAA,mBAAmB,OAAA;AAErB,+CAAmE;AAAjC,yGAAA,SAAS,OAAA;AAW3C,2DAGgC;AAD9B,+GAAA,YAAY,OAAA;AAEd,yEAGuC;AADrC,6HAAA,mBAAmB,OAAA;AAErB,uEAGsC;AADpC,2HAAA,kBAAkB,OAAA;AAEpB,2CAMwB;AAFtB,yGAAA,cAAc,OAAA;AACd,+FAAA,IAAI,OAAA;AAEN,qEAKqC;AADnC,yHAAA,iBAAiB,OAAA;AAEnB,yDAK+B;AAD7B,6GAAA,WAAW,OAAA;AAEb,iEAKmC;AADjC,qHAAA,eAAe,OAAA;AAEjB,6DAKiC;AAD/B,iHAAA,aAAa,OAAA;AAEf,+CAWuB;AAVrB,qGAAA,KAAK,OAAA;AACL,uGAAA,OAAO,OAAA;AACP,sGAAA,MAAM,OAAA;AACN,uGAAA,OAAO,OAAA;AACP,wGAAA,QAAQ,OAAA;AACR,sGAAA,MAAM,OAAA;AACN,0GAAA,UAAU,OAAA;AACV,iHAAA,iBAAiB,OAAA;AACjB,uGAAA,OAAO,OAAA;AACP,kHAAA,kBAAkB,OAAA"}

11
node_modules/viem/_cjs/accounts/mnemonicToAccount.js generated vendored Normal file
View File

@@ -0,0 +1,11 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.mnemonicToAccount = mnemonicToAccount;
const bip32_1 = require("@scure/bip32");
const bip39_1 = require("@scure/bip39");
const hdKeyToAccount_js_1 = require("./hdKeyToAccount.js");
function mnemonicToAccount(mnemonic, { passphrase, ...hdKeyOpts } = {}) {
const seed = (0, bip39_1.mnemonicToSeedSync)(mnemonic, passphrase);
return (0, hdKeyToAccount_js_1.hdKeyToAccount)(bip32_1.HDKey.fromMasterSeed(seed), hdKeyOpts);
}
//# sourceMappingURL=mnemonicToAccount.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"mnemonicToAccount.js","sourceRoot":"","sources":["../../accounts/mnemonicToAccount.ts"],"names":[],"mappings":";;AAsBA,8CAMC;AA5BD,wCAAoC;AACpC,wCAAiD;AAGjD,2DAI4B;AAc5B,SAAgB,iBAAiB,CAC/B,QAAgB,EAChB,EAAE,UAAU,EAAE,GAAG,SAAS,KAA+B,EAAE;IAE3D,MAAM,IAAI,GAAG,IAAA,0BAAkB,EAAC,QAAQ,EAAE,UAAU,CAAC,CAAA;IACrD,OAAO,IAAA,kCAAc,EAAC,aAAK,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,SAAS,CAAC,CAAA;AAC9D,CAAC"}

42
node_modules/viem/_cjs/accounts/privateKeyToAccount.js generated vendored Normal file
View File

@@ -0,0 +1,42 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.privateKeyToAccount = privateKeyToAccount;
const secp256k1_1 = require("@noble/curves/secp256k1");
const toHex_js_1 = require("../utils/encoding/toHex.js");
const toAccount_js_1 = require("./toAccount.js");
const publicKeyToAddress_js_1 = require("./utils/publicKeyToAddress.js");
const sign_js_1 = require("./utils/sign.js");
const signAuthorization_js_1 = require("./utils/signAuthorization.js");
const signMessage_js_1 = require("./utils/signMessage.js");
const signTransaction_js_1 = require("./utils/signTransaction.js");
const signTypedData_js_1 = require("./utils/signTypedData.js");
function privateKeyToAccount(privateKey, options = {}) {
const { nonceManager } = options;
const publicKey = (0, toHex_js_1.toHex)(secp256k1_1.secp256k1.getPublicKey(privateKey.slice(2), false));
const address = (0, publicKeyToAddress_js_1.publicKeyToAddress)(publicKey);
const account = (0, toAccount_js_1.toAccount)({
address,
nonceManager,
async sign({ hash }) {
return (0, sign_js_1.sign)({ hash, privateKey, to: 'hex' });
},
async signAuthorization(authorization) {
return (0, signAuthorization_js_1.signAuthorization)({ ...authorization, privateKey });
},
async signMessage({ message }) {
return (0, signMessage_js_1.signMessage)({ message, privateKey });
},
async signTransaction(transaction, { serializer } = {}) {
return (0, signTransaction_js_1.signTransaction)({ privateKey, transaction, serializer });
},
async signTypedData(typedData) {
return (0, signTypedData_js_1.signTypedData)({ ...typedData, privateKey });
},
});
return {
...account,
publicKey,
source: 'privateKey',
};
}
//# sourceMappingURL=privateKeyToAccount.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"privateKeyToAccount.js","sourceRoot":"","sources":["../../accounts/privateKeyToAccount.ts"],"names":[],"mappings":";;AA0CA,kDAiCC;AA3ED,uDAAmD;AAGnD,yDAAuE;AAEvE,iDAAmE;AAEnE,yEAGsC;AACtC,6CAA0D;AAC1D,uEAAgE;AAChE,2DAA+E;AAC/E,mEAGmC;AACnC,+DAGiC;AAqBjC,SAAgB,mBAAmB,CACjC,UAAe,EACf,UAAsC,EAAE;IAExC,MAAM,EAAE,YAAY,EAAE,GAAG,OAAO,CAAA;IAChC,MAAM,SAAS,GAAG,IAAA,gBAAK,EAAC,qBAAS,CAAC,YAAY,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAA;IAC3E,MAAM,OAAO,GAAG,IAAA,0CAAkB,EAAC,SAAS,CAAC,CAAA;IAE7C,MAAM,OAAO,GAAG,IAAA,wBAAS,EAAC;QACxB,OAAO;QACP,YAAY;QACZ,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE;YACjB,OAAO,IAAA,cAAI,EAAC,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,CAAA;QAC9C,CAAC;QACD,KAAK,CAAC,iBAAiB,CAAC,aAAa;YACnC,OAAO,IAAA,wCAAiB,EAAC,EAAE,GAAG,aAAa,EAAE,UAAU,EAAE,CAAC,CAAA;QAC5D,CAAC;QACD,KAAK,CAAC,WAAW,CAAC,EAAE,OAAO,EAAE;YAC3B,OAAO,IAAA,4BAAW,EAAC,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC,CAAA;QAC7C,CAAC;QACD,KAAK,CAAC,eAAe,CAAC,WAAW,EAAE,EAAE,UAAU,EAAE,GAAG,EAAE;YACpD,OAAO,IAAA,oCAAe,EAAC,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC,CAAA;QACjE,CAAC;QACD,KAAK,CAAC,aAAa,CAAC,SAAS;YAC3B,OAAO,IAAA,gCAAa,EAAC,EAAE,GAAG,SAAS,EAAE,UAAU,EAAS,CAAC,CAAA;QAC3D,CAAC;KACF,CAAC,CAAA;IAEF,OAAO;QACL,GAAG,OAAO;QACV,SAAS;QACT,MAAM,EAAE,YAAY;KACA,CAAA;AACxB,CAAC"}

29
node_modules/viem/_cjs/accounts/toAccount.js generated vendored Normal file
View File

@@ -0,0 +1,29 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.toAccount = toAccount;
const address_js_1 = require("../errors/address.js");
const isAddress_js_1 = require("../utils/address/isAddress.js");
function toAccount(source) {
if (typeof source === 'string') {
if (!(0, isAddress_js_1.isAddress)(source, { strict: false }))
throw new address_js_1.InvalidAddressError({ address: source });
return {
address: source,
type: 'json-rpc',
};
}
if (!(0, isAddress_js_1.isAddress)(source.address, { strict: false }))
throw new address_js_1.InvalidAddressError({ address: source.address });
return {
address: source.address,
nonceManager: source.nonceManager,
sign: source.sign,
signAuthorization: source.signAuthorization,
signMessage: source.signMessage,
signTransaction: source.signTransaction,
signTypedData: source.signTypedData,
source: 'custom',
type: 'local',
};
}
//# sourceMappingURL=toAccount.js.map

1
node_modules/viem/_cjs/accounts/toAccount.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"toAccount.js","sourceRoot":"","sources":["../../accounts/toAccount.ts"],"names":[],"mappings":";;AAkCA,8BAyBC;AAvDD,qDAG6B;AAE7B,gEAGsC;AAsBtC,SAAgB,SAAS,CACvB,MAAqB;IAErB,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;QAC/B,IAAI,CAAC,IAAA,wBAAS,EAAC,MAAM,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;YACvC,MAAM,IAAI,gCAAmB,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAA;QACpD,OAAO;YACL,OAAO,EAAE,MAAM;YACf,IAAI,EAAE,UAAU;SACsB,CAAA;IAC1C,CAAC;IAED,IAAI,CAAC,IAAA,wBAAS,EAAC,MAAM,CAAC,OAAO,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;QAC/C,MAAM,IAAI,gCAAmB,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC,CAAA;IAC5D,OAAO;QACL,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,YAAY,EAAE,MAAM,CAAC,YAAY;QACjC,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,iBAAiB,EAAE,MAAM,CAAC,iBAAiB;QAC3C,WAAW,EAAE,MAAM,CAAC,WAAW;QAC/B,eAAe,EAAE,MAAM,CAAC,eAAe;QACvC,aAAa,EAAE,MAAM,CAAC,aAAa;QACnC,MAAM,EAAE,QAAQ;QAChB,IAAI,EAAE,OAAO;KACyB,CAAA;AAC1C,CAAC"}

3
node_modules/viem/_cjs/accounts/types.js generated vendored Normal file
View File

@@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=types.js.map

1
node_modules/viem/_cjs/accounts/types.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../accounts/types.ts"],"names":[],"mappings":""}

View File

@@ -0,0 +1,9 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.parseAccount = parseAccount;
function parseAccount(account) {
if (typeof account === 'string')
return { address: account, type: 'json-rpc' };
return account;
}
//# sourceMappingURL=parseAccount.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"parseAccount.js","sourceRoot":"","sources":["../../../accounts/utils/parseAccount.ts"],"names":[],"mappings":";;AAOA,oCAMC;AAND,SAAgB,YAAY,CAC1B,OAAyB;IAEzB,IAAI,OAAO,OAAO,KAAK,QAAQ;QAC7B,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAS,CAAA;IACtD,OAAO,OAAc,CAAA;AACvB,CAAC"}

View File

@@ -0,0 +1,11 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.privateKeyToAddress = privateKeyToAddress;
const secp256k1_1 = require("@noble/curves/secp256k1");
const toHex_js_1 = require("../../utils/encoding/toHex.js");
const publicKeyToAddress_js_1 = require("./publicKeyToAddress.js");
function privateKeyToAddress(privateKey) {
const publicKey = (0, toHex_js_1.bytesToHex)(secp256k1_1.secp256k1.getPublicKey(privateKey.slice(2), false));
return (0, publicKeyToAddress_js_1.publicKeyToAddress)(publicKey);
}
//# sourceMappingURL=privateKeyToAddress.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"privateKeyToAddress.js","sourceRoot":"","sources":["../../../accounts/utils/privateKeyToAddress.ts"],"names":[],"mappings":";;AA0BA,kDAKC;AA/BD,uDAAmD;AAKnD,4DAGsC;AACtC,mEAGgC;AAchC,SAAgB,mBAAmB,CAAC,UAAe;IACjD,MAAM,SAAS,GAAG,IAAA,qBAAU,EAC1B,qBAAS,CAAC,YAAY,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CACnD,CAAA;IACD,OAAO,IAAA,0CAAkB,EAAC,SAAS,CAAC,CAAA;AACtC,CAAC"}

Some files were not shown because too many files have changed in this diff Show More