@pepu-chain/sdk 0.2.0 → 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.
Files changed (110) hide show
  1. package/README.md +26 -2
  2. package/dist/aa/kernel.cjs +11 -9
  3. package/dist/aa/kernel.guard.js +15 -0
  4. package/dist/aa/kernel.js +5 -4
  5. package/dist/aa/react-direct.cjs +14 -12
  6. package/dist/aa/react-direct.cjs.map +1 -1
  7. package/dist/aa/react-direct.guard.js +15 -0
  8. package/dist/aa/react-direct.js +7 -6
  9. package/dist/aa/react-direct.js.map +1 -1
  10. package/dist/aa/react.cjs +7 -5
  11. package/dist/aa/react.cjs.map +1 -1
  12. package/dist/aa/react.d.cts +1 -1
  13. package/dist/aa/react.d.ts +1 -1
  14. package/dist/aa/react.guard.js +15 -0
  15. package/dist/aa/react.js +4 -3
  16. package/dist/aa/react.js.map +1 -1
  17. package/dist/aa.cjs +19 -18
  18. package/dist/aa.d.cts +1 -1
  19. package/dist/aa.d.ts +1 -1
  20. package/dist/aa.js +6 -5
  21. package/dist/chunk-4GEC7GUU.cjs +283 -0
  22. package/dist/chunk-4GEC7GUU.cjs.map +1 -0
  23. package/dist/{chunk-PHM3ZORG.cjs → chunk-4L4CHIXE.cjs} +9 -9
  24. package/dist/{chunk-PHM3ZORG.cjs.map → chunk-4L4CHIXE.cjs.map} +1 -1
  25. package/dist/{chunk-A5LP2UCS.cjs → chunk-65Y5UCQ7.cjs} +2 -276
  26. package/dist/chunk-65Y5UCQ7.cjs.map +1 -0
  27. package/dist/{chunk-MBA4CLA5.js → chunk-7PVR7QSE.js} +3 -3
  28. package/dist/{chunk-MBA4CLA5.js.map → chunk-7PVR7QSE.js.map} +1 -1
  29. package/dist/{chunk-7MNJF2OB.cjs → chunk-DNWWZWUW.cjs} +4 -4
  30. package/dist/{chunk-7MNJF2OB.cjs.map → chunk-DNWWZWUW.cjs.map} +1 -1
  31. package/dist/{chunk-D52PADVY.js → chunk-GFKIM7HT.js} +25 -2
  32. package/dist/chunk-GFKIM7HT.js.map +1 -0
  33. package/dist/{chunk-IY3ALPUJ.js → chunk-GIZNH65Q.js} +5 -273
  34. package/dist/chunk-GIZNH65Q.js.map +1 -0
  35. package/dist/{chunk-WANILJZQ.cjs → chunk-HTCX46RJ.cjs} +25 -2
  36. package/dist/chunk-HTCX46RJ.cjs.map +1 -0
  37. package/dist/{chunk-TIEAZYHF.cjs → chunk-K7JSQPZO.cjs} +8 -2
  38. package/dist/chunk-K7JSQPZO.cjs.map +1 -0
  39. package/dist/{chunk-FCXSP2YF.js → chunk-KJYNF5KH.js} +8 -3
  40. package/dist/chunk-KJYNF5KH.js.map +1 -0
  41. package/dist/{chunk-KVG3AYYR.js → chunk-NHPWXIA2.js} +4 -4
  42. package/dist/{chunk-KVG3AYYR.js.map → chunk-NHPWXIA2.js.map} +1 -1
  43. package/dist/{chunk-ZB6SVBK4.js → chunk-QIDMFFAQ.js} +4 -4
  44. package/dist/{chunk-ZB6SVBK4.js.map → chunk-QIDMFFAQ.js.map} +1 -1
  45. package/dist/{chunk-IB2FSPMJ.js → chunk-QZKUPCUD.js} +3 -3
  46. package/dist/{chunk-IB2FSPMJ.js.map → chunk-QZKUPCUD.js.map} +1 -1
  47. package/dist/{chunk-ET3P6TX6.cjs → chunk-RCMKPJZO.cjs} +4 -4
  48. package/dist/{chunk-ET3P6TX6.cjs.map → chunk-RCMKPJZO.cjs.map} +1 -1
  49. package/dist/chunk-RSPAN44L.js +276 -0
  50. package/dist/chunk-RSPAN44L.js.map +1 -0
  51. package/dist/{chunk-NVOPDXTA.cjs → chunk-UQH4ZAXD.cjs} +10 -10
  52. package/dist/{chunk-NVOPDXTA.cjs.map → chunk-UQH4ZAXD.cjs.map} +1 -1
  53. package/dist/{chunk-SLW7FRTL.cjs → chunk-VYMAZVIK.cjs} +52 -22
  54. package/dist/chunk-VYMAZVIK.cjs.map +1 -0
  55. package/dist/{chunk-KIIFL4VM.js → chunk-XR5ONV2Y.js} +42 -12
  56. package/dist/chunk-XR5ONV2Y.js.map +1 -0
  57. package/dist/combo/react.cjs +62 -13
  58. package/dist/combo/react.cjs.map +1 -1
  59. package/dist/combo/react.d.cts +14 -2
  60. package/dist/combo/react.d.ts +14 -2
  61. package/dist/combo/react.guard.js +15 -0
  62. package/dist/combo/react.js +58 -11
  63. package/dist/combo/react.js.map +1 -1
  64. package/dist/combo.cjs +45 -29
  65. package/dist/combo.cjs.map +1 -1
  66. package/dist/combo.d.cts +11 -0
  67. package/dist/combo.d.ts +11 -0
  68. package/dist/combo.guard.js +15 -0
  69. package/dist/combo.js +33 -18
  70. package/dist/combo.js.map +1 -1
  71. package/dist/index.cjs +28 -23
  72. package/dist/index.cjs.map +1 -1
  73. package/dist/index.d.cts +2 -2
  74. package/dist/index.d.ts +2 -2
  75. package/dist/index.js +6 -5
  76. package/dist/index.js.map +1 -1
  77. package/dist/paymaster.cjs +39 -38
  78. package/dist/paymaster.cjs.map +1 -1
  79. package/dist/paymaster.js +4 -3
  80. package/dist/paymaster.js.map +1 -1
  81. package/dist/privy/react.cjs +1 -0
  82. package/dist/privy/react.guard.js +15 -0
  83. package/dist/privy/server.cjs +1 -0
  84. package/dist/privy/server.guard.js +15 -0
  85. package/dist/privy/wagmi.guard.js +15 -0
  86. package/dist/react.cjs +6 -4
  87. package/dist/react.cjs.map +1 -1
  88. package/dist/react.d.cts +1 -1
  89. package/dist/react.d.ts +1 -1
  90. package/dist/react.guard.js +15 -0
  91. package/dist/react.js +4 -3
  92. package/dist/react.js.map +1 -1
  93. package/dist/session/kernel.cjs +19 -17
  94. package/dist/session/kernel.guard.js +15 -0
  95. package/dist/session/kernel.js +6 -5
  96. package/dist/session/react.cjs +1 -0
  97. package/dist/session/react.guard.js +15 -0
  98. package/dist/session/server.cjs +1 -0
  99. package/dist/session/server.guard.js +15 -0
  100. package/dist/{status-DwkkOrGQ.d.ts → status-Dx9zAFo9.d.ts} +42 -10
  101. package/dist/{status-CmOsyPmO.d.cts → status-wgTM26V7.d.cts} +42 -10
  102. package/package.json +38 -2
  103. package/dist/chunk-A5LP2UCS.cjs.map +0 -1
  104. package/dist/chunk-D52PADVY.js.map +0 -1
  105. package/dist/chunk-FCXSP2YF.js.map +0 -1
  106. package/dist/chunk-IY3ALPUJ.js.map +0 -1
  107. package/dist/chunk-KIIFL4VM.js.map +0 -1
  108. package/dist/chunk-SLW7FRTL.cjs.map +0 -1
  109. package/dist/chunk-TIEAZYHF.cjs.map +0 -1
  110. package/dist/chunk-WANILJZQ.cjs.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/paymaster/api.ts"],"names":[],"mappings":";;;;;;;AA8RA,IAAM,mBAAA,GAAsB,MAAA;AAC5B,IAAM,iBAAA,GAAoB,MAAA;AAGnB,SAAS,eAAe,UAAA,EAAgD;AAC7E,EAAA,IAAI,UAAA,CAAW,UAAA,CAAW,mBAAmB,CAAA,EAAG,OAAO,QAAA;AACvD,EAAA,IAAI,UAAA,CAAW,UAAA,CAAW,iBAAiB,CAAA,EAAG,OAAO,QAAA;AACrD,EAAA,OAAO,IAAA;AACT;AAEA,SAAS,SAAS,GAAA,EAAqB;AACrC,EAAA,OAAO,GAAA,CAAI,OAAA,CAAQ,MAAA,EAAQ,EAAE,CAAA;AAC/B;AAqBO,SAAS,gBAAgB,OAAA,EAAyC;AACvE,EAAA,MAAM,KAAA,GAAQ,OAAA,CAAQ,KAAA,CAAM,IAAA,EAAK;AACjC,EAAA,IAAI,UAAU,EAAA,EAAI;AAChB,IAAA,MAAM,IAAI,eAAA,CAAgB,oBAAA,EAAsB,6DAA6D,CAAA;AAAA,EAC/G;AACA,EAAA,IAAI,eAAe,KAAK,CAAA,KAAM,QAAA,IAAa,UAAA,CAAoC,WAAW,MAAA,EAAW;AACnG,IAAA,MAAM,IAAI,eAAA;AAAA,MACR,oBAAA;AAAA,MACA;AAAA,KACF;AAAA,EACF;AACA,EAAA,IAAI,IAAA;AACJ,EAAA,IAAI;AACF,IAA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EAAI,EAAA,EAAG;AAC3B;AAGO,SAAS,qBAAqB,CAAA,EAAmD;AACtF,EAAA,OAAO;AAAA,IACL,OAAO,CAAA,CAAE,KAAA;AAAA,IACT,UAAU,CAAA,CAAE,QAAA;AAAA,IACZ,KAAA,EAAO,CAAA,CAAE,KAAA,CAAM,QAAA,EAAS;AAAA,IACxB,QAAA,EAAU,CAAA,CAAE,QAAA,CAAS,QAAA,EAAS;AAAA,IAC9B,WAAW,CAAA,CAAE;AAAA,GACf;AACF","file":"chunk-RSPAN44L.js","sourcesContent":["import { createSiweMessage } from \"viem/siwe\";\nimport { isAddress, toHex } from \"viem\";\nimport type { Address, Hex } from \"viem\";\n\nimport { pepuMainnet } from \"../chains.js\";\nimport { PEPU_HOSTED, resolvePepuEndpoints } from \"../endpoints.js\";\nimport { PepuConfigError, PepuPaymasterError } from \"../errors.js\";\nimport type { PepuErrorCode } from \"../errors.js\";\nimport type { ProjectClaimAttestation } from \"./onchain.js\";\nimport { mapPaymasterReason, paymasterReasonToError } from \"./reasons.js\";\n\n/**\n * REST client for the PEPU paymaster policy service: v1 (`/sponsor`, ERC-7677 at `/paymaster/<token>`) and\n * v2 (`/v2/*`, tiered, on-chain projects). Isomorphic (plain `fetch`), so it is safe in a browser EXCEPT for\n * the claim attestation call that carries a Privy app secret, which lives in `@pepu-chain/sdk/paymaster/server`.\n *\n * Contract: services/paymaster/policy-service/openapi.yaml and SPONSORSHIP-SPEC.md. Credentials: a server key\n * (`ppk_...`, secret, any wallet) and a client token (`ppt_...`, publishable, bound to allowed origins).\n */\n\n// ---------------------------------------------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------------------------------------------\n\n/** A quantity as the service accepts it: `0x` hex or bigint (converted for you). */\nexport type Quantity = Hex | bigint;\n\n/** The UserOperation fields `POST /sponsor` and `POST /v2/sponsor` read (EntryPoint v0.7, unpacked). */\nexport interface SponsorUserOp {\n sender: Address;\n nonce: Quantity;\n factory?: Address;\n factoryData?: Hex;\n callData: Hex;\n callGasLimit: Quantity;\n verificationGasLimit: Quantity;\n preVerificationGas: Quantity;\n maxFeePerGas: Quantity;\n maxPriorityFeePerGas: Quantity;\n}\n\nexport interface SponsorApproval {\n status: \"approved\";\n chainId: number;\n paymaster: Address;\n paymasterVerificationGasLimit: Hex;\n paymasterPostOpGasLimit: Hex;\n paymasterData: Hex;\n validUntil: number;\n validAfter: number;\n /** EntryPoint's canonical userOpHash. */\n userOpHash: Hex;\n /** v2 only. */\n sponsor?: { kind: \"project\" | \"free\"; sponsorId: Hex; projectKey: string };\n /** v2 only: worst-case cost, decimal wei. */\n maxCostWei?: string;\n}\n\nexport interface SponsorDenial {\n status: \"denied\";\n /** Machine-readable reason, see {@link PAYMASTER_DENIAL_REASONS}. */\n reason: string;\n message: string;\n /** v2: per-tier reasons when both tiers were tried. */\n detail?: { project?: string; free?: string };\n}\n\nexport type SponsorResult = SponsorApproval | SponsorDenial;\n\n/** Credentials for a sponsor call. */\nexport interface SponsorAuth {\n /** The project's server key (`ppk_`) or client token (`ppt_`). Sent as `X-Api-Key`. */\n apiKey: string;\n /** The user's Privy access token. REQUIRED by v1 and by the v2 free tier. Sent as `Authorization: Bearer`. */\n privyAccessToken?: string;\n /** Origin header, for server-side calls with a client token (browsers set it themselves). */\n origin?: string;\n}\n\nexport interface V2LoginResult {\n token: string;\n address: Address;\n /** ISO timestamp. */\n expiresAt: string;\n}\n\nexport type V2ConfigResponse = Record<string, unknown>;\nexport type V2FreeTierInfo = Record<string, unknown>;\n\nexport interface V2ContractInfo {\n address: Address;\n chainId: number;\n entryPoint: Address;\n abi: readonly unknown[];\n}\n\n/** `POST /v2/projects/prepare` response: a transaction for the owner's wallet to send. */\nexport interface PreparedTx {\n chainId: number;\n to: Address;\n data: Hex;\n /** Decimal wei string. */\n value: string;\n function: string;\n description: string;\n}\n\ntype Wei = string;\ntype Bytes32 = Hex;\n\n/** Body of `POST /v2/projects/prepare`. */\nexport type PrepareRequest =\n | { action: \"claimProject\" | \"reclaimProject\"; attestation: SerializedAttestation }\n | { action: \"depositFor\"; projectId: Bytes32; amountWei: Wei }\n | { action: \"executeReclaim\" | \"cancelReclaim\" | \"acceptProjectOwnership\"; projectId: Bytes32 }\n | { action: \"setTargets\"; projectId: Bytes32; targets: Address[]; allowed: boolean }\n | { action: \"setDailyLimit\" | \"setSenderDailyLimit\"; projectId: Bytes32; limitWei: Wei }\n | { action: \"setPaused\"; projectId: Bytes32; paused: boolean }\n | { action: \"proposeProjectOwner\"; projectId: Bytes32; newOwner: Address };\n\n/** Attestation in the service's wire format (decimal strings). */\nexport interface SerializedAttestation {\n appId: string;\n newOwner: Address;\n nonce: string;\n deadline: string;\n signature: Hex;\n}\n\nexport interface RegisterProjectRequest {\n /** Give `projectId` or `appId` (the id is keccak256(appId)). */\n projectId?: Bytes32;\n appId?: string;\n perUserDailyCapWei?: Wei;\n /** Opt in: refuse wallets without a verified Privy token. Default false (any wallet). */\n requireIdentity?: boolean;\n /** Plain origins (scheme://host[:port], http only for localhost). Max 20. None means server-key only. */\n allowedOrigins?: string[];\n}\n\nexport interface RegisterProjectResponse {\n /** Publishable client token (`ppt_...`), shown once. */\n token: string;\n /** ERC-7677 URL embedding the client token. */\n paymasterUrl: string;\n /** SECRET server key (`ppk_...`), shown once. Backend only. */\n serverKey?: string;\n}\n\nexport interface ProjectSettings {\n perUserDailyCapWei?: Wei;\n requireIdentity?: boolean;\n allowedOrigins?: string[];\n}\n\nexport interface ProjectDetail {\n projectId: Bytes32;\n appId: string | null;\n indexed: boolean;\n owner: Address;\n onchain: {\n balance: Wei;\n spendable: Wei;\n outstandingApprovals: Wei;\n paused: boolean;\n dailyLimit: Wei;\n senderDailyLimit: Wei;\n spentToday: Wei;\n dailyRemaining: Wei;\n };\n adminChangeDelaySeconds: number | null;\n allowlist: Address[] | null;\n offchain: Record<string, unknown> | null;\n usage24h: { ops: number; projectFundedWei: Wei; freeTierFundedWei: Wei } | null;\n contract: { address: Address; chainId: number };\n}\n\n/** Options for the low-level request escape hatch. */\nexport interface V2RequestOptions {\n body?: unknown;\n query?: Record<string, string | number | undefined>;\n /** Send the stored SIWE session as a bearer token. Default false. */\n session?: boolean;\n /**\n * Never put the service's message into thrown errors (only the HTTP status and error code). Set for calls whose\n * request body holds a secret.\n */\n quietErrors?: boolean;\n}\n\nexport interface CreatePaymasterApiOptions {\n /**\n * Policy-service base URL (no trailing path). Defaults to `PEPU_PAYMASTER_URL` /\n * `NEXT_PUBLIC_PEPU_PAYMASTER_URL`, then the hosted default once it exists.\n */\n baseUrl?: string;\n /** Fetch implementation (tests, custom agents). Defaults to global `fetch`. */\n fetch?: typeof fetch;\n /** Environment for URL resolution. Defaults to `process.env`. */\n env?: Record<string, string | undefined>;\n /** Request timeout in milliseconds. Default 15000. */\n timeoutMs?: number;\n /** Start with an existing SIWE session token. */\n sessionToken?: string;\n}\n\nexport interface PaymasterApiV1 {\n /** `POST /sponsor`. Needs the user's Privy access token and the app API key. */\n sponsor(userOp: SponsorUserOp, auth: SponsorAuth): Promise<SponsorResult>;\n /** `GET /health`. */\n health(): Promise<{ status: string }>;\n /** ERC-7677 URL for this service (`<base>/paymaster/<token>`). */\n erc7677Url(appToken: string): string;\n}\n\nexport interface PaymasterApiV2 {\n /** `POST /v2/sponsor`. Denials are returned (not thrown); use {@link assertApproved}. */\n sponsor(userOp: SponsorUserOp, auth: SponsorAuth): Promise<SponsorResult>;\n /** ERC-7677 URL for this service (`<base>/v2/paymaster/<token>`). */\n erc7677Url(appToken: string): string;\n config(): Promise<V2ConfigResponse>;\n contract(): Promise<V2ContractInfo>;\n freeTier(): Promise<V2FreeTierInfo>;\n auth: {\n nonce(): Promise<{ nonce: string; expiresAt: string }>;\n /** Stores the returned session token on this client. */\n login(message: string, signature: Hex): Promise<V2LoginResult>;\n logout(): Promise<void>;\n };\n /** `GET /v2/me`: the session address. */\n me(): Promise<{ address: Address }>;\n /**\n * Full SIWE sign-in: nonce, EIP-4361 message, your signature, login. The session lasts 1 hour and is stored\n * on this client.\n */\n loginWithWallet(sign: (message: string) => Promise<Hex>, o: LoginWithWalletOptions): Promise<V2LoginResult>;\n /** Current session token, if signed in. */\n getSessionToken(): string | null;\n setSessionToken(token: string | null): void;\n projects: {\n /** `POST /v2/projects/prepare`: calldata for the owner's wallet. Sends nothing. */\n prepare(request: PrepareRequest): Promise<PreparedTx>;\n /** `POST /v2/projects`: index a claimed project and get its credentials. */\n register(request: RegisterProjectRequest): Promise<RegisterProjectResponse>;\n list(): Promise<{ projects: unknown[]; onchainUnindexed?: unknown[] }>;\n get(projectId: Hex): Promise<ProjectDetail>;\n rotateClientToken(projectId: Hex): Promise<{ token: string; paymasterUrl: string; note?: string }>;\n rotateServerKey(projectId: Hex): Promise<{ serverKey: string; note?: string }>;\n updateSettings(projectId: Hex, settings: ProjectSettings): Promise<Record<string, unknown>>;\n usage(projectId: Hex, q?: { limit?: number; before?: number }): Promise<Record<string, unknown>>;\n events(projectId: Hex, q?: { fromBlock?: number; limit?: number }): Promise<{ projectId: Hex; events: unknown[] }>;\n allowlist(projectId: Hex): Promise<{ projectId: Hex; source: string; targets: Address[] }>;\n };\n /**\n * Low-level call to any `/v2` path, with the same error mapping. Used by `@pepu-chain/sdk/paymaster/server`\n * for `POST /v2/projects/verify`. Prefer the typed methods.\n */\n request<T>(method: \"GET\" | \"POST\" | \"PATCH\", path: string, options?: V2RequestOptions): Promise<T>;\n}\n\nexport interface PaymasterApi {\n /** Resolved base URL, no trailing slash. */\n readonly baseUrl: string;\n v1: PaymasterApiV1;\n v2: PaymasterApiV2;\n}\n\nexport interface LoginWithWalletOptions {\n /** The signing wallet's address. */\n address: Address;\n /** SIWE domain; must be one of the service's `SIWE_DOMAINS` (for example `app.example.com`). */\n domain: string;\n /** SIWE `uri`. Default `https://<domain>`. */\n uri?: string;\n /** Chain id in the message. Default 97741. */\n chainId?: number;\n statement?: string;\n /** Message lifetime in seconds (service maximum is 600 by default). Default 300. */\n lifetimeSeconds?: number;\n now?: () => number;\n}\n\n// ---------------------------------------------------------------------------------------------------------------\n// Helpers\n// ---------------------------------------------------------------------------------------------------------------\n\nconst CLIENT_TOKEN_PREFIX = \"ppt_\";\nconst SERVER_KEY_PREFIX = \"ppk_\";\n\n/** `\"client\"` for `ppt_` tokens, `\"server\"` for `ppk_` keys, otherwise `null`. Never inspects beyond the prefix. */\nexport function credentialKind(credential: string): \"client\" | \"server\" | null {\n if (credential.startsWith(CLIENT_TOKEN_PREFIX)) return \"client\";\n if (credential.startsWith(SERVER_KEY_PREFIX)) return \"server\";\n return null;\n}\n\nfunction trimBase(url: string): string {\n return url.replace(/\\/+$/, \"\");\n}\n\nexport interface BuildErc7677UrlOptions {\n /** Policy-service base URL. */\n baseUrl: string;\n /** Client token (`ppt_`, browser-safe) or server key (`ppk_`, secret). */\n token: string;\n /** Default 2. v1 serves `/paymaster/<token>`, v2 serves `/v2/paymaster/<token>`. */\n version?: 1 | 2;\n}\n\n/**\n * Build the ERC-7677 paymaster URL for a project credential (paste it into a Privy \"Paymaster URL\" or pass it\n * to a viem paymaster client). Refuses a server key (`ppk_`) in a browser, because the URL embeds it.\n *\n * @example\n * ```ts\n * const url = buildErc7677Url({ baseUrl: \"https://paymaster.example.com\", token: \"ppt_abc\" });\n * // https://paymaster.example.com/v2/paymaster/ppt_abc\n * ```\n */\nexport function buildErc7677Url(options: BuildErc7677UrlOptions): string {\n const token = options.token.trim();\n if (token === \"\") {\n throw new PepuConfigError(\"CONFIG_MISSING_ENV\", \"buildErc7677Url needs a project client token or server key.\");\n }\n if (credentialKind(token) === \"server\" && (globalThis as { window?: unknown }).window !== undefined) {\n throw new PepuConfigError(\n \"CONFIG_SERVER_ONLY\",\n \"Refusing to build an ERC-7677 URL from a server key (ppk_) in a browser: the URL embeds the secret. Use the client token (ppt_).\",\n );\n }\n let base: URL;\n try {\n base = new URL(options.baseUrl);\n } catch {\n throw new PepuConfigError(\"CONFIG_BAD_URL\", \"buildErc7677Url: baseUrl is not a valid URL.\");\n }\n if (base.protocol !== \"http:\" && base.protocol !== \"https:\") {\n throw new PepuConfigError(\"CONFIG_BAD_URL\", \"buildErc7677Url: baseUrl must be an http(s) URL.\");\n }\n const prefix = (options.version ?? 2) === 2 ? \"/v2/paymaster/\" : \"/paymaster/\";\n return `${trimBase(options.baseUrl)}${prefix}${encodeURIComponent(token)}`;\n}\n\n/**\n * The hosted ERC-7677 URL for a project credential: `<hosted base>/v2/paymaster/<token>`.\n * Pass the project's client token (`ppt_`, browser-safe); a server key is refused in a browser.\n *\n * @example\n * const url = hostedErc7677Url(\"ppt_abc\");\n * // https://paymaster.pepeunchained.com/v2/paymaster/ppt_abc\n */\nexport function hostedErc7677Url(token: string): string {\n if (PEPU_HOSTED.paymasterBaseUrl === null) {\n throw new PepuConfigError(\"CONFIG_MISSING_ENV\", \"No hosted paymaster base URL is set.\");\n }\n return buildErc7677Url({ baseUrl: PEPU_HOSTED.paymasterBaseUrl, token });\n}\n\nfunction toQuantity(v: Quantity): Hex {\n return typeof v === \"bigint\" ? toHex(v) : v;\n}\n\nfunction serializeUserOp(op: SponsorUserOp): Record<string, string> {\n const out: Record<string, string> = {\n sender: op.sender,\n nonce: toQuantity(op.nonce),\n callData: op.callData,\n callGasLimit: toQuantity(op.callGasLimit),\n verificationGasLimit: toQuantity(op.verificationGasLimit),\n preVerificationGas: toQuantity(op.preVerificationGas),\n maxFeePerGas: toQuantity(op.maxFeePerGas),\n maxPriorityFeePerGas: toQuantity(op.maxPriorityFeePerGas),\n };\n if (op.factory !== undefined) out[\"factory\"] = op.factory;\n if (op.factoryData !== undefined) out[\"factoryData\"] = op.factoryData;\n return out;\n}\n\n/**\n * Turn a sponsor result into the approval, or throw the mapped {@link PepuPaymasterError}\n * (`project_not_claimed_onchain` becomes `PAYMASTER_PROJECT_NOT_CLAIMED`, and so on).\n *\n * @example\n * ```ts\n * const approval = assertApproved(await api.v2.sponsor(userOp, { apiKey }));\n * ```\n */\nexport function assertApproved(result: SponsorResult): SponsorApproval {\n if (result.status === \"approved\") return result;\n throw paymasterReasonToError(result.reason, result.message, result.detail ? { detail: result.detail } : undefined);\n}\n\n/** Pull `retryAfterSeconds` out of a Retry-After header. */\nfunction retryAfter(res: Response): number | undefined {\n const raw = res.headers.get(\"retry-after\");\n const n = raw === null ? NaN : Number(raw);\n return Number.isFinite(n) ? n : undefined;\n}\n\nfunction isRecord(v: unknown): v is Record<string, unknown> {\n return typeof v === \"object\" && v !== null && !Array.isArray(v);\n}\n\nfunction missingBaseUrl(): PepuConfigError {\n return new PepuConfigError(\n \"CONFIG_MISSING_ENV\",\n \"No paymaster URL configured. Set PEPU_PAYMASTER_URL (or NEXT_PUBLIC_PEPU_PAYMASTER_URL), or pass baseUrl to createPaymasterApi.\",\n );\n}\n\n// ---------------------------------------------------------------------------------------------------------------\n// Client\n// ---------------------------------------------------------------------------------------------------------------\n\n/**\n * Create the paymaster REST client.\n *\n * @example\n * ```ts\n * const api = createPaymasterApi({ baseUrl: \"https://paymaster.example.com\" });\n * const free = await api.v2.freeTier();\n * const result = await api.v2.sponsor(userOp, { apiKey: process.env.PEPU_SERVER_KEY!, privyAccessToken });\n * if (result.status === \"denied\") console.log(result.reason);\n * ```\n */\nexport function createPaymasterApi(options: CreatePaymasterApiOptions = {}): PaymasterApi {\n const resolved = options.baseUrl ?? resolvePepuEndpoints(options.env ? { env: options.env } : {}).paymasterBaseUrl;\n if (resolved === null || resolved === undefined || resolved.trim() === \"\") throw missingBaseUrl();\n try {\n const u = new URL(resolved);\n if (u.protocol !== \"http:\" && u.protocol !== \"https:\") throw new Error(\"protocol\");\n } catch {\n throw new PepuConfigError(\"CONFIG_BAD_URL\", \"The paymaster baseUrl is not a valid http(s) URL.\");\n }\n const baseUrl = trimBase(resolved.trim());\n const doFetch = options.fetch ?? ((...args: Parameters<typeof fetch>) => fetch(...args));\n const timeoutMs = options.timeoutMs ?? 15_000;\n let sessionToken: string | null = options.sessionToken ?? null;\n\n /** Fetch with timeout; network failures become BUNDLER_UNREACHABLE without echoing request details. */\n async function send(url: string, init: RequestInit): Promise<Response> {\n try {\n return await doFetch(url, { ...init, signal: AbortSignal.timeout(timeoutMs) });\n } catch (e) {\n const timedOut = e instanceof Error && (e.name === \"TimeoutError\" || e.name === \"AbortError\");\n throw new PepuPaymasterError(\n \"BUNDLER_UNREACHABLE\",\n timedOut ? \"The paymaster did not answer in time.\" : \"Could not reach the paymaster service.\",\n { details: { path: new URL(url).pathname.replace(/\\/(ppt_|ppk_)[^/]*/, \"/<credential>\") } },\n );\n }\n }\n\n async function readJson(res: Response): Promise<unknown> {\n const text = await res.text().catch(() => \"\");\n if (text === \"\") return undefined;\n try {\n return JSON.parse(text) as unknown;\n } catch {\n return undefined;\n }\n }\n\n function apiError(res: Response, body: unknown, quiet: boolean): PepuPaymasterError {\n const rec = isRecord(body) ? body : {};\n const errorCode = typeof rec[\"error\"] === \"string\" ? rec[\"error\"] : undefined;\n const reason = typeof rec[\"reason\"] === \"string\" ? rec[\"reason\"] : undefined;\n const serverMessage = typeof rec[\"message\"] === \"string\" && !quiet ? rec[\"message\"] : undefined;\n const details = { status: res.status, error: errorCode, reason, retryAfterSeconds: retryAfter(res) };\n const tagged = reason ?? errorCode;\n let code: PepuErrorCode;\n if (res.status === 401 && errorCode === \"unauthenticated\") code = \"PAYMASTER_SESSION_REQUIRED\";\n else if (tagged !== undefined && mapPaymasterReason(tagged) !== \"PAYMASTER_DENIED\") code = mapPaymasterReason(tagged);\n else if (res.status === 401 && errorCode !== \"login_failed\") code = \"PAYMASTER_SESSION_REQUIRED\";\n else if (res.status === 401) code = \"PAYMASTER_DENIED\";\n else if (res.status === 429) code = \"PAYMASTER_RATE_LIMITED\";\n else if (res.status === 403) code = \"PAYMASTER_DENIED\";\n else code = \"PAYMASTER_API_ERROR\";\n const label = `Paymaster API ${res.status}${errorCode ? ` ${errorCode}` : \"\"}${reason && reason !== errorCode ? ` (${reason})` : \"\"}`;\n return new PepuPaymasterError(code, serverMessage ? `${label}: ${serverMessage}` : `${label}.`, {\n details,\n ...(res.status === 429 || res.status === 503 ? { retryable: true } : {}),\n });\n }\n\n async function request<T>(method: \"GET\" | \"POST\" | \"PATCH\", path: string, o: V2RequestOptions = {}): Promise<T> {\n const headers: Record<string, string> = { accept: \"application/json\" };\n if (o.body !== undefined) headers[\"content-type\"] = \"application/json\";\n if (o.session) {\n if (!sessionToken) {\n throw new PepuPaymasterError(\"PAYMASTER_SESSION_REQUIRED\", \"This call needs a SIWE session. Call loginWithWallet() first.\");\n }\n headers[\"authorization\"] = `Bearer ${sessionToken}`;\n }\n let url = `${baseUrl}${path}`;\n if (o.query) {\n const qs = new URLSearchParams();\n for (const [k, v] of Object.entries(o.query)) if (v !== undefined) qs.set(k, String(v));\n const s = qs.toString();\n if (s) url += `?${s}`;\n }\n const res = await send(url, { method, headers, ...(o.body !== undefined ? { body: JSON.stringify(o.body) } : {}) });\n const body = await readJson(res);\n if (!res.ok) throw apiError(res, body, o.quietErrors === true);\n return body as T;\n }\n\n async function sponsor(path: string, userOp: SponsorUserOp, auth: SponsorAuth): Promise<SponsorResult> {\n if (!auth.apiKey) {\n throw new PepuConfigError(\"CONFIG_MISSING_ENV\", \"sponsor needs auth.apiKey (the project server key or client token).\");\n }\n const headers: Record<string, string> = {\n accept: \"application/json\",\n \"content-type\": \"application/json\",\n \"x-api-key\": auth.apiKey,\n };\n if (auth.privyAccessToken) headers[\"authorization\"] = `Bearer ${auth.privyAccessToken}`;\n if (auth.origin) headers[\"origin\"] = auth.origin;\n const res = await send(`${baseUrl}${path}`, {\n method: \"POST\",\n headers,\n body: JSON.stringify({ userOp: serializeUserOp(userOp) }),\n });\n const body = await readJson(res);\n if (isRecord(body) && (body[\"status\"] === \"approved\" || body[\"status\"] === \"denied\")) {\n return body as unknown as SponsorResult;\n }\n throw apiError(res, body, false);\n }\n\n const projectPath = (id: Hex, sub = \"\"): string => {\n if (!/^0x[0-9a-fA-F]{64}$/.test(id)) {\n throw new PepuPaymasterError(\"PAYMASTER_DENIED\", \"projectId must be a 0x-prefixed 32-byte hex string.\");\n }\n return `/v2/projects/${id}${sub}`;\n };\n\n const v1: PaymasterApiV1 = {\n sponsor: async (userOp, auth) => {\n if (!auth.privyAccessToken) {\n throw new PepuPaymasterError(\n \"PAYMASTER_IDENTITY_REQUIRED\",\n \"The v1 /sponsor endpoint requires the user's Privy access token (auth.privyAccessToken).\",\n );\n }\n return sponsor(\"/sponsor\", userOp, auth);\n },\n health: async () => {\n const res = await send(`${baseUrl}/health`, { method: \"GET\" });\n const body = await readJson(res);\n if (!res.ok) throw apiError(res, body, false);\n return (isRecord(body) ? body : { status: \"ok\" }) as { status: string };\n },\n erc7677Url: (token) => buildErc7677Url({ baseUrl, token, version: 1 }),\n };\n\n const v2: PaymasterApiV2 = {\n sponsor: (userOp, auth) => sponsor(\"/v2/sponsor\", userOp, auth),\n erc7677Url: (token) => buildErc7677Url({ baseUrl, token, version: 2 }),\n config: () => request(\"GET\", \"/v2/config\"),\n contract: () => request(\"GET\", \"/v2/contract\"),\n freeTier: () => request(\"GET\", \"/v2/free-tier\"),\n auth: {\n nonce: () => request(\"GET\", \"/v2/auth/nonce\"),\n login: async (message, signature) => {\n const r = await request<V2LoginResult>(\"POST\", \"/v2/auth/login\", { body: { message, signature } });\n sessionToken = r.token;\n return r;\n },\n logout: async () => {\n await request(\"POST\", \"/v2/auth/logout\", { session: true });\n sessionToken = null;\n },\n },\n me: () => request(\"GET\", \"/v2/me\", { session: true }),\n loginWithWallet: async (sign, o) => {\n if (!isAddress(o.address, { strict: false })) {\n throw new PepuPaymasterError(\"PAYMASTER_DENIED\", \"loginWithWallet: address is not a valid address.\");\n }\n const { nonce } = await v2.auth.nonce();\n const now = (o.now ?? Date.now)();\n const message = createSiweMessage({\n address: o.address,\n chainId: o.chainId ?? pepuMainnet.id,\n domain: o.domain,\n nonce,\n uri: o.uri ?? `https://${o.domain}`,\n version: \"1\",\n statement: o.statement ?? \"Sign in to manage your PEPU gas sponsorship project. This does not move any funds.\",\n issuedAt: new Date(now),\n expirationTime: new Date(now + (o.lifetimeSeconds ?? 300) * 1000),\n });\n const signature = await sign(message);\n return v2.auth.login(message, signature);\n },\n getSessionToken: () => sessionToken,\n setSessionToken: (t) => {\n sessionToken = t;\n },\n projects: {\n prepare: (body) => request(\"POST\", \"/v2/projects/prepare\", { session: true, body }),\n register: (body) => request(\"POST\", \"/v2/projects\", { session: true, body }),\n list: () => request(\"GET\", \"/v2/projects\", { session: true }),\n get: async (id) => request(\"GET\", projectPath(id), { session: true }),\n rotateClientToken: async (id) => request(\"POST\", projectPath(id, \"/token/rotate\"), { session: true }),\n rotateServerKey: async (id) => request(\"POST\", projectPath(id, \"/server-key/rotate\"), { session: true }),\n updateSettings: async (id, body) => request(\"PATCH\", projectPath(id, \"/settings\"), { session: true, body }),\n usage: async (id, q = {}) => request(\"GET\", projectPath(id, \"/usage\"), { session: true, query: { ...q } }),\n events: async (id, q = {}) => request(\"GET\", projectPath(id, \"/events\"), { session: true, query: { ...q } }),\n allowlist: async (id) => request(\"GET\", projectPath(id, \"/allowlist\"), { session: true }),\n },\n request,\n };\n\n return { baseUrl, v1, v2 };\n}\n\n/** Serialize a typed attestation into the wire format for `projects.prepare`. */\nexport function serializeAttestation(a: ProjectClaimAttestation): SerializedAttestation {\n return {\n appId: a.appId,\n newOwner: a.newOwner,\n nonce: a.nonce.toString(),\n deadline: a.deadline.toString(),\n signature: a.signature,\n };\n}\n"]}
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
- var chunk7MNJF2OB_cjs = require('./chunk-7MNJF2OB.cjs');
3
+ var chunkDNWWZWUW_cjs = require('./chunk-DNWWZWUW.cjs');
4
4
  var chunkAJS4UFQX_cjs = require('./chunk-AJS4UFQX.cjs');
