@pafi-dev/core 0.9.6 → 0.13.0

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 (43) hide show
  1. package/README.md +146 -188
  2. package/dist/abi/index.cjs +2 -2
  3. package/dist/abi/index.cjs.map +1 -1
  4. package/dist/abi/index.d.cts +58 -106
  5. package/dist/abi/index.d.ts +58 -106
  6. package/dist/abi/index.js +3 -3
  7. package/dist/{chunk-Y5EYH2SQ.js → chunk-H3X3FYUU.js} +1 -10
  8. package/dist/chunk-H3X3FYUU.js.map +1 -0
  9. package/dist/{chunk-5NEAI2BH.cjs → chunk-NT2ZPF72.cjs} +50 -72
  10. package/dist/chunk-NT2ZPF72.cjs.map +1 -0
  11. package/dist/{chunk-BNO5SM25.cjs → chunk-TRYGIC2I.cjs} +2 -11
  12. package/dist/chunk-TRYGIC2I.cjs.map +1 -0
  13. package/dist/{chunk-HJYHGCMT.js → chunk-UEO4YN6T.js} +53 -75
  14. package/dist/chunk-UEO4YN6T.js.map +1 -0
  15. package/dist/{chunk-MIQA46E3.cjs → chunk-XXLIIWIF.cjs} +45 -53
  16. package/dist/chunk-XXLIIWIF.cjs.map +1 -0
  17. package/dist/{chunk-CWH4KOUW.js → chunk-ZJXXCG5P.js} +45 -53
  18. package/dist/chunk-ZJXXCG5P.js.map +1 -0
  19. package/dist/contract/index.cjs +2 -4
  20. package/dist/contract/index.cjs.map +1 -1
  21. package/dist/contract/index.d.cts +5 -15
  22. package/dist/contract/index.d.ts +5 -15
  23. package/dist/contract/index.js +1 -3
  24. package/dist/eip712/index.cjs +2 -8
  25. package/dist/eip712/index.cjs.map +1 -1
  26. package/dist/eip712/index.d.cts +29 -43
  27. package/dist/eip712/index.d.ts +29 -43
  28. package/dist/eip712/index.js +3 -9
  29. package/dist/index.cjs +141 -158
  30. package/dist/index.cjs.map +1 -1
  31. package/dist/index.d.cts +201 -182
  32. package/dist/index.d.ts +201 -182
  33. package/dist/index.js +135 -152
  34. package/dist/index.js.map +1 -1
  35. package/dist/{types-DWLZNgcw.d.cts → types-C17pznGz.d.cts} +72 -30
  36. package/dist/{types-DWLZNgcw.d.ts → types-C17pznGz.d.ts} +72 -30
  37. package/package.json +15 -5
  38. package/dist/chunk-5NEAI2BH.cjs.map +0 -1
  39. package/dist/chunk-BNO5SM25.cjs.map +0 -1
  40. package/dist/chunk-CWH4KOUW.js.map +0 -1
  41. package/dist/chunk-HJYHGCMT.js.map +0 -1
  42. package/dist/chunk-MIQA46E3.cjs.map +0 -1
  43. package/dist/chunk-Y5EYH2SQ.js.map +0 -1
