@pafi-dev/core 0.3.0-beta.0 → 0.3.0-beta.10

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 (87) hide show
  1. package/dist/abi/index.cjs +2 -6
  2. package/dist/abi/index.cjs.map +1 -1
  3. package/dist/abi/index.d.cts +1 -286
  4. package/dist/abi/index.d.ts +1 -286
  5. package/dist/abi/index.js +1 -5
  6. package/dist/{chunk-R4L66ZR5.js → chunk-73CQTNLB.js} +10 -1
  7. package/dist/chunk-73CQTNLB.js.map +1 -0
  8. package/dist/{chunk-5YH4D7QF.js → chunk-7UBO7DY5.js} +1 -1
  9. package/dist/{chunk-FGKLDKJK.cjs → chunk-ALCWYDVG.cjs} +1 -1
  10. package/dist/{chunk-FGKLDKJK.cjs.map → chunk-ALCWYDVG.cjs.map} +1 -1
  11. package/dist/{chunk-X3I5XWAR.cjs → chunk-CQCSQPWG.cjs} +2 -15
  12. package/dist/chunk-CQCSQPWG.cjs.map +1 -0
  13. package/dist/{chunk-CWP4PFOP.cjs → chunk-DMW67WBU.cjs} +11 -2
  14. package/dist/chunk-DMW67WBU.cjs.map +1 -0
  15. package/dist/{chunk-C4ZDYG4D.js → chunk-DUY7Z2AI.js} +48 -6
  16. package/dist/chunk-DUY7Z2AI.js.map +1 -0
  17. package/dist/chunk-EDR5SFJN.cjs +351 -0
  18. package/dist/chunk-EDR5SFJN.cjs.map +1 -0
  19. package/dist/{chunk-FIKTQR7H.js → chunk-I2P3TIP7.js} +2 -2
  20. package/dist/{chunk-BNTVOKYT.cjs → chunk-KJKDLD7N.cjs} +51 -9
  21. package/dist/chunk-KJKDLD7N.cjs.map +1 -0
  22. package/dist/{chunk-VQSRCMMK.js → chunk-QGO6X6LG.js} +2 -15
  23. package/dist/chunk-QGO6X6LG.js.map +1 -0
  24. package/dist/chunk-W23EJNYG.js +351 -0
  25. package/dist/chunk-W23EJNYG.js.map +1 -0
  26. package/dist/{chunk-CAE2BVKI.cjs → chunk-Z2V525IS.cjs} +6 -6
  27. package/dist/{chunk-CAE2BVKI.cjs.map → chunk-Z2V525IS.cjs.map} +1 -1
  28. package/dist/contract/index.cjs +2 -5
  29. package/dist/contract/index.cjs.map +1 -1
  30. package/dist/contract/index.d.cts +2 -4
  31. package/dist/contract/index.d.ts +2 -4
  32. package/dist/contract/index.js +1 -4
  33. package/dist/eip712/index.cjs +9 -3
  34. package/dist/eip712/index.cjs.map +1 -1
  35. package/dist/eip712/index.d.cts +44 -2
  36. package/dist/eip712/index.d.ts +44 -2
  37. package/dist/eip712/index.js +8 -2
  38. package/dist/index-B06IJlHe.d.ts +244 -0
  39. package/dist/index-B7pGBych.d.cts +244 -0
  40. package/dist/index.cjs +365 -329
  41. package/dist/index.cjs.map +1 -1
  42. package/dist/index.d.cts +778 -459
  43. package/dist/index.d.ts +778 -459
  44. package/dist/index.js +383 -347
  45. package/dist/index.js.map +1 -1
  46. package/dist/quoting/index.cjs +3 -3
  47. package/dist/quoting/index.d.cts +1 -1
  48. package/dist/quoting/index.d.ts +1 -1
  49. package/dist/quoting/index.js +2 -2
  50. package/dist/swap/index.cjs +4 -3
  51. package/dist/swap/index.cjs.map +1 -1
  52. package/dist/swap/index.d.cts +3 -84
  53. package/dist/swap/index.d.ts +3 -84
  54. package/dist/swap/index.js +3 -2
  55. package/dist/{types-BDOnH5Le.d.ts → types-b5_Tokjl.d.cts} +8 -17
  56. package/dist/{types-BDOnH5Le.d.cts → types-b5_Tokjl.d.ts} +8 -17
  57. package/package.json +1 -1
  58. package/dist/chunk-27V32VNM.cjs +0 -370
  59. package/dist/chunk-27V32VNM.cjs.map +0 -1
  60. package/dist/chunk-4RYBJLF3.js +0 -370
  61. package/dist/chunk-4RYBJLF3.js.map +0 -1
  62. package/dist/chunk-5QJZT7VB.cjs +0 -46
  63. package/dist/chunk-5QJZT7VB.cjs.map +0 -1
  64. package/dist/chunk-6I6K43RQ.cjs +0 -149
  65. package/dist/chunk-6I6K43RQ.cjs.map +0 -1
  66. package/dist/chunk-BNTVOKYT.cjs.map +0 -1
  67. package/dist/chunk-C4ZDYG4D.js.map +0 -1
  68. package/dist/chunk-CWP4PFOP.cjs.map +0 -1
  69. package/dist/chunk-L74CZAVQ.cjs +0 -99
  70. package/dist/chunk-L74CZAVQ.cjs.map +0 -1
  71. package/dist/chunk-P56TUGTS.js +0 -46
  72. package/dist/chunk-P56TUGTS.js.map +0 -1
  73. package/dist/chunk-R4L66ZR5.js.map +0 -1
  74. package/dist/chunk-UU72CX7E.js +0 -149
  75. package/dist/chunk-UU72CX7E.js.map +0 -1
  76. package/dist/chunk-VQSRCMMK.js.map +0 -1
  77. package/dist/chunk-X3I5XWAR.cjs.map +0 -1
  78. package/dist/chunk-X4IXUTTD.js +0 -99
  79. package/dist/chunk-X4IXUTTD.js.map +0 -1
  80. package/dist/relay/index.cjs +0 -19
  81. package/dist/relay/index.cjs.map +0 -1
  82. package/dist/relay/index.d.cts +0 -75
  83. package/dist/relay/index.d.ts +0 -75
  84. package/dist/relay/index.js +0 -19
  85. package/dist/relay/index.js.map +0 -1
  86. /package/dist/{chunk-5YH4D7QF.js.map → chunk-7UBO7DY5.js.map} +0 -0
  87. /package/dist/{chunk-FIKTQR7H.js.map → chunk-I2P3TIP7.js.map} +0 -0
