@reptilianhq/uniswap-sdk 0.2.2

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 (89) hide show
  1. package/LICENSE +21 -0
  2. package/NOTICE +4 -0
  3. package/README.md +176 -0
  4. package/RELEASING.md +114 -0
  5. package/dist/abis.d.ts +161 -0
  6. package/dist/abis.d.ts.map +1 -0
  7. package/dist/abis.js +21 -0
  8. package/dist/abis.js.map +1 -0
  9. package/dist/batch.d.ts +60 -0
  10. package/dist/batch.d.ts.map +1 -0
  11. package/dist/batch.js +157 -0
  12. package/dist/batch.js.map +1 -0
  13. package/dist/compatibility.d.ts +15 -0
  14. package/dist/compatibility.d.ts.map +1 -0
  15. package/dist/compatibility.js +57 -0
  16. package/dist/compatibility.js.map +1 -0
  17. package/dist/deployments.d.ts +27 -0
  18. package/dist/deployments.d.ts.map +1 -0
  19. package/dist/deployments.js +70 -0
  20. package/dist/deployments.js.map +1 -0
  21. package/dist/depth.d.ts +24 -0
  22. package/dist/depth.d.ts.map +1 -0
  23. package/dist/depth.js +65 -0
  24. package/dist/depth.js.map +1 -0
  25. package/dist/errors.d.ts +25 -0
  26. package/dist/errors.d.ts.map +1 -0
  27. package/dist/errors.js +32 -0
  28. package/dist/errors.js.map +1 -0
  29. package/dist/events.d.ts +23 -0
  30. package/dist/events.d.ts.map +1 -0
  31. package/dist/events.js +27 -0
  32. package/dist/events.js.map +1 -0
  33. package/dist/index.d.ts +4 -0
  34. package/dist/index.d.ts.map +1 -0
  35. package/dist/index.js +4 -0
  36. package/dist/index.js.map +1 -0
  37. package/dist/official-sdk.cjs +9 -0
  38. package/dist/official-sdk.cjs.map +1 -0
  39. package/dist/official-sdk.d.cts +2 -0
  40. package/dist/official-sdk.d.cts.map +1 -0
  41. package/dist/pool.d.ts +30 -0
  42. package/dist/pool.d.ts.map +1 -0
  43. package/dist/pool.js +55 -0
  44. package/dist/pool.js.map +1 -0
  45. package/dist/providers.d.ts +59 -0
  46. package/dist/providers.d.ts.map +1 -0
  47. package/dist/providers.js +110 -0
  48. package/dist/providers.js.map +1 -0
  49. package/dist/reads.d.ts +61 -0
  50. package/dist/reads.d.ts.map +1 -0
  51. package/dist/reads.js +92 -0
  52. package/dist/reads.js.map +1 -0
  53. package/dist/receipts.d.ts +2 -0
  54. package/dist/receipts.d.ts.map +1 -0
  55. package/dist/receipts.js +2 -0
  56. package/dist/receipts.js.map +1 -0
  57. package/dist/transactions.d.ts +2 -0
  58. package/dist/transactions.d.ts.map +1 -0
  59. package/dist/transactions.js +2 -0
  60. package/dist/transactions.js.map +1 -0
  61. package/dist/v3-abis.d.ts +525 -0
  62. package/dist/v3-abis.d.ts.map +1 -0
  63. package/dist/v3-abis.js +43 -0
  64. package/dist/v3-abis.js.map +1 -0
  65. package/dist/v3-receipts.d.ts +28 -0
  66. package/dist/v3-receipts.d.ts.map +1 -0
  67. package/dist/v3-receipts.js +68 -0
  68. package/dist/v3-receipts.js.map +1 -0
  69. package/dist/v3-transactions.d.ts +107 -0
  70. package/dist/v3-transactions.d.ts.map +1 -0
  71. package/dist/v3-transactions.js +323 -0
  72. package/dist/v3-transactions.js.map +1 -0
  73. package/dist/v3.d.ts +6 -0
  74. package/dist/v3.d.ts.map +1 -0
  75. package/dist/v3.js +6 -0
  76. package/dist/v3.js.map +1 -0
  77. package/dist/v4.d.ts +8 -0
  78. package/dist/v4.d.ts.map +1 -0
  79. package/dist/v4.js +5 -0
  80. package/dist/v4.js.map +1 -0
  81. package/docs/FORK_TESTING.md +24 -0
  82. package/examples/read-only-consumer.mjs +59 -0
  83. package/fixtures/receipts/robinhood-mainnet-v3-lifecycle.json +84 -0
  84. package/fixtures/receipts/robinhood-mainnet-v3-mint.json +42 -0
  85. package/package.json +124 -0
  86. package/provenance/mainnet.json +33 -0
  87. package/provenance/testnet.json +33 -0
  88. package/scripts/check-conformance.mjs +191 -0
  89. package/scripts/verify-v3-deployments.mjs +23 -0
