@pafi-dev/core 0.18.0 → 0.20.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 (57) hide show
  1. package/README.md +55 -10
  2. package/dist/abi/index.cjs +14 -4
  3. package/dist/abi/index.cjs.map +1 -1
  4. package/dist/abi/index.d.cts +3846 -482
  5. package/dist/abi/index.d.ts +3846 -482
  6. package/dist/abi/index.js +15 -5
  7. package/dist/{chunk-KRHGFUDI.cjs → chunk-245YA3CQ.cjs} +87 -20
  8. package/dist/chunk-245YA3CQ.cjs.map +1 -0
  9. package/dist/{chunk-C7VB6WTL.cjs → chunk-2CU7ZH2A.cjs} +490 -497
  10. package/dist/chunk-2CU7ZH2A.cjs.map +1 -0
  11. package/dist/chunk-2DVM77Y2.cjs +5018 -0
  12. package/dist/chunk-2DVM77Y2.cjs.map +1 -0
  13. package/dist/{chunk-UZUDJXKE.cjs → chunk-3ZT7KTN4.cjs} +5 -3
  14. package/dist/chunk-3ZT7KTN4.cjs.map +1 -0
  15. package/dist/{chunk-H3X3FYUU.js → chunk-4VPIPVV5.js} +62 -35
  16. package/dist/chunk-4VPIPVV5.js.map +1 -0
  17. package/dist/{chunk-UCO5DXD6.js → chunk-5Y7MGN56.js} +87 -20
  18. package/dist/chunk-5Y7MGN56.js.map +1 -0
  19. package/dist/chunk-DQKCPH6B.cjs +199 -0
  20. package/dist/chunk-DQKCPH6B.cjs.map +1 -0
  21. package/dist/{chunk-4TNHRZ4X.js → chunk-K4GBOB5V.js} +4 -2
  22. package/dist/chunk-K4GBOB5V.js.map +1 -0
  23. package/dist/{chunk-LF5GIN5P.js → chunk-W2DHHR2N.js} +490 -497
  24. package/dist/chunk-W2DHHR2N.js.map +1 -0
  25. package/dist/chunk-ZQVYWMOG.js +5018 -0
  26. package/dist/chunk-ZQVYWMOG.js.map +1 -0
  27. package/dist/contract/index.cjs +8 -4
  28. package/dist/contract/index.cjs.map +1 -1
  29. package/dist/contract/index.d.cts +53 -27
  30. package/dist/contract/index.d.ts +53 -27
  31. package/dist/contract/index.js +13 -9
  32. package/dist/eip712/index.cjs +3 -3
  33. package/dist/eip712/index.d.cts +7 -1
  34. package/dist/eip712/index.d.ts +7 -1
  35. package/dist/eip712/index.js +2 -2
  36. package/dist/index.cjs +227 -38
  37. package/dist/index.cjs.map +1 -1
  38. package/dist/index.d.cts +601 -11
  39. package/dist/index.d.ts +601 -11
  40. package/dist/index.js +213 -24
  41. package/dist/index.js.map +1 -1
  42. package/dist/{types-C17pznGz.d.ts → types-Hn1zUPTt.d.cts} +46 -13
  43. package/dist/{types-C17pznGz.d.cts → types-Hn1zUPTt.d.ts} +46 -13
  44. package/package.json +1 -1
  45. package/dist/chunk-4TNHRZ4X.js.map +0 -1
  46. package/dist/chunk-C7VB6WTL.cjs.map +0 -1
  47. package/dist/chunk-H3X3FYUU.js.map +0 -1
  48. package/dist/chunk-KRHGFUDI.cjs.map +0 -1
  49. package/dist/chunk-LF5GIN5P.js.map +0 -1
  50. package/dist/chunk-TRYGIC2I.cjs +0 -172
  51. package/dist/chunk-TRYGIC2I.cjs.map +0 -1
  52. package/dist/chunk-UCO5DXD6.js.map +0 -1
  53. package/dist/chunk-UZUDJXKE.cjs.map +0 -1
  54. package/dist/chunk-XXLIIWIF.cjs +0 -711
  55. package/dist/chunk-XXLIIWIF.cjs.map +0 -1
  56. package/dist/chunk-ZJXXCG5P.js +0 -711
  57. package/dist/chunk-ZJXXCG5P.js.map +0 -1