@@ -1,370 +0,0 @@
1
- // src/abi/relay.ts
2
- var relayAbi = [
3
- {
4
- "type": "constructor",
5
- "inputs": [
6
- {
7
- "name": "initialOwner",
8
- "type": "address",
9
- "internalType": "address"
10
- },
11
- {
12
- "name": "_poolManager",
13
- "type": "address",
14
- "internalType": "address"
15
- },
16
- {
17
- "name": "_usdt",
18
- "type": "address",
19
- "internalType": "address"
20
- }
21
- ],
22
- "stateMutability": "nonpayable"
23
- },
24
- {
25
- "type": "function",
26
- "name": "acceptOwnership",
27
- "inputs": [],
28
- "outputs": [],
29
- "stateMutability": "nonpayable"
30
- },
31
- {
32
- "type": "function",
33
- "name": "mintAndSwap",
34
- "inputs": [
35
- {
36
- "name": "mint",
37
- "type": "tuple",
38
- "internalType": "struct Relay.MintParams",
39
- "components": [
40
- {
41
- "name": "pointToken",
42
- "type": "address",
43
- "internalType": "address"
44
- },
45
- {
46
- "name": "receiver",
47
- "type": "address",
48
- "internalType": "address"
49
- },
50
- {
51
- "name": "amount",
52
- "type": "uint256",
53
- "internalType": "uint256"
54
- },
55
- {
56
- "name": "deadline",
57
- "type": "uint256",
58
- "internalType": "uint256"
59
- },
60
- {
61
- "name": "minterSig",
62
- "type": "bytes",
63
- "internalType": "bytes"
64
- },
65
- {
66
- "name": "receiverSig",
67
- "type": "bytes",
68
- "internalType": "bytes"
69
- },
70
- {
71
- "name": "extData",
72
- "type": "bytes",
73
- "internalType": "bytes"
74
- }
75
- ]
76
- },
77
- {
78
- "name": "swap",
79
- "type": "tuple",
80
- "internalType": "struct Relay.SwapParams",
81
- "components": [
82
- {
83
- "name": "path",
84
- "type": "tuple[]",
85
- "internalType": "struct Relay.PathKey[]",
86
- "components": [
87
- {
88
- "name": "intermediateCurrency",
89
- "type": "address",
90
- "internalType": "address"
91
- },
92
- {
93
- "name": "fee",
94
- "type": "uint24",
95
- "internalType": "uint24"
96
- },
97
- {
98
- "name": "tickSpacing",
99
- "type": "int24",
100
- "internalType": "int24"
101
- },
102
- {
103
- "name": "hooks",
104
- "type": "address",
105
- "internalType": "address"
106
- },
107
- {
108
- "name": "hookData",
109
- "type": "bytes",
110
- "internalType": "bytes"
111
- }
112
- ]
113
- },
114
- {
115
- "name": "deadline",
116
- "type": "uint256",
117
- "internalType": "uint256"
118
- }
119
- ]
120
- }
121
- ],
122
- "outputs": [],
123
- "stateMutability": "nonpayable"
124
- },
125
- {
126
- "type": "function",
127
- "name": "owner",
128
- "inputs": [],
129
- "outputs": [
130
- {
131
- "name": "",
132
- "type": "address",
133
- "internalType": "address"
134
- }
135
- ],
136
- "stateMutability": "view"
137
- },
138
- {
139
- "type": "function",
140
- "name": "pendingOwner",
141
- "inputs": [],
142
- "outputs": [
143
- {
144
- "name": "",
145
- "type": "address",
146
- "internalType": "address"
147
- }
148
- ],
149
- "stateMutability": "view"
150
- },
151
- {
152
- "type": "function",
153
- "name": "poolManager",
154
- "inputs": [],
155
- "outputs": [
156
- {
157
- "name": "",
158
- "type": "address",
159
- "internalType": "address"
160
- }
161
- ],
162
- "stateMutability": "view"
163
- },
164
- {
165
- "type": "function",
166
- "name": "renounceOwnership",
167
- "inputs": [],
168
- "outputs": [],
169
- "stateMutability": "nonpayable"
170
- },
171
- {
172
- "type": "function",
173
- "name": "transferOwnership",
174
- "inputs": [
175
- {
176
- "name": "newOwner",
177
- "type": "address",
178
- "internalType": "address"
179
- }
180
- ],
181
- "outputs": [],
182
- "stateMutability": "nonpayable"
183
- },
184
- {
185
- "type": "function",
186
- "name": "unlockCallback",
187
- "inputs": [
188
- {
189
- "name": "data",
190
- "type": "bytes",
191
- "internalType": "bytes"
192
- }
193
- ],
194
- "outputs": [
195
- {
196
- "name": "",
197
- "type": "bytes",
198
- "internalType": "bytes"
199
- }
200
- ],
201
- "stateMutability": "nonpayable"
202
- },
203
- {
204
- "type": "function",
205
- "name": "usdt",
206
- "inputs": [],
207
- "outputs": [
208
- {
209
- "name": "",
210
- "type": "address",
211
- "internalType": "address"
212
- }
213
- ],
214
- "stateMutability": "view"
215
- },
216
- {
217
- "type": "event",
218
- "name": "MintAndSwapExecuted",
219
- "inputs": [
220
- {
221
- "name": "pointToken",
222
- "type": "address",
223
- "indexed": true,
224
- "internalType": "address"
225
- },
226
- {
227
- "name": "receiver",
228
- "type": "address",
229
- "indexed": true,
230
- "internalType": "address"
231
- },
232
- {
233
- "name": "mintAmount",
234
- "type": "uint256",
235
- "indexed": false,
236
- "internalType": "uint256"
237
- },
238
- {
239
- "name": "usdtOut",
240
- "type": "uint256",
241
- "indexed": false,
242
- "internalType": "uint256"
243
- },
244
- {
245
- "name": "fee",
246
- "type": "uint256",
247
- "indexed": false,
248
- "internalType": "uint256"
249
- },
250
- {
251
- "name": "relayer",
252
- "type": "address",
253
- "indexed": true,
254
- "internalType": "address"
255
- }
256
- ],
257
- "anonymous": false
258
- },
259
- {
260
- "type": "event",
261
- "name": "OwnershipTransferStarted",
262
- "inputs": [
263
- {
264
- "name": "previousOwner",
265
- "type": "address",
266
- "indexed": true,
267
- "internalType": "address"
268
- },
269
- {
270
- "name": "newOwner",
271
- "type": "address",
272
- "indexed": true,
273
- "internalType": "address"
274
- }
275
- ],
276
- "anonymous": false
277
- },
278
- {
279
- "type": "event",
280
- "name": "OwnershipTransferred",
281
- "inputs": [
282
- {
283
- "name": "previousOwner",
284
- "type": "address",
285
- "indexed": true,
286
- "internalType": "address"
287
- },
288
- {
289
- "name": "newOwner",
290
- "type": "address",
291
- "indexed": true,
292
- "internalType": "address"
293
- }
294
- ],
295
- "anonymous": false
296
- },
297
- {
298
- "type": "error",
299
- "name": "DeadlineExpired",
300
- "inputs": []
301
- },
302
- {
303
- "type": "error",
304
- "name": "FeeExceedsOutput",
305
- "inputs": []
306
- },
307
- {
308
- "type": "error",
309
- "name": "InsufficientOutputAmount",
310
- "inputs": []
311
- },
312
- {
313
- "type": "error",
314
- "name": "InvalidPath",
315
- "inputs": []
316
- },
317
- {
318
- "type": "error",
319
- "name": "OnlyPoolManager",
320
- "inputs": []
321
- },
322
- {
323
- "type": "error",
324
- "name": "OwnableInvalidOwner",
325
- "inputs": [
326
- {
327
- "name": "owner",
328
- "type": "address",
329
- "internalType": "address"
330
- }
331
- ]
332
- },
333
- {
334
- "type": "error",
335
- "name": "OwnableUnauthorizedAccount",
336
- "inputs": [
337
- {
338
- "name": "account",
339
- "type": "address",
340
- "internalType": "address"
341
- }
342
- ]
343
- },
344
- {
345
- "type": "error",
346
- "name": "ReentrancyGuardReentrantCall",
347
- "inputs": []
348
- },
349
- {
350
- "type": "error",
351
- "name": "SafeERC20FailedOperation",
352
- "inputs": [
353
- {
354
- "name": "token",
355
- "type": "address",
356
- "internalType": "address"
357
- }
358
- ]
359
- },
360
- {
361
- "type": "error",
362
- "name": "ZeroAddress",
363
- "inputs": []
364
- }
365
- ];
366
-
367
- export {
368
- relayAbi
369
- };
370
- //# sourceMappingURL=chunk-4RYBJLF3.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/abi/relay.ts"],"sourcesContent":["/** ABI for Relay contract (mint + swap via PoolManager) — auto-generated from Foundry artifacts, do not edit */\nexport const relayAbi = [\n {\n \"type\": \"constructor\",\n \"inputs\": [\n {\n \"name\": \"initialOwner\",\n \"type\": \"address\",\n \"internalType\": \"address\"\n },\n {\n \"name\": \"_poolManager\",\n \"type\": \"address\",\n \"internalType\": \"address\"\n },\n {\n \"name\": \"_usdt\",\n \"type\": \"address\",\n \"internalType\": \"address\"\n }\n ],\n \"stateMutability\": \"nonpayable\"\n },\n {\n \"type\": \"function\",\n \"name\": \"acceptOwnership\",\n \"inputs\": [],\n \"outputs\": [],\n \"stateMutability\": \"nonpayable\"\n },\n {\n \"type\": \"function\",\n \"name\": \"mintAndSwap\",\n \"inputs\": [\n {\n \"name\": \"mint\",\n \"type\": \"tuple\",\n \"internalType\": \"struct Relay.MintParams\",\n \"components\": [\n {\n \"name\": \"pointToken\",\n \"type\": \"address\",\n \"internalType\": \"address\"\n },\n {\n \"name\": \"receiver\",\n \"type\": \"address\",\n \"internalType\": \"address\"\n },\n {\n \"name\": \"amount\",\n \"type\": \"uint256\",\n \"internalType\": \"uint256\"\n },\n {\n \"name\": \"deadline\",\n \"type\": \"uint256\",\n \"internalType\": \"uint256\"\n },\n {\n \"name\": \"minterSig\",\n \"type\": \"bytes\",\n \"internalType\": \"bytes\"\n },\n {\n \"name\": \"receiverSig\",\n \"type\": \"bytes\",\n \"internalType\": \"bytes\"\n },\n {\n \"name\": \"extData\",\n \"type\": \"bytes\",\n \"internalType\": \"bytes\"\n }\n ]\n },\n {\n \"name\": \"swap\",\n \"type\": \"tuple\",\n \"internalType\": \"struct Relay.SwapParams\",\n \"components\": [\n {\n \"name\": \"path\",\n \"type\": \"tuple[]\",\n \"internalType\": \"struct Relay.PathKey[]\",\n \"components\": [\n {\n \"name\": \"intermediateCurrency\",\n \"type\": \"address\",\n \"internalType\": \"address\"\n },\n {\n \"name\": \"fee\",\n \"type\": \"uint24\",\n \"internalType\": \"uint24\"\n },\n {\n \"name\": \"tickSpacing\",\n \"type\": \"int24\",\n \"internalType\": \"int24\"\n },\n {\n \"name\": \"hooks\",\n \"type\": \"address\",\n \"internalType\": \"address\"\n },\n {\n \"name\": \"hookData\",\n \"type\": \"bytes\",\n \"internalType\": \"bytes\"\n }\n ]\n },\n {\n \"name\": \"deadline\",\n \"type\": \"uint256\",\n \"internalType\": \"uint256\"\n }\n ]\n }\n ],\n \"outputs\": [],\n \"stateMutability\": \"nonpayable\"\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\": \"poolManager\",\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\": \"renounceOwnership\",\n \"inputs\": [],\n \"outputs\": [],\n \"stateMutability\": \"nonpayable\"\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\": \"unlockCallback\",\n \"inputs\": [\n {\n \"name\": \"data\",\n \"type\": \"bytes\",\n \"internalType\": \"bytes\"\n }\n ],\n \"outputs\": [\n {\n \"name\": \"\",\n \"type\": \"bytes\",\n \"internalType\": \"bytes\"\n }\n ],\n \"stateMutability\": \"nonpayable\"\n },\n {\n \"type\": \"function\",\n \"name\": \"usdt\",\n \"inputs\": [],\n \"outputs\": [\n {\n \"name\": \"\",\n \"type\": \"address\",\n \"internalType\": \"address\"\n }\n ],\n \"stateMutability\": \"view\"\n },\n {\n \"type\": \"event\",\n \"name\": \"MintAndSwapExecuted\",\n \"inputs\": [\n {\n \"name\": \"pointToken\",\n \"type\": \"address\",\n \"indexed\": true,\n \"internalType\": \"address\"\n },\n {\n \"name\": \"receiver\",\n \"type\": \"address\",\n \"indexed\": true,\n \"internalType\": \"address\"\n },\n {\n \"name\": \"mintAmount\",\n \"type\": \"uint256\",\n \"indexed\": false,\n \"internalType\": \"uint256\"\n },\n {\n \"name\": \"usdtOut\",\n \"type\": \"uint256\",\n \"indexed\": false,\n \"internalType\": \"uint256\"\n },\n {\n \"name\": \"fee\",\n \"type\": \"uint256\",\n \"indexed\": false,\n \"internalType\": \"uint256\"\n },\n {\n \"name\": \"relayer\",\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\": \"error\",\n \"name\": \"DeadlineExpired\",\n \"inputs\": []\n },\n {\n \"type\": \"error\",\n \"name\": \"FeeExceedsOutput\",\n \"inputs\": []\n },\n {\n \"type\": \"error\",\n \"name\": \"InsufficientOutputAmount\",\n \"inputs\": []\n },\n {\n \"type\": \"error\",\n \"name\": \"InvalidPath\",\n \"inputs\": []\n },\n {\n \"type\": \"error\",\n \"name\": \"OnlyPoolManager\",\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\": \"ReentrancyGuardReentrantCall\",\n \"inputs\": []\n },\n {\n \"type\": \"error\",\n \"name\": \"SafeERC20FailedOperation\",\n \"inputs\": [\n {\n \"name\": \"token\",\n \"type\": \"address\",\n \"internalType\": \"address\"\n }\n ]\n },\n {\n \"type\": \"error\",\n \"name\": \"ZeroAddress\",\n \"inputs\": []\n }\n] as const;\n"],"mappings":";AACO,IAAM,WAAW;AAAA,EACtB;AAAA,IACE,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,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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AAA,IACR,QAAQ;AAAA,IACR,UAAU,CAAC;AAAA,EACb;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,IACF;AAAA,EACF;AAAA,EACA;AAAA,IACE,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,UAAU,CAAC;AAAA,EACb;AACF;","names":[]}
@@ -1,46 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/errors.ts
2
- var PafiSDKError = class extends Error {
3
- constructor(message) {
4
- super(message);
5
- this.name = "PafiSDKError";
6
- }
7
- };
8
- var ConfigurationError = class extends PafiSDKError {
9
- constructor(message) {
10
- super(message);
11
- this.name = "ConfigurationError";
12
- }
13
- };
14
- var SigningError = class extends PafiSDKError {
15
- constructor(message) {
16
- super(message);
17
- this.name = "SigningError";
18
- }
19
- };
20
- var SimulationError = class extends PafiSDKError {
21
- constructor(operation, reason) {
22
- super(`Simulation failed for ${operation}: ${reason}`);
23
- this.operation = operation;
24
- this.reason = reason;
25
- this.name = "SimulationError";
26
- }
27
-
28
-
29
- };
30
- var ApiError = class extends PafiSDKError {
31
- constructor(message, status) {
32
- super(message);
33
- this.status = status;
34
- this.name = "ApiError";
35
- }
36
-
37
- };
38
-
39
-
40
-
41
-
42
-
43
-
44
-
45
- exports.PafiSDKError = PafiSDKError; exports.ConfigurationError = ConfigurationError; exports.SigningError = SigningError; exports.SimulationError = SimulationError; exports.ApiError = ApiError;
46
- //# sourceMappingURL=chunk-5QJZT7VB.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["/Users/phitran/Pacific-Finance/pafi-backend/pafi-sdk/packages/core/dist/chunk-5QJZT7VB.cjs","../src/errors.ts"],"names":[],"mappings":"AAAA;ACAO,IAAM,aAAA,EAAN,MAAA,QAA2B,MAAM;AAAA,EACtC,WAAA,CAAY,OAAA,EAAiB;AAC3B,IAAA,KAAA,CAAM,OAAO,CAAA;AACb,IAAA,IAAA,CAAK,KAAA,EAAO,cAAA;AAAA,EACd;AACF,CAAA;AAEO,IAAM,mBAAA,EAAN,MAAA,QAAiC,aAAa;AAAA,EACnD,WAAA,CAAY,OAAA,EAAiB;AAC3B,IAAA,KAAA,CAAM,OAAO,CAAA;AACb,IAAA,IAAA,CAAK,KAAA,EAAO,oBAAA;AAAA,EACd;AACF,CAAA;AAEO,IAAM,aAAA,EAAN,MAAA,QAA2B,aAAa;AAAA,EAC7C,WAAA,CAAY,OAAA,EAAiB;AAC3B,IAAA,KAAA,CAAM,OAAO,CAAA;AACb,IAAA,IAAA,CAAK,KAAA,EAAO,cAAA;AAAA,EACd;AACF,CAAA;AAEO,IAAM,gBAAA,EAAN,MAAA,QAA8B,aAAa;AAAA,EAChD,WAAA,CACS,SAAA,EACA,MAAA,EACP;AACA,IAAA,KAAA,CAAM,CAAA,sBAAA,EAAyB,SAAS,CAAA,EAAA,EAAK,MAAM,CAAA,CAAA;AAH5C,IAAA;AACA,IAAA;AAGK,IAAA;AACd,EAAA;AALS,EAAA;AACA,EAAA;AAKX;AAE2C;AAIvC,EAAA;AACa,IAAA;AAFN,IAAA;AAGK,IAAA;AACd,EAAA;AAJS,EAAA;AAKX;ADFwD;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"/Users/phitran/Pacific-Finance/pafi-backend/pafi-sdk/packages/core/dist/chunk-5QJZT7VB.cjs","sourcesContent":[null,"export class PafiSDKError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"PafiSDKError\";\n }\n}\n\nexport class ConfigurationError extends PafiSDKError {\n constructor(message: string) {\n super(message);\n this.name = \"ConfigurationError\";\n }\n}\n\nexport class SigningError extends PafiSDKError {\n constructor(message: string) {\n super(message);\n this.name = \"SigningError\";\n }\n}\n\nexport class SimulationError extends PafiSDKError {\n constructor(\n public operation: string,\n public reason: string,\n ) {\n super(`Simulation failed for ${operation}: ${reason}`);\n this.name = \"SimulationError\";\n }\n}\n\nexport class ApiError extends PafiSDKError {\n constructor(\n message: string,\n public status?: number,\n ) {\n super(message);\n this.name = \"ApiError\";\n }\n}\n"]}
@@ -1,149 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
-
4
-
5
- var _chunkIPXARZ6Fcjs = require('./chunk-IPXARZ6F.cjs');
6
-
7
-
8
- var _chunk5QJZT7VBcjs = require('./chunk-5QJZT7VB.cjs');
9
-
10
- // src/swap/approval.ts
11
- var _viem = require('viem');
12
- async function checkAllowance(client, token, owner, spender) {
13
- return client.readContract({
14
- address: token,
15
- abi: _chunkIPXARZ6Fcjs.erc20Abi,
16
- functionName: "allowance",
17
- args: [owner, spender]
18
- });
19
- }
20
- function buildErc20ApprovalCalldata(spender, amount) {
21
- return _viem.encodeFunctionData.call(void 0, {
22
- abi: _chunkIPXARZ6Fcjs.erc20Abi,
23
- functionName: "approve",
24
- args: [spender, amount]
25
- });
26
- }
27
- function buildPermit2ApprovalCalldata(token, spender, amount, expiration) {
28
- return _viem.encodeFunctionData.call(void 0, {
29
- abi: _chunkIPXARZ6Fcjs.permit2Abi,
30
- functionName: "approve",
31
- args: [token, spender, amount, expiration]
32
- });
33
- }
34
-
35
- // src/swap/universalRouter.ts
36
-
37
- var V4_SWAP = 16;
38
- var SWAP_EXACT_IN = 7;
39
- var SETTLE_ALL = 12;
40
- var TAKE_ALL = 15;
41
- var PATH_KEY_ABI_COMPONENTS = [
42
- { name: "intermediateCurrency", type: "address" },
43
- { name: "fee", type: "uint256" },
44
- { name: "tickSpacing", type: "int24" },
45
- { name: "hooks", type: "address" },
46
- { name: "hookData", type: "bytes" }
47
- ];
48
- var EXACT_INPUT_PARAMS_ABI = [
49
- { name: "currencyIn", type: "address" },
50
- {
51
- name: "path",
52
- type: "tuple[]",
53
- components: PATH_KEY_ABI_COMPONENTS
54
- },
55
- { name: "amountIn", type: "uint128" },
56
- { name: "amountOutMinimum", type: "uint128" }
57
- ];
58
- function buildV4SwapInput(currencyIn, path, amountIn, minAmountOut, outputCurrency) {
59
- const actions = _viem.encodePacked.call(void 0,
60
- ["uint8", "uint8", "uint8"],
61
- [SWAP_EXACT_IN, SETTLE_ALL, TAKE_ALL]
62
- );
63
- const swapParam = _viem.encodeAbiParameters.call(void 0,
64
- [{ name: "swap", type: "tuple", components: EXACT_INPUT_PARAMS_ABI }],
65
- [
66
- {
67
- currencyIn,
68
- path: path.map((p) => ({
69
- intermediateCurrency: p.intermediateCurrency,
70
- fee: BigInt(p.fee),
71
- tickSpacing: p.tickSpacing,
72
- hooks: p.hooks,
73
- hookData: p.hookData
74
- })),
75
- amountIn,
76
- amountOutMinimum: minAmountOut
77
- }
78
- ]
79
- );
80
- const settleParam = _viem.encodeAbiParameters.call(void 0,
81
- [
82
- { name: "currency", type: "address" },
83
- { name: "maxAmount", type: "uint256" }
84
- ],
85
- [currencyIn, amountIn]
86
- );
87
- const takeParam = _viem.encodeAbiParameters.call(void 0,
88
- [
89
- { name: "currency", type: "address" },
90
- { name: "minAmount", type: "uint256" }
91
- ],
92
- [outputCurrency, minAmountOut]
93
- );
94
- return _viem.encodeAbiParameters.call(void 0,
95
- [
96
- { name: "actions", type: "bytes" },
97
- { name: "params", type: "bytes[]" }
98
- ],
99
- [actions, [swapParam, settleParam, takeParam]]
100
- );
101
- }
102
- function buildUniversalRouterExecuteArgs(currencyIn, path, amountIn, minAmountOut, outputCurrency) {
103
- const commands = _viem.encodePacked.call(void 0, ["uint8"], [V4_SWAP]);
104
- const inputs = [
105
- buildV4SwapInput(currencyIn, path, amountIn, minAmountOut, outputCurrency)
106
- ];
107
- return { commands, inputs };
108
- }
109
- function buildSwapFromQuote(params) {
110
- return buildUniversalRouterExecuteArgs(
111
- params.currencyIn,
112
- params.quote.path,
113
- params.amountIn,
114
- params.minAmountOut,
115
- params.currencyOut
116
- );
117
- }
118
-
119
- // src/swap/simulate.ts
120
- async function simulateSwap(client, routerAddress, commands, inputs, deadline, from) {
121
- try {
122
- const gasEstimate = await client.estimateContractGas({
123
- address: routerAddress,
124
- abi: _chunkIPXARZ6Fcjs.universalRouterAbi,
125
- functionName: "execute",
126
- args: [commands, inputs, deadline],
127
- account: from
128
- });
129
- return { success: true, gasEstimate };
130
- } catch (error) {
131
- const message = error instanceof Error ? error.message : "Unknown simulation error";
132
- throw new (0, _chunk5QJZT7VBcjs.SimulationError)("swap", message);
133
- }
134
- }
135
-
136
-
137
-
138
-
139
-
140
-
141
-
142
-
143
-
144
-
145
-
146
-
147
-
148
- exports.checkAllowance = checkAllowance; exports.buildErc20ApprovalCalldata = buildErc20ApprovalCalldata; exports.buildPermit2ApprovalCalldata = buildPermit2ApprovalCalldata; exports.V4_SWAP = V4_SWAP; exports.SWAP_EXACT_IN = SWAP_EXACT_IN; exports.SETTLE_ALL = SETTLE_ALL; exports.TAKE_ALL = TAKE_ALL; exports.buildV4SwapInput = buildV4SwapInput; exports.buildUniversalRouterExecuteArgs = buildUniversalRouterExecuteArgs; exports.buildSwapFromQuote = buildSwapFromQuote; exports.simulateSwap = simulateSwap;
149
- //# sourceMappingURL=chunk-6I6K43RQ.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["/Users/phitran/Pacific-Finance/pafi-backend/pafi-sdk/packages/core/dist/chunk-6I6K43RQ.cjs","../src/swap/approval.ts","../src/swap/universalRouter.ts","../src/swap/simulate.ts"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACA;ACTA,4BAAmC;AAKnC,MAAA,SAAsB,cAAA,CACpB,MAAA,EACA,KAAA,EACA,KAAA,EACA,OAAA,EACiB;AACjB,EAAA,OAAO,MAAA,CAAO,YAAA,CAAa;AAAA,IACzB,OAAA,EAAS,KAAA;AAAA,IACT,GAAA,EAAK,0BAAA;AAAA,IACL,YAAA,EAAc,WAAA;AAAA,IACd,IAAA,EAAM,CAAC,KAAA,EAAO,OAAO;AAAA,EACvB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AO,mBAAA,CAAoB;AAAA,MACnD,OAAA,EAAS,aAAA;AAAA,MACT,GAAA,EAAK,oCAAA;AAAA,MACL,YAAA,EAAc,SAAA;AAAA,MACd,IAAA,EAAM,CAAC,QAAA,EAAU,MAAA,EAAQ,QAAQ,CAAA;AAAA,MACjC,OAAA,EAAS;AAAA,IACX,CAAC,CAAA;AAED,IAAA,OAAO,EAAE,OAAA,EAAS,IAAA,EAAM,YAAY,CAAA;AAAA,EACtC,EAAA,MAAA,CAAS,KAAA,EAAgB;AACvB,IAAA,MAAM,QAAA,EACJ,MAAA,WAAiB,MAAA,EAAQ,KAAA,CAAM,QAAA,EAAU,0BAAA;AAC3C,IAAA,MAAM,IAAI,sCAAA,CAAgB,MAAA,EAAQ,OAAO,CAAA;AAAA,EAC3C;AACF;AHwFA;AACA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,4fAAC","file":"/Users/phitran/Pacific-Finance/pafi-backend/pafi-sdk/packages/core/dist/chunk-6I6K43RQ.cjs","sourcesContent":[null,"import { encodeFunctionData } from \"viem\";\nimport type { Address, Hex, PublicClient } from \"viem\";\nimport { erc20Abi } from \"../abi/erc20\";\nimport { permit2Abi } from \"../abi/permit2\";\n\nexport async function checkAllowance(\n client: PublicClient,\n token: Address,\n owner: Address,\n spender: Address,\n): Promise<bigint> {\n return client.readContract({\n address: token,\n abi: erc20Abi,\n functionName: \"allowance\",\n args: [owner, spender],\n });\n}\n\n/**\n * Encode an ERC-20 approve(spender, amount) call.\n */\nexport function buildErc20ApprovalCalldata(\n spender: Address,\n amount: bigint,\n): Hex {\n return encodeFunctionData({\n abi: erc20Abi,\n functionName: \"approve\",\n args: [spender, amount],\n });\n}\n\n/**\n * Encode a Permit2 approve(token, spender, amount, expiration) call.\n */\nexport function buildPermit2ApprovalCalldata(\n token: Address,\n spender: Address,\n amount: bigint,\n expiration: number,\n): Hex {\n return encodeFunctionData({\n abi: permit2Abi,\n functionName: \"approve\",\n args: [token, spender, amount, expiration],\n });\n}\n","import { encodeAbiParameters, encodePacked } from \"viem\";\nimport type { Address, Hex } from \"viem\";\nimport type { PathKey, QuoteResult } from \"../types\";\n\n// -------------------------------------------------------------------------\n// V4 UniversalRouter command / action constants\n// Reference: https://github.com/Uniswap/v4-periphery/blob/main/src/libraries/Actions.sol\n// -------------------------------------------------------------------------\n\n/** UniversalRouter command byte for V4 swap */\nexport const V4_SWAP = 0x10 as const;\n\n/** V4 actions */\nexport const SWAP_EXACT_IN_SINGLE = 0x06 as const;\nexport const SWAP_EXACT_IN = 0x07 as const;\nexport const SETTLE_ALL = 0x0c as const;\nexport const TAKE_ALL = 0x0f as const;\n\n// -------------------------------------------------------------------------\n// ABI type strings matching Uniswap's V4Planner encoding\n// Reference: https://github.com/Uniswap/sdks/blob/main/sdks/v4-sdk/src/utils/v4Planner.ts\n//\n// IMPORTANT: PathKey.fee is uint256 in the V4 Router ABI (not uint24).\n// -------------------------------------------------------------------------\n\n// PathKey components for V4 Router ABI encoding.\n// IMPORTANT: fee is uint256 in the V4 Router (not uint24 as in PoolKey).\n// Reference: https://github.com/Uniswap/sdks/blob/main/sdks/v4-sdk/src/utils/v4Planner.ts\nconst PATH_KEY_ABI_COMPONENTS = [\n { name: \"intermediateCurrency\", type: \"address\" },\n { name: \"fee\", type: \"uint256\" },\n { name: \"tickSpacing\", type: \"int24\" },\n { name: \"hooks\", type: \"address\" },\n { name: \"hookData\", type: \"bytes\" },\n] as const;\n\nconst EXACT_INPUT_PARAMS_ABI = [\n { name: \"currencyIn\", type: \"address\" },\n {\n name: \"path\",\n type: \"tuple[]\",\n components: PATH_KEY_ABI_COMPONENTS,\n },\n { name: \"amountIn\", type: \"uint128\" },\n { name: \"amountOutMinimum\", type: \"uint128\" },\n] as const;\n\n/**\n * Build the calldata inputs[0] (the V4_SWAP command payload) for\n * UniversalRouter.execute.\n *\n * Actions encoded: SWAP_EXACT_IN → SETTLE_ALL → TAKE_ALL\n *\n * Encoding matches the Uniswap V4 SDK's V4Planner — each action's params\n * are individually ABI-encoded, then wrapped together with the action bytes.\n */\nexport function buildV4SwapInput(\n currencyIn: Address,\n path: PathKey[],\n amountIn: bigint,\n minAmountOut: bigint,\n outputCurrency: Address,\n): Hex {\n const actions = encodePacked(\n [\"uint8\", \"uint8\", \"uint8\"],\n [SWAP_EXACT_IN, SETTLE_ALL, TAKE_ALL],\n );\n\n // Param 0: ExactInputParams — encoded as a single tuple so the CalldataDecoder\n // can locate it via a single offset pointer. fee is uint256 per V4 Router spec.\n const swapParam = encodeAbiParameters(\n [{ name: \"swap\", type: \"tuple\", components: EXACT_INPUT_PARAMS_ABI }],\n [\n {\n currencyIn,\n path: path.map((p) => ({\n intermediateCurrency: p.intermediateCurrency,\n fee: BigInt(p.fee),\n tickSpacing: p.tickSpacing,\n hooks: p.hooks,\n hookData: p.hookData,\n })),\n amountIn,\n amountOutMinimum: minAmountOut,\n },\n ],\n );\n\n // Param 1: SETTLE_ALL { currency, maxAmount }\n const settleParam = encodeAbiParameters(\n [\n { name: \"currency\", type: \"address\" },\n { name: \"maxAmount\", type: \"uint256\" },\n ],\n [currencyIn, amountIn],\n );\n\n // Param 2: TAKE_ALL { currency, minAmount }\n const takeParam = encodeAbiParameters(\n [\n { name: \"currency\", type: \"address\" },\n { name: \"minAmount\", type: \"uint256\" },\n ],\n [outputCurrency, minAmountOut],\n );\n\n return encodeAbiParameters(\n [\n { name: \"actions\", type: \"bytes\" },\n { name: \"params\", type: \"bytes[]\" },\n ],\n [actions, [swapParam, settleParam, takeParam]],\n );\n}\n\n/**\n * Build the full commands + inputs args for UniversalRouter.execute.\n */\nexport function buildUniversalRouterExecuteArgs(\n currencyIn: Address,\n path: PathKey[],\n amountIn: bigint,\n minAmountOut: bigint,\n outputCurrency: Address,\n): { commands: Hex; inputs: Hex[] } {\n const commands = encodePacked([\"uint8\"], [V4_SWAP]);\n const inputs: Hex[] = [\n buildV4SwapInput(currencyIn, path, amountIn, minAmountOut, outputCurrency),\n ];\n return { commands, inputs };\n}\n\n/**\n * Build UniversalRouter execute args from a quote result.\n *\n * Takes the output of `findBestQuote` / `quoteBestRoute` and produces\n * ready-to-use `{ commands, inputs }` for `UniversalRouter.execute`.\n *\n * @param quote - Quote result containing the path\n * @param currencyIn - Input token address\n * @param currencyOut - Output token address\n * @param amountIn - Exact input amount (same value passed to the quoter)\n * @param minAmountOut - Minimum acceptable output (caller applies slippage)\n *\n * @deprecated Since v1.4 — the Issuer App no longer handles swaps.\n * For the new PT→USDT batch call on PAFI Web (Scenario 4 with\n * EIP-7702 gas deduction), use `buildSwapWithGasDeduction()` (v1.5).\n * This helper is kept for legacy v0.2.x consumers; will be removed in v2.0.\n */\nexport function buildSwapFromQuote(params: {\n quote: QuoteResult;\n currencyIn: Address;\n currencyOut: Address;\n amountIn: bigint;\n minAmountOut: bigint;\n}): { commands: Hex; inputs: Hex[] } {\n return buildUniversalRouterExecuteArgs(\n params.currencyIn,\n params.quote.path,\n params.amountIn,\n params.minAmountOut,\n params.currencyOut,\n );\n}\n","import type { Address, Hex, PublicClient } from \"viem\";\nimport { universalRouterAbi } from \"../abi/universalRouter\";\nimport { SimulationError } from \"../errors\";\n\nexport interface SwapSimulationResult {\n success: boolean;\n gasEstimate: bigint;\n}\n\n/**\n * Simulate a UniversalRouter.execute swap call via eth_call (no gas spent).\n *\n * Runs the full V4 swap flow — token transfer via Permit2, swap via\n * PoolManager, output settlement — without submitting a transaction.\n * If the simulation reverts, throws a `SimulationError` with the reason.\n *\n * @param client - viem PublicClient\n * @param routerAddress - UniversalRouter contract address\n * @param commands - Packed command bytes (from buildSwapFromQuote)\n * @param inputs - Encoded inputs per command (from buildSwapFromQuote)\n * @param deadline - Unix timestamp after which the tx expires\n * @param from - Address that will execute the swap\n */\nexport async function simulateSwap(\n client: PublicClient,\n routerAddress: Address,\n commands: Hex,\n inputs: Hex[],\n deadline: bigint,\n from: Address,\n): Promise<SwapSimulationResult> {\n try {\n const gasEstimate = await client.estimateContractGas({\n address: routerAddress,\n abi: universalRouterAbi,\n functionName: \"execute\",\n args: [commands, inputs, deadline],\n account: from,\n });\n\n return { success: true, gasEstimate };\n } catch (error: unknown) {\n const message =\n error instanceof Error ? error.message : \"Unknown simulation error\";\n throw new SimulationError(\"swap\", message);\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["/Users/phitran/Pacific-Finance/pafi-backend/pafi-sdk/packages/core/dist/chunk-BNTVOKYT.cjs","../src/eip712/domain.ts","../src/eip712/mintRequest.ts","../src/eip712/receiverConsent.ts"],"names":["parseSignature","recoverTypedDataAddress","getAddress"],"mappings":"AAAA;AACE;AACA;AACF,wDAA6B;AAC7B;AACA;ACHO,SAAS,WAAA,CAAY,MAAA,EAAgC;AAC1D,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,MAAA,CAAO,IAAA;AAAA,IACb,OAAA,EAAS,GAAA;AAAA,IACT,OAAA,EAAS,MAAA,CAAO,OAAA;AAAA,IAChB,iBAAA,EAAmB,MAAA,CAAO;AAAA,EAC5B,CAAA;AACF;ADKA;AACA;AEfA,4BAAoE;AAW7D,SAAS,yBAAA,CACd,MAAA,EACA,OAAA,EACA;AACA,EAAA,OAAO;AAAA,IACL,MAAA,EAAQ,WAAA,CAAY,MAAM,CAAA;AAAA,IAC1B,KAAA,EAAO,kCAAA;AAAA,IACP,WAAA,EAAa,aAAA;AAAA,IACb;AAAA,EACF,CAAA;AACF;AAEA,MAAA,SAAsB,eAAA,CACpB,YAAA,EACA,MAAA,EACA,OAAA,EAC0B;AAC1B,EAAA,MAAM,WAAA,EAAa,MAAM,YAAA,CAAa,aAAA,CAAc;AAAA,IAClD,OAAA,EAAS,YAAA,CAAa,OAAA;AAAA,IACtB,MAAA,EAAQ,WAAA,CAAY,MAAM,CAAA;AAAA,IAC1B,KAAA,EAAO,kCAAA;AAAA,IACP,WAAA,EAAa,aAAA;AAAA,IACb;AAAA,EACF,CAAC,CAAA;AAED,EAAA,MAAM,EAAE,CAAA,EAAG,CAAA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,EAAA,OAAO;AAAA,IACL,CAAA,EAAG,MAAA,CAAO,CAAC,CAAA;AAAA,IACX,CAAA;AAAA,IACA,CAAA;AAAA,IACA;AAAA,EACF,CAAA;AACF;AAEA,MAAA,SAAsB,qBAAA,CACpB,MAAA,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,sCAAA;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;AH2BA;AACA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACF,4WAAC","file":"/Users/phitran/Pacific-Finance/pafi-backend/pafi-sdk/packages/core/dist/chunk-BNTVOKYT.cjs","sourcesContent":[null,"import type { PointTokenDomainConfig } from \"../types\";\n\nexport function buildDomain(config: PointTokenDomainConfig) {\n return {\n name: config.name,\n version: \"1\" as const,\n chainId: config.chainId,\n verifyingContract: config.verifyingContract,\n };\n}\n","import { getAddress, parseSignature, recoverTypedDataAddress } from \"viem\";\nimport type { Address, Hex, WalletClient } from \"viem\";\nimport { mintRequestTypes } from \"../constants\";\nimport type { EIP712Signature, MintRequest, PointTokenDomainConfig, SignatureVerification } from \"../types\";\nimport { buildDomain } from \"./domain\";\n\n/**\n * Build the EIP-712 typed data object for a MintRequest.\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: \"MintRequest\" as const,\n message,\n };\n}\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: \"MintRequest\",\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: \"MintRequest\",\n message,\n signature,\n });\n\n const isValid = getAddress(recoveredAddress) === getAddress(expectedMinter);\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":["../src/eip712/domain.ts","../src/eip712/mintRequest.ts","../src/eip712/receiverConsent.ts"],"sourcesContent":["import type { PointTokenDomainConfig } from \"../types\";\n\nexport function buildDomain(config: PointTokenDomainConfig) {\n return {\n name: config.name,\n version: \"1\" as const,\n chainId: config.chainId,\n verifyingContract: config.verifyingContract,\n };\n}\n","import { getAddress, parseSignature, recoverTypedDataAddress } from \"viem\";\nimport type { Address, Hex, WalletClient } from \"viem\";\nimport { mintRequestTypes } from \"../constants\";\nimport type { EIP712Signature, MintRequest, PointTokenDomainConfig, SignatureVerification } from \"../types\";\nimport { buildDomain } from \"./domain\";\n\n/**\n * Build the EIP-712 typed data object for a MintRequest.\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: \"MintRequest\" as const,\n message,\n };\n}\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: \"MintRequest\",\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: \"MintRequest\",\n message,\n signature,\n });\n\n const isValid = getAddress(recoveredAddress) === getAddress(expectedMinter);\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":";;;;;;A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Q,YAAY,MAAM;AAAA,IAC1B,OAAO;AAAA,IACP,aAAa;AAAA,IACb;AAAA,EACF,CAAC;AAED,QAAM,EAAE,GAAG,GAAG,EAAE,IAAIC,gBAAe,UAAU;AAE7C,SAAO;AAAA,IACL,GAAG,OAAO,CAAC;AAAA,IACX;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;AAEA,eAAsB,sBACpB,QACA,SACA,WACA,kBACgC;AAChC,QAAM,mBAAmB,MAAMC,yBAAwB;AAAA,IACrD,QAAQ,YAAY,MAAM;AAAA,IAC1B,OAAO;AAAA,IACP,aAAa;AAAA,IACb;AAAA,IACA;AAAA,EACF,CAAC;AAED,QAAM,UAAUC,YAAW,gBAAgB,MAAMA,YAAW,gBAAgB;AAE5E,SAAO,EAAE,SAAS,iBAAiB;AACrC;","names":["getAddress","parseSignature","recoverTypedDataAddress","parseSignature","recoverTypedDataAddress","getAddress"]}