@@ -0,0 +1,525 @@
1
+ export declare const v3Erc20Abi: readonly [{
2
+ readonly name: "symbol";
3
+ readonly type: "function";
4
+ readonly stateMutability: "view";
5
+ readonly inputs: readonly [];
6
+ readonly outputs: readonly [{
7
+ readonly type: "string";
8
+ }];
9
+ }, {
10
+ readonly name: "decimals";
11
+ readonly type: "function";
12
+ readonly stateMutability: "view";
13
+ readonly inputs: readonly [];
14
+ readonly outputs: readonly [{
15
+ readonly type: "uint8";
16
+ }];
17
+ }, {
18
+ readonly name: "balanceOf";
19
+ readonly type: "function";
20
+ readonly stateMutability: "view";
21
+ readonly inputs: readonly [{
22
+ readonly type: "address";
23
+ readonly name: "owner";
24
+ }];
25
+ readonly outputs: readonly [{
26
+ readonly type: "uint256";
27
+ }];
28
+ }, {
29
+ readonly name: "allowance";
30
+ readonly type: "function";
31
+ readonly stateMutability: "view";
32
+ readonly inputs: readonly [{
33
+ readonly type: "address";
34
+ readonly name: "owner";
35
+ }, {
36
+ readonly type: "address";
37
+ readonly name: "spender";
38
+ }];
39
+ readonly outputs: readonly [{
40
+ readonly type: "uint256";
41
+ }];
42
+ }, {
43
+ readonly name: "approve";
44
+ readonly type: "function";
45
+ readonly stateMutability: "nonpayable";
46
+ readonly inputs: readonly [{
47
+ readonly type: "address";
48
+ readonly name: "spender";
49
+ }, {
50
+ readonly type: "uint256";
51
+ readonly name: "amount";
52
+ }];
53
+ readonly outputs: readonly [{
54
+ readonly type: "bool";
55
+ }];
56
+ }];
57
+ export declare const v3FactoryAbi: readonly [{
58
+ readonly name: "createPool";
59
+ readonly type: "function";
60
+ readonly stateMutability: "nonpayable";
61
+ readonly inputs: readonly [{
62
+ readonly type: "address";
63
+ readonly name: "tokenA";
64
+ }, {
65
+ readonly type: "address";
66
+ readonly name: "tokenB";
67
+ }, {
68
+ readonly type: "uint24";
69
+ readonly name: "fee";
70
+ }];
71
+ readonly outputs: readonly [{
72
+ readonly type: "address";
73
+ readonly name: "pool";
74
+ }];
75
+ }, {
76
+ readonly name: "getPool";
77
+ readonly type: "function";
78
+ readonly stateMutability: "view";
79
+ readonly inputs: readonly [{
80
+ readonly type: "address";
81
+ readonly name: "tokenA";
82
+ }, {
83
+ readonly type: "address";
84
+ readonly name: "tokenB";
85
+ }, {
86
+ readonly type: "uint24";
87
+ readonly name: "fee";
88
+ }];
89
+ readonly outputs: readonly [{
90
+ readonly type: "address";
91
+ readonly name: "pool";
92
+ }];
93
+ }, {
94
+ readonly name: "feeAmountTickSpacing";
95
+ readonly type: "function";
96
+ readonly stateMutability: "view";
97
+ readonly inputs: readonly [{
98
+ readonly type: "uint24";
99
+ readonly name: "fee";
100
+ }];
101
+ readonly outputs: readonly [{
102
+ readonly type: "int24";
103
+ readonly name: "tickSpacing";
104
+ }];
105
+ }];
106
+ export declare const v3PoolAbi: readonly [{
107
+ readonly name: "slot0";
108
+ readonly type: "function";
109
+ readonly stateMutability: "view";
110
+ readonly inputs: readonly [];
111
+ readonly outputs: readonly [{
112
+ readonly type: "uint160";
113
+ readonly name: "sqrtPriceX96";
114
+ }, {
115
+ readonly type: "int24";
116
+ readonly name: "tick";
117
+ }, {
118
+ readonly type: "uint16";
119
+ readonly name: "observationIndex";
120
+ }, {
121
+ readonly type: "uint16";
122
+ readonly name: "observationCardinality";
123
+ }, {
124
+ readonly type: "uint16";
125
+ readonly name: "observationCardinalityNext";
126
+ }, {
127
+ readonly type: "uint8";
128
+ readonly name: "feeProtocol";
129
+ }, {
130
+ readonly type: "bool";
131
+ readonly name: "unlocked";
132
+ }];
133
+ }];
134
+ export declare const multicall3Abi: readonly [{
135
+ readonly name: "aggregate3";
136
+ readonly type: "function";
137
+ readonly stateMutability: "payable";
138
+ readonly inputs: readonly [{
139
+ readonly type: "tuple[]";
140
+ readonly components: readonly [{
141
+ readonly type: "address";
142
+ readonly name: "target";
143
+ }, {
144
+ readonly type: "bool";
145
+ readonly name: "allowFailure";
146
+ }, {
147
+ readonly type: "bytes";
148
+ readonly name: "callData";
149
+ }];
150
+ readonly name: "calls";
151
+ }];
152
+ readonly outputs: readonly [{
153
+ readonly type: "tuple[]";
154
+ readonly components: readonly [{
155
+ readonly type: "bool";
156
+ readonly name: "success";
157
+ }, {
158
+ readonly type: "bytes";
159
+ readonly name: "returnData";
160
+ }];
161
+ readonly name: "returnData";
162
+ }];
163
+ }];
164
+ export declare const v3PositionManagerAbi: readonly [{
165
+ readonly name: "factory";
166
+ readonly type: "function";
167
+ readonly stateMutability: "view";
168
+ readonly inputs: readonly [];
169
+ readonly outputs: readonly [{
170
+ readonly type: "address";
171
+ }];
172
+ }, {
173
+ readonly name: "WETH9";
174
+ readonly type: "function";
175
+ readonly stateMutability: "view";
176
+ readonly inputs: readonly [];
177
+ readonly outputs: readonly [{
178
+ readonly type: "address";
179
+ }];
180
+ }, {
181
+ readonly name: "balanceOf";
182
+ readonly type: "function";
183
+ readonly stateMutability: "view";
184
+ readonly inputs: readonly [{
185
+ readonly type: "address";
186
+ readonly name: "owner";
187
+ }];
188
+ readonly outputs: readonly [{
189
+ readonly type: "uint256";
190
+ }];
191
+ }, {
192
+ readonly name: "ownerOf";
193
+ readonly type: "function";
194
+ readonly stateMutability: "view";
195
+ readonly inputs: readonly [{
196
+ readonly type: "uint256";
197
+ readonly name: "tokenId";
198
+ }];
199
+ readonly outputs: readonly [{
200
+ readonly type: "address";
201
+ }];
202
+ }, {
203
+ readonly name: "tokenOfOwnerByIndex";
204
+ readonly type: "function";
205
+ readonly stateMutability: "view";
206
+ readonly inputs: readonly [{
207
+ readonly type: "address";
208
+ readonly name: "owner";
209
+ }, {
210
+ readonly type: "uint256";
211
+ readonly name: "index";
212
+ }];
213
+ readonly outputs: readonly [{
214
+ readonly type: "uint256";
215
+ }];
216
+ }, {
217
+ readonly name: "positions";
218
+ readonly type: "function";
219
+ readonly stateMutability: "view";
220
+ readonly inputs: readonly [{
221
+ readonly type: "uint256";
222
+ readonly name: "tokenId";
223
+ }];
224
+ readonly outputs: readonly [{
225
+ readonly type: "uint96";
226
+ readonly name: "nonce";
227
+ }, {
228
+ readonly type: "address";
229
+ readonly name: "operator";
230
+ }, {
231
+ readonly type: "address";
232
+ readonly name: "token0";
233
+ }, {
234
+ readonly type: "address";
235
+ readonly name: "token1";
236
+ }, {
237
+ readonly type: "uint24";
238
+ readonly name: "fee";
239
+ }, {
240
+ readonly type: "int24";
241
+ readonly name: "tickLower";
242
+ }, {
243
+ readonly type: "int24";
244
+ readonly name: "tickUpper";
245
+ }, {
246
+ readonly type: "uint128";
247
+ readonly name: "liquidity";
248
+ }, {
249
+ readonly type: "uint256";
250
+ readonly name: "feeGrowthInside0LastX128";
251
+ }, {
252
+ readonly type: "uint256";
253
+ readonly name: "feeGrowthInside1LastX128";
254
+ }, {
255
+ readonly type: "uint128";
256
+ readonly name: "tokensOwed0";
257
+ }, {
258
+ readonly type: "uint128";
259
+ readonly name: "tokensOwed1";
260
+ }];
261
+ }, {
262
+ readonly name: "createAndInitializePoolIfNecessary";
263
+ readonly type: "function";
264
+ readonly stateMutability: "payable";
265
+ readonly inputs: readonly [{
266
+ readonly type: "address";
267
+ readonly name: "token0";
268
+ }, {
269
+ readonly type: "address";
270
+ readonly name: "token1";
271
+ }, {
272
+ readonly type: "uint24";
273
+ readonly name: "fee";
274
+ }, {
275
+ readonly type: "uint160";
276
+ readonly name: "sqrtPriceX96";
277
+ }];
278
+ readonly outputs: readonly [{
279
+ readonly type: "address";
280
+ readonly name: "pool";
281
+ }];
282
+ }, {
283
+ readonly name: "mint";
284
+ readonly type: "function";
285
+ readonly stateMutability: "payable";
286
+ readonly inputs: readonly [{
287
+ readonly type: "tuple";
288
+ readonly components: readonly [{
289
+ readonly type: "address";
290
+ readonly name: "token0";
291
+ }, {
292
+ readonly type: "address";
293
+ readonly name: "token1";
294
+ }, {
295
+ readonly type: "uint24";
296
+ readonly name: "fee";
297
+ }, {
298
+ readonly type: "int24";
299
+ readonly name: "tickLower";
300
+ }, {
301
+ readonly type: "int24";
302
+ readonly name: "tickUpper";
303
+ }, {
304
+ readonly type: "uint256";
305
+ readonly name: "amount0Desired";
306
+ }, {
307
+ readonly type: "uint256";
308
+ readonly name: "amount1Desired";
309
+ }, {
310
+ readonly type: "uint256";
311
+ readonly name: "amount0Min";
312
+ }, {
313
+ readonly type: "uint256";
314
+ readonly name: "amount1Min";
315
+ }, {
316
+ readonly type: "address";
317
+ readonly name: "recipient";
318
+ }, {
319
+ readonly type: "uint256";
320
+ readonly name: "deadline";
321
+ }];
322
+ readonly name: "params";
323
+ }];
324
+ readonly outputs: readonly [{
325
+ readonly type: "uint256";
326
+ readonly name: "tokenId";
327
+ }, {
328
+ readonly type: "uint128";
329
+ readonly name: "liquidity";
330
+ }, {
331
+ readonly type: "uint256";
332
+ readonly name: "amount0";
333
+ }, {
334
+ readonly type: "uint256";
335
+ readonly name: "amount1";
336
+ }];
337
+ }, {
338
+ readonly name: "multicall";
339
+ readonly type: "function";
340
+ readonly stateMutability: "payable";
341
+ readonly inputs: readonly [{
342
+ readonly type: "bytes[]";
343
+ readonly name: "data";
344
+ }];
345
+ readonly outputs: readonly [{
346
+ readonly type: "bytes[]";
347
+ readonly name: "results";
348
+ }];
349
+ }, {
350
+ readonly name: "decreaseLiquidity";
351
+ readonly type: "function";
352
+ readonly stateMutability: "payable";
353
+ readonly inputs: readonly [{
354
+ readonly type: "tuple";
355
+ readonly components: readonly [{
356
+ readonly type: "uint256";
357
+ readonly name: "tokenId";
358
+ }, {
359
+ readonly type: "uint128";
360
+ readonly name: "liquidity";
361
+ }, {
362
+ readonly type: "uint256";
363
+ readonly name: "amount0Min";
364
+ }, {
365
+ readonly type: "uint256";
366
+ readonly name: "amount1Min";
367
+ }, {
368
+ readonly type: "uint256";
369
+ readonly name: "deadline";
370
+ }];
371
+ readonly name: "params";
372
+ }];
373
+ readonly outputs: readonly [{
374
+ readonly type: "uint256";
375
+ readonly name: "amount0";
376
+ }, {
377
+ readonly type: "uint256";
378
+ readonly name: "amount1";
379
+ }];
380
+ }, {
381
+ readonly name: "collect";
382
+ readonly type: "function";
383
+ readonly stateMutability: "payable";
384
+ readonly inputs: readonly [{
385
+ readonly type: "tuple";
386
+ readonly components: readonly [{
387
+ readonly type: "uint256";
388
+ readonly name: "tokenId";
389
+ }, {
390
+ readonly type: "address";
391
+ readonly name: "recipient";
392
+ }, {
393
+ readonly type: "uint128";
394
+ readonly name: "amount0Max";
395
+ }, {
396
+ readonly type: "uint128";
397
+ readonly name: "amount1Max";
398
+ }];
399
+ readonly name: "params";
400
+ }];
401
+ readonly outputs: readonly [{
402
+ readonly type: "uint256";
403
+ readonly name: "amount0";
404
+ }, {
405
+ readonly type: "uint256";
406
+ readonly name: "amount1";
407
+ }];
408
+ }, {
409
+ readonly name: "increaseLiquidity";
410
+ readonly type: "function";
411
+ readonly stateMutability: "payable";
412
+ readonly inputs: readonly [{
413
+ readonly type: "tuple";
414
+ readonly components: readonly [{
415
+ readonly type: "uint256";
416
+ readonly name: "tokenId";
417
+ }, {
418
+ readonly type: "uint256";
419
+ readonly name: "amount0Desired";
420
+ }, {
421
+ readonly type: "uint256";
422
+ readonly name: "amount1Desired";
423
+ }, {
424
+ readonly type: "uint256";
425
+ readonly name: "amount0Min";
426
+ }, {
427
+ readonly type: "uint256";
428
+ readonly name: "amount1Min";
429
+ }, {
430
+ readonly type: "uint256";
431
+ readonly name: "deadline";
432
+ }];
433
+ readonly name: "params";
434
+ }];
435
+ readonly outputs: readonly [{
436
+ readonly type: "uint128";
437
+ readonly name: "liquidity";
438
+ }, {
439
+ readonly type: "uint256";
440
+ readonly name: "amount0";
441
+ }, {
442
+ readonly type: "uint256";
443
+ readonly name: "amount1";
444
+ }];
445
+ }, {
446
+ readonly name: "burn";
447
+ readonly type: "function";
448
+ readonly stateMutability: "payable";
449
+ readonly inputs: readonly [{
450
+ readonly type: "uint256";
451
+ readonly name: "tokenId";
452
+ }];
453
+ readonly outputs: readonly [];
454
+ }];
455
+ export declare const V3_ABI_REVISION = "uniswap-v3-core-periphery-1.0.0";
456
+ export declare const v3PositionManagerEventAbi: readonly [{
457
+ readonly name: "IncreaseLiquidity";
458
+ readonly type: "event";
459
+ readonly inputs: readonly [{
460
+ readonly type: "uint256";
461
+ readonly name: "tokenId";
462
+ readonly indexed: true;
463
+ }, {
464
+ readonly type: "uint128";
465
+ readonly name: "liquidity";
466
+ }, {
467
+ readonly type: "uint256";
468
+ readonly name: "amount0";
469
+ }, {
470
+ readonly type: "uint256";
471
+ readonly name: "amount1";
472
+ }];
473
+ }, {
474
+ readonly name: "DecreaseLiquidity";
475
+ readonly type: "event";
476
+ readonly inputs: readonly [{
477
+ readonly type: "uint256";
478
+ readonly name: "tokenId";
479
+ readonly indexed: true;
480
+ }, {
481
+ readonly type: "uint128";
482
+ readonly name: "liquidity";
483
+ }, {
484
+ readonly type: "uint256";
485
+ readonly name: "amount0";
486
+ }, {
487
+ readonly type: "uint256";
488
+ readonly name: "amount1";
489
+ }];
490
+ }, {
491
+ readonly name: "Collect";
492
+ readonly type: "event";
493
+ readonly inputs: readonly [{
494
+ readonly type: "uint256";
495
+ readonly name: "tokenId";
496
+ readonly indexed: true;
497
+ }, {
498
+ readonly type: "address";
499
+ readonly name: "recipient";
500
+ }, {
501
+ readonly type: "uint256";
502
+ readonly name: "amount0";
503
+ }, {
504
+ readonly type: "uint256";
505
+ readonly name: "amount1";
506
+ }];
507
+ }, {
508
+ readonly name: "Transfer";
509
+ readonly type: "event";
510
+ readonly inputs: readonly [{
511
+ readonly type: "address";
512
+ readonly name: "from";
513
+ readonly indexed: true;
514
+ }, {
515
+ readonly type: "address";
516
+ readonly name: "to";
517
+ readonly indexed: true;
518
+ }, {
519
+ readonly type: "uint256";
520
+ readonly name: "tokenId";
521
+ readonly indexed: true;
522
+ }];
523
+ }];
524
+ export declare const V3_MAX_UINT128: bigint;
525
+ //# sourceMappingURL=v3-abis.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"v3-abis.d.ts","sourceRoot":"","sources":["../src/v3-abis.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAMrB,CAAC;AAEH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAIvB,CAAC;AAEH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;EAEpB,CAAC;AAEH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAExB,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAc/B,CAAC;AAEH,eAAO,MAAM,eAAe,oCAAoC,CAAC;AAEjE,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAKpC,CAAC;AAEH,eAAO,MAAM,cAAc,QAAoB,CAAC"}
@@ -0,0 +1,43 @@
1
+ import { parseAbi } from 'viem';
2
+ export const v3Erc20Abi = parseAbi([
3
+ 'function symbol() view returns (string)',
4
+ 'function decimals() view returns (uint8)',
5
+ 'function balanceOf(address owner) view returns (uint256)',
6
+ 'function allowance(address owner, address spender) view returns (uint256)',
7
+ 'function approve(address spender, uint256 amount) returns (bool)',
8
+ ]);
9
+ export const v3FactoryAbi = parseAbi([
10
+ 'function createPool(address tokenA, address tokenB, uint24 fee) returns (address pool)',
11
+ 'function getPool(address tokenA, address tokenB, uint24 fee) view returns (address pool)',
12
+ 'function feeAmountTickSpacing(uint24 fee) view returns (int24 tickSpacing)',
13
+ ]);
14
+ export const v3PoolAbi = parseAbi([
15
+ 'function slot0() view returns (uint160 sqrtPriceX96, int24 tick, uint16 observationIndex, uint16 observationCardinality, uint16 observationCardinalityNext, uint8 feeProtocol, bool unlocked)',
16
+ ]);
17
+ export const multicall3Abi = parseAbi([
18
+ 'function aggregate3((address target,bool allowFailure,bytes callData)[] calls) payable returns ((bool success,bytes returnData)[] returnData)',
19
+ ]);
20
+ export const v3PositionManagerAbi = parseAbi([
21
+ 'function factory() view returns (address)',
22
+ 'function WETH9() view returns (address)',
23
+ 'function balanceOf(address owner) view returns (uint256)',
24
+ 'function ownerOf(uint256 tokenId) view returns (address)',
25
+ 'function tokenOfOwnerByIndex(address owner, uint256 index) view returns (uint256)',
26
+ 'function positions(uint256 tokenId) view returns (uint96 nonce, address operator, address token0, address token1, uint24 fee, int24 tickLower, int24 tickUpper, uint128 liquidity, uint256 feeGrowthInside0LastX128, uint256 feeGrowthInside1LastX128, uint128 tokensOwed0, uint128 tokensOwed1)',
27
+ 'function createAndInitializePoolIfNecessary(address token0,address token1,uint24 fee,uint160 sqrtPriceX96) payable returns (address pool)',
28
+ 'function mint((address token0,address token1,uint24 fee,int24 tickLower,int24 tickUpper,uint256 amount0Desired,uint256 amount1Desired,uint256 amount0Min,uint256 amount1Min,address recipient,uint256 deadline) params) payable returns (uint256 tokenId,uint128 liquidity,uint256 amount0,uint256 amount1)',
29
+ 'function multicall(bytes[] data) payable returns (bytes[] results)',
30
+ 'function decreaseLiquidity((uint256 tokenId,uint128 liquidity,uint256 amount0Min,uint256 amount1Min,uint256 deadline) params) payable returns (uint256 amount0,uint256 amount1)',
31
+ 'function collect((uint256 tokenId,address recipient,uint128 amount0Max,uint128 amount1Max) params) payable returns (uint256 amount0,uint256 amount1)',
32
+ 'function increaseLiquidity((uint256 tokenId,uint256 amount0Desired,uint256 amount1Desired,uint256 amount0Min,uint256 amount1Min,uint256 deadline) params) payable returns (uint128 liquidity,uint256 amount0,uint256 amount1)',
33
+ 'function burn(uint256 tokenId) payable',
34
+ ]);
35
+ export const V3_ABI_REVISION = 'uniswap-v3-core-periphery-1.0.0';
36
+ export const v3PositionManagerEventAbi = parseAbi([
37
+ 'event IncreaseLiquidity(uint256 indexed tokenId, uint128 liquidity, uint256 amount0, uint256 amount1)',
38
+ 'event DecreaseLiquidity(uint256 indexed tokenId, uint128 liquidity, uint256 amount0, uint256 amount1)',
39
+ 'event Collect(uint256 indexed tokenId, address recipient, uint256 amount0, uint256 amount1)',
40
+ 'event Transfer(address indexed from, address indexed to, uint256 indexed tokenId)',
41
+ ]);
42
+ export const V3_MAX_UINT128 = (1n << 128n) - 1n;
43
+ //# sourceMappingURL=v3-abis.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"v3-abis.js","sourceRoot":"","sources":["../src/v3-abis.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAEhC,MAAM,CAAC,MAAM,UAAU,GAAG,QAAQ,CAAC;IACjC,yCAAyC;IACzC,0CAA0C;IAC1C,0DAA0D;IAC1D,2EAA2E;IAC3E,kEAAkE;CACnE,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,YAAY,GAAG,QAAQ,CAAC;IACnC,wFAAwF;IACxF,0FAA0F;IAC1F,4EAA4E;CAC7E,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,SAAS,GAAG,QAAQ,CAAC;IAChC,+LAA+L;CAChM,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,aAAa,GAAG,QAAQ,CAAC;IACpC,+IAA+I;CAChJ,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,oBAAoB,GAAG,QAAQ,CAAC;IAC3C,2CAA2C;IAC3C,yCAAyC;IACzC,0DAA0D;IAC1D,0DAA0D;IAC1D,mFAAmF;IACnF,kSAAkS;IAClS,2IAA2I;IAC3I,6SAA6S;IAC7S,oEAAoE;IACpE,iLAAiL;IACjL,sJAAsJ;IACtJ,+NAA+N;IAC/N,wCAAwC;CACzC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,eAAe,GAAG,iCAAiC,CAAC;AAEjE,MAAM,CAAC,MAAM,yBAAyB,GAAG,QAAQ,CAAC;IAChD,uGAAuG;IACvG,uGAAuG;IACvG,6FAA6F;IAC7F,mFAAmF;CACpF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,EAAE,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC","sourcesContent":["import { parseAbi } from 'viem';\n\nexport const v3Erc20Abi = parseAbi([\n 'function symbol() view returns (string)',\n 'function decimals() view returns (uint8)',\n 'function balanceOf(address owner) view returns (uint256)',\n 'function allowance(address owner, address spender) view returns (uint256)',\n 'function approve(address spender, uint256 amount) returns (bool)',\n]);\n\nexport const v3FactoryAbi = parseAbi([\n 'function createPool(address tokenA, address tokenB, uint24 fee) returns (address pool)',\n 'function getPool(address tokenA, address tokenB, uint24 fee) view returns (address pool)',\n 'function feeAmountTickSpacing(uint24 fee) view returns (int24 tickSpacing)',\n]);\n\nexport const v3PoolAbi = parseAbi([\n 'function slot0() view returns (uint160 sqrtPriceX96, int24 tick, uint16 observationIndex, uint16 observationCardinality, uint16 observationCardinalityNext, uint8 feeProtocol, bool unlocked)',\n]);\n\nexport const multicall3Abi = parseAbi([\n 'function aggregate3((address target,bool allowFailure,bytes callData)[] calls) payable returns ((bool success,bytes returnData)[] returnData)',\n]);\n\nexport const v3PositionManagerAbi = parseAbi([\n 'function factory() view returns (address)',\n 'function WETH9() view returns (address)',\n 'function balanceOf(address owner) view returns (uint256)',\n 'function ownerOf(uint256 tokenId) view returns (address)',\n 'function tokenOfOwnerByIndex(address owner, uint256 index) view returns (uint256)',\n 'function positions(uint256 tokenId) view returns (uint96 nonce, address operator, address token0, address token1, uint24 fee, int24 tickLower, int24 tickUpper, uint128 liquidity, uint256 feeGrowthInside0LastX128, uint256 feeGrowthInside1LastX128, uint128 tokensOwed0, uint128 tokensOwed1)',\n 'function createAndInitializePoolIfNecessary(address token0,address token1,uint24 fee,uint160 sqrtPriceX96) payable returns (address pool)',\n 'function mint((address token0,address token1,uint24 fee,int24 tickLower,int24 tickUpper,uint256 amount0Desired,uint256 amount1Desired,uint256 amount0Min,uint256 amount1Min,address recipient,uint256 deadline) params) payable returns (uint256 tokenId,uint128 liquidity,uint256 amount0,uint256 amount1)',\n 'function multicall(bytes[] data) payable returns (bytes[] results)',\n 'function decreaseLiquidity((uint256 tokenId,uint128 liquidity,uint256 amount0Min,uint256 amount1Min,uint256 deadline) params) payable returns (uint256 amount0,uint256 amount1)',\n 'function collect((uint256 tokenId,address recipient,uint128 amount0Max,uint128 amount1Max) params) payable returns (uint256 amount0,uint256 amount1)',\n 'function increaseLiquidity((uint256 tokenId,uint256 amount0Desired,uint256 amount1Desired,uint256 amount0Min,uint256 amount1Min,uint256 deadline) params) payable returns (uint128 liquidity,uint256 amount0,uint256 amount1)',\n 'function burn(uint256 tokenId) payable',\n]);\n\nexport const V3_ABI_REVISION = 'uniswap-v3-core-periphery-1.0.0';\n\nexport const v3PositionManagerEventAbi = parseAbi([\n 'event IncreaseLiquidity(uint256 indexed tokenId, uint128 liquidity, uint256 amount0, uint256 amount1)',\n 'event DecreaseLiquidity(uint256 indexed tokenId, uint128 liquidity, uint256 amount0, uint256 amount1)',\n 'event Collect(uint256 indexed tokenId, address recipient, uint256 amount0, uint256 amount1)',\n 'event Transfer(address indexed from, address indexed to, uint256 indexed tokenId)',\n]);\n\nexport const V3_MAX_UINT128 = (1n << 128n) - 1n;\n"]}
@@ -0,0 +1,28 @@
1
+ import { type Address, type Hex } from 'viem';
2
+ export type V3ReceiptLog = {
3
+ address: Address | string;
4
+ data: Hex;
5
+ topics: readonly [] | readonly [Hex, ...(Hex | Hex[] | null)[]];
6
+ };
7
+ export interface V3PositionReceiptEvidence {
8
+ liquidityAdded: bigint;
9
+ amount0Added: bigint;
10
+ amount1Added: bigint;
11
+ liquidityRemoved: bigint;
12
+ amount0Collected: bigint;
13
+ amount1Collected: bigint;
14
+ burned: boolean;
15
+ }
16
+ export declare function findV3MintedPositionTokenId(input: {
17
+ logs: readonly V3ReceiptLog[];
18
+ manager: Address;
19
+ recipient: Address;
20
+ }): bigint;
21
+ /** Reduces only same-manager, same-position, same-recipient receipt evidence. */
22
+ export declare function summarizeV3PositionReceipt(input: {
23
+ logs: readonly V3ReceiptLog[];
24
+ manager: Address;
25
+ tokenId: bigint;
26
+ recipient: Address;
27
+ }): V3PositionReceiptEvidence;
28
+ //# sourceMappingURL=v3-receipts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"v3-receipts.d.ts","sourceRoot":"","sources":["../src/v3-receipts.ts"],"names":[],"mappings":"AAAA,OAAO,EAA+B,KAAK,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,MAAM,CAAC;AAI3E,MAAM,MAAM,YAAY,GAAG;IACzB,OAAO,EAAE,OAAO,GAAG,MAAM,CAAC;IAC1B,IAAI,EAAE,GAAG,CAAC;IACV,MAAM,EAAE,SAAS,EAAE,GAAG,SAAS,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,GAAG,GAAG,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC;CACjE,CAAC;AAOF,MAAM,WAAW,yBAAyB;IACxC,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;IACzB,gBAAgB,EAAE,MAAM,CAAC;IACzB,gBAAgB,EAAE,MAAM,CAAC;IACzB,MAAM,EAAE,OAAO,CAAC;CACjB;AAQD,wBAAgB,2BAA2B,CAAC,KAAK,EAAE;IACjD,IAAI,EAAE,SAAS,YAAY,EAAE,CAAC;IAAC,OAAO,EAAE,OAAO,CAAC;IAAC,SAAS,EAAE,OAAO,CAAC;CACrE,GAAG,MAAM,CAaT;AAED,iFAAiF;AACjF,wBAAgB,0BAA0B,CAAC,KAAK,EAAE;IAChD,IAAI,EAAE,SAAS,YAAY,EAAE,CAAC;IAAC,OAAO,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,OAAO,CAAC;CACtF,GAAG,yBAAyB,CAkC5B"}
@@ -0,0 +1,68 @@
1
+ import { decodeEventLog, zeroAddress } from 'viem';
2
+ import { UniswapSdkError } from './errors.js';
3
+ import { v3PositionManagerEventAbi } from './v3-abis.js';
4
+ function decodableTopics(topics) {
5
+ if (topics.some((topic) => typeof topic !== 'string'))
6
+ return [];
7
+ return [...topics];
8
+ }
9
+ export function findV3MintedPositionTokenId(input) {
10
+ for (const log of input.logs) {
11
+ if (log.address.toLowerCase() !== input.manager.toLowerCase())
12
+ continue;
13
+ try {
14
+ const decoded = decodeEventLog({ abi: v3PositionManagerEventAbi, eventName: 'Transfer', data: log.data, topics: decodableTopics(log.topics) });
15
+ if (decoded.eventName === 'Transfer'
16
+ && decoded.args.from === zeroAddress
17
+ && decoded.args.to.toLowerCase() === input.recipient.toLowerCase())
18
+ return decoded.args.tokenId;
19
+ }
20
+ catch {
21
+ // Unrelated manager logs do not satisfy the required mint evidence.
22
+ }
23
+ }
24
+ throw new UniswapSdkError('EVENT_NOT_FOUND', 'Mint receipt did not create a position NFT for the reviewed recipient');
25
+ }
26
+ /** Reduces only same-manager, same-position, same-recipient receipt evidence. */
27
+ export function summarizeV3PositionReceipt(input) {
28
+ const evidence = {
29
+ liquidityAdded: 0n,
30
+ amount0Added: 0n,
31
+ amount1Added: 0n,
32
+ liquidityRemoved: 0n,
33
+ amount0Collected: 0n,
34
+ amount1Collected: 0n,
35
+ burned: false,
36
+ };
37
+ for (const log of input.logs) {
38
+ if (log.address.toLowerCase() !== input.manager.toLowerCase())
39
+ continue;
40
+ try {
41
+ const decoded = decodeEventLog({ abi: v3PositionManagerEventAbi, data: log.data, topics: decodableTopics(log.topics) });
42
+ if (decoded.args.tokenId !== input.tokenId)
43
+ continue;
44
+ if (decoded.eventName === 'IncreaseLiquidity') {
45
+ evidence.liquidityAdded += decoded.args.liquidity;
46
+ evidence.amount0Added += decoded.args.amount0;
47
+ evidence.amount1Added += decoded.args.amount1;
48
+ }
49
+ else if (decoded.eventName === 'DecreaseLiquidity') {
50
+ evidence.liquidityRemoved += decoded.args.liquidity;
51
+ }
52
+ else if (decoded.eventName === 'Collect' && decoded.args.recipient.toLowerCase() === input.recipient.toLowerCase()) {
53
+ evidence.amount0Collected += decoded.args.amount0;
54
+ evidence.amount1Collected += decoded.args.amount1;
55
+ }
56
+ else if (decoded.eventName === 'Transfer'
57
+ && decoded.args.from.toLowerCase() === input.recipient.toLowerCase()
58
+ && decoded.args.to === zeroAddress) {
59
+ evidence.burned = true;
60
+ }
61
+ }
62
+ catch {
63
+ // Unrelated or malformed manager logs do not contribute evidence.
64
+ }
65
+ }
66
+ return evidence;
67
+ }
68
+ //# sourceMappingURL=v3-receipts.js.map