@pimlico/alto 0.0.0-main.20240612T111639 → 0.0.0-prool.20240609T212210
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/cli/alto.js +59 -28
- package/esm/cli/alto.js.map +1 -1
- package/esm/cli/config/bundler.d.ts +41 -47
- package/esm/cli/config/bundler.js +77 -75
- package/esm/cli/config/bundler.js.map +1 -1
- package/esm/cli/config/index.js +18 -2
- package/esm/cli/config/index.js.map +1 -1
- package/esm/cli/config/options.js +13 -16
- package/esm/cli/config/options.js.map +1 -1
- package/esm/cli/customTransport.js +11 -7
- package/esm/cli/customTransport.js.map +1 -1
- package/esm/cli/handler.js +28 -48
- package/esm/cli/handler.js.map +1 -1
- package/esm/cli/index.js +19 -3
- package/esm/cli/index.js.map +1 -1
- package/esm/cli/instrumentation.js +22 -20
- package/esm/cli/instrumentation.js.map +1 -1
- package/esm/cli/setupServer.js +21 -17
- package/esm/cli/setupServer.js.map +1 -1
- package/esm/cli/util.js +5 -1
- package/esm/cli/util.js.map +1 -1
- package/esm/executor/executor.js +86 -71
- package/esm/executor/executor.js.map +1 -1
- package/esm/executor/executorManager.js +11 -7
- package/esm/executor/executorManager.js.map +1 -1
- package/esm/executor/index.js +20 -4
- package/esm/executor/index.js.map +1 -1
- package/esm/executor/senderManager.js +12 -8
- package/esm/executor/senderManager.js.map +1 -1
- package/esm/executor/test/utils.js +28 -22
- package/esm/executor/test/utils.js.map +1 -1
- package/esm/executor/utils.js +61 -31
- package/esm/executor/utils.js.map +1 -1
- package/esm/mempool/index.js +20 -4
- package/esm/mempool/index.js.map +1 -1
- package/esm/mempool/mempool.js +64 -58
- package/esm/mempool/mempool.js.map +1 -1
- package/esm/mempool/monitoring.js +5 -1
- package/esm/mempool/monitoring.js.map +1 -1
- package/esm/mempool/nullMempool.js +5 -1
- package/esm/mempool/nullMempool.js.map +1 -1
- package/esm/mempool/reputationManager.js +52 -51
- package/esm/mempool/reputationManager.js.map +1 -1
- package/esm/mempool/store.js +5 -1
- package/esm/mempool/store.js.map +1 -1
- package/esm/rpc/EntryPointSimulationsV07.d.ts +1 -5
- package/esm/rpc/EntryPointSimulationsV07.js +51 -45
- package/esm/rpc/EntryPointSimulationsV07.js.map +1 -1
- package/esm/rpc/ExecuteSimulator.js +5 -2
- package/esm/rpc/ExecuteSimulator.js.map +1 -1
- package/esm/rpc/gasEstimation.js +72 -69
- package/esm/rpc/gasEstimation.js.map +1 -1
- package/esm/rpc/index.js +20 -4
- package/esm/rpc/index.js.map +1 -1
- package/esm/rpc/nonceQueuer.js +20 -16
- package/esm/rpc/nonceQueuer.js.map +1 -1
- package/esm/rpc/rpcHandler.js +108 -92
- package/esm/rpc/rpcHandler.js.map +1 -1
- package/esm/rpc/server.js +58 -32
- package/esm/rpc/server.js.map +1 -1
- package/esm/rpc/validation/BundlerCollectorTracerV06.js +5 -1
- package/esm/rpc/validation/BundlerCollectorTracerV06.js.map +1 -1
- package/esm/rpc/validation/BundlerCollectorTracerV07.js +5 -1
- package/esm/rpc/validation/BundlerCollectorTracerV07.js.map +1 -1
- package/esm/rpc/validation/SafeValidator.d.ts +6 -2
- package/esm/rpc/validation/SafeValidator.js +252 -91
- package/esm/rpc/validation/SafeValidator.js.map +1 -1
- package/esm/rpc/validation/TracerResultParserV06.js +30 -26
- package/esm/rpc/validation/TracerResultParserV06.js.map +1 -1
- package/esm/rpc/validation/TracerResultParserV07.js +38 -35
- package/esm/rpc/validation/TracerResultParserV07.js.map +1 -1
- package/esm/rpc/validation/UnsafeValidator.d.ts +1 -2
- package/esm/rpc/validation/UnsafeValidator.js +107 -80
- package/esm/rpc/validation/UnsafeValidator.js.map +1 -1
- package/esm/rpc/validation/index.js +18 -2
- package/esm/rpc/validation/index.js.map +1 -1
- package/esm/rpc/validation/tracer.js +37 -7
- package/esm/rpc/validation/tracer.js.map +1 -1
- package/esm/types/contracts/BundleBulker.js +4 -1
- package/esm/types/contracts/BundleBulker.js.map +1 -1
- package/esm/types/contracts/CallEngine.js +4 -1
- package/esm/types/contracts/CallEngine.js.map +1 -1
- package/esm/types/contracts/CodeHashGetter.js +5 -2
- package/esm/types/contracts/CodeHashGetter.js.map +1 -1
- package/esm/types/contracts/EntryPoint.js +7 -4
- package/esm/types/contracts/EntryPoint.js.map +1 -1
- package/esm/types/contracts/EntryPointSimulations.d.ts +1 -0
- package/esm/types/contracts/EntryPointSimulations.js +6 -1942
- package/esm/types/contracts/EntryPointSimulations.js.map +1 -1
- package/esm/types/contracts/IOpInflator.js +4 -1
- package/esm/types/contracts/IOpInflator.js.map +1 -1
- package/esm/types/contracts/IPaymaster.js +4 -1
- package/esm/types/contracts/IPaymaster.js.map +1 -1
- package/esm/types/contracts/Inflator.js +4 -1
- package/esm/types/contracts/Inflator.js.map +1 -1
- package/esm/types/contracts/PerOpInflator.js +4 -1
- package/esm/types/contracts/PerOpInflator.js.map +1 -1
- package/esm/types/contracts/PimlicoEntryPointSimulations.d.ts +1 -1
- package/esm/types/contracts/PimlicoEntryPointSimulations.js +5 -2
- package/esm/types/contracts/PimlicoEntryPointSimulations.js.map +1 -1
- package/esm/types/contracts/SenderCreator.js +5 -2
- package/esm/types/contracts/SenderCreator.js.map +1 -1
- package/esm/types/contracts/SimpleAccountFactory.js +5 -2
- package/esm/types/contracts/SimpleAccountFactory.js.map +1 -1
- package/esm/types/contracts/TestOpcodesAccount.js +5 -2
- package/esm/types/contracts/TestOpcodesAccount.js.map +1 -1
- package/esm/types/contracts/TestOpcodesAccountFactory.js +5 -2
- package/esm/types/contracts/TestOpcodesAccountFactory.js.map +1 -1
- package/esm/types/contracts/TestStorageAccount.js +5 -2
- package/esm/types/contracts/TestStorageAccount.js.map +1 -1
- package/esm/types/contracts/index.js +32 -16
- package/esm/types/contracts/index.js.map +1 -1
- package/esm/types/gasPrice.js +17 -14
- package/esm/types/gasPrice.js.map +1 -1
- package/esm/types/index.js +26 -10
- package/esm/types/index.js.map +1 -1
- package/esm/types/interfaces.js +2 -1
- package/esm/types/mempool.js +10 -5
- package/esm/types/mempool.js.map +1 -1
- package/esm/types/schemas.d.ts +38 -38
- package/esm/types/schemas.js +284 -254
- package/esm/types/schemas.js.map +1 -1
- package/esm/types/test/validationTestErrors.js +5 -2
- package/esm/types/test/validationTestErrors.js.map +1 -1
- package/esm/types/utils.js +9 -5
- package/esm/types/utils.js.map +1 -1
- package/esm/types/validation.d.ts +12 -12
- package/esm/types/validation.js +142 -139
- package/esm/types/validation.js.map +1 -1
- package/esm/utils/bigInt.js +7 -2
- package/esm/utils/bigInt.js.map +1 -1
- package/esm/utils/compressionHandler.js +11 -7
- package/esm/utils/compressionHandler.js.map +1 -1
- package/esm/utils/gasPriceManager.js +57 -30
- package/esm/utils/gasPriceManager.js.map +1 -1
- package/esm/utils/helpers.js +10 -5
- package/esm/utils/helpers.js.map +1 -1
- package/esm/utils/index.d.ts +1 -0
- package/esm/utils/index.js +26 -9
- package/esm/utils/index.js.map +1 -1
- package/esm/utils/logger.js +19 -10
- package/esm/utils/logger.js.map +1 -1
- package/esm/utils/metrics.js +24 -20
- package/esm/utils/metrics.js.map +1 -1
- package/esm/utils/rpc-reply.js +3 -1
- package/esm/utils/rpc-reply.js.map +1 -1
- package/esm/utils/test.js +67 -36
- package/esm/utils/test.js.map +1 -1
- package/esm/utils/toArgs.d.ts +36 -0
- package/esm/utils/toArgs.js +87 -0
- package/esm/utils/toArgs.js.map +1 -0
- package/esm/utils/userop.d.ts +2 -2
- package/esm/utils/userop.js +108 -63
- package/esm/utils/userop.js.map +1 -1
- package/esm/utils/validation.js +99 -64
- package/esm/utils/validation.js.map +1 -1
- package/lib/cli/config/bundler.d.ts +0 -6
- package/lib/cli/config/bundler.js +0 -1
- package/lib/cli/config/bundler.js.map +1 -1
- package/lib/cli/config/options.js +0 -6
- package/lib/cli/config/options.js.map +1 -1
- package/lib/cli/handler.js +1 -25
- package/lib/cli/handler.js.map +1 -1
- package/lib/executor/executor.js +2 -15
- package/lib/executor/executor.js.map +1 -1
- package/lib/mempool/mempool.js +7 -5
- package/lib/mempool/mempool.js.map +1 -1
- package/lib/mempool/reputationManager.js +3 -7
- package/lib/mempool/reputationManager.js.map +1 -1
- package/lib/rpc/EntryPointSimulationsV07.d.ts +1 -5
- package/lib/rpc/EntryPointSimulationsV07.js +2 -3
- package/lib/rpc/EntryPointSimulationsV07.js.map +1 -1
- package/lib/rpc/gasEstimation.js +3 -7
- package/lib/rpc/gasEstimation.js.map +1 -1
- package/lib/rpc/rpcHandler.js +7 -18
- package/lib/rpc/rpcHandler.js.map +1 -1
- package/lib/rpc/server.js +0 -4
- package/lib/rpc/server.js.map +1 -1
- package/lib/rpc/validation/SafeValidator.d.ts +6 -2
- package/lib/rpc/validation/SafeValidator.js +205 -48
- package/lib/rpc/validation/SafeValidator.js.map +1 -1
- package/lib/rpc/validation/TracerResultParserV07.js +2 -6
- package/lib/rpc/validation/TracerResultParserV07.js.map +1 -1
- package/lib/rpc/validation/UnsafeValidator.d.ts +1 -2
- package/lib/rpc/validation/UnsafeValidator.js +68 -45
- package/lib/rpc/validation/UnsafeValidator.js.map +1 -1
- package/lib/types/contracts/EntryPointSimulations.d.ts +1 -0
- package/lib/types/contracts/EntryPointSimulations.js +3 -1942
- package/lib/types/contracts/EntryPointSimulations.js.map +1 -1
- package/lib/types/contracts/PimlicoEntryPointSimulations.d.ts +1 -1
- package/lib/types/contracts/PimlicoEntryPointSimulations.js +2 -2
- package/lib/types/contracts/PimlicoEntryPointSimulations.js.map +1 -1
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.js +1 -0
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/toArgs.d.ts +36 -0
- package/lib/utils/toArgs.js +87 -0
- package/lib/utils/toArgs.js.map +1 -0
- package/lib/utils/userop.d.ts +2 -2
- package/lib/utils/userop.js +25 -2
- package/lib/utils/userop.js.map +1 -1
- package/package.json +3 -2
- package/esm/index.d.ts +0 -2
- package/esm/index.js +0 -2
- package/esm/index.js.map +0 -1
- package/lib/index.d.ts +0 -2
- package/lib/index.js +0 -4
- package/lib/index.js.map +0 -1
package/esm/utils/test.js
CHANGED
|
@@ -1,17 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.parseSenderAddressError = exports.getUserOpHash = exports.deployContract = exports.createClients = exports.launchAnvil = void 0;
|
|
1
27
|
// biome-ignore lint/nursery/noNodejsModules: <explanation>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const anvilProcess = exec("anvil");
|
|
12
|
-
const client = createPublicClient({
|
|
13
|
-
chain: foundry,
|
|
14
|
-
transport: http()
|
|
28
|
+
const child_process_1 = require("child_process");
|
|
29
|
+
const types_1 = require("../types/index.js");
|
|
30
|
+
const sentry = __importStar(require("@sentry/node"));
|
|
31
|
+
const abitype_1 = require("abitype");
|
|
32
|
+
const viem_1 = require("viem");
|
|
33
|
+
const accounts_1 = require("viem/accounts");
|
|
34
|
+
const chains_1 = require("viem/chains");
|
|
35
|
+
const zod_validation_error_1 = require("zod-validation-error");
|
|
36
|
+
const launchAnvil = async () => {
|
|
37
|
+
const anvilProcess = (0, child_process_1.exec)("anvil");
|
|
38
|
+
const client = (0, viem_1.createPublicClient)({
|
|
39
|
+
chain: chains_1.foundry,
|
|
40
|
+
transport: (0, viem_1.http)()
|
|
15
41
|
});
|
|
16
42
|
// keep calling getNetwork every 2ms until it doesn't throw
|
|
17
43
|
while (true) {
|
|
@@ -25,10 +51,11 @@ export const launchAnvil = async () => {
|
|
|
25
51
|
}
|
|
26
52
|
return anvilProcess;
|
|
27
53
|
};
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
54
|
+
exports.launchAnvil = launchAnvil;
|
|
55
|
+
const createClients = async (signer) => {
|
|
56
|
+
const publicClient = (0, viem_1.createPublicClient)({
|
|
57
|
+
chain: chains_1.foundry,
|
|
58
|
+
transport: (0, viem_1.http)("http://127.0.0.1:8545")
|
|
32
59
|
});
|
|
33
60
|
try {
|
|
34
61
|
await publicClient.getChainId();
|
|
@@ -36,16 +63,16 @@ export const createClients = async (signer) => {
|
|
|
36
63
|
catch {
|
|
37
64
|
throw new Error("anvil is not running");
|
|
38
65
|
}
|
|
39
|
-
const testClient = createTestClient({
|
|
40
|
-
chain: foundry,
|
|
41
|
-
transport: http("http://127.0.0.1:8545"),
|
|
66
|
+
const testClient = (0, viem_1.createTestClient)({
|
|
67
|
+
chain: chains_1.foundry,
|
|
68
|
+
transport: (0, viem_1.http)("http://127.0.0.1:8545"),
|
|
42
69
|
mode: "anvil"
|
|
43
70
|
});
|
|
44
71
|
testClient.key;
|
|
45
|
-
const walletClient = createWalletClient({
|
|
46
|
-
chain: foundry,
|
|
47
|
-
transport: http("http://127.0.0.1:8545"),
|
|
48
|
-
account: signer ?? privateKeyToAccount(generatePrivateKey())
|
|
72
|
+
const walletClient = (0, viem_1.createWalletClient)({
|
|
73
|
+
chain: chains_1.foundry,
|
|
74
|
+
transport: (0, viem_1.http)("http://127.0.0.1:8545"),
|
|
75
|
+
account: signer ?? (0, accounts_1.privateKeyToAccount)((0, accounts_1.generatePrivateKey)())
|
|
49
76
|
});
|
|
50
77
|
// : createWalletClient({
|
|
51
78
|
// chain: foundry,
|
|
@@ -58,7 +85,8 @@ export const createClients = async (signer) => {
|
|
|
58
85
|
wallet: walletClient
|
|
59
86
|
};
|
|
60
87
|
};
|
|
61
|
-
|
|
88
|
+
exports.createClients = createClients;
|
|
89
|
+
const deployContract = async (clients, deployer, abi,
|
|
62
90
|
// biome-ignore lint/suspicious/noExplicitAny: it's a generic type
|
|
63
91
|
args, bytecode) => {
|
|
64
92
|
if (clients.wallet.chain === undefined) {
|
|
@@ -79,18 +107,19 @@ args, bytecode) => {
|
|
|
79
107
|
}
|
|
80
108
|
return contractAddress;
|
|
81
109
|
};
|
|
82
|
-
|
|
110
|
+
exports.deployContract = deployContract;
|
|
111
|
+
function getUserOpHash(op, entryPoint, chainId) {
|
|
83
112
|
const hashedUserOp = {
|
|
84
113
|
sender: op.sender,
|
|
85
114
|
nonce: op.nonce,
|
|
86
|
-
initCodeHash: keccak256(op.initCode),
|
|
87
|
-
callDataHash: keccak256(op.callData),
|
|
115
|
+
initCodeHash: (0, viem_1.keccak256)(op.initCode),
|
|
116
|
+
callDataHash: (0, viem_1.keccak256)(op.callData),
|
|
88
117
|
callGasLimit: op.callGasLimit,
|
|
89
118
|
verificationGasLimit: op.verificationGasLimit,
|
|
90
119
|
preVerificationGas: op.preVerificationGas,
|
|
91
120
|
maxFeePerGas: op.maxFeePerGas,
|
|
92
121
|
maxPriorityFeePerGas: op.maxPriorityFeePerGas,
|
|
93
|
-
paymasterAndDataHash: keccak256(op.paymasterAndData)
|
|
122
|
+
paymasterAndDataHash: (0, viem_1.keccak256)(op.paymasterAndData)
|
|
94
123
|
};
|
|
95
124
|
const userOpType = {
|
|
96
125
|
components: [
|
|
@@ -108,17 +137,18 @@ export function getUserOpHash(op, entryPoint, chainId) {
|
|
|
108
137
|
name: "hashedUserOp",
|
|
109
138
|
type: "tuple"
|
|
110
139
|
};
|
|
111
|
-
const encoded = encodeAbiParameters([userOpType], [{ ...hashedUserOp }]);
|
|
140
|
+
const encoded = (0, viem_1.encodeAbiParameters)([userOpType], [{ ...hashedUserOp }]);
|
|
112
141
|
// remove leading word (total length) and trailing word (zero-length signature)
|
|
113
|
-
const userOpHash = keccak256(encoded);
|
|
114
|
-
const enc = encodeAbiParameters(parseAbiParameters("bytes32, address, uint256"), [userOpHash, entryPoint, BigInt(chainId)]);
|
|
115
|
-
return keccak256(enc);
|
|
142
|
+
const userOpHash = (0, viem_1.keccak256)(encoded);
|
|
143
|
+
const enc = (0, viem_1.encodeAbiParameters)((0, abitype_1.parseAbiParameters)("bytes32, address, uint256"), [userOpHash, entryPoint, BigInt(chainId)]);
|
|
144
|
+
return (0, viem_1.keccak256)(enc);
|
|
116
145
|
}
|
|
117
|
-
|
|
118
|
-
|
|
146
|
+
exports.getUserOpHash = getUserOpHash;
|
|
147
|
+
const parseSenderAddressError = (e) => {
|
|
148
|
+
const entryPointExecutionErrorSchemaParsing = types_1.entryPointExecutionErrorSchemaV06.safeParse(e);
|
|
119
149
|
if (!entryPointExecutionErrorSchemaParsing.success) {
|
|
120
150
|
sentry.captureException(e);
|
|
121
|
-
throw fromZodError(entryPointExecutionErrorSchemaParsing.error);
|
|
151
|
+
throw (0, zod_validation_error_1.fromZodError)(entryPointExecutionErrorSchemaParsing.error);
|
|
122
152
|
}
|
|
123
153
|
const errorData = entryPointExecutionErrorSchemaParsing.data;
|
|
124
154
|
if (errorData.errorName !== "SenderAddressResult") {
|
|
@@ -127,4 +157,5 @@ export const parseSenderAddressError = (e) => {
|
|
|
127
157
|
}
|
|
128
158
|
return errorData.args.sender;
|
|
129
159
|
};
|
|
160
|
+
exports.parseSenderAddressError = parseSenderAddressError;
|
|
130
161
|
//# sourceMappingURL=test.js.map
|
package/esm/utils/test.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test.js","sourceRoot":"","sources":["../../utils/test.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,
|
|
1
|
+
{"version":3,"file":"test.js","sourceRoot":"","sources":["../../utils/test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2DAA2D;AAC3D,iDAAuD;AAEvD,uCAA+D;AAC/D,qDAAsC;AACtC,qCAAsD;AACtD,+BAaa;AACb,4CAAuE;AACvE,wCAAiD;AACjD,+DAAmD;AAQ5C,MAAM,WAAW,GAAG,KAAK,IAA2B,EAAE;IACzD,MAAM,YAAY,GAAG,IAAA,oBAAI,EAAC,OAAO,CAAC,CAAA;IAElC,MAAM,MAAM,GAAG,IAAA,yBAAkB,EAAC;QAC9B,KAAK,EAAE,gBAAO;QACd,SAAS,EAAE,IAAA,WAAI,GAAE;KACpB,CAAC,CAAA;IAEF,2DAA2D;IAC3D,OAAO,IAAI,EAAE,CAAC;QACV,IAAI,CAAC;YACD,MAAM,MAAM,CAAC,UAAU,EAAE,CAAA;YACzB,MAAK;QACT,CAAC;QAAC,OAAO,EAAE,EAAE,CAAC;YACV,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAA;QAC1D,CAAC;IACL,CAAC;IAED,OAAO,YAAY,CAAA;AACvB,CAAC,CAAA;AAnBY,QAAA,WAAW,eAmBvB;AAEM,MAAM,aAAa,GAAG,KAAK,EAAE,MAAgB,EAAo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AAA;QAC1B,MAAM,IAAA,mCAAY,EAAC,qCAAqC,CAAC,KAAK,CAAC,CAAA;IACnE,CAAC;IACD,MAAM,SAAS,GAAG,qCAAqC,CAAC,IAAI,CAAA;IAC5D,IAAI,SAAS,CAAC,SAAS,KAAK,qBAAqB,EAAE,CAAC;QAChD,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAA;QAC1B,MAAM,CAAC,CAAA;IACX,CAAC;IACD,OAAO,SAAS,CAAC,IAAI,CAAC,MAAM,CAAA;AAChC,CAAC,CAAA;AAbY,QAAA,uBAAuB,2BAanC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export type ExtractPathReturnType = {
|
|
2
|
+
id: number | undefined;
|
|
3
|
+
path: string;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* Parse a request url into an object containing the id and path.
|
|
7
|
+
*
|
|
8
|
+
* @param request The request url.
|
|
9
|
+
* @returns The parsed request context or undefined.
|
|
10
|
+
*/
|
|
11
|
+
export declare function extractPath(request: string): ExtractPathReturnType;
|
|
12
|
+
/**
|
|
13
|
+
* Strips ANSI color codes from a string.
|
|
14
|
+
*
|
|
15
|
+
* @param message The string to strip.
|
|
16
|
+
* @returns The stripped string.
|
|
17
|
+
*/
|
|
18
|
+
export declare function stripColors(message: string): string;
|
|
19
|
+
export type ToArgsParameters = {
|
|
20
|
+
[key: string]: Record<string, string> | string | readonly string[] | boolean | number | bigint | undefined;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Converts an object of options to an array of command line arguments.
|
|
24
|
+
*
|
|
25
|
+
* @param options The options object.
|
|
26
|
+
* @returns The command line arguments.
|
|
27
|
+
*/
|
|
28
|
+
export declare function toArgs(parameters: ToArgsParameters): string[];
|
|
29
|
+
/**
|
|
30
|
+
* Converts a camelCase string to a flag case string.
|
|
31
|
+
*
|
|
32
|
+
* @param key The camelCase string.
|
|
33
|
+
* @returns The flag case string.
|
|
34
|
+
*/
|
|
35
|
+
export declare function toFlagCase(key: string): string;
|
|
36
|
+
//# sourceMappingURL=toArgs.d.ts.map
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toFlagCase = exports.toArgs = exports.stripColors = exports.extractPath = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Parse a request url into an object containing the id and path.
|
|
6
|
+
*
|
|
7
|
+
* @param request The request url.
|
|
8
|
+
* @returns The parsed request context or undefined.
|
|
9
|
+
*/
|
|
10
|
+
function extractPath(request) {
|
|
11
|
+
const host = "http://localhost"; // Dummy value for URL constructor
|
|
12
|
+
const url = new URL(`${host}${request ?? "/"}`);
|
|
13
|
+
const [idOrPath, ...pathname] = url.pathname
|
|
14
|
+
.split("/")
|
|
15
|
+
.filter((part) => part !== "");
|
|
16
|
+
const id = !Number.isNaN(Number(idOrPath)) && Number(idOrPath) > 0
|
|
17
|
+
? Number(idOrPath)
|
|
18
|
+
: undefined;
|
|
19
|
+
const path = `/${typeof id === "number"
|
|
20
|
+
? pathname.join("/")
|
|
21
|
+
: [idOrPath, ...pathname].join("/")}`;
|
|
22
|
+
return { id, path };
|
|
23
|
+
}
|
|
24
|
+
exports.extractPath = extractPath;
|
|
25
|
+
const ansiColorRegex =
|
|
26
|
+
// biome-ignore lint/suspicious/noControlCharactersInRegex: <explanation>
|
|
27
|
+
/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g;
|
|
28
|
+
/**
|
|
29
|
+
* Strips ANSI color codes from a string.
|
|
30
|
+
*
|
|
31
|
+
* @param message The string to strip.
|
|
32
|
+
* @returns The stripped string.
|
|
33
|
+
*/
|
|
34
|
+
function stripColors(message) {
|
|
35
|
+
return message.replace(ansiColorRegex, "");
|
|
36
|
+
}
|
|
37
|
+
exports.stripColors = stripColors;
|
|
38
|
+
/**
|
|
39
|
+
* Converts an object of options to an array of command line arguments.
|
|
40
|
+
*
|
|
41
|
+
* @param options The options object.
|
|
42
|
+
* @returns The command line arguments.
|
|
43
|
+
*/
|
|
44
|
+
function toArgs(parameters) {
|
|
45
|
+
return Object.entries(parameters).flatMap(([key, value]) => {
|
|
46
|
+
if (value === undefined) {
|
|
47
|
+
return [];
|
|
48
|
+
}
|
|
49
|
+
if (Array.isArray(value)) {
|
|
50
|
+
return [toFlagCase(key), value.join(",")];
|
|
51
|
+
}
|
|
52
|
+
if (typeof value === "object" && value !== null) {
|
|
53
|
+
return Object.entries(value).flatMap(([subKey, subValue]) => {
|
|
54
|
+
if (subValue === undefined) {
|
|
55
|
+
return [];
|
|
56
|
+
}
|
|
57
|
+
const flag = toFlagCase(key);
|
|
58
|
+
const value = `${subKey}: ${subValue}`;
|
|
59
|
+
return [flag, value];
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
const flag = toFlagCase(key);
|
|
63
|
+
if (value === false) {
|
|
64
|
+
return [flag, "false"];
|
|
65
|
+
}
|
|
66
|
+
if (value === true) {
|
|
67
|
+
return [flag];
|
|
68
|
+
}
|
|
69
|
+
const stringified = value.toString();
|
|
70
|
+
if (stringified === "") {
|
|
71
|
+
return [flag];
|
|
72
|
+
}
|
|
73
|
+
return [flag, stringified];
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
exports.toArgs = toArgs;
|
|
77
|
+
/**
|
|
78
|
+
* Converts a camelCase string to a flag case string.
|
|
79
|
+
*
|
|
80
|
+
* @param key The camelCase string.
|
|
81
|
+
* @returns The flag case string.
|
|
82
|
+
*/
|
|
83
|
+
function toFlagCase(key) {
|
|
84
|
+
return `--${key.replace(/[A-Z]/g, (match) => `-${match.toLowerCase()}`)}`;
|
|
85
|
+
}
|
|
86
|
+
exports.toFlagCase = toFlagCase;
|
|
87
|
+
//# sourceMappingURL=toArgs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toArgs.js","sourceRoot":"","sources":["../../utils/to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;GAKG;AACH,SAAgB,UAAU,CAAC,GAAW;IAClC,OAAO,KAAK,GAAG,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,KAAK,CAAC,WAAW,EAAE,EAAE,CAAC,EAAE,CAAA;AAC7E,CAAC;AAFD,gCAEC"}
|
package/esm/utils/userop.d.ts
CHANGED
|
@@ -36,10 +36,10 @@ export declare function toPackedUserOperation(unpackedUserOperation: UserOperati
|
|
|
36
36
|
export declare function deepHexlify(obj: any): any;
|
|
37
37
|
export declare function getAddressFromInitCodeOrPaymasterAndData(data: Hex): Address | null;
|
|
38
38
|
export declare const transactionIncluded: (isVersion06: boolean, txHash: HexData32, publicClient: PublicClient, entryPoint: Address) => Promise<{
|
|
39
|
-
|
|
39
|
+
status: "included" | "reverted" | "failed" | "not_found";
|
|
40
|
+
[userOperationHash: HexData32]: {
|
|
40
41
|
accountDeployed: boolean;
|
|
41
42
|
};
|
|
42
|
-
status: "included" | "reverted" | "failed" | "not_found";
|
|
43
43
|
}>;
|
|
44
44
|
export declare const getUserOperationHashV06: (userOperation: UserOperationV06, entryPointAddress: Address, chainId: number) => `0x${string}`;
|
|
45
45
|
export declare const getUserOperationHashV07: (userOperation: PackedUserOperation, entryPointAddress: Address, chainId: number) => `0x${string}`;
|