5
- var chunkWANILJZQ_cjs = require('./chunk-WANILJZQ.cjs');
5
+ var chunkHTCX46RJ_cjs = require('./chunk-HTCX46RJ.cjs');
6
6
  var chunk4GINFJO6_cjs = require('./chunk-4GINFJO6.cjs');
7
7
  var chunkVF3D6KLQ_cjs = require('./chunk-VF3D6KLQ.cjs');
8
8
  var chunkDPCZJLB3_cjs = require('./chunk-DPCZJLB3.cjs');
@@ -20,11 +20,11 @@ function defaultPublicClient() {
20
20
  async function toPepuKernelAccount(p) {
21
21
  const sudo = await ecdsaValidator.signerToEcdsaValidator(zd(p.publicClient), {
22
22
  signer: p.owner,
23
- entryPoint: chunk7MNJF2OB_cjs.ENTRY_POINT_V07,
23
+ entryPoint: chunkDNWWZWUW_cjs.ENTRY_POINT_V07,
24
24
  kernelVersion: KERNEL_VERSION
25
25
  });
26
26
  return sdk.createKernelAccount(zd(p.publicClient), {
27
- entryPoint: chunk7MNJF2OB_cjs.ENTRY_POINT_V07,
27
+ entryPoint: chunkDNWWZWUW_cjs.ENTRY_POINT_V07,
28
28
  kernelVersion: KERNEL_VERSION,
29
29
  plugins: { sudo, ...p.plugins?.regular ? { regular: p.plugins.regular } : {} },
30
30
  ...p.index !== void 0 ? { index: p.index } : {}
@@ -50,7 +50,7 @@ async function getKernelAddress(publicClient, owner) {
50
50
  }
51
51
  function createPepuSponsoredClient(p) {
52
52
  const publicClient = p.publicClient ?? defaultPublicClient();
53
- const paymaster = chunk7MNJF2OB_cjs.createPepuPaymasterClient({
53
+ const paymaster = chunkDNWWZWUW_cjs.createPepuPaymasterClient({
54
54
  ...p.paymasterUrl !== void 0 ? { paymasterUrl: p.paymasterUrl } : {},
55
55
  ...p.paymasterToken !== void 0 ? { paymasterToken: p.paymasterToken } : {},
56
56
  ...p.paymasterContext ? { context: p.paymasterContext } : {}
@@ -59,9 +59,9 @@ function createPepuSponsoredClient(p) {
59
59
  account: p.account,
60
60
  chain: chunkDPCZJLB3_cjs.pepuMainnet,
61
61
  client: zd(publicClient),
62
- bundlerTransport: viem.http(chunk7MNJF2OB_cjs.requireBundlerUrl(p.bundlerUrl)),
62
+ bundlerTransport: viem.http(chunkDNWWZWUW_cjs.requireBundlerUrl(p.bundlerUrl)),
63
63
  paymaster,
64
- userOperation: { estimateFeesPerGas: async () => chunk7MNJF2OB_cjs.estimatePepuUserOpFees(publicClient) }
64
+ userOperation: { estimateFeesPerGas: async () => chunkDNWWZWUW_cjs.estimatePepuUserOpFees(publicClient) }
65
65
  });
66
66
  }
67
67
  async function sendSponsored(p) {
@@ -82,7 +82,7 @@ async function sendSponsored(p) {
82
82
  explorerUrl: chunk4GINFJO6_cjs.txUrl(chunkDPCZJLB3_cjs.pepuMainnet, transactionHash)
83
83
  };
84
84
  } catch (e) {
85
- throw chunkWANILJZQ_cjs.describeUserOpFailure(e);
85
+ throw chunkHTCX46RJ_cjs.describeUserOpFailure(e);
86
86
  }
87
87
  }
88
88
 
@@ -91,5 +91,5 @@ exports.createPepuSponsoredClient = createPepuSponsoredClient;
91
91
  exports.getKernelAddress = getKernelAddress;
92
92
  exports.sendSponsored = sendSponsored;
93
93
  exports.toPepuKernelAccount = toPepuKernelAccount;
94
- //# sourceMappingURL=chunk-NVOPDXTA.cjs.map
95
- //# sourceMappingURL=chunk-NVOPDXTA.cjs.map
94
+ //# sourceMappingURL=chunk-UQH4ZAXD.cjs.map
95
+ //# sourceMappingURL=chunk-UQH4ZAXD.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/aa/kernel.ts"],"names":["constants","createPublicClient","pepuMainnet","http","resolvePepuEndpoints","signerToEcdsaValidator","ENTRY_POINT_V07","createKernelAccount","createPepuPaymasterClient","createKernelAccountClient","requireBundlerUrl","estimatePepuUserOpFees","normalizeCalls","txUrl","describeUserOpFailure"],"mappings":";;;;;;;;;;;;AAiCO,IAAM,iBAAiBA,aAAA,CAAU;AAUxC,SAAS,GAAG,MAAA,EAAqC;AAC/C,EAAA,OAAO,MAAA;AACT;AAUA,SAAS,mBAAA,GAAoC;AAC3C,EAAA,OAAOC,uBAAA,CAAmB,EAAE,KAAA,EAAOC,6BAAA,EAAa,SAAA,EAAWC,UAAKC,sCAAA,EAAqB,CAAE,MAAM,CAAA,EAAG,CAAA;AAClG;AAWA,eAAsB,oBAAoB,CAAA,EAUV;AAC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AAA,CAAE,SAAA,IAAa,GAAA,EAAQ,CAAA;AAC/G,IAAA,MAAM,eAAA,GAAkB,QAAQ,OAAA,CAAQ,eAAA;AACxC,IAAA,OAAO;AAAA,MACL,UAAA;AAAA,MACA,eAAA;AAAA,MACA,SAAS,OAAA,CAAQ,OAAA;AAAA,MACjB,SAAA,EAAW,QAAQ,SAAA,IAAa,IAAA;AAAA,MAChC,kBAAkB,OAAA,CAAQ,aAAA;AAAA,MAC1B,WAAA,EAAaC,uBAAA,CAAMX,6BAAA,EAAa,eAAe;AAAA,KACjD;AAAA,EACF,SAAS,CAAA,EAAG;AACV,IAAA,MAAMY,wCAAsB,CAAC,CAAA;AAAA,EAC/B;AACF","file":"chunk-NVOPDXTA.cjs","sourcesContent":["/**\n * @pepu-chain/sdk/aa/kernel: Kernel v3.1 smart account plus sponsored-send\n * helpers for the \"direct\" transport (your own bundler and paymaster URLs).\n * Needs the optional peers `@zerodev/sdk` and `@zerodev/ecdsa-validator`.\n *\n * This is the only module in the SDK (with `session/kernel` and `combo`) that\n * imports ZeroDev. Ported from `templates/sponsored-session-app/lib/kernel.ts`\n * (Kernel v3.1 build, 20% fee headroom because Alto lacks\n * `zd_getUserOperationGasPrice`).\n *\n * Session keys: `toPepuKernelAccount` takes an optional `plugins.regular`\n * validator, which is the plug point WP-B6 (`/session/kernel`, `/combo`) uses\n * to add a permission validator on top of the ECDSA root.\n */\nimport { signerToEcdsaValidator } from \"@zerodev/ecdsa-validator\";\nimport { constants, createKernelAccount, createKernelAccountClient } from \"@zerodev/sdk\";\nimport type { Signer } from \"@zerodev/sdk/types\";\nimport { createPublicClient, http } from \"viem\";\nimport type { Address, Hex, LocalAccount, PublicClient, WalletClient } from \"viem\";\n\nimport { pepuMainnet } from \"../chains.js\";\nimport { resolvePepuEndpoints } from \"../endpoints.js\";\nimport { txUrl } from \"../explorer.js\";\nimport type { PaymasterContext } from \"../erc7677.js\";\nimport { normalizeCalls } from \"./calls.js\";\nimport { ENTRY_POINT_V07, createPepuPaymasterClient, estimatePepuUserOpFees, requireBundlerUrl } from \"./clients.js\";\nimport { describeUserOpFailure } from \"./describe.js\";\nimport type { Call } from \"./types.js\";\n\nexport type { Call } from \"./types.js\";\nexport { encodeKernelExecute } from \"./calls.js\";\n\n/** Kernel v3.1, the version deployed on PEPU mainnet (factory in the contract registry). */\nexport const KERNEL_VERSION = constants.KERNEL_V3_1;\n\ntype ZeroDevClient = Parameters<typeof createKernelAccount>[0];\ntype KernelAccountParams = Parameters<typeof createKernelAccount>[1];\n\n/**\n * The ZeroDev packages resolve their own copy of viem as a peer. In a monorepo\n * with several viem installs two identical `PublicClient` types are nominally\n * different; this is a type-level bridge only (same object at runtime).\n */\nfunction zd(client: PublicClient): ZeroDevClient {\n return client as unknown as ZeroDevClient;\n}\n\n/** The Kernel account type this module builds. */\nexport type KernelSmartAccount = Awaited<ReturnType<typeof createKernelAccount>>;\n/** The sponsored client type {@link createPepuSponsoredClient} returns. */\nexport type KernelAccountClient = ReturnType<typeof createKernelAccountClient>;\n\n/** Anything that can sign for the Kernel owner. */\nexport type KernelOwner = LocalAccount | Signer | WalletClient;\n\nfunction defaultPublicClient(): PublicClient {\n return createPublicClient({ chain: pepuMainnet, transport: http(resolvePepuEndpoints().rpcUrl) }) as PublicClient;\n}\n\n/**\n * Build a Kernel v3.1 smart account owned by `owner` (ECDSA root validator).\n * The address depends only on the owner and `index`, never on a session.\n * Pass `plugins.regular` to add a permission (session-key) validator on top\n * of the root; that is how `@pepu-chain/sdk/session/kernel` builds on this.\n *\n * @example\n * const account = await toPepuKernelAccount({ publicClient, owner: privateKeyToAccount(key) });\n */\nexport async function toPepuKernelAccount(p: {\n publicClient: PublicClient;\n owner: KernelOwner;\n index?: bigint;\n /**\n * `regular` is a ZeroDev validator plugin, for example the permission\n * validator from `@zerodev/permissions` (see `@pepu-chain/sdk/session/kernel`).\n * Typed as `object` so this entry does not need `@zerodev/permissions` types.\n */\n plugins?: { regular?: object };\n}): Promise<KernelSmartAccount> {\n const sudo = await signerToEcdsaValidator(zd(p.publicClient), {\n signer: p.owner as Signer,\n entryPoint: ENTRY_POINT_V07,\n kernelVersion: KERNEL_VERSION,\n });\n return createKernelAccount(zd(p.publicClient), {\n entryPoint: ENTRY_POINT_V07,\n kernelVersion: KERNEL_VERSION,\n plugins: { sudo, ...(p.plugins?.regular ? { regular: p.plugins.regular } : {}) },\n ...(p.index !== undefined ? { index: p.index } : {}),\n } as KernelAccountParams);\n}\n\nfunction toEmptyAccount(address: Address): LocalAccount {\n const refuse = async (): Promise<never> => {\n throw new Error(\"read-only account cannot sign\");\n };\n return {\n address,\n type: \"local\",\n source: \"custom\",\n publicKey: \"0x\" as Hex,\n signMessage: refuse,\n signTransaction: refuse,\n signTypedData: refuse,\n } as unknown as LocalAccount;\n}\n\n/**\n * The counterfactual Kernel address for an owner, with no signature needed.\n * Lifted from `templates/sponsored-session-app/lib/kernel.ts`.\n *\n * @example\n * const smartAccount = await getKernelAddress(publicClient, ownerAddress);\n */\nexport async function getKernelAddress(publicClient: PublicClient, owner: Address): Promise<Address> {\n const account = await toPepuKernelAccount({ publicClient, owner: toEmptyAccount(owner) });\n return account.address;\n}\n\n/**\n * A Kernel client that sends through YOUR bundler and has gas paid by YOUR\n * paymaster (ERC-7677). Fees come from the chain with 20% headroom.\n *\n * @example\n * const client = createPepuSponsoredClient({ account, paymasterContext: { privyAccessToken } });\n */\nexport function createPepuSponsoredClient(p: {\n account: KernelSmartAccount;\n bundlerUrl?: string;\n paymasterUrl?: string;\n /** Project client token; builds the ERC-7677 URL against the paymaster base when no URL is configured. */\n paymasterToken?: string;\n paymasterContext?: PaymasterContext;\n publicClient?: PublicClient;\n}): KernelAccountClient {\n const publicClient = p.publicClient ?? defaultPublicClient();\n const paymaster = createPepuPaymasterClient({\n ...(p.paymasterUrl !== undefined ? { paymasterUrl: p.paymasterUrl } : {}),\n ...(p.paymasterToken !== undefined ? { paymasterToken: p.paymasterToken } : {}),\n ...(p.paymasterContext ? { context: p.paymasterContext } : {}),\n });\n return createKernelAccountClient({\n account: p.account,\n chain: pepuMainnet,\n client: zd(publicClient),\n bundlerTransport: http(requireBundlerUrl(p.bundlerUrl)),\n paymaster,\n userOperation: { estimateFeesPerGas: async () => estimatePepuUserOpFees(publicClient) },\n } as unknown as Parameters<typeof createKernelAccountClient>[0]);\n}\n\n/** Result of {@link sendSponsored}. */\nexport interface SendSponsoredResult {\n userOpHash: Hex;\n transactionHash: Hex;\n success: boolean;\n paymaster: Address | null;\n actualGasCostWei: bigint;\n explorerUrl: string;\n}\n\n/**\n * Encode `calls`, send one UserOperation, wait for its receipt, and report\n * who paid. Failures are mapped through `describeUserOpFailure` (AAxx and\n * paymaster reasons become typed PepuErrors). Flow ported from\n * `sendSessionTap` in the sponsored-session-app template.\n *\n * @example\n * const r = await sendSponsored({ client, calls: [{ to, abi, functionName: \"tap\" }] });\n * console.log(r.paymaster, r.explorerUrl);\n */\nexport async function sendSponsored(p: {\n client: KernelAccountClient;\n calls: Call[];\n timeoutMs?: number;\n}): Promise<SendSponsoredResult> {\n const calls = normalizeCalls(p.calls);\n try {\n const account = p.client.account;\n if (!account) throw new Error(\"The Kernel client has no account.\");\n const callData = await account.encodeCalls(calls);\n const userOpHash = await p.client.sendUserOperation({ callData });\n const receipt = await p.client.waitForUserOperationReceipt({ hash: userOpHash, timeout: p.timeoutMs ?? 90_000 });\n const transactionHash = receipt.receipt.transactionHash;\n return {\n userOpHash,\n transactionHash,\n success: receipt.success,\n paymaster: receipt.paymaster ?? null,\n actualGasCostWei: receipt.actualGasCost,\n explorerUrl: txUrl(pepuMainnet, transactionHash),\n };\n } catch (e) {\n throw describeUserOpFailure(e);\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/aa/kernel.ts"],"names":["constants","createPublicClient","pepuMainnet","http","resolvePepuEndpoints","signerToEcdsaValidator","ENTRY_POINT_V07","createKernelAccount","createPepuPaymasterClient","createKernelAccountClient","requireBundlerUrl","estimatePepuUserOpFees","normalizeCalls","txUrl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IAAA,IAAI,CAAC,OAAA,EAAS,MAAM,IAAI,MAAM,mCAAmC,CAAA;AACjE,IAAA,MAAM,QAAA,GAAW,MAAM,OAAA,CAAQ,WAAA,CAAY,KAAK,CAAA;AAChD,IAAA,MAAM,aAAa,MAAM,CAAA,CAAE,OAAO,iBAAA,CAAkB,EAAE,UAAU,CAAA;AAChE,IAAA,MAAM,OAAA,GAAU,MAAM,CAAA,CAAE,MAAA,CAAO,2BAAA,CAA4B,EAAE,IAAA,EAAM,UAAA,EAAY,OAAA,EAAS,CAAA,CAAE,SAAA,IAAa,GAAA,EAAQ,CAAA;AAC/G,IAAA,MAAM,eAAA,GAAkB,QAAQ,OAAA,CAAQ,eAAA;AACxC,IAAA,OAAO;AAAA,MACL,UAAA;AAAA,MACA,eAAA;AAAA,MACA,SAAS,OAAA,CAAQ,OAAA;AAAA,MACjB,SAAA,EAAW,QAAQ,SAAA,IAAa,IAAA;AAAA,MAChC,kBAAkB,OAAA,CAAQ,aAAA;AAAA,MAC1B,WAAA,EAAaC,uBAAA,CAAMX,6BAAA,EAAa,eAAe;AAAA,KACjD;AAAA,EACF,SAAS,CAAA,EAAG;AACV,IAAA,MAAMY,wCAAsB,CAAC,CAAA;AAAA,EAC/B;AACF","file":"chunk-UQH4ZAXD.cjs","sourcesContent":["/**\n * @pepu-chain/sdk/aa/kernel: Kernel v3.1 smart account plus sponsored-send\n * helpers for the \"direct\" transport (your own bundler and paymaster URLs).\n * Needs the optional peers `@zerodev/sdk` and `@zerodev/ecdsa-validator`.\n *\n * This is the only module in the SDK (with `session/kernel` and `combo`) that\n * imports ZeroDev. Ported from `templates/sponsored-session-app/lib/kernel.ts`\n * (Kernel v3.1 build, 20% fee headroom because Alto lacks\n * `zd_getUserOperationGasPrice`).\n *\n * Session keys: `toPepuKernelAccount` takes an optional `plugins.regular`\n * validator, which is the plug point WP-B6 (`/session/kernel`, `/combo`) uses\n * to add a permission validator on top of the ECDSA root.\n */\nimport { signerToEcdsaValidator } from \"@zerodev/ecdsa-validator\";\nimport { constants, createKernelAccount, createKernelAccountClient } from \"@zerodev/sdk\";\nimport type { Signer } from \"@zerodev/sdk/types\";\nimport { createPublicClient, http } from \"viem\";\nimport type { Address, Hex, LocalAccount, PublicClient, WalletClient } from \"viem\";\n\nimport { pepuMainnet } from \"../chains.js\";\nimport { resolvePepuEndpoints } from \"../endpoints.js\";\nimport { txUrl } from \"../explorer.js\";\nimport type { PaymasterContext } from \"../erc7677.js\";\nimport { normalizeCalls } from \"./calls.js\";\nimport { ENTRY_POINT_V07, createPepuPaymasterClient, estimatePepuUserOpFees, requireBundlerUrl } from \"./clients.js\";\nimport { describeUserOpFailure } from \"./describe.js\";\nimport type { Call } from \"./types.js\";\n\nexport type { Call } from \"./types.js\";\nexport { encodeKernelExecute } from \"./calls.js\";\n\n/** Kernel v3.1, the version deployed on PEPU mainnet (factory in the contract registry). */\nexport const KERNEL_VERSION = constants.KERNEL_V3_1;\n\ntype ZeroDevClient = Parameters<typeof createKernelAccount>[0];\ntype KernelAccountParams = Parameters<typeof createKernelAccount>[1];\n\n/**\n * The ZeroDev packages resolve their own copy of viem as a peer. In a monorepo\n * with several viem installs two identical `PublicClient` types are nominally\n * different; this is a type-level bridge only (same object at runtime).\n */\nfunction zd(client: PublicClient): ZeroDevClient {\n return client as unknown as ZeroDevClient;\n}\n\n/** The Kernel account type this module builds. */\nexport type KernelSmartAccount = Awaited<ReturnType<typeof createKernelAccount>>;\n/** The sponsored client type {@link createPepuSponsoredClient} returns. */\nexport type KernelAccountClient = ReturnType<typeof createKernelAccountClient>;\n\n/** Anything that can sign for the Kernel owner. */\nexport type KernelOwner = LocalAccount | Signer | WalletClient;\n\nfunction defaultPublicClient(): PublicClient {\n return createPublicClient({ chain: pepuMainnet, transport: http(resolvePepuEndpoints().rpcUrl) }) as PublicClient;\n}\n\n/**\n * Build a Kernel v3.1 smart account owned by `owner` (ECDSA root validator).\n * The address depends only on the owner and `index`, never on a session.\n * Pass `plugins.regular` to add a permission (session-key) validator on top\n * of the root; that is how `@pepu-chain/sdk/session/kernel` builds on this.\n *\n * @example\n * const account = await toPepuKernelAccount({ publicClient, owner: privateKeyToAccount(key) });\n */\nexport async function toPepuKernelAccount(p: {\n publicClient: PublicClient;\n owner: KernelOwner;\n index?: bigint;\n /**\n * `regular` is a ZeroDev validator plugin, for example the permission\n * validator from `@zerodev/permissions` (see `@pepu-chain/sdk/session/kernel`).\n * Typed as `object` so this entry does not need `@zerodev/permissions` types.\n */\n plugins?: { regular?: object };\n}): Promise<KernelSmartAccount> {\n const sudo = await signerToEcdsaValidator(zd(p.publicClient), {\n signer: p.owner as Signer,\n entryPoint: ENTRY_POINT_V07,\n kernelVersion: KERNEL_VERSION,\n });\n return createKernelAccount(zd(p.publicClient), {\n entryPoint: ENTRY_POINT_V07,\n kernelVersion: KERNEL_VERSION,\n plugins: { sudo, ...(p.plugins?.regular ? { regular: p.plugins.regular } : {}) },\n ...(p.index !== undefined ? { index: p.index } : {}),\n } as KernelAccountParams);\n}\n\nfunction toEmptyAccount(address: Address): LocalAccount {\n const refuse = async (): Promise<never> => {\n throw new Error(\"read-only account cannot sign\");\n };\n return {\n address,\n type: \"local\",\n source: \"custom\",\n publicKey: \"0x\" as Hex,\n signMessage: refuse,\n signTransaction: refuse,\n signTypedData: refuse,\n } as unknown as LocalAccount;\n}\n\n/**\n * The counterfactual Kernel address for an owner, with no signature needed.\n * Lifted from `templates/sponsored-session-app/lib/kernel.ts`.\n *\n * @example\n * const smartAccount = await getKernelAddress(publicClient, ownerAddress);\n */\nexport async function getKernelAddress(publicClient: PublicClient, owner: Address): Promise<Address> {\n const account = await toPepuKernelAccount({ publicClient, owner: toEmptyAccount(owner) });\n return account.address;\n}\n\n/**\n * A Kernel client that sends through YOUR bundler and has gas paid by YOUR\n * paymaster (ERC-7677). Fees come from the chain with 20% headroom.\n *\n * @example\n * const client = createPepuSponsoredClient({ account, paymasterContext: { privyAccessToken } });\n */\nexport function createPepuSponsoredClient(p: {\n account: KernelSmartAccount;\n bundlerUrl?: string;\n paymasterUrl?: string;\n /** Project client token; builds the ERC-7677 URL against the paymaster base when no URL is configured. */\n paymasterToken?: string;\n paymasterContext?: PaymasterContext;\n publicClient?: PublicClient;\n}): KernelAccountClient {\n const publicClient = p.publicClient ?? defaultPublicClient();\n const paymaster = createPepuPaymasterClient({\n ...(p.paymasterUrl !== undefined ? { paymasterUrl: p.paymasterUrl } : {}),\n ...(p.paymasterToken !== undefined ? { paymasterToken: p.paymasterToken } : {}),\n ...(p.paymasterContext ? { context: p.paymasterContext } : {}),\n });\n return createKernelAccountClient({\n account: p.account,\n chain: pepuMainnet,\n client: zd(publicClient),\n bundlerTransport: http(requireBundlerUrl(p.bundlerUrl)),\n paymaster,\n userOperation: { estimateFeesPerGas: async () => estimatePepuUserOpFees(publicClient) },\n } as unknown as Parameters<typeof createKernelAccountClient>[0]);\n}\n\n/** Result of {@link sendSponsored}. */\nexport interface SendSponsoredResult {\n userOpHash: Hex;\n transactionHash: Hex;\n success: boolean;\n paymaster: Address | null;\n actualGasCostWei: bigint;\n explorerUrl: string;\n}\n\n/**\n * Encode `calls`, send one UserOperation, wait for its receipt, and report\n * who paid. Failures are mapped through `describeUserOpFailure` (AAxx and\n * paymaster reasons become typed PepuErrors). Flow ported from\n * `sendSessionTap` in the sponsored-session-app template.\n *\n * @example\n * const r = await sendSponsored({ client, calls: [{ to, abi, functionName: \"tap\" }] });\n * console.log(r.paymaster, r.explorerUrl);\n */\nexport async function sendSponsored(p: {\n client: KernelAccountClient;\n calls: Call[];\n timeoutMs?: number;\n}): Promise<SendSponsoredResult> {\n const calls = normalizeCalls(p.calls);\n try {\n const account = p.client.account;\n if (!account) throw new Error(\"The Kernel client has no account.\");\n const callData = await account.encodeCalls(calls);\n const userOpHash = await p.client.sendUserOperation({ callData });\n const receipt = await p.client.waitForUserOperationReceipt({ hash: userOpHash, timeout: p.timeoutMs ?? 90_000 });\n const transactionHash = receipt.receipt.transactionHash;\n return {\n userOpHash,\n transactionHash,\n success: receipt.success,\n paymaster: receipt.paymaster ?? null,\n actualGasCostWei: receipt.actualGasCost,\n explorerUrl: txUrl(pepuMainnet, transactionHash),\n };\n } catch (e) {\n throw describeUserOpFailure(e);\n }\n}\n"]}
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var chunkWANILJZQ_cjs = require('./chunk-WANILJZQ.cjs');
4
- var chunkTIEAZYHF_cjs = require('./chunk-TIEAZYHF.cjs');
3
+ var chunkHTCX46RJ_cjs = require('./chunk-HTCX46RJ.cjs');
4
+ var chunkK7JSQPZO_cjs = require('./chunk-K7JSQPZO.cjs');
5
5
  var chunkVF3D6KLQ_cjs = require('./chunk-VF3D6KLQ.cjs');
6
6
  var chunkDPCZJLB3_cjs = require('./chunk-DPCZJLB3.cjs');
7
7
  var chunkYQL7NISX_cjs = require('./chunk-YQL7NISX.cjs');
@@ -32,7 +32,18 @@ var BUNDLER_METHODS = [
32
32
  "pimlico_getUserOperationGasPrice",
33
33
  "zd_getUserOperationGasPrice"
34
34
  ];
35
+ var REQUIRED_BUNDLER_METHODS = [
36
+ "eth_sendUserOperation",
37
+ "eth_estimateUserOperationGas",
38
+ "eth_getUserOperationReceipt"
39
+ ];
35
40
  var METHOD_NOT_FOUND = -32601;
41
+ function isMethodNotFound(error) {
42
+ if (!error || error.code !== METHOD_NOT_FOUND) return false;
43
+ const message = error.message ?? "";
44
+ if (/invalid discriminator value/i.test(message)) return true;
45
+ return !/validation error|invalid params|must contain|required at/i.test(message);
46
+ }
36
47
  function hostOf(url) {
37
48
  try {
38
49
  return new URL(url).host;
@@ -81,7 +92,7 @@ async function rpc(f, url, method, params, timeoutMs) {
81
92
  return body;
82
93
  }
83
94
  function unreachable(url, e) {
84
- const reason = e instanceof Error && e.name === "AbortError" ? "timed out" : chunkWANILJZQ_cjs.redactSecrets(e instanceof Error ? e.message : String(e)).replace(/https?:\/\/\S+/g, "[url]");
95
+ const reason = e instanceof Error && e.name === "AbortError" ? "timed out" : chunkHTCX46RJ_cjs.redactSecrets(e instanceof Error ? e.message : String(e)).replace(/https?:\/\/\S+/g, "[url]");
85
96
  return new chunkYQL7NISX_cjs.PepuBundlerError("BUNDLER_UNREACHABLE", `Could not reach ${hostOf(url)}: ${reason}`, { cause: e });
86
97
  }
87
98
  async function probeBundler(url, o = {}) {
@@ -98,22 +109,31 @@ async function probeBundler(url, o = {}) {
98
109
  for (const m of BUNDLER_METHODS) {
99
110
  try {
100
111
  const r = await rpc(f, url, m, [], timeoutMs);
101
- supportedMethods[m] = r.error?.code !== METHOD_NOT_FOUND;
112
+ supportedMethods[m] = !isMethodNotFound(r.error);
102
113
  } catch {
103
114
  supportedMethods[m] = false;
104
115
  }
105
116
  }
106
- const ep07 = chunkTIEAZYHF_cjs.getContract(chunkDPCZJLB3_cjs.pepuMainnet.id, "entryPoint07");
117
+ const ep07 = chunkK7JSQPZO_cjs.getContract(chunkDPCZJLB3_cjs.pepuMainnet.id, "entryPoint07");
107
118
  const want = ep07?.status === "deployed" ? ep07.address.toLowerCase() : void 0;
108
- const ok = chainId === chunkDPCZJLB3_cjs.pepuMainnet.id && (want === void 0 || (entryPoints?.some((a) => a.toLowerCase() === want) ?? false));
109
- const out = { ok, latencyMs: Date.now() - started, supportedMethods };
119
+ const missing = REQUIRED_BUNDLER_METHODS.filter((m) => supportedMethods[m] !== true);
120
+ const chainAndEntryPointOk = chainId === chunkDPCZJLB3_cjs.pepuMainnet.id && (want === void 0 || (entryPoints?.some((a) => a.toLowerCase() === want) ?? false));
121
+ const ok = chainAndEntryPointOk && missing.length === 0;
122
+ const out = {
123
+ ok,
124
+ latencyMs: Date.now() - started,
125
+ supportedMethods,
126
+ missingRequiredMethods: [...missing]
127
+ };
110
128
  if (chainId !== void 0) out.chainId = chainId;
111
129
  if (entryPoints) out.entryPoints = entryPoints;
112
130
  if (!ok) {
113
131
  out.error = new chunkYQL7NISX_cjs.PepuBundlerError(
114
132
  "BUNDLER_UNREACHABLE",
115
- chainId !== void 0 && chainId !== chunkDPCZJLB3_cjs.pepuMainnet.id ? `The bundler serves chain ${chainId}, not ${chunkDPCZJLB3_cjs.pepuMainnet.id}.` : "The bundler does not list EntryPoint v0.7.",
116
- { hint: "Point PEPU_BUNDLER_URL at a bundler for chain 97741 that supports EntryPoint v0.7." }
133
+ chainId !== void 0 && chainId !== chunkDPCZJLB3_cjs.pepuMainnet.id ? `The bundler serves chain ${chainId}, not ${chunkDPCZJLB3_cjs.pepuMainnet.id}.` : !chainAndEntryPointOk ? "The bundler does not list EntryPoint v0.7." : `The bundler does not support ${missing.join(", ")}.`,
134
+ {
135
+ hint: "Point PEPU_BUNDLER_URL at a bundler for chain 97741 that supports EntryPoint v0.7 and the ERC-4337 UserOperation methods."
136
+ }
117
137
  );
118
138
  }
119
139
  return out;
@@ -159,7 +179,7 @@ async function probePaymaster(url, o = {}) {
159
179
  }
160
180
  let speaksRpc = false;
161
181
  try {
162
- const ep07 = chunkTIEAZYHF_cjs.getContract(chunkDPCZJLB3_cjs.pepuMainnet.id, "entryPoint07");
182
+ const ep07 = chunkK7JSQPZO_cjs.getContract(chunkDPCZJLB3_cjs.pepuMainnet.id, "entryPoint07");
163
183
  const ep = ep07?.status === "deployed" ? ep07.address : "0x0000000071727De22E5E9d8BAf0edAc6f37da032";
164
184
  const reply = await rpc(
165
185
  f,
@@ -169,14 +189,24 @@ async function probePaymaster(url, o = {}) {
169
189
  timeoutMs
170
190
  );
171
191
  reached = true;
172
- speaksRpc = reply.result !== void 0 || reply.error !== void 0;
173
- out.erc7677StubOk = reply.result !== void 0;
192
+ const rpcError = reply.error !== null && typeof reply.error === "object";
193
+ speaksRpc = reply.result !== void 0 || rpcError;
194
+ if (reply.result !== void 0) {
195
+ out.erc7677StubOk = true;
196
+ out.erc7677 = "stub-ok";
197
+ } else if (rpcError) {
198
+ out.erc7677 = "needs-credential";
199
+ } else {
200
+ out.erc7677StubOk = false;
201
+ out.erc7677 = "not-responding";
202
+ }
174
203
  } catch (e) {
175
204
  lastError = e;
176
205
  out.erc7677StubOk = false;
206
+ out.erc7677 = "not-responding";
177
207
  }
178
208
  out.latencyMs = Date.now() - started;
179
- out.ok = out.health === true || speaksRpc;
209
+ out.ok = speaksRpc && out.health !== false;
180
210
  if (!reached) out.error = unreachable(url, lastError);
181
211
  else if (!out.ok) {
182
212
  out.error = new chunkYQL7NISX_cjs.PepuBundlerError("BUNDLER_UNREACHABLE", `${hostOf(url)} answered but is not a PEPU paymaster service.`, {
@@ -186,8 +216,8 @@ async function probePaymaster(url, o = {}) {
186
216
  return out;
187
217
  }
188
218
  async function getPaymasterDeposit(client, paymaster) {
189
- const pm = chunkTIEAZYHF_cjs.getContract(chunkDPCZJLB3_cjs.pepuMainnet.id, "paymaster");
190
- const ep = chunkTIEAZYHF_cjs.getContract(chunkDPCZJLB3_cjs.pepuMainnet.id, "entryPoint07");
219
+ const pm = chunkK7JSQPZO_cjs.getContract(chunkDPCZJLB3_cjs.pepuMainnet.id, "paymaster");
220
+ const ep = chunkK7JSQPZO_cjs.getContract(chunkDPCZJLB3_cjs.pepuMainnet.id, "entryPoint07");
191
221
  const account = paymaster ?? (pm?.status === "deployed" ? pm.address : void 0);
192
222
  if (!account || ep?.status !== "deployed") {
193
223
  throw new chunkYQL7NISX_cjs.PepuConfigError("CONFIG_MISSING_ENV", "No paymaster address is known; pass one explicitly.", {
@@ -204,11 +234,11 @@ async function getPaymasterDeposit(client, paymaster) {
204
234
 
205
235
  // src/aa/status.ts
206
236
  function getPepuKernelStack(chainId) {
207
- const entryPoint06 = chunkTIEAZYHF_cjs.getContract(chainId, "entryPoint06");
208
- const entryPoint07 = chunkTIEAZYHF_cjs.getContract(chainId, "entryPoint07");
209
- const kernelFactory = chunkTIEAZYHF_cjs.getContract(chainId, "kernelFactory");
210
- const kernelMetaFactory = chunkTIEAZYHF_cjs.getContract(chainId, "kernelMetaFactory");
211
- const ecdsaValidator = chunkTIEAZYHF_cjs.getContract(chainId, "ecdsaValidator");
237
+ const entryPoint06 = chunkK7JSQPZO_cjs.getContract(chainId, "entryPoint06");
238
+ const entryPoint07 = chunkK7JSQPZO_cjs.getContract(chainId, "entryPoint07");
239
+ const kernelFactory = chunkK7JSQPZO_cjs.getContract(chainId, "kernelFactory");
240
+ const kernelMetaFactory = chunkK7JSQPZO_cjs.getContract(chainId, "kernelMetaFactory");
241
+ const ecdsaValidator = chunkK7JSQPZO_cjs.getContract(chainId, "ecdsaValidator");
212
242
  if (entryPoint06?.status !== "deployed" || entryPoint07?.status !== "deployed" || kernelFactory?.status !== "deployed" || kernelMetaFactory?.status !== "deployed" || ecdsaValidator?.status !== "deployed") {
213
243
  return void 0;
214
244
  }
@@ -281,5 +311,5 @@ exports.getSponsorshipStatus = getSponsorshipStatus;
281
311
  exports.kernelFactoryAbi = kernelFactoryAbi;
282
312
  exports.probeBundler = probeBundler;
283
313
  exports.probePaymaster = probePaymaster;
284
- //# sourceMappingURL=chunk-SLW7FRTL.cjs.map
285
- //# sourceMappingURL=chunk-SLW7FRTL.cjs.map
314
+ //# sourceMappingURL=chunk-VYMAZVIK.cjs.map
315
+ //# sourceMappingURL=chunk-VYMAZVIK.cjs.map
@@ -0,0 +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,uBA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,EAAA,IAAI,UAAA;AACJ,EAAA,IAAI,QAAQ,YAAA,EAAc;AACxB,IAAA,IAAI;AACF,MAAA,UAAA,GAAa,MAAM,mBAAA,CAAoB,OAAA,CAAQ,YAAA,EAAc,QAAQ,gBAAgB,CAAA;AACrF,MAAA,IAAI,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,5 +1,5 @@
1
- import { redactSecrets } from './chunk-D52PADVY.js';
2
- import { getContract } from './chunk-FCXSP2YF.js';
1
+ import { redactSecrets } from './chunk-GFKIM7HT.js';
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';
5
5
  import { PepuBundlerError, PepuConfigError } from './chunk-6DSZ4Z2N.js';
@@ -30,7 +30,18 @@ var BUNDLER_METHODS = [
30
30
  "pimlico_getUserOperationGasPrice",
31
31
  "zd_getUserOperationGasPrice"
32
32
  ];
33
+ var REQUIRED_BUNDLER_METHODS = [
34
+ "eth_sendUserOperation",
35
+ "eth_estimateUserOperationGas",
36
+ "eth_getUserOperationReceipt"
37
+ ];
33
38
  var METHOD_NOT_FOUND = -32601;
39
+ function isMethodNotFound(error) {
40
+ if (!error || error.code !== METHOD_NOT_FOUND) return false;
41
+ const message = error.message ?? "";
42
+ if (/invalid discriminator value/i.test(message)) return true;
43
+ return !/validation error|invalid params|must contain|required at/i.test(message);
44
+ }
34
45
  function hostOf(url) {
35
46
  try {
36
47
  return new URL(url).host;
@@ -96,22 +107,31 @@ async function probeBundler(url, o = {}) {
96
107
  for (const m of BUNDLER_METHODS) {
97
108
  try {
98
109
  const r = await rpc(f, url, m, [], timeoutMs);
99
- supportedMethods[m] = r.error?.code !== METHOD_NOT_FOUND;
110
+ supportedMethods[m] = !isMethodNotFound(r.error);
100
111
  } catch {
101
112
  supportedMethods[m] = false;
102
113
  }
103
114
  }
104
115
  const ep07 = getContract(pepuMainnet.id, "entryPoint07");
105
116
  const want = ep07?.status === "deployed" ? ep07.address.toLowerCase() : void 0;
106
- const ok = chainId === pepuMainnet.id && (want === void 0 || (entryPoints?.some((a) => a.toLowerCase() === want) ?? false));
107
- const out = { ok, latencyMs: Date.now() - started, supportedMethods };
117
+ const missing = REQUIRED_BUNDLER_METHODS.filter((m) => supportedMethods[m] !== true);
118
+ const chainAndEntryPointOk = chainId === pepuMainnet.id && (want === void 0 || (entryPoints?.some((a) => a.toLowerCase() === want) ?? false));
119
+ const ok = chainAndEntryPointOk && missing.length === 0;
120
+ const out = {
121
+ ok,
122
+ latencyMs: Date.now() - started,
123
+ supportedMethods,
124
+ missingRequiredMethods: [...missing]
125
+ };
108
126
  if (chainId !== void 0) out.chainId = chainId;
109
127
  if (entryPoints) out.entryPoints = entryPoints;
110
128
  if (!ok) {
111
129
  out.error = new PepuBundlerError(
112
130
  "BUNDLER_UNREACHABLE",
113
- chainId !== void 0 && chainId !== pepuMainnet.id ? `The bundler serves chain ${chainId}, not ${pepuMainnet.id}.` : "The bundler does not list EntryPoint v0.7.",
114
- { hint: "Point PEPU_BUNDLER_URL at a bundler for chain 97741 that supports EntryPoint v0.7." }
131
+ chainId !== void 0 && chainId !== pepuMainnet.id ? `The bundler serves chain ${chainId}, not ${pepuMainnet.id}.` : !chainAndEntryPointOk ? "The bundler does not list EntryPoint v0.7." : `The bundler does not support ${missing.join(", ")}.`,
132
+ {
133
+ hint: "Point PEPU_BUNDLER_URL at a bundler for chain 97741 that supports EntryPoint v0.7 and the ERC-4337 UserOperation methods."
134
+ }
115
135
  );
116
136
  }
117
137
  return out;
@@ -167,14 +187,24 @@ async function probePaymaster(url, o = {}) {
167
187
  timeoutMs
168
188
  );
169
189
  reached = true;
170
- speaksRpc = reply.result !== void 0 || reply.error !== void 0;
171
- out.erc7677StubOk = reply.result !== void 0;
190
+ const rpcError = reply.error !== null && typeof reply.error === "object";
191
+ speaksRpc = reply.result !== void 0 || rpcError;
192
+ if (reply.result !== void 0) {
193
+ out.erc7677StubOk = true;
194
+ out.erc7677 = "stub-ok";
195
+ } else if (rpcError) {
196
+ out.erc7677 = "needs-credential";
197
+ } else {
198
+ out.erc7677StubOk = false;
199
+ out.erc7677 = "not-responding";
200
+ }
172
201
  } catch (e) {
173
202
  lastError = e;
174
203
  out.erc7677StubOk = false;
204
+ out.erc7677 = "not-responding";
175
205
  }
176
206
  out.latencyMs = Date.now() - started;
177
- out.ok = out.health === true || speaksRpc;
207
+ out.ok = speaksRpc && out.health !== false;
178
208
  if (!reached) out.error = unreachable(url, lastError);
179
209
  else if (!out.ok) {
180
210
  out.error = new PepuBundlerError("BUNDLER_UNREACHABLE", `${hostOf(url)} answered but is not a PEPU paymaster service.`, {
@@ -270,5 +300,5 @@ async function checkSponsorship(options = {}) {
270
300
  }
271
301
 
272
302
  export { KERNEL_V3_1_IMPLEMENTATION_ADDRESS, checkSponsorship, entryPointV07Abi, getKernelAccountAddress, getPaymasterDeposit, getPepuKernelStack, getSponsorshipStatus, kernelFactoryAbi, probeBundler, probePaymaster };
273
- //# sourceMappingURL=chunk-KIIFL4VM.js.map
274
- //# sourceMappingURL=chunk-KIIFL4VM.js.map
303
+ //# sourceMappingURL=chunk-XR5ONV2Y.js.map
304
+ //# sourceMappingURL=chunk-XR5ONV2Y.js.map