@pepu-chain/sdk 0.0.0-stage → 0.2.1

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 (244) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +590 -2
  3. package/dist/aa/kernel.cjs +41 -0
  4. package/dist/aa/kernel.cjs.map +1 -0
  5. package/dist/aa/kernel.d.cts +88 -0
  6. package/dist/aa/kernel.d.ts +88 -0
  7. package/dist/aa/kernel.guard.js +15 -0
  8. package/dist/aa/kernel.js +11 -0
  9. package/dist/aa/kernel.js.map +1 -0
  10. package/dist/aa/react-direct.cjs +111 -0
  11. package/dist/aa/react-direct.cjs.map +1 -0
  12. package/dist/aa/react-direct.d.cts +42 -0
  13. package/dist/aa/react-direct.d.ts +42 -0
  14. package/dist/aa/react-direct.guard.js +15 -0
  15. package/dist/aa/react-direct.js +107 -0
  16. package/dist/aa/react-direct.js.map +1 -0
  17. package/dist/aa/react.cjs +152 -0
  18. package/dist/aa/react.cjs.map +1 -0
  19. package/dist/aa/react.d.cts +62 -0
  20. package/dist/aa/react.d.ts +62 -0
  21. package/dist/aa/react.guard.js +15 -0
  22. package/dist/aa/react.js +147 -0
  23. package/dist/aa/react.js.map +1 -0
  24. package/dist/aa.cjs +84 -0
  25. package/dist/aa.cjs.map +1 -0
  26. package/dist/aa.d.cts +85 -0
  27. package/dist/aa.d.ts +85 -0
  28. package/dist/aa.js +11 -0
  29. package/dist/aa.js.map +1 -0
  30. package/dist/api-Dz4sCHH_.d.cts +654 -0
  31. package/dist/api-Dz4sCHH_.d.ts +654 -0
  32. package/dist/calls-BRPjKgjl.d.cts +70 -0
  33. package/dist/calls-z_EQOtFb.d.ts +70 -0
  34. package/dist/chains-DK13zGIp.d.cts +235 -0
  35. package/dist/chains-DK13zGIp.d.ts +235 -0
  36. package/dist/chunk-3XUGQODR.js +194 -0
  37. package/dist/chunk-3XUGQODR.js.map +1 -0
  38. package/dist/chunk-45KSZH26.cjs +145 -0
  39. package/dist/chunk-45KSZH26.cjs.map +1 -0
  40. package/dist/chunk-4GINFJO6.cjs +44 -0
  41. package/dist/chunk-4GINFJO6.cjs.map +1 -0
  42. package/dist/chunk-62M2LKQW.js +136 -0
  43. package/dist/chunk-62M2LKQW.js.map +1 -0
  44. package/dist/chunk-6DSZ4Z2N.js +498 -0
  45. package/dist/chunk-6DSZ4Z2N.js.map +1 -0
  46. package/dist/chunk-7MNJF2OB.cjs +72 -0
  47. package/dist/chunk-7MNJF2OB.cjs.map +1 -0
  48. package/dist/chunk-7PVR7QSE.js +45 -0
  49. package/dist/chunk-7PVR7QSE.js.map +1 -0
  50. package/dist/chunk-A5LP2UCS.cjs +2729 -0
  51. package/dist/chunk-A5LP2UCS.cjs.map +1 -0
  52. package/dist/chunk-AJS4UFQX.cjs +121 -0
  53. package/dist/chunk-AJS4UFQX.cjs.map +1 -0
  54. package/dist/chunk-BGALSKAF.cjs +315 -0
  55. package/dist/chunk-BGALSKAF.cjs.map +1 -0
  56. package/dist/chunk-C2XW44FI.cjs +200 -0
  57. package/dist/chunk-C2XW44FI.cjs.map +1 -0
  58. package/dist/chunk-C7IC36XS.cjs +13 -0
  59. package/dist/chunk-C7IC36XS.cjs.map +1 -0
  60. package/dist/chunk-D52PADVY.js +84 -0
  61. package/dist/chunk-D52PADVY.js.map +1 -0
  62. package/dist/chunk-DH6BFNVJ.cjs +272 -0
  63. package/dist/chunk-DH6BFNVJ.cjs.map +1 -0
  64. package/dist/chunk-DPCZJLB3.cjs +87 -0
  65. package/dist/chunk-DPCZJLB3.cjs.map +1 -0
  66. package/dist/chunk-EHBPIYY4.js +262 -0
  67. package/dist/chunk-EHBPIYY4.js.map +1 -0
  68. package/dist/chunk-ESMNAXUI.js +86 -0
  69. package/dist/chunk-ESMNAXUI.js.map +1 -0
  70. package/dist/chunk-F2R473FR.js +304 -0
  71. package/dist/chunk-F2R473FR.js.map +1 -0
  72. package/dist/chunk-IB2FSPMJ.js +66 -0
  73. package/dist/chunk-IB2FSPMJ.js.map +1 -0
  74. package/dist/chunk-IG7RSL2Y.cjs +178 -0
  75. package/dist/chunk-IG7RSL2Y.cjs.map +1 -0
  76. package/dist/chunk-IY3ALPUJ.js +2716 -0
  77. package/dist/chunk-IY3ALPUJ.js.map +1 -0
  78. package/dist/chunk-J3O2ZGG3.cjs +93 -0
  79. package/dist/chunk-J3O2ZGG3.cjs.map +1 -0
  80. package/dist/chunk-J6UXXHBE.js +37 -0
  81. package/dist/chunk-J6UXXHBE.js.map +1 -0
  82. package/dist/chunk-JLZ4LZ4Z.js +22 -0
  83. package/dist/chunk-JLZ4LZ4Z.js.map +1 -0
  84. package/dist/chunk-K7JSQPZO.cjs +231 -0
  85. package/dist/chunk-K7JSQPZO.cjs.map +1 -0
  86. package/dist/chunk-KJYNF5KH.js +224 -0
  87. package/dist/chunk-KJYNF5KH.js.map +1 -0
  88. package/dist/chunk-KVG3AYYR.js +99 -0
  89. package/dist/chunk-KVG3AYYR.js.map +1 -0
  90. package/dist/chunk-NE3QKDOB.cjs +24 -0
  91. package/dist/chunk-NE3QKDOB.cjs.map +1 -0
  92. package/dist/chunk-NVOPDXTA.cjs +95 -0
  93. package/dist/chunk-NVOPDXTA.cjs.map +1 -0
  94. package/dist/chunk-OH3QMAIB.js +11 -0
  95. package/dist/chunk-OH3QMAIB.js.map +1 -0
  96. package/dist/chunk-PHM3ZORG.cjs +110 -0
  97. package/dist/chunk-PHM3ZORG.cjs.map +1 -0
  98. package/dist/chunk-R5PXQNO3.cjs +209 -0
  99. package/dist/chunk-R5PXQNO3.cjs.map +1 -0
  100. package/dist/chunk-RCMKPJZO.cjs +49 -0
  101. package/dist/chunk-RCMKPJZO.cjs.map +1 -0
  102. package/dist/chunk-SVWRRALU.cjs +17 -0
  103. package/dist/chunk-SVWRRALU.cjs.map +1 -0
  104. package/dist/chunk-T43PQXJD.js +202 -0
  105. package/dist/chunk-T43PQXJD.js.map +1 -0
  106. package/dist/chunk-VBH3JLQ5.js +116 -0
  107. package/dist/chunk-VBH3JLQ5.js.map +1 -0
  108. package/dist/chunk-VF3D6KLQ.cjs +94 -0
  109. package/dist/chunk-VF3D6KLQ.cjs.map +1 -0
  110. package/dist/chunk-VTQIHMF3.js +82 -0
  111. package/dist/chunk-VTQIHMF3.js.map +1 -0
  112. package/dist/chunk-W3JN3YIW.js +15 -0
  113. package/dist/chunk-W3JN3YIW.js.map +1 -0
  114. package/dist/chunk-WANILJZQ.cjs +87 -0
  115. package/dist/chunk-WANILJZQ.cjs.map +1 -0
  116. package/dist/chunk-XC4IBCI2.js +86 -0
  117. package/dist/chunk-XC4IBCI2.js.map +1 -0
  118. package/dist/chunk-YKEWWQEJ.js +165 -0
  119. package/dist/chunk-YKEWWQEJ.js.map +1 -0
  120. package/dist/chunk-YQL7NISX.cjs +515 -0
  121. package/dist/chunk-YQL7NISX.cjs.map +1 -0
  122. package/dist/chunk-ZB6SVBK4.js +89 -0
  123. package/dist/chunk-ZB6SVBK4.js.map +1 -0
  124. package/dist/combo/react.cjs +236 -0
  125. package/dist/combo/react.cjs.map +1 -0
  126. package/dist/combo/react.d.cts +148 -0
  127. package/dist/combo/react.d.ts +148 -0
  128. package/dist/combo/react.guard.js +15 -0
  129. package/dist/combo/react.js +230 -0
  130. package/dist/combo/react.js.map +1 -0
  131. package/dist/combo.cjs +263 -0
  132. package/dist/combo.cjs.map +1 -0
  133. package/dist/combo.d.cts +139 -0
  134. package/dist/combo.d.ts +139 -0
  135. package/dist/combo.guard.js +15 -0
  136. package/dist/combo.js +249 -0
  137. package/dist/combo.js.map +1 -0
  138. package/dist/config-CHjz7ZjZ.d.cts +57 -0
  139. package/dist/config-COjhIZTh.d.ts +57 -0
  140. package/dist/doctor.cjs +354 -0
  141. package/dist/doctor.cjs.map +1 -0
  142. package/dist/doctor.d.cts +177 -0
  143. package/dist/doctor.d.ts +177 -0
  144. package/dist/doctor.js +345 -0
  145. package/dist/doctor.js.map +1 -0
  146. package/dist/erc7677-DOW58QBE.d.cts +111 -0
  147. package/dist/erc7677-DOW58QBE.d.ts +111 -0
  148. package/dist/errors-CgX1vNj7.d.cts +100 -0
  149. package/dist/errors-CgX1vNj7.d.ts +100 -0
  150. package/dist/index.cjs +806 -0
  151. package/dist/index.cjs.map +1 -0
  152. package/dist/index.d.cts +2398 -0
  153. package/dist/index.d.ts +2398 -0
  154. package/dist/index.js +559 -0
  155. package/dist/index.js.map +1 -0
  156. package/dist/paymaster/server.cjs +38 -0
  157. package/dist/paymaster/server.cjs.map +1 -0
  158. package/dist/paymaster/server.d.cts +57 -0
  159. package/dist/paymaster/server.d.ts +57 -0
  160. package/dist/paymaster/server.js +36 -0
  161. package/dist/paymaster/server.js.map +1 -0
  162. package/dist/paymaster.cjs +356 -0
  163. package/dist/paymaster.cjs.map +1 -0
  164. package/dist/paymaster.d.cts +1851 -0
  165. package/dist/paymaster.d.ts +1851 -0
  166. package/dist/paymaster.js +289 -0
  167. package/dist/paymaster.js.map +1 -0
  168. package/dist/privy/react.cjs +49 -0
  169. package/dist/privy/react.cjs.map +1 -0
  170. package/dist/privy/react.d.cts +194 -0
  171. package/dist/privy/react.d.ts +194 -0
  172. package/dist/privy/react.guard.js +15 -0
  173. package/dist/privy/react.js +7 -0
  174. package/dist/privy/react.js.map +1 -0
  175. package/dist/privy/server.cjs +44 -0
  176. package/dist/privy/server.cjs.map +1 -0
  177. package/dist/privy/server.d.cts +192 -0
  178. package/dist/privy/server.d.ts +192 -0
  179. package/dist/privy/server.guard.js +15 -0
  180. package/dist/privy/server.js +6 -0
  181. package/dist/privy/server.js.map +1 -0
  182. package/dist/privy/wagmi.d.ts +90 -0
  183. package/dist/privy/wagmi.guard.js +15 -0
  184. package/dist/privy/wagmi.js +55 -0
  185. package/dist/privy/wagmi.js.map +1 -0
  186. package/dist/privy.cjs +34 -0
  187. package/dist/privy.cjs.map +1 -0
  188. package/dist/privy.d.cts +4 -0
  189. package/dist/privy.d.ts +4 -0
  190. package/dist/privy.js +5 -0
  191. package/dist/privy.js.map +1 -0
  192. package/dist/react.cjs +73 -0
  193. package/dist/react.cjs.map +1 -0
  194. package/dist/react.d.cts +66 -0
  195. package/dist/react.d.ts +66 -0
  196. package/dist/react.guard.js +15 -0
  197. package/dist/react.js +68 -0
  198. package/dist/react.js.map +1 -0
  199. package/dist/requirements-C-QiJkL9.d.cts +134 -0
  200. package/dist/requirements-C-QiJkL9.d.ts +134 -0
  201. package/dist/scope-DBRkN7bR.d.cts +94 -0
  202. package/dist/scope-DBRkN7bR.d.ts +94 -0
  203. package/dist/server.cjs +59 -0
  204. package/dist/server.cjs.map +1 -0
  205. package/dist/server.d.cts +208 -0
  206. package/dist/server.d.ts +208 -0
  207. package/dist/server.js +8 -0
  208. package/dist/server.js.map +1 -0
  209. package/dist/session/kernel.cjs +83 -0
  210. package/dist/session/kernel.cjs.map +1 -0
  211. package/dist/session/kernel.d.cts +131 -0
  212. package/dist/session/kernel.d.ts +131 -0
  213. package/dist/session/kernel.guard.js +15 -0
  214. package/dist/session/kernel.js +13 -0
  215. package/dist/session/kernel.js.map +1 -0
  216. package/dist/session/react.cjs +38 -0
  217. package/dist/session/react.cjs.map +1 -0
  218. package/dist/session/react.d.cts +119 -0
  219. package/dist/session/react.d.ts +119 -0
  220. package/dist/session/react.guard.js +15 -0
  221. package/dist/session/react.js +8 -0
  222. package/dist/session/react.js.map +1 -0
  223. package/dist/session/server.cjs +268 -0
  224. package/dist/session/server.cjs.map +1 -0
  225. package/dist/session/server.d.cts +151 -0
  226. package/dist/session/server.d.ts +151 -0
  227. package/dist/session/server.guard.js +15 -0
  228. package/dist/session/server.js +252 -0
  229. package/dist/session/server.js.map +1 -0
  230. package/dist/session.cjs +74 -0
  231. package/dist/session.cjs.map +1 -0
  232. package/dist/session.d.cts +3 -0
  233. package/dist/session.d.ts +3 -0
  234. package/dist/session.js +5 -0
  235. package/dist/session.js.map +1 -0
  236. package/dist/status-Dx9zAFo9.d.ts +327 -0
  237. package/dist/status-wgTM26V7.d.cts +327 -0
  238. package/dist/store-CjmLgp9g.d.cts +64 -0
  239. package/dist/store-CjmLgp9g.d.ts +64 -0
  240. package/dist/types-BEEM7WdG.d.cts +25 -0
  241. package/dist/types-BEEM7WdG.d.ts +25 -0
  242. package/dist/types-BilBTDqK.d.cts +27 -0
  243. package/dist/types-BilBTDqK.d.ts +27 -0
  244. package/package.json +245 -3
