@pepu-chain/sdk 0.2.1 → 0.2.2
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/README.md +1 -2
- package/dist/aa/kernel.cjs +10 -9
- package/dist/aa/kernel.js +5 -4
- package/dist/aa/react-direct.cjs +10 -9
- package/dist/aa/react-direct.cjs.map +1 -1
- package/dist/aa/react-direct.js +5 -4
- package/dist/aa/react-direct.js.map +1 -1
- package/dist/aa/react.cjs +5 -4
- package/dist/aa/react.cjs.map +1 -1
- package/dist/aa/react.js +3 -2
- package/dist/aa/react.js.map +1 -1
- package/dist/aa.cjs +18 -17
- package/dist/aa.js +5 -4
- package/dist/chunk-4GEC7GUU.cjs +283 -0
- package/dist/chunk-4GEC7GUU.cjs.map +1 -0
- package/dist/{chunk-PHM3ZORG.cjs → chunk-4L4CHIXE.cjs} +9 -9
- package/dist/{chunk-PHM3ZORG.cjs.map → chunk-4L4CHIXE.cjs.map} +1 -1
- package/dist/{chunk-A5LP2UCS.cjs → chunk-65Y5UCQ7.cjs} +2 -276
- package/dist/chunk-65Y5UCQ7.cjs.map +1 -0
- package/dist/{chunk-7MNJF2OB.cjs → chunk-DNWWZWUW.cjs} +4 -4
- package/dist/{chunk-7MNJF2OB.cjs.map → chunk-DNWWZWUW.cjs.map} +1 -1
- package/dist/{chunk-D52PADVY.js → chunk-GFKIM7HT.js} +25 -2
- package/dist/chunk-GFKIM7HT.js.map +1 -0
- package/dist/{chunk-IY3ALPUJ.js → chunk-GIZNH65Q.js} +5 -273
- package/dist/chunk-GIZNH65Q.js.map +1 -0
- package/dist/{chunk-WANILJZQ.cjs → chunk-HTCX46RJ.cjs} +25 -2
- package/dist/chunk-HTCX46RJ.cjs.map +1 -0
- package/dist/{chunk-KVG3AYYR.js → chunk-NHPWXIA2.js} +4 -4
- package/dist/{chunk-KVG3AYYR.js.map → chunk-NHPWXIA2.js.map} +1 -1
- package/dist/{chunk-ZB6SVBK4.js → chunk-QIDMFFAQ.js} +4 -4
- package/dist/{chunk-ZB6SVBK4.js.map → chunk-QIDMFFAQ.js.map} +1 -1
- package/dist/{chunk-IB2FSPMJ.js → chunk-QZKUPCUD.js} +3 -3
- package/dist/{chunk-IB2FSPMJ.js.map → chunk-QZKUPCUD.js.map} +1 -1
- package/dist/chunk-RSPAN44L.js +276 -0
- package/dist/chunk-RSPAN44L.js.map +1 -0
- package/dist/{chunk-NVOPDXTA.cjs → chunk-UQH4ZAXD.cjs} +10 -10
- package/dist/{chunk-NVOPDXTA.cjs.map → chunk-UQH4ZAXD.cjs.map} +1 -1
- package/dist/{chunk-BGALSKAF.cjs → chunk-VYMAZVIK.cjs} +4 -4
- package/dist/{chunk-BGALSKAF.cjs.map → chunk-VYMAZVIK.cjs.map} +1 -1
- package/dist/{chunk-F2R473FR.js → chunk-XR5ONV2Y.js} +3 -3
- package/dist/{chunk-F2R473FR.js.map → chunk-XR5ONV2Y.js.map} +1 -1
- package/dist/combo/react.cjs +61 -13
- package/dist/combo/react.cjs.map +1 -1
- package/dist/combo/react.d.cts +14 -2
- package/dist/combo/react.d.ts +14 -2
- package/dist/combo/react.guard.js +1 -1
- package/dist/combo/react.js +58 -11
- package/dist/combo/react.js.map +1 -1
- package/dist/combo.cjs +41 -26
- package/dist/combo.cjs.map +1 -1
- package/dist/combo.d.cts +11 -0
- package/dist/combo.d.ts +11 -0
- package/dist/combo.js +31 -16
- package/dist/combo.js.map +1 -1
- package/dist/index.cjs +10 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/paymaster.cjs +37 -36
- package/dist/paymaster.cjs.map +1 -1
- package/dist/paymaster.js +3 -2
- package/dist/paymaster.js.map +1 -1
- package/dist/react.cjs +4 -3
- package/dist/react.cjs.map +1 -1
- package/dist/react.js +3 -2
- package/dist/react.js.map +1 -1
- package/dist/session/kernel.cjs +18 -17
- package/dist/session/kernel.js +6 -5
- package/package.json +1 -1
- package/dist/chunk-A5LP2UCS.cjs.map +0 -1
- package/dist/chunk-D52PADVY.js.map +0 -1
- package/dist/chunk-IY3ALPUJ.js.map +0 -1
- package/dist/chunk-WANILJZQ.cjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/abi/kernelFactory.ts","../src/abi/entryPointV07.ts","../src/aa/probes.ts","../src/aa/status.ts"],"names":["parseAbi","PepuConfigError","redactSecrets","PepuBundlerError","getContract","pepuMainnet","resolvePepuEndpoints","PEPU_ENV"],"mappings":";;;;;;;;;AA6BO,IAAM,mBAAmBA,aAAA,CAAS;AAAA,EACvC,kDAAA;AAAA,EACA,+EAAA;AAAA,EACA;AACF,CAAC;AAOM,IAAM,kCAAA,GACX;ACdK,IAAM,mBAAmBA,aAAAA,CAAS;AAAA,EACvC,6EAAA;AAAA,EACA,4DAAA;AAAA,EACA,6CAAA;AAAA,EACA,8EAAA;AAAA,EACA,wJAAA;AAAA,EACA,gEAAA;AAAA,EACA;AACF,CAAC;;;ACuBD,IAAM,eAAA,GAAkB;AAAA,EACtB,uBAAA;AAAA,EACA,8BAAA;AAAA,EACA,6BAAA;AAAA,EACA,4BAAA;AAAA,EACA,kCAAA;AAAA,EACA;AACF,CAAA;AAGO,IAAM,wBAAA,GAA2B;AAAA,EACtC,uBAAA;AAAA,EACA,8BAAA;AAAA,EACA;AACF,CAAA;AAEA,IAAM,gBAAA,GAAmB,MAAA;AASzB,SAAS,iBAAiB,KAAA,EAAiE;AACzF,EAAA,IAAI,CAAC,KAAA,IAAS,KAAA,CAAM,IAAA,KAAS,kBAAkB,OAAO,KAAA;AACtD,EAAA,MAAM,OAAA,GAAU,MAAM,OAAA,IAAW,EAAA;AACjC,EAAA,IAAI,8BAAA,CAA+B,IAAA,CAAK,OAAO,CAAA,EAAG,OAAO,IAAA;AACzD,EAAA,OAAO,CAAC,2DAAA,CAA4D,IAAA,CAAK,OAAO,CAAA;AAClF;AAEA,SAAS,OAAO,GAAA,EAAqB;AACnC,EAA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EAAA;AACN,EAAA,OAAO;AAAA,IACL,SAAA;AAAA,IACA,SAAA,EAAW,aAAa,QAAA,GAAW,MAAA;AAAA,IACnC,OAAA,EAAS,EAAE,UAAA,EAAY,UAAA,KAAe,IAAA,EAAM,GAAI,MAAA,GAAS,EAAE,KAAA,EAAO,MAAA,EAAO,GAAI,EAAC,EAAG;AAAA,IACjF,SAAA,EAAW;AAAA,MACT,YAAY,YAAA,KAAiB,IAAA;AAAA,MAC7B,GAAI,MAAA,GAAS,EAAE,KAAA,EAAO,MAAA,KAAW,EAAC;AAAA,MAClC,GAAI,UAAA,KAAe,MAAA,GAAY,EAAE,UAAA,KAAe;AAAC,KACnD;AAAA,IACA,MAAA;AAAA,IACA;AAAA,GACF;AACF","file":"chunk-BGALSKAF.cjs","sourcesContent":["import { parseAbi } from \"viem\";\n\n/**\n * ZeroDev Kernel v3 account factory ABI, at\n * `0xaac5D4240AF87249B3f71BC8E4A2cae074A3E419` (deployed on PEPU mainnet\n * only; see `pepuContracts.kernelFactory` in `../contracts.js`).\n *\n * Verified live against mainnet 2026-09-24 via `eth_call`:\n * - `implementation()` returns `0xbAC849bB641841b44E965fb01A4Bf5F074F84B4d` —\n * ZeroDev's Kernel v3.1 singleton implementation address, deployed at the\n * same address on every chain that has it via CREATE2.\n * - `getAddress(bytes,bytes32)`, called with empty `data` and a zero salt,\n * returns a computed address without reverting.\n * - `createAccount(bytes,bytes32)`, simulated (not sent) with the same\n * empty `data` and zero salt via `eth_call`, returns the **same** address\n * `getAddress` computed for those inputs — exactly the counterfactual-\n * address behavior a CREATE2 account factory is supposed to have.\n *\n * What this package does NOT ship: a helper that encodes the `data`\n * argument (Kernel v3.1's `initialize(...)` calldata — root validator,\n * hook, validator data, hook data, init config). No account has ever been\n * created through this factory on PEPU yet (its transaction history is\n * empty as of the verification date above), so there was nothing on-chain\n * to check a hand-rolled encoding against, and guessing one here would be\n * exactly the kind of invented byte layout this package's rules forbid.\n * Use ZeroDev's own `@zerodev/sdk` (or the public Kernel contracts source)\n * to build that payload, then pass the resulting bytes into\n * `getAddress`/`createAccount` from this ABI.\n */\nexport const kernelFactoryAbi = parseAbi([\n \"function implementation() view returns (address)\",\n \"function getAddress(bytes calldata data, bytes32 salt) view returns (address)\",\n \"function createAccount(bytes calldata data, bytes32 salt) payable returns (address)\",\n]);\n\n/**\n * The verified Kernel v3.1 singleton implementation address that\n * `kernelFactoryAbi`'s `implementation()` resolves to on PEPU mainnet. Same\n * address ZeroDev uses across every chain that has this Kernel version.\n */\nexport const KERNEL_V3_1_IMPLEMENTATION_ADDRESS =\n \"0xbAC849bB641841b44E965fb01A4Bf5F074F84B4d\" as const;\n","import { parseAbi } from \"viem\";\n\n/**\n * ERC-4337 EntryPoint v0.7 ABI — the subset a dapp actually needs to manage\n * a smart account's gas deposit and read its nonce, at the canonical address\n * `0x0000000071727De22E5E9d8BAf0edAc6f37da032` (deployed on PEPU mainnet\n * only; see `pepuContracts.entryPoint07` in `../contracts.js`).\n *\n * This is NOT the full `IEntryPoint` interface (no `handleOps`,\n * `simulateValidation`, etc.) — those are normally called by a bundler, and\n * PEPU has no publicly hosted bundler yet (see `getSponsorshipStatus` in\n * `../aa/status.js`). This ABI only covers deposit/nonce management, which works\n * today with a plain viem wallet client and no bundler at all.\n *\n * Verified live against mainnet 2026-09-24 via `eth_call`:\n * - `getNonce(address,uint192)` for the zero address/key returns `0`.\n * - `balanceOf(address)` for the zero address returns `0`.\n * - `getDepositInfo(address)` for the zero address returns a 5-word\n * (all-zero) tuple, matching the v0.7 `DepositInfo` struct shape\n * `(uint256 deposit, bool staked, uint96 stake, uint32 unstakeDelaySec,\n * uint48 withdrawTime)` field-for-field.\n * `depositTo`/`withdrawTo` share the same `IStakeManager` interface as the\n * verified `getDepositInfo`/`balanceOf` pair and are standard across every\n * EntryPoint version; they were not separately simulated (both mutate\n * state, and simulating a withdrawal from an empty deposit would only prove\n * it reverts, not that it works).\n */\nexport const entryPointV07Abi = parseAbi([\n \"function getNonce(address sender, uint192 key) view returns (uint256 nonce)\",\n \"function balanceOf(address account) view returns (uint256)\",\n \"function depositTo(address account) payable\",\n \"function withdrawTo(address payable withdrawAddress, uint256 withdrawAmount)\",\n \"function getDepositInfo(address account) view returns ((uint256 deposit, bool staked, uint96 stake, uint32 unstakeDelaySec, uint48 withdrawTime) info)\",\n \"event Deposited(address indexed account, uint256 totalDeposit)\",\n \"event Withdrawn(address indexed account, address withdrawAddress, uint256 amount)\",\n]);\n","import type { Address, PublicClient } from \"viem\";\n\nimport { entryPointV07Abi } from \"../abi/entryPointV07.js\";\nimport { pepuMainnet } from \"../chains.js\";\nimport { getContract } from \"../contracts.js\";\nimport { PepuBundlerError, PepuConfigError } from \"../errors.js\";\nimport { redactSecrets } from \"./describe.js\";\n\n/** Minimal fetch signature, so tests and non-browser hosts can inject one. */\nexport type FetchLike = (input: string, init?: RequestInit) => Promise<Response>;\n\nexport interface ProbeOptions {\n fetch?: FetchLike;\n /** Per-request timeout. Default 8000. */\n timeoutMs?: number;\n}\n\nexport interface BundlerProbeResult {\n ok: boolean;\n chainId?: number;\n entryPoints?: Address[];\n /**\n * `true` when the method exists. Each method is called with deliberately empty\n * (invalid) params, so nothing is ever sent on-chain: an \"invalid params\" or\n * validation answer means the method exists, a \"method not found\" answer\n * (including Alto's \"Invalid discriminator value\") means it does not.\n */\n supportedMethods?: Record<string, boolean>;\n /** Required methods (see `REQUIRED_BUNDLER_METHODS`) the bundler lacks. Empty when all are present. */\n missingRequiredMethods?: string[];\n latencyMs: number;\n error?: PepuBundlerError;\n}\n\nexport interface PaymasterProbeResult {\n ok: boolean;\n /** `GET <origin>/health` answered `{ status: \"ok\" }`. */\n health?: boolean;\n /** Body of `GET <origin>/v2/free-tier` when the service exposes it. */\n freeTier?: unknown;\n /**\n * `true` when the URL answered `pm_getPaymasterStubData` with a stub result,\n * `false` when it did not answer JSON-RPC at all. A JSON-RPC denial (no\n * credential, unknown sender) leaves it `undefined`: the endpoint speaks\n * ERC-7677 but the probe has no credential, so a stub cannot be judged. Read\n * `erc7677` for the three-way answer.\n */\n erc7677StubOk?: boolean;\n /**\n * `\"stub-ok\"`: a stub came back. `\"needs-credential\"`: the endpoint speaks ERC-7677\n * JSON-RPC and answered with an error (no credential, unknown sender), so the stub\n * check is not applicable without a client token. `\"not-responding\"`: no JSON-RPC answer.\n */\n erc7677?: \"stub-ok\" | \"needs-credential\" | \"not-responding\";\n latencyMs: number;\n error?: PepuBundlerError;\n}\n\nconst BUNDLER_METHODS = [\n \"eth_sendUserOperation\",\n \"eth_estimateUserOperationGas\",\n \"eth_getUserOperationReceipt\",\n \"eth_getUserOperationByHash\",\n \"pimlico_getUserOperationGasPrice\",\n \"zd_getUserOperationGasPrice\",\n] as const;\n\n/** Methods a bundler must support to be usable for PEPU sponsored UserOperations. */\nexport const REQUIRED_BUNDLER_METHODS = [\n \"eth_sendUserOperation\",\n \"eth_estimateUserOperationGas\",\n \"eth_getUserOperationReceipt\",\n] as const;\n\nconst METHOD_NOT_FOUND = -32601;\n\n/**\n * A bundler answers a method that does not exist with \"method not found\". Alto\n * (Pimlico) also reports bad params of a KNOWN method with code -32601 and a\n * \"Validation error: ...\" message, and an unknown method as \"Validation error:\n * Invalid discriminator value\". So -32601 means unsupported unless the message is\n * a params validation error that is not the discriminator one.\n */\nfunction isMethodNotFound(error: { code?: number; message?: string } | undefined): boolean {\n if (!error || error.code !== METHOD_NOT_FOUND) return false;\n const message = error.message ?? \"\";\n if (/invalid discriminator value/i.test(message)) return true;\n return !/validation error|invalid params|must contain|required at/i.test(message);\n}\n\nfunction hostOf(url: string): string {\n try {\n return new URL(url).host;\n } catch {\n return \"the configured host\";\n }\n}\n\nfunction checkUrl(url: string, label: string): void {\n let u: URL;\n try {\n u = new URL(url);\n } catch {\n throw new PepuConfigError(\"CONFIG_BAD_URL\", `${label} is not a valid URL.`);\n }\n if (u.protocol !== \"http:\" && u.protocol !== \"https:\") {\n throw new PepuConfigError(\"CONFIG_BAD_URL\", `${label} must be an http(s) URL.`);\n }\n}\n\nasync function timedFetch(f: FetchLike, url: string, init: RequestInit, timeoutMs: number): Promise<Response> {\n const ctl = new AbortController();\n const t = setTimeout(() => ctl.abort(), timeoutMs);\n try {\n return await f(url, { ...init, signal: ctl.signal });\n } finally {\n clearTimeout(t);\n }\n}\n\ninterface RpcReply {\n result?: unknown;\n error?: { code?: number; message?: string; data?: unknown };\n}\n\nasync function rpc(f: FetchLike, url: string, method: string, params: unknown[], timeoutMs: number): Promise<RpcReply> {\n const res = await timedFetch(\n f,\n url,\n {\n method: \"POST\",\n headers: { \"content-type\": \"application/json\" },\n body: JSON.stringify({ jsonrpc: \"2.0\", id: 1, method, params }),\n },\n timeoutMs,\n );\n let body: unknown;\n try {\n body = await res.json();\n } catch {\n throw new Error(`HTTP ${res.status} with a non-JSON body`);\n }\n if (!body || typeof body !== \"object\") throw new Error(`HTTP ${res.status} with an unexpected body`);\n return body as RpcReply;\n}\n\nfunction unreachable(url: string, e: unknown): PepuBundlerError {\n const reason = e instanceof Error && e.name === \"AbortError\" ? \"timed out\" : redactSecrets(e instanceof Error ? e.message : String(e)).replace(/https?:\\/\\/\\S+/g, \"[url]\");\n return new PepuBundlerError(\"BUNDLER_UNREACHABLE\", `Could not reach ${hostOf(url)}: ${reason}`, { cause: e });\n}\n\n/**\n * Probe a bundler URL: `eth_chainId`, `eth_supportedEntryPoints` and a\n * capability check of the methods PEPU apps use (a method answered with\n * anything but \"method not found\" counts as supported; nothing is sent\n * on-chain). Never throws for network trouble; returns `ok: false` with a\n * `BUNDLER_UNREACHABLE` error. Throws `CONFIG_BAD_URL` for a malformed URL.\n *\n * @example\n * const r = await probeBundler(\"https://bundler.example.com\");\n * if (!r.ok) console.log(r.error?.hint);\n */\nexport async function probeBundler(url: string, o: ProbeOptions = {}): Promise<BundlerProbeResult> {\n checkUrl(url, \"Bundler URL\");\n const f: FetchLike = o.fetch ?? ((i, init) => fetch(i, init));\n const timeoutMs = o.timeoutMs ?? 8000;\n const started = Date.now();\n try {\n const chain = await rpc(f, url, \"eth_chainId\", [], timeoutMs);\n const eps = await rpc(f, url, \"eth_supportedEntryPoints\", [], timeoutMs);\n const chainId = typeof chain.result === \"string\" ? Number(BigInt(chain.result)) : undefined;\n const entryPoints = Array.isArray(eps.result) ? (eps.result as Address[]) : undefined;\n const supportedMethods: Record<string, boolean> = {};\n for (const m of BUNDLER_METHODS) {\n try {\n const r = await rpc(f, url, m, [], timeoutMs);\n supportedMethods[m] = !isMethodNotFound(r.error);\n } catch {\n supportedMethods[m] = false;\n }\n }\n const ep07 = getContract(pepuMainnet.id, \"entryPoint07\");\n const want = ep07?.status === \"deployed\" ? ep07.address.toLowerCase() : undefined;\n const missing = REQUIRED_BUNDLER_METHODS.filter((m) => supportedMethods[m] !== true);\n const chainAndEntryPointOk =\n chainId === pepuMainnet.id &&\n (want === undefined || (entryPoints?.some((a) => a.toLowerCase() === want) ?? false));\n const ok = chainAndEntryPointOk && missing.length === 0;\n const out: BundlerProbeResult = {\n ok,\n latencyMs: Date.now() - started,\n supportedMethods,\n missingRequiredMethods: [...missing],\n };\n if (chainId !== undefined) out.chainId = chainId;\n if (entryPoints) out.entryPoints = entryPoints;\n if (!ok) {\n out.error = new PepuBundlerError(\n \"BUNDLER_UNREACHABLE\",\n chainId !== undefined && chainId !== pepuMainnet.id\n ? `The bundler serves chain ${chainId}, not ${pepuMainnet.id}.`\n : !chainAndEntryPointOk\n ? \"The bundler does not list EntryPoint v0.7.\"\n : `The bundler does not support ${missing.join(\", \")}.`,\n {\n hint: \"Point PEPU_BUNDLER_URL at a bundler for chain 97741 that supports EntryPoint v0.7 and the ERC-4337 UserOperation methods.\",\n },\n );\n }\n return out;\n } catch (e) {\n return { ok: false, latencyMs: Date.now() - started, error: unreachable(url, e) };\n }\n}\n\nconst STUB_PROBE_OP = {\n sender: \"0x0000000000000000000000000000000000000001\",\n nonce: \"0x0\",\n callData: \"0x\",\n callGasLimit: \"0x0\",\n verificationGasLimit: \"0x0\",\n preVerificationGas: \"0x0\",\n maxFeePerGas: \"0x0\",\n maxPriorityFeePerGas: \"0x0\",\n signature: \"0x\",\n} as const;\n\n/**\n * Probe a paymaster URL: the service base (`https://paymaster.pepeunchained.com`) or the ERC-7677 endpoint\n * (`https://host/v2/paymaster/<token>`).\n * Checks `GET <origin>/health`, `GET <origin>/v2/free-tier`, and whether the URL\n * answers JSON-RPC `pm_getPaymasterStubData` (`erc7677`: without a client token a\n * JSON-RPC denial is reported as `\"needs-credential\"`, not as a failure). `ok` means\n * every capability that could be checked is fine: `/health` did not fail and the URL\n * spoke ERC-7677 JSON-RPC. The URL (which can embed a\n * token) never appears in the returned error.\n *\n * @example\n * const r = await probePaymaster(process.env.PEPU_PAYMASTER_URL!);\n * console.log(r.ok, r.freeTier);\n */\nexport async function probePaymaster(url: string, o: ProbeOptions = {}): Promise<PaymasterProbeResult> {\n checkUrl(url, \"Paymaster URL\");\n const f: FetchLike = o.fetch ?? ((i, init) => fetch(i, init));\n const timeoutMs = o.timeoutMs ?? 8000;\n const started = Date.now();\n const origin = new URL(url).origin;\n const out: PaymasterProbeResult = { ok: false, latencyMs: 0 };\n let reached = false;\n let lastError: unknown;\n\n try {\n const res = await timedFetch(f, `${origin}/health`, { method: \"GET\" }, timeoutMs);\n reached = true;\n const body = (await res.json().catch(() => null)) as { status?: unknown } | null;\n out.health = res.ok && body?.status === \"ok\";\n } catch (e) {\n lastError = e;\n out.health = false;\n }\n\n try {\n const res = await timedFetch(f, `${origin}/v2/free-tier`, { method: \"GET\" }, timeoutMs);\n reached = true;\n if (res.ok) out.freeTier = await res.json().catch(() => undefined);\n } catch (e) {\n lastError = e;\n }\n\n let speaksRpc = false;\n try {\n const ep07 = getContract(pepuMainnet.id, \"entryPoint07\");\n const ep = ep07?.status === \"deployed\" ? ep07.address : \"0x0000000071727De22E5E9d8BAf0edAc6f37da032\";\n const reply = await rpc(\n f,\n url,\n \"pm_getPaymasterStubData\",\n [STUB_PROBE_OP, ep, `0x${pepuMainnet.id.toString(16)}`, {}],\n timeoutMs,\n );\n reached = true;\n // A JSON-RPC answer has a result, or an error OBJECT (a REST 404 body like {\"error\":\"not_found\"} is not one).\n const rpcError = reply.error !== null && typeof reply.error === \"object\";\n speaksRpc = reply.result !== undefined || rpcError;\n if (reply.result !== undefined) {\n out.erc7677StubOk = true;\n out.erc7677 = \"stub-ok\";\n } else if (rpcError) {\n // Alive and speaking JSON-RPC, but the probe has no credential: not applicable, not a failure.\n out.erc7677 = \"needs-credential\";\n } else {\n out.erc7677StubOk = false;\n out.erc7677 = \"not-responding\";\n }\n } catch (e) {\n lastError = e;\n out.erc7677StubOk = false;\n out.erc7677 = \"not-responding\";\n }\n\n out.latencyMs = Date.now() - started;\n out.ok = speaksRpc && out.health !== false;\n if (!reached) out.error = unreachable(url, lastError);\n else if (!out.ok) {\n out.error = new PepuBundlerError(\"BUNDLER_UNREACHABLE\", `${hostOf(url)} answered but is not a PEPU paymaster service.`, {\n hint: \"Check PEPU_PAYMASTER_URL points at the policy service (https://paymaster.pepeunchained.com), or its /v2/paymaster/<client token> endpoint.\",\n });\n }\n return out;\n}\n\n/**\n * The paymaster's EntryPoint v0.7 deposit in wei. A drop across a UserOperation\n * is the proof that it was sponsored. Defaults to PEPU's deployed paymaster.\n *\n * @example\n * const before = await getPaymasterDeposit(publicClient);\n */\nexport async function getPaymasterDeposit(client: PublicClient, paymaster?: Address): Promise<bigint> {\n const pm = getContract(pepuMainnet.id, \"paymaster\");\n const ep = getContract(pepuMainnet.id, \"entryPoint07\");\n const account = paymaster ?? (pm?.status === \"deployed\" ? pm.address : undefined);\n if (!account || ep?.status !== \"deployed\") {\n throw new PepuConfigError(\"CONFIG_MISSING_ENV\", \"No paymaster address is known; pass one explicitly.\", {\n hint: \"Pass the paymaster address as the second argument.\",\n });\n }\n return client.readContract({\n address: ep.address,\n abi: entryPointV07Abi,\n functionName: \"balanceOf\",\n args: [account],\n });\n}\n","import type { Address, Hex, PublicClient, Transport } from \"viem\";\n\nimport { kernelFactoryAbi } from \"../abi/kernelFactory.js\";\nimport type { PepuChain } from \"../chains.js\";\nimport type { DeployedContract } from \"../contracts.js\";\nimport { getContract } from \"../contracts.js\";\nimport { PEPU_ENV, resolvePepuEndpoints } from \"../endpoints.js\";\nimport { getPaymasterDeposit, probeBundler, probePaymaster } from \"./probes.js\";\nimport type { BundlerProbeResult, FetchLike, PaymasterProbeResult } from \"./probes.js\";\n\n/**\n * The account-abstraction contracts a Kernel v3 smart account needs,\n * narrowed to their {@link DeployedContract} form for a given chain.\n * Returns `undefined` if any one of them isn't deployed on that chain\n * (today: everything except mainnet, `97741`) — this package never fabricates\n * a partial/best-effort bundle.\n */\nexport interface PepuKernelStack {\n readonly entryPoint06: DeployedContract;\n readonly entryPoint07: DeployedContract;\n readonly kernelFactory: DeployedContract;\n readonly kernelMetaFactory: DeployedContract;\n readonly ecdsaValidator: DeployedContract;\n}\n\n/**\n * Look up every AA contract this package knows about for `chainId`, already\n * narrowed to {@link DeployedContract}. Returns `undefined` unless *all* five\n * are deployed on that chain (today, only PEPU mainnet qualifies) — a caller\n * building a Kernel account needs every one of them, so a partial result\n * would just move the \"is this actually usable\" check into every caller.\n *\n * This is a convenience grouping over `getContract` from `./contracts.js`;\n * it doesn't add any address or fact that registry doesn't already have.\n */\nexport function getPepuKernelStack(chainId: number): PepuKernelStack | undefined {\n const entryPoint06 = getContract(chainId, \"entryPoint06\");\n const entryPoint07 = getContract(chainId, \"entryPoint07\");\n const kernelFactory = getContract(chainId, \"kernelFactory\");\n const kernelMetaFactory = getContract(chainId, \"kernelMetaFactory\");\n const ecdsaValidator = getContract(chainId, \"ecdsaValidator\");\n\n if (\n entryPoint06?.status !== \"deployed\" ||\n entryPoint07?.status !== \"deployed\" ||\n kernelFactory?.status !== \"deployed\" ||\n kernelMetaFactory?.status !== \"deployed\" ||\n ecdsaValidator?.status !== \"deployed\"\n ) {\n return undefined;\n }\n\n return { entryPoint06, entryPoint07, kernelFactory, kernelMetaFactory, ecdsaValidator };\n}\n\n/**\n * Legacy static gas-sponsorship status for PEPU. **Always reports\n * unavailable** (it never probes). Sponsorship is PROVEN end to end on PEPU\n * mainnet through the hosted bundler and paymaster service (a zero-balance\n * Kernel smart account transacted, paid for by the paymaster); use\n * `checkSponsorship()` for the live answer. This function\n * exists so nothing downstream (this package, `@pepu-chain/mcp`, an app)\n * has to independently invent an \"is sponsorship on?\" check, and so that\n * check can't silently start lying once this file changes.\n *\n * Do not treat the presence of `kernelFactory`/`ecdsaValidator`/`paymaster`\n * addresses in {@link getPepuKernelStack} / the contract registry as\n * sponsorship support — those let you build and deploy a Kernel account and\n * send its UserOperations through a normal `eth_sendTransaction`-style flow\n * (self-paying its own gas via the EntryPoint deposit), which is a real,\n * working feature; sponsoring that gas needs a funded project or free-tier token.\n */\nexport interface SponsorshipStatus {\n readonly available: false;\n readonly reason: string;\n /**\n * Extension point for a future bundler/paymaster integration. Passing a\n * URL here does **not** make sponsorship available — `available` stays\n * `false` regardless — this field only exists so a caller can start\n * wiring a URL through their own config today and have this function\n * start using it later without an API change.\n */\n readonly bundlerUrl?: string;\n}\n\n/** Options for {@link getSponsorshipStatus}. */\nexport interface GetSponsorshipStatusOptions {\n /** See {@link SponsorshipStatus.bundlerUrl}. Not yet used for anything. */\n readonly bundlerUrl?: string;\n}\n\n/**\n * @deprecated Always reports `available: false`. Use `checkSponsorship()` (live\n * bundler and paymaster probe) from `@pepu-chain/sdk`. Kept for 0.1 callers.\n */\nexport function getSponsorshipStatus(\n options?: GetSponsorshipStatusOptions,\n): SponsorshipStatus {\n const reason =\n \"This deprecated function never probes anything and always reports \" +\n \"unavailable. The hosted bundler (bundler.pepeunchained.com) and \" +\n \"paymaster service (paymaster.pepeunchained.com) are live, and \" +\n \"sponsorship is proven end to end on mainnet through them. Call \" +\n \"checkSponsorship() for the live status. A Kernel v3 smart account \" +\n \"without a funded project or free-tier token must still fund its own \" +\n \"EntryPoint deposit and pay its own gas, like a normal EOA-sent transaction.\";\n return options?.bundlerUrl === undefined\n ? { available: false, reason }\n : { available: false, reason, bundlerUrl: options.bundlerUrl };\n}\n\n/**\n * Compute (or confirm) the counterfactual address of a Kernel v3 smart\n * account via the verified factory's `getAddress(data, salt)` — a thin,\n * typed pass-through, not a re-implementation.\n *\n * Deliberately does **not** build `data` (Kernel v3.1's `initialize(...)`\n * calldata: root validator, hook, validator data, hook data, init config)\n * for you. A hand-rolled encoding here would be a second, unverified copy of\n * the byte layout that ZeroDev's SDK already produces (and that has been\n * exercised against PEPU's factory through the sponsored-transaction run),\n * which is exactly the kind of invented encoding this package's rules\n * forbid for addresses. Build `data` with ZeroDev's\n * `@zerodev/sdk` (or by hand from the public Kernel v3 contracts source),\n * then pass the result here.\n */\nexport async function getKernelAccountAddress(\n client: PublicClient<Transport, PepuChain>,\n factory: Pick<DeployedContract, \"address\">,\n args: { readonly data: Hex; readonly salt: Hex },\n): Promise<Address> {\n return client.readContract({\n address: factory.address,\n abi: kernelFactoryAbi,\n functionName: \"getAddress\",\n args: [args.data, args.salt],\n });\n}\n\n/** Live sponsorship report from {@link checkSponsorship}. */\nexport interface SponsorshipReport {\n /** True only when a bundler and a paymaster are configured and both answer. */\n available: boolean;\n /** `direct` when you bring your own bundler and paymaster URLs; `none` when nothing is configured. */\n transport: \"direct\" | \"none\";\n bundler: { configured: boolean; probe?: BundlerProbeResult };\n paymaster: { configured: boolean; probe?: PaymasterProbeResult; depositWei?: bigint };\n /** One sentence for a human or an agent. */\n reason: string;\n /** Concrete next steps, empty when `available`. */\n fixes: string[];\n}\n\n/** Options for {@link checkSponsorship}. */\nexport interface CheckSponsorshipOptions {\n bundlerUrl?: string;\n paymasterUrl?: string;\n env?: Record<string, string | undefined>;\n fetch?: FetchLike;\n /** When given, also read the paymaster's EntryPoint deposit. */\n publicClient?: PublicClient;\n /** Paymaster contract to read the deposit of. Defaults to PEPU's deployed paymaster. */\n paymasterAddress?: Address;\n timeoutMs?: number;\n}\n\n/**\n * Live gas-sponsorship status. Resolves the bundler and paymaster URLs from\n * options, env, then the hosted defaults (bundler.pepeunchained.com and the paymaster\n * service base; with no token URL the service is probed at its base), probes both,\n * and optionally reads the paymaster deposit. Never throws for an\n * unreachable service; it reports `available: false` with `fixes`.\n * Replaces the hard-coded {@link getSponsorshipStatus}.\n *\n * @example\n * const s = await checkSponsorship({ publicClient });\n * if (!s.available) console.log(s.reason, s.fixes);\n */\nexport async function checkSponsorship(options: CheckSponsorshipOptions = {}): Promise<SponsorshipReport> {\n const { bundlerUrl, paymasterUrl: erc7677Url, paymasterBaseUrl } = resolvePepuEndpoints({\n ...(options.bundlerUrl !== undefined ? { bundlerUrl: options.bundlerUrl } : {}),\n ...(options.paymasterUrl !== undefined ? { paymasterUrl: options.paymasterUrl } : {}),\n ...(options.env ? { env: options.env } : {}),\n });\n // No token means no complete ERC-7677 URL: probe the service base (health + free-tier state) instead.\n const paymasterUrl = erc7677Url ?? paymasterBaseUrl;\n const probeOpts = {\n ...(options.fetch ? { fetch: options.fetch } : {}),\n ...(options.timeoutMs !== undefined ? { timeoutMs: options.timeoutMs } : {}),\n };\n const fixes: string[] = [];\n if (bundlerUrl === null) fixes.push(`Set ${PEPU_ENV.bundlerUrl} to a bundler for chain 97741 (EntryPoint v0.7).`);\n if (paymasterUrl === null) fixes.push(`Set ${PEPU_ENV.paymasterUrl} to your ERC-7677 paymaster endpoint (https://paymaster.pepeunchained.com/v2/paymaster/<client token>).`);\n\n const [bProbe, pProbe] = await Promise.all([\n bundlerUrl === null ? undefined : probeBundler(bundlerUrl, probeOpts),\n paymasterUrl === null ? undefined : probePaymaster(paymasterUrl, probeOpts),\n ]);\n if (bProbe && !bProbe.ok) fixes.push(bProbe.error?.hint ?? \"The bundler did not answer correctly.\");\n if (pProbe && !pProbe.ok) fixes.push(pProbe.error?.hint ?? \"The paymaster did not answer correctly.\");\n\n let depositWei: bigint | undefined;\n if (options.publicClient) {\n try {\n depositWei = await getPaymasterDeposit(options.publicClient, options.paymasterAddress);\n if (depositWei === 0n) fixes.push(\"The paymaster's EntryPoint deposit is empty. Deposit PEPU to it.\");\n } catch {\n // A failed read must not flip availability; the probes are the source of truth.\n }\n }\n\n const available = !!bProbe?.ok && !!pProbe?.ok && depositWei !== 0n;\n const configured = bundlerUrl !== null || paymasterUrl !== null;\n const reason = available\n ? \"Bundler and paymaster are reachable; sponsored UserOperations can be sent.\"\n : !configured\n ? \"No bundler or paymaster URL is configured. Set PEPU_BUNDLER_URL and PEPU_PAYMASTER_URL, or use the hosted defaults.\"\n : \"A bundler or paymaster is configured but not fully working. See fixes.\";\n return {\n available,\n transport: configured ? \"direct\" : \"none\",\n bundler: { configured: bundlerUrl !== null, ...(bProbe ? { probe: bProbe } : {}) },\n paymaster: {\n configured: paymasterUrl !== null,\n ...(pProbe ? { probe: pProbe } : {}),\n ...(depositWei !== undefined ? { depositWei } : {}),\n },\n reason,\n fixes,\n };\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/abi/kernelFactory.ts","../src/abi/entryPointV07.ts","../src/aa/probes.ts","../src/aa/status.ts"],"names":["parseAbi","PepuConfigError","redactSecrets","PepuBundlerError","getContract","pepuMainnet","resolvePepuEndpoints","PEPU_ENV"],"mappings":";;;;;;;;;AA6BO,IAAM,mBAAmBA,aAAA,CAAS;AAAA,EACvC,kDAAA;AAAA,EACA,+EAAA;AAAA,EACA;AACF,CAAC;AAOM,IAAM,kCAAA,GACX;ACdK,IAAM,mBAAmBA,aAAAA,CAAS;AAAA,EACvC,6EAAA;AAAA,EACA,4DAAA;AAAA,EACA,6CAAA;AAAA,EACA,8EAAA;AAAA,EACA,wJAAA;AAAA,EACA,gEAAA;AAAA,EACA;AACF,CAAC;;;ACuBD,IAAM,eAAA,GAAkB;AAAA,EACtB,uBAAA;AAAA,EACA,8BAAA;AAAA,EACA,6BAAA;AAAA,EACA,4BAAA;AAAA,EACA,kCAAA;AAAA,EACA;AACF,CAAA;AAGO,IAAM,wBAAA,GAA2B;AAAA,EACtC,uBAAA;AAAA,EACA,8BAAA;AAAA,EACA;AACF,C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AAI,UAAA,KAAe,EAAA,EAAI,KAAA,CAAM,IAAA,CAAK,kEAAkE,CAAA;AAAA,IACtG,CAAA,CAAA,MAAQ;AAAA,IAER;AAAA,EACF;AAEA,EAAA,MAAM,SAAA,GAAY,CAAC,CAAC,MAAA,EAAQ,MAAM,CAAC,CAAC,MAAA,EAAQ,EAAA,IAAM,UAAA,KAAe,EAAA;AACjE,EAAA,MAAM,UAAA,GAAa,UAAA,KAAe,IAAA,IAAQ,YAAA,KAAiB,IAAA;AAC3D,EAAA,MAAM,MAAA,GAAS,SAAA,GACX,4EAAA,GACA,CAAC,aACC,qHAAA,GACA,wEAAA;AACN,EAAA,OAAO;AAAA,IACL,SAAA;AAAA,IACA,SAAA,EAAW,aAAa,QAAA,GAAW,MAAA;AAAA,IACnC,OAAA,EAAS,EAAE,UAAA,EAAY,UAAA,KAAe,IAAA,EAAM,GAAI,MAAA,GAAS,EAAE,KAAA,EAAO,MAAA,EAAO,GAAI,EAAC,EAAG;AAAA,IACjF,SAAA,EAAW;AAAA,MACT,YAAY,YAAA,KAAiB,IAAA;AAAA,MAC7B,GAAI,MAAA,GAAS,EAAE,KAAA,EAAO,MAAA,KAAW,EAAC;AAAA,MAClC,GAAI,UAAA,KAAe,MAAA,GAAY,EAAE,UAAA,KAAe;AAAC,KACnD;AAAA,IACA,MAAA;AAAA,IACA;AAAA,GACF;AACF","file":"chunk-VYMAZVIK.cjs","sourcesContent":["import { parseAbi } from \"viem\";\n\n/**\n * ZeroDev Kernel v3 account factory ABI, at\n * `0xaac5D4240AF87249B3f71BC8E4A2cae074A3E419` (deployed on PEPU mainnet\n * only; see `pepuContracts.kernelFactory` in `../contracts.js`).\n *\n * Verified live against mainnet 2026-09-24 via `eth_call`:\n * - `implementation()` returns `0xbAC849bB641841b44E965fb01A4Bf5F074F84B4d` —\n * ZeroDev's Kernel v3.1 singleton implementation address, deployed at the\n * same address on every chain that has it via CREATE2.\n * - `getAddress(bytes,bytes32)`, called with empty `data` and a zero salt,\n * returns a computed address without reverting.\n * - `createAccount(bytes,bytes32)`, simulated (not sent) with the same\n * empty `data` and zero salt via `eth_call`, returns the **same** address\n * `getAddress` computed for those inputs — exactly the counterfactual-\n * address behavior a CREATE2 account factory is supposed to have.\n *\n * What this package does NOT ship: a helper that encodes the `data`\n * argument (Kernel v3.1's `initialize(...)` calldata — root validator,\n * hook, validator data, hook data, init config). No account has ever been\n * created through this factory on PEPU yet (its transaction history is\n * empty as of the verification date above), so there was nothing on-chain\n * to check a hand-rolled encoding against, and guessing one here would be\n * exactly the kind of invented byte layout this package's rules forbid.\n * Use ZeroDev's own `@zerodev/sdk` (or the public Kernel contracts source)\n * to build that payload, then pass the resulting bytes into\n * `getAddress`/`createAccount` from this ABI.\n */\nexport const kernelFactoryAbi = parseAbi([\n \"function implementation() view returns (address)\",\n \"function getAddress(bytes calldata data, bytes32 salt) view returns (address)\",\n \"function createAccount(bytes calldata data, bytes32 salt) payable returns (address)\",\n]);\n\n/**\n * The verified Kernel v3.1 singleton implementation address that\n * `kernelFactoryAbi`'s `implementation()` resolves to on PEPU mainnet. Same\n * address ZeroDev uses across every chain that has this Kernel version.\n */\nexport const KERNEL_V3_1_IMPLEMENTATION_ADDRESS =\n \"0xbAC849bB641841b44E965fb01A4Bf5F074F84B4d\" as const;\n","import { parseAbi } from \"viem\";\n\n/**\n * ERC-4337 EntryPoint v0.7 ABI — the subset a dapp actually needs to manage\n * a smart account's gas deposit and read its nonce, at the canonical address\n * `0x0000000071727De22E5E9d8BAf0edAc6f37da032` (deployed on PEPU mainnet\n * only; see `pepuContracts.entryPoint07` in `../contracts.js`).\n *\n * This is NOT the full `IEntryPoint` interface (no `handleOps`,\n * `simulateValidation`, etc.) — those are normally called by a bundler, and\n * PEPU has no publicly hosted bundler yet (see `getSponsorshipStatus` in\n * `../aa/status.js`). This ABI only covers deposit/nonce management, which works\n * today with a plain viem wallet client and no bundler at all.\n *\n * Verified live against mainnet 2026-09-24 via `eth_call`:\n * - `getNonce(address,uint192)` for the zero address/key returns `0`.\n * - `balanceOf(address)` for the zero address returns `0`.\n * - `getDepositInfo(address)` for the zero address returns a 5-word\n * (all-zero) tuple, matching the v0.7 `DepositInfo` struct shape\n * `(uint256 deposit, bool staked, uint96 stake, uint32 unstakeDelaySec,\n * uint48 withdrawTime)` field-for-field.\n * `depositTo`/`withdrawTo` share the same `IStakeManager` interface as the\n * verified `getDepositInfo`/`balanceOf` pair and are standard across every\n * EntryPoint version; they were not separately simulated (both mutate\n * state, and simulating a withdrawal from an empty deposit would only prove\n * it reverts, not that it works).\n */\nexport const entryPointV07Abi = parseAbi([\n \"function getNonce(address sender, uint192 key) view returns (uint256 nonce)\",\n \"function balanceOf(address account) view returns (uint256)\",\n \"function depositTo(address account) payable\",\n \"function withdrawTo(address payable withdrawAddress, uint256 withdrawAmount)\",\n \"function getDepositInfo(address account) view returns ((uint256 deposit, bool staked, uint96 stake, uint32 unstakeDelaySec, uint48 withdrawTime) info)\",\n \"event Deposited(address indexed account, uint256 totalDeposit)\",\n \"event Withdrawn(address indexed account, address withdrawAddress, uint256 amount)\",\n]);\n","import type { Address, PublicClient } from \"viem\";\n\nimport { entryPointV07Abi } from \"../abi/entryPointV07.js\";\nimport { pepuMainnet } from \"../chains.js\";\nimport { getContract } from \"../contracts.js\";\nimport { PepuBundlerError, PepuConfigError } from \"../errors.js\";\nimport { redactSecrets } from \"./describe.js\";\n\n/** Minimal fetch signature, so tests and non-browser hosts can inject one. */\nexport type FetchLike = (input: string, init?: RequestInit) => Promise<Response>;\n\nexport interface ProbeOptions {\n fetch?: FetchLike;\n /** Per-request timeout. Default 8000. */\n timeoutMs?: number;\n}\n\nexport interface BundlerProbeResult {\n ok: boolean;\n chainId?: number;\n entryPoints?: Address[];\n /**\n * `true` when the method exists. Each method is called with deliberately empty\n * (invalid) params, so nothing is ever sent on-chain: an \"invalid params\" or\n * validation answer means the method exists, a \"method not found\" answer\n * (including Alto's \"Invalid discriminator value\") means it does not.\n */\n supportedMethods?: Record<string, boolean>;\n /** Required methods (see `REQUIRED_BUNDLER_METHODS`) the bundler lacks. Empty when all are present. */\n missingRequiredMethods?: string[];\n latencyMs: number;\n error?: PepuBundlerError;\n}\n\nexport interface PaymasterProbeResult {\n ok: boolean;\n /** `GET <origin>/health` answered `{ status: \"ok\" }`. */\n health?: boolean;\n /** Body of `GET <origin>/v2/free-tier` when the service exposes it. */\n freeTier?: unknown;\n /**\n * `true` when the URL answered `pm_getPaymasterStubData` with a stub result,\n * `false` when it did not answer JSON-RPC at all. A JSON-RPC denial (no\n * credential, unknown sender) leaves it `undefined`: the endpoint speaks\n * ERC-7677 but the probe has no credential, so a stub cannot be judged. Read\n * `erc7677` for the three-way answer.\n */\n erc7677StubOk?: boolean;\n /**\n * `\"stub-ok\"`: a stub came back. `\"needs-credential\"`: the endpoint speaks ERC-7677\n * JSON-RPC and answered with an error (no credential, unknown sender), so the stub\n * check is not applicable without a client token. `\"not-responding\"`: no JSON-RPC answer.\n */\n erc7677?: \"stub-ok\" | \"needs-credential\" | \"not-responding\";\n latencyMs: number;\n error?: PepuBundlerError;\n}\n\nconst BUNDLER_METHODS = [\n \"eth_sendUserOperation\",\n \"eth_estimateUserOperationGas\",\n \"eth_getUserOperationReceipt\",\n \"eth_getUserOperationByHash\",\n \"pimlico_getUserOperationGasPrice\",\n \"zd_getUserOperationGasPrice\",\n] as const;\n\n/** Methods a bundler must support to be usable for PEPU sponsored UserOperations. */\nexport const REQUIRED_BUNDLER_METHODS = [\n \"eth_sendUserOperation\",\n \"eth_estimateUserOperationGas\",\n \"eth_getUserOperationReceipt\",\n] as const;\n\nconst METHOD_NOT_FOUND = -32601;\n\n/**\n * A bundler answers a method that does not exist with \"method not found\". Alto\n * (Pimlico) also reports bad params of a KNOWN method with code -32601 and a\n * \"Validation error: ...\" message, and an unknown method as \"Validation error:\n * Invalid discriminator value\". So -32601 means unsupported unless the message is\n * a params validation error that is not the discriminator one.\n */\nfunction isMethodNotFound(error: { code?: number; message?: string } | undefined): boolean {\n if (!error || error.code !== METHOD_NOT_FOUND) return false;\n const message = error.message ?? \"\";\n if (/invalid discriminator value/i.test(message)) return true;\n return !/validation error|invalid params|must contain|required at/i.test(message);\n}\n\nfunction hostOf(url: string): string {\n try {\n return new URL(url).host;\n } catch {\n return \"the configured host\";\n }\n}\n\nfunction checkUrl(url: string, label: string): void {\n let u: URL;\n try {\n u = new URL(url);\n } catch {\n throw new PepuConfigError(\"CONFIG_BAD_URL\", `${label} is not a valid URL.`);\n }\n if (u.protocol !== \"http:\" && u.protocol !== \"https:\") {\n throw new PepuConfigError(\"CONFIG_BAD_URL\", `${label} must be an http(s) URL.`);\n }\n}\n\nasync function timedFetch(f: FetchLike, url: string, init: RequestInit, timeoutMs: number): Promise<Response> {\n const ctl = new AbortController();\n const t = setTimeout(() => ctl.abort(), timeoutMs);\n try {\n return await f(url, { ...init, signal: ctl.signal });\n } finally {\n clearTimeout(t);\n }\n}\n\ninterface RpcReply {\n result?: unknown;\n error?: { code?: number; message?: string; data?: unknown };\n}\n\nasync function rpc(f: FetchLike, url: string, method: string, params: unknown[], timeoutMs: number): Promise<RpcReply> {\n const res = await timedFetch(\n f,\n url,\n {\n method: \"POST\",\n headers: { \"content-type\": \"application/json\" },\n body: JSON.stringify({ jsonrpc: \"2.0\", id: 1, method, params }),\n },\n timeoutMs,\n );\n let body: unknown;\n try {\n body = await res.json();\n } catch {\n throw new Error(`HTTP ${res.status} with a non-JSON body`);\n }\n if (!body || typeof body !== \"object\") throw new Error(`HTTP ${res.status} with an unexpected body`);\n return body as RpcReply;\n}\n\nfunction unreachable(url: string, e: unknown): PepuBundlerError {\n const reason = e instanceof Error && e.name === \"AbortError\" ? \"timed out\" : redactSecrets(e instanceof Error ? e.message : String(e)).replace(/https?:\\/\\/\\S+/g, \"[url]\");\n return new PepuBundlerError(\"BUNDLER_UNREACHABLE\", `Could not reach ${hostOf(url)}: ${reason}`, { cause: e });\n}\n\n/**\n * Probe a bundler URL: `eth_chainId`, `eth_supportedEntryPoints` and a\n * capability check of the methods PEPU apps use (a method answered with\n * anything but \"method not found\" counts as supported; nothing is sent\n * on-chain). Never throws for network trouble; returns `ok: false` with a\n * `BUNDLER_UNREACHABLE` error. Throws `CONFIG_BAD_URL` for a malformed URL.\n *\n * @example\n * const r = await probeBundler(\"https://bundler.example.com\");\n * if (!r.ok) console.log(r.error?.hint);\n */\nexport async function probeBundler(url: string, o: ProbeOptions = {}): Promise<BundlerProbeResult> {\n checkUrl(url, \"Bundler URL\");\n const f: FetchLike = o.fetch ?? ((i, init) => fetch(i, init));\n const timeoutMs = o.timeoutMs ?? 8000;\n const started = Date.now();\n try {\n const chain = await rpc(f, url, \"eth_chainId\", [], timeoutMs);\n const eps = await rpc(f, url, \"eth_supportedEntryPoints\", [], timeoutMs);\n const chainId = typeof chain.result === \"string\" ? Number(BigInt(chain.result)) : undefined;\n const entryPoints = Array.isArray(eps.result) ? (eps.result as Address[]) : undefined;\n const supportedMethods: Record<string, boolean> = {};\n for (const m of BUNDLER_METHODS) {\n try {\n const r = await rpc(f, url, m, [], timeoutMs);\n supportedMethods[m] = !isMethodNotFound(r.error);\n } catch {\n supportedMethods[m] = false;\n }\n }\n const ep07 = getContract(pepuMainnet.id, \"entryPoint07\");\n const want = ep07?.status === \"deployed\" ? ep07.address.toLowerCase() : undefined;\n const missing = REQUIRED_BUNDLER_METHODS.filter((m) => supportedMethods[m] !== true);\n const chainAndEntryPointOk =\n chainId === pepuMainnet.id &&\n (want === undefined || (entryPoints?.some((a) => a.toLowerCase() === want) ?? false));\n const ok = chainAndEntryPointOk && missing.length === 0;\n const out: BundlerProbeResult = {\n ok,\n latencyMs: Date.now() - started,\n supportedMethods,\n missingRequiredMethods: [...missing],\n };\n if (chainId !== undefined) out.chainId = chainId;\n if (entryPoints) out.entryPoints = entryPoints;\n if (!ok) {\n out.error = new PepuBundlerError(\n \"BUNDLER_UNREACHABLE\",\n chainId !== undefined && chainId !== pepuMainnet.id\n ? `The bundler serves chain ${chainId}, not ${pepuMainnet.id}.`\n : !chainAndEntryPointOk\n ? \"The bundler does not list EntryPoint v0.7.\"\n : `The bundler does not support ${missing.join(\", \")}.`,\n {\n hint: \"Point PEPU_BUNDLER_URL at a bundler for chain 97741 that supports EntryPoint v0.7 and the ERC-4337 UserOperation methods.\",\n },\n );\n }\n return out;\n } catch (e) {\n return { ok: false, latencyMs: Date.now() - started, error: unreachable(url, e) };\n }\n}\n\nconst STUB_PROBE_OP = {\n sender: \"0x0000000000000000000000000000000000000001\",\n nonce: \"0x0\",\n callData: \"0x\",\n callGasLimit: \"0x0\",\n verificationGasLimit: \"0x0\",\n preVerificationGas: \"0x0\",\n maxFeePerGas: \"0x0\",\n maxPriorityFeePerGas: \"0x0\",\n signature: \"0x\",\n} as const;\n\n/**\n * Probe a paymaster URL: the service base (`https://paymaster.pepeunchained.com`) or the ERC-7677 endpoint\n * (`https://host/v2/paymaster/<token>`).\n * Checks `GET <origin>/health`, `GET <origin>/v2/free-tier`, and whether the URL\n * answers JSON-RPC `pm_getPaymasterStubData` (`erc7677`: without a client token a\n * JSON-RPC denial is reported as `\"needs-credential\"`, not as a failure). `ok` means\n * every capability that could be checked is fine: `/health` did not fail and the URL\n * spoke ERC-7677 JSON-RPC. The URL (which can embed a\n * token) never appears in the returned error.\n *\n * @example\n * const r = await probePaymaster(process.env.PEPU_PAYMASTER_URL!);\n * console.log(r.ok, r.freeTier);\n */\nexport async function probePaymaster(url: string, o: ProbeOptions = {}): Promise<PaymasterProbeResult> {\n checkUrl(url, \"Paymaster URL\");\n const f: FetchLike = o.fetch ?? ((i, init) => fetch(i, init));\n const timeoutMs = o.timeoutMs ?? 8000;\n const started = Date.now();\n const origin = new URL(url).origin;\n const out: PaymasterProbeResult = { ok: false, latencyMs: 0 };\n let reached = false;\n let lastError: unknown;\n\n try {\n const res = await timedFetch(f, `${origin}/health`, { method: \"GET\" }, timeoutMs);\n reached = true;\n const body = (await res.json().catch(() => null)) as { status?: unknown } | null;\n out.health = res.ok && body?.status === \"ok\";\n } catch (e) {\n lastError = e;\n out.health = false;\n }\n\n try {\n const res = await timedFetch(f, `${origin}/v2/free-tier`, { method: \"GET\" }, timeoutMs);\n reached = true;\n if (res.ok) out.freeTier = await res.json().catch(() => undefined);\n } catch (e) {\n lastError = e;\n }\n\n let speaksRpc = false;\n try {\n const ep07 = getContract(pepuMainnet.id, \"entryPoint07\");\n const ep = ep07?.status === \"deployed\" ? ep07.address : \"0x0000000071727De22E5E9d8BAf0edAc6f37da032\";\n const reply = await rpc(\n f,\n url,\n \"pm_getPaymasterStubData\",\n [STUB_PROBE_OP, ep, `0x${pepuMainnet.id.toString(16)}`, {}],\n timeoutMs,\n );\n reached = true;\n // A JSON-RPC answer has a result, or an error OBJECT (a REST 404 body like {\"error\":\"not_found\"} is not one).\n const rpcError = reply.error !== null && typeof reply.error === \"object\";\n speaksRpc = reply.result !== undefined || rpcError;\n if (reply.result !== undefined) {\n out.erc7677StubOk = true;\n out.erc7677 = \"stub-ok\";\n } else if (rpcError) {\n // Alive and speaking JSON-RPC, but the probe has no credential: not applicable, not a failure.\n out.erc7677 = \"needs-credential\";\n } else {\n out.erc7677StubOk = false;\n out.erc7677 = \"not-responding\";\n }\n } catch (e) {\n lastError = e;\n out.erc7677StubOk = false;\n out.erc7677 = \"not-responding\";\n }\n\n out.latencyMs = Date.now() - started;\n out.ok = speaksRpc && out.health !== false;\n if (!reached) out.error = unreachable(url, lastError);\n else if (!out.ok) {\n out.error = new PepuBundlerError(\"BUNDLER_UNREACHABLE\", `${hostOf(url)} answered but is not a PEPU paymaster service.`, {\n hint: \"Check PEPU_PAYMASTER_URL points at the policy service (https://paymaster.pepeunchained.com), or its /v2/paymaster/<client token> endpoint.\",\n });\n }\n return out;\n}\n\n/**\n * The paymaster's EntryPoint v0.7 deposit in wei. A drop across a UserOperation\n * is the proof that it was sponsored. Defaults to PEPU's deployed paymaster.\n *\n * @example\n * const before = await getPaymasterDeposit(publicClient);\n */\nexport async function getPaymasterDeposit(client: PublicClient, paymaster?: Address): Promise<bigint> {\n const pm = getContract(pepuMainnet.id, \"paymaster\");\n const ep = getContract(pepuMainnet.id, \"entryPoint07\");\n const account = paymaster ?? (pm?.status === \"deployed\" ? pm.address : undefined);\n if (!account || ep?.status !== \"deployed\") {\n throw new PepuConfigError(\"CONFIG_MISSING_ENV\", \"No paymaster address is known; pass one explicitly.\", {\n hint: \"Pass the paymaster address as the second argument.\",\n });\n }\n return client.readContract({\n address: ep.address,\n abi: entryPointV07Abi,\n functionName: \"balanceOf\",\n args: [account],\n });\n}\n","import type { Address, Hex, PublicClient, Transport } from \"viem\";\n\nimport { kernelFactoryAbi } from \"../abi/kernelFactory.js\";\nimport type { PepuChain } from \"../chains.js\";\nimport type { DeployedContract } from \"../contracts.js\";\nimport { getContract } from \"../contracts.js\";\nimport { PEPU_ENV, resolvePepuEndpoints } from \"../endpoints.js\";\nimport { getPaymasterDeposit, probeBundler, probePaymaster } from \"./probes.js\";\nimport type { BundlerProbeResult, FetchLike, PaymasterProbeResult } from \"./probes.js\";\n\n/**\n * The account-abstraction contracts a Kernel v3 smart account needs,\n * narrowed to their {@link DeployedContract} form for a given chain.\n * Returns `undefined` if any one of them isn't deployed on that chain\n * (today: everything except mainnet, `97741`) — this package never fabricates\n * a partial/best-effort bundle.\n */\nexport interface PepuKernelStack {\n readonly entryPoint06: DeployedContract;\n readonly entryPoint07: DeployedContract;\n readonly kernelFactory: DeployedContract;\n readonly kernelMetaFactory: DeployedContract;\n readonly ecdsaValidator: DeployedContract;\n}\n\n/**\n * Look up every AA contract this package knows about for `chainId`, already\n * narrowed to {@link DeployedContract}. Returns `undefined` unless *all* five\n * are deployed on that chain (today, only PEPU mainnet qualifies) — a caller\n * building a Kernel account needs every one of them, so a partial result\n * would just move the \"is this actually usable\" check into every caller.\n *\n * This is a convenience grouping over `getContract` from `./contracts.js`;\n * it doesn't add any address or fact that registry doesn't already have.\n */\nexport function getPepuKernelStack(chainId: number): PepuKernelStack | undefined {\n const entryPoint06 = getContract(chainId, \"entryPoint06\");\n const entryPoint07 = getContract(chainId, \"entryPoint07\");\n const kernelFactory = getContract(chainId, \"kernelFactory\");\n const kernelMetaFactory = getContract(chainId, \"kernelMetaFactory\");\n const ecdsaValidator = getContract(chainId, \"ecdsaValidator\");\n\n if (\n entryPoint06?.status !== \"deployed\" ||\n entryPoint07?.status !== \"deployed\" ||\n kernelFactory?.status !== \"deployed\" ||\n kernelMetaFactory?.status !== \"deployed\" ||\n ecdsaValidator?.status !== \"deployed\"\n ) {\n return undefined;\n }\n\n return { entryPoint06, entryPoint07, kernelFactory, kernelMetaFactory, ecdsaValidator };\n}\n\n/**\n * Legacy static gas-sponsorship status for PEPU. **Always reports\n * unavailable** (it never probes). Sponsorship is PROVEN end to end on PEPU\n * mainnet through the hosted bundler and paymaster service (a zero-balance\n * Kernel smart account transacted, paid for by the paymaster); use\n * `checkSponsorship()` for the live answer. This function\n * exists so nothing downstream (this package, `@pepu-chain/mcp`, an app)\n * has to independently invent an \"is sponsorship on?\" check, and so that\n * check can't silently start lying once this file changes.\n *\n * Do not treat the presence of `kernelFactory`/`ecdsaValidator`/`paymaster`\n * addresses in {@link getPepuKernelStack} / the contract registry as\n * sponsorship support — those let you build and deploy a Kernel account and\n * send its UserOperations through a normal `eth_sendTransaction`-style flow\n * (self-paying its own gas via the EntryPoint deposit), which is a real,\n * working feature; sponsoring that gas needs a funded project or free-tier token.\n */\nexport interface SponsorshipStatus {\n readonly available: false;\n readonly reason: string;\n /**\n * Extension point for a future bundler/paymaster integration. Passing a\n * URL here does **not** make sponsorship available — `available` stays\n * `false` regardless — this field only exists so a caller can start\n * wiring a URL through their own config today and have this function\n * start using it later without an API change.\n */\n readonly bundlerUrl?: string;\n}\n\n/** Options for {@link getSponsorshipStatus}. */\nexport interface GetSponsorshipStatusOptions {\n /** See {@link SponsorshipStatus.bundlerUrl}. Not yet used for anything. */\n readonly bundlerUrl?: string;\n}\n\n/**\n * @deprecated Always reports `available: false`. Use `checkSponsorship()` (live\n * bundler and paymaster probe) from `@pepu-chain/sdk`. Kept for 0.1 callers.\n */\nexport function getSponsorshipStatus(\n options?: GetSponsorshipStatusOptions,\n): SponsorshipStatus {\n const reason =\n \"This deprecated function never probes anything and always reports \" +\n \"unavailable. The hosted bundler (bundler.pepeunchained.com) and \" +\n \"paymaster service (paymaster.pepeunchained.com) are live, and \" +\n \"sponsorship is proven end to end on mainnet through them. Call \" +\n \"checkSponsorship() for the live status. A Kernel v3 smart account \" +\n \"without a funded project or free-tier token must still fund its own \" +\n \"EntryPoint deposit and pay its own gas, like a normal EOA-sent transaction.\";\n return options?.bundlerUrl === undefined\n ? { available: false, reason }\n : { available: false, reason, bundlerUrl: options.bundlerUrl };\n}\n\n/**\n * Compute (or confirm) the counterfactual address of a Kernel v3 smart\n * account via the verified factory's `getAddress(data, salt)` — a thin,\n * typed pass-through, not a re-implementation.\n *\n * Deliberately does **not** build `data` (Kernel v3.1's `initialize(...)`\n * calldata: root validator, hook, validator data, hook data, init config)\n * for you. A hand-rolled encoding here would be a second, unverified copy of\n * the byte layout that ZeroDev's SDK already produces (and that has been\n * exercised against PEPU's factory through the sponsored-transaction run),\n * which is exactly the kind of invented encoding this package's rules\n * forbid for addresses. Build `data` with ZeroDev's\n * `@zerodev/sdk` (or by hand from the public Kernel v3 contracts source),\n * then pass the result here.\n */\nexport async function getKernelAccountAddress(\n client: PublicClient<Transport, PepuChain>,\n factory: Pick<DeployedContract, \"address\">,\n args: { readonly data: Hex; readonly salt: Hex },\n): Promise<Address> {\n return client.readContract({\n address: factory.address,\n abi: kernelFactoryAbi,\n functionName: \"getAddress\",\n args: [args.data, args.salt],\n });\n}\n\n/** Live sponsorship report from {@link checkSponsorship}. */\nexport interface SponsorshipReport {\n /** True only when a bundler and a paymaster are configured and both answer. */\n available: boolean;\n /** `direct` when you bring your own bundler and paymaster URLs; `none` when nothing is configured. */\n transport: \"direct\" | \"none\";\n bundler: { configured: boolean; probe?: BundlerProbeResult };\n paymaster: { configured: boolean; probe?: PaymasterProbeResult; depositWei?: bigint };\n /** One sentence for a human or an agent. */\n reason: string;\n /** Concrete next steps, empty when `available`. */\n fixes: string[];\n}\n\n/** Options for {@link checkSponsorship}. */\nexport interface CheckSponsorshipOptions {\n bundlerUrl?: string;\n paymasterUrl?: string;\n env?: Record<string, string | undefined>;\n fetch?: FetchLike;\n /** When given, also read the paymaster's EntryPoint deposit. */\n publicClient?: PublicClient;\n /** Paymaster contract to read the deposit of. Defaults to PEPU's deployed paymaster. */\n paymasterAddress?: Address;\n timeoutMs?: number;\n}\n\n/**\n * Live gas-sponsorship status. Resolves the bundler and paymaster URLs from\n * options, env, then the hosted defaults (bundler.pepeunchained.com and the paymaster\n * service base; with no token URL the service is probed at its base), probes both,\n * and optionally reads the paymaster deposit. Never throws for an\n * unreachable service; it reports `available: false` with `fixes`.\n * Replaces the hard-coded {@link getSponsorshipStatus}.\n *\n * @example\n * const s = await checkSponsorship({ publicClient });\n * if (!s.available) console.log(s.reason, s.fixes);\n */\nexport async function checkSponsorship(options: CheckSponsorshipOptions = {}): Promise<SponsorshipReport> {\n const { bundlerUrl, paymasterUrl: erc7677Url, paymasterBaseUrl } = resolvePepuEndpoints({\n ...(options.bundlerUrl !== undefined ? { bundlerUrl: options.bundlerUrl } : {}),\n ...(options.paymasterUrl !== undefined ? { paymasterUrl: options.paymasterUrl } : {}),\n ...(options.env ? { env: options.env } : {}),\n });\n // No token means no complete ERC-7677 URL: probe the service base (health + free-tier state) instead.\n const paymasterUrl = erc7677Url ?? paymasterBaseUrl;\n const probeOpts = {\n ...(options.fetch ? { fetch: options.fetch } : {}),\n ...(options.timeoutMs !== undefined ? { timeoutMs: options.timeoutMs } : {}),\n };\n const fixes: string[] = [];\n if (bundlerUrl === null) fixes.push(`Set ${PEPU_ENV.bundlerUrl} to a bundler for chain 97741 (EntryPoint v0.7).`);\n if (paymasterUrl === null) fixes.push(`Set ${PEPU_ENV.paymasterUrl} to your ERC-7677 paymaster endpoint (https://paymaster.pepeunchained.com/v2/paymaster/<client token>).`);\n\n const [bProbe, pProbe] = await Promise.all([\n bundlerUrl === null ? undefined : probeBundler(bundlerUrl, probeOpts),\n paymasterUrl === null ? undefined : probePaymaster(paymasterUrl, probeOpts),\n ]);\n if (bProbe && !bProbe.ok) fixes.push(bProbe.error?.hint ?? \"The bundler did not answer correctly.\");\n if (pProbe && !pProbe.ok) fixes.push(pProbe.error?.hint ?? \"The paymaster did not answer correctly.\");\n\n let depositWei: bigint | undefined;\n if (options.publicClient) {\n try {\n depositWei = await getPaymasterDeposit(options.publicClient, options.paymasterAddress);\n if (depositWei === 0n) fixes.push(\"The paymaster's EntryPoint deposit is empty. Deposit PEPU to it.\");\n } catch {\n // A failed read must not flip availability; the probes are the source of truth.\n }\n }\n\n const available = !!bProbe?.ok && !!pProbe?.ok && depositWei !== 0n;\n const configured = bundlerUrl !== null || paymasterUrl !== null;\n const reason = available\n ? \"Bundler and paymaster are reachable; sponsored UserOperations can be sent.\"\n : !configured\n ? \"No bundler or paymaster URL is configured. Set PEPU_BUNDLER_URL and PEPU_PAYMASTER_URL, or use the hosted defaults.\"\n : \"A bundler or paymaster is configured but not fully working. See fixes.\";\n return {\n available,\n transport: configured ? \"direct\" : \"none\",\n bundler: { configured: bundlerUrl !== null, ...(bProbe ? { probe: bProbe } : {}) },\n paymaster: {\n configured: paymasterUrl !== null,\n ...(pProbe ? { probe: pProbe } : {}),\n ...(depositWei !== undefined ? { depositWei } : {}),\n },\n reason,\n fixes,\n };\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { redactSecrets } from './chunk-
|
|
1
|
+
import { redactSecrets } from './chunk-GFKIM7HT.js';
|
|
2
2
|
import { getContract } from './chunk-KJYNF5KH.js';
|
|
3
3
|
import { resolvePepuEndpoints, PEPU_ENV } from './chunk-XC4IBCI2.js';
|
|
4
4
|
import { pepuMainnet } from './chunk-VTQIHMF3.js';
|
|
@@ -300,5 +300,5 @@ async function checkSponsorship(options = {}) {
|
|
|
300
300
|
}
|
|
301
301
|
|
|
302
302
|
export { KERNEL_V3_1_IMPLEMENTATION_ADDRESS, checkSponsorship, entryPointV07Abi, getKernelAccountAddress, getPaymasterDeposit, getPepuKernelStack, getSponsorshipStatus, kernelFactoryAbi, probeBundler, probePaymaster };
|
|
303
|
-
//# sourceMappingURL=chunk-
|
|
304
|
-
//# sourceMappingURL=chunk-
|
|
303
|
+
//# sourceMappingURL=chunk-XR5ONV2Y.js.map
|
|
304
|
+
//# sourceMappingURL=chunk-XR5ONV2Y.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/abi/kernelFactory.ts","../src/abi/entryPointV07.ts","../src/aa/probes.ts","../src/aa/status.ts"],"names":["parseAbi"],"mappings":";;;;;;;AA6BO,IAAM,mBAAmB,QAAA,CAAS;AAAA,EACvC,kDAAA;AAAA,EACA,+EAAA;AAAA,EACA;AACF,CAAC;AAOM,IAAM,kCAAA,GACX;ACdK,IAAM,mBAAmBA,QAAAA,CAAS;AAAA,EACvC,6EAAA;AAAA,EACA,4DAAA;AAAA,EACA,6CAAA;AAAA,EACA,8EAAA;AAAA,EACA,wJAAA;AAAA,EACA,gEAAA;AAAA,EACA;AACF,CAAC;;;ACuBD,IAAM,eAAA,GAAkB;AAAA,EACtB,uBAAA;AAAA,EACA,8BAAA;AAAA,EACA,6BAAA;AAAA,EACA,4BAAA;AAAA,EACA,kCAAA;AAAA,EACA;AACF,CAAA;AAGO,IAAM,wBAAA,GAA2B;AAAA,EACtC,uBAAA;AAAA,EACA,8BAAA;AAAA,EACA;AACF,CAAA;AAEA,IAAM,gBAAA,GAAmB,MAAA;AASzB,SAAS,iBAAiB,KAAA,EAAiE;AACzF,EAAA,IAAI,CAAC,KAAA,IAAS,KAAA,CAAM,IAAA,KAAS,kBAAkB,OAAO,KAAA;AACtD,EAAA,MAAM,OAAA,GAAU,MAAM,OAAA,IAAW,EAAA;AACjC,EAAA,IAAI,8BAAA,CAA+B,IAAA,CAAK,OAAO,CA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EAAA,MAAM,MAAA,GAAS,SAAA,GACX,4EAAA,GACA,CAAC,aACC,qHAAA,GACA,wEAAA;AACN,EAAA,OAAO;AAAA,IACL,SAAA;AAAA,IACA,SAAA,EAAW,aAAa,QAAA,GAAW,MAAA;AAAA,IACnC,OAAA,EAAS,EAAE,UAAA,EAAY,UAAA,KAAe,IAAA,EAAM,GAAI,MAAA,GAAS,EAAE,KAAA,EAAO,MAAA,EAAO,GAAI,EAAC,EAAG;AAAA,IACjF,SAAA,EAAW;AAAA,MACT,YAAY,YAAA,KAAiB,IAAA;AAAA,MAC7B,GAAI,MAAA,GAAS,EAAE,KAAA,EAAO,MAAA,KAAW,EAAC;AAAA,MAClC,GAAI,UAAA,KAAe,MAAA,GAAY,EAAE,UAAA,KAAe;AAAC,KACnD;AAAA,IACA,MAAA;AAAA,IACA;AAAA,GACF;AACF","file":"chunk-F2R473FR.js","sourcesContent":["import { parseAbi } from \"viem\";\n\n/**\n * ZeroDev Kernel v3 account factory ABI, at\n * `0xaac5D4240AF87249B3f71BC8E4A2cae074A3E419` (deployed on PEPU mainnet\n * only; see `pepuContracts.kernelFactory` in `../contracts.js`).\n *\n * Verified live against mainnet 2026-09-24 via `eth_call`:\n * - `implementation()` returns `0xbAC849bB641841b44E965fb01A4Bf5F074F84B4d` —\n * ZeroDev's Kernel v3.1 singleton implementation address, deployed at the\n * same address on every chain that has it via CREATE2.\n * - `getAddress(bytes,bytes32)`, called with empty `data` and a zero salt,\n * returns a computed address without reverting.\n * - `createAccount(bytes,bytes32)`, simulated (not sent) with the same\n * empty `data` and zero salt via `eth_call`, returns the **same** address\n * `getAddress` computed for those inputs — exactly the counterfactual-\n * address behavior a CREATE2 account factory is supposed to have.\n *\n * What this package does NOT ship: a helper that encodes the `data`\n * argument (Kernel v3.1's `initialize(...)` calldata — root validator,\n * hook, validator data, hook data, init config). No account has ever been\n * created through this factory on PEPU yet (its transaction history is\n * empty as of the verification date above), so there was nothing on-chain\n * to check a hand-rolled encoding against, and guessing one here would be\n * exactly the kind of invented byte layout this package's rules forbid.\n * Use ZeroDev's own `@zerodev/sdk` (or the public Kernel contracts source)\n * to build that payload, then pass the resulting bytes into\n * `getAddress`/`createAccount` from this ABI.\n */\nexport const kernelFactoryAbi = parseAbi([\n \"function implementation() view returns (address)\",\n \"function getAddress(bytes calldata data, bytes32 salt) view returns (address)\",\n \"function createAccount(bytes calldata data, bytes32 salt) payable returns (address)\",\n]);\n\n/**\n * The verified Kernel v3.1 singleton implementation address that\n * `kernelFactoryAbi`'s `implementation()` resolves to on PEPU mainnet. Same\n * address ZeroDev uses across every chain that has this Kernel version.\n */\nexport const KERNEL_V3_1_IMPLEMENTATION_ADDRESS =\n \"0xbAC849bB641841b44E965fb01A4Bf5F074F84B4d\" as const;\n","import { parseAbi } from \"viem\";\n\n/**\n * ERC-4337 EntryPoint v0.7 ABI — the subset a dapp actually needs to manage\n * a smart account's gas deposit and read its nonce, at the canonical address\n * `0x0000000071727De22E5E9d8BAf0edAc6f37da032` (deployed on PEPU mainnet\n * only; see `pepuContracts.entryPoint07` in `../contracts.js`).\n *\n * This is NOT the full `IEntryPoint` interface (no `handleOps`,\n * `simulateValidation`, etc.) — those are normally called by a bundler, and\n * PEPU has no publicly hosted bundler yet (see `getSponsorshipStatus` in\n * `../aa/status.js`). This ABI only covers deposit/nonce management, which works\n * today with a plain viem wallet client and no bundler at all.\n *\n * Verified live against mainnet 2026-09-24 via `eth_call`:\n * - `getNonce(address,uint192)` for the zero address/key returns `0`.\n * - `balanceOf(address)` for the zero address returns `0`.\n * - `getDepositInfo(address)` for the zero address returns a 5-word\n * (all-zero) tuple, matching the v0.7 `DepositInfo` struct shape\n * `(uint256 deposit, bool staked, uint96 stake, uint32 unstakeDelaySec,\n * uint48 withdrawTime)` field-for-field.\n * `depositTo`/`withdrawTo` share the same `IStakeManager` interface as the\n * verified `getDepositInfo`/`balanceOf` pair and are standard across every\n * EntryPoint version; they were not separately simulated (both mutate\n * state, and simulating a withdrawal from an empty deposit would only prove\n * it reverts, not that it works).\n */\nexport const entryPointV07Abi = parseAbi([\n \"function getNonce(address sender, uint192 key) view returns (uint256 nonce)\",\n \"function balanceOf(address account) view returns (uint256)\",\n \"function depositTo(address account) payable\",\n \"function withdrawTo(address payable withdrawAddress, uint256 withdrawAmount)\",\n \"function getDepositInfo(address account) view returns ((uint256 deposit, bool staked, uint96 stake, uint32 unstakeDelaySec, uint48 withdrawTime) info)\",\n \"event Deposited(address indexed account, uint256 totalDeposit)\",\n \"event Withdrawn(address indexed account, address withdrawAddress, uint256 amount)\",\n]);\n","import type { Address, PublicClient } from \"viem\";\n\nimport { entryPointV07Abi } from \"../abi/entryPointV07.js\";\nimport { pepuMainnet } from \"../chains.js\";\nimport { getContract } from \"../contracts.js\";\nimport { PepuBundlerError, PepuConfigError } from \"../errors.js\";\nimport { redactSecrets } from \"./describe.js\";\n\n/** Minimal fetch signature, so tests and non-browser hosts can inject one. */\nexport type FetchLike = (input: string, init?: RequestInit) => Promise<Response>;\n\nexport interface ProbeOptions {\n fetch?: FetchLike;\n /** Per-request timeout. Default 8000. */\n timeoutMs?: number;\n}\n\nexport interface BundlerProbeResult {\n ok: boolean;\n chainId?: number;\n entryPoints?: Address[];\n /**\n * `true` when the method exists. Each method is called with deliberately empty\n * (invalid) params, so nothing is ever sent on-chain: an \"invalid params\" or\n * validation answer means the method exists, a \"method not found\" answer\n * (including Alto's \"Invalid discriminator value\") means it does not.\n */\n supportedMethods?: Record<string, boolean>;\n /** Required methods (see `REQUIRED_BUNDLER_METHODS`) the bundler lacks. Empty when all are present. */\n missingRequiredMethods?: string[];\n latencyMs: number;\n error?: PepuBundlerError;\n}\n\nexport interface PaymasterProbeResult {\n ok: boolean;\n /** `GET <origin>/health` answered `{ status: \"ok\" }`. */\n health?: boolean;\n /** Body of `GET <origin>/v2/free-tier` when the service exposes it. */\n freeTier?: unknown;\n /**\n * `true` when the URL answered `pm_getPaymasterStubData` with a stub result,\n * `false` when it did not answer JSON-RPC at all. A JSON-RPC denial (no\n * credential, unknown sender) leaves it `undefined`: the endpoint speaks\n * ERC-7677 but the probe has no credential, so a stub cannot be judged. Read\n * `erc7677` for the three-way answer.\n */\n erc7677StubOk?: boolean;\n /**\n * `\"stub-ok\"`: a stub came back. `\"needs-credential\"`: the endpoint speaks ERC-7677\n * JSON-RPC and answered with an error (no credential, unknown sender), so the stub\n * check is not applicable without a client token. `\"not-responding\"`: no JSON-RPC answer.\n */\n erc7677?: \"stub-ok\" | \"needs-credential\" | \"not-responding\";\n latencyMs: number;\n error?: PepuBundlerError;\n}\n\nconst BUNDLER_METHODS = [\n \"eth_sendUserOperation\",\n \"eth_estimateUserOperationGas\",\n \"eth_getUserOperationReceipt\",\n \"eth_getUserOperationByHash\",\n \"pimlico_getUserOperationGasPrice\",\n \"zd_getUserOperationGasPrice\",\n] as const;\n\n/** Methods a bundler must support to be usable for PEPU sponsored UserOperations. */\nexport const REQUIRED_BUNDLER_METHODS = [\n \"eth_sendUserOperation\",\n \"eth_estimateUserOperationGas\",\n \"eth_getUserOperationReceipt\",\n] as const;\n\nconst METHOD_NOT_FOUND = -32601;\n\n/**\n * A bundler answers a method that does not exist with \"method not found\". Alto\n * (Pimlico) also reports bad params of a KNOWN method with code -32601 and a\n * \"Validation error: ...\" message, and an unknown method as \"Validation error:\n * Invalid discriminator value\". So -32601 means unsupported unless the message is\n * a params validation error that is not the discriminator one.\n */\nfunction isMethodNotFound(error: { code?: number; message?: string } | undefined): boolean {\n if (!error || error.code !== METHOD_NOT_FOUND) return false;\n const message = error.message ?? \"\";\n if (/invalid discriminator value/i.test(message)) return true;\n return !/validation error|invalid params|must contain|required at/i.test(message);\n}\n\nfunction hostOf(url: string): string {\n try {\n return new URL(url).host;\n } catch {\n return \"the configured host\";\n }\n}\n\nfunction checkUrl(url: string, label: string): void {\n let u: URL;\n try {\n u = new URL(url);\n } catch {\n throw new PepuConfigError(\"CONFIG_BAD_URL\", `${label} is not a valid URL.`);\n }\n if (u.protocol !== \"http:\" && u.protocol !== \"https:\") {\n throw new PepuConfigError(\"CONFIG_BAD_URL\", `${label} must be an http(s) URL.`);\n }\n}\n\nasync function timedFetch(f: FetchLike, url: string, init: RequestInit, timeoutMs: number): Promise<Response> {\n const ctl = new AbortController();\n const t = setTimeout(() => ctl.abort(), timeoutMs);\n try {\n return await f(url, { ...init, signal: ctl.signal });\n } finally {\n clearTimeout(t);\n }\n}\n\ninterface RpcReply {\n result?: unknown;\n error?: { code?: number; message?: string; data?: unknown };\n}\n\nasync function rpc(f: FetchLike, url: string, method: string, params: unknown[], timeoutMs: number): Promise<RpcReply> {\n const res = await timedFetch(\n f,\n url,\n {\n method: \"POST\",\n headers: { \"content-type\": \"application/json\" },\n body: JSON.stringify({ jsonrpc: \"2.0\", id: 1, method, params }),\n },\n timeoutMs,\n );\n let body: unknown;\n try {\n body = await res.json();\n } catch {\n throw new Error(`HTTP ${res.status} with a non-JSON body`);\n }\n if (!body || typeof body !== \"object\") throw new Error(`HTTP ${res.status} with an unexpected body`);\n return body as RpcReply;\n}\n\nfunction unreachable(url: string, e: unknown): PepuBundlerError {\n const reason = e instanceof Error && e.name === \"AbortError\" ? \"timed out\" : redactSecrets(e instanceof Error ? e.message : String(e)).replace(/https?:\\/\\/\\S+/g, \"[url]\");\n return new PepuBundlerError(\"BUNDLER_UNREACHABLE\", `Could not reach ${hostOf(url)}: ${reason}`, { cause: e });\n}\n\n/**\n * Probe a bundler URL: `eth_chainId`, `eth_supportedEntryPoints` and a\n * capability check of the methods PEPU apps use (a method answered with\n * anything but \"method not found\" counts as supported; nothing is sent\n * on-chain). Never throws for network trouble; returns `ok: false` with a\n * `BUNDLER_UNREACHABLE` error. Throws `CONFIG_BAD_URL` for a malformed URL.\n *\n * @example\n * const r = await probeBundler(\"https://bundler.example.com\");\n * if (!r.ok) console.log(r.error?.hint);\n */\nexport async function probeBundler(url: string, o: ProbeOptions = {}): Promise<BundlerProbeResult> {\n checkUrl(url, \"Bundler URL\");\n const f: FetchLike = o.fetch ?? ((i, init) => fetch(i, init));\n const timeoutMs = o.timeoutMs ?? 8000;\n const started = Date.now();\n try {\n const chain = await rpc(f, url, \"eth_chainId\", [], timeoutMs);\n const eps = await rpc(f, url, \"eth_supportedEntryPoints\", [], timeoutMs);\n const chainId = typeof chain.result === \"string\" ? Number(BigInt(chain.result)) : undefined;\n const entryPoints = Array.isArray(eps.result) ? (eps.result as Address[]) : undefined;\n const supportedMethods: Record<string, boolean> = {};\n for (const m of BUNDLER_METHODS) {\n try {\n const r = await rpc(f, url, m, [], timeoutMs);\n supportedMethods[m] = !isMethodNotFound(r.error);\n } catch {\n supportedMethods[m] = false;\n }\n }\n const ep07 = getContract(pepuMainnet.id, \"entryPoint07\");\n const want = ep07?.status === \"deployed\" ? ep07.address.toLowerCase() : undefined;\n const missing = REQUIRED_BUNDLER_METHODS.filter((m) => supportedMethods[m] !== true);\n const chainAndEntryPointOk =\n chainId === pepuMainnet.id &&\n (want === undefined || (entryPoints?.some((a) => a.toLowerCase() === want) ?? false));\n const ok = chainAndEntryPointOk && missing.length === 0;\n const out: BundlerProbeResult = {\n ok,\n latencyMs: Date.now() - started,\n supportedMethods,\n missingRequiredMethods: [...missing],\n };\n if (chainId !== undefined) out.chainId = chainId;\n if (entryPoints) out.entryPoints = entryPoints;\n if (!ok) {\n out.error = new PepuBundlerError(\n \"BUNDLER_UNREACHABLE\",\n chainId !== undefined && chainId !== pepuMainnet.id\n ? `The bundler serves chain ${chainId}, not ${pepuMainnet.id}.`\n : !chainAndEntryPointOk\n ? \"The bundler does not list EntryPoint v0.7.\"\n : `The bundler does not support ${missing.join(\", \")}.`,\n {\n hint: \"Point PEPU_BUNDLER_URL at a bundler for chain 97741 that supports EntryPoint v0.7 and the ERC-4337 UserOperation methods.\",\n },\n );\n }\n return out;\n } catch (e) {\n return { ok: false, latencyMs: Date.now() - started, error: unreachable(url, e) };\n }\n}\n\nconst STUB_PROBE_OP = {\n sender: \"0x0000000000000000000000000000000000000001\",\n nonce: \"0x0\",\n callData: \"0x\",\n callGasLimit: \"0x0\",\n verificationGasLimit: \"0x0\",\n preVerificationGas: \"0x0\",\n maxFeePerGas: \"0x0\",\n maxPriorityFeePerGas: \"0x0\",\n signature: \"0x\",\n} as const;\n\n/**\n * Probe a paymaster URL: the service base (`https://paymaster.pepeunchained.com`) or the ERC-7677 endpoint\n * (`https://host/v2/paymaster/<token>`).\n * Checks `GET <origin>/health`, `GET <origin>/v2/free-tier`, and whether the URL\n * answers JSON-RPC `pm_getPaymasterStubData` (`erc7677`: without a client token a\n * JSON-RPC denial is reported as `\"needs-credential\"`, not as a failure). `ok` means\n * every capability that could be checked is fine: `/health` did not fail and the URL\n * spoke ERC-7677 JSON-RPC. The URL (which can embed a\n * token) never appears in the returned error.\n *\n * @example\n * const r = await probePaymaster(process.env.PEPU_PAYMASTER_URL!);\n * console.log(r.ok, r.freeTier);\n */\nexport async function probePaymaster(url: string, o: ProbeOptions = {}): Promise<PaymasterProbeResult> {\n checkUrl(url, \"Paymaster URL\");\n const f: FetchLike = o.fetch ?? ((i, init) => fetch(i, init));\n const timeoutMs = o.timeoutMs ?? 8000;\n const started = Date.now();\n const origin = new URL(url).origin;\n const out: PaymasterProbeResult = { ok: false, latencyMs: 0 };\n let reached = false;\n let lastError: unknown;\n\n try {\n const res = await timedFetch(f, `${origin}/health`, { method: \"GET\" }, timeoutMs);\n reached = true;\n const body = (await res.json().catch(() => null)) as { status?: unknown } | null;\n out.health = res.ok && body?.status === \"ok\";\n } catch (e) {\n lastError = e;\n out.health = false;\n }\n\n try {\n const res = await timedFetch(f, `${origin}/v2/free-tier`, { method: \"GET\" }, timeoutMs);\n reached = true;\n if (res.ok) out.freeTier = await res.json().catch(() => undefined);\n } catch (e) {\n lastError = e;\n }\n\n let speaksRpc = false;\n try {\n const ep07 = getContract(pepuMainnet.id, \"entryPoint07\");\n const ep = ep07?.status === \"deployed\" ? ep07.address : \"0x0000000071727De22E5E9d8BAf0edAc6f37da032\";\n const reply = await rpc(\n f,\n url,\n \"pm_getPaymasterStubData\",\n [STUB_PROBE_OP, ep, `0x${pepuMainnet.id.toString(16)}`, {}],\n timeoutMs,\n );\n reached = true;\n // A JSON-RPC answer has a result, or an error OBJECT (a REST 404 body like {\"error\":\"not_found\"} is not one).\n const rpcError = reply.error !== null && typeof reply.error === \"object\";\n speaksRpc = reply.result !== undefined || rpcError;\n if (reply.result !== undefined) {\n out.erc7677StubOk = true;\n out.erc7677 = \"stub-ok\";\n } else if (rpcError) {\n // Alive and speaking JSON-RPC, but the probe has no credential: not applicable, not a failure.\n out.erc7677 = \"needs-credential\";\n } else {\n out.erc7677StubOk = false;\n out.erc7677 = \"not-responding\";\n }\n } catch (e) {\n lastError = e;\n out.erc7677StubOk = false;\n out.erc7677 = \"not-responding\";\n }\n\n out.latencyMs = Date.now() - started;\n out.ok = speaksRpc && out.health !== false;\n if (!reached) out.error = unreachable(url, lastError);\n else if (!out.ok) {\n out.error = new PepuBundlerError(\"BUNDLER_UNREACHABLE\", `${hostOf(url)} answered but is not a PEPU paymaster service.`, {\n hint: \"Check PEPU_PAYMASTER_URL points at the policy service (https://paymaster.pepeunchained.com), or its /v2/paymaster/<client token> endpoint.\",\n });\n }\n return out;\n}\n\n/**\n * The paymaster's EntryPoint v0.7 deposit in wei. A drop across a UserOperation\n * is the proof that it was sponsored. Defaults to PEPU's deployed paymaster.\n *\n * @example\n * const before = await getPaymasterDeposit(publicClient);\n */\nexport async function getPaymasterDeposit(client: PublicClient, paymaster?: Address): Promise<bigint> {\n const pm = getContract(pepuMainnet.id, \"paymaster\");\n const ep = getContract(pepuMainnet.id, \"entryPoint07\");\n const account = paymaster ?? (pm?.status === \"deployed\" ? pm.address : undefined);\n if (!account || ep?.status !== \"deployed\") {\n throw new PepuConfigError(\"CONFIG_MISSING_ENV\", \"No paymaster address is known; pass one explicitly.\", {\n hint: \"Pass the paymaster address as the second argument.\",\n });\n }\n return client.readContract({\n address: ep.address,\n abi: entryPointV07Abi,\n functionName: \"balanceOf\",\n args: [account],\n });\n}\n","import type { Address, Hex, PublicClient, Transport } from \"viem\";\n\nimport { kernelFactoryAbi } from \"../abi/kernelFactory.js\";\nimport type { PepuChain } from \"../chains.js\";\nimport type { DeployedContract } from \"../contracts.js\";\nimport { getContract } from \"../contracts.js\";\nimport { PEPU_ENV, resolvePepuEndpoints } from \"../endpoints.js\";\nimport { getPaymasterDeposit, probeBundler, probePaymaster } from \"./probes.js\";\nimport type { BundlerProbeResult, FetchLike, PaymasterProbeResult } from \"./probes.js\";\n\n/**\n * The account-abstraction contracts a Kernel v3 smart account needs,\n * narrowed to their {@link DeployedContract} form for a given chain.\n * Returns `undefined` if any one of them isn't deployed on that chain\n * (today: everything except mainnet, `97741`) — this package never fabricates\n * a partial/best-effort bundle.\n */\nexport interface PepuKernelStack {\n readonly entryPoint06: DeployedContract;\n readonly entryPoint07: DeployedContract;\n readonly kernelFactory: DeployedContract;\n readonly kernelMetaFactory: DeployedContract;\n readonly ecdsaValidator: DeployedContract;\n}\n\n/**\n * Look up every AA contract this package knows about for `chainId`, already\n * narrowed to {@link DeployedContract}. Returns `undefined` unless *all* five\n * are deployed on that chain (today, only PEPU mainnet qualifies) — a caller\n * building a Kernel account needs every one of them, so a partial result\n * would just move the \"is this actually usable\" check into every caller.\n *\n * This is a convenience grouping over `getContract` from `./contracts.js`;\n * it doesn't add any address or fact that registry doesn't already have.\n */\nexport function getPepuKernelStack(chainId: number): PepuKernelStack | undefined {\n const entryPoint06 = getContract(chainId, \"entryPoint06\");\n const entryPoint07 = getContract(chainId, \"entryPoint07\");\n const kernelFactory = getContract(chainId, \"kernelFactory\");\n const kernelMetaFactory = getContract(chainId, \"kernelMetaFactory\");\n const ecdsaValidator = getContract(chainId, \"ecdsaValidator\");\n\n if (\n entryPoint06?.status !== \"deployed\" ||\n entryPoint07?.status !== \"deployed\" ||\n kernelFactory?.status !== \"deployed\" ||\n kernelMetaFactory?.status !== \"deployed\" ||\n ecdsaValidator?.status !== \"deployed\"\n ) {\n return undefined;\n }\n\n return { entryPoint06, entryPoint07, kernelFactory, kernelMetaFactory, ecdsaValidator };\n}\n\n/**\n * Legacy static gas-sponsorship status for PEPU. **Always reports\n * unavailable** (it never probes). Sponsorship is PROVEN end to end on PEPU\n * mainnet through the hosted bundler and paymaster service (a zero-balance\n * Kernel smart account transacted, paid for by the paymaster); use\n * `checkSponsorship()` for the live answer. This function\n * exists so nothing downstream (this package, `@pepu-chain/mcp`, an app)\n * has to independently invent an \"is sponsorship on?\" check, and so that\n * check can't silently start lying once this file changes.\n *\n * Do not treat the presence of `kernelFactory`/`ecdsaValidator`/`paymaster`\n * addresses in {@link getPepuKernelStack} / the contract registry as\n * sponsorship support — those let you build and deploy a Kernel account and\n * send its UserOperations through a normal `eth_sendTransaction`-style flow\n * (self-paying its own gas via the EntryPoint deposit), which is a real,\n * working feature; sponsoring that gas needs a funded project or free-tier token.\n */\nexport interface SponsorshipStatus {\n readonly available: false;\n readonly reason: string;\n /**\n * Extension point for a future bundler/paymaster integration. Passing a\n * URL here does **not** make sponsorship available — `available` stays\n * `false` regardless — this field only exists so a caller can start\n * wiring a URL through their own config today and have this function\n * start using it later without an API change.\n */\n readonly bundlerUrl?: string;\n}\n\n/** Options for {@link getSponsorshipStatus}. */\nexport interface GetSponsorshipStatusOptions {\n /** See {@link SponsorshipStatus.bundlerUrl}. Not yet used for anything. */\n readonly bundlerUrl?: string;\n}\n\n/**\n * @deprecated Always reports `available: false`. Use `checkSponsorship()` (live\n * bundler and paymaster probe) from `@pepu-chain/sdk`. Kept for 0.1 callers.\n */\nexport function getSponsorshipStatus(\n options?: GetSponsorshipStatusOptions,\n): SponsorshipStatus {\n const reason =\n \"This deprecated function never probes anything and always reports \" +\n \"unavailable. The hosted bundler (bundler.pepeunchained.com) and \" +\n \"paymaster service (paymaster.pepeunchained.com) are live, and \" +\n \"sponsorship is proven end to end on mainnet through them. Call \" +\n \"checkSponsorship() for the live status. A Kernel v3 smart account \" +\n \"without a funded project or free-tier token must still fund its own \" +\n \"EntryPoint deposit and pay its own gas, like a normal EOA-sent transaction.\";\n return options?.bundlerUrl === undefined\n ? { available: false, reason }\n : { available: false, reason, bundlerUrl: options.bundlerUrl };\n}\n\n/**\n * Compute (or confirm) the counterfactual address of a Kernel v3 smart\n * account via the verified factory's `getAddress(data, salt)` — a thin,\n * typed pass-through, not a re-implementation.\n *\n * Deliberately does **not** build `data` (Kernel v3.1's `initialize(...)`\n * calldata: root validator, hook, validator data, hook data, init config)\n * for you. A hand-rolled encoding here would be a second, unverified copy of\n * the byte layout that ZeroDev's SDK already produces (and that has been\n * exercised against PEPU's factory through the sponsored-transaction run),\n * which is exactly the kind of invented encoding this package's rules\n * forbid for addresses. Build `data` with ZeroDev's\n * `@zerodev/sdk` (or by hand from the public Kernel v3 contracts source),\n * then pass the result here.\n */\nexport async function getKernelAccountAddress(\n client: PublicClient<Transport, PepuChain>,\n factory: Pick<DeployedContract, \"address\">,\n args: { readonly data: Hex; readonly salt: Hex },\n): Promise<Address> {\n return client.readContract({\n address: factory.address,\n abi: kernelFactoryAbi,\n functionName: \"getAddress\",\n args: [args.data, args.salt],\n });\n}\n\n/** Live sponsorship report from {@link checkSponsorship}. */\nexport interface SponsorshipReport {\n /** True only when a bundler and a paymaster are configured and both answer. */\n available: boolean;\n /** `direct` when you bring your own bundler and paymaster URLs; `none` when nothing is configured. */\n transport: \"direct\" | \"none\";\n bundler: { configured: boolean; probe?: BundlerProbeResult };\n paymaster: { configured: boolean; probe?: PaymasterProbeResult; depositWei?: bigint };\n /** One sentence for a human or an agent. */\n reason: string;\n /** Concrete next steps, empty when `available`. */\n fixes: string[];\n}\n\n/** Options for {@link checkSponsorship}. */\nexport interface CheckSponsorshipOptions {\n bundlerUrl?: string;\n paymasterUrl?: string;\n env?: Record<string, string | undefined>;\n fetch?: FetchLike;\n /** When given, also read the paymaster's EntryPoint deposit. */\n publicClient?: PublicClient;\n /** Paymaster contract to read the deposit of. Defaults to PEPU's deployed paymaster. */\n paymasterAddress?: Address;\n timeoutMs?: number;\n}\n\n/**\n * Live gas-sponsorship status. Resolves the bundler and paymaster URLs from\n * options, env, then the hosted defaults (bundler.pepeunchained.com and the paymaster\n * service base; with no token URL the service is probed at its base), probes both,\n * and optionally reads the paymaster deposit. Never throws for an\n * unreachable service; it reports `available: false` with `fixes`.\n * Replaces the hard-coded {@link getSponsorshipStatus}.\n *\n * @example\n * const s = await checkSponsorship({ publicClient });\n * if (!s.available) console.log(s.reason, s.fixes);\n */\nexport async function checkSponsorship(options: CheckSponsorshipOptions = {}): Promise<SponsorshipReport> {\n const { bundlerUrl, paymasterUrl: erc7677Url, paymasterBaseUrl } = resolvePepuEndpoints({\n ...(options.bundlerUrl !== undefined ? { bundlerUrl: options.bundlerUrl } : {}),\n ...(options.paymasterUrl !== undefined ? { paymasterUrl: options.paymasterUrl } : {}),\n ...(options.env ? { env: options.env } : {}),\n });\n // No token means no complete ERC-7677 URL: probe the service base (health + free-tier state) instead.\n const paymasterUrl = erc7677Url ?? paymasterBaseUrl;\n const probeOpts = {\n ...(options.fetch ? { fetch: options.fetch } : {}),\n ...(options.timeoutMs !== undefined ? { timeoutMs: options.timeoutMs } : {}),\n };\n const fixes: string[] = [];\n if (bundlerUrl === null) fixes.push(`Set ${PEPU_ENV.bundlerUrl} to a bundler for chain 97741 (EntryPoint v0.7).`);\n if (paymasterUrl === null) fixes.push(`Set ${PEPU_ENV.paymasterUrl} to your ERC-7677 paymaster endpoint (https://paymaster.pepeunchained.com/v2/paymaster/<client token>).`);\n\n const [bProbe, pProbe] = await Promise.all([\n bundlerUrl === null ? undefined : probeBundler(bundlerUrl, probeOpts),\n paymasterUrl === null ? undefined : probePaymaster(paymasterUrl, probeOpts),\n ]);\n if (bProbe && !bProbe.ok) fixes.push(bProbe.error?.hint ?? \"The bundler did not answer correctly.\");\n if (pProbe && !pProbe.ok) fixes.push(pProbe.error?.hint ?? \"The paymaster did not answer correctly.\");\n\n let depositWei: bigint | undefined;\n if (options.publicClient) {\n try {\n depositWei = await getPaymasterDeposit(options.publicClient, options.paymasterAddress);\n if (depositWei === 0n) fixes.push(\"The paymaster's EntryPoint deposit is empty. Deposit PEPU to it.\");\n } catch {\n // A failed read must not flip availability; the probes are the source of truth.\n }\n }\n\n const available = !!bProbe?.ok && !!pProbe?.ok && depositWei !== 0n;\n const configured = bundlerUrl !== null || paymasterUrl !== null;\n const reason = available\n ? \"Bundler and paymaster are reachable; sponsored UserOperations can be sent.\"\n : !configured\n ? \"No bundler or paymaster URL is configured. Set PEPU_BUNDLER_URL and PEPU_PAYMASTER_URL, or use the hosted defaults.\"\n : \"A bundler or paymaster is configured but not fully working. See fixes.\";\n return {\n available,\n transport: configured ? \"direct\" : \"none\",\n bundler: { configured: bundlerUrl !== null, ...(bProbe ? { probe: bProbe } : {}) },\n paymaster: {\n configured: paymasterUrl !== null,\n ...(pProbe ? { probe: pProbe } : {}),\n ...(depositWei !== undefined ? { depositWei } : {}),\n },\n reason,\n fixes,\n };\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/abi/kernelFactory.ts","../src/abi/entryPointV07.ts","../src/aa/probes.ts","../src/aa/status.ts"],"names":["parseAbi"],"mappings":";;;;;;;AA6BO,IAAM,mBAAmB,QAAA,CAAS;AAAA,EACvC,kDAAA;AAAA,EACA,+EAAA;AAAA,EACA;AACF,CAAC;AAOM,IAAM,kCAAA,GACX;ACdK,IAAM,mBAAmBA,QAAAA,CAAS;AAAA,EACvC,6EAAA;AAAA,EACA,4DAAA;AAAA,EACA,6CAAA;AAAA,EACA,8EAAA;AAAA,EACA,wJAAA;AAAA,EACA,gEAAA;AAAA,EACA;AACF,CAAC;;;ACuBD,IAAM,eAAA,GAAkB;AAAA,EACtB,uBAAA;AAAA,EACA,8BAAA;AAAA,EACA,6BAAA;AAAA,EACA,4BAAA;AAAA,EACA,kCAAA;AAAA,EACA;AACF,CAAA;AAGO,IAAM,wBAAA,GAA2B;AAAA,EACtC,uBAAA;AAAA,EACA,8BAAA;AAAA,EACA;AACF,CAAA;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A;AAAA,IACtG,CAAA,CAAA,MAAQ;AAAA,IAER;AAAA,EACF;AAEA,EAAA,MAAM,SAAA,GAAY,CAAC,CAAC,MAAA,EAAQ,MAAM,CAAC,CAAC,MAAA,EAAQ,EAAA,IAAM,UAAA,KAAe,EAAA;AACjE,EAAA,MAAM,UAAA,GAAa,UAAA,KAAe,IAAA,IAAQ,YAAA,KAAiB,IAAA;AAC3D,EAAA,MAAM,MAAA,GAAS,SAAA,GACX,4EAAA,GACA,CAAC,aACC,qHAAA,GACA,wEAAA;AACN,EAAA,OAAO;AAAA,IACL,SAAA;AAAA,IACA,SAAA,EAAW,aAAa,QAAA,GAAW,MAAA;AAAA,IACnC,OAAA,EAAS,EAAE,UAAA,EAAY,UAAA,KAAe,IAAA,EAAM,GAAI,MAAA,GAAS,EAAE,KAAA,EAAO,MAAA,EAAO,GAAI,EAAC,EAAG;AAAA,IACjF,SAAA,EAAW;AAAA,MACT,YAAY,YAAA,KAAiB,IAAA;AAAA,MAC7B,GAAI,MAAA,GAAS,EAAE,KAAA,EAAO,MAAA,KAAW,EAAC;AAAA,MAClC,GAAI,UAAA,KAAe,MAAA,GAAY,EAAE,UAAA,KAAe;AAAC,KACnD;AAAA,IACA,MAAA;AAAA,IACA;AAAA,GACF;AACF","file":"chunk-XR5ONV2Y.js","sourcesContent":["import { parseAbi } from \"viem\";\n\n/**\n * ZeroDev Kernel v3 account factory ABI, at\n * `0xaac5D4240AF87249B3f71BC8E4A2cae074A3E419` (deployed on PEPU mainnet\n * only; see `pepuContracts.kernelFactory` in `../contracts.js`).\n *\n * Verified live against mainnet 2026-09-24 via `eth_call`:\n * - `implementation()` returns `0xbAC849bB641841b44E965fb01A4Bf5F074F84B4d` —\n * ZeroDev's Kernel v3.1 singleton implementation address, deployed at the\n * same address on every chain that has it via CREATE2.\n * - `getAddress(bytes,bytes32)`, called with empty `data` and a zero salt,\n * returns a computed address without reverting.\n * - `createAccount(bytes,bytes32)`, simulated (not sent) with the same\n * empty `data` and zero salt via `eth_call`, returns the **same** address\n * `getAddress` computed for those inputs — exactly the counterfactual-\n * address behavior a CREATE2 account factory is supposed to have.\n *\n * What this package does NOT ship: a helper that encodes the `data`\n * argument (Kernel v3.1's `initialize(...)` calldata — root validator,\n * hook, validator data, hook data, init config). No account has ever been\n * created through this factory on PEPU yet (its transaction history is\n * empty as of the verification date above), so there was nothing on-chain\n * to check a hand-rolled encoding against, and guessing one here would be\n * exactly the kind of invented byte layout this package's rules forbid.\n * Use ZeroDev's own `@zerodev/sdk` (or the public Kernel contracts source)\n * to build that payload, then pass the resulting bytes into\n * `getAddress`/`createAccount` from this ABI.\n */\nexport const kernelFactoryAbi = parseAbi([\n \"function implementation() view returns (address)\",\n \"function getAddress(bytes calldata data, bytes32 salt) view returns (address)\",\n \"function createAccount(bytes calldata data, bytes32 salt) payable returns (address)\",\n]);\n\n/**\n * The verified Kernel v3.1 singleton implementation address that\n * `kernelFactoryAbi`'s `implementation()` resolves to on PEPU mainnet. Same\n * address ZeroDev uses across every chain that has this Kernel version.\n */\nexport const KERNEL_V3_1_IMPLEMENTATION_ADDRESS =\n \"0xbAC849bB641841b44E965fb01A4Bf5F074F84B4d\" as const;\n","import { parseAbi } from \"viem\";\n\n/**\n * ERC-4337 EntryPoint v0.7 ABI — the subset a dapp actually needs to manage\n * a smart account's gas deposit and read its nonce, at the canonical address\n * `0x0000000071727De22E5E9d8BAf0edAc6f37da032` (deployed on PEPU mainnet\n * only; see `pepuContracts.entryPoint07` in `../contracts.js`).\n *\n * This is NOT the full `IEntryPoint` interface (no `handleOps`,\n * `simulateValidation`, etc.) — those are normally called by a bundler, and\n * PEPU has no publicly hosted bundler yet (see `getSponsorshipStatus` in\n * `../aa/status.js`). This ABI only covers deposit/nonce management, which works\n * today with a plain viem wallet client and no bundler at all.\n *\n * Verified live against mainnet 2026-09-24 via `eth_call`:\n * - `getNonce(address,uint192)` for the zero address/key returns `0`.\n * - `balanceOf(address)` for the zero address returns `0`.\n * - `getDepositInfo(address)` for the zero address returns a 5-word\n * (all-zero) tuple, matching the v0.7 `DepositInfo` struct shape\n * `(uint256 deposit, bool staked, uint96 stake, uint32 unstakeDelaySec,\n * uint48 withdrawTime)` field-for-field.\n * `depositTo`/`withdrawTo` share the same `IStakeManager` interface as the\n * verified `getDepositInfo`/`balanceOf` pair and are standard across every\n * EntryPoint version; they were not separately simulated (both mutate\n * state, and simulating a withdrawal from an empty deposit would only prove\n * it reverts, not that it works).\n */\nexport const entryPointV07Abi = parseAbi([\n \"function getNonce(address sender, uint192 key) view returns (uint256 nonce)\",\n \"function balanceOf(address account) view returns (uint256)\",\n \"function depositTo(address account) payable\",\n \"function withdrawTo(address payable withdrawAddress, uint256 withdrawAmount)\",\n \"function getDepositInfo(address account) view returns ((uint256 deposit, bool staked, uint96 stake, uint32 unstakeDelaySec, uint48 withdrawTime) info)\",\n \"event Deposited(address indexed account, uint256 totalDeposit)\",\n \"event Withdrawn(address indexed account, address withdrawAddress, uint256 amount)\",\n]);\n","import type { Address, PublicClient } from \"viem\";\n\nimport { entryPointV07Abi } from \"../abi/entryPointV07.js\";\nimport { pepuMainnet } from \"../chains.js\";\nimport { getContract } from \"../contracts.js\";\nimport { PepuBundlerError, PepuConfigError } from \"../errors.js\";\nimport { redactSecrets } from \"./describe.js\";\n\n/** Minimal fetch signature, so tests and non-browser hosts can inject one. */\nexport type FetchLike = (input: string, init?: RequestInit) => Promise<Response>;\n\nexport interface ProbeOptions {\n fetch?: FetchLike;\n /** Per-request timeout. Default 8000. */\n timeoutMs?: number;\n}\n\nexport interface BundlerProbeResult {\n ok: boolean;\n chainId?: number;\n entryPoints?: Address[];\n /**\n * `true` when the method exists. Each method is called with deliberately empty\n * (invalid) params, so nothing is ever sent on-chain: an \"invalid params\" or\n * validation answer means the method exists, a \"method not found\" answer\n * (including Alto's \"Invalid discriminator value\") means it does not.\n */\n supportedMethods?: Record<string, boolean>;\n /** Required methods (see `REQUIRED_BUNDLER_METHODS`) the bundler lacks. Empty when all are present. */\n missingRequiredMethods?: string[];\n latencyMs: number;\n error?: PepuBundlerError;\n}\n\nexport interface PaymasterProbeResult {\n ok: boolean;\n /** `GET <origin>/health` answered `{ status: \"ok\" }`. */\n health?: boolean;\n /** Body of `GET <origin>/v2/free-tier` when the service exposes it. */\n freeTier?: unknown;\n /**\n * `true` when the URL answered `pm_getPaymasterStubData` with a stub result,\n * `false` when it did not answer JSON-RPC at all. A JSON-RPC denial (no\n * credential, unknown sender) leaves it `undefined`: the endpoint speaks\n * ERC-7677 but the probe has no credential, so a stub cannot be judged. Read\n * `erc7677` for the three-way answer.\n */\n erc7677StubOk?: boolean;\n /**\n * `\"stub-ok\"`: a stub came back. `\"needs-credential\"`: the endpoint speaks ERC-7677\n * JSON-RPC and answered with an error (no credential, unknown sender), so the stub\n * check is not applicable without a client token. `\"not-responding\"`: no JSON-RPC answer.\n */\n erc7677?: \"stub-ok\" | \"needs-credential\" | \"not-responding\";\n latencyMs: number;\n error?: PepuBundlerError;\n}\n\nconst BUNDLER_METHODS = [\n \"eth_sendUserOperation\",\n \"eth_estimateUserOperationGas\",\n \"eth_getUserOperationReceipt\",\n \"eth_getUserOperationByHash\",\n \"pimlico_getUserOperationGasPrice\",\n \"zd_getUserOperationGasPrice\",\n] as const;\n\n/** Methods a bundler must support to be usable for PEPU sponsored UserOperations. */\nexport const REQUIRED_BUNDLER_METHODS = [\n \"eth_sendUserOperation\",\n \"eth_estimateUserOperationGas\",\n \"eth_getUserOperationReceipt\",\n] as const;\n\nconst METHOD_NOT_FOUND = -32601;\n\n/**\n * A bundler answers a method that does not exist with \"method not found\". Alto\n * (Pimlico) also reports bad params of a KNOWN method with code -32601 and a\n * \"Validation error: ...\" message, and an unknown method as \"Validation error:\n * Invalid discriminator value\". So -32601 means unsupported unless the message is\n * a params validation error that is not the discriminator one.\n */\nfunction isMethodNotFound(error: { code?: number; message?: string } | undefined): boolean {\n if (!error || error.code !== METHOD_NOT_FOUND) return false;\n const message = error.message ?? \"\";\n if (/invalid discriminator value/i.test(message)) return true;\n return !/validation error|invalid params|must contain|required at/i.test(message);\n}\n\nfunction hostOf(url: string): string {\n try {\n return new URL(url).host;\n } catch {\n return \"the configured host\";\n }\n}\n\nfunction checkUrl(url: string, label: string): void {\n let u: URL;\n try {\n u = new URL(url);\n } catch {\n throw new PepuConfigError(\"CONFIG_BAD_URL\", `${label} is not a valid URL.`);\n }\n if (u.protocol !== \"http:\" && u.protocol !== \"https:\") {\n throw new PepuConfigError(\"CONFIG_BAD_URL\", `${label} must be an http(s) URL.`);\n }\n}\n\nasync function timedFetch(f: FetchLike, url: string, init: RequestInit, timeoutMs: number): Promise<Response> {\n const ctl = new AbortController();\n const t = setTimeout(() => ctl.abort(), timeoutMs);\n try {\n return await f(url, { ...init, signal: ctl.signal });\n } finally {\n clearTimeout(t);\n }\n}\n\ninterface RpcReply {\n result?: unknown;\n error?: { code?: number; message?: string; data?: unknown };\n}\n\nasync function rpc(f: FetchLike, url: string, method: string, params: unknown[], timeoutMs: number): Promise<RpcReply> {\n const res = await timedFetch(\n f,\n url,\n {\n method: \"POST\",\n headers: { \"content-type\": \"application/json\" },\n body: JSON.stringify({ jsonrpc: \"2.0\", id: 1, method, params }),\n },\n timeoutMs,\n );\n let body: unknown;\n try {\n body = await res.json();\n } catch {\n throw new Error(`HTTP ${res.status} with a non-JSON body`);\n }\n if (!body || typeof body !== \"object\") throw new Error(`HTTP ${res.status} with an unexpected body`);\n return body as RpcReply;\n}\n\nfunction unreachable(url: string, e: unknown): PepuBundlerError {\n const reason = e instanceof Error && e.name === \"AbortError\" ? \"timed out\" : redactSecrets(e instanceof Error ? e.message : String(e)).replace(/https?:\\/\\/\\S+/g, \"[url]\");\n return new PepuBundlerError(\"BUNDLER_UNREACHABLE\", `Could not reach ${hostOf(url)}: ${reason}`, { cause: e });\n}\n\n/**\n * Probe a bundler URL: `eth_chainId`, `eth_supportedEntryPoints` and a\n * capability check of the methods PEPU apps use (a method answered with\n * anything but \"method not found\" counts as supported; nothing is sent\n * on-chain). Never throws for network trouble; returns `ok: false` with a\n * `BUNDLER_UNREACHABLE` error. Throws `CONFIG_BAD_URL` for a malformed URL.\n *\n * @example\n * const r = await probeBundler(\"https://bundler.example.com\");\n * if (!r.ok) console.log(r.error?.hint);\n */\nexport async function probeBundler(url: string, o: ProbeOptions = {}): Promise<BundlerProbeResult> {\n checkUrl(url, \"Bundler URL\");\n const f: FetchLike = o.fetch ?? ((i, init) => fetch(i, init));\n const timeoutMs = o.timeoutMs ?? 8000;\n const started = Date.now();\n try {\n const chain = await rpc(f, url, \"eth_chainId\", [], timeoutMs);\n const eps = await rpc(f, url, \"eth_supportedEntryPoints\", [], timeoutMs);\n const chainId = typeof chain.result === \"string\" ? Number(BigInt(chain.result)) : undefined;\n const entryPoints = Array.isArray(eps.result) ? (eps.result as Address[]) : undefined;\n const supportedMethods: Record<string, boolean> = {};\n for (const m of BUNDLER_METHODS) {\n try {\n const r = await rpc(f, url, m, [], timeoutMs);\n supportedMethods[m] = !isMethodNotFound(r.error);\n } catch {\n supportedMethods[m] = false;\n }\n }\n const ep07 = getContract(pepuMainnet.id, \"entryPoint07\");\n const want = ep07?.status === \"deployed\" ? ep07.address.toLowerCase() : undefined;\n const missing = REQUIRED_BUNDLER_METHODS.filter((m) => supportedMethods[m] !== true);\n const chainAndEntryPointOk =\n chainId === pepuMainnet.id &&\n (want === undefined || (entryPoints?.some((a) => a.toLowerCase() === want) ?? false));\n const ok = chainAndEntryPointOk && missing.length === 0;\n const out: BundlerProbeResult = {\n ok,\n latencyMs: Date.now() - started,\n supportedMethods,\n missingRequiredMethods: [...missing],\n };\n if (chainId !== undefined) out.chainId = chainId;\n if (entryPoints) out.entryPoints = entryPoints;\n if (!ok) {\n out.error = new PepuBundlerError(\n \"BUNDLER_UNREACHABLE\",\n chainId !== undefined && chainId !== pepuMainnet.id\n ? `The bundler serves chain ${chainId}, not ${pepuMainnet.id}.`\n : !chainAndEntryPointOk\n ? \"The bundler does not list EntryPoint v0.7.\"\n : `The bundler does not support ${missing.join(\", \")}.`,\n {\n hint: \"Point PEPU_BUNDLER_URL at a bundler for chain 97741 that supports EntryPoint v0.7 and the ERC-4337 UserOperation methods.\",\n },\n );\n }\n return out;\n } catch (e) {\n return { ok: false, latencyMs: Date.now() - started, error: unreachable(url, e) };\n }\n}\n\nconst STUB_PROBE_OP = {\n sender: \"0x0000000000000000000000000000000000000001\",\n nonce: \"0x0\",\n callData: \"0x\",\n callGasLimit: \"0x0\",\n verificationGasLimit: \"0x0\",\n preVerificationGas: \"0x0\",\n maxFeePerGas: \"0x0\",\n maxPriorityFeePerGas: \"0x0\",\n signature: \"0x\",\n} as const;\n\n/**\n * Probe a paymaster URL: the service base (`https://paymaster.pepeunchained.com`) or the ERC-7677 endpoint\n * (`https://host/v2/paymaster/<token>`).\n * Checks `GET <origin>/health`, `GET <origin>/v2/free-tier`, and whether the URL\n * answers JSON-RPC `pm_getPaymasterStubData` (`erc7677`: without a client token a\n * JSON-RPC denial is reported as `\"needs-credential\"`, not as a failure). `ok` means\n * every capability that could be checked is fine: `/health` did not fail and the URL\n * spoke ERC-7677 JSON-RPC. The URL (which can embed a\n * token) never appears in the returned error.\n *\n * @example\n * const r = await probePaymaster(process.env.PEPU_PAYMASTER_URL!);\n * console.log(r.ok, r.freeTier);\n */\nexport async function probePaymaster(url: string, o: ProbeOptions = {}): Promise<PaymasterProbeResult> {\n checkUrl(url, \"Paymaster URL\");\n const f: FetchLike = o.fetch ?? ((i, init) => fetch(i, init));\n const timeoutMs = o.timeoutMs ?? 8000;\n const started = Date.now();\n const origin = new URL(url).origin;\n const out: PaymasterProbeResult = { ok: false, latencyMs: 0 };\n let reached = false;\n let lastError: unknown;\n\n try {\n const res = await timedFetch(f, `${origin}/health`, { method: \"GET\" }, timeoutMs);\n reached = true;\n const body = (await res.json().catch(() => null)) as { status?: unknown } | null;\n out.health = res.ok && body?.status === \"ok\";\n } catch (e) {\n lastError = e;\n out.health = false;\n }\n\n try {\n const res = await timedFetch(f, `${origin}/v2/free-tier`, { method: \"GET\" }, timeoutMs);\n reached = true;\n if (res.ok) out.freeTier = await res.json().catch(() => undefined);\n } catch (e) {\n lastError = e;\n }\n\n let speaksRpc = false;\n try {\n const ep07 = getContract(pepuMainnet.id, \"entryPoint07\");\n const ep = ep07?.status === \"deployed\" ? ep07.address : \"0x0000000071727De22E5E9d8BAf0edAc6f37da032\";\n const reply = await rpc(\n f,\n url,\n \"pm_getPaymasterStubData\",\n [STUB_PROBE_OP, ep, `0x${pepuMainnet.id.toString(16)}`, {}],\n timeoutMs,\n );\n reached = true;\n // A JSON-RPC answer has a result, or an error OBJECT (a REST 404 body like {\"error\":\"not_found\"} is not one).\n const rpcError = reply.error !== null && typeof reply.error === \"object\";\n speaksRpc = reply.result !== undefined || rpcError;\n if (reply.result !== undefined) {\n out.erc7677StubOk = true;\n out.erc7677 = \"stub-ok\";\n } else if (rpcError) {\n // Alive and speaking JSON-RPC, but the probe has no credential: not applicable, not a failure.\n out.erc7677 = \"needs-credential\";\n } else {\n out.erc7677StubOk = false;\n out.erc7677 = \"not-responding\";\n }\n } catch (e) {\n lastError = e;\n out.erc7677StubOk = false;\n out.erc7677 = \"not-responding\";\n }\n\n out.latencyMs = Date.now() - started;\n out.ok = speaksRpc && out.health !== false;\n if (!reached) out.error = unreachable(url, lastError);\n else if (!out.ok) {\n out.error = new PepuBundlerError(\"BUNDLER_UNREACHABLE\", `${hostOf(url)} answered but is not a PEPU paymaster service.`, {\n hint: \"Check PEPU_PAYMASTER_URL points at the policy service (https://paymaster.pepeunchained.com), or its /v2/paymaster/<client token> endpoint.\",\n });\n }\n return out;\n}\n\n/**\n * The paymaster's EntryPoint v0.7 deposit in wei. A drop across a UserOperation\n * is the proof that it was sponsored. Defaults to PEPU's deployed paymaster.\n *\n * @example\n * const before = await getPaymasterDeposit(publicClient);\n */\nexport async function getPaymasterDeposit(client: PublicClient, paymaster?: Address): Promise<bigint> {\n const pm = getContract(pepuMainnet.id, \"paymaster\");\n const ep = getContract(pepuMainnet.id, \"entryPoint07\");\n const account = paymaster ?? (pm?.status === \"deployed\" ? pm.address : undefined);\n if (!account || ep?.status !== \"deployed\") {\n throw new PepuConfigError(\"CONFIG_MISSING_ENV\", \"No paymaster address is known; pass one explicitly.\", {\n hint: \"Pass the paymaster address as the second argument.\",\n });\n }\n return client.readContract({\n address: ep.address,\n abi: entryPointV07Abi,\n functionName: \"balanceOf\",\n args: [account],\n });\n}\n","import type { Address, Hex, PublicClient, Transport } from \"viem\";\n\nimport { kernelFactoryAbi } from \"../abi/kernelFactory.js\";\nimport type { PepuChain } from \"../chains.js\";\nimport type { DeployedContract } from \"../contracts.js\";\nimport { getContract } from \"../contracts.js\";\nimport { PEPU_ENV, resolvePepuEndpoints } from \"../endpoints.js\";\nimport { getPaymasterDeposit, probeBundler, probePaymaster } from \"./probes.js\";\nimport type { BundlerProbeResult, FetchLike, PaymasterProbeResult } from \"./probes.js\";\n\n/**\n * The account-abstraction contracts a Kernel v3 smart account needs,\n * narrowed to their {@link DeployedContract} form for a given chain.\n * Returns `undefined` if any one of them isn't deployed on that chain\n * (today: everything except mainnet, `97741`) — this package never fabricates\n * a partial/best-effort bundle.\n */\nexport interface PepuKernelStack {\n readonly entryPoint06: DeployedContract;\n readonly entryPoint07: DeployedContract;\n readonly kernelFactory: DeployedContract;\n readonly kernelMetaFactory: DeployedContract;\n readonly ecdsaValidator: DeployedContract;\n}\n\n/**\n * Look up every AA contract this package knows about for `chainId`, already\n * narrowed to {@link DeployedContract}. Returns `undefined` unless *all* five\n * are deployed on that chain (today, only PEPU mainnet qualifies) — a caller\n * building a Kernel account needs every one of them, so a partial result\n * would just move the \"is this actually usable\" check into every caller.\n *\n * This is a convenience grouping over `getContract` from `./contracts.js`;\n * it doesn't add any address or fact that registry doesn't already have.\n */\nexport function getPepuKernelStack(chainId: number): PepuKernelStack | undefined {\n const entryPoint06 = getContract(chainId, \"entryPoint06\");\n const entryPoint07 = getContract(chainId, \"entryPoint07\");\n const kernelFactory = getContract(chainId, \"kernelFactory\");\n const kernelMetaFactory = getContract(chainId, \"kernelMetaFactory\");\n const ecdsaValidator = getContract(chainId, \"ecdsaValidator\");\n\n if (\n entryPoint06?.status !== \"deployed\" ||\n entryPoint07?.status !== \"deployed\" ||\n kernelFactory?.status !== \"deployed\" ||\n kernelMetaFactory?.status !== \"deployed\" ||\n ecdsaValidator?.status !== \"deployed\"\n ) {\n return undefined;\n }\n\n return { entryPoint06, entryPoint07, kernelFactory, kernelMetaFactory, ecdsaValidator };\n}\n\n/**\n * Legacy static gas-sponsorship status for PEPU. **Always reports\n * unavailable** (it never probes). Sponsorship is PROVEN end to end on PEPU\n * mainnet through the hosted bundler and paymaster service (a zero-balance\n * Kernel smart account transacted, paid for by the paymaster); use\n * `checkSponsorship()` for the live answer. This function\n * exists so nothing downstream (this package, `@pepu-chain/mcp`, an app)\n * has to independently invent an \"is sponsorship on?\" check, and so that\n * check can't silently start lying once this file changes.\n *\n * Do not treat the presence of `kernelFactory`/`ecdsaValidator`/`paymaster`\n * addresses in {@link getPepuKernelStack} / the contract registry as\n * sponsorship support — those let you build and deploy a Kernel account and\n * send its UserOperations through a normal `eth_sendTransaction`-style flow\n * (self-paying its own gas via the EntryPoint deposit), which is a real,\n * working feature; sponsoring that gas needs a funded project or free-tier token.\n */\nexport interface SponsorshipStatus {\n readonly available: false;\n readonly reason: string;\n /**\n * Extension point for a future bundler/paymaster integration. Passing a\n * URL here does **not** make sponsorship available — `available` stays\n * `false` regardless — this field only exists so a caller can start\n * wiring a URL through their own config today and have this function\n * start using it later without an API change.\n */\n readonly bundlerUrl?: string;\n}\n\n/** Options for {@link getSponsorshipStatus}. */\nexport interface GetSponsorshipStatusOptions {\n /** See {@link SponsorshipStatus.bundlerUrl}. Not yet used for anything. */\n readonly bundlerUrl?: string;\n}\n\n/**\n * @deprecated Always reports `available: false`. Use `checkSponsorship()` (live\n * bundler and paymaster probe) from `@pepu-chain/sdk`. Kept for 0.1 callers.\n */\nexport function getSponsorshipStatus(\n options?: GetSponsorshipStatusOptions,\n): SponsorshipStatus {\n const reason =\n \"This deprecated function never probes anything and always reports \" +\n \"unavailable. The hosted bundler (bundler.pepeunchained.com) and \" +\n \"paymaster service (paymaster.pepeunchained.com) are live, and \" +\n \"sponsorship is proven end to end on mainnet through them. Call \" +\n \"checkSponsorship() for the live status. A Kernel v3 smart account \" +\n \"without a funded project or free-tier token must still fund its own \" +\n \"EntryPoint deposit and pay its own gas, like a normal EOA-sent transaction.\";\n return options?.bundlerUrl === undefined\n ? { available: false, reason }\n : { available: false, reason, bundlerUrl: options.bundlerUrl };\n}\n\n/**\n * Compute (or confirm) the counterfactual address of a Kernel v3 smart\n * account via the verified factory's `getAddress(data, salt)` — a thin,\n * typed pass-through, not a re-implementation.\n *\n * Deliberately does **not** build `data` (Kernel v3.1's `initialize(...)`\n * calldata: root validator, hook, validator data, hook data, init config)\n * for you. A hand-rolled encoding here would be a second, unverified copy of\n * the byte layout that ZeroDev's SDK already produces (and that has been\n * exercised against PEPU's factory through the sponsored-transaction run),\n * which is exactly the kind of invented encoding this package's rules\n * forbid for addresses. Build `data` with ZeroDev's\n * `@zerodev/sdk` (or by hand from the public Kernel v3 contracts source),\n * then pass the result here.\n */\nexport async function getKernelAccountAddress(\n client: PublicClient<Transport, PepuChain>,\n factory: Pick<DeployedContract, \"address\">,\n args: { readonly data: Hex; readonly salt: Hex },\n): Promise<Address> {\n return client.readContract({\n address: factory.address,\n abi: kernelFactoryAbi,\n functionName: \"getAddress\",\n args: [args.data, args.salt],\n });\n}\n\n/** Live sponsorship report from {@link checkSponsorship}. */\nexport interface SponsorshipReport {\n /** True only when a bundler and a paymaster are configured and both answer. */\n available: boolean;\n /** `direct` when you bring your own bundler and paymaster URLs; `none` when nothing is configured. */\n transport: \"direct\" | \"none\";\n bundler: { configured: boolean; probe?: BundlerProbeResult };\n paymaster: { configured: boolean; probe?: PaymasterProbeResult; depositWei?: bigint };\n /** One sentence for a human or an agent. */\n reason: string;\n /** Concrete next steps, empty when `available`. */\n fixes: string[];\n}\n\n/** Options for {@link checkSponsorship}. */\nexport interface CheckSponsorshipOptions {\n bundlerUrl?: string;\n paymasterUrl?: string;\n env?: Record<string, string | undefined>;\n fetch?: FetchLike;\n /** When given, also read the paymaster's EntryPoint deposit. */\n publicClient?: PublicClient;\n /** Paymaster contract to read the deposit of. Defaults to PEPU's deployed paymaster. */\n paymasterAddress?: Address;\n timeoutMs?: number;\n}\n\n/**\n * Live gas-sponsorship status. Resolves the bundler and paymaster URLs from\n * options, env, then the hosted defaults (bundler.pepeunchained.com and the paymaster\n * service base; with no token URL the service is probed at its base), probes both,\n * and optionally reads the paymaster deposit. Never throws for an\n * unreachable service; it reports `available: false` with `fixes`.\n * Replaces the hard-coded {@link getSponsorshipStatus}.\n *\n * @example\n * const s = await checkSponsorship({ publicClient });\n * if (!s.available) console.log(s.reason, s.fixes);\n */\nexport async function checkSponsorship(options: CheckSponsorshipOptions = {}): Promise<SponsorshipReport> {\n const { bundlerUrl, paymasterUrl: erc7677Url, paymasterBaseUrl } = resolvePepuEndpoints({\n ...(options.bundlerUrl !== undefined ? { bundlerUrl: options.bundlerUrl } : {}),\n ...(options.paymasterUrl !== undefined ? { paymasterUrl: options.paymasterUrl } : {}),\n ...(options.env ? { env: options.env } : {}),\n });\n // No token means no complete ERC-7677 URL: probe the service base (health + free-tier state) instead.\n const paymasterUrl = erc7677Url ?? paymasterBaseUrl;\n const probeOpts = {\n ...(options.fetch ? { fetch: options.fetch } : {}),\n ...(options.timeoutMs !== undefined ? { timeoutMs: options.timeoutMs } : {}),\n };\n const fixes: string[] = [];\n if (bundlerUrl === null) fixes.push(`Set ${PEPU_ENV.bundlerUrl} to a bundler for chain 97741 (EntryPoint v0.7).`);\n if (paymasterUrl === null) fixes.push(`Set ${PEPU_ENV.paymasterUrl} to your ERC-7677 paymaster endpoint (https://paymaster.pepeunchained.com/v2/paymaster/<client token>).`);\n\n const [bProbe, pProbe] = await Promise.all([\n bundlerUrl === null ? undefined : probeBundler(bundlerUrl, probeOpts),\n paymasterUrl === null ? undefined : probePaymaster(paymasterUrl, probeOpts),\n ]);\n if (bProbe && !bProbe.ok) fixes.push(bProbe.error?.hint ?? \"The bundler did not answer correctly.\");\n if (pProbe && !pProbe.ok) fixes.push(pProbe.error?.hint ?? \"The paymaster did not answer correctly.\");\n\n let depositWei: bigint | undefined;\n if (options.publicClient) {\n try {\n depositWei = await getPaymasterDeposit(options.publicClient, options.paymasterAddress);\n if (depositWei === 0n) fixes.push(\"The paymaster's EntryPoint deposit is empty. Deposit PEPU to it.\");\n } catch {\n // A failed read must not flip availability; the probes are the source of truth.\n }\n }\n\n const available = !!bProbe?.ok && !!pProbe?.ok && depositWei !== 0n;\n const configured = bundlerUrl !== null || paymasterUrl !== null;\n const reason = available\n ? \"Bundler and paymaster are reachable; sponsored UserOperations can be sent.\"\n : !configured\n ? \"No bundler or paymaster URL is configured. Set PEPU_BUNDLER_URL and PEPU_PAYMASTER_URL, or use the hosted defaults.\"\n : \"A bundler or paymaster is configured but not fully working. See fixes.\";\n return {\n available,\n transport: configured ? \"direct\" : \"none\",\n bundler: { configured: bundlerUrl !== null, ...(bProbe ? { probe: bProbe } : {}) },\n paymaster: {\n configured: paymasterUrl !== null,\n ...(pProbe ? { probe: pProbe } : {}),\n ...(depositWei !== undefined ? { depositWei } : {}),\n },\n reason,\n fixes,\n };\n}\n"]}
|
package/dist/combo/react.cjs
CHANGED
|
@@ -2,12 +2,13 @@
|
|
|
2
2
|
/* @pepu-chain/peer-guard */(function(){var p=["react","@privy-io/react-auth","@zerodev/sdk","@zerodev/permissions","@zerodev/ecdsa-validator"];for(var i=0;i<p.length;i++){try{require.resolve(p[i])}catch(e){if(e&&e.code==="MODULE_NOT_FOUND"){var m="@pepu-chain/sdk/combo/react needs peer packages that are not installed: react @privy-io/react-auth @zerodev/sdk @zerodev/permissions @zerodev/ecdsa-validator. Install with: npm i react @privy-io/react-auth @zerodev/sdk @zerodev/permissions @zerodev/ecdsa-validator (or let create-pepu-app scaffold everything).";var x=new Error(m);x.code="PEPU_MISSING_PEER";throw x}}}})();
|
|
3
3
|
|
|
4
4
|
var chunkR5PXQNO3_cjs = require('../chunk-R5PXQNO3.cjs');
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
require('../chunk-
|
|
5
|
+
var chunk4L4CHIXE_cjs = require('../chunk-4L4CHIXE.cjs');
|
|
6
|
+
var chunkUQH4ZAXD_cjs = require('../chunk-UQH4ZAXD.cjs');
|
|
7
|
+
require('../chunk-DNWWZWUW.cjs');
|
|
8
8
|
require('../chunk-AJS4UFQX.cjs');
|
|
9
|
-
require('../chunk-
|
|
10
|
-
require('../chunk-
|
|
9
|
+
require('../chunk-4GEC7GUU.cjs');
|
|
10
|
+
require('../chunk-HTCX46RJ.cjs');
|
|
11
|
+
require('../chunk-65Y5UCQ7.cjs');
|
|
11
12
|
var chunkDH6BFNVJ_cjs = require('../chunk-DH6BFNVJ.cjs');
|
|
12
13
|
require('../chunk-NE3QKDOB.cjs');
|
|
13
14
|
var chunkJ3O2ZGG3_cjs = require('../chunk-J3O2ZGG3.cjs');
|
|
@@ -35,6 +36,22 @@ function deriveSessionPhase(p) {
|
|
|
35
36
|
if (p.validUntil !== void 0) return p.nowSeconds < p.validUntil ? "active" : "expired";
|
|
36
37
|
return p.hasError ? "error" : "ready";
|
|
37
38
|
}
|
|
39
|
+
var PROVISIONING_RETRY_DELAYS_MS = [500, 1e3, 2e3, 3e3];
|
|
40
|
+
var sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
41
|
+
function isProvisioning(e) {
|
|
42
|
+
return e?.code === "WALLET_NOT_PROVISIONED";
|
|
43
|
+
}
|
|
44
|
+
async function whileProvisioning(fn, delays) {
|
|
45
|
+
for (let i = 0; ; i++) {
|
|
46
|
+
try {
|
|
47
|
+
return await fn();
|
|
48
|
+
} catch (e) {
|
|
49
|
+
const delay = delays[i];
|
|
50
|
+
if (!isProvisioning(e) || delay === void 0) throw e;
|
|
51
|
+
await sleep(delay);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
38
55
|
async function postJson(authFetch, url, body) {
|
|
39
56
|
const res = await authFetch(url, {
|
|
40
57
|
method: "POST",
|
|
@@ -45,16 +62,20 @@ async function postJson(authFetch, url, body) {
|
|
|
45
62
|
}
|
|
46
63
|
async function grantKernelSession(p) {
|
|
47
64
|
const ep = { ...DEFAULT_SESSION_ENDPOINTS, ...p.endpoints };
|
|
48
|
-
const prepared = await
|
|
49
|
-
|
|
65
|
+
const prepared = await whileProvisioning(
|
|
66
|
+
() => postJson(p.authFetch, ep.prepare),
|
|
67
|
+
p.provisioningRetryDelaysMs ?? PROVISIONING_RETRY_DELAYS_MS
|
|
68
|
+
);
|
|
69
|
+
const { approval } = await chunk4L4CHIXE_cjs.approveKernelSession({
|
|
50
70
|
publicClient: p.publicClient,
|
|
51
71
|
owner: p.owner,
|
|
52
72
|
sessionKeyAddress: prepared.sessionKeyAddress,
|
|
53
|
-
policies:
|
|
73
|
+
policies: chunk4L4CHIXE_cjs.buildKernelSessionPolicies({ calls: p.scope.calls, validUntil: prepared.validUntil })
|
|
54
74
|
});
|
|
55
75
|
await postJson(p.authFetch, ep.activate, { approval });
|
|
56
76
|
return prepared;
|
|
57
77
|
}
|
|
78
|
+
var STATUS_PROVISIONING_DELAYS_MS = [...PROVISIONING_RETRY_DELAYS_MS, 5e3, 5e3, 5e3, 5e3, 5e3];
|
|
58
79
|
var sharedClient;
|
|
59
80
|
function defaultPublicClient() {
|
|
60
81
|
sharedClient ??= chunkC7IC36XS_cjs.getPublicClient(chunkDPCZJLB3_cjs.pepuMainnet);
|
|
@@ -85,13 +106,17 @@ function useSponsoredSession(o) {
|
|
|
85
106
|
const refetch = react.useCallback(() => setTick((t) => t + 1), []);
|
|
86
107
|
const [lastValidUntil, setLastValidUntil] = react.useState();
|
|
87
108
|
const grantInFlight = react.useRef(false);
|
|
109
|
+
const provisioningDelays = o.provisioningRetryDelaysMs ?? STATUS_PROVISIONING_DELAYS_MS;
|
|
110
|
+
const delaysRef = react.useRef(provisioningDelays);
|
|
111
|
+
delaysRef.current = provisioningDelays;
|
|
112
|
+
const provisioningAttempts = react.useRef(0);
|
|
88
113
|
react.useEffect(() => {
|
|
89
114
|
if (!owner) {
|
|
90
115
|
setSmartAccount(void 0);
|
|
91
116
|
return;
|
|
92
117
|
}
|
|
93
118
|
let cancelled = false;
|
|
94
|
-
|
|
119
|
+
chunkUQH4ZAXD_cjs.getKernelAddress(publicClient, owner).then((a) => {
|
|
95
120
|
if (!cancelled) setSmartAccount(a);
|
|
96
121
|
}).catch((e) => {
|
|
97
122
|
if (!cancelled) setError(chunkYQL7NISX_cjs.toPepuError(e, { op: "derive smart account" }));
|
|
@@ -103,24 +128,45 @@ function useSponsoredSession(o) {
|
|
|
103
128
|
react.useEffect(() => {
|
|
104
129
|
if (!authenticated || !owner) return;
|
|
105
130
|
let cancelled = false;
|
|
131
|
+
let timer;
|
|
132
|
+
const retryLater = () => {
|
|
133
|
+
const delay = delaysRef.current[provisioningAttempts.current];
|
|
134
|
+
if (delay === void 0) return false;
|
|
135
|
+
provisioningAttempts.current += 1;
|
|
136
|
+
timer = setTimeout(() => {
|
|
137
|
+
if (!cancelled) refetch();
|
|
138
|
+
}, delay);
|
|
139
|
+
return true;
|
|
140
|
+
};
|
|
106
141
|
void (async () => {
|
|
142
|
+
let waiting = false;
|
|
107
143
|
try {
|
|
108
144
|
const res = await authFetch(endpointsRef.current.status);
|
|
109
145
|
if (!res.ok) throw await chunkR5PXQNO3_cjs.errorFromResponse(res);
|
|
110
146
|
const body = await res.json();
|
|
111
147
|
if (cancelled) return;
|
|
148
|
+
if (!body.active && body.provisioning) {
|
|
149
|
+
waiting = retryLater();
|
|
150
|
+
if (!waiting) setStatus({ active: false });
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
provisioningAttempts.current = 0;
|
|
112
154
|
setStatus(body);
|
|
155
|
+
setError(void 0);
|
|
113
156
|
if (body.active) setLastValidUntil(body.validUntil);
|
|
114
157
|
} catch (e) {
|
|
115
|
-
if (
|
|
158
|
+
if (cancelled) return;
|
|
159
|
+
if (isProvisioning(e) && (waiting = retryLater())) return;
|
|
160
|
+
setError(chunkYQL7NISX_cjs.toPepuError(e, { op: "session status" }));
|
|
116
161
|
} finally {
|
|
117
|
-
if (!cancelled) setStatusChecked(true);
|
|
162
|
+
if (!cancelled && !waiting) setStatusChecked(true);
|
|
118
163
|
}
|
|
119
164
|
})();
|
|
120
165
|
return () => {
|
|
121
166
|
cancelled = true;
|
|
167
|
+
if (timer) clearTimeout(timer);
|
|
122
168
|
};
|
|
123
|
-
}, [authenticated, owner, authFetch, tick]);
|
|
169
|
+
}, [authenticated, owner, authFetch, tick, refetch]);
|
|
124
170
|
react.useEffect(() => {
|
|
125
171
|
const id = setInterval(() => setNow(Math.floor(Date.now() / 1e3)), 1e3);
|
|
126
172
|
return () => clearInterval(id);
|
|
@@ -150,7 +196,8 @@ function useSponsoredSession(o) {
|
|
|
150
196
|
publicClient,
|
|
151
197
|
owner: walletClient,
|
|
152
198
|
scope: scopeRef.current,
|
|
153
|
-
endpoints: endpointsRef.current
|
|
199
|
+
endpoints: endpointsRef.current,
|
|
200
|
+
provisioningRetryDelaysMs: delaysRef.current
|
|
154
201
|
});
|
|
155
202
|
setPrepared(result);
|
|
156
203
|
setLastValidUntil(result.validUntil);
|
|
@@ -229,6 +276,7 @@ function useSponsoredSession(o) {
|
|
|
229
276
|
}
|
|
230
277
|
|
|
231
278
|
exports.DEFAULT_SESSION_ENDPOINTS = DEFAULT_SESSION_ENDPOINTS;
|
|
279
|
+
exports.PROVISIONING_RETRY_DELAYS_MS = PROVISIONING_RETRY_DELAYS_MS;
|
|
232
280
|
exports.deriveSessionPhase = deriveSessionPhase;
|
|
233
281
|
exports.grantKernelSession = grantKernelSession;
|
|
234
282
|
exports.useSponsoredSession = useSponsoredSession;
|