@@ -0,0 +1,199 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+
4
+
5
+ var _chunk2CU7ZH2Acjs = require('./chunk-2CU7ZH2A.cjs');
6
+
7
+
8
+ var _chunk245YA3CQcjs = require('./chunk-245YA3CQ.cjs');
9
+
10
+ // src/contract/pointToken.ts
11
+ async function getMintRequestNonce(client, pointToken, receiver) {
12
+ return client.readContract({
13
+ address: pointToken,
14
+ abi: _chunk245YA3CQcjs.pointTokenAbi,
15
+ functionName: "mintRequestNonces",
16
+ args: [receiver]
17
+ });
18
+ }
19
+ async function isMinter(client, pointToken, account) {
20
+ return client.readContract({
21
+ address: pointToken,
22
+ abi: _chunk245YA3CQcjs.pointTokenAbi,
23
+ functionName: "minters",
24
+ args: [account]
25
+ });
26
+ }
27
+ async function getTokenName(client, pointToken) {
28
+ return client.readContract({
29
+ address: pointToken,
30
+ abi: _chunk245YA3CQcjs.pointTokenAbi,
31
+ functionName: "name"
32
+ });
33
+ }
34
+ async function getIssuer(client, pointToken) {
35
+ return client.readContract({
36
+ address: pointToken,
37
+ abi: _chunk245YA3CQcjs.pointTokenAbi,
38
+ functionName: "issuer"
39
+ });
40
+ }
41
+ async function getPointTokenBalance(client, pointToken, holder) {
42
+ return client.readContract({
43
+ address: pointToken,
44
+ abi: _chunk245YA3CQcjs.pointTokenAbi,
45
+ functionName: "balanceOf",
46
+ args: [holder]
47
+ });
48
+ }
49
+ async function getBurnRequestNonce(client, pointToken, from) {
50
+ return client.readContract({
51
+ address: pointToken,
52
+ abi: _chunk245YA3CQcjs.pointTokenAbi,
53
+ functionName: "burnRequestNonces",
54
+ args: [from]
55
+ });
56
+ }
57
+
58
+ // src/contract/issuerRegistry.ts
59
+ var GET_ISSUER_FLAT_ABI = [
60
+ {
61
+ type: "function",
62
+ name: "getIssuer",
63
+ inputs: [{ name: "issuer", type: "address" }],
64
+ outputs: [
65
+ { name: "signerAddress", type: "address" },
66
+ { name: "name", type: "string" },
67
+ { name: "active", type: "bool" },
68
+ { name: "capitalBase", type: "uint256" },
69
+ { name: "basisPoints", type: "uint16" }
70
+ ],
71
+ stateMutability: "view"
72
+ }
73
+ ];
74
+ async function getIssuer2(client, registryAddress, issuer) {
75
+ const result = await client.readContract({
76
+ address: registryAddress,
77
+ abi: GET_ISSUER_FLAT_ABI,
78
+ functionName: "getIssuer",
79
+ args: [issuer]
80
+ });
81
+ return {
82
+ signerAddress: result[0],
83
+ name: result[1],
84
+ active: result[2],
85
+ capitalBase: result[3],
86
+ basisPoints: Number(result[4])
87
+ };
88
+ }
89
+ var issuerRegistryGetIssuerFlatAbi = GET_ISSUER_FLAT_ABI;
90
+ async function isActiveIssuer(client, registryAddress, issuer) {
91
+ return client.readContract({
92
+ address: registryAddress,
93
+ abi: _chunk2CU7ZH2Acjs.issuerRegistryAbi,
94
+ functionName: "isActiveIssuer",
95
+ args: [issuer]
96
+ });
97
+ }
98
+ function computeEquityCap(issuer) {
99
+ return issuer.capitalBase * BigInt(issuer.basisPoints) / 10000n;
100
+ }
101
+
102
+ // src/types.ts
103
+ var Source = /* @__PURE__ */ ((Source2) => {
104
+ Source2[Source2["EQUITY"] = 0] = "EQUITY";
105
+ Source2[Source2["VAULT"] = 1] = "VAULT";
106
+ return Source2;
107
+ })(Source || {});
108
+
109
+ // src/contract/mintingOracle.ts
110
+ async function verifyMint(client, oracleAddress, pointToken, issuer, source, amount) {
111
+ await client.readContract({
112
+ address: oracleAddress,
113
+ abi: _chunk2CU7ZH2Acjs.mintingOracleAbi,
114
+ functionName: "verifyMint",
115
+ args: [pointToken, issuer, source, amount]
116
+ });
117
+ }
118
+ async function verifyEquityMint(client, oracleAddress, pointToken, issuer, amount) {
119
+ await verifyMint(
120
+ client,
121
+ oracleAddress,
122
+ pointToken,
123
+ issuer,
124
+ 0 /* EQUITY */,
125
+ amount
126
+ );
127
+ }
128
+ async function verifyIssuerOperative(client, oracleAddress, pointToken, issuer) {
129
+ await client.readContract({
130
+ address: oracleAddress,
131
+ abi: _chunk2CU7ZH2Acjs.mintingOracleAbi,
132
+ functionName: "verifyIssuerOperative",
133
+ args: [pointToken, issuer]
134
+ });
135
+ }
136
+ async function getOracleRegistries(client, oracleAddress) {
137
+ const [issuerRegistry, tokenRegistry, vaultRegistry] = await Promise.all([
138
+ client.readContract({
139
+ address: oracleAddress,
140
+ abi: _chunk2CU7ZH2Acjs.mintingOracleAbi,
141
+ functionName: "issuerRegistry"
142
+ }),
143
+ client.readContract({
144
+ address: oracleAddress,
145
+ abi: _chunk2CU7ZH2Acjs.mintingOracleAbi,
146
+ functionName: "tokenRegistry"
147
+ }),
148
+ client.readContract({
149
+ address: oracleAddress,
150
+ abi: _chunk2CU7ZH2Acjs.mintingOracleAbi,
151
+ functionName: "vaultRegistry"
152
+ })
153
+ ]);
154
+ return { issuerRegistry, tokenRegistry, vaultRegistry };
155
+ }
156
+
157
+ // src/contract/mintFeeWrapper.ts
158
+ async function getMintFeeBps(client, wrapperAddress, pointToken) {
159
+ const fee = await client.readContract({
160
+ address: wrapperAddress,
161
+ abi: _chunk2CU7ZH2Acjs.mintFeeWrapperAbi,
162
+ functionName: "totalFeeBps",
163
+ args: [pointToken]
164
+ });
165
+ return Number(fee);
166
+ }
167
+ async function getMintFeeRecipients(client, wrapperAddress, pointToken) {
168
+ const recipients = await client.readContract({
169
+ address: wrapperAddress,
170
+ abi: _chunk2CU7ZH2Acjs.mintFeeWrapperAbi,
171
+ functionName: "getRecipients",
172
+ args: [pointToken]
173
+ });
174
+ return recipients.map((r) => ({
175
+ account: r.account,
176
+ basisPoints: Number(r.basisPoints)
177
+ }));
178
+ }
179
+
180
+
181
+
182
+
183
+
184
+
185
+
186
+
187
+
188
+
189
+
190
+
191
+
192
+
193
+
194
+
195
+
196
+
197
+
198
+ exports.Source = Source; exports.getMintRequestNonce = getMintRequestNonce; exports.isMinter = isMinter; exports.getTokenName = getTokenName; exports.getIssuer = getIssuer; exports.getPointTokenBalance = getPointTokenBalance; exports.getBurnRequestNonce = getBurnRequestNonce; exports.getIssuer2 = getIssuer2; exports.issuerRegistryGetIssuerFlatAbi = issuerRegistryGetIssuerFlatAbi; exports.isActiveIssuer = isActiveIssuer; exports.computeEquityCap = computeEquityCap; exports.verifyMint = verifyMint; exports.verifyEquityMint = verifyEquityMint; exports.verifyIssuerOperative = verifyIssuerOperative; exports.getOracleRegistries = getOracleRegistries; exports.getMintFeeBps = getMintFeeBps; exports.getMintFeeRecipients = getMintFeeRecipients;
199
+ //# sourceMappingURL=chunk-DQKCPH6B.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/Users/phitran/Pacific-Finance/pafi-backend/pafi-sdk/packages/core/dist/chunk-DQKCPH6B.cjs","../src/contract/pointToken.ts","../src/contract/issuerRegistry.ts","../src/types.ts","../src/contract/mintingOracle.ts","../src/contract/mintFeeWrapper.ts"],"names":["getIssuer","Source"],"mappings":"AAAA;AACE;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACA;ACNA,MAAA,SAAsB,mBAAA,CACpB,MAAA,EACA,UAAA,EACA,QAAA,EACiB;AACjB,EAAA,OAAO,MAAA,CAAO,YAAA,CAAa;AAAA,IACzB,OAAA,EAAS,UAAA;AAAA,IACT,GAAA,EAAK,+BAAA;AAAA,IACL,YAAA,EAAc,mBAAA;AAAA,IACd,IAAA,EAAM,CAAC,QAAQ;AAAA,EACjB,CAAC,CAAA;AACH;AAEA,MAAA,SAAsB,QAAA,CACpB,MAAA,EACA,UAAA,EACA,OAAA,EACkB;AAClB,EAAA,OAAO,MAAA,CAAO,YAAA,CAAa;AAAA,IACzB,OAAA,EAAS,UAAA;AAAA,IACT,GAAA,EAAK,+BAAA;AAAA,IACL,YAAA,EAAc,SAAA;AAAA,IACd,IAAA,EAAM,CAAC,OAAO;AAAA,EAChB,CAAC,CAAA;AACH;AAEA,MAAA,SAAsB,YAAA,CACpB,MAAA,EACA,UAAA,EACiB;AACjB,EAAA,OAAO,MAAA,CAAO,YAAA,CAAa;AAAA,IACzB,OAAA,EAAS,UAAA;AAAA,IACT,GAAA,EAAK,+BAAA;AAAA,IACL,YAAA,EAAc;AAAA,EAChB,CAAC,CAAA;AACH;AAEA,MAAA,SAAsB,SAAA,CACpB,MAAA,EACA,UAAA,EACkB;AAClB,EAAA,OAAO,MAAA,CAAO,YAAA,CAAa;AAAA,IACzB,OAAA,EAAS,UAAA;AAAA,IACT,GAAA,EAAK,+BAAA;AAAA,IACL,YAAA,EAAc;AAAA,EAChB,CA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acific-Finance/pafi-backend/pafi-sdk/packages/core/dist/chunk-DQKCPH6B.cjs","sourcesContent":[null,"import type { Address, PublicClient } from \"viem\";\nimport { pointTokenAbi } from \"../abi/pointToken\";\n\nexport async function getMintRequestNonce(\n client: PublicClient,\n pointToken: Address,\n receiver: Address,\n): Promise<bigint> {\n return client.readContract({\n address: pointToken,\n abi: pointTokenAbi,\n functionName: \"mintRequestNonces\",\n args: [receiver],\n });\n}\n\nexport async function isMinter(\n client: PublicClient,\n pointToken: Address,\n account: Address,\n): Promise<boolean> {\n return client.readContract({\n address: pointToken,\n abi: pointTokenAbi,\n functionName: \"minters\",\n args: [account],\n });\n}\n\nexport async function getTokenName(\n client: PublicClient,\n pointToken: Address,\n): Promise<string> {\n return client.readContract({\n address: pointToken,\n abi: pointTokenAbi,\n functionName: \"name\",\n });\n}\n\nexport async function getIssuer(\n client: PublicClient,\n pointToken: Address,\n): Promise<Address> {\n return client.readContract({\n address: pointToken,\n abi: pointTokenAbi,\n functionName: \"issuer\",\n });\n}\n\n/**\n * Read the ERC-20 on-chain balance for `holder`. Returned in raw 18-decimal\n * base units. Use alongside the issuer's off-chain ledger balance to render\n * a combined \"total balance\" in the app UI.\n */\nexport async function getPointTokenBalance(\n client: PublicClient,\n pointToken: Address,\n holder: Address,\n): Promise<bigint> {\n return client.readContract({\n address: pointToken,\n abi: pointTokenAbi,\n functionName: \"balanceOf\",\n args: [holder],\n });\n}\n\nexport async function getBurnRequestNonce(\n client: PublicClient,\n pointToken: Address,\n from: Address,\n): Promise<bigint> {\n return client.readContract({\n address: pointToken,\n abi: pointTokenAbi,\n functionName: \"burnRequestNonces\",\n args: [from],\n });\n}\n","import type { Address, PublicClient } from \"viem\";\nimport { issuerRegistryAbi } from \"../abi/issuerRegistry\";\nimport type { Issuer } from \"../types\";\n\n/**\n * Flat-output ABI for `getIssuer` — V2 dual-bucket (5 fields).\n *\n * Workaround for a viem decoding bug (≤ 2.48.x) where\n * `outputs: [{ type: 'tuple', components: [...] }]` with mixed static +\n * dynamic fields throws `IntegerOutOfRangeError` because viem expects\n * an outer offset that the actual on-chain return doesn't carry\n * (Solidity inlines `returns (Struct)` at the wire level).\n *\n * Flat outputs (one entry per struct field) match the on-chain encoding\n * and decode correctly. We rebuild the named struct from the result\n * array.\n *\n * V2 Issuer shape (lab/master: `c15cb50`):\n * { signerAddress, name, active, capitalBase, basisPoints }\n *\n * The EQUITY cap is `capitalBase * basisPoints / 10000`; sponsor-relayer\n * computes it server-side rather than calling MintingOracle (which is\n * now stateless — see `contract/mintingOracle.ts:verifyMint`).\n */\nconst GET_ISSUER_FLAT_ABI = [\n {\n type: \"function\",\n name: \"getIssuer\",\n inputs: [{ name: \"issuer\", type: \"address\" }],\n outputs: [\n { name: \"signerAddress\", type: \"address\" },\n { name: \"name\", type: \"string\" },\n { name: \"active\", type: \"bool\" },\n { name: \"capitalBase\", type: \"uint256\" },\n { name: \"basisPoints\", type: \"uint16\" },\n ],\n stateMutability: \"view\",\n },\n] as const;\n\nexport async function getIssuer(\n client: PublicClient,\n registryAddress: Address,\n issuer: Address,\n): Promise<Issuer> {\n const result = (await client.readContract({\n address: registryAddress,\n abi: GET_ISSUER_FLAT_ABI,\n functionName: \"getIssuer\",\n args: [issuer],\n })) as readonly [Address, string, boolean, bigint, number];\n return {\n signerAddress: result[0],\n name: result[1],\n active: result[2],\n capitalBase: result[3],\n basisPoints: Number(result[4]),\n } satisfies Issuer;\n}\n\n/**\n * Re-export the flat ABI so callers using `client.readContract` directly\n * (e.g. inside batched `Promise.all`) can use it instead of the\n * struct-returning entry from `issuerRegistryAbi`.\n */\nexport const issuerRegistryGetIssuerFlatAbi = GET_ISSUER_FLAT_ABI;\n\nexport async function isActiveIssuer(\n client: PublicClient,\n registryAddress: Address,\n issuer: Address,\n): Promise<boolean> {\n return client.readContract({\n address: registryAddress,\n abi: issuerRegistryAbi,\n functionName: \"isActiveIssuer\",\n args: [issuer],\n });\n}\n\n/**\n * Compute the EQUITY-bucket cap for an issuer from its registry record.\n * V2 cap = `capitalBase * basisPoints / 10000`. Returns the cap as a\n * `bigint` so callers can compare to `equitySupply` directly.\n */\nexport function computeEquityCap(issuer: Issuer): bigint {\n return (issuer.capitalBase * BigInt(issuer.basisPoints)) / 10_000n;\n}\n","import type { Address, Hex, PublicClient, WalletClient } from \"viem\";\n\n// -------------------------------------------------------------------------\n// EIP-712 / signing types\n// -------------------------------------------------------------------------\n\n/**\n * V2 dual-bucket supply source for `PointToken.mint` and\n * `PointToken.burn`. Matches `IPointToken.Source` on chain.\n *\n * EQUITY (0) — backed by issuer's declared capital (`Issuer.capitalBase\n * * basisPoints / 10000`). Default path; this is what\n * SDK signing helpers + sponsor-relayer accept today.\n * VAULT (1) — backed by LP collateral deposited into the token's\n * `SettlementVault`. Contract-ready but no SDK writer\n * ships it; sponsor-relayer rejects `source != EQUITY`\n * in `validateMint` / `validateBurn` until the\n * LP/admin dashboard surface lands.\n */\nexport enum Source {\n EQUITY = 0,\n VAULT = 1,\n}\n\n/**\n * MintForRequest(address user,address receiver,uint256 amount,uint8 source,uint256 nonce,uint256 deadline)\n *\n * `user` — off-chain spender; PointToken increments mintRequestNonces[user]\n * `receiver` — on-chain caller of PointToken.mint; contract enforces `msg.sender == receiver`\n * `source` — V2 supply bucket (EQUITY = 0, VAULT = 1)\n *\n * Direct user mint: user == receiver == EOA\n * Wrapper-mediated: user = end-user, receiver = MintFeeWrapper address\n */\nexport interface MintRequest {\n user: Address;\n receiver: Address;\n amount: bigint;\n source: Source;\n nonce: bigint;\n deadline: bigint;\n}\n\n/**\n * BurnRequest(address from,uint256 amount,uint8 source,uint256 nonce,uint256 deadline)\n *\n * `source` — V2 supply bucket to draw the burn against (must match\n * the bucket the corresponding mint was attributed to;\n * the contract reverts `BucketUnderflow` otherwise).\n */\nexport interface BurnRequest {\n from: Address;\n amount: bigint;\n source: Source;\n nonce: bigint;\n deadline: bigint;\n}\n\n// Sponsored mints reuse the same `MintForRequest` flow — sponsor-relayer\n// pays gas. The deployed PointToken contract has no separate\n// `ReceiverConsent` path, so no dedicated interface is exported here.\n\nexport interface EIP712Signature {\n v: number;\n r: Hex;\n s: Hex;\n serialized: Hex;\n}\n\nexport interface PointTokenDomainConfig {\n name: string;\n verifyingContract: Address;\n chainId: number;\n /**\n * EIP-712 domain version. Defaults to `\"1\"` when omitted (matches\n * the deployed PointToken on Base mainnet at the time of writing).\n * Pass an explicit value if the contract upgrades its domain\n * separator (e.g. `\"2\"` after a hardfork) — every PT may report a\n * different version via its `eip712Domain()` view.\n */\n version?: string;\n}\n\n/**\n * Why a verification failed. Present on `SignatureVerification` when\n * `isValid === false`. Callers can switch on this to give a useful\n * UX message:\n *\n * - `INVALID_SIGNER` — recovered address does not match the\n * expected signer (forged or wrong-key sig).\n * - `DEADLINE_PASSED` — signature is cryptographically valid but\n * the request's `deadline` has elapsed\n * relative to the caller-supplied\n * `currentTimeSec`. Only reported when the\n * caller opted into deadline checking by\n * passing `currentTimeSec`.\n */\nexport type SignatureVerificationFailReason =\n | \"INVALID_SIGNER\"\n | \"DEADLINE_PASSED\";\n\nexport interface SignatureVerification {\n isValid: boolean;\n recoveredAddress: Address;\n /**\n * Populated only when `isValid === false`. See\n * `SignatureVerificationFailReason` for the meanings.\n */\n reason?: SignatureVerificationFailReason;\n}\n\n/**\n * Options shared by `verifyMintRequest` / `verifyBurnRequest`. The\n * helpers default to recovering and matching the signer only. Pass\n * `currentTimeSec` (unix seconds) to additionally enforce\n * `deadline >= currentTimeSec` — the same predicate the on-chain\n * contract runs via `block.timestamp <= deadline`.\n *\n * Optional by design:\n * - Backward compatibility for callers already using the 4-arg form.\n * - Different callers want different time sources (server clock for\n * issuer backend, device clock for FE pre-flight, fixed value for\n * deterministic tests / historical replay).\n *\n * The on-chain contract remains the source of truth — this is a\n * pre-flight check to avoid opaque on-chain reverts.\n */\nexport interface SignatureVerifyOptions {\n /** Unix seconds. Throws if not a finite non-negative number. */\n currentTimeSec?: number;\n}\n\n// ---- GENERATED CONTRACT STRUCTS START ----\n\n/** Auto-generated from Solidity struct — do not edit */\nexport interface Recipient {\n account: Address;\n basisPoints: number;\n}\n\n/**\n * V2 `IssuerRegistry.Issuer` (5 fields). V1 had 7 fields including\n * `issuerAddress`, `symbol`, `pointToken`, `mintingOracle`; those were\n * removed because V2 separates token metadata into TokenRegistry and\n * the MintingOracle is stateless (no longer per-issuer wired).\n *\n * `capitalBase` — issuer's declared capital (USD-scaled by\n * `MintingOracle.TOKEN_SCALE()`)\n * `basisPoints` — uint16, EQUITY cap multiplier; cap =\n * `capitalBase * basisPoints / 10000`\n *\n * Consumers that need the issuer key (the address that owns the\n * record) should pass it alongside the struct — it is no longer\n * embedded.\n */\nexport interface Issuer {\n signerAddress: Address;\n name: string;\n active: boolean;\n capitalBase: bigint;\n basisPoints: number;\n}\n\n// `TokenCap` from V1 is deleted — V2 MintingOracle is stateless and the\n// EQUITY cap is computed off-chain from the `Issuer` record via\n// `computeEquityCap` (see `contract/issuerRegistry.ts`). VAULT cap is\n// driven by SettlementVault collateral × LTV and is not exposed via\n// SDK helpers yet (deferred until the LP/admin dashboard ships).\n// ---- GENERATED CONTRACT STRUCTS END ----\n\n/**\n * Uniswap V3 pool identifier. Pool addresses are deterministic via\n * `factory + initCodeHash + sortedTokens + fee` — see\n * `computeV3PoolAddress()` in `./utils`.\n *\n * `fee` is the pool's fee tier in hundredths of a basis point (e.g.\n * `3000` = 0.3%). Valid tiers are factory-configured — query\n * `PafiV3Factory.feeAmountTickSpacing(fee)` if you need to enumerate.\n */\nexport interface PoolKey {\n token0: Address;\n token1: Address;\n fee: number;\n}\n\n/**\n * Uniswap V3 packed swap path. Represents a multi-hop route as a\n * sequence of tokens connected by fee tiers. For an N-hop swap,\n * `tokens.length === N + 1` and `fees.length === N`.\n *\n * Encoded on-chain as packed bytes via `encodeV3Path()`:\n * `tokens[0] ‖ fees[0] ‖ tokens[1] ‖ fees[1] ‖ ... ‖ tokens[N]`\n *\n * For exact-input swaps the path is encoded input→output. For\n * exact-output swaps the path is encoded output→input (reversed) —\n * see `quoteExactOutput` / `buildSwapUserOpExactOut`.\n */\nexport interface V3Path {\n tokens: Address[];\n fees: number[];\n}\n\n// -------------------------------------------------------------------------\n// Chain / config types\n// -------------------------------------------------------------------------\n\nexport interface ChainConfig {\n name: string;\n}\n\n// -------------------------------------------------------------------------\n// Quoting types\n// -------------------------------------------------------------------------\n\nexport interface QuoteResult {\n amountOut: bigint;\n gasEstimate: bigint;\n /** V3 path used to obtain the quote, oriented input→output. */\n path: V3Path;\n}\n\nexport interface BestQuote {\n bestRoute: QuoteResult;\n allRoutes: QuoteResult[];\n}\n\n// -------------------------------------------------------------------------\n// Exact-output quoting (sibling to QuoteResult/BestQuote — kept as a\n// separate type rather than a discriminated union because `QuoteResult` is\n// read across the trading package and core consumers; expanding its shape\n// would be invasive). Returned by `quoteExactOutput*` and\n// `findBestQuoteExactOut` in `@pafi-dev/trading`.\n// -------------------------------------------------------------------------\n\nexport interface ExactOutputQuoteResult {\n /** Input amount required to receive `exactAmount` of the output token. */\n amountIn: bigint;\n gasEstimate: bigint;\n /**\n * V3 path oriented output→input for exact-out quoting. On-chain this\n * gets packed with the tokens in reverse order so the Quoter walks\n * from the desired output back to the input.\n */\n path: V3Path;\n}\n\nexport interface ExactOutputBestQuote {\n bestRoute: ExactOutputQuoteResult;\n allRoutes: ExactOutputQuoteResult[];\n}\n\n// -------------------------------------------------------------------------\n// SDK config\n// -------------------------------------------------------------------------\n//\n// Note: `@pafi-dev/core` is intentionally HTTP-client-free. It handles only\n// cryptography (EIP-712 / EIP-4361), contract calldata + reads, and V4\n// quoting. The HTTP API contract (routes, request/response shapes) is\n// owned by `@pafi-dev/issuer` as the single source of truth — frontends\n// import those types via `import type` and build their own `fetch` calls.\n\nexport interface PafiSDKConfig {\n pointTokenAddress?: Address;\n signer?: WalletClient;\n provider?: PublicClient;\n rpcUrl?: string;\n chainId?: number;\n}\n\n// -------------------------------------------------------------------------\n// Redemption restriction policy\n// -------------------------------------------------------------------------\n//\n// Per-issuer policy fetched from settlement-api. The issuer SDK enforces\n// it locally by combining the policy with a redemption history query.\n// Amounts are PT bigints (18 decimals on the deployed token).\n\nexport interface BlackoutWindow {\n /** Inclusive UTC unix-second start. */\n startUnixSec: number;\n /** Exclusive UTC unix-second end. */\n endUnixSec: number;\n reason?: string;\n}\n\nexport interface RedemptionPolicy {\n issuerId: string;\n dailyLimitPt: bigint;\n cooldownSec: number;\n perTxMinPt: bigint;\n perTxMaxPt: bigint;\n blackoutWindows: BlackoutWindow[];\n version: string;\n}\n\n/**\n * Source the cached policy was last loaded from. `default` means the\n * SDK fallback was used (settlement-api unreachable or returned 404).\n */\nexport type RedemptionPolicySource = \"settlement\" | \"cache\" | \"default\";\n\nexport type RedemptionDenialCode =\n | \"AMOUNT_BELOW_MIN\"\n | \"AMOUNT_ABOVE_MAX\"\n | \"DAILY_LIMIT_EXCEEDED\"\n | \"COOLDOWN_ACTIVE\"\n | \"BLACKOUT_WINDOW\";\n\nexport interface RedemptionDenial {\n code: RedemptionDenialCode;\n message: string;\n}\n\n/**\n * Result of `getPreview(user)` — what the user can redeem right now.\n * `availableAmountPt` is the largest single redemption that would\n * pass the policy at this moment (clamped by daily remainder + perTxMax).\n */\nexport interface RedemptionPreview {\n availableAmountPt: bigint;\n dailyRemainingPt: bigint;\n cooldownUntilUnixSec: number | null;\n nextBlackoutEndsAtUnixSec: number | null;\n perTxMinPt: bigint;\n perTxMaxPt: bigint;\n policyVersion: string;\n policySource: RedemptionPolicySource;\n}\n\n/**\n * Result of `evaluate(user, amount)` — whether the redemption is allowed\n * right now and, if not, why.\n */\nexport interface RedemptionDecision {\n allowed: boolean;\n denial?: RedemptionDenial;\n preview: RedemptionPreview;\n}\n","import type { Address, PublicClient } from \"viem\";\nimport { mintingOracleAbi } from \"../abi/mintingOracle\";\nimport { Source } from \"../types\";\n\n/**\n * V2 MintingOracle — stateless cap verifier. The V1 `tokenCaps`\n * mapping + `getTokenCap` helper are GONE; the oracle no longer holds\n * per-token cap state.\n *\n * Sponsor-relayer's cap pre-check should call `verifyMint` as a view\n * dry-run; it reverts with `MintCapExceeded` / `VaultCapExceeded` /\n * `IssuerNotActive` / `TokenInactive` / `UnregisteredPointToken` /\n * `IssuerMismatch` exactly the same way the on-chain mint path will,\n * so a successful view call is a strong pre-flight guarantee.\n */\n\n/**\n * Dry-run the on-chain cap check. Throws if the mint would revert.\n *\n * pointToken — the PT being minted\n * issuer — the issuer address (must match `IssuerRegistry`'s\n * record for this token)\n * source — EQUITY or VAULT (uint8)\n * amount — gross mint amount (the wrapper fee is split *after*\n * this verify, so amount here is the wrapper-call gross)\n */\nexport async function verifyMint(\n client: PublicClient,\n oracleAddress: Address,\n pointToken: Address,\n issuer: Address,\n source: Source,\n amount: bigint,\n): Promise<void> {\n await client.readContract({\n address: oracleAddress,\n abi: mintingOracleAbi,\n functionName: \"verifyMint\",\n args: [pointToken, issuer, source, amount],\n });\n}\n\n/**\n * Convenience for the EQUITY-only path that the SDK + sponsor-relayer\n * currently ship. VAULT minting is contract-ready but no SDK writer\n * exposes it; this helper exists to make the EQUITY default obvious at\n * the call site.\n */\nexport async function verifyEquityMint(\n client: PublicClient,\n oracleAddress: Address,\n pointToken: Address,\n issuer: Address,\n amount: bigint,\n): Promise<void> {\n await verifyMint(\n client,\n oracleAddress,\n pointToken,\n issuer,\n Source.EQUITY,\n amount,\n );\n}\n\n/**\n * Confirm the (token, issuer) pair is currently active. Useful as a\n * narrow pre-check for burn / non-mint flows that don't care about the\n * cap but still need the active gate. Reverts with\n * `IssuerNotActive` / `TokenInactive` / `UnregisteredPointToken` /\n * `IssuerMismatch` on failure.\n */\nexport async function verifyIssuerOperative(\n client: PublicClient,\n oracleAddress: Address,\n pointToken: Address,\n issuer: Address,\n): Promise<void> {\n await client.readContract({\n address: oracleAddress,\n abi: mintingOracleAbi,\n functionName: \"verifyIssuerOperative\",\n args: [pointToken, issuer],\n });\n}\n\n/**\n * V2 routes the issuer lookup through TokenRegistry. The oracle exposes\n * `tokenRegistry()` / `issuerRegistry()` as read-only addresses for\n * callers that want to wire reads themselves.\n */\nexport async function getOracleRegistries(\n client: PublicClient,\n oracleAddress: Address,\n): Promise<{\n issuerRegistry: Address;\n tokenRegistry: Address;\n vaultRegistry: Address;\n}> {\n const [issuerRegistry, tokenRegistry, vaultRegistry] = await Promise.all([\n client.readContract({\n address: oracleAddress,\n abi: mintingOracleAbi,\n functionName: \"issuerRegistry\",\n }) as Promise<Address>,\n client.readContract({\n address: oracleAddress,\n abi: mintingOracleAbi,\n functionName: \"tokenRegistry\",\n }) as Promise<Address>,\n client.readContract({\n address: oracleAddress,\n abi: mintingOracleAbi,\n functionName: \"vaultRegistry\",\n }) as Promise<Address>,\n ]);\n return { issuerRegistry, tokenRegistry, vaultRegistry };\n}\n","import type { Address, PublicClient } from \"viem\";\nimport { mintFeeWrapperAbi } from \"../abi/mintFeeWrapper\";\n\n/**\n * Read the total fee in basis points (0–10000) for a specific PointToken\n * from the shared `MintFeeWrapper`. Each PointToken has its own recipient\n * list with per-recipient `basisPoints`; `totalFeeBps` is the sum.\n *\n * Returns 0 when no recipients are registered (mint goes through wrapper\n * with no fee deduction). Reverts only on RPC failure.\n */\nexport async function getMintFeeBps(\n client: PublicClient,\n wrapperAddress: Address,\n pointToken: Address,\n): Promise<number> {\n const fee = await client.readContract({\n address: wrapperAddress,\n abi: mintFeeWrapperAbi,\n functionName: \"totalFeeBps\",\n args: [pointToken],\n });\n return Number(fee);\n}\n\n/**\n * Read the recipient configuration for a PointToken — list of\n * `{ account, basisPoints }`. Useful for /config endpoints that want to\n * surface fee distribution to the frontend.\n */\nexport async function getMintFeeRecipients(\n client: PublicClient,\n wrapperAddress: Address,\n pointToken: Address,\n): Promise<readonly { account: Address; basisPoints: number }[]> {\n const recipients = await client.readContract({\n address: wrapperAddress,\n abi: mintFeeWrapperAbi,\n functionName: \"getRecipients\",\n args: [pointToken],\n });\n return recipients.map((r) => ({\n account: r.account,\n basisPoints: Number(r.basisPoints),\n }));\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  pointTokenAbi
3
- } from "./chunk-UCO5DXD6.js";
3
+ } from "./chunk-5Y7MGN56.js";
4
4
 