@@ -0,0 +1,208 @@
1
+ import { Hex, Hash, Address, AbiFunction, Abi } from 'viem';
2
+
3
+ /**
4
+ * SERVER-ONLY helpers (`@pepu-chain/sdk/server`). Nothing here holds a secret,
5
+ * but these run on a backend that does hold Privy's app secret and
6
+ * authorization key; keep this entry point out of client bundles. No module
7
+ * in `src/` imports the `./server` barrel (enforced by a test). This file is the pure policy builder; it is re-exported from `@pepu-chain/sdk/session` and `@pepu-chain/sdk/server`.
8
+ */
9
+ /**
10
+ * Privy rejects policy and rule names of 50 characters or more. Its published
11
+ * OpenAPI spec says `maxLength: 50`, but the live validator says "must be
12
+ * fewer than 50 characters", so the real limit is 49 (measured on a real
13
+ * `POST /policies` 400). Using 49 is safe under both readings.
14
+ */
15
+ declare const PRIVY_POLICY_NAME_MAX_LENGTH = 49;
16
+ /** Throws if `value` is over {@link PRIVY_POLICY_NAME_MAX_LENGTH}; returns it otherwise. */
17
+ declare function assertWithinPolicyNameLimit(value: string, field: string): string;
18
+ type SessionPolicyCondition = {
19
+ field_source: "ethereum_transaction";
20
+ field: "to" | "value";
21
+ operator: "eq";
22
+ value: string;
23
+ } | {
24
+ field_source: "ethereum_calldata";
25
+ field: "function_name";
26
+ abi: AbiFunction[];
27
+ operator: "eq";
28
+ value: string;
29
+ } | {
30
+ field_source: "system";
31
+ field: "current_unix_timestamp";
32
+ operator: "lte";
33
+ value: string;
34
+ };
35
+ interface SessionPolicyRule {
36
+ name: string;
37
+ method: "eth_signTransaction";
38
+ action: "ALLOW";
39
+ conditions: SessionPolicyCondition[];
40
+ }
41
+ /** Body for `privy.policies().create(...)`. */
42
+ interface SessionPolicy {
43
+ version: "1.0";
44
+ name: string;
45
+ chain_type: "ethereum";
46
+ rules: SessionPolicyRule[];
47
+ }
48
+ interface BuildSessionPolicyParams {
49
+ /** The one contract the session may call. */
50
+ contractAddress: Address;
51
+ /** The function(s) the session may call, as ABI function fragments. At least one. */
52
+ functions: readonly AbiFunction[];
53
+ /** Unix seconds after which Privy's engine denies every request. */
54
+ expiresAtUnixSeconds: number;
55
+ /** Optional dashboard label; must be at most 49 characters. */
56
+ name?: string;
57
+ }
58
+ /**
59
+ * Build the scoped Privy session-signer policy: ONE `ALLOW` rule per function,
60
+ * each requiring `to` equals the contract, calldata decodes to that function,
61
+ * `value` is exactly zero, and the clock is before expiry. Privy ANDs the
62
+ * conditions in a rule, ORs the rules, and denies by default.
63
+ *
64
+ * Refuses to build an unscoped policy: it throws on an invalid contract
65
+ * address, no functions, a non-function ABI item, or a bad expiry. Names are
66
+ * checked against {@link PRIVY_POLICY_NAME_MAX_LENGTH}. The method is
67
+ * `eth_signTransaction` (a rule for `eth_sendTransaction` never matches the
68
+ * sign-and-broadcast flow).
69
+ *
70
+ * The scope is enforced by Privy's backend policy engine, not on-chain.
71
+ */
72
+ declare function buildSessionPolicy({ contractAddress, functions, expiresAtUnixSeconds, name, }: BuildSessionPolicyParams): SessionPolicy;
73
+ /** The unsigned legacy transaction body Privy's `eth_signTransaction` takes (snake_case, hex quantities). */
74
+ interface PrivyUnsignedTransaction {
75
+ readonly to: Address;
76
+ readonly data: Hex;
77
+ readonly value: Hex;
78
+ readonly chain_id: number;
79
+ readonly type: 0;
80
+ readonly nonce: number;
81
+ readonly gas_limit: Hex;
82
+ readonly gas_price: Hex;
83
+ }
84
+ /** What Privy's `signTransaction` returns, or just the raw hex. */
85
+ type SignedTransactionLike = Hex | {
86
+ signed_transaction: string;
87
+ };
88
+ /** Minimal viem client surface needed to broadcast. */
89
+ interface BroadcastClient {
90
+ sendRawTransaction(args: {
91
+ serializedTransaction: Hex;
92
+ }): Promise<Hash>;
93
+ }
94
+ /** Minimal viem client surface needed to resolve nonce/gas and broadcast. */
95
+ interface SignAndBroadcastClient extends BroadcastClient {
96
+ getTransactionCount(args: {
97
+ address: Address;
98
+ blockTag: "pending";
99
+ }): Promise<number>;
100
+ estimateGas(args: {
101
+ account: Address;
102
+ to: Address;
103
+ data: Hex;
104
+ value: bigint;
105
+ }): Promise<bigint>;
106
+ getGasPrice(): Promise<bigint>;
107
+ }
108
+ /** Estimate plus 20%: Nitro gas estimates can undershoot slightly. */
109
+ declare function withGasLimitBuffer(estimatedGas: bigint): bigint;
110
+ /**
111
+ * Broadcast a raw signed transaction (from Privy `eth_signTransaction`) to
112
+ * PEPU through a viem client and return the transaction hash. Accepts the raw
113
+ * hex or Privy's `{ signed_transaction }` object. A failure here is a failed
114
+ * TRANSACTION (revert, nonce race), not proof the session signer is gone.
115
+ */
116
+ declare function broadcastSignedTransaction(client: BroadcastClient, signed: SignedTransactionLike): Promise<Hash>;
117
+ interface SignAndBroadcastParams {
118
+ client: SignAndBroadcastClient;
119
+ /** The wallet that signs (the session-signer wallet's address). */
120
+ from: Address;
121
+ to: Address;
122
+ /** Pre-encoded calldata, or use `abi` + `functionName` + `args`. */
123
+ data?: Hex;
124
+ abi?: Abi;
125
+ functionName?: string;
126
+ args?: readonly unknown[];
127
+ /** Native value in wei. Default 0n. */
128
+ value?: bigint;
129
+ chainId: number;
130
+ /**
131
+ * Performs the signing, e.g. a call to
132
+ * `privy.wallets().ethereum().signTransaction(walletId, { params: { transaction }, authorization_context })`
133
+ * and returns its result. Injected so this package has no Privy dependency.
134
+ */
135
+ sign: (transaction: PrivyUnsignedTransaction) => Promise<SignedTransactionLike>;
136
+ }
137
+ /**
138
+ * The full sign-with-Privy, broadcast-yourself flow: resolve nonce (pending),
139
+ * gas (+20%) and gas price against PEPU's RPC, build the unsigned legacy
140
+ * transaction, hand it to `sign`, then broadcast the result and return the hash.
141
+ * Privy's server-side `eth_sendTransaction` rejects chain 97741, which is why
142
+ * this exists.
143
+ */
144
+ declare function signAndBroadcast(params: SignAndBroadcastParams): Promise<Hash>;
145
+ /** Default session length when `SESSION_DURATION_MINUTES` is unset or invalid. */
146
+ declare const DEFAULT_SESSION_MINUTES = 15;
147
+ /** Upper bound for a session: 24 hours. Larger requests are clamped. */
148
+ declare const MAX_SESSION_MINUTES = 1440;
149
+ /**
150
+ * Parse a session duration (an env value or number) into minutes: anything
151
+ * missing, non-numeric, zero or negative falls back to
152
+ * {@link DEFAULT_SESSION_MINUTES}; anything above {@link MAX_SESSION_MINUTES} is clamped.
153
+ * Lifted from templates/game-app/lib/env.server.ts.
154
+ *
155
+ * @example
156
+ * resolveSessionMinutes(process.env.SESSION_DURATION_MINUTES); // 15 when unset
157
+ * resolveSessionMinutes("99999"); // 1440
158
+ */
159
+ declare function resolveSessionMinutes(raw: string | number | null | undefined): number;
160
+ /**
161
+ * The unix-seconds expiry for a session that starts at `nowSeconds` and lasts
162
+ * `minutes`. Whole seconds, rounded down.
163
+ *
164
+ * @example
165
+ * sessionExpiry(1_700_000_000, 15); // 1_700_000_900
166
+ */
167
+ declare function sessionExpiry(nowSeconds: number, minutes: number): number;
168
+ /** One callable function in a session's scope, ready for a consent screen. */
169
+ interface SessionScopeFunction {
170
+ name: string;
171
+ /** e.g. `tap()` or `transfer(address,uint256)`. */
172
+ signature: string;
173
+ /** 4-byte selector. */
174
+ selector: Hex;
175
+ /** Always `"0"`: a session call never carries native value. */
176
+ valueWei: "0";
177
+ }
178
+ /** What a session may do, as plain data for a consent screen. */
179
+ interface SessionScope {
180
+ contractAddress: Address;
181
+ functions: SessionScopeFunction[];
182
+ expiresAtUnixSeconds: number;
183
+ }
184
+ /**
185
+ * Consent-screen data for a session: the one contract, each allowed function
186
+ * (name, signature, selector), zero value, and the expiry. Throws on an
187
+ * invalid address or an empty or non-function list, same as {@link buildSessionPolicy}.
188
+ *
189
+ * @example
190
+ * const scope = describeSessionScope({ contractAddress, functions: [tapAbi], expiresAtUnixSeconds });
191
+ * scope.functions[0]?.signature; // "tap()"
192
+ */
193
+ declare function describeSessionScope(p: {
194
+ contractAddress: Address;
195
+ functions: readonly AbiFunction[];
196
+ expiresAtUnixSeconds: number;
197
+ }): SessionScope;
198
+ /**
199
+ * The mandatory honest statements about who enforces a session's limits. Show
200
+ * the one for the mode in use on the consent screen. Adapted from
201
+ * templates/game-app/components/session-consent-screen.tsx.
202
+ *
203
+ * @example
204
+ * <p>{SESSION_TRUST_NOTICE["privy-offchain"]}</p>
205
+ */
206
+ declare const SESSION_TRUST_NOTICE: Record<"privy-offchain" | "kernel-onchain", string>;
207
+
208
+ export { type BroadcastClient, type BuildSessionPolicyParams, DEFAULT_SESSION_MINUTES, MAX_SESSION_MINUTES, PRIVY_POLICY_NAME_MAX_LENGTH, type PrivyUnsignedTransaction, SESSION_TRUST_NOTICE, type SessionPolicy, type SessionPolicyCondition, type SessionPolicyRule, type SessionScope, type SessionScopeFunction, type SignAndBroadcastClient, type SignAndBroadcastParams, type SignedTransactionLike, assertWithinPolicyNameLimit, broadcastSignedTransaction, buildSessionPolicy, describeSessionScope, resolveSessionMinutes, sessionExpiry, signAndBroadcast, withGasLimitBuffer };
@@ -0,0 +1,208 @@
1
+ import { Hex, Hash, Address, AbiFunction, Abi } from 'viem';
2
+
3
+ /**
4
+ * SERVER-ONLY helpers (`@pepu-chain/sdk/server`). Nothing here holds a secret,
5
+ * but these run on a backend that does hold Privy's app secret and
6
+ * authorization key; keep this entry point out of client bundles. No module
7
+ * in `src/` imports the `./server` barrel (enforced by a test). This file is the pure policy builder; it is re-exported from `@pepu-chain/sdk/session` and `@pepu-chain/sdk/server`.
8
+ */
9
+ /**
10
+ * Privy rejects policy and rule names of 50 characters or more. Its published
11
+ * OpenAPI spec says `maxLength: 50`, but the live validator says "must be
12
+ * fewer than 50 characters", so the real limit is 49 (measured on a real
13
+ * `POST /policies` 400). Using 49 is safe under both readings.
14
+ */
15
+ declare const PRIVY_POLICY_NAME_MAX_LENGTH = 49;
16
+ /** Throws if `value` is over {@link PRIVY_POLICY_NAME_MAX_LENGTH}; returns it otherwise. */
17
+ declare function assertWithinPolicyNameLimit(value: string, field: string): string;
18
+ type SessionPolicyCondition = {
19
+ field_source: "ethereum_transaction";
20
+ field: "to" | "value";
21
+ operator: "eq";
22
+ value: string;
23
+ } | {
24
+ field_source: "ethereum_calldata";
25
+ field: "function_name";
26
+ abi: AbiFunction[];
27
+ operator: "eq";
28
+ value: string;
29
+ } | {
30
+ field_source: "system";
31
+ field: "current_unix_timestamp";
32
+ operator: "lte";
33
+ value: string;
34
+ };
35
+ interface SessionPolicyRule {
36
+ name: string;
37
+ method: "eth_signTransaction";
38
+ action: "ALLOW";
39
+ conditions: SessionPolicyCondition[];
40
+ }
41
+ /** Body for `privy.policies().create(...)`. */
42
+ interface SessionPolicy {
43
+ version: "1.0";
44
+ name: string;
45
+ chain_type: "ethereum";
46
+ rules: SessionPolicyRule[];
47
+ }
48
+ interface BuildSessionPolicyParams {
49
+ /** The one contract the session may call. */
50
+ contractAddress: Address;
51
+ /** The function(s) the session may call, as ABI function fragments. At least one. */
52
+ functions: readonly AbiFunction[];
53
+ /** Unix seconds after which Privy's engine denies every request. */
54
+ expiresAtUnixSeconds: number;
55
+ /** Optional dashboard label; must be at most 49 characters. */
56
+ name?: string;
57
+ }
58
+ /**
59
+ * Build the scoped Privy session-signer policy: ONE `ALLOW` rule per function,
60
+ * each requiring `to` equals the contract, calldata decodes to that function,
61
+ * `value` is exactly zero, and the clock is before expiry. Privy ANDs the
62
+ * conditions in a rule, ORs the rules, and denies by default.
63
+ *
64
+ * Refuses to build an unscoped policy: it throws on an invalid contract
65
+ * address, no functions, a non-function ABI item, or a bad expiry. Names are
66
+ * checked against {@link PRIVY_POLICY_NAME_MAX_LENGTH}. The method is
67
+ * `eth_signTransaction` (a rule for `eth_sendTransaction` never matches the
68
+ * sign-and-broadcast flow).
69
+ *
70
+ * The scope is enforced by Privy's backend policy engine, not on-chain.
71
+ */
72
+ declare function buildSessionPolicy({ contractAddress, functions, expiresAtUnixSeconds, name, }: BuildSessionPolicyParams): SessionPolicy;
73
+ /** The unsigned legacy transaction body Privy's `eth_signTransaction` takes (snake_case, hex quantities). */
74
+ interface PrivyUnsignedTransaction {
75
+ readonly to: Address;
76
+ readonly data: Hex;
77
+ readonly value: Hex;
78
+ readonly chain_id: number;
79
+ readonly type: 0;
80
+ readonly nonce: number;
81
+ readonly gas_limit: Hex;
82
+ readonly gas_price: Hex;
83
+ }
84
+ /** What Privy's `signTransaction` returns, or just the raw hex. */
85
+ type SignedTransactionLike = Hex | {
86
+ signed_transaction: string;
87
+ };
88
+ /** Minimal viem client surface needed to broadcast. */
89
+ interface BroadcastClient {
90
+ sendRawTransaction(args: {
91
+ serializedTransaction: Hex;
92
+ }): Promise<Hash>;
93
+ }
94
+ /** Minimal viem client surface needed to resolve nonce/gas and broadcast. */
95
+ interface SignAndBroadcastClient extends BroadcastClient {
96
+ getTransactionCount(args: {
97
+ address: Address;
98
+ blockTag: "pending";
99
+ }): Promise<number>;
100
+ estimateGas(args: {
101
+ account: Address;
102
+ to: Address;
103
+ data: Hex;
104
+ value: bigint;
105
+ }): Promise<bigint>;
106
+ getGasPrice(): Promise<bigint>;
107
+ }
108
+ /** Estimate plus 20%: Nitro gas estimates can undershoot slightly. */
109
+ declare function withGasLimitBuffer(estimatedGas: bigint): bigint;
110
+ /**
111
+ * Broadcast a raw signed transaction (from Privy `eth_signTransaction`) to
112
+ * PEPU through a viem client and return the transaction hash. Accepts the raw
113
+ * hex or Privy's `{ signed_transaction }` object. A failure here is a failed
114
+ * TRANSACTION (revert, nonce race), not proof the session signer is gone.
115
+ */
116
+ declare function broadcastSignedTransaction(client: BroadcastClient, signed: SignedTransactionLike): Promise<Hash>;
117
+ interface SignAndBroadcastParams {
118
+ client: SignAndBroadcastClient;
119
+ /** The wallet that signs (the session-signer wallet's address). */
120
+ from: Address;
121
+ to: Address;
122
+ /** Pre-encoded calldata, or use `abi` + `functionName` + `args`. */
123
+ data?: Hex;
124
+ abi?: Abi;
125
+ functionName?: string;
126
+ args?: readonly unknown[];
127
+ /** Native value in wei. Default 0n. */
128
+ value?: bigint;
129
+ chainId: number;
130
+ /**
131
+ * Performs the signing, e.g. a call to
132
+ * `privy.wallets().ethereum().signTransaction(walletId, { params: { transaction }, authorization_context })`
133
+ * and returns its result. Injected so this package has no Privy dependency.
134
+ */
135
+ sign: (transaction: PrivyUnsignedTransaction) => Promise<SignedTransactionLike>;
136
+ }
137
+ /**
138
+ * The full sign-with-Privy, broadcast-yourself flow: resolve nonce (pending),
139
+ * gas (+20%) and gas price against PEPU's RPC, build the unsigned legacy
140
+ * transaction, hand it to `sign`, then broadcast the result and return the hash.
141
+ * Privy's server-side `eth_sendTransaction` rejects chain 97741, which is why
142
+ * this exists.
143
+ */
144
+ declare function signAndBroadcast(params: SignAndBroadcastParams): Promise<Hash>;
145
+ /** Default session length when `SESSION_DURATION_MINUTES` is unset or invalid. */
146
+ declare const DEFAULT_SESSION_MINUTES = 15;
147
+ /** Upper bound for a session: 24 hours. Larger requests are clamped. */
148
+ declare const MAX_SESSION_MINUTES = 1440;
149
+ /**
150
+ * Parse a session duration (an env value or number) into minutes: anything
151
+ * missing, non-numeric, zero or negative falls back to
152
+ * {@link DEFAULT_SESSION_MINUTES}; anything above {@link MAX_SESSION_MINUTES} is clamped.
153
+ * Lifted from templates/game-app/lib/env.server.ts.
154
+ *
155
+ * @example
156
+ * resolveSessionMinutes(process.env.SESSION_DURATION_MINUTES); // 15 when unset
157
+ * resolveSessionMinutes("99999"); // 1440
158
+ */
159
+ declare function resolveSessionMinutes(raw: string | number | null | undefined): number;
160
+ /**
161
+ * The unix-seconds expiry for a session that starts at `nowSeconds` and lasts
162
+ * `minutes`. Whole seconds, rounded down.
163
+ *
164
+ * @example
165
+ * sessionExpiry(1_700_000_000, 15); // 1_700_000_900
166
+ */
167
+ declare function sessionExpiry(nowSeconds: number, minutes: number): number;
168
+ /** One callable function in a session's scope, ready for a consent screen. */
169
+ interface SessionScopeFunction {
170
+ name: string;
171
+ /** e.g. `tap()` or `transfer(address,uint256)`. */
172
+ signature: string;
173
+ /** 4-byte selector. */
174
+ selector: Hex;
175
+ /** Always `"0"`: a session call never carries native value. */
176
+ valueWei: "0";
177
+ }
178
+ /** What a session may do, as plain data for a consent screen. */
179
+ interface SessionScope {
180
+ contractAddress: Address;
181
+ functions: SessionScopeFunction[];
182
+ expiresAtUnixSeconds: number;
183
+ }
184
+ /**
185
+ * Consent-screen data for a session: the one contract, each allowed function
186
+ * (name, signature, selector), zero value, and the expiry. Throws on an
187
+ * invalid address or an empty or non-function list, same as {@link buildSessionPolicy}.
188
+ *
189
+ * @example
190
+ * const scope = describeSessionScope({ contractAddress, functions: [tapAbi], expiresAtUnixSeconds });
191
+ * scope.functions[0]?.signature; // "tap()"
192
+ */
193
+ declare function describeSessionScope(p: {
194
+ contractAddress: Address;
195
+ functions: readonly AbiFunction[];
196
+ expiresAtUnixSeconds: number;
197
+ }): SessionScope;
198
+ /**
199
+ * The mandatory honest statements about who enforces a session's limits. Show
200
+ * the one for the mode in use on the consent screen. Adapted from
201
+ * templates/game-app/components/session-consent-screen.tsx.
202
+ *
203
+ * @example
204
+ * <p>{SESSION_TRUST_NOTICE["privy-offchain"]}</p>
205
+ */
206
+ declare const SESSION_TRUST_NOTICE: Record<"privy-offchain" | "kernel-onchain", string>;
207
+
208
+ export { type BroadcastClient, type BuildSessionPolicyParams, DEFAULT_SESSION_MINUTES, MAX_SESSION_MINUTES, PRIVY_POLICY_NAME_MAX_LENGTH, type PrivyUnsignedTransaction, SESSION_TRUST_NOTICE, type SessionPolicy, type SessionPolicyCondition, type SessionPolicyRule, type SessionScope, type SessionScopeFunction, type SignAndBroadcastClient, type SignAndBroadcastParams, type SignedTransactionLike, assertWithinPolicyNameLimit, broadcastSignedTransaction, buildSessionPolicy, describeSessionScope, resolveSessionMinutes, sessionExpiry, signAndBroadcast, withGasLimitBuffer };
package/dist/server.js ADDED
@@ -0,0 +1,8 @@
1
+ import { assertServerOnly } from './chunk-W3JN3YIW.js';
2
+ export { DEFAULT_SESSION_MINUTES, MAX_SESSION_MINUTES, PRIVY_POLICY_NAME_MAX_LENGTH, SESSION_TRUST_NOTICE, assertWithinPolicyNameLimit, broadcastSignedTransaction, buildSessionPolicy, describeSessionScope, resolveSessionMinutes, sessionExpiry, signAndBroadcast, withGasLimitBuffer } from './chunk-YKEWWQEJ.js';
3
+ import './chunk-6DSZ4Z2N.js';
4
+
5
+ // src/server.ts
6
+ assertServerOnly("@pepu-chain/sdk/server");
7
+ //# sourceMappingURL=server.js.map
8
+ //# sourceMappingURL=server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/server.ts"],"names":[],"mappings":";;;;;AAEA,gBAAA,CAAiB,wBAAwB,CAAA","file":"server.js","sourcesContent":["import { assertServerOnly } from \"./internal/assert-server.js\";\n\nassertServerOnly(\"@pepu-chain/sdk/server\");\n\n/**\n * `@pepu-chain/sdk/server` is kept as a stable import path. It re-exports the\n * pure server-side helpers, which now live in `./session/policy.ts`. New\n * server code lives in `/privy/server`, `/session/server` and\n * `/paymaster/server`.\n */\nexport * from \"./session/policy.js\";\n"]}
@@ -0,0 +1,83 @@
1
+ 'use strict';
2
+ /* @pepu-chain/peer-guard */(function(){var p=["@zerodev/sdk","@zerodev/permissions","@zerodev/ecdsa-validator"];for(var i=0;i<p.length;i++){try{require.resolve(p[i])}catch(e){if(e&&e.code==="MODULE_NOT_FOUND"){var m="@pepu-chain/sdk/session/kernel needs peer packages that are not installed: @zerodev/sdk @zerodev/permissions @zerodev/ecdsa-validator. Install with: npm i @zerodev/sdk @zerodev/permissions @zerodev/ecdsa-validator (or let create-pepu-app scaffold everything).";var x=new Error(m);x.code="PEPU_MISSING_PEER";throw x}}}})();
3
+
4
+ var chunkPHM3ZORG_cjs = require('../chunk-PHM3ZORG.cjs');
5
+ var chunkNVOPDXTA_cjs = require('../chunk-NVOPDXTA.cjs');
6
+ require('../chunk-7MNJF2OB.cjs');
7
+ require('../chunk-AJS4UFQX.cjs');
8
+ require('../chunk-A5LP2UCS.cjs');
9
+ require('../chunk-WANILJZQ.cjs');
10
+ var chunkJ3O2ZGG3_cjs = require('../chunk-J3O2ZGG3.cjs');
11
+ require('../chunk-4GINFJO6.cjs');
12
+ require('../chunk-VF3D6KLQ.cjs');
13
+ require('../chunk-DPCZJLB3.cjs');
14
+ require('../chunk-YQL7NISX.cjs');
15
+
16
+
17
+
18
+ Object.defineProperty(exports, "CALL_POLICY_V0_0_4_ADDRESS", {
19
+ enumerable: true,
20
+ get: function () { return chunkPHM3ZORG_cjs.CALL_POLICY_V0_0_4_ADDRESS; }
21
+ });
22
+ Object.defineProperty(exports, "SESSION_GAS_RESERVATION_PEPU", {
23
+ enumerable: true,
24
+ get: function () { return chunkPHM3ZORG_cjs.SESSION_GAS_RESERVATION_PEPU; }
25
+ });
26
+ Object.defineProperty(exports, "TIMESTAMP_POLICY_ADDRESS", {
27
+ enumerable: true,
28
+ get: function () { return chunkPHM3ZORG_cjs.TIMESTAMP_POLICY_ADDRESS; }
29
+ });
30
+ Object.defineProperty(exports, "approveKernelSession", {
31
+ enumerable: true,
32
+ get: function () { return chunkPHM3ZORG_cjs.approveKernelSession; }
33
+ });
34
+ Object.defineProperty(exports, "buildKernelSessionPolicies", {
35
+ enumerable: true,
36
+ get: function () { return chunkPHM3ZORG_cjs.buildKernelSessionPolicies; }
37
+ });
38
+ Object.defineProperty(exports, "createMemoryStore", {
39
+ enumerable: true,
40
+ get: function () { return chunkPHM3ZORG_cjs.createMemoryStore; }
41
+ });
42
+ Object.defineProperty(exports, "expectedPermissionId", {
43
+ enumerable: true,
44
+ get: function () { return chunkPHM3ZORG_cjs.expectedPermissionId; }
45
+ });
46
+ Object.defineProperty(exports, "generateSessionKey", {
47
+ enumerable: true,
48
+ get: function () { return chunkPHM3ZORG_cjs.generateSessionKey; }
49
+ });
50
+ Object.defineProperty(exports, "isLive", {
51
+ enumerable: true,
52
+ get: function () { return chunkPHM3ZORG_cjs.isLive; }
53
+ });
54
+ Object.defineProperty(exports, "loadKernelSessionAccount", {
55
+ enumerable: true,
56
+ get: function () { return chunkPHM3ZORG_cjs.loadKernelSessionAccount; }
57
+ });
58
+ Object.defineProperty(exports, "KERNEL_VERSION", {
59
+ enumerable: true,
60
+ get: function () { return chunkNVOPDXTA_cjs.KERNEL_VERSION; }
61
+ });
62
+ Object.defineProperty(exports, "getKernelAddress", {
63
+ enumerable: true,
64
+ get: function () { return chunkNVOPDXTA_cjs.getKernelAddress; }
65
+ });
66
+ Object.defineProperty(exports, "checkApproval", {
67
+ enumerable: true,
68
+ get: function () { return chunkJ3O2ZGG3_cjs.checkApproval; }
69
+ });
70
+ Object.defineProperty(exports, "describeKernelSessionScope", {
71
+ enumerable: true,
72
+ get: function () { return chunkJ3O2ZGG3_cjs.describeKernelSessionScope; }
73
+ });
74
+ Object.defineProperty(exports, "isCallInScope", {
75
+ enumerable: true,
76
+ get: function () { return chunkJ3O2ZGG3_cjs.isCallInScope; }
77
+ });
78
+ Object.defineProperty(exports, "parseApproval", {
79
+ enumerable: true,
80
+ get: function () { return chunkJ3O2ZGG3_cjs.parseApproval; }
81
+ });
82
+ //# sourceMappingURL=kernel.cjs.map
83
+ //# sourceMappingURL=kernel.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"kernel.cjs"}
@@ -0,0 +1,131 @@
1
+ import { Policy } from '@zerodev/permissions';
2
+ import { Address, PublicClient, Hex } from 'viem';
3
+ import { KernelOwner, KernelSmartAccount } from '../aa/kernel.cjs';
4
+ export { KERNEL_VERSION, getKernelAddress } from '../aa/kernel.cjs';
5
+ import { K as KernelSessionCall } from '../scope-DBRkN7bR.cjs';
6
+ export { A as ApprovalCheck, a as KernelSessionScope, P as ParsedApproval, c as checkApproval, d as describeKernelSessionScope, i as isCallInScope, p as parseApproval } from '../scope-DBRkN7bR.cjs';
7
+ export { a as SessionRecord, S as SessionStore, c as createMemoryStore, i as isLive } from '../store-CjmLgp9g.cjs';
8
+ import '@zerodev/sdk/types';
9
+ import '@zerodev/sdk';
10
+ import '../erc7677-DOW58QBE.cjs';
11
+ import '../types-BilBTDqK.cjs';
12
+ import '../calls-BRPjKgjl.cjs';
13
+
14
+ /**
15
+ * `@pepu-chain/sdk/session/kernel`: on-chain session keys with ZeroDev Kernel
16
+ * permissions. Extracted from templates/sponsored-session-app/lib/{kernel,
17
+ * session-policy,approval}.ts and built on `toPepuKernelAccount`
18
+ * (`plugins.regular`).
19
+ *
20
+ * The scope is enforced ON-CHAIN by ZeroDev's policy contracts, which the
21
+ * user's Kernel account calls during UserOperation validation:
22
+ *
23
+ * - Call policy v0.0.4: only the listed targets and function selectors, with a
24
+ * native value no larger than `valueLimit` (default 0).
25
+ * - Timestamp policy: the permission is invalid outside `validAfter`..`validUntil`.
26
+ *
27
+ * A UserOperation outside this scope is rejected by the EntryPoint itself, no
28
+ * matter who relays it or what the app backend does.
29
+ *
30
+ * Deployed on PEPU mainnet (eth_getCode verified 2026-10-02): Kernel v3.1
31
+ * factory 0xaac5D4240AF87249B3f71BC8E4A2cae074A3E419, ECDSA validator
32
+ * 0x845ADb2C711129d4f3966735eD98a9F09fC4cE57, ECDSA signer module
33
+ * 0x6A6F069E2a08c2468e7724Ab3250CdBFBA14D4FF, call policy v0.0.4 and the
34
+ * timestamp policy below. Call policy v0.0.5 is NOT deployed on PEPU, so the
35
+ * version is pinned.
36
+ *
37
+ * Optional peers: `@zerodev/sdk`, `@zerodev/permissions`, `@zerodev/ecdsa-validator`.
38
+ */
39
+ /** Call policy v0.0.4. Pinned: v0.0.5 is not deployed on PEPU mainnet. */
40
+ declare const CALL_POLICY_V0_0_4_ADDRESS: Address;
41
+ /** ZeroDev timestamp policy on PEPU mainnet. */
42
+ declare const TIMESTAMP_POLICY_ADDRESS: Address;
43
+ /**
44
+ * Worst-case gas the paymaster policy service RESERVES per sponsored operation,
45
+ * measured on PEPU mainnet with the sponsored-session-app template: the first
46
+ * operation of a session (account deploy plus enabling the permission) about
47
+ * 20.5 PEPU, later operations about 6.9 PEPU. The real first-session cost was
48
+ * about 12.8 PEPU for two operations. Size per-user hourly and daily spend
49
+ * caps above these, or users hit `trailing-hour spend ... would exceed cap`
50
+ * after their first action.
51
+ */
52
+ declare const SESSION_GAS_RESERVATION_PEPU: {
53
+ readonly firstOperation: 20.5;
54
+ readonly laterOperation: 6.9;
55
+ };
56
+ /**
57
+ * The on-chain policies for one session: call policy v0.0.4 plus the timestamp
58
+ * policy. Pure and deterministic given its input. Only the named function
59
+ * fragments go into the policy, which keeps the grant small.
60
+ *
61
+ * @example
62
+ * const policies = buildKernelSessionPolicies({
63
+ * calls: [{ target: tapScore, abi: tapScoreAbi, functionName: "tap" }],
64
+ * validUntil: Math.floor(Date.now() / 1000) + 900,
65
+ * });
66
+ */
67
+ declare function buildKernelSessionPolicies(p: {
68
+ calls: readonly KernelSessionCall[];
69
+ validUntil: number;
70
+ validAfter?: number;
71
+ }): Policy[];
72
+ /**
73
+ * A fresh random session key. SERVER ONLY: the private key must never reach
74
+ * the browser. Only the address is sent to the owner for approval.
75
+ *
76
+ * @example
77
+ * const { privateKey, address } = generateSessionKey();
78
+ */
79
+ declare function generateSessionKey(): {
80
+ privateKey: Hex;
81
+ address: Address;
82
+ };
83
+ /**
84
+ * The permission id the chain derives for this session key plus these
85
+ * policies. The server compares it with a browser-supplied approval.
86
+ *
87
+ * @example
88
+ * const permissionId = await expectedPermissionId({ publicClient, sessionKeyAddress, policies });
89
+ */
90
+ declare function expectedPermissionId(p: {
91
+ publicClient: PublicClient;
92
+ sessionKeyAddress: Address;
93
+ policies: Policy[];
94
+ }): Promise<string>;
95
+ /**
96
+ * In the user's browser: the owner (the Privy embedded wallet, the only thing
97
+ * that can authorize a session) signs ONE EIP-712 message that enables a
98
+ * permission validator on their Kernel account. That signature is the whole
99
+ * grant. It names the session key's public address (never its private key)
100
+ * and the policies. The returned `approval` holds no secret: it is the enable
101
+ * signature plus the policy parameters, useless without the session key.
102
+ *
103
+ * @example
104
+ * const { approval, kernelAddress } = await approveKernelSession({
105
+ * publicClient, owner: walletClient, sessionKeyAddress, policies,
106
+ * });
107
+ */
108
+ declare function approveKernelSession(p: {
109
+ publicClient: PublicClient;
110
+ owner: KernelOwner;
111
+ sessionKeyAddress: Address;
112
+ policies: Policy[];
113
+ }): Promise<{
114
+ approval: string;
115
+ kernelAddress: Address;
116
+ }>;
117
+ /**
118
+ * On the server: rebuild the session's Kernel account from the approval and
119
+ * the server-held session key (an ECDSA signer for that key). No owner
120
+ * signature is involved. Pass the result to `createPepuSponsoredClient`.
121
+ *
122
+ * @example
123
+ * const account = await loadKernelSessionAccount({ publicClient, approval, sessionPrivateKey });
124
+ */
125
+ declare function loadKernelSessionAccount(p: {
126
+ publicClient: PublicClient;
127
+ approval: string;
128
+ sessionPrivateKey: Hex;
129
+ }): Promise<KernelSmartAccount>;
130
+
131
+ export { CALL_POLICY_V0_0_4_ADDRESS, KernelOwner, KernelSessionCall, KernelSmartAccount, SESSION_GAS_RESERVATION_PEPU, TIMESTAMP_POLICY_ADDRESS, approveKernelSession, buildKernelSessionPolicies, expectedPermissionId, generateSessionKey, loadKernelSessionAccount };