@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.
- package/LICENSE +21 -0
- package/README.md +590 -2
- package/dist/aa/kernel.cjs +41 -0
- package/dist/aa/kernel.cjs.map +1 -0
- package/dist/aa/kernel.d.cts +88 -0
- package/dist/aa/kernel.d.ts +88 -0
- package/dist/aa/kernel.guard.js +15 -0
- package/dist/aa/kernel.js +11 -0
- package/dist/aa/kernel.js.map +1 -0
- package/dist/aa/react-direct.cjs +111 -0
- package/dist/aa/react-direct.cjs.map +1 -0
- package/dist/aa/react-direct.d.cts +42 -0
- package/dist/aa/react-direct.d.ts +42 -0
- package/dist/aa/react-direct.guard.js +15 -0
- package/dist/aa/react-direct.js +107 -0
- package/dist/aa/react-direct.js.map +1 -0
- package/dist/aa/react.cjs +152 -0
- package/dist/aa/react.cjs.map +1 -0
- package/dist/aa/react.d.cts +62 -0
- package/dist/aa/react.d.ts +62 -0
- package/dist/aa/react.guard.js +15 -0
- package/dist/aa/react.js +147 -0
- package/dist/aa/react.js.map +1 -0
- package/dist/aa.cjs +84 -0
- package/dist/aa.cjs.map +1 -0
- package/dist/aa.d.cts +85 -0
- package/dist/aa.d.ts +85 -0
- package/dist/aa.js +11 -0
- package/dist/aa.js.map +1 -0
- package/dist/api-Dz4sCHH_.d.cts +654 -0
- package/dist/api-Dz4sCHH_.d.ts +654 -0
- package/dist/calls-BRPjKgjl.d.cts +70 -0
- package/dist/calls-z_EQOtFb.d.ts +70 -0
- package/dist/chains-DK13zGIp.d.cts +235 -0
- package/dist/chains-DK13zGIp.d.ts +235 -0
- package/dist/chunk-3XUGQODR.js +194 -0
- package/dist/chunk-3XUGQODR.js.map +1 -0
- package/dist/chunk-45KSZH26.cjs +145 -0
- package/dist/chunk-45KSZH26.cjs.map +1 -0
- package/dist/chunk-4GINFJO6.cjs +44 -0
- package/dist/chunk-4GINFJO6.cjs.map +1 -0
- package/dist/chunk-62M2LKQW.js +136 -0
- package/dist/chunk-62M2LKQW.js.map +1 -0
- package/dist/chunk-6DSZ4Z2N.js +498 -0
- package/dist/chunk-6DSZ4Z2N.js.map +1 -0
- package/dist/chunk-7MNJF2OB.cjs +72 -0
- package/dist/chunk-7MNJF2OB.cjs.map +1 -0
- package/dist/chunk-7PVR7QSE.js +45 -0
- package/dist/chunk-7PVR7QSE.js.map +1 -0
- package/dist/chunk-A5LP2UCS.cjs +2729 -0
- package/dist/chunk-A5LP2UCS.cjs.map +1 -0
- package/dist/chunk-AJS4UFQX.cjs +121 -0
- package/dist/chunk-AJS4UFQX.cjs.map +1 -0
- package/dist/chunk-BGALSKAF.cjs +315 -0
- package/dist/chunk-BGALSKAF.cjs.map +1 -0
- package/dist/chunk-C2XW44FI.cjs +200 -0
- package/dist/chunk-C2XW44FI.cjs.map +1 -0
- package/dist/chunk-C7IC36XS.cjs +13 -0
- package/dist/chunk-C7IC36XS.cjs.map +1 -0
- package/dist/chunk-D52PADVY.js +84 -0
- package/dist/chunk-D52PADVY.js.map +1 -0
- package/dist/chunk-DH6BFNVJ.cjs +272 -0
- package/dist/chunk-DH6BFNVJ.cjs.map +1 -0
- package/dist/chunk-DPCZJLB3.cjs +87 -0
- package/dist/chunk-DPCZJLB3.cjs.map +1 -0
- package/dist/chunk-EHBPIYY4.js +262 -0
- package/dist/chunk-EHBPIYY4.js.map +1 -0
- package/dist/chunk-ESMNAXUI.js +86 -0
- package/dist/chunk-ESMNAXUI.js.map +1 -0
- package/dist/chunk-F2R473FR.js +304 -0
- package/dist/chunk-F2R473FR.js.map +1 -0
- package/dist/chunk-IB2FSPMJ.js +66 -0
- package/dist/chunk-IB2FSPMJ.js.map +1 -0
- package/dist/chunk-IG7RSL2Y.cjs +178 -0
- package/dist/chunk-IG7RSL2Y.cjs.map +1 -0
- package/dist/chunk-IY3ALPUJ.js +2716 -0
- package/dist/chunk-IY3ALPUJ.js.map +1 -0
- package/dist/chunk-J3O2ZGG3.cjs +93 -0
- package/dist/chunk-J3O2ZGG3.cjs.map +1 -0
- package/dist/chunk-J6UXXHBE.js +37 -0
- package/dist/chunk-J6UXXHBE.js.map +1 -0
- package/dist/chunk-JLZ4LZ4Z.js +22 -0
- package/dist/chunk-JLZ4LZ4Z.js.map +1 -0
- package/dist/chunk-K7JSQPZO.cjs +231 -0
- package/dist/chunk-K7JSQPZO.cjs.map +1 -0
- package/dist/chunk-KJYNF5KH.js +224 -0
- package/dist/chunk-KJYNF5KH.js.map +1 -0
- package/dist/chunk-KVG3AYYR.js +99 -0
- package/dist/chunk-KVG3AYYR.js.map +1 -0
- package/dist/chunk-NE3QKDOB.cjs +24 -0
- package/dist/chunk-NE3QKDOB.cjs.map +1 -0
- package/dist/chunk-NVOPDXTA.cjs +95 -0
- package/dist/chunk-NVOPDXTA.cjs.map +1 -0
- package/dist/chunk-OH3QMAIB.js +11 -0
- package/dist/chunk-OH3QMAIB.js.map +1 -0
- package/dist/chunk-PHM3ZORG.cjs +110 -0
- package/dist/chunk-PHM3ZORG.cjs.map +1 -0
- package/dist/chunk-R5PXQNO3.cjs +209 -0
- package/dist/chunk-R5PXQNO3.cjs.map +1 -0
- package/dist/chunk-RCMKPJZO.cjs +49 -0
- package/dist/chunk-RCMKPJZO.cjs.map +1 -0
- package/dist/chunk-SVWRRALU.cjs +17 -0
- package/dist/chunk-SVWRRALU.cjs.map +1 -0
- package/dist/chunk-T43PQXJD.js +202 -0
- package/dist/chunk-T43PQXJD.js.map +1 -0
- package/dist/chunk-VBH3JLQ5.js +116 -0
- package/dist/chunk-VBH3JLQ5.js.map +1 -0
- package/dist/chunk-VF3D6KLQ.cjs +94 -0
- package/dist/chunk-VF3D6KLQ.cjs.map +1 -0
- package/dist/chunk-VTQIHMF3.js +82 -0
- package/dist/chunk-VTQIHMF3.js.map +1 -0
- package/dist/chunk-W3JN3YIW.js +15 -0
- package/dist/chunk-W3JN3YIW.js.map +1 -0
- package/dist/chunk-WANILJZQ.cjs +87 -0
- package/dist/chunk-WANILJZQ.cjs.map +1 -0
- package/dist/chunk-XC4IBCI2.js +86 -0
- package/dist/chunk-XC4IBCI2.js.map +1 -0
- package/dist/chunk-YKEWWQEJ.js +165 -0
- package/dist/chunk-YKEWWQEJ.js.map +1 -0
- package/dist/chunk-YQL7NISX.cjs +515 -0
- package/dist/chunk-YQL7NISX.cjs.map +1 -0
- package/dist/chunk-ZB6SVBK4.js +89 -0
- package/dist/chunk-ZB6SVBK4.js.map +1 -0
- package/dist/combo/react.cjs +236 -0
- package/dist/combo/react.cjs.map +1 -0
- package/dist/combo/react.d.cts +148 -0
- package/dist/combo/react.d.ts +148 -0
- package/dist/combo/react.guard.js +15 -0
- package/dist/combo/react.js +230 -0
- package/dist/combo/react.js.map +1 -0
- package/dist/combo.cjs +263 -0
- package/dist/combo.cjs.map +1 -0
- package/dist/combo.d.cts +139 -0
- package/dist/combo.d.ts +139 -0
- package/dist/combo.guard.js +15 -0
- package/dist/combo.js +249 -0
- package/dist/combo.js.map +1 -0
- package/dist/config-CHjz7ZjZ.d.cts +57 -0
- package/dist/config-COjhIZTh.d.ts +57 -0
- package/dist/doctor.cjs +354 -0
- package/dist/doctor.cjs.map +1 -0
- package/dist/doctor.d.cts +177 -0
- package/dist/doctor.d.ts +177 -0
- package/dist/doctor.js +345 -0
- package/dist/doctor.js.map +1 -0
- package/dist/erc7677-DOW58QBE.d.cts +111 -0
- package/dist/erc7677-DOW58QBE.d.ts +111 -0
- package/dist/errors-CgX1vNj7.d.cts +100 -0
- package/dist/errors-CgX1vNj7.d.ts +100 -0
- package/dist/index.cjs +806 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +2398 -0
- package/dist/index.d.ts +2398 -0
- package/dist/index.js +559 -0
- package/dist/index.js.map +1 -0
- package/dist/paymaster/server.cjs +38 -0
- package/dist/paymaster/server.cjs.map +1 -0
- package/dist/paymaster/server.d.cts +57 -0
- package/dist/paymaster/server.d.ts +57 -0
- package/dist/paymaster/server.js +36 -0
- package/dist/paymaster/server.js.map +1 -0
- package/dist/paymaster.cjs +356 -0
- package/dist/paymaster.cjs.map +1 -0
- package/dist/paymaster.d.cts +1851 -0
- package/dist/paymaster.d.ts +1851 -0
- package/dist/paymaster.js +289 -0
- package/dist/paymaster.js.map +1 -0
- package/dist/privy/react.cjs +49 -0
- package/dist/privy/react.cjs.map +1 -0
- package/dist/privy/react.d.cts +194 -0
- package/dist/privy/react.d.ts +194 -0
- package/dist/privy/react.guard.js +15 -0
- package/dist/privy/react.js +7 -0
- package/dist/privy/react.js.map +1 -0
- package/dist/privy/server.cjs +44 -0
- package/dist/privy/server.cjs.map +1 -0
- package/dist/privy/server.d.cts +192 -0
- package/dist/privy/server.d.ts +192 -0
- package/dist/privy/server.guard.js +15 -0
- package/dist/privy/server.js +6 -0
- package/dist/privy/server.js.map +1 -0
- package/dist/privy/wagmi.d.ts +90 -0
- package/dist/privy/wagmi.guard.js +15 -0
- package/dist/privy/wagmi.js +55 -0
- package/dist/privy/wagmi.js.map +1 -0
- package/dist/privy.cjs +34 -0
- package/dist/privy.cjs.map +1 -0
- package/dist/privy.d.cts +4 -0
- package/dist/privy.d.ts +4 -0
- package/dist/privy.js +5 -0
- package/dist/privy.js.map +1 -0
- package/dist/react.cjs +73 -0
- package/dist/react.cjs.map +1 -0
- package/dist/react.d.cts +66 -0
- package/dist/react.d.ts +66 -0
- package/dist/react.guard.js +15 -0
- package/dist/react.js +68 -0
- package/dist/react.js.map +1 -0
- package/dist/requirements-C-QiJkL9.d.cts +134 -0
- package/dist/requirements-C-QiJkL9.d.ts +134 -0
- package/dist/scope-DBRkN7bR.d.cts +94 -0
- package/dist/scope-DBRkN7bR.d.ts +94 -0
- package/dist/server.cjs +59 -0
- package/dist/server.cjs.map +1 -0
- package/dist/server.d.cts +208 -0
- package/dist/server.d.ts +208 -0
- package/dist/server.js +8 -0
- package/dist/server.js.map +1 -0
- package/dist/session/kernel.cjs +83 -0
- package/dist/session/kernel.cjs.map +1 -0
- package/dist/session/kernel.d.cts +131 -0
- package/dist/session/kernel.d.ts +131 -0
- package/dist/session/kernel.guard.js +15 -0
- package/dist/session/kernel.js +13 -0
- package/dist/session/kernel.js.map +1 -0
- package/dist/session/react.cjs +38 -0
- package/dist/session/react.cjs.map +1 -0
- package/dist/session/react.d.cts +119 -0
- package/dist/session/react.d.ts +119 -0
- package/dist/session/react.guard.js +15 -0
- package/dist/session/react.js +8 -0
- package/dist/session/react.js.map +1 -0
- package/dist/session/server.cjs +268 -0
- package/dist/session/server.cjs.map +1 -0
- package/dist/session/server.d.cts +151 -0
- package/dist/session/server.d.ts +151 -0
- package/dist/session/server.guard.js +15 -0
- package/dist/session/server.js +252 -0
- package/dist/session/server.js.map +1 -0
- package/dist/session.cjs +74 -0
- package/dist/session.cjs.map +1 -0
- package/dist/session.d.cts +3 -0
- package/dist/session.d.ts +3 -0
- package/dist/session.js +5 -0
- package/dist/session.js.map +1 -0
- package/dist/status-Dx9zAFo9.d.ts +327 -0
- package/dist/status-wgTM26V7.d.cts +327 -0
- package/dist/store-CjmLgp9g.d.cts +64 -0
- package/dist/store-CjmLgp9g.d.ts +64 -0
- package/dist/types-BEEM7WdG.d.cts +25 -0
- package/dist/types-BEEM7WdG.d.ts +25 -0
- package/dist/types-BilBTDqK.d.cts +27 -0
- package/dist/types-BilBTDqK.d.ts +27 -0
- package/package.json +245 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Pepe Unchained
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,591 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @pepu-chain/sdk
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Chain definitions, contract/DEX registries, ABIs, gas utilities, explorer
|
|
4
|
+
helpers, an account-abstraction surface, and a canonical token list for
|
|
5
|
+
**Pepe Unchained V2** — an Arbitrum Orbit / Nitro chain (ArbOS 51) hosted by
|
|
6
|
+
Conduit.
|
|
7
|
+
|
|
8
|
+
This package *extends* [viem](https://viem.sh). It does not wrap or
|
|
9
|
+
re-export viem's own API — you still use `viem` directly for clients,
|
|
10
|
+
actions, encoding, etc. `@pepu-chain/sdk` only supplies the PEPU-specific facts
|
|
11
|
+
viem doesn't know: chain IDs, RPC URLs, which contracts actually exist on
|
|
12
|
+
this chain (with on-chain-verified addresses only), ABIs for those
|
|
13
|
+
contracts, a token list, and small helpers layered on top.
|
|
14
|
+
|
|
15
|
+
Everything in this package is independently verified against live PEPU
|
|
16
|
+
mainnet (`eth_getCode` plus a successful read call, at minimum) — see each
|
|
17
|
+
module's source comments for exactly how. Nothing here is a guessed or
|
|
18
|
+
copied-from-elsewhere address.
|
|
19
|
+
|
|
20
|
+
## Install
|
|
21
|
+
|
|
22
|
+
```sh
|
|
23
|
+
npm install @pepu-chain/sdk viem
|
|
24
|
+
# or
|
|
25
|
+
pnpm add @pepu-chain/sdk viem
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
`viem` is a peer dependency (`^2.0.0`) — this package does not bundle it, so
|
|
29
|
+
your app controls its own viem version. `react` is an **optional** peer
|
|
30
|
+
dependency, needed only if you import from `@pepu-chain/sdk/react` (see below);
|
|
31
|
+
the main `@pepu-chain/sdk` entry point never touches React and works in a plain
|
|
32
|
+
Node script.
|
|
33
|
+
|
|
34
|
+
### Install: peers per subpath
|
|
35
|
+
|
|
36
|
+
Every subpath also needs `viem`. The entries below need extra peers, and **the recommended path is the CLI: `create-pepu-app` scaffolds an app with every peer already in its `package.json`**, so you never run these by hand. If you install by hand and a peer is missing, importing the subpath throws `PEPU_MISSING_PEER` naming the subpath and the exact command (under Node; bundlers report their own "module not found"). Subpaths not listed here (`.`, `/privy`, `/session`, `/aa`, `/paymaster`, `/paymaster/server`, `/server`, `/doctor`) need only `viem`.
|
|
37
|
+
|
|
38
|
+
| Subpath | Required peers | Install |
|
|
39
|
+
|---|---|---|
|
|
40
|
+
| `@pepu-chain/sdk/react` | `react` | `npm i react` |
|
|
41
|
+
| `@pepu-chain/sdk/privy/react` | `react`, `@privy-io/react-auth` | `npm i react @privy-io/react-auth` |
|
|
42
|
+
| `@pepu-chain/sdk/privy/wagmi` | `react`, `@privy-io/react-auth`, `@privy-io/wagmi`, `wagmi`, `@tanstack/react-query` | `npm i react @privy-io/react-auth @privy-io/wagmi wagmi @tanstack/react-query` |
|
|
43
|
+
| `@pepu-chain/sdk/privy/server` | `@privy-io/node` | `npm i @privy-io/node` |
|
|
44
|
+
| `@pepu-chain/sdk/session/server` | `@privy-io/node` | `npm i @privy-io/node` |
|
|
45
|
+
| `@pepu-chain/sdk/session/react` | `react`, `@privy-io/react-auth` | `npm i react @privy-io/react-auth` |
|
|
46
|
+
| `@pepu-chain/sdk/session/kernel` | `@zerodev/sdk`, `@zerodev/permissions`, `@zerodev/ecdsa-validator` | `npm i @zerodev/sdk @zerodev/permissions @zerodev/ecdsa-validator` |
|
|
47
|
+
| `@pepu-chain/sdk/aa/kernel` | `@zerodev/sdk`, `@zerodev/ecdsa-validator` | `npm i @zerodev/sdk @zerodev/ecdsa-validator` |
|
|
48
|
+
| `@pepu-chain/sdk/aa/react` | `react`, `@privy-io/react-auth`, `permissionless` | `npm i react @privy-io/react-auth permissionless` |
|
|
49
|
+
| `@pepu-chain/sdk/aa/react-direct` | `react`, `@privy-io/react-auth`, `@zerodev/sdk`, `@zerodev/ecdsa-validator` | `npm i react @privy-io/react-auth @zerodev/sdk @zerodev/ecdsa-validator` |
|
|
50
|
+
| `@pepu-chain/sdk/combo` | `@privy-io/node`, `@zerodev/sdk`, `@zerodev/permissions`, `@zerodev/ecdsa-validator` | `npm i @privy-io/node @zerodev/sdk @zerodev/permissions @zerodev/ecdsa-validator` |
|
|
51
|
+
| `@pepu-chain/sdk/combo/react` | `react`, `@privy-io/react-auth`, `@zerodev/sdk`, `@zerodev/permissions`, `@zerodev/ecdsa-validator` | `npm i react @privy-io/react-auth @zerodev/sdk @zerodev/permissions @zerodev/ecdsa-validator` |
|
|
52
|
+
|
|
53
|
+
**Bundle** for the common pillars (Google login + session keys + sponsored gas), client and server together:
|
|
54
|
+
|
|
55
|
+
```sh
|
|
56
|
+
npm i viem react @privy-io/react-auth @privy-io/node @zerodev/sdk @zerodev/permissions @zerodev/ecdsa-validator permissionless
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Quickstart
|
|
60
|
+
|
|
61
|
+
```ts
|
|
62
|
+
import { pepuMainnet, getPublicClient, explorerUrl } from "@pepu-chain/sdk";
|
|
63
|
+
|
|
64
|
+
const client = getPublicClient(pepuMainnet);
|
|
65
|
+
|
|
66
|
+
const blockNumber = await client.getBlockNumber();
|
|
67
|
+
console.log(`Latest block: ${blockNumber}`);
|
|
68
|
+
|
|
69
|
+
console.log(explorerUrl(pepuMainnet, "tx", "0x..."));
|
|
70
|
+
// -> https://pepuscan.com/tx/0x...
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Using it with wagmi is the same as any other chain:
|
|
74
|
+
|
|
75
|
+
```ts
|
|
76
|
+
import { createConfig, http } from "wagmi";
|
|
77
|
+
import { pepuMainnet } from "@pepu-chain/sdk";
|
|
78
|
+
|
|
79
|
+
export const config = createConfig({
|
|
80
|
+
chains: [pepuMainnet],
|
|
81
|
+
transports: {
|
|
82
|
+
[pepuMainnet.id]: http(),
|
|
83
|
+
},
|
|
84
|
+
});
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Chain registry & wallet helpers
|
|
88
|
+
|
|
89
|
+
```ts
|
|
90
|
+
import {
|
|
91
|
+
pepuMainnet,
|
|
92
|
+
pepuTestnet,
|
|
93
|
+
pepuChains,
|
|
94
|
+
isPepuChain,
|
|
95
|
+
toAddEthereumChainParameter,
|
|
96
|
+
switchOrAddPepuChain,
|
|
97
|
+
} from "@pepu-chain/sdk";
|
|
98
|
+
|
|
99
|
+
isPepuChain(97741); // true
|
|
100
|
+
isPepuChain(1); // false — Ethereum mainnet
|
|
101
|
+
|
|
102
|
+
// Build the `wallet_addEthereumChain` parameter object by hand:
|
|
103
|
+
toAddEthereumChainParameter(pepuMainnet);
|
|
104
|
+
// -> { chainId: "0x17dcd", chainName: "Pepe Unchained V2", ... }
|
|
105
|
+
|
|
106
|
+
// Or let a connected EIP-1193 provider add it if needed, then switch:
|
|
107
|
+
await switchOrAddPepuChain(window.ethereum, pepuMainnet);
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Contract registry
|
|
111
|
+
|
|
112
|
+
```ts
|
|
113
|
+
import { getContract, isDeployed, pepuMainnet } from "@pepu-chain/sdk";
|
|
114
|
+
|
|
115
|
+
const permit2 = getContract(pepuMainnet.id, "permit2");
|
|
116
|
+
if (isDeployed(permit2)) {
|
|
117
|
+
console.log(permit2.address);
|
|
118
|
+
// -> 0x000000000022D473030F116dDEE9F6B43aC78BA3 (canonical Permit2)
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const multicall3 = getContract(pepuMainnet.id, "multicall3");
|
|
122
|
+
// PEPU-specific address, NOT the canonical one — see "Known gaps" below.
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
`pepuContracts[chainId]` tracks, per chain, whichever of these exist:
|
|
126
|
+
`create2Factory`, `multicall3`, `permit2`, `entryPoint06`, `entryPoint07`,
|
|
127
|
+
`kernelFactory`, `kernelMetaFactory`, `ecdsaValidator`, `paymaster`. Every
|
|
128
|
+
entry is either `{ status: "deployed", address, notes? }` or
|
|
129
|
+
`{ status: "pending", reason }` — there is no field to accidentally read an
|
|
130
|
+
address off a pending entry; TypeScript won't let you.
|
|
131
|
+
|
|
132
|
+
The `paymaster` entry (alias of `paymasterV2`) is the v2 paymaster
|
|
133
|
+
`PepuSponsoredPaymasterV7` at `0xdb28528C9399C33c9A0297E8A62F39145acbC30D`,
|
|
134
|
+
deployed as a canary: internally reviewed 3x, external audit pending, funded in
|
|
135
|
+
small tranches. `paymasterV1` is retired (`retired: true`; its EntryPoint
|
|
136
|
+
deposit was withdrawn, so it cannot sponsor anything, never deposit to it).
|
|
137
|
+
`status: "deployed"` answers "does this contract exist," not "can my app get
|
|
138
|
+
gas sponsored." For that second question call `checkSponsorship()` (a live
|
|
139
|
+
probe of the hosted bundler and paymaster service). The deprecated
|
|
140
|
+
`getSponsorshipStatus()` still always reports unavailable.
|
|
141
|
+
|
|
142
|
+
## PepuSwap (DEX) registry
|
|
143
|
+
|
|
144
|
+
PepuSwap is PEPU's flagship DEX, a Uniswap V3 fork. Its contracts are
|
|
145
|
+
tracked separately from `pepuContracts` (see `src/dex.ts` for why) because
|
|
146
|
+
they're one application's deployment, not chain infrastructure:
|
|
147
|
+
|
|
148
|
+
```ts
|
|
149
|
+
import { getPepuSwapContract, isDeployed, pepuMainnet } from "@pepu-chain/sdk";
|
|
150
|
+
|
|
151
|
+
const router = getPepuSwapContract(pepuMainnet.id, "swapRouter02");
|
|
152
|
+
if (isDeployed(router)) {
|
|
153
|
+
console.log(router.address); // 0x150c3F0f16C3D9EB34351d7af9c961FeDc97A0fb
|
|
154
|
+
}
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
Tracked names: `v3Factory`, `swapRouter02`, `universalRouter`,
|
|
158
|
+
`positionManager`, `quoterV2`, `tickLens`, `v3Migrator`, `v3Staker`,
|
|
159
|
+
`multicallNonCanonical`, `permit2NonCanonical`. The last two are PepuSwap's
|
|
160
|
+
own overrides of otherwise-standard infrastructure — **do not** confuse them
|
|
161
|
+
with `pepuContracts.multicall3` / `pepuContracts.permit2`:
|
|
162
|
+
|
|
163
|
+
- `multicallNonCanonical` (`0x927af2a6B76d2d8206d93004463F8C122701383B`) is
|
|
164
|
+
Uniswap's `UniswapInterfaceMulticall`, not Multicall3. See
|
|
165
|
+
`pepuSwapMulticallAbi`.
|
|
166
|
+
- `permit2NonCanonical` (`0xB461c05f76d7f919FF7A3Df2B0D2593F56538b4B`) is
|
|
167
|
+
PepuSwap's own separate Permit2 deployment, predating (and not
|
|
168
|
+
interoperable with) the canonical Permit2 now also live on PEPU as
|
|
169
|
+
`pepuContracts.permit2`.
|
|
170
|
+
|
|
171
|
+
`v3Migrator` and `v3Staker` are verified (address + a live read) but ship
|
|
172
|
+
without a dedicated ABI in `./abi/` — pair them with Uniswap's public
|
|
173
|
+
`V3Migrator`/`V3Staker` ABIs if you need their full interface.
|
|
174
|
+
|
|
175
|
+
## ABIs
|
|
176
|
+
|
|
177
|
+
`@pepu-chain/sdk` ships hand-verified ABI subsets — not full contract interfaces,
|
|
178
|
+
just the functions actually confirmed live — for every deployed contract in
|
|
179
|
+
both registries: `wpepuAbi`, `pepuSwapV3FactoryAbi`, `pepuSwapV3PoolAbi`,
|
|
180
|
+
`pepuSwapRouterAbi`, `pepuSwapQuoterAbi`, `pepuSwapPositionManagerAbi`,
|
|
181
|
+
`pepuSwapTickLensAbi`, `pepuSwapUniversalRouterAbi`, `pepuSwapPermit2Abi`,
|
|
182
|
+
`pepuSwapMulticallAbi`, `arbGasInfoAbi` (+ `ARB_GAS_INFO_ADDRESS`),
|
|
183
|
+
`entryPointV07Abi`, `kernelFactoryAbi` (+
|
|
184
|
+
`KERNEL_V3_1_IMPLEMENTATION_ADDRESS`), `kernelEcdsaValidatorAbi` (+
|
|
185
|
+
`ERC7579_MODULE_TYPE`). See each file under `src/abi/` for exactly which
|
|
186
|
+
functions were verified and how.
|
|
187
|
+
|
|
188
|
+
```ts
|
|
189
|
+
import { createPublicClient, http } from "viem";
|
|
190
|
+
import { pepuMainnet, getPepuSwapContract, isDeployed, pepuSwapV3FactoryAbi } from "@pepu-chain/sdk";
|
|
191
|
+
|
|
192
|
+
const client = createPublicClient({ chain: pepuMainnet, transport: http() });
|
|
193
|
+
const factory = getPepuSwapContract(pepuMainnet.id, "v3Factory");
|
|
194
|
+
|
|
195
|
+
if (isDeployed(factory)) {
|
|
196
|
+
const pool = await client.readContract({
|
|
197
|
+
address: factory.address,
|
|
198
|
+
abi: pepuSwapV3FactoryAbi,
|
|
199
|
+
functionName: "getPool",
|
|
200
|
+
args: [wpepuAddress, usdtAddress, 3000],
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
## Gas & fees
|
|
206
|
+
|
|
207
|
+
PEPU's Nitro dual-fee model (L2 execution + L1 data-posting) is not what
|
|
208
|
+
most developers expect, and its ~12,500 gwei base fee looks alarming if you
|
|
209
|
+
only know Ethereum's range — but PEPU is a low-value token, so naive
|
|
210
|
+
formatting misleads in both directions. See `src/gas.ts`.
|
|
211
|
+
|
|
212
|
+
```ts
|
|
213
|
+
import {
|
|
214
|
+
getNitroFeeBreakdown,
|
|
215
|
+
explainDualFeeModel,
|
|
216
|
+
estimateTransactionCost,
|
|
217
|
+
formatPepu,
|
|
218
|
+
formatPepuGasPrice,
|
|
219
|
+
maxSendableAmount,
|
|
220
|
+
} from "@pepu-chain/sdk";
|
|
221
|
+
|
|
222
|
+
const breakdown = await getNitroFeeBreakdown(client);
|
|
223
|
+
// { l2PricePerGasWei, l1PricePerCalldataUnitWei, l1BaseFeeEstimateWei }
|
|
224
|
+
|
|
225
|
+
console.log(explainDualFeeModel().summary);
|
|
226
|
+
|
|
227
|
+
const estimate = await estimateTransactionCost(client, {
|
|
228
|
+
to: "0x...",
|
|
229
|
+
value: 1000000000000000000n,
|
|
230
|
+
});
|
|
231
|
+
console.log(estimate.costFormatted); // e.g. "0.0000105 PEPU"
|
|
232
|
+
|
|
233
|
+
formatPepu(10_000_000_000n); // "0.00000001 PEPU" — not "0 PEPU"
|
|
234
|
+
formatPepuGasPrice(12_500_000_000_000n);
|
|
235
|
+
// "12500 gwei/gas (PEPU's normal baseline is ~12,500 gwei — this is not a congestion spike; see explainDualFeeModel())"
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
### "Send max" — sizing a transfer against the sender's own balance
|
|
239
|
+
|
|
240
|
+
Naive `balance - gasLimit * gasPrice` arithmetic is wrong on an Arbitrum
|
|
241
|
+
Nitro chain in general (see the dual-fee model above), and doubly wrong if
|
|
242
|
+
you plug in a hand-picked `gasLimit` instead of a real `eth_estimateGas`
|
|
243
|
+
result. `maxSendableAmount` does this correctly — and safely — for a
|
|
244
|
+
native-currency "Max" button:
|
|
245
|
+
|
|
246
|
+
```ts
|
|
247
|
+
import { maxSendableAmount } from "@pepu-chain/sdk";
|
|
248
|
+
|
|
249
|
+
const result = await maxSendableAmount({
|
|
250
|
+
client,
|
|
251
|
+
from: "0xSender...",
|
|
252
|
+
to: "0xRecipient...", // omit while the user hasn't typed one yet
|
|
253
|
+
balanceWei: senderBalance, // e.g. from wagmi's useBalance / viem's getBalance
|
|
254
|
+
});
|
|
255
|
+
|
|
256
|
+
switch (result.status) {
|
|
257
|
+
case "ok":
|
|
258
|
+
// result.amountWei is safe to fill into an amount field.
|
|
259
|
+
// result.estimate / result.marginWei / result.totalReservedWei explain why.
|
|
260
|
+
break;
|
|
261
|
+
case "zero-balance":
|
|
262
|
+
case "insufficient-for-gas":
|
|
263
|
+
// result.reason is a ready-to-render explanation — disable the button, don't guess.
|
|
264
|
+
break;
|
|
265
|
+
}
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
It never reimplements Nitro's fee math — it estimates the real transfer
|
|
269
|
+
with `estimateTransactionCost` (so the chain's own `eth_estimateGas`
|
|
270
|
+
decides gas usage) and applies a documented safety margin
|
|
271
|
+
(`DEFAULT_MAX_SEND_MARGIN_BPS`, 20% by default) on top, to absorb base-fee
|
|
272
|
+
movement between estimating and submitting. Estimation failures propagate
|
|
273
|
+
as a rejected promise rather than a silent fallback guess — see
|
|
274
|
+
`src/gas.ts`'s doc comment on `maxSendableAmount` for the full reasoning,
|
|
275
|
+
including why it can't just estimate gas using the balance itself as the
|
|
276
|
+
candidate `value` (circular, and most RPCs would reject the simulation for
|
|
277
|
+
insufficient funds).
|
|
278
|
+
|
|
279
|
+
**Not currently used by `templates/consumer-app`.** That template's send
|
|
280
|
+
form removed its "Max" button — not because this helper is wrong, but
|
|
281
|
+
because Privy's transaction confirmation modal performs its own separate,
|
|
282
|
+
over-conservative pre-flight balance check before signing, and on PEPU it
|
|
283
|
+
has been observed to reject transfers this function sizes correctly (e.g.
|
|
284
|
+
refusing a 0.2625 PEPU transfer from a 0.7748 PEPU balance). Since that
|
|
285
|
+
modal has final say, a correct "Max" amount can still bounce there, so the
|
|
286
|
+
button was removed rather than ship a control that sometimes lies. Reach
|
|
287
|
+
for `maxSendableAmount` for any PEPU wallet UI that submits transactions
|
|
288
|
+
itself instead of routing through Privy's modal.
|
|
289
|
+
|
|
290
|
+
## Explorer helpers & pepuscan client
|
|
291
|
+
|
|
292
|
+
```ts
|
|
293
|
+
import {
|
|
294
|
+
explorerUrl,
|
|
295
|
+
txUrl,
|
|
296
|
+
addressUrl,
|
|
297
|
+
tokenUrl,
|
|
298
|
+
blockUrl,
|
|
299
|
+
createPepuscanClient,
|
|
300
|
+
} from "@pepu-chain/sdk";
|
|
301
|
+
|
|
302
|
+
txUrl(pepuMainnet, "0x...");
|
|
303
|
+
blockUrl(pepuMainnet, 12345);
|
|
304
|
+
|
|
305
|
+
const pepuscan = createPepuscanClient(pepuMainnet);
|
|
306
|
+
const abi = await pepuscan.getVerifiedAbi("0x..."); // null if unverified
|
|
307
|
+
const meta = await pepuscan.getTokenMetadata("0x..."); // null if not a known token
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
`createPepuscanClient` is deliberately narrow — verified-ABI and
|
|
311
|
+
token-metadata reads only. It does not re-wrap Blockscout's full API
|
|
312
|
+
(transaction history, logs, NFTs, etc.); use the Blockscout MCP server for
|
|
313
|
+
that.
|
|
314
|
+
|
|
315
|
+
## Account abstraction and gas sponsorship
|
|
316
|
+
|
|
317
|
+
The full ZeroDev Kernel v3 stack (EntryPoint v0.6/v0.7, Kernel
|
|
318
|
+
factory/meta-factory, ECDSA validator) is deployed and verified on mainnet.
|
|
319
|
+
PEPU hosts the bundler (`https://bundler.pepeunchained.com`, the default for
|
|
320
|
+
`PEPU_BUNDLER_URL`) and the paymaster service
|
|
321
|
+
(`https://paymaster.pepeunchained.com`, exposed as
|
|
322
|
+
`resolvePepuEndpoints().paymasterBaseUrl`). Sponsorship is **proven on
|
|
323
|
+
mainnet** through those URLs: a project-sponsored operation from a fresh
|
|
324
|
+
Kernel account holding 0 PEPU, paid for by the v2 paymaster (a canary:
|
|
325
|
+
internally reviewed 3x, external audit pending, funded in small tranches, so
|
|
326
|
+
deposit in small amounts).
|
|
327
|
+
|
|
328
|
+
The ERC-7677 paymaster URL always embeds a token
|
|
329
|
+
(`https://paymaster.pepeunchained.com/v2/paymaster/<token>`), so there is no
|
|
330
|
+
tokenless default (`PEPU_HOSTED.paymasterUrl` is `null`). An app brings a
|
|
331
|
+
project: claim it, deposit into it, and use its token. Build the URL with
|
|
332
|
+
`hostedErc7677Url(token)` (from `@pepu-chain/sdk/paymaster`) or pass
|
|
333
|
+
`paymasterToken` to `createPepuPaymasterClient` /
|
|
334
|
+
`createPepuSponsoredClient`. A project client token (`ppt_`) works only from
|
|
335
|
+
the project's allowed origins; a server key (`ppk_`) is secret and server
|
|
336
|
+
only. The per-user free tier (100 PEPU/day and 50 PEPU/hour, TapScore only for
|
|
337
|
+
now) needs a verified Privy token from PEPU's own Privy app, so third-party
|
|
338
|
+
apps use a project. See [/paymaster](../../docs/sdk/paymaster.md) and
|
|
339
|
+
[/aa](../../docs/sdk/aa.md). The Google login + Kernel session key +
|
|
340
|
+
sponsorship combination is proven by script; the browser flow has not yet been
|
|
341
|
+
run by a person.
|
|
342
|
+
|
|
343
|
+
```ts
|
|
344
|
+
import {
|
|
345
|
+
getPepuKernelStack,
|
|
346
|
+
getKernelAccountAddress,
|
|
347
|
+
getSponsorshipStatus,
|
|
348
|
+
pepuMainnet,
|
|
349
|
+
} from "@pepu-chain/sdk";
|
|
350
|
+
|
|
351
|
+
const stack = getPepuKernelStack(pepuMainnet.id); // undefined on testnet
|
|
352
|
+
if (stack) {
|
|
353
|
+
// Build `data` (Kernel v3.1's initialize() calldata) with @zerodev/sdk —
|
|
354
|
+
// this package does not fabricate that encoding. Then:
|
|
355
|
+
const address = await getKernelAccountAddress(client, stack.kernelFactory, {
|
|
356
|
+
data, // from @zerodev/sdk
|
|
357
|
+
salt: "0x0",
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
getSponsorshipStatus();
|
|
362
|
+
// Deprecated and always { available: false }. Use `await checkSponsorship()` for the live answer.
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
## Token list
|
|
366
|
+
|
|
367
|
+
```ts
|
|
368
|
+
import { pepuTokenList } from "@pepu-chain/sdk";
|
|
369
|
+
|
|
370
|
+
console.log(pepuTokenList.tokens.map((t) => t.symbol));
|
|
371
|
+
// -> ["WPEPU", "USDT", "USDC", "WETH"]
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
`pepuTokenList` conforms to the
|
|
375
|
+
[Uniswap Token List schema](https://github.com/Uniswap/token-lists). Every
|
|
376
|
+
token address is independently on-chain verified (see `src/tokens.ts`) —
|
|
377
|
+
none are copied from a third-party list without cross-checking.
|
|
378
|
+
|
|
379
|
+
## React hooks (`@pepu-chain/sdk/react`)
|
|
380
|
+
|
|
381
|
+
A separate subpath so the core package never needs React installed.
|
|
382
|
+
|
|
383
|
+
```ts
|
|
384
|
+
import { usePepuBalance, usePepuChain, useSponsorshipStatus } from "@pepu-chain/sdk/react";
|
|
385
|
+
|
|
386
|
+
function Balance({ client, address }) {
|
|
387
|
+
const { data, isLoading, error, refetch } = usePepuBalance(client, { address });
|
|
388
|
+
// ...
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
function ChainBadge({ chainId }) {
|
|
392
|
+
const { chain, isPepuChain } = usePepuChain(chainId);
|
|
393
|
+
// ...
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
function SponsorshipNotice() {
|
|
397
|
+
const { available, reason } = useSponsorshipStatus();
|
|
398
|
+
// `available` is always false today — see "Account abstraction" above.
|
|
399
|
+
}
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
Every hook takes its viem client (or nothing extra at all) as a parameter
|
|
403
|
+
rather than reaching for one via a context provider this package would have
|
|
404
|
+
to define — use whatever client your app already has.
|
|
405
|
+
|
|
406
|
+
## Privy, session-signer and paymaster helpers
|
|
407
|
+
|
|
408
|
+
Three small additions so apps stop re-implementing the same Privy and ERC-7677 plumbing. None of them depends on a Privy package, and none of them implies sponsorship is available to an app.
|
|
409
|
+
|
|
410
|
+
| Import | Export | Description |
|
|
411
|
+
|---|---|---|
|
|
412
|
+
| `@pepu-chain/sdk/privy` (client-safe) | `createPepuPrivyConfig(options?)` | The `config` for `<PrivyProvider>`: `defaultChain` and `supportedChains` set to PEPU mainnet only, `embeddedWallets.ethereum.createOnLogin` (default `"off"`), and Coinbase Wallet pinned to `eoaOnly` |
|
|
413
|
+
| `@pepu-chain/sdk/server` (server-only) | `buildSessionPolicy({ contractAddress, functions, expiresAtUnixSeconds, name? })` | The scoped Privy policy for a session signer: one `ALLOW` rule per function, each pinning contract, function, zero value and expiry, on `eth_signTransaction`. Throws rather than build an unscoped policy |
|
|
414
|
+
| | `PRIVY_POLICY_NAME_MAX_LENGTH` (`49`), `assertWithinPolicyNameLimit(value, field)` | Privy rejects policy and rule names of 50 characters or more; the guard fails loudly at build time |
|
|
415
|
+
| | `signAndBroadcast({ client, from, to, data \| abi + functionName, chainId, sign })` | Resolves nonce, gas (+20%) and gas price against PEPU's RPC, hands the unsigned legacy transaction to your `sign` callback (Privy `eth_signTransaction`), broadcasts, returns the hash |
|
|
416
|
+
| | `broadcastSignedTransaction(client, signed)` | Broadcast a raw signed transaction (hex or `{ signed_transaction }`) and return the hash |
|
|
417
|
+
| `@pepu-chain/sdk` | `buildPaymasterContext(entries?)`, `buildPaymasterStubDataRequest(options)`, `buildPaymasterDataRequest(options)` | ERC-7677 request builders defaulting to chain 97741 and EntryPoint v0.7 |
|
|
418
|
+
| | `Erc7677UserOperation`, `PaymasterStubDataRequest`, `PaymasterDataRequest`, `PaymasterStubDataResult`, `PaymasterDataResult`, `PaymasterRpcResponse`, `PaymasterRpcError`, `PaymasterContext` | ERC-7677 request and response types |
|
|
419
|
+
|
|
420
|
+
```tsx
|
|
421
|
+
// Client: app/providers.tsx
|
|
422
|
+
import { createPepuPrivyConfig } from "@pepu-chain/sdk/privy";
|
|
423
|
+
|
|
424
|
+
const privyConfig = createPepuPrivyConfig({ loginMethods: ["email", "google", "wallet"] });
|
|
425
|
+
```
|
|
426
|
+
|
|
427
|
+
```ts
|
|
428
|
+
// Server: an authenticated route, never client code
|
|
429
|
+
import { buildSessionPolicy, signAndBroadcast } from "@pepu-chain/sdk/server";
|
|
430
|
+
|
|
431
|
+
const policy = buildSessionPolicy({
|
|
432
|
+
contractAddress,
|
|
433
|
+
functions: [tapAbiFragment],
|
|
434
|
+
expiresAtUnixSeconds: Math.floor(Date.now() / 1000) + 15 * 60,
|
|
435
|
+
});
|
|
436
|
+
|
|
437
|
+
const hash = await signAndBroadcast({
|
|
438
|
+
client: publicClient,
|
|
439
|
+
from: wallet.address,
|
|
440
|
+
to: contractAddress,
|
|
441
|
+
data,
|
|
442
|
+
chainId: 97741,
|
|
443
|
+
sign: (transaction) =>
|
|
444
|
+
privy.wallets().ethereum().signTransaction(wallet.id, {
|
|
445
|
+
params: { transaction },
|
|
446
|
+
authorization_context: { authorization_private_keys: [privyAuthorizationKey] },
|
|
447
|
+
}),
|
|
448
|
+
});
|
|
449
|
+
```
|
|
450
|
+
|
|
451
|
+
The session policy is enforced by Privy's backend engine, not on-chain, and the user still pays gas. See [Session Keys](https://guide.pepeunchained.com/onboarding/session-keys) and [Sign with Privy, Broadcast Yourself](https://guide.pepeunchained.com/recipes/sign-with-privy-broadcast-yourself).
|
|
452
|
+
|
|
453
|
+
## Additions for app templates
|
|
454
|
+
|
|
455
|
+
All additive; nothing here changes an existing signature.
|
|
456
|
+
|
|
457
|
+
| Import | Export | What it does |
|
|
458
|
+
|---|---|---|
|
|
459
|
+
| `@pepu-chain/sdk` | `formatUnitsCompact(value, decimals, maxFractionDigits = 4)` | Short decimal string for any token's decimals (truncates, trims zeros). `formatPepu` is the 18-decimals PEPU one |
|
|
460
|
+
| `@pepu-chain/sdk` | `erc20Abi`, `erc721Abi` | viem's standard ABIs, re-exported from the abi module so apps import every ABI from one place |
|
|
461
|
+
| `/privy/react` | `<WalletGate loading error stalled>` | Render props for all three states: `loading` (node), `error(e, retry)`, `stalled(address, reload)`. Use it directly with your own markup |
|
|
462
|
+
| `/session/react` | `useSessionStatus().loading` | `true` until the first status response lands, so the consent screen does not flash on reload |
|
|
463
|
+
| `/combo/react` | `useSponsoredSession().statusLoading` | Same for the combo flow. `phase` stays `ready` while it is `true` |
|
|
464
|
+
| `/combo`, `/combo/react` | `SponsoredActResult` (type) | Response body of the combo `act` route. `useSponsoredSession<undefined, SponsoredActResult>()` |
|
|
465
|
+
| `/combo` | `resolveSessionMinutes` | Same session-length rule the routes use (`SESSION_DURATION_MINUTES`, default 15, clamped 1..1440) |
|
|
466
|
+
| `/aa/react` | `usePepuSmartAccount()` | Falls back to `useSmartWallets().getClientForChain({ id: 97741 })` while `client` is unset. Never loads `@zerodev/*`; needs `permissionless` |
|
|
467
|
+
| `/aa/react-direct` | `useDirectSponsoredSend`, `useDirectSmartAccount` | The direct transport (your own bundler and paymaster) split out of `/aa/react` so that entry never references ZeroDev. Needs `@zerodev/sdk` and `@zerodev/ecdsa-validator` |
|
|
468
|
+
| `/session/server`, `/combo` | `createSessionRoutes`, `createSessionActionRoute`, `createSponsoredSessionRoutes` | An empty or undefined contract address (an unset env variable) no longer throws at module load: every route answers `CONFIG_MISSING_ENV` as JSON at request time. Name the variable with `contractAddressEnv` (`targetEnv` in the combo scope). A non-empty malformed address still throws at creation |
|
|
469
|
+
| `/session`, `/session/kernel` | `describeKernelSessionScope`, `isCallInScope`, `parseApproval`, `checkApproval`, scope types | Pure helpers in `session/scope.ts`. Import them from `/session` to avoid the `@zerodev/*` peers; `/session/kernel` re-exports them |
|
|
470
|
+
| `/aa`, `/aa/kernel` | `encodeKernelExecute(calls)` | Pure ERC-7579 `execute` callData for a Kernel v3 UserOperation (single mode for one call, batch for several), no live account needed |
|
|
471
|
+
| `/aa`, `/aa/kernel` | `userOpEventsFromReceipt(receipt)` | Every `UserOperationEvent` in a receipt, without knowing the sender. `userOpEventFromReceipt` finds one sender's |
|
|
472
|
+
|
|
473
|
+
```tsx
|
|
474
|
+
<WalletGate
|
|
475
|
+
loading={<Spinner />}
|
|
476
|
+
error={(e, retry) => <button onClick={retry}>{e.message}</button>}
|
|
477
|
+
stalled={(address, reload) => <button onClick={reload}>Reload ({address})</button>}
|
|
478
|
+
>
|
|
479
|
+
<App />
|
|
480
|
+
</WalletGate>
|
|
481
|
+
```
|
|
482
|
+
|
|
483
|
+
## Public API
|
|
484
|
+
|
|
485
|
+
Named exports only — there is no default export, in either entry point.
|
|
486
|
+
|
|
487
|
+
### `@pepu-chain/sdk`
|
|
488
|
+
|
|
489
|
+
| Export | Kind | Description |
|
|
490
|
+
| --- | --- | --- |
|
|
491
|
+
| `pepuMainnet` / `pepuTestnet` | value | viem `Chain` objects for `97741` / `97740` |
|
|
492
|
+
| `pepuChains` | value | `[pepuMainnet, pepuTestnet]` |
|
|
493
|
+
| `PepuChain` / `PepuChainId` | type | Chain object / id union |
|
|
494
|
+
| `isPepuChain(chainId)` | function | Type guard: is this one of PEPU's chain ids? |
|
|
495
|
+
| `toAddEthereumChainParameter(chain)` | function | Build a `wallet_addEthereumChain` parameter object |
|
|
496
|
+
| `switchOrAddPepuChain(provider, chain)` | function | Switch an EIP-1193 provider to `chain`, adding it first if needed |
|
|
497
|
+
| `pepuContracts` | value | Chain-infrastructure contract registry, keyed by chain id |
|
|
498
|
+
| `getContract` / `listContracts` / `isDeployed` | function | Registry lookup / list / type-narrow |
|
|
499
|
+
| `PepuContractName` / `ContractEntry` / `DeployedContract` / `PendingContract` / `PepuContractRegistry` | type | Registry shapes |
|
|
500
|
+
| `pepuSwapContracts` | value | PepuSwap (DEX) contract registry, keyed by chain id |
|
|
501
|
+
| `getPepuSwapContract` / `listPepuSwapContracts` | function | PepuSwap registry lookup / list |
|
|
502
|
+
| `PepuSwapContractName` | type | Union of PepuSwap registry keys |
|
|
503
|
+
| `wpepuAbi`, `pepuSwapV3FactoryAbi`, `pepuSwapV3PoolAbi`, `pepuSwapRouterAbi`, `pepuSwapQuoterAbi`, `pepuSwapPositionManagerAbi`, `pepuSwapTickLensAbi`, `pepuSwapUniversalRouterAbi`, `pepuSwapPermit2Abi`, `pepuSwapMulticallAbi` | value | Verified PepuSwap/WPEPU ABI subsets |
|
|
504
|
+
| `arbGasInfoAbi` / `ARB_GAS_INFO_ADDRESS` | value | Arbitrum `ArbGasInfo` precompile ABI/address |
|
|
505
|
+
| `entryPointV07Abi` | value | ERC-4337 EntryPoint v0.7 deposit/nonce ABI subset |
|
|
506
|
+
| `kernelFactoryAbi` / `KERNEL_V3_1_IMPLEMENTATION_ADDRESS` | value | Kernel v3 factory ABI / verified implementation address |
|
|
507
|
+
| `kernelEcdsaValidatorAbi` / `ERC7579_MODULE_TYPE` | value | Kernel ECDSA validator ABI / ERC-7579 module type ids |
|
|
508
|
+
| `pepuTokenList` | value | Uniswap-schema token list |
|
|
509
|
+
| `PepuTokenList` / `PepuTokenInfo` | type | Token list shapes |
|
|
510
|
+
| `getPublicClient(chain, options?)` | function | Configured viem `PublicClient` |
|
|
511
|
+
| `explorerUrl(chain, type, value)` / `txUrl` / `addressUrl` / `tokenUrl` / `blockUrl` | function | Build Blockscout URLs |
|
|
512
|
+
| `ExplorerResourceType` | type | `"tx" \| "address" \| "token" \| "block"` |
|
|
513
|
+
| `createPepuscanClient(chain)` | function | Minimal pepuscan (Blockscout) client — verified-ABI + token-metadata reads |
|
|
514
|
+
| `PepuscanClient` / `PepuscanTokenMetadata` | type | pepuscan client shapes |
|
|
515
|
+
| `getNitroFeeBreakdown(client)` | function | Live L2/L1 fee components from `ArbGasInfo` |
|
|
516
|
+
| `explainDualFeeModel()` | function | Plain-English explanation of Nitro's dual-fee model |
|
|
517
|
+
| `estimateTransactionCost(client, request)` | function | Estimate a transaction's PEPU cost |
|
|
518
|
+
| `formatPepu(wei, options?)` / `formatPepuGasPrice(weiPerGas)` | function | PEPU-appropriate amount/gas-price formatting |
|
|
519
|
+
| `maxSendableAmount(options)` | function | Largest amount sendable from a balance after gas + safety margin |
|
|
520
|
+
| `DEFAULT_MAX_SEND_MARGIN_BPS` | value | Default safety margin `maxSendableAmount` applies (2000 = 20%) |
|
|
521
|
+
| `NitroFeeBreakdown` / `DualFeeModelExplanation` / `TransactionCostEstimate` / `FormatPepuOptions` / `MaxSendableAmountOptions` / `MaxSendableAmountResult` | type | Gas module shapes |
|
|
522
|
+
| `getPepuKernelStack(chainId)` | function | The 5 AA contracts, grouped, `undefined` unless all deployed |
|
|
523
|
+
| `getKernelAccountAddress(client, factory, args)` | function | Thin pass-through to the Kernel factory's `getAddress` |
|
|
524
|
+
| `getSponsorshipStatus(options?)` | function | Always-honest gas-sponsorship availability check |
|
|
525
|
+
| `PepuKernelStack` / `SponsorshipStatus` / `GetSponsorshipStatusOptions` | type | AA module shapes |
|
|
526
|
+
| `buildPaymasterContext(entries?)` / `buildPaymasterStubDataRequest(options)` / `buildPaymasterDataRequest(options)` | function | ERC-7677 context and JSON-RPC request builders (chain 97741, EntryPoint v0.7 by default) |
|
|
527
|
+
| `Erc7677UserOperation` / `PaymasterStubDataRequest` / `PaymasterDataRequest` / `PaymasterStubDataResult` / `PaymasterDataResult` / `PaymasterRpcResponse` / `PaymasterRpcError` / `PaymasterRpcParams` / `PaymasterContext` / `BuildPaymasterRequestOptions` | type | ERC-7677 types |
|
|
528
|
+
|
|
529
|
+
### `@pepu-chain/sdk/react` (requires `react` installed)
|
|
530
|
+
|
|
531
|
+
| Export | Kind | Description |
|
|
532
|
+
| --- | --- | --- |
|
|
533
|
+
| `usePepuBalance(client, options)` | hook | Read (and optionally poll) a native or ERC-20 balance |
|
|
534
|
+
| `usePepuChain(chainId)` | hook | Resolve a raw chain id to its `PepuChain`, if it's one of PEPU's |
|
|
535
|
+
| `useSponsorshipStatus(options?)` | hook | React wrapper around `getSponsorshipStatus` |
|
|
536
|
+
| `UsePepuBalanceOptions` / `UsePepuBalanceResult` / `UsePepuChainResult` | type | Hook option/result shapes |
|
|
537
|
+
|
|
538
|
+
### `@pepu-chain/sdk/privy` (client-safe, no Privy dependency)
|
|
539
|
+
|
|
540
|
+
| Export | Kind | Description |
|
|
541
|
+
| --- | --- | --- |
|
|
542
|
+
| `createPepuPrivyConfig(options?)` | function | `<PrivyProvider>` config: PEPU mainnet only, `createOnLogin` (default `"off"`), Coinbase `eoaOnly` |
|
|
543
|
+
| `PepuPrivyClientConfig` / `CreatePepuPrivyConfigOptions` / `PrivyLoginMethod` / `EmbeddedWalletCreateOnLogin` | type | Config shapes |
|
|
544
|
+
|
|
545
|
+
### `@pepu-chain/sdk/server` (server-only: keep out of client bundles)
|
|
546
|
+
|
|
547
|
+
| Export | Kind | Description |
|
|
548
|
+
| --- | --- | --- |
|
|
549
|
+
| `buildSessionPolicy(params)` | function | Scoped Privy session-signer policy (contract, function(s), zero value, expiry); refuses an unscoped policy |
|
|
550
|
+
| `PRIVY_POLICY_NAME_MAX_LENGTH` / `assertWithinPolicyNameLimit(value, field)` | value / function | Privy name limit (49) and its guard |
|
|
551
|
+
| `signAndBroadcast(params)` | function | Resolve fields, sign via your `sign` callback, broadcast, return the hash |
|
|
552
|
+
| `broadcastSignedTransaction(client, signed)` | function | Broadcast a raw signed transaction, return the hash |
|
|
553
|
+
| `withGasLimitBuffer(gas)` | function | Gas estimate plus 20% |
|
|
554
|
+
| `SessionPolicy` / `SessionPolicyRule` / `SessionPolicyCondition` / `BuildSessionPolicyParams` / `PrivyUnsignedTransaction` / `SignedTransactionLike` / `BroadcastClient` / `SignAndBroadcastClient` / `SignAndBroadcastParams` | type | Server helper shapes |
|
|
555
|
+
|
|
556
|
+
## Known gaps
|
|
557
|
+
|
|
558
|
+
Deliberate omissions, not oversights — each is tracked so it can be filled
|
|
559
|
+
in later without a breaking change.
|
|
560
|
+
|
|
561
|
+
- **Sponsorship needs a project.** The hosted bundler and paymaster service are
|
|
562
|
+
live and the v2 paymaster is a canary (external audit pending), but every
|
|
563
|
+
ERC-7677 URL embeds a project token and there is no tokenless default.
|
|
564
|
+
`getSponsorshipStatus()` / `useSponsorshipStatus()` are deprecated and
|
|
565
|
+
always report `available: false`; use `checkSponsorship()` /
|
|
566
|
+
`usePepuSponsorship()` for the live answer.
|
|
567
|
+
- **Testnet (97740) is out of scope.** No faucet exists to fund
|
|
568
|
+
verification there, so every `pepuContracts` entry beyond
|
|
569
|
+
`create2Factory` stays `status: "pending"`, there's no PepuSwap
|
|
570
|
+
deployment, no Blockscout explorer, and no verified token addresses.
|
|
571
|
+
Don't "fix" this by copying mainnet's entries onto testnet.
|
|
572
|
+
- **`multicall3` and the DEX's `multicallNonCanonical`/`permit2NonCanonical`
|
|
573
|
+
are deliberately not at their "canonical" addresses.** See the Contract
|
|
574
|
+
registry and PepuSwap sections above — this is a real, verified fact
|
|
575
|
+
about this chain, not a placeholder.
|
|
576
|
+
- **`v3Migrator` and `v3Staker` have verified addresses but no dedicated
|
|
577
|
+
ABI** in `./abi/` — only enough getters were checked to confirm the
|
|
578
|
+
address, not their full interface.
|
|
579
|
+
- **Kernel account creation (`initialize()` calldata encoding) is not
|
|
580
|
+
implemented here.** No account has ever been created through PEPU's
|
|
581
|
+
Kernel factory, so there was nothing on-chain to check a hand-rolled
|
|
582
|
+
encoding against — use `@zerodev/sdk` to build that payload, then pass it
|
|
583
|
+
to `getKernelAccountAddress`.
|
|
584
|
+
- **The token list has four tokens (WPEPU, USDT, USDC and WETH on mainnet).** Every
|
|
585
|
+
entry is independently on-chain verified; no other token address cleared
|
|
586
|
+
that bar at the time this package was written.
|
|
587
|
+
|
|
588
|
+
## Development
|
|
589
|
+
|
|
590
|
+
See [AGENTS.md](./AGENTS.md) for how to build, test, and extend this
|
|
591
|
+
package.
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/* @pepu-chain/peer-guard */(function(){var p=["@zerodev/sdk","@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/aa/kernel needs peer packages that are not installed: @zerodev/sdk @zerodev/ecdsa-validator. Install with: npm i @zerodev/sdk @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 chunkNVOPDXTA_cjs = require('../chunk-NVOPDXTA.cjs');
|
|
5
|
+
require('../chunk-7MNJF2OB.cjs');
|
|
6
|
+
var chunkAJS4UFQX_cjs = require('../chunk-AJS4UFQX.cjs');
|
|
7
|
+
require('../chunk-A5LP2UCS.cjs');
|
|
8
|
+
require('../chunk-WANILJZQ.cjs');
|
|
9
|
+
require('../chunk-4GINFJO6.cjs');
|
|
10
|
+
require('../chunk-VF3D6KLQ.cjs');
|
|
11
|
+
require('../chunk-DPCZJLB3.cjs');
|
|
12
|
+
require('../chunk-YQL7NISX.cjs');
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
Object.defineProperty(exports, "KERNEL_VERSION", {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function () { return chunkNVOPDXTA_cjs.KERNEL_VERSION; }
|
|
19
|
+
});
|
|
20
|
+
Object.defineProperty(exports, "createPepuSponsoredClient", {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: function () { return chunkNVOPDXTA_cjs.createPepuSponsoredClient; }
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "getKernelAddress", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () { return chunkNVOPDXTA_cjs.getKernelAddress; }
|
|
27
|
+
});
|
|
28
|
+
Object.defineProperty(exports, "sendSponsored", {
|
|
29
|
+
enumerable: true,
|
|
30
|
+
get: function () { return chunkNVOPDXTA_cjs.sendSponsored; }
|
|
31
|
+
});
|
|
32
|
+
Object.defineProperty(exports, "toPepuKernelAccount", {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function () { return chunkNVOPDXTA_cjs.toPepuKernelAccount; }
|
|
35
|
+
});
|
|
36
|
+
Object.defineProperty(exports, "encodeKernelExecute", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function () { return chunkAJS4UFQX_cjs.encodeKernelExecute; }
|
|
39
|
+
});
|
|
40
|
+
//# sourceMappingURL=kernel.cjs.map
|
|
41
|
+
//# sourceMappingURL=kernel.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"kernel.cjs"}
|