5
5
  // src/eip712/domain.ts
6
6
  function buildDomain(config) {
@@ -67,6 +67,7 @@ var mintRequestTypes = {
67
67
  { name: "user", type: "address" },
68
68
  { name: "receiver", type: "address" },
69
69
  { name: "amount", type: "uint256" },
70
+ { name: "source", type: "uint8" },
70
71
  { name: "nonce", type: "uint256" },
71
72
  { name: "deadline", type: "uint256" }
72
73
  ]
@@ -75,6 +76,7 @@ var burnRequestTypes = {
75
76
  BurnRequest: [
76
77
  { name: "from", type: "address" },
77
78
  { name: "amount", type: "uint256" },
79
+ { name: "source", type: "uint8" },
78
80
  { name: "nonce", type: "uint256" },
79
81
  { name: "deadline", type: "uint256" }
80
82
  ]
@@ -252,4 +254,4 @@ export {
252
254
  signBurnRequest,
253
255
  verifyBurnRequest
254
256
  };
255
- //# sourceMappingURL=chunk-4TNHRZ4X.js.map
257
+ //# sourceMappingURL=chunk-K4GBOB5V.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/eip712/domain.ts","../src/eip712/mintRequest.ts","../src/constants.ts","../src/eip712/verifyDeadline.ts","../src/eip712/burnRequest.ts"],"sourcesContent":["import type { Address, PublicClient } from \"viem\";\nimport type { PointTokenDomainConfig } from \"../types\";\nimport { pointTokenAbi } from \"../abi/pointToken\";\n\n/**\n * Build the EIP-712 domain struct from a PointToken config. Uses\n * `config.version` when supplied; defaults to `\"1\"` for back-compat.\n */\nexport function buildDomain(config: PointTokenDomainConfig) {\n return {\n name: config.name,\n version: config.version ?? \"1\",\n chainId: config.chainId,\n verifyingContract: config.verifyingContract,\n };\n}\n\n/**\n * Domain mismatch error thrown by `assertDomainMatchesContract`.\n */\nexport class Eip712DomainMismatchError extends Error {\n constructor(\n public readonly field: \"name\" | \"version\" | \"chainId\" | \"verifyingContract\",\n public readonly expected: string,\n public readonly actual: string,\n ) {\n super(\n `EIP-712 domain mismatch on field \"${field}\": expected ${expected}, got ${actual}. ` +\n `Local SDK config is out of sync with deployed PointToken — signatures will be rejected on-chain. ` +\n `Update SDK config or contract before producing more signatures.`,\n );\n this.name = \"Eip712DomainMismatchError\";\n }\n}\n\n/**\n * One-RPC health check that the local EIP-712 domain config matches\n * what the deployed `PointToken` reports via `eip712Domain()`. If the\n * contract has bumped `version` from `\"1\"` to `\"2\"` (or any field\n * differs), every signature produced with the stale config will be\n * silently rejected on-chain (`ECDSA: invalid signature` — opaque to\n * the user).\n *\n * Recommended: call once at issuer-startup health check, not on every\n * mint. Throws `Eip712DomainMismatchError` describing the diverged\n * field.\n *\n * @example\n * ```ts\n * import { assertDomainMatchesContract, buildDomain } from \"@pafi-dev/core\";\n *\n * const expected = buildDomain({\n * name: \"PointToken\",\n * chainId: 8453,\n * verifyingContract: \"0x855c2046AD49AcF9B3B32557176FfCB1a1A38A22\",\n * });\n *\n * await assertDomainMatchesContract(publicClient, expected);\n * // → throws Eip712DomainMismatchError if version on-chain has bumped\n * ```\n */\nexport async function assertDomainMatchesContract(\n client: PublicClient,\n expected: ReturnType<typeof buildDomain>,\n): Promise<void> {\n const onChain = (await client.readContract({\n address: expected.verifyingContract as Address,\n abi: pointTokenAbi,\n functionName: \"eip712Domain\",\n })) as readonly [\n `0x${string}`, // fields (bytes1)\n string, // name\n string, // version\n bigint, // chainId\n Address, // verifyingContract\n `0x${string}`, // salt\n readonly bigint[], // extensions\n ];\n\n const [, name, version, chainId, verifyingContract] = onChain;\n\n if (name !== expected.name) {\n throw new Eip712DomainMismatchError(\"name\", expected.name, name);\n }\n if (version !== expected.version) {\n throw new Eip712DomainMismatchError(\n \"version\",\n expected.version,\n version,\n );\n }\n if (chainId !== BigInt(expected.chainId)) {\n throw new Eip712DomainMismatchError(\n \"chainId\",\n String(expected.chainId),\n chainId.toString(),\n );\n }\n if (\n verifyingContract.toLowerCase() !==\n expected.verifyingContract.toLowerCase()\n ) {\n throw new Eip712DomainMismatchError(\n \"verifyingContract\",\n expected.verifyingContract,\n verifyingContract,\n );\n }\n}\n","import { getAddress, parseSignature, recoverTypedDataAddress } from \"viem\";\nimport type { Address, Hex, WalletClient } from \"viem\";\nimport { mintRequestTypes } from \"../constants\";\nimport type {\n EIP712Signature,\n MintRequest,\n PointTokenDomainConfig,\n SignatureVerification,\n SignatureVerifyOptions,\n} from \"../types\";\nimport { buildDomain } from \"./domain\";\nimport { assertValidCurrentTimeSec } from \"./verifyDeadline\";\n\nconst PRIMARY_TYPE = \"MintForRequest\" as const;\n\n/**\n * Build the EIP-712 typed data object for a MintForRequest.\n * Returns the standard `{ domain, types, primaryType, message }` structure\n * that any EIP-712 signer (viem, ethers, Privy, WalletConnect) can consume.\n */\nexport function buildMintRequestTypedData(\n domain: PointTokenDomainConfig,\n message: MintRequest,\n) {\n return {\n domain: buildDomain(domain),\n types: mintRequestTypes,\n primaryType: PRIMARY_TYPE,\n message,\n };\n}\n\n/**\n * Sign a MintForRequest. Caller passes the full 5-field message:\n * - user = off-chain spender (drives nonce stream)\n * - receiver = on-chain caller (= msg.sender of `mint()`; wrapper or user)\n * - amount = PT amount\n * - nonce = pointToken.mintRequestNonces(user)\n * - deadline = unix seconds\n */\nexport async function signMintRequest(\n walletClient: WalletClient,\n domain: PointTokenDomainConfig,\n message: MintRequest,\n): Promise<EIP712Signature> {\n const serialized = await walletClient.signTypedData({\n account: walletClient.account!,\n domain: buildDomain(domain),\n types: mintRequestTypes,\n primaryType: PRIMARY_TYPE,\n message,\n });\n\n const { v, r, s } = parseSignature(serialized);\n\n return {\n v: Number(v),\n r,\n s,\n serialized,\n };\n}\n\n/**\n * Verify a MintForRequest signature. Always recovers the signer and\n * compares against `expectedMinter`. Pass `options.currentTimeSec`\n * (unix seconds) to additionally enforce the request's `deadline` —\n * the on-chain contract enforces `block.timestamp <= deadline`, so\n * a stale-but-cryptographically-valid sig will only revert\n * on-submission unless the caller pre-flights here.\n *\n * Result shape:\n * - `{ isValid: true, recoveredAddress }` — sig matches and (if\n * deadline check requested) deadline has not elapsed.\n * - `{ isValid: false, recoveredAddress, reason: 'INVALID_SIGNER' }`\n * — sig does not recover to `expectedMinter`.\n * - `{ isValid: false, recoveredAddress, reason: 'DEADLINE_PASSED' }`\n * — sig is valid but `deadline < currentTimeSec`.\n *\n * Throws (synchronous Promise rejection):\n * - When `options.currentTimeSec` is provided but not a finite,\n * non-negative number. Misusing the API should fail loudly.\n */\nexport async function verifyMintRequest(\n domain: PointTokenDomainConfig,\n message: MintRequest,\n signature: Hex,\n expectedMinter: Address,\n options?: SignatureVerifyOptions,\n): Promise<SignatureVerification> {\n assertValidCurrentTimeSec(options?.currentTimeSec);\n\n const recoveredAddress = await recoverTypedDataAddress({\n domain: buildDomain(domain),\n types: mintRequestTypes,\n primaryType: PRIMARY_TYPE,\n message,\n signature,\n });\n\n if (getAddress(recoveredAddress) !== getAddress(expectedMinter)) {\n return { isValid: false, recoveredAddress, reason: \"INVALID_SIGNER\" };\n }\n\n if (\n options?.currentTimeSec !== undefined &&\n message.deadline < BigInt(options.currentTimeSec)\n ) {\n return { isValid: false, recoveredAddress, reason: \"DEADLINE_PASSED\" };\n }\n\n return { isValid: true, recoveredAddress };\n}\n","import type { Address, Hex } from \"viem\";\nimport type { ChainConfig, PoolKey } from \"./types\";\n\n// -------------------------------------------------------------------------\n// EIP-712 type definitions for viem\n// -------------------------------------------------------------------------\n\n/**\n * EIP-712 typed data for the sig-gated mint path.\n *\n * V2 dual-bucket — adds `source` (uint8) so the on-chain digest matches\n * `MintForRequest(address user,address receiver,uint256 amount,uint8 source,uint256 nonce,uint256 deadline)`.\n * Source values per `IPointToken.Source`:\n * 0 = EQUITY (mint backed by issuer's declared capital)\n * 1 = VAULT (mint backed by LP collateral in SettlementVault)\n *\n * SDK helpers `signMintRequest` / `prepareMint` hardcode `source = 0`\n * (EQUITY). VAULT minting is contract-ready but no SDK writer ships it\n * until the LP/admin dashboard lands; sponsor-relayer fails closed on\n * `source != EQUITY` for the same reason.\n *\n * Contract enforces:\n * - msg.sender == receiver (the on-chain caller of `mint`)\n * - nonce == mintRequestNonces[user] (per-user nonce stream)\n *\n * `user` is the off-chain spender (whose nonce advances), `receiver` is\n * the on-chain mint recipient. For direct mints `user == receiver` (user\n * calls PointToken.mint themselves). For wrapper-mediated mints `user ==\n * end-user`, `receiver == wrapper address`.\n */\nexport const mintRequestTypes = {\n MintForRequest: [\n { name: \"user\", type: \"address\" },\n { name: \"receiver\", type: \"address\" },\n { name: \"amount\", type: \"uint256\" },\n { name: \"source\", type: \"uint8\" },\n { name: \"nonce\", type: \"uint256\" },\n { name: \"deadline\", type: \"uint256\" },\n ],\n} as const;\n\n/**\n * EIP-712 typed data for the sig-gated burn path. V2 adds `source`\n * (uint8) to match the contract's 6-field digest:\n * `BurnRequest(address from,uint256 amount,uint8 source,uint256 nonce,uint256 deadline)`\n *\n * Same EQUITY-only policy as `mintRequestTypes`.\n */\nexport const burnRequestTypes = {\n BurnRequest: [\n { name: \"from\", type: \"address\" },\n { name: \"amount\", type: \"uint256\" },\n { name: \"source\", type: \"uint8\" },\n { name: \"nonce\", type: \"uint256\" },\n { name: \"deadline\", type: \"uint256\" },\n ],\n} as const;\n\n// Sponsored mints are implemented at the relayer layer (sponsor-relayer\n// pays gas for the sig-gated `MintForRequest`); the deployed PointToken\n// contract has no separate `ReceiverConsent` path, no extra EIP-712 type,\n// and no separate on-chain nonce mapping.\n\n// -------------------------------------------------------------------------\n// Chain-indexed constants — add entries here as new chains are supported\n// -------------------------------------------------------------------------\n\nexport const SUPPORTED_CHAINS: Record<number, ChainConfig> = {\n 8453: { name: \"Base\" },\n};\n\n/**\n * Uniswap V3 QuoterV2 — used by `findBestQuote` / `quoteExactInput` etc.\n * QuoterV2 (vs V1) reverts cleanly inside multicall and returns a 4-tuple\n * `(amountOut, sqrtPriceX96AfterList, initializedTicksCrossedList, gasEstimate)`.\n */\nexport const QUOTER_V2_ADDRESSES: Record<number, Address> = {\n 8453: \"0xa0765363D9EA1347Afcff6Ae21D6D7B9d36490D0\",\n};\n\n/**\n * Uniswap UniversalRouter — used for AA/batched swaps via PT delegated\n * accounts. Speaks V3 commands (`V3_SWAP_EXACT_IN = 0x00`,\n * `V3_SWAP_EXACT_OUT = 0x01`).\n */\nexport const UNIVERSAL_ROUTER_ADDRESSES: Record<number, Address> = {\n 8453: \"0x008887C992A5bDC24097E717Bfb71CE89483c5A2\",\n};\n\n/**\n * Uniswap V3 SwapRouter — used by `swapDirect`-style flows that bypass\n * the UniversalRouter. Takes `exactInput` / `exactOutput` with packed-bytes\n * paths directly.\n */\nexport const V3_SWAP_ROUTER_ADDRESSES: Record<number, Address> = {\n 8453: \"0xca937aC69708b00B72cc3247440211d8DbDAaFF8\",\n};\n\n/**\n * PAFI's Uniswap V3 factory — used together with `V3_POOL_INIT_CODE_HASH`\n * to derive pool addresses deterministically (`computeV3PoolAddress`).\n */\nexport const V3_FACTORY_ADDRESSES: Record<number, Address> = {\n 8453: \"0x154bAFC6C311f3909080f28438294Cd5184c2924\",\n};\n\n/**\n * Pool-init code hash for PAFI's V3 deployment. Combined with the factory\n * address + sorted tokens + fee, deterministically yields a pool's\n * address via the standard Uniswap V3 CREATE2 derivation.\n */\nexport const V3_POOL_INIT_CODE_HASH: Hex =\n \"0x15380e4800aaa7f219c07d4e07d86cc0e3df225c6a518a1f14f8565f6d9c57c3\";\n\nexport const COMMON_TOKENS: Record<number, Record<string, Address>> = {\n // Base\n 8453: {\n WETH: \"0x4200000000000000000000000000000000000006\",\n USDC: \"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913\",\n USDT: \"0xfde4C96c8593536E31F229EA8f37b2ADa2699bb2\",\n },\n};\n\nexport const COMMON_POOLS: Record<number, PoolKey[]> = {\n // Base — Uniswap V3 pools (PAFI deployment)\n 8453: [\n // WETH/USDC 0.3%\n {\n token0: \"0x4200000000000000000000000000000000000006\",\n token1: \"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913\",\n fee: 3000,\n },\n // WETH/USDC 0.05%\n {\n token0: \"0x4200000000000000000000000000000000000006\",\n token1: \"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913\",\n fee: 500,\n },\n ],\n};\n\nexport const POINT_TOKEN_POOLS: Record<number, Record<Address, PoolKey[]>> = {\n // chainId → pointTokenAddress → PoolKey[]\n};\n\n// -------------------------------------------------------------------------\n// Protocol constants — chain-agnostic (same address on every EVM chain)\n// -------------------------------------------------------------------------\n\n/** ERC-4337 v0.7 EntryPoint — deployed deterministically across all EVM chains. */\nexport const ENTRY_POINT_V07: Address = \"0x0000000071727De22E5E9d8BAf0edAc6f37da032\";\n\n/**\n * ERC-4337 v0.8 EntryPoint — used by Pimlico's `Simple7702Account` impl\n * (`0xe6Cae83BdE06E4c305530e199D7217f42808555B`) and by permissionless's\n * `to7702SimpleSmartAccount`. EIP-7702 delegated EOAs in PAFI's flow\n * point at this EntryPoint, NOT v0.7.\n *\n * Why this matters: account.validateUserOp does\n * `require(msg.sender == entryPoint(), \"account: not from EntryPoint\")`.\n * If the bundler/paymaster sim runs against a different EntryPoint than\n * what the account's `entryPoint()` returns, the require fails and you\n * see `AA23 reverted account: not from EntryPoint`.\n */\nexport const ENTRY_POINT_V08: Address = \"0x4337084d9e255ff0702461cf8895ce9e3b5ff108\";\n\n/** Permit2 — Uniswap's universal approval contract, same address on all EVM chains. */\n// export const PERMIT2_ADDRESS: Address = \"0x000000000022D473030F116dDEE9F6B43aC78BA3\";\n/**\n * Permit2 — PAFI's deployed instance. PAFI ships its own forked deployment.\n */\nexport const PERMIT2_ADDRESS: Address = \"0xEB450d21ae68D3303Cf5775A54Cc84EE7c3fC8eC\";","/**\n * Shared input validator for `verifyMintRequest` /\n * `verifyBurnRequest`'s `options.currentTimeSec`. Centralised so both\n * helpers fail in the same way on bad input — a quiet skip on\n * `NaN` / negative values would defeat the purpose of opting into\n * deadline checking.\n *\n * No-op when `currentTimeSec` is undefined: the caller did not opt in\n * to deadline checking.\n */\nexport function assertValidCurrentTimeSec(\n currentTimeSec: number | undefined,\n): void {\n if (currentTimeSec === undefined) return;\n if (!Number.isFinite(currentTimeSec) || currentTimeSec < 0) {\n throw new Error(\n `verifyDeadline: currentTimeSec must be a finite non-negative number (got ${String(\n currentTimeSec,\n )})`,\n );\n }\n}\n","import { getAddress, parseSignature, recoverTypedDataAddress } from \"viem\";\nimport type { Address, Hex, WalletClient } from \"viem\";\nimport { burnRequestTypes } from \"../constants\";\nimport type {\n BurnRequest,\n EIP712Signature,\n PointTokenDomainConfig,\n SignatureVerification,\n SignatureVerifyOptions,\n} from \"../types\";\nimport { buildDomain } from \"./domain\";\nimport { assertValidCurrentTimeSec } from \"./verifyDeadline\";\n\n/**\n * EIP-712 helpers for `BurnRequest` — consumed by the sig-gated burn\n * path on `PointToken`:\n *\n * burn(address from, uint256 amount, uint256 deadline, bytes burnerSig)\n *\n * Solidity type hash:\n * BurnRequest(address from,uint256 amount,uint256 nonce,uint256 deadline)\n *\n * Issuer backend signs with its burner signer (HSM/KMS). On-chain\n * `msg.sender` must equal `from`, and the recovered signer must be in\n * `burners[]`. Nonce comes from `burnRequestNonces[from]` and is\n * auto-incremented on success.\n */\nexport function buildBurnRequestTypedData(\n domain: PointTokenDomainConfig,\n message: BurnRequest,\n) {\n return {\n domain: buildDomain(domain),\n types: burnRequestTypes,\n primaryType: \"BurnRequest\" as const,\n message,\n };\n}\n\nexport async function signBurnRequest(\n walletClient: WalletClient,\n domain: PointTokenDomainConfig,\n message: BurnRequest,\n): Promise<EIP712Signature> {\n const serialized = await walletClient.signTypedData({\n account: walletClient.account!,\n domain: buildDomain(domain),\n types: burnRequestTypes,\n primaryType: \"BurnRequest\",\n message,\n });\n\n const { v, r, s } = parseSignature(serialized);\n\n return {\n v: Number(v),\n r,\n s,\n serialized,\n };\n}\n\n/**\n * Verify a BurnRequest signature. Symmetric with `verifyMintRequest`:\n * always recovers the signer; opt-in deadline check via\n * `options.currentTimeSec`. See that helper for the full contract.\n */\nexport async function verifyBurnRequest(\n domain: PointTokenDomainConfig,\n message: BurnRequest,\n signature: Hex,\n expectedBurner: Address,\n options?: SignatureVerifyOptions,\n): Promise<SignatureVerification> {\n assertValidCurrentTimeSec(options?.currentTimeSec);\n\n const recoveredAddress = await recoverTypedDataAddress({\n domain: buildDomain(domain),\n types: burnRequestTypes,\n primaryType: \"BurnRequest\",\n message,\n signature,\n });\n\n if (getAddress(recoveredAddress) !== getAddress(expectedBurner)) {\n return { isValid: false, recoveredAddress, reason: \"INVALID_SIGNER\" };\n }\n\n if (\n options?.currentTimeSec !== undefined &&\n message.deadline < BigInt(options.currentTimeSec)\n ) {\n return { isValid: false, recoveredAddress, reason: \"DEADLINE_PASSED\" };\n }\n\n return { isValid: true, recoveredAddress };\n}\n"],"mappings":";;;;;AAQO,SAAS,YAAY,QAAgC;AAC1D,SAAO;AAAA,IACL,MAAM,OAAO;AAAA,IACb,SAAS,OAAO,WAAW;AAAA,IAC3B,SAAS,OAAO;AAAA,IAChB,mBAAmB,OAAO;AAAA,EAC5B;AACF;AAKO,IAAM,4BAAN,cAAwC,MAAM;AAAA,EACnD,YACkB,OACA,UACA,QAChB;AACA;AAAA,MACE,qCAAqC,KAAK,eAAe,QAAQ,SAAS,MAAM;AAAA,IAGlF;AARgB;AACA;AACA;AAOhB,SAAK,OAAO;AAAA,EACd;AAAA,EAVkB;AAAA,EACA;AAAA,EACA;AASpB;AA4BA,eAAsB,4BACpB,QACA,UACe;AACf,QAAM,UAAW,MAAM,OAAO,aAAa;AAAA,IACzC,SAAS,SAAS;AAAA,IAClB,KAAK;AAAA,IACL,cAAc;AAAA,EAChB,CAAC;AAUD,QAAM,CAAC,EAAE,MAAM,SAAS,SAAS,iBAAiB,IAAI;AAEtD,MAAI,SAAS,SAAS,MAAM;AAC1B,UAAM,IAAI,0BAA0B,QAAQ,SAAS,MAAM,IAAI;AAAA,EACjE;AACA,MAAI,YAAY,SAAS,SAAS;AAChC,UAAM,IAAI;AAAA,MACR;AAAA,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B,QAAQ,iBAAiB;AAAA,EACtE;AAEA,MACE,SAAS,mBAAmB,UAC5B,QAAQ,WAAW,OAAO,QAAQ,cAAc,GAChD;AACA,WAAO,EAAE,SAAS,OAAO,kBAAkB,QAAQ,kBAAkB;AAAA,EACvE;AAEA,SAAO,EAAE,SAAS,MAAM,iBAAiB;AAC3C;","names":["getAddress","parseSignature","recoverTypedDataAddress","parseSignature","recoverTypedDataAddress","getAddress"]}