@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
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { Address, Hex } from 'viem';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* ERC-7677 paymaster web-service types, for the two JSON-RPC methods PEPU's
|
|
5
|
+
* paymaster policy service implements: `pm_getPaymasterStubData` and
|
|
6
|
+
* `pm_getPaymasterData`. See https://eips.ethereum.org/EIPS/eip-7677.
|
|
7
|
+
*
|
|
8
|
+
* Pure types plus a few tiny builders: no network, no secrets, safe in a
|
|
9
|
+
* browser bundle. Quantities are `0x`-prefixed hex strings, as on the wire.
|
|
10
|
+
*
|
|
11
|
+
* Note this package never implies sponsorship is available to an app: see
|
|
12
|
+
* `getSponsorshipStatus()`. These types describe the protocol only.
|
|
13
|
+
*/
|
|
14
|
+
/** An ERC-4337 v0.7 UserOperation in its unpacked JSON-RPC shape. */
|
|
15
|
+
interface Erc7677UserOperation {
|
|
16
|
+
sender: Address;
|
|
17
|
+
nonce: Hex;
|
|
18
|
+
factory?: Address;
|
|
19
|
+
factoryData?: Hex;
|
|
20
|
+
callData: Hex;
|
|
21
|
+
callGasLimit: Hex;
|
|
22
|
+
verificationGasLimit: Hex;
|
|
23
|
+
preVerificationGas: Hex;
|
|
24
|
+
maxFeePerGas: Hex;
|
|
25
|
+
maxPriorityFeePerGas: Hex;
|
|
26
|
+
paymaster?: Address;
|
|
27
|
+
paymasterVerificationGasLimit?: Hex;
|
|
28
|
+
paymasterPostOpGasLimit?: Hex;
|
|
29
|
+
paymasterData?: Hex;
|
|
30
|
+
signature: Hex;
|
|
31
|
+
}
|
|
32
|
+
/** Paymaster-defined, JSON-serializable context (params[3]). */
|
|
33
|
+
type PaymasterContext = Record<string, unknown>;
|
|
34
|
+
type PaymasterRpcParams = readonly [
|
|
35
|
+
userOperation: Partial<Erc7677UserOperation> & Pick<Erc7677UserOperation, "sender" | "callData">,
|
|
36
|
+
entryPoint: Address,
|
|
37
|
+
chainId: Hex,
|
|
38
|
+
context?: PaymasterContext
|
|
39
|
+
];
|
|
40
|
+
interface PaymasterStubDataRequest {
|
|
41
|
+
jsonrpc: "2.0";
|
|
42
|
+
id: number | string;
|
|
43
|
+
method: "pm_getPaymasterStubData";
|
|
44
|
+
params: PaymasterRpcParams;
|
|
45
|
+
}
|
|
46
|
+
interface PaymasterDataRequest {
|
|
47
|
+
jsonrpc: "2.0";
|
|
48
|
+
id: number | string;
|
|
49
|
+
method: "pm_getPaymasterData";
|
|
50
|
+
params: PaymasterRpcParams;
|
|
51
|
+
}
|
|
52
|
+
/** Result of `pm_getPaymasterStubData`. Stub values are for gas estimation only. */
|
|
53
|
+
interface PaymasterStubDataResult {
|
|
54
|
+
paymaster: Address;
|
|
55
|
+
paymasterData: Hex;
|
|
56
|
+
paymasterVerificationGasLimit?: Hex;
|
|
57
|
+
paymasterPostOpGasLimit?: Hex;
|
|
58
|
+
/** `true` when the stub values are also the final values. */
|
|
59
|
+
isFinal?: boolean;
|
|
60
|
+
sponsor?: {
|
|
61
|
+
name: string;
|
|
62
|
+
icon?: string;
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
/** Result of `pm_getPaymasterData`: the signed values to submit. */
|
|
66
|
+
interface PaymasterDataResult {
|
|
67
|
+
paymaster: Address;
|
|
68
|
+
paymasterData: Hex;
|
|
69
|
+
paymasterVerificationGasLimit?: Hex;
|
|
70
|
+
paymasterPostOpGasLimit?: Hex;
|
|
71
|
+
}
|
|
72
|
+
interface PaymasterRpcError {
|
|
73
|
+
code: number;
|
|
74
|
+
message: string;
|
|
75
|
+
/** PEPU's policy service puts the machine-readable denial reason in `data.reason`. */
|
|
76
|
+
data?: {
|
|
77
|
+
reason?: string;
|
|
78
|
+
} & Record<string, unknown>;
|
|
79
|
+
}
|
|
80
|
+
type PaymasterRpcResponse<TResult> = {
|
|
81
|
+
jsonrpc: "2.0";
|
|
82
|
+
id: number | string | null;
|
|
83
|
+
result: TResult;
|
|
84
|
+
} | {
|
|
85
|
+
jsonrpc: "2.0";
|
|
86
|
+
id: number | string | null;
|
|
87
|
+
error: PaymasterRpcError;
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* Build a paymaster `context` object: drops `undefined` entries and throws on
|
|
91
|
+
* anything that would not survive `JSON.stringify` (bigint, function, symbol),
|
|
92
|
+
* so a bad value fails here instead of as an opaque RPC error. Returns `{}`
|
|
93
|
+
* for no input. The context is paymaster-defined; PEPU's policy service
|
|
94
|
+
* currently accepts and ignores it.
|
|
95
|
+
*/
|
|
96
|
+
declare function buildPaymasterContext(entries?: Readonly<Record<string, unknown>>): PaymasterContext;
|
|
97
|
+
interface BuildPaymasterRequestOptions {
|
|
98
|
+
userOperation: PaymasterRpcParams[0];
|
|
99
|
+
/** Defaults to PEPU mainnet's EntryPoint v0.7. */
|
|
100
|
+
entryPoint?: Address;
|
|
101
|
+
/** Defaults to 97741 (PEPU mainnet). */
|
|
102
|
+
chainId?: number;
|
|
103
|
+
context?: PaymasterContext;
|
|
104
|
+
id?: number | string;
|
|
105
|
+
}
|
|
106
|
+
/** Build a `pm_getPaymasterStubData` JSON-RPC request body. */
|
|
107
|
+
declare function buildPaymasterStubDataRequest(options: BuildPaymasterRequestOptions): PaymasterStubDataRequest;
|
|
108
|
+
/** Build a `pm_getPaymasterData` JSON-RPC request body. */
|
|
109
|
+
declare function buildPaymasterDataRequest(options: BuildPaymasterRequestOptions): PaymasterDataRequest;
|
|
110
|
+
|
|
111
|
+
export { type BuildPaymasterRequestOptions as B, type Erc7677UserOperation as E, type PaymasterContext as P, type PaymasterDataRequest as a, type PaymasterDataResult as b, type PaymasterRpcError as c, type PaymasterRpcParams as d, type PaymasterRpcResponse as e, type PaymasterStubDataRequest as f, type PaymasterStubDataResult as g, buildPaymasterContext as h, buildPaymasterDataRequest as i, buildPaymasterStubDataRequest as j };
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { Address, Hex } from 'viem';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* ERC-7677 paymaster web-service types, for the two JSON-RPC methods PEPU's
|
|
5
|
+
* paymaster policy service implements: `pm_getPaymasterStubData` and
|
|
6
|
+
* `pm_getPaymasterData`. See https://eips.ethereum.org/EIPS/eip-7677.
|
|
7
|
+
*
|
|
8
|
+
* Pure types plus a few tiny builders: no network, no secrets, safe in a
|
|
9
|
+
* browser bundle. Quantities are `0x`-prefixed hex strings, as on the wire.
|
|
10
|
+
*
|
|
11
|
+
* Note this package never implies sponsorship is available to an app: see
|
|
12
|
+
* `getSponsorshipStatus()`. These types describe the protocol only.
|
|
13
|
+
*/
|
|
14
|
+
/** An ERC-4337 v0.7 UserOperation in its unpacked JSON-RPC shape. */
|
|
15
|
+
interface Erc7677UserOperation {
|
|
16
|
+
sender: Address;
|
|
17
|
+
nonce: Hex;
|
|
18
|
+
factory?: Address;
|
|
19
|
+
factoryData?: Hex;
|
|
20
|
+
callData: Hex;
|
|
21
|
+
callGasLimit: Hex;
|
|
22
|
+
verificationGasLimit: Hex;
|
|
23
|
+
preVerificationGas: Hex;
|
|
24
|
+
maxFeePerGas: Hex;
|
|
25
|
+
maxPriorityFeePerGas: Hex;
|
|
26
|
+
paymaster?: Address;
|
|
27
|
+
paymasterVerificationGasLimit?: Hex;
|
|
28
|
+
paymasterPostOpGasLimit?: Hex;
|
|
29
|
+
paymasterData?: Hex;
|
|
30
|
+
signature: Hex;
|
|
31
|
+
}
|
|
32
|
+
/** Paymaster-defined, JSON-serializable context (params[3]). */
|
|
33
|
+
type PaymasterContext = Record<string, unknown>;
|
|
34
|
+
type PaymasterRpcParams = readonly [
|
|
35
|
+
userOperation: Partial<Erc7677UserOperation> & Pick<Erc7677UserOperation, "sender" | "callData">,
|
|
36
|
+
entryPoint: Address,
|
|
37
|
+
chainId: Hex,
|
|
38
|
+
context?: PaymasterContext
|
|
39
|
+
];
|
|
40
|
+
interface PaymasterStubDataRequest {
|
|
41
|
+
jsonrpc: "2.0";
|
|
42
|
+
id: number | string;
|
|
43
|
+
method: "pm_getPaymasterStubData";
|
|
44
|
+
params: PaymasterRpcParams;
|
|
45
|
+
}
|
|
46
|
+
interface PaymasterDataRequest {
|
|
47
|
+
jsonrpc: "2.0";
|
|
48
|
+
id: number | string;
|
|
49
|
+
method: "pm_getPaymasterData";
|
|
50
|
+
params: PaymasterRpcParams;
|
|
51
|
+
}
|
|
52
|
+
/** Result of `pm_getPaymasterStubData`. Stub values are for gas estimation only. */
|
|
53
|
+
interface PaymasterStubDataResult {
|
|
54
|
+
paymaster: Address;
|
|
55
|
+
paymasterData: Hex;
|
|
56
|
+
paymasterVerificationGasLimit?: Hex;
|
|
57
|
+
paymasterPostOpGasLimit?: Hex;
|
|
58
|
+
/** `true` when the stub values are also the final values. */
|
|
59
|
+
isFinal?: boolean;
|
|
60
|
+
sponsor?: {
|
|
61
|
+
name: string;
|
|
62
|
+
icon?: string;
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
/** Result of `pm_getPaymasterData`: the signed values to submit. */
|
|
66
|
+
interface PaymasterDataResult {
|
|
67
|
+
paymaster: Address;
|
|
68
|
+
paymasterData: Hex;
|
|
69
|
+
paymasterVerificationGasLimit?: Hex;
|
|
70
|
+
paymasterPostOpGasLimit?: Hex;
|
|
71
|
+
}
|
|
72
|
+
interface PaymasterRpcError {
|
|
73
|
+
code: number;
|
|
74
|
+
message: string;
|
|
75
|
+
/** PEPU's policy service puts the machine-readable denial reason in `data.reason`. */
|
|
76
|
+
data?: {
|
|
77
|
+
reason?: string;
|
|
78
|
+
} & Record<string, unknown>;
|
|
79
|
+
}
|
|
80
|
+
type PaymasterRpcResponse<TResult> = {
|
|
81
|
+
jsonrpc: "2.0";
|
|
82
|
+
id: number | string | null;
|
|
83
|
+
result: TResult;
|
|
84
|
+
} | {
|
|
85
|
+
jsonrpc: "2.0";
|
|
86
|
+
id: number | string | null;
|
|
87
|
+
error: PaymasterRpcError;
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* Build a paymaster `context` object: drops `undefined` entries and throws on
|
|
91
|
+
* anything that would not survive `JSON.stringify` (bigint, function, symbol),
|
|
92
|
+
* so a bad value fails here instead of as an opaque RPC error. Returns `{}`
|
|
93
|
+
* for no input. The context is paymaster-defined; PEPU's policy service
|
|
94
|
+
* currently accepts and ignores it.
|
|
95
|
+
*/
|
|
96
|
+
declare function buildPaymasterContext(entries?: Readonly<Record<string, unknown>>): PaymasterContext;
|
|
97
|
+
interface BuildPaymasterRequestOptions {
|
|
98
|
+
userOperation: PaymasterRpcParams[0];
|
|
99
|
+
/** Defaults to PEPU mainnet's EntryPoint v0.7. */
|
|
100
|
+
entryPoint?: Address;
|
|
101
|
+
/** Defaults to 97741 (PEPU mainnet). */
|
|
102
|
+
chainId?: number;
|
|
103
|
+
context?: PaymasterContext;
|
|
104
|
+
id?: number | string;
|
|
105
|
+
}
|
|
106
|
+
/** Build a `pm_getPaymasterStubData` JSON-RPC request body. */
|
|
107
|
+
declare function buildPaymasterStubDataRequest(options: BuildPaymasterRequestOptions): PaymasterStubDataRequest;
|
|
108
|
+
/** Build a `pm_getPaymasterData` JSON-RPC request body. */
|
|
109
|
+
declare function buildPaymasterDataRequest(options: BuildPaymasterRequestOptions): PaymasterDataRequest;
|
|
110
|
+
|
|
111
|
+
export { type BuildPaymasterRequestOptions as B, type Erc7677UserOperation as E, type PaymasterContext as P, type PaymasterDataRequest as a, type PaymasterDataResult as b, type PaymasterRpcError as c, type PaymasterRpcParams as d, type PaymasterRpcResponse as e, type PaymasterStubDataRequest as f, type PaymasterStubDataResult as g, buildPaymasterContext as h, buildPaymasterDataRequest as i, buildPaymasterStubDataRequest as j };
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { Hex } from 'viem';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The SDK error model. Everything the SDK throws is a {@link PepuError}
|
|
5
|
+
* subclass carrying a stable `code`, a one-sentence `hint` and a `docsUrl`.
|
|
6
|
+
* Messages never contain secrets: they name environment variables, never
|
|
7
|
+
* their values.
|
|
8
|
+
*/
|
|
9
|
+
declare const PEPU_ERRORS_DOCS_URL = "https://guide.pepeunchained.com/reference/errors";
|
|
10
|
+
type PepuErrorCode = "CONFIG_MISSING_ENV" | "CONFIG_BAD_URL" | "CONFIG_SERVER_ONLY" | "CONFIG_PRIVY_DASHBOARD" | "CONFIG_PRIVY_CREATE_ON_LOGIN" | "CONFIG_ORIGIN_MISMATCH" | "AUTH_INVALID_TOKEN" | "WALLET_NOT_PROVISIONED" | "WALLET_COINBASE_UNSUPPORTED_CHAIN" | "WALLET_INJECTED_ACTIVE" | "POLICY_UNSCOPED" | "POLICY_NAME_TOO_LONG" | "SESSION_EXPIRED" | "SESSION_NONE" | "SESSION_APPROVAL_MISMATCH" | "PRIVY_CHAIN_REJECTED_97741" | "PRIVY_KEY_QUORUM_MISMATCH" | "BUNDLER_UNREACHABLE" | "BUNDLER_AA_FAILED" | "PAYMASTER_DENIED" | "PAYMASTER_NO_BALANCE" | "PAYMASTER_CAP" | "PAYMASTER_ORIGIN_NOT_ALLOWED" | "PAYMASTER_DESTINATION_NOT_ALLOWED" | "PAYMASTER_PROJECT_NOT_CLAIMED" | "PAYMASTER_PROJECT_OWNER_CHANGED" | "PAYMASTER_PROJECT_PAUSED" | "PAYMASTER_IDENTITY_REQUIRED" | "PAYMASTER_FREE_TIER_UNAVAILABLE" | "PAYMASTER_RATE_LIMITED" | "PAYMASTER_SESSION_REQUIRED" | "PAYMASTER_API_ERROR" | "TX_REVERTED" | "TX_NONCE_RACE" | "TX_GAS_UNDERSHOOT" | "MULTICALL3_CANONICAL_ADDRESS" | "UNKNOWN";
|
|
11
|
+
interface ErrorCatalogEntry {
|
|
12
|
+
readonly code: PepuErrorCode;
|
|
13
|
+
readonly title: string;
|
|
14
|
+
/** What went wrong, in one or two sentences. */
|
|
15
|
+
readonly cause: string;
|
|
16
|
+
/** How to fix it. */
|
|
17
|
+
readonly fix: string;
|
|
18
|
+
/** Suggested HTTP status for route factories. */
|
|
19
|
+
readonly status: number;
|
|
20
|
+
readonly retryable: boolean;
|
|
21
|
+
/** Tested, in order, against the flattened error text. Empty for code-only entries. */
|
|
22
|
+
readonly matchers: readonly RegExp[];
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Single source for the SDK `explainError`, the MCP `pepu_explain_error` tool
|
|
26
|
+
* and the generated docs error page. ORDER MATTERS: the first entry whose
|
|
27
|
+
* matcher hits wins, so specific entries come before general ones.
|
|
28
|
+
*/
|
|
29
|
+
declare const PEPU_ERROR_CATALOG: readonly ErrorCatalogEntry[];
|
|
30
|
+
/** Look up a catalog entry by code. */
|
|
31
|
+
declare function getErrorEntry(code: PepuErrorCode): ErrorCatalogEntry;
|
|
32
|
+
/** `https://guide.pepeunchained.com/reference/errors#<CODE>` */
|
|
33
|
+
declare function errorDocsUrl(code: PepuErrorCode): string;
|
|
34
|
+
interface PepuErrorOptions {
|
|
35
|
+
hint?: string;
|
|
36
|
+
docsUrl?: string;
|
|
37
|
+
retryable?: boolean;
|
|
38
|
+
status?: number;
|
|
39
|
+
details?: unknown;
|
|
40
|
+
cause?: unknown;
|
|
41
|
+
}
|
|
42
|
+
declare class PepuError extends Error {
|
|
43
|
+
readonly code: PepuErrorCode;
|
|
44
|
+
readonly hint: string;
|
|
45
|
+
readonly docsUrl: string;
|
|
46
|
+
readonly retryable: boolean;
|
|
47
|
+
readonly status: number;
|
|
48
|
+
readonly details?: unknown;
|
|
49
|
+
constructor(code: PepuErrorCode, message?: string, options?: PepuErrorOptions);
|
|
50
|
+
}
|
|
51
|
+
/** Missing env, bad URL, dashboard misconfiguration. */
|
|
52
|
+
declare class PepuConfigError extends PepuError {
|
|
53
|
+
}
|
|
54
|
+
/** Bad or missing Privy token, wrong owner. */
|
|
55
|
+
declare class PepuAuthError extends PepuError {
|
|
56
|
+
}
|
|
57
|
+
/** Unscoped policy, name too long, expiry, denied by policy. */
|
|
58
|
+
declare class PepuPolicyError extends PepuError {
|
|
59
|
+
}
|
|
60
|
+
/** No session, expired, mismatched approval. */
|
|
61
|
+
declare class PepuSessionError extends PepuError {
|
|
62
|
+
}
|
|
63
|
+
/** AAxx, JSON-RPC errors, timeouts. */
|
|
64
|
+
declare class PepuBundlerError extends PepuError {
|
|
65
|
+
}
|
|
66
|
+
/** Reason codes, caps, balance, origin. */
|
|
67
|
+
declare class PepuPaymasterError extends PepuError {
|
|
68
|
+
}
|
|
69
|
+
/** Revert, nonce race, gas, rpc rate limit. */
|
|
70
|
+
declare class PepuChainError extends PepuError {
|
|
71
|
+
}
|
|
72
|
+
interface ErrorExplanation {
|
|
73
|
+
code: PepuErrorCode;
|
|
74
|
+
title: string;
|
|
75
|
+
cause: string;
|
|
76
|
+
fix: string;
|
|
77
|
+
docsUrl: string;
|
|
78
|
+
matched: "catalog" | "abi-decode" | "unknown";
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Explain an error, an error message, or raw revert data (`0x...`). Pure and
|
|
82
|
+
* synchronous; never throws.
|
|
83
|
+
*/
|
|
84
|
+
declare function explainError(e: unknown | string | Hex): ErrorExplanation;
|
|
85
|
+
/** Wrap anything thrown into a typed {@link PepuError}. PepuErrors pass through. */
|
|
86
|
+
declare function toPepuError(e: unknown, ctx?: {
|
|
87
|
+
op: string;
|
|
88
|
+
}): PepuError;
|
|
89
|
+
/** The `{ error: { code, message, hint } }` body route factories return. */
|
|
90
|
+
declare function toErrorBody(e: unknown): {
|
|
91
|
+
error: {
|
|
92
|
+
code: PepuErrorCode;
|
|
93
|
+
message: string;
|
|
94
|
+
hint: string;
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
/** A JSON `Response` with the error body and the status from the error model. */
|
|
98
|
+
declare function toErrorResponse(e: unknown): Response;
|
|
99
|
+
|
|
100
|
+
export { type ErrorCatalogEntry as E, PepuError as P, PepuBundlerError as a, PepuPaymasterError as b, type PepuErrorCode as c, type ErrorExplanation as d, PEPU_ERRORS_DOCS_URL as e, PEPU_ERROR_CATALOG as f, PepuAuthError as g, PepuChainError as h, PepuConfigError as i, type PepuErrorOptions as j, PepuPolicyError as k, PepuSessionError as l, errorDocsUrl as m, explainError as n, getErrorEntry as o, toErrorResponse as p, toPepuError as q, toErrorBody as t };
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { Hex } from 'viem';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The SDK error model. Everything the SDK throws is a {@link PepuError}
|
|
5
|
+
* subclass carrying a stable `code`, a one-sentence `hint` and a `docsUrl`.
|
|
6
|
+
* Messages never contain secrets: they name environment variables, never
|
|
7
|
+
* their values.
|
|
8
|
+
*/
|
|
9
|
+
declare const PEPU_ERRORS_DOCS_URL = "https://guide.pepeunchained.com/reference/errors";
|
|
10
|
+
type PepuErrorCode = "CONFIG_MISSING_ENV" | "CONFIG_BAD_URL" | "CONFIG_SERVER_ONLY" | "CONFIG_PRIVY_DASHBOARD" | "CONFIG_PRIVY_CREATE_ON_LOGIN" | "CONFIG_ORIGIN_MISMATCH" | "AUTH_INVALID_TOKEN" | "WALLET_NOT_PROVISIONED" | "WALLET_COINBASE_UNSUPPORTED_CHAIN" | "WALLET_INJECTED_ACTIVE" | "POLICY_UNSCOPED" | "POLICY_NAME_TOO_LONG" | "SESSION_EXPIRED" | "SESSION_NONE" | "SESSION_APPROVAL_MISMATCH" | "PRIVY_CHAIN_REJECTED_97741" | "PRIVY_KEY_QUORUM_MISMATCH" | "BUNDLER_UNREACHABLE" | "BUNDLER_AA_FAILED" | "PAYMASTER_DENIED" | "PAYMASTER_NO_BALANCE" | "PAYMASTER_CAP" | "PAYMASTER_ORIGIN_NOT_ALLOWED" | "PAYMASTER_DESTINATION_NOT_ALLOWED" | "PAYMASTER_PROJECT_NOT_CLAIMED" | "PAYMASTER_PROJECT_OWNER_CHANGED" | "PAYMASTER_PROJECT_PAUSED" | "PAYMASTER_IDENTITY_REQUIRED" | "PAYMASTER_FREE_TIER_UNAVAILABLE" | "PAYMASTER_RATE_LIMITED" | "PAYMASTER_SESSION_REQUIRED" | "PAYMASTER_API_ERROR" | "TX_REVERTED" | "TX_NONCE_RACE" | "TX_GAS_UNDERSHOOT" | "MULTICALL3_CANONICAL_ADDRESS" | "UNKNOWN";
|
|
11
|
+
interface ErrorCatalogEntry {
|
|
12
|
+
readonly code: PepuErrorCode;
|
|
13
|
+
readonly title: string;
|
|
14
|
+
/** What went wrong, in one or two sentences. */
|
|
15
|
+
readonly cause: string;
|
|
16
|
+
/** How to fix it. */
|
|
17
|
+
readonly fix: string;
|
|
18
|
+
/** Suggested HTTP status for route factories. */
|
|
19
|
+
readonly status: number;
|
|
20
|
+
readonly retryable: boolean;
|
|
21
|
+
/** Tested, in order, against the flattened error text. Empty for code-only entries. */
|
|
22
|
+
readonly matchers: readonly RegExp[];
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Single source for the SDK `explainError`, the MCP `pepu_explain_error` tool
|
|
26
|
+
* and the generated docs error page. ORDER MATTERS: the first entry whose
|
|
27
|
+
* matcher hits wins, so specific entries come before general ones.
|
|
28
|
+
*/
|
|
29
|
+
declare const PEPU_ERROR_CATALOG: readonly ErrorCatalogEntry[];
|
|
30
|
+
/** Look up a catalog entry by code. */
|
|
31
|
+
declare function getErrorEntry(code: PepuErrorCode): ErrorCatalogEntry;
|
|
32
|
+
/** `https://guide.pepeunchained.com/reference/errors#<CODE>` */
|
|
33
|
+
declare function errorDocsUrl(code: PepuErrorCode): string;
|
|
34
|
+
interface PepuErrorOptions {
|
|
35
|
+
hint?: string;
|
|
36
|
+
docsUrl?: string;
|
|
37
|
+
retryable?: boolean;
|
|
38
|
+
status?: number;
|
|
39
|
+
details?: unknown;
|
|
40
|
+
cause?: unknown;
|
|
41
|
+
}
|
|
42
|
+
declare class PepuError extends Error {
|
|
43
|
+
readonly code: PepuErrorCode;
|
|
44
|
+
readonly hint: string;
|
|
45
|
+
readonly docsUrl: string;
|
|
46
|
+
readonly retryable: boolean;
|
|
47
|
+
readonly status: number;
|
|
48
|
+
readonly details?: unknown;
|
|
49
|
+
constructor(code: PepuErrorCode, message?: string, options?: PepuErrorOptions);
|
|
50
|
+
}
|
|
51
|
+
/** Missing env, bad URL, dashboard misconfiguration. */
|
|
52
|
+
declare class PepuConfigError extends PepuError {
|
|
53
|
+
}
|
|
54
|
+
/** Bad or missing Privy token, wrong owner. */
|
|
55
|
+
declare class PepuAuthError extends PepuError {
|
|
56
|
+
}
|
|
57
|
+
/** Unscoped policy, name too long, expiry, denied by policy. */
|
|
58
|
+
declare class PepuPolicyError extends PepuError {
|
|
59
|
+
}
|
|
60
|
+
/** No session, expired, mismatched approval. */
|
|
61
|
+
declare class PepuSessionError extends PepuError {
|
|
62
|
+
}
|
|
63
|
+
/** AAxx, JSON-RPC errors, timeouts. */
|
|
64
|
+
declare class PepuBundlerError extends PepuError {
|
|
65
|
+
}
|
|
66
|
+
/** Reason codes, caps, balance, origin. */
|
|
67
|
+
declare class PepuPaymasterError extends PepuError {
|
|
68
|
+
}
|
|
69
|
+
/** Revert, nonce race, gas, rpc rate limit. */
|
|
70
|
+
declare class PepuChainError extends PepuError {
|
|
71
|
+
}
|
|
72
|
+
interface ErrorExplanation {
|
|
73
|
+
code: PepuErrorCode;
|
|
74
|
+
title: string;
|
|
75
|
+
cause: string;
|
|
76
|
+
fix: string;
|
|
77
|
+
docsUrl: string;
|
|
78
|
+
matched: "catalog" | "abi-decode" | "unknown";
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Explain an error, an error message, or raw revert data (`0x...`). Pure and
|
|
82
|
+
* synchronous; never throws.
|
|
83
|
+
*/
|
|
84
|
+
declare function explainError(e: unknown | string | Hex): ErrorExplanation;
|
|
85
|
+
/** Wrap anything thrown into a typed {@link PepuError}. PepuErrors pass through. */
|
|
86
|
+
declare function toPepuError(e: unknown, ctx?: {
|
|
87
|
+
op: string;
|
|
88
|
+
}): PepuError;
|
|
89
|
+
/** The `{ error: { code, message, hint } }` body route factories return. */
|
|
90
|
+
declare function toErrorBody(e: unknown): {
|
|
91
|
+
error: {
|
|
92
|
+
code: PepuErrorCode;
|
|
93
|
+
message: string;
|
|
94
|
+
hint: string;
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
/** A JSON `Response` with the error body and the status from the error model. */
|
|
98
|
+
declare function toErrorResponse(e: unknown): Response;
|
|
99
|
+
|
|
100
|
+
export { type ErrorCatalogEntry as E, PepuError as P, PepuBundlerError as a, PepuPaymasterError as b, type PepuErrorCode as c, type ErrorExplanation as d, PEPU_ERRORS_DOCS_URL as e, PEPU_ERROR_CATALOG as f, PepuAuthError as g, PepuChainError as h, PepuConfigError as i, type PepuErrorOptions as j, PepuPolicyError as k, PepuSessionError as l, errorDocsUrl as m, explainError as n, getErrorEntry as o, toErrorResponse as p, toPepuError as q, toErrorBody as t };
|