@@ -3,9 +3,8 @@ import { Address, Hex, WalletClient, PublicClient } from 'viem';
3
3
  /**
4
4
  * MintForRequest(address user,address receiver,uint256 amount,uint256 nonce,uint256 deadline)
5
5
  *
6
- * v1.6 contract typehash. Two new fields vs v1.5:
7
6
  * `user` — off-chain spender; PointToken increments mintRequestNonces[user]
8
- * `receiver` — on-chain caller of PointToken.mint; required `msg.sender == receiver`
7
+ * `receiver` — on-chain caller of PointToken.mint; contract enforces `msg.sender == receiver`
9
8
  *
10
9
  * Direct user mint: user == receiver == EOA
11
10
  * Wrapper-mediated: user = end-user, receiver = MintFeeWrapper address
@@ -24,15 +23,6 @@ interface BurnRequest {
24
23
  nonce: bigint;
25
24
  deadline: bigint;
26
25
  }
27
- /** ReceiverConsent(address onBehalfOf,address originalReceiver,uint256 amount,uint256 nonce,uint256 deadline,bytes extData) */
28
- interface ReceiverConsent {
29
- onBehalfOf: Address;
30
- originalReceiver: Address;
31
- amount: bigint;
32
- nonce: bigint;
33
- deadline: bigint;
34
- extData: Hex;
35
- }
36
26
  interface EIP712Signature {
37
27
  v: number;
38
28
  r: Hex;
@@ -52,9 +42,49 @@ interface PointTokenDomainConfig {
52
42
  */
53
43
  version?: string;
54
44
  }
45
+ /**
46
+ * Why a verification failed. Present on `SignatureVerification` when
47
+ * `isValid === false`. Callers can switch on this to give a useful
48
+ * UX message:
49
+ *
50
+ * - `INVALID_SIGNER` — recovered address does not match the
51
+ * expected signer (forged or wrong-key sig).
52
+ * - `DEADLINE_PASSED` — signature is cryptographically valid but
53
+ * the request's `deadline` has elapsed
54
+ * relative to the caller-supplied
55
+ * `currentTimeSec`. Only reported when the
56
+ * caller opted into deadline checking by
57
+ * passing `currentTimeSec`.
58
+ */
59
+ type SignatureVerificationFailReason = "INVALID_SIGNER" | "DEADLINE_PASSED";
55
60
  interface SignatureVerification {
56
61
  isValid: boolean;
57
62
  recoveredAddress: Address;
63
+ /**
64
+ * Populated only when `isValid === false`. See
65
+ * `SignatureVerificationFailReason` for the meanings.
66
+ */
67
+ reason?: SignatureVerificationFailReason;
68
+ }
69
+ /**
70
+ * Options shared by `verifyMintRequest` / `verifyBurnRequest`. The
71
+ * helpers default to recovering and matching the signer only. Pass
72
+ * `currentTimeSec` (unix seconds) to additionally enforce
73
+ * `deadline >= currentTimeSec` — the same predicate the on-chain
74
+ * contract runs via `block.timestamp <= deadline`.
75
+ *
76
+ * Optional by design:
77
+ * - Backward compatibility for callers already using the 4-arg form.
78
+ * - Different callers want different time sources (server clock for
79
+ * issuer backend, device clock for FE pre-flight, fixed value for
80
+ * deterministic tests / historical replay).
81
+ *
82
+ * The on-chain contract remains the source of truth — this is a
83
+ * pre-flight check to avoid opaque on-chain reverts.
84
+ */
85
+ interface SignatureVerifyOptions {
86
+ /** Unix seconds. Throws if not a finite non-negative number. */
87
+ currentTimeSec?: number;
58
88
  }
59
89
  /** Auto-generated from Solidity struct — do not edit */
60
90
  interface Recipient {
@@ -76,25 +106,35 @@ interface TokenCap {
76
106
  declaredTotalSupply: bigint;
77
107
  capBasisPoints: number;
78
108
  }
79
- /** Auto-generated from Solidity struct — do not edit */
109
+ /**
110
+ * Uniswap V3 pool identifier. Pool addresses are deterministic via
111
+ * `factory + initCodeHash + sortedTokens + fee` — see
112
+ * `computeV3PoolAddress()` in `./utils`.
113
+ *
114
+ * `fee` is the pool's fee tier in hundredths of a basis point (e.g.
115
+ * `3000` = 0.3%). Valid tiers are factory-configured — query
116
+ * `PafiV3Factory.feeAmountTickSpacing(fee)` if you need to enumerate.
117
+ */
80
118
  interface PoolKey {
81
- currency0: Address;
82
- currency1: Address;
119
+ token0: Address;
120
+ token1: Address;
83
121
  fee: number;
84
- tickSpacing: number;
85
- hooks: Address;
86
122
  }
87
123
  /**
88
- * Uniswap V4 PathKey one hop in a multi-hop swap route. Same `fee`
89
- * + `tickSpacing` typing constraints as `PoolKey`.
124
+ * Uniswap V3 packed swap path. Represents a multi-hop route as a
125
+ * sequence of tokens connected by fee tiers. For an N-hop swap,
126
+ * `tokens.length === N + 1` and `fees.length === N`.
127
+ *
128
+ * Encoded on-chain as packed bytes via `encodeV3Path()`:
129
+ * `tokens[0] ‖ fees[0] ‖ tokens[1] ‖ fees[1] ‖ ... ‖ tokens[N]`
130
+ *
131
+ * For exact-input swaps the path is encoded input→output. For
132
+ * exact-output swaps the path is encoded output→input (reversed) —
133
+ * see `quoteExactOutput` / `buildSwapUserOpExactOut`.
90
134
  */
91
- interface PathKey {
92
- intermediateCurrency: Address;
93
- /** uint24 on-chain — number for legibility; bigint accepted. */
94
- fee: number | bigint;
95
- tickSpacing: number;
96
- hooks: Address;
97
- hookData: Hex;
135
+ interface V3Path {
136
+ tokens: Address[];
137
+ fees: number[];
98
138
  }
99
139
  interface ChainConfig {
100
140
  name: string;
@@ -102,7 +142,8 @@ interface ChainConfig {
102
142
  interface QuoteResult {
103
143
  amountOut: bigint;
104
144
  gasEstimate: bigint;
105
- path: PathKey[];
145
+ /** V3 path used to obtain the quote, oriented input→output. */
146
+ path: V3Path;
106
147
  }
107
148
  interface BestQuote {
108
149
  bestRoute: QuoteResult;
@@ -113,10 +154,11 @@ interface ExactOutputQuoteResult {
113
154
  amountIn: bigint;
114
155
  gasEstimate: bigint;
115
156
  /**
116
- * V4 PathKey[] traversed output→input for exact-out quoting (each
117
- * `path[i].intermediateCurrency` is the previous currency in the route).
157
+ * V3 path oriented output→input for exact-out quoting. On-chain this
158
+ * gets packed with the tokens in reverse order so the Quoter walks
159
+ * from the desired output back to the input.
118
160
  */
119
- path: PathKey[];
161
+ path: V3Path;
120
162
  }
121
163
  interface ExactOutputBestQuote {
122
164
  bestRoute: ExactOutputQuoteResult;
@@ -180,4 +222,4 @@ interface RedemptionDecision {
180
222
  preview: RedemptionPreview;
181
223
  }
182
224
 
183
- export type { BestQuote as B, ChainConfig as C, EIP712Signature as E, Issuer as I, MintRequest as M, PoolKey as P, QuoteResult as Q, ReceiverConsent as R, SignatureVerification as S, TokenCap as T, PafiSDKConfig as a, PointTokenDomainConfig as b, BlackoutWindow as c, BurnRequest as d, ExactOutputBestQuote as e, ExactOutputQuoteResult as f, PathKey as g, Recipient as h, RedemptionDecision as i, RedemptionDenial as j, RedemptionDenialCode as k, RedemptionPolicy as l, RedemptionPolicySource as m, RedemptionPreview as n };
225
+ export type { BestQuote as B, ChainConfig as C, EIP712Signature as E, Issuer as I, MintRequest as M, PoolKey as P, QuoteResult as Q, Recipient as R, SignatureVerifyOptions as S, TokenCap as T, V3Path as V, PafiSDKConfig as a, PointTokenDomainConfig as b, SignatureVerification as c, BlackoutWindow as d, BurnRequest as e, ExactOutputBestQuote as f, ExactOutputQuoteResult as g, RedemptionDecision as h, RedemptionDenial as i, RedemptionDenialCode as j, RedemptionPolicy as k, RedemptionPolicySource as l, RedemptionPreview as m, SignatureVerificationFailReason as n };
@@ -3,9 +3,8 @@ import { Address, Hex, WalletClient, PublicClient } from 'viem';
3
3
  /**
4
4
  * MintForRequest(address user,address receiver,uint256 amount,uint256 nonce,uint256 deadline)
5
5
  *
6
- * v1.6 contract typehash. Two new fields vs v1.5:
7
6
  * `user` — off-chain spender; PointToken increments mintRequestNonces[user]
8
- * `receiver` — on-chain caller of PointToken.mint; required `msg.sender == receiver`
7
+ * `receiver` — on-chain caller of PointToken.mint; contract enforces `msg.sender == receiver`
9
8
  *
10
9
  * Direct user mint: user == receiver == EOA
11
10
  * Wrapper-mediated: user = end-user, receiver = MintFeeWrapper address
@@ -24,15 +23,6 @@ interface BurnRequest {
24
23
  nonce: bigint;
25
24
  deadline: bigint;
26
25
  }
27
- /** ReceiverConsent(address onBehalfOf,address originalReceiver,uint256 amount,uint256 nonce,uint256 deadline,bytes extData) */
28
- interface ReceiverConsent {
29
- onBehalfOf: Address;
30
- originalReceiver: Address;
31
- amount: bigint;
32
- nonce: bigint;
33
- deadline: bigint;
34
- extData: Hex;
35
- }
36
26
  interface EIP712Signature {
37
27
  v: number;
38
28
  r: Hex;
@@ -52,9 +42,49 @@ interface PointTokenDomainConfig {
52
42
  */
53
43
  version?: string;
54
44
  }
45
+ /**
46
+ * Why a verification failed. Present on `SignatureVerification` when
47
+ * `isValid === false`. Callers can switch on this to give a useful
48
+ * UX message:
49
+ *
50
+ * - `INVALID_SIGNER` — recovered address does not match the
51
+ * expected signer (forged or wrong-key sig).
52
+ * - `DEADLINE_PASSED` — signature is cryptographically valid but
53
+ * the request's `deadline` has elapsed
54
+ * relative to the caller-supplied
55
+ * `currentTimeSec`. Only reported when the
56
+ * caller opted into deadline checking by
57
+ * passing `currentTimeSec`.
58
+ */
59
+ type SignatureVerificationFailReason = "INVALID_SIGNER" | "DEADLINE_PASSED";
55
60
  interface SignatureVerification {
56
61
  isValid: boolean;
57
62
  recoveredAddress: Address;
63
+ /**
64
+ * Populated only when `isValid === false`. See
65
+ * `SignatureVerificationFailReason` for the meanings.
66
+ */
67
+ reason?: SignatureVerificationFailReason;
68
+ }
69
+ /**
70
+ * Options shared by `verifyMintRequest` / `verifyBurnRequest`. The
71
+ * helpers default to recovering and matching the signer only. Pass
72
+ * `currentTimeSec` (unix seconds) to additionally enforce
73
+ * `deadline >= currentTimeSec` — the same predicate the on-chain
74
+ * contract runs via `block.timestamp <= deadline`.
75
+ *
76
+ * Optional by design:
77
+ * - Backward compatibility for callers already using the 4-arg form.
78
+ * - Different callers want different time sources (server clock for
79
+ * issuer backend, device clock for FE pre-flight, fixed value for
80
+ * deterministic tests / historical replay).
81
+ *
82
+ * The on-chain contract remains the source of truth — this is a
83
+ * pre-flight check to avoid opaque on-chain reverts.
84
+ */
85
+ interface SignatureVerifyOptions {
86
+ /** Unix seconds. Throws if not a finite non-negative number. */
87
+ currentTimeSec?: number;
58
88
  }
59
89
  /** Auto-generated from Solidity struct — do not edit */
60
90
  interface Recipient {
@@ -76,25 +106,35 @@ interface TokenCap {
76
106
  declaredTotalSupply: bigint;
77
107
  capBasisPoints: number;
78
108
  }
79
- /** Auto-generated from Solidity struct — do not edit */
109
+ /**
110
+ * Uniswap V3 pool identifier. Pool addresses are deterministic via
111
+ * `factory + initCodeHash + sortedTokens + fee` — see
112
+ * `computeV3PoolAddress()` in `./utils`.
113
+ *
114
+ * `fee` is the pool's fee tier in hundredths of a basis point (e.g.
115
+ * `3000` = 0.3%). Valid tiers are factory-configured — query
116
+ * `PafiV3Factory.feeAmountTickSpacing(fee)` if you need to enumerate.
117
+ */
80
118
  interface PoolKey {
81
- currency0: Address;
82
- currency1: Address;
119
+ token0: Address;
120
+ token1: Address;
83
121
  fee: number;
84
- tickSpacing: number;
85
- hooks: Address;
86
122
  }
87
123
  /**
88
- * Uniswap V4 PathKey one hop in a multi-hop swap route. Same `fee`
89
- * + `tickSpacing` typing constraints as `PoolKey`.
124
+ * Uniswap V3 packed swap path. Represents a multi-hop route as a
125
+ * sequence of tokens connected by fee tiers. For an N-hop swap,
126
+ * `tokens.length === N + 1` and `fees.length === N`.
127
+ *
128
+ * Encoded on-chain as packed bytes via `encodeV3Path()`:
129
+ * `tokens[0] ‖ fees[0] ‖ tokens[1] ‖ fees[1] ‖ ... ‖ tokens[N]`
130
+ *
131
+ * For exact-input swaps the path is encoded input→output. For
132
+ * exact-output swaps the path is encoded output→input (reversed) —
133
+ * see `quoteExactOutput` / `buildSwapUserOpExactOut`.
90
134
  */
91
- interface PathKey {
92
- intermediateCurrency: Address;
93
- /** uint24 on-chain — number for legibility; bigint accepted. */
94
- fee: number | bigint;
95
- tickSpacing: number;
96
- hooks: Address;
97
- hookData: Hex;
135
+ interface V3Path {
136
+ tokens: Address[];
137
+ fees: number[];
98
138
  }
99
139
  interface ChainConfig {
100
140
  name: string;
@@ -102,7 +142,8 @@ interface ChainConfig {
102
142
  interface QuoteResult {
103
143
  amountOut: bigint;
104
144
  gasEstimate: bigint;
105
- path: PathKey[];
145
+ /** V3 path used to obtain the quote, oriented input→output. */
146
+ path: V3Path;
106
147
  }
107
148
  interface BestQuote {
108
149
  bestRoute: QuoteResult;
@@ -113,10 +154,11 @@ interface ExactOutputQuoteResult {
113
154
  amountIn: bigint;
114
155
  gasEstimate: bigint;
115
156
  /**
116
- * V4 PathKey[] traversed output→input for exact-out quoting (each
117
- * `path[i].intermediateCurrency` is the previous currency in the route).
157
+ * V3 path oriented output→input for exact-out quoting. On-chain this
158
+ * gets packed with the tokens in reverse order so the Quoter walks
159
+ * from the desired output back to the input.
118
160
  */
119
- path: PathKey[];
161
+ path: V3Path;
120
162
  }
121
163
  interface ExactOutputBestQuote {
122
164
  bestRoute: ExactOutputQuoteResult;
@@ -180,4 +222,4 @@ interface RedemptionDecision {
180
222
  preview: RedemptionPreview;
181
223
  }
182
224
 
183
- export type { BestQuote as B, ChainConfig as C, EIP712Signature as E, Issuer as I, MintRequest as M, PoolKey as P, QuoteResult as Q, ReceiverConsent as R, SignatureVerification as S, TokenCap as T, PafiSDKConfig as a, PointTokenDomainConfig as b, BlackoutWindow as c, BurnRequest as d, ExactOutputBestQuote as e, ExactOutputQuoteResult as f, PathKey as g, Recipient as h, RedemptionDecision as i, RedemptionDenial as j, RedemptionDenialCode as k, RedemptionPolicy as l, RedemptionPolicySource as m, RedemptionPreview as n };
225
+ export type { BestQuote as B, ChainConfig as C, EIP712Signature as E, Issuer as I, MintRequest as M, PoolKey as P, QuoteResult as Q, Recipient as R, SignatureVerifyOptions as S, TokenCap as T, V3Path as V, PafiSDKConfig as a, PointTokenDomainConfig as b, SignatureVerification as c, BlackoutWindow as d, BurnRequest as e, ExactOutputBestQuote as f, ExactOutputQuoteResult as g, RedemptionDecision as h, RedemptionDenial as i, RedemptionDenialCode as j, RedemptionPolicy as k, RedemptionPolicySource as l, RedemptionPreview as m, SignatureVerificationFailReason as n };
package/package.json CHANGED
@@ -1,7 +1,16 @@
1
1
  {
2
2
  "name": "@pafi-dev/core",
3
- "version": "0.9.6",
4
- "description": "EIP-712 signing, contract interaction, and Relay calldata for the PAFI point token system",
3
+ "version": "0.13.0",
4
+ "description": "EIP-712 signing, contract interaction, Uniswap V3 path helpers, and ERC-4337 UserOp building for the PAFI point token system",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/Pacific-Finance-Lab/pafi-sdk.git",
8
+ "directory": "packages/core"
9
+ },
10
+ "homepage": "https://github.com/Pacific-Finance-Lab/pafi-sdk/tree/main/packages/core#readme",
11
+ "bugs": {
12
+ "url": "https://github.com/Pacific-Finance-Lab/pafi-sdk/issues"
13
+ },
5
14
  "type": "module",
6
15
  "main": "./dist/index.cjs",
7
16
  "module": "./dist/index.js",
@@ -65,10 +74,11 @@
65
74
  "viem": "^2.0.0"
66
75
  },
67
76
  "devDependencies": {
77
+ "@vitest/coverage-v8": "^2.1.0",
78
+ "tsup": "^8.0.0",
68
79
  "tsx": "^4.0.0",
69
- "viem": "^2.21.0",
70
80
  "typescript": "^5.5.0",
71
- "tsup": "^8.0.0",
81
+ "viem": "^2.21.0",
72
82
  "vitest": "^2.0.0"
73
83
  },
74
84
  "license": "Apache-2.0",
@@ -77,7 +87,7 @@
77
87
  "build": "tsup",
78
88
  "test": "vitest run",
79
89
  "test:watch": "vitest",
80
- "test:integration": "vitest run --config vitest.integration.config.ts",
90
+ "test:cov": "vitest run --coverage",
81
91
  "test:fork": "vitest run --config vitest.fork.config.ts",
82
92
  "typecheck": "tsc --noEmit"
83
93
  }
@@ -1 +0,0 @@
1
- {"version":3,"sources":["/Users/phitran/Pacific-Finance/pafi-backend/pafi-sdk/packages/core/dist/chunk-5NEAI2BH.cjs","../src/eip712/domain.ts","../src/eip712/mintRequest.ts","../src/constants.ts","../src/eip712/burnRequest.ts","../src/eip712/receiverConsent.ts"],"names":["parseSignature","recoverTypedDataAddress","getAddress"],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACA;ACIO,SAAS,WAAA,CAAY,MAAA,EAAgC;AAC1D,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,MAAA,CAAO,IAAA;AAAA,IACb,OAAA,mBAAS,MAAA,CAAO,OAAA,UAAW,KAAA;AAAA,IAC3B,OAAA,EAAS,MAAA,CAAO,OAAA;AAAA,IAChB,iBAAA,EAAmB,MAAA,CAAO;AAAA,EAC5B,CAAA;AACF;AAKO,IAAM,0BAAA,EAAN,MAAA,QAAwC,MAAM;AAAA,EACnD,WAAA,CACkB,KAAA,EACA,QAAA,EACA,MAAA,EAChB;AACA,IAAA,KAAA;AAAA,MACE,CAAA,kCAAA,EAAqC,KAAK,CAAA,YAAA,EAAe,QAAQ,CAAA,MAAA,EAAS,MAAM,CAAA,uKAAA;AAAA,IAGlF,CAAA;AARgB,IAAA,IAAA,CAAA,MAAA,EAAA,KAAA;AACA,IAAA,IAAA,CAAA,SAAA,EAAA,QAAA;AACA,IAAA,IAAA,CAAA,OAAA,EAAA,MAAA;AAOhB,IAAA,IAAA,CAAK,KAAA,EAAO,2BAAA;AAAA,EACd;AAAA,EAVkB;AAAA,EACA;AAAA,EACA;AASpB,CAAA;AA4BA,MAAA,SAAsB,2BAAA,CACpB,MAAA,EACA,QAAA,EACe;AACf,EAAA,MAAM,QAAA,EAAW,MAAM,MAAA,CAAO,YAAA,CAAa;AAAA,IACzC,OAAA,EAAS,QAAA,CAAS,iBAAA;AAAA,IAClB,GAAA,EAAK,+BAAA;AAAA,IACL,YAAA,EAAc;AAAA,EAChB,CAAC,CAAA;AAUD,EAAA,MAAM,CAAC,EAAE,IAAA,EAAM,OAAA,EAAS,OAAA,EAAS,iBAAiB,EAAA,EAAI,OAAA;AAEtD,EAAA,GAAA,CAAI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AA,EACA,OAAA,EACA,SAAA,EACA,gBAAA,EACgC;AAChC,EAAA,MAAM,iBAAA,EAAmB,MAAMC,2CAAAA;AAAwB,IACrD,MAAA,EAAQ,WAAA,CAAY,MAAM,CAAA;AAAA,IAC1B,KAAA,EAAO,oBAAA;AAAA,IACP,WAAA,EAAa,iBAAA;AAAA,IACb,OAAA;AAAA,IACA;AAAA,EACF,CAAC,CAAA;AAED,EAAA,MAAM,QAAA,EAAUC,8BAAAA,gBAA2B,EAAA,IAAMA,8BAAAA,gBAA2B,CAAA;AAE5E,EAAA,OAAO,EAAE,OAAA,EAAS,iBAAiB,CAAA;AACrC;AL0LA;AACA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,mrCAAC","file":"/Users/phitran/Pacific-Finance/pafi-backend/pafi-sdk/packages/core/dist/chunk-5NEAI2BH.cjs","sourcesContent":[null,"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} from \"../types\";\nimport { buildDomain } from \"./domain\";\n\nconst PRIMARY_TYPE = \"MintForRequest\" as const;\n\n/**\n * Build the EIP-712 typed data object for a v1.6 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 v1.6 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\nexport async function verifyMintRequest(\n domain: PointTokenDomainConfig,\n message: MintRequest,\n signature: Hex,\n expectedMinter: Address,\n): Promise<SignatureVerification> {\n const recoveredAddress = await recoverTypedDataAddress({\n domain: buildDomain(domain),\n types: mintRequestTypes,\n primaryType: PRIMARY_TYPE,\n message,\n signature,\n });\n\n const isValid = getAddress(recoveredAddress) === getAddress(expectedMinter);\n\n return { isValid, recoveredAddress };\n}\n","import type { Address } 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 v1.6 sig-gated mint path.\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: \"nonce\", type: \"uint256\" },\n { name: \"deadline\", type: \"uint256\" },\n ],\n} as const;\n\nexport const burnRequestTypes = {\n BurnRequest: [\n { name: \"from\", type: \"address\" },\n { name: \"amount\", type: \"uint256\" },\n { name: \"nonce\", type: \"uint256\" },\n { name: \"deadline\", type: \"uint256\" },\n ],\n} as const;\n\nexport const receiverConsentTypes = {\n ReceiverConsent: [\n { name: \"onBehalfOf\", type: \"address\" },\n { name: \"originalReceiver\", type: \"address\" },\n { name: \"amount\", type: \"uint256\" },\n { name: \"nonce\", type: \"uint256\" },\n { name: \"deadline\", type: \"uint256\" },\n { name: \"extData\", type: \"bytes\" },\n ],\n} as const;\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\nexport const V4_QUOTER_ADDRESSES: Record<number, Address> = {\n 8453: \"0x0d5e0f971ed27fbff6c2837bf31316121532048d\",\n};\n\nexport const UNIVERSAL_ROUTER_ADDRESSES: Record<number, Address> = {\n 8453: \"0x6ff5693b99212da76ad316178a184ab56d299b43\",\n};\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 — existing Uniswap V4 pools\n 8453: [\n // WETH/USDC 0.3%\n {\n currency0: \"0x4200000000000000000000000000000000000006\",\n currency1: \"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913\",\n fee: 3000,\n tickSpacing: 60,\n hooks: \"0x0000000000000000000000000000000000000000\",\n },\n // WETH/USDC 0.05%\n {\n currency0: \"0x4200000000000000000000000000000000000006\",\n currency1: \"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913\",\n fee: 500,\n tickSpacing: 10,\n hooks: \"0x0000000000000000000000000000000000000000\",\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. */\nexport const PERMIT2_ADDRESS: Address = \"0x000000000022D473030F116dDEE9F6B43aC78BA3\";\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} from \"../types\";\nimport { buildDomain } from \"./domain\";\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\nexport async function verifyBurnRequest(\n domain: PointTokenDomainConfig,\n message: BurnRequest,\n signature: Hex,\n expectedBurner: Address,\n): Promise<SignatureVerification> {\n const recoveredAddress = await recoverTypedDataAddress({\n domain: buildDomain(domain),\n types: burnRequestTypes,\n primaryType: \"BurnRequest\",\n message,\n signature,\n });\n\n const isValid = getAddress(recoveredAddress) === getAddress(expectedBurner);\n\n return { isValid, recoveredAddress };\n}\n","import { getAddress, parseSignature, recoverTypedDataAddress } from \"viem\";\nimport type { Address, Hex, WalletClient } from \"viem\";\nimport { receiverConsentTypes } from \"../constants\";\nimport type { EIP712Signature, PointTokenDomainConfig, ReceiverConsent, SignatureVerification } from \"../types\";\nimport { buildDomain } from \"./domain\";\n\n/**\n * Build the EIP-712 typed data object for a ReceiverConsent.\n * Returns the standard `{ domain, types, primaryType, message }` structure\n * that any EIP-712 signer (viem, ethers, Privy, WalletConnect) can consume.\n */\nexport function buildReceiverConsentTypedData(\n domain: PointTokenDomainConfig,\n message: ReceiverConsent,\n) {\n return {\n domain: buildDomain(domain),\n types: receiverConsentTypes,\n primaryType: \"ReceiverConsent\" as const,\n message,\n };\n}\n\nexport async function signReceiverConsent(\n walletClient: WalletClient,\n domain: PointTokenDomainConfig,\n message: ReceiverConsent,\n): Promise<EIP712Signature> {\n const serialized = await walletClient.signTypedData({\n account: walletClient.account!,\n domain: buildDomain(domain),\n types: receiverConsentTypes,\n primaryType: \"ReceiverConsent\",\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\nexport async function verifyReceiverConsent(\n domain: PointTokenDomainConfig,\n message: ReceiverConsent,\n signature: Hex,\n expectedReceiver: Address,\n): Promise<SignatureVerification> {\n const recoveredAddress = await recoverTypedDataAddress({\n domain: buildDomain(domain),\n types: receiverConsentTypes,\n primaryType: \"ReceiverConsent\",\n message,\n signature,\n });\n\n const isValid = getAddress(recoveredAddress) === getAddress(expectedReceiver);\n\n return { isValid, recoveredAddress };\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["/Users/phitran/Pacific-Finance/pafi-backend/pafi-sdk/packages/core/dist/chunk-BNO5SM25.cjs","../src/contract/pointToken.ts","../src/contract/issuerRegistry.ts","../src/contract/mintingOracle.ts","../src/contract/mintFeeWrapper.ts"],"names":["getIssuer"],"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,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W,GAAA,CAAI,CAAC,CAAA,EAAA,GAAA,CAAO;AAAA,IAC5B,OAAA,EAAS,CAAA,CAAE,OAAA;AAAA,IACX,WAAA,EAAa,MAAA,CAAO,CAAA,CAAE,WAAW;AAAA,EACnC,CAAA,CAAE,CAAA;AACJ;AJqHA;AACA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,kqBAAC","file":"/Users/phitran/Pacific-Finance/pafi-backend/pafi-sdk/packages/core/dist/chunk-BNO5SM25.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\n/**\n * Read the receiver consent nonce for EIP-712 `ReceiverConsent` signing.\n *\n * NOTE: `receiverConsentNonces` was removed from the deployed ABI in the\n * latest Foundry build. Pending SC confirmation on whether `nonces(owner)`\n * is the replacement or if a separate mapping will be re-added.\n * Using `nonces` as a fallback until confirmed.\n */\nexport async function getReceiverConsentNonce(\n client: PublicClient,\n pointToken: Address,\n receiver: Address,\n): Promise<bigint> {\n return client.readContract({\n address: pointToken,\n abi: pointTokenAbi,\n functionName: \"nonces\",\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` — workaround for a viem decoding bug\n * (≤ 2.48.x) where `outputs: [{ type: 'tuple', components: [...] }]` with\n * mixed static + dynamic fields throws `IntegerOutOfRangeError` because\n * viem expects an outer offset that the actual on-chain return doesn't\n * carry (Solidity inlines `returns (Struct)` at the wire level).\n *\n * Using flat outputs (one entry per struct field) matches the on-chain\n * encoding and decodes correctly. We rebuild the named struct from the\n * resulting array.\n */\nconst GET_ISSUER_FLAT_ABI = [\n {\n type: \"function\",\n name: \"getIssuer\",\n inputs: [{ name: \"issuer\", type: \"address\" }],\n outputs: [\n { name: \"issuerAddress\", type: \"address\" },\n { name: \"signerAddress\", type: \"address\" },\n { name: \"name\", type: \"string\" },\n { name: \"symbol\", type: \"string\" },\n { name: \"active\", type: \"bool\" },\n { name: \"pointToken\", type: \"address\" },\n { name: \"mintingOracle\", type: \"address\" },\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 [\n Address,\n Address,\n string,\n string,\n boolean,\n Address,\n Address,\n ];\n return {\n issuerAddress: result[0],\n signerAddress: result[1],\n name: result[2],\n symbol: result[3],\n active: result[4],\n pointToken: result[5],\n mintingOracle: result[6],\n } as 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","import type { Address, PublicClient } from \"viem\";\nimport { mintingOracleAbi } from \"../abi/mintingOracle\";\n\n/**\n * verifyMintCap signature changed in v1.6 (commit cc26f62) — now takes\n * `pointToken` as the first arg so the oracle can look up the per-token\n * cap. Reverts if the cap would be exceeded.\n */\nexport async function verifyMintCap(\n client: PublicClient,\n oracleAddress: Address,\n pointToken: Address,\n issuer: Address,\n amount: bigint,\n): Promise<void> {\n await client.readContract({\n address: oracleAddress,\n abi: mintingOracleAbi,\n functionName: \"verifyMintCap\",\n args: [pointToken, issuer, amount],\n });\n}\n\nexport async function getPointTokenIssuer(\n client: PublicClient,\n oracleAddress: Address,\n pointToken: Address,\n): Promise<Address> {\n return client.readContract({\n address: oracleAddress,\n abi: mintingOracleAbi,\n functionName: \"pointTokenToIssuer\",\n args: [pointToken],\n });\n}\n\n/**\n * v1.6 — read the per-PointToken cap config from the oracle. Returns\n * `{ declaredTotalSupply, capBasisPoints }`. The on-chain `_mint` path\n * computes `hardCap = declaredTotalSupply * capBasisPoints / 10000` and\n * reverts if `mintedSupply + amount > hardCap`. Issuers replicate this\n * math at pre-validate time to fail fast before the user signs.\n *\n * Returns `{ 0n, 0 }` when the token is not registered with the oracle —\n * caller treats that as \"no cap configured\", which means mints will\n * always revert on-chain (the oracle requires a non-zero cap).\n */\nexport async function getTokenCap(\n client: PublicClient,\n oracleAddress: Address,\n pointToken: Address,\n): Promise<{ declaredTotalSupply: bigint; capBasisPoints: number }> {\n const cap = await client.readContract({\n address: oracleAddress,\n abi: mintingOracleAbi,\n functionName: \"tokenCaps\",\n args: [pointToken],\n });\n return {\n declaredTotalSupply: cap.declaredTotalSupply,\n capBasisPoints: Number(cap.capBasisPoints),\n };\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 +0,0 @@
1
- {"version":3,"sources":["../src/abi/pointTokenFactory.ts","../src/abi/erc20.ts","../src/abi/universalRouter.ts","../src/abi/permit2.ts","../src/abi/v4Quoter.ts"],"sourcesContent":["/** ABI for PointTokenFactory (EIP-1167 proxy cloning, UUPS upgradeable) — auto-generated from Foundry artifacts, do not edit */\nexport const pointTokenFactoryAbi = [\n {\n \"type\": \"constructor\",\n \"inputs\": [],\n \"stateMutability\": \"nonpayable\"\n },\n {\n \"type\": \"function\",\n \"name\": \"UPGRADE_INTERFACE_VERSION\",\n \"inputs\": [],\n \"outputs\": [\n {\n \"name\": \"\",\n \"type\": \"string\",\n \"internalType\": \"string\"\n }\n ],\n \"stateMutability\": \"view\"\n },\n {\n \"type\": \"function\",\n \"name\": \"acceptOwnership\",\n \"inputs\": [],\n \"outputs\": [],\n \"stateMutability\": \"nonpayable\"\n },\n {\n \"type\": \"function\",\n \"name\": \"createToken\",\n \"inputs\": [\n {\n \"name\": \"tokenOwner\",\n \"type\": \"address\",\n \"internalType\": \"address\"\n },\n {\n \"name\": \"issuer\",\n \"type\": \"address\",\n \"internalType\": \"address\"\n },\n {\n \"name\": \"signerAddress\",\n \"type\": \"address\",\n \"internalType\": \"address\"\n },\n {\n \"name\": \"name\",\n \"type\": \"string\",\n \"internalType\": \"string\"\n },\n {\n \"name\": \"symbol\",\n \"type\": \"string\",\n \"internalType\": \"string\"\n }\n ],\n \"outputs\": [\n {\n \"name\": \"token\",\n \"type\": \"address\",\n \"internalType\": \"address\"\n },\n {\n \"name\": \"\",\n \"type\": \"address\",\n \"internalType\": \"address\"\n }\n ],\n \"stateMutability\": \"nonpayable\"\n },\n {\n \"type\": \"function\",\n \"name\": \"initialize\",\n \"inputs\": [\n {\n \"name\": \"initialOwner\",\n \"type\": \"address\",\n \"internalType\": \"address\"\n },\n {\n \"name\": \"_issuerRegistry\",\n \"type\": \"address\",\n \"internalType\": \"address\"\n },\n {\n \"name\": \"_mintingOracle\",\n \"type\": \"address\",\n \"internalType\": \"address\"\n },\n {\n \"name\": \"_tokenImplementation\",\n \"type\": \"address\",\n \"internalType\": \"address\"\n }\n ],\n \"outputs\": [],\n \"stateMutability\": \"nonpayable\"\n },\n {\n \"type\": \"function\",\n \"name\": \"issuerRegistry\",\n \"inputs\": [],\n \"outputs\": [\n {\n \"name\": \"\",\n \"type\": \"address\",\n \"internalType\": \"address\"\n }\n ],\n \"stateMutability\": \"view\"\n },\n {\n \"type\": \"function\",\n \"name\": \"mintingOracle\",\n \"inputs\": [],\n \"outputs\": [\n {\n \"name\": \"\",\n \"type\": \"address\",\n \"internalType\": \"address\"\n }\n ],\n \"stateMutability\": \"view\"\n },\n {\n \"type\": \"function\",\n \"name\": \"owner\",\n \"inputs\": [],\n \"outputs\": [\n {\n \"name\": \"\",\n \"type\": \"address\",\n \"internalType\": \"address\"\n }\n ],\n \"stateMutability\": \"view\"\n },\n {\n \"type\": \"function\",\n \"name\": \"pendingOwner\",\n \"inputs\": [],\n \"outputs\": [\n {\n \"name\": \"\",\n \"type\": \"address\",\n \"internalType\": \"address\"\n }\n ],\n \"stateMutability\": \"view\"\n },\n {\n \"type\": \"function\",\n \"name\": \"proxiableUUID\",\n \"inputs\": [],\n \"outputs\": [\n {\n \"name\": \"\",\n \"type\": \"bytes32\",\n \"internalType\": \"bytes32\"\n }\n ],\n \"stateMutability\": \"view\"\n },\n {\n \"type\": \"function\",\n \"name\": \"renounceOwnership\",\n \"inputs\": [],\n \"outputs\": [],\n \"stateMutability\": \"nonpayable\"\n },\n {\n \"type\": \"function\",\n \"name\": \"setMintingOracle\",\n \"inputs\": [\n {\n \"name\": \"_mintingOracle\",\n \"type\": \"address\",\n \"internalType\": \"address\"\n }\n ],\n \"outputs\": [],\n \"stateMutability\": \"nonpayable\"\n },\n {\n \"type\": \"function\",\n \"name\": \"setTokenImplementationAddress\",\n \"inputs\": [\n {\n \"name\": \"impl\",\n \"type\": \"address\",\n \"internalType\": \"address\"\n }\n ],\n \"outputs\": [],\n \"stateMutability\": \"nonpayable\"\n },\n {\n \"type\": \"function\",\n \"name\": \"tokenImplementation\",\n \"inputs\": [],\n \"outputs\": [\n {\n \"name\": \"\",\n \"type\": \"address\",\n \"internalType\": \"address\"\n }\n ],\n \"stateMutability\": \"view\"\n },\n {\n \"type\": \"function\",\n \"name\": \"transferOwnership\",\n \"inputs\": [\n {\n \"name\": \"newOwner\",\n \"type\": \"address\",\n \"internalType\": \"address\"\n }\n ],\n \"outputs\": [],\n \"stateMutability\": \"nonpayable\"\n },\n {\n \"type\": \"function\",\n \"name\": \"upgradeToAndCall\",\n \"inputs\": [\n {\n \"name\": \"newImplementation\",\n \"type\": \"address\",\n \"internalType\": \"address\"\n },\n {\n \"name\": \"data\",\n \"type\": \"bytes\",\n \"internalType\": \"bytes\"\n }\n ],\n \"outputs\": [],\n \"stateMutability\": \"payable\"\n },\n {\n \"type\": \"event\",\n \"name\": \"Initialized\",\n \"inputs\": [\n {\n \"name\": \"version\",\n \"type\": \"uint64\",\n \"indexed\": false,\n \"internalType\": \"uint64\"\n }\n ],\n \"anonymous\": false\n },\n {\n \"type\": \"event\",\n \"name\": \"MintingOracleUpdated\",\n \"inputs\": [\n {\n \"name\": \"mintingOracle\",\n \"type\": \"address\",\n \"indexed\": true,\n \"internalType\": \"address\"\n }\n ],\n \"anonymous\": false\n },\n {\n \"type\": \"event\",\n \"name\": \"OwnershipTransferStarted\",\n \"inputs\": [\n {\n \"name\": \"previousOwner\",\n \"type\": \"address\",\n \"indexed\": true,\n \"internalType\": \"address\"\n },\n {\n \"name\": \"newOwner\",\n \"type\": \"address\",\n \"indexed\": true,\n \"internalType\": \"address\"\n }\n ],\n \"anonymous\": false\n },\n {\n \"type\": \"event\",\n \"name\": \"OwnershipTransferred\",\n \"inputs\": [\n {\n \"name\": \"previousOwner\",\n \"type\": \"address\",\n \"indexed\": true,\n \"internalType\": \"address\"\n },\n {\n \"name\": \"newOwner\",\n \"type\": \"address\",\n \"indexed\": true,\n \"internalType\": \"address\"\n }\n ],\n \"anonymous\": false\n },\n {\n \"type\": \"event\",\n \"name\": \"TokenCreated\",\n \"inputs\": [\n {\n \"name\": \"issuer\",\n \"type\": \"address\",\n \"indexed\": true,\n \"internalType\": \"address\"\n },\n {\n \"name\": \"token\",\n \"type\": \"address\",\n \"indexed\": true,\n \"internalType\": \"address\"\n }\n ],\n \"anonymous\": false\n },\n {\n \"type\": \"event\",\n \"name\": \"TokenImplementationAddressUpdated\",\n \"inputs\": [\n {\n \"name\": \"tokenImplementation\",\n \"type\": \"address\",\n \"indexed\": true,\n \"internalType\": \"address\"\n }\n ],\n \"anonymous\": false\n },\n {\n \"type\": \"event\",\n \"name\": \"Upgraded\",\n \"inputs\": [\n {\n \"name\": \"implementation\",\n \"type\": \"address\",\n \"indexed\": true,\n \"internalType\": \"address\"\n }\n ],\n \"anonymous\": false\n },\n {\n \"type\": \"error\",\n \"name\": \"AddressEmptyCode\",\n \"inputs\": [\n {\n \"name\": \"target\",\n \"type\": \"address\",\n \"internalType\": \"address\"\n }\n ]\n },\n {\n \"type\": \"error\",\n \"name\": \"ERC1967InvalidImplementation\",\n \"inputs\": [\n {\n \"name\": \"implementation\",\n \"type\": \"address\",\n \"internalType\": \"address\"\n }\n ]\n },\n {\n \"type\": \"error\",\n \"name\": \"ERC1967NonPayable\",\n \"inputs\": []\n },\n {\n \"type\": \"error\",\n \"name\": \"FailedCall\",\n \"inputs\": []\n },\n {\n \"type\": \"error\",\n \"name\": \"FailedDeployment\",\n \"inputs\": []\n },\n {\n \"type\": \"error\",\n \"name\": \"ImplementationNotSet\",\n \"inputs\": []\n },\n {\n \"type\": \"error\",\n \"name\": \"InsufficientBalance\",\n \"inputs\": [\n {\n \"name\": \"balance\",\n \"type\": \"uint256\",\n \"internalType\": \"uint256\"\n },\n {\n \"name\": \"needed\",\n \"type\": \"uint256\",\n \"internalType\": \"uint256\"\n }\n ]\n },\n {\n \"type\": \"error\",\n \"name\": \"InvalidInitialization\",\n \"inputs\": []\n },\n {\n \"type\": \"error\",\n \"name\": \"MintingOracleNotSet\",\n \"inputs\": []\n },\n {\n \"type\": \"error\",\n \"name\": \"NotInitializing\",\n \"inputs\": []\n },\n {\n \"type\": \"error\",\n \"name\": \"OnlyIssuerRegistry\",\n \"inputs\": []\n },\n {\n \"type\": \"error\",\n \"name\": \"OwnableInvalidOwner\",\n \"inputs\": [\n {\n \"name\": \"owner\",\n \"type\": \"address\",\n \"internalType\": \"address\"\n }\n ]\n },\n {\n \"type\": \"error\",\n \"name\": \"OwnableUnauthorizedAccount\",\n \"inputs\": [\n {\n \"name\": \"account\",\n \"type\": \"address\",\n \"internalType\": \"address\"\n }\n ]\n },\n {\n \"type\": \"error\",\n \"name\": \"UUPSUnauthorizedCallContext\",\n \"inputs\": []\n },\n {\n \"type\": \"error\",\n \"name\": \"UUPSUnsupportedProxiableUUID\",\n \"inputs\": [\n {\n \"name\": \"slot\",\n \"type\": \"bytes32\",\n \"internalType\": \"bytes32\"\n }\n ]\n },\n {\n \"type\": \"error\",\n \"name\": \"ZeroAddress\",\n \"inputs\": []\n }\n] as const;\n","export const erc20Abi = [\n {\n type: \"function\",\n name: \"name\",\n stateMutability: \"view\",\n inputs: [],\n outputs: [{ name: \"\", type: \"string\" }],\n },\n {\n type: \"function\",\n name: \"symbol\",\n stateMutability: \"view\",\n inputs: [],\n outputs: [{ name: \"\", type: \"string\" }],\n },\n {\n type: \"function\",\n name: \"decimals\",\n stateMutability: \"view\",\n inputs: [],\n outputs: [{ name: \"\", type: \"uint8\" }],\n },\n {\n type: \"function\",\n name: \"totalSupply\",\n stateMutability: \"view\",\n inputs: [],\n outputs: [{ name: \"\", type: \"uint256\" }],\n },\n {\n type: \"function\",\n name: \"balanceOf\",\n stateMutability: \"view\",\n inputs: [{ name: \"account\", type: \"address\" }],\n outputs: [{ name: \"\", type: \"uint256\" }],\n },\n {\n type: \"function\",\n name: \"transfer\",\n stateMutability: \"nonpayable\",\n inputs: [\n { name: \"to\", type: \"address\" },\n { name: \"amount\", type: \"uint256\" },\n ],\n outputs: [{ name: \"\", type: \"bool\" }],\n },\n {\n type: \"function\",\n name: \"approve\",\n stateMutability: \"nonpayable\",\n inputs: [\n { name: \"spender\", type: \"address\" },\n { name: \"amount\", type: \"uint256\" },\n ],\n outputs: [{ name: \"\", type: \"bool\" }],\n },\n {\n type: \"function\",\n name: \"allowance\",\n stateMutability: \"view\",\n inputs: [\n { name: \"owner\", type: \"address\" },\n { name: \"spender\", type: \"address\" },\n ],\n outputs: [{ name: \"\", type: \"uint256\" }],\n },\n {\n type: \"function\",\n name: \"transferFrom\",\n stateMutability: \"nonpayable\",\n inputs: [\n { name: \"from\", type: \"address\" },\n { name: \"to\", type: \"address\" },\n { name: \"amount\", type: \"uint256\" },\n ],\n outputs: [{ name: \"\", type: \"bool\" }],\n },\n {\n type: \"event\",\n name: \"Transfer\",\n inputs: [\n { name: \"from\", type: \"address\", indexed: true },\n { name: \"to\", type: \"address\", indexed: true },\n { name: \"value\", type: \"uint256\", indexed: false },\n ],\n },\n {\n type: \"event\",\n name: \"Approval\",\n inputs: [\n { name: \"owner\", type: \"address\", indexed: true },\n { name: \"spender\", type: \"address\", indexed: true },\n { name: \"value\", type: \"uint256\", indexed: false },\n ],\n },\n] as const;\n","export const universalRouterAbi = [\n {\n type: \"function\",\n name: \"execute\",\n stateMutability: \"payable\",\n inputs: [\n { name: \"commands\", type: \"bytes\" },\n { name: \"inputs\", type: \"bytes[]\" },\n { name: \"deadline\", type: \"uint256\" },\n ],\n outputs: [],\n },\n] as const;\n","export const permit2Abi = [\n {\n type: \"function\",\n name: \"approve\",\n stateMutability: \"nonpayable\",\n inputs: [\n { name: \"token\", type: \"address\" },\n { name: \"spender\", type: \"address\" },\n { name: \"amount\", type: \"uint160\" },\n { name: \"expiration\", type: \"uint48\" },\n ],\n outputs: [],\n },\n] as const;\n","// IV4Quoter — Uniswap V4 Quoter interface\n\nconst poolKeyComponents = [\n { name: \"currency0\", type: \"address\" },\n { name: \"currency1\", type: \"address\" },\n { name: \"fee\", type: \"uint24\" },\n { name: \"tickSpacing\", type: \"int24\" },\n { name: \"hooks\", type: \"address\" },\n] as const;\n\nconst pathKeyComponents = [\n { name: \"intermediateCurrency\", type: \"address\" },\n { name: \"fee\", type: \"uint24\" },\n { name: \"tickSpacing\", type: \"int24\" },\n { name: \"hooks\", type: \"address\" },\n { name: \"hookData\", type: \"bytes\" },\n] as const;\n\nexport const v4QuoterAbi = [\n // quoteExactInputSingle — single-hop quote\n {\n type: \"function\",\n name: \"quoteExactInputSingle\",\n stateMutability: \"nonpayable\",\n inputs: [\n {\n name: \"params\",\n type: \"tuple\",\n components: [\n { name: \"poolKey\", type: \"tuple\", components: poolKeyComponents },\n { name: \"zeroForOne\", type: \"bool\" },\n { name: \"exactAmount\", type: \"uint128\" },\n { name: \"hookData\", type: \"bytes\" },\n ],\n },\n ],\n outputs: [\n { name: \"amountOut\", type: \"uint256\" },\n { name: \"gasEstimate\", type: \"uint256\" },\n ],\n },\n // quoteExactInput — multi-hop quote\n {\n type: \"function\",\n name: \"quoteExactInput\",\n stateMutability: \"nonpayable\",\n inputs: [\n {\n name: \"params\",\n type: \"tuple\",\n components: [\n { name: \"exactCurrency\", type: \"address\" },\n { name: \"path\", type: \"tuple[]\", components: pathKeyComponents },\n { name: \"exactAmount\", type: \"uint128\" },\n ],\n },\n ],\n outputs: [\n { name: \"amountOut\", type: \"uint256\" },\n { name: \"gasEstimate\", type: \"uint256\" },\n ],\n },\n // quoteExactOutputSingle — single-hop exact-output quote\n // For exact-output, `exactAmount` is the desired OUTPUT amount; the\n // function returns the INPUT amount required to obtain it.\n {\n type: \"function\",\n name: \"quoteExactOutputSingle\",\n stateMutability: \"nonpayable\",\n inputs: [\n {\n name: \"params\",\n type: \"tuple\",\n components: [\n { name: \"poolKey\", type: \"tuple\", components: poolKeyComponents },\n { name: \"zeroForOne\", type: \"bool\" },\n { name: \"exactAmount\", type: \"uint128\" },\n { name: \"hookData\", type: \"bytes\" },\n ],\n },\n ],\n outputs: [\n { name: \"amountIn\", type: \"uint256\" },\n { name: \"gasEstimate\", type: \"uint256\" },\n ],\n },\n // quoteExactOutput — multi-hop exact-output quote\n // CAUTION: `exactCurrency` here is the OUTPUT currency (token user wants\n // to receive), and `path` walks output→input — opposite semantics from\n // `quoteExactInput`. The field names are dangerously symmetric.\n {\n type: \"function\",\n name: \"quoteExactOutput\",\n stateMutability: \"nonpayable\",\n inputs: [\n {\n name: \"params\",\n type: \"tuple\",\n components: [\n { name: \"exactCurrency\", type: \"address\" },\n { name: \"path\", type: \"tuple[]\", components: pathKeyComponents },\n { name: \"exactAmount\", type: \"uint128\" },\n ],\n },\n ],\n outputs: [\n { name: \"amountIn\", type: \"uint256\" },\n { name: \"gasEstimate\", type: \"uint256\" },\n ],\n },\n] as const;\n"],"mappings":";AACO,IAAM,uBAAuB;AAAA,EAClC;AAAA,IACE,QAAQ;AAAA,IACR,UAAU,CAAC;AAAA,IACX,mBAAmB;AAAA,EACrB;AAAA,EACA;AAAA,IACE,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,UAAU,CAAC;AAAA,IACX,WAAW;AAAA,MACT;AAAA,QACE,QAAQ;AAAA,QACR,QAAQ;AAAA,QACR,gBAAgB;AAAA,MAClB;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,EACrB;AAAA,EACA;AAAA,IACE,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,UAAU,CAAC;AAAA,IACX,WAAW,CAAC;AAAA,IACZ,mBAAmB;AAAA,EACrB;AAAA,EACA;AAAA,IACE,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,UAAU;AAAA,MACR;AAAA,QACE,QAAQ;AAAA,QACR,QAAQ;AAAA,QACR,gBAAgB;AAAA,MAClB;AAAA,MACA;AAAA,QACE,QAAQ;AAAA,QACR,QAAQ;AAAA,QACR,gBAAgB;AAAA,MAClB;AAAA,MACA;AAAA,QACE,QAAQ;AAAA,QACR,QAAQ;AAAA,QACR,gBAAgB;AAAA,MAClB;AAAA,MACA;AAAA,QACE,QAAQ;AAAA,QACR,QAAQ;AAAA,QACR,gBAAgB;AAAA,MAClB;AAAA,MACA;AAAA,QACE,QAAQ;AAAA,QACR,QAAQ;AAAA,QACR,gBAAgB;AAAA,MAClB;AAAA,IACF;AAAA,I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AAY;AAAA,UACV,EAAE,MAAM,WAAW,MAAM,SAAS,YAAY,kBAAkB;AAAA,UAChE,EAAE,MAAM,cAAc,MAAM,OAAO;AAAA,UACnC,EAAE,MAAM,eAAe,MAAM,UAAU;AAAA,UACvC,EAAE,MAAM,YAAY,MAAM,QAAQ;AAAA,QACpC;AAAA,MACF;AAAA,IACF;AAAA,IACA,SAAS;AAAA,MACP,EAAE,MAAM,YAAY,MAAM,UAAU;AAAA,MACpC,EAAE,MAAM,eAAe,MAAM,UAAU;AAAA,IACzC;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA,EAKA;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,iBAAiB;AAAA,IACjB,QAAQ;AAAA,MACN;AAAA,QACE,MAAM;AAAA,QACN,MAAM;AAAA,QACN,YAAY;AAAA,UACV,EAAE,MAAM,iBAAiB,MAAM,UAAU;AAAA,UACzC,EAAE,MAAM,QAAQ,MAAM,WAAW,YAAY,kBAAkB;AAAA,UAC/D,EAAE,MAAM,eAAe,MAAM,UAAU;AAAA,QACzC;AAAA,MACF;AAAA,IACF;AAAA,IACA,SAAS;AAAA,MACP,EAAE,MAAM,YAAY,MAAM,UAAU;AAAA,MACpC,EAAE,MAAM,eAAe,MAAM,UAAU;AAAA,IACzC;AAAA,EACF;AACF;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/eip712/domain.ts","../src/eip712/mintRequest.ts","../src/constants.ts","../src/eip712/burnRequest.ts","../src/eip712/receiverConsent.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} from \"../types\";\nimport { buildDomain } from \"./domain\";\n\nconst PRIMARY_TYPE = \"MintForRequest\" as const;\n\n/**\n * Build the EIP-712 typed data object for a v1.6 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 v1.6 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\nexport async function verifyMintRequest(\n domain: PointTokenDomainConfig,\n message: MintRequest,\n signature: Hex,\n expectedMinter: Address,\n): Promise<SignatureVerification> {\n const recoveredAddress = await recoverTypedDataAddress({\n domain: buildDomain(domain),\n types: mintRequestTypes,\n primaryType: PRIMARY_TYPE,\n message,\n signature,\n });\n\n const isValid = getAddress(recoveredAddress) === getAddress(expectedMinter);\n\n return { isValid, recoveredAddress };\n}\n","import type { Address } 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 v1.6 sig-gated mint path.\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: \"nonce\", type: \"uint256\" },\n { name: \"deadline\", type: \"uint256\" },\n ],\n} as const;\n\nexport const burnRequestTypes = {\n BurnRequest: [\n { name: \"from\", type: \"address\" },\n { name: \"amount\", type: \"uint256\" },\n { name: \"nonce\", type: \"uint256\" },\n { name: \"deadline\", type: \"uint256\" },\n ],\n} as const;\n\nexport const receiverConsentTypes = {\n ReceiverConsent: [\n { name: \"onBehalfOf\", type: \"address\" },\n { name: \"originalReceiver\", type: \"address\" },\n { name: \"amount\", type: \"uint256\" },\n { name: \"nonce\", type: \"uint256\" },\n { name: \"deadline\", type: \"uint256\" },\n { name: \"extData\", type: \"bytes\" },\n ],\n} as const;\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\nexport const V4_QUOTER_ADDRESSES: Record<number, Address> = {\n 8453: \"0x0d5e0f971ed27fbff6c2837bf31316121532048d\",\n};\n\nexport const UNIVERSAL_ROUTER_ADDRESSES: Record<number, Address> = {\n 8453: \"0x6ff5693b99212da76ad316178a184ab56d299b43\",\n};\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 — existing Uniswap V4 pools\n 8453: [\n // WETH/USDC 0.3%\n {\n currency0: \"0x4200000000000000000000000000000000000006\",\n currency1: \"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913\",\n fee: 3000,\n tickSpacing: 60,\n hooks: \"0x0000000000000000000000000000000000000000\",\n },\n // WETH/USDC 0.05%\n {\n currency0: \"0x4200000000000000000000000000000000000006\",\n currency1: \"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913\",\n fee: 500,\n tickSpacing: 10,\n hooks: \"0x0000000000000000000000000000000000000000\",\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. */\nexport const PERMIT2_ADDRESS: Address = \"0x000000000022D473030F116dDEE9F6B43aC78BA3\";\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} from \"../types\";\nimport { buildDomain } from \"./domain\";\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\nexport async function verifyBurnRequest(\n domain: PointTokenDomainConfig,\n message: BurnRequest,\n signature: Hex,\n expectedBurner: Address,\n): Promise<SignatureVerification> {\n const recoveredAddress = await recoverTypedDataAddress({\n domain: buildDomain(domain),\n types: burnRequestTypes,\n primaryType: \"BurnRequest\",\n message,\n signature,\n });\n\n const isValid = getAddress(recoveredAddress) === getAddress(expectedBurner);\n\n return { isValid, recoveredAddress };\n}\n","import { getAddress, parseSignature, recoverTypedDataAddress } from \"viem\";\nimport type { Address, Hex, WalletClient } from \"viem\";\nimport { receiverConsentTypes } from \"../constants\";\nimport type { EIP712Signature, PointTokenDomainConfig, ReceiverConsent, SignatureVerification } from \"../types\";\nimport { buildDomain } from \"./domain\";\n\n/**\n * Build the EIP-712 typed data object for a ReceiverConsent.\n * Returns the standard `{ domain, types, primaryType, message }` structure\n * that any EIP-712 signer (viem, ethers, Privy, WalletConnect) can consume.\n */\nexport function buildReceiverConsentTypedData(\n domain: PointTokenDomainConfig,\n message: ReceiverConsent,\n) {\n return {\n domain: buildDomain(domain),\n types: receiverConsentTypes,\n primaryType: \"ReceiverConsent\" as const,\n message,\n };\n}\n\nexport async function signReceiverConsent(\n walletClient: WalletClient,\n domain: PointTokenDomainConfig,\n message: ReceiverConsent,\n): Promise<EIP712Signature> {\n const serialized = await walletClient.signTypedData({\n account: walletClient.account!,\n domain: buildDomain(domain),\n types: receiverConsentTypes,\n primaryType: \"ReceiverConsent\",\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\nexport async function verifyReceiverConsent(\n domain: PointTokenDomainConfig,\n message: ReceiverConsent,\n signature: Hex,\n expectedReceiver: Address,\n): Promise<SignatureVerification> {\n const recoveredAddress = await recoverTypedDataAddress({\n domain: buildDomain(domain),\n types: receiverConsentTypes,\n primaryType: \"ReceiverConsent\",\n message,\n signature,\n });\n\n const isValid = getAddress(recoveredAddress) === getAddress(expectedReceiver);\n\n return { isValid, recoveredAddress };\n}\n"],"mappings":";;;;;AAQO,SAAS,YAAY,QAAgC;AAC1D,SAAO;AAAA,IAC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recoverTypedDataAddress","parseSignature","recoverTypedDataAddress","getAddress","getAddress","parseSignature","recoverTypedDataAddress","parseSignature","recoverTypedDataAddress","getAddress"]}