@logswap/sdk 0.5.98 → 0.5.100
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +46 -31
- package/dist/actions.d.ts +8 -8
- package/dist/actions.js +8 -8
- package/dist/client.d.ts +2 -2
- package/dist/client.js +11 -2
- package/dist/fees.js +2 -24
- package/dist/fpool.d.ts +10 -6
- package/dist/fpool.js +12 -23
- package/dist/generated.d.ts +84 -47
- package/dist/generated.js +88 -37
- package/dist/history.d.ts +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/liquidity.d.ts +2 -1
- package/dist/liquidity.js +2 -1
- package/dist/positions.js +2 -13
- package/package.json +1 -1
- package/src/actions.ts +12 -12
- package/src/client.ts +11 -2
- package/src/fees.ts +2 -22
- package/src/fpool.ts +16 -24
- package/src/generated.ts +88 -37
- package/src/history.ts +1 -1
- package/src/index.ts +0 -1
- package/src/liquidity.ts +2 -1
- package/src/positions.ts +3 -14
- package/dist/views.d.ts +0 -281
- package/dist/views.js +0 -188
- package/src/views.ts +0 -480
package/dist/generated.js
CHANGED
|
@@ -780,6 +780,7 @@ export const managerCAbi = [
|
|
|
780
780
|
type: 'function',
|
|
781
781
|
inputs: [
|
|
782
782
|
{ name: 'poolId', internalType: 'bytes32', type: 'bytes32' },
|
|
783
|
+
{ name: 'payer', internalType: 'address', type: 'address' },
|
|
783
784
|
{ name: 'to', internalType: 'address', type: 'address' },
|
|
784
785
|
{ name: 'floor', internalType: 'int256', type: 'int256' },
|
|
785
786
|
{ name: 'cap', internalType: 'int256', type: 'int256' },
|
|
@@ -1026,13 +1027,13 @@ export const managerCAbi = [
|
|
|
1026
1027
|
type: 'event',
|
|
1027
1028
|
anonymous: false,
|
|
1028
1029
|
inputs: [
|
|
1029
|
-
{ name: 'id', internalType: 'uint256', type: 'uint256', indexed: true },
|
|
1030
1030
|
{
|
|
1031
1031
|
name: 'poolId',
|
|
1032
1032
|
internalType: 'bytes32',
|
|
1033
1033
|
type: 'bytes32',
|
|
1034
1034
|
indexed: true,
|
|
1035
1035
|
},
|
|
1036
|
+
{ name: 'id', internalType: 'uint256', type: 'uint256', indexed: true },
|
|
1036
1037
|
{ name: 'floor', internalType: 'int256', type: 'int256', indexed: false },
|
|
1037
1038
|
{ name: 'cap', internalType: 'int256', type: 'int256', indexed: false },
|
|
1038
1039
|
{ name: 'capped', internalType: 'bool', type: 'bool', indexed: false },
|
|
@@ -1050,7 +1051,7 @@ export const managerCAbi = [
|
|
|
1050
1051
|
indexed: true,
|
|
1051
1052
|
},
|
|
1052
1053
|
{
|
|
1053
|
-
name: '
|
|
1054
|
+
name: 'owner',
|
|
1054
1055
|
internalType: 'address',
|
|
1055
1056
|
type: 'address',
|
|
1056
1057
|
indexed: true,
|
|
@@ -1188,7 +1189,12 @@ export const managerCAbi = [
|
|
|
1188
1189
|
type: 'bytes32',
|
|
1189
1190
|
indexed: true,
|
|
1190
1191
|
},
|
|
1191
|
-
{
|
|
1192
|
+
{
|
|
1193
|
+
name: 'owner',
|
|
1194
|
+
internalType: 'address',
|
|
1195
|
+
type: 'address',
|
|
1196
|
+
indexed: true,
|
|
1197
|
+
},
|
|
1192
1198
|
{ name: 'id', internalType: 'uint256', type: 'uint256', indexed: true },
|
|
1193
1199
|
{
|
|
1194
1200
|
name: 'shares',
|
|
@@ -1229,6 +1235,18 @@ export const managerCAbi = [
|
|
|
1229
1235
|
},
|
|
1230
1236
|
{ name: 'to', internalType: 'address', type: 'address', indexed: true },
|
|
1231
1237
|
{ name: 'id', internalType: 'uint256', type: 'uint256', indexed: true },
|
|
1238
|
+
{
|
|
1239
|
+
name: 'sender',
|
|
1240
|
+
internalType: 'address',
|
|
1241
|
+
type: 'address',
|
|
1242
|
+
indexed: false,
|
|
1243
|
+
},
|
|
1244
|
+
{
|
|
1245
|
+
name: 'payer',
|
|
1246
|
+
internalType: 'address',
|
|
1247
|
+
type: 'address',
|
|
1248
|
+
indexed: false,
|
|
1249
|
+
},
|
|
1232
1250
|
{
|
|
1233
1251
|
name: 'shares',
|
|
1234
1252
|
internalType: 'uint256',
|
|
@@ -1261,7 +1279,7 @@ export const managerCAbi = [
|
|
|
1261
1279
|
indexed: true,
|
|
1262
1280
|
},
|
|
1263
1281
|
{
|
|
1264
|
-
name: '
|
|
1282
|
+
name: 'owner',
|
|
1265
1283
|
internalType: 'address',
|
|
1266
1284
|
type: 'address',
|
|
1267
1285
|
indexed: true,
|
|
@@ -1316,6 +1334,12 @@ export const managerCAbi = [
|
|
|
1316
1334
|
type: 'bytes32',
|
|
1317
1335
|
indexed: true,
|
|
1318
1336
|
},
|
|
1337
|
+
{
|
|
1338
|
+
name: 'sender',
|
|
1339
|
+
internalType: 'address',
|
|
1340
|
+
type: 'address',
|
|
1341
|
+
indexed: true,
|
|
1342
|
+
},
|
|
1319
1343
|
{ name: 'to', internalType: 'address', type: 'address', indexed: true },
|
|
1320
1344
|
{
|
|
1321
1345
|
name: 'amount',
|
|
@@ -1604,6 +1628,7 @@ export const managerFAbi = [
|
|
|
1604
1628
|
inputs: [
|
|
1605
1629
|
{ name: 'poolId', internalType: 'bytes32', type: 'bytes32' },
|
|
1606
1630
|
{ name: 'gen', internalType: 'uint256', type: 'uint256' },
|
|
1631
|
+
{ name: 'owner', internalType: 'address', type: 'address' },
|
|
1607
1632
|
{ name: 'to', internalType: 'address', type: 'address' },
|
|
1608
1633
|
],
|
|
1609
1634
|
name: 'claim',
|
|
@@ -1785,6 +1810,7 @@ export const managerFAbi = [
|
|
|
1785
1810
|
type: 'function',
|
|
1786
1811
|
inputs: [
|
|
1787
1812
|
{ name: 'poolId', internalType: 'bytes32', type: 'bytes32' },
|
|
1813
|
+
{ name: 'payer', internalType: 'address', type: 'address' },
|
|
1788
1814
|
{ name: 'to', internalType: 'address', type: 'address' },
|
|
1789
1815
|
{ name: 'L', internalType: 'uint256', type: 'uint256' },
|
|
1790
1816
|
{ name: 'maxQuoteIn', internalType: 'uint256', type: 'uint256' },
|
|
@@ -2064,7 +2090,7 @@ export const managerFAbi = [
|
|
|
2064
2090
|
},
|
|
2065
2091
|
{ name: 'gen', internalType: 'uint256', type: 'uint256', indexed: true },
|
|
2066
2092
|
{
|
|
2067
|
-
name: '
|
|
2093
|
+
name: 'owner',
|
|
2068
2094
|
internalType: 'address',
|
|
2069
2095
|
type: 'address',
|
|
2070
2096
|
indexed: true,
|
|
@@ -2110,6 +2136,12 @@ export const managerFAbi = [
|
|
|
2110
2136
|
indexed: true,
|
|
2111
2137
|
},
|
|
2112
2138
|
{ name: 'gen', internalType: 'uint256', type: 'uint256', indexed: true },
|
|
2139
|
+
{
|
|
2140
|
+
name: 'operator',
|
|
2141
|
+
internalType: 'address',
|
|
2142
|
+
type: 'address',
|
|
2143
|
+
indexed: true,
|
|
2144
|
+
},
|
|
2113
2145
|
{
|
|
2114
2146
|
name: 'supply',
|
|
2115
2147
|
internalType: 'uint256',
|
|
@@ -2136,6 +2168,12 @@ export const managerFAbi = [
|
|
|
2136
2168
|
indexed: true,
|
|
2137
2169
|
},
|
|
2138
2170
|
{ name: 'to', internalType: 'address', type: 'address', indexed: true },
|
|
2171
|
+
{
|
|
2172
|
+
name: 'operator',
|
|
2173
|
+
internalType: 'address',
|
|
2174
|
+
type: 'address',
|
|
2175
|
+
indexed: true,
|
|
2176
|
+
},
|
|
2139
2177
|
{ name: 'gen', internalType: 'uint256', type: 'uint256', indexed: false },
|
|
2140
2178
|
{
|
|
2141
2179
|
name: 'income',
|
|
@@ -2236,6 +2274,12 @@ export const managerFAbi = [
|
|
|
2236
2274
|
indexed: true,
|
|
2237
2275
|
},
|
|
2238
2276
|
{ name: 'gen', internalType: 'uint256', type: 'uint256', indexed: true },
|
|
2277
|
+
{
|
|
2278
|
+
name: 'operator',
|
|
2279
|
+
internalType: 'address',
|
|
2280
|
+
type: 'address',
|
|
2281
|
+
indexed: true,
|
|
2282
|
+
},
|
|
2239
2283
|
{
|
|
2240
2284
|
name: 'quoteAmount',
|
|
2241
2285
|
internalType: 'uint256',
|
|
@@ -2299,11 +2343,17 @@ export const managerFAbi = [
|
|
|
2299
2343
|
indexed: true,
|
|
2300
2344
|
},
|
|
2301
2345
|
{
|
|
2302
|
-
name: '
|
|
2346
|
+
name: 'creator',
|
|
2303
2347
|
internalType: 'address',
|
|
2304
2348
|
type: 'address',
|
|
2305
2349
|
indexed: true,
|
|
2306
2350
|
},
|
|
2351
|
+
{
|
|
2352
|
+
name: 'policy',
|
|
2353
|
+
internalType: 'address',
|
|
2354
|
+
type: 'address',
|
|
2355
|
+
indexed: false,
|
|
2356
|
+
},
|
|
2307
2357
|
{
|
|
2308
2358
|
name: 'bases',
|
|
2309
2359
|
internalType: 'address[]',
|
|
@@ -2355,8 +2405,13 @@ export const managerFAbi = [
|
|
|
2355
2405
|
type: 'bytes32',
|
|
2356
2406
|
indexed: true,
|
|
2357
2407
|
},
|
|
2358
|
-
{
|
|
2359
|
-
|
|
2408
|
+
{
|
|
2409
|
+
name: 'owner',
|
|
2410
|
+
internalType: 'address',
|
|
2411
|
+
type: 'address',
|
|
2412
|
+
indexed: true,
|
|
2413
|
+
},
|
|
2414
|
+
{ name: 'gen', internalType: 'uint256', type: 'uint256', indexed: true },
|
|
2360
2415
|
{ name: 'L', internalType: 'uint256', type: 'uint256', indexed: false },
|
|
2361
2416
|
{
|
|
2362
2417
|
name: 'shares',
|
|
@@ -2396,7 +2451,19 @@ export const managerFAbi = [
|
|
|
2396
2451
|
indexed: true,
|
|
2397
2452
|
},
|
|
2398
2453
|
{ name: 'to', internalType: 'address', type: 'address', indexed: true },
|
|
2399
|
-
{ name: 'gen', internalType: 'uint256', type: 'uint256', indexed:
|
|
2454
|
+
{ name: 'gen', internalType: 'uint256', type: 'uint256', indexed: true },
|
|
2455
|
+
{
|
|
2456
|
+
name: 'sender',
|
|
2457
|
+
internalType: 'address',
|
|
2458
|
+
type: 'address',
|
|
2459
|
+
indexed: false,
|
|
2460
|
+
},
|
|
2461
|
+
{
|
|
2462
|
+
name: 'payer',
|
|
2463
|
+
internalType: 'address',
|
|
2464
|
+
type: 'address',
|
|
2465
|
+
indexed: false,
|
|
2466
|
+
},
|
|
2400
2467
|
{ name: 'L', internalType: 'uint256', type: 'uint256', indexed: false },
|
|
2401
2468
|
{
|
|
2402
2469
|
name: 'shares',
|
|
@@ -3576,7 +3643,7 @@ export const routerCAbi = [
|
|
|
3576
3643
|
{ name: 'shares', internalType: 'uint256[]', type: 'uint256[]' },
|
|
3577
3644
|
{ name: 'minBaseOut', internalType: 'uint256', type: 'uint256' },
|
|
3578
3645
|
{ name: 'minQuoteOut', internalType: 'uint256', type: 'uint256' },
|
|
3579
|
-
{ name: '
|
|
3646
|
+
{ name: 'to', internalType: 'address', type: 'address' },
|
|
3580
3647
|
{ name: 'deadline', internalType: 'uint256', type: 'uint256' },
|
|
3581
3648
|
],
|
|
3582
3649
|
name: 'burn',
|
|
@@ -3592,7 +3659,7 @@ export const routerCAbi = [
|
|
|
3592
3659
|
{ name: 'poolId', internalType: 'bytes32', type: 'bytes32' },
|
|
3593
3660
|
{ name: 'quote', internalType: 'address', type: 'address' },
|
|
3594
3661
|
{ name: 'ids', internalType: 'uint256[]', type: 'uint256[]' },
|
|
3595
|
-
{ name: '
|
|
3662
|
+
{ name: 'to', internalType: 'address', type: 'address' },
|
|
3596
3663
|
{ name: 'deadline', internalType: 'uint256', type: 'uint256' },
|
|
3597
3664
|
],
|
|
3598
3665
|
name: 'claim',
|
|
@@ -3622,7 +3689,7 @@ export const routerCAbi = [
|
|
|
3622
3689
|
{ name: 'L', internalType: 'uint256', type: 'uint256' },
|
|
3623
3690
|
{ name: 'maxBaseIn', internalType: 'uint256', type: 'uint256' },
|
|
3624
3691
|
{ name: 'maxQuoteIn', internalType: 'uint256', type: 'uint256' },
|
|
3625
|
-
{ name: '
|
|
3692
|
+
{ name: 'to', internalType: 'address', type: 'address' },
|
|
3626
3693
|
{ name: 'deadline', internalType: 'uint256', type: 'uint256' },
|
|
3627
3694
|
],
|
|
3628
3695
|
name: 'createMarket',
|
|
@@ -3653,7 +3720,7 @@ export const routerCAbi = [
|
|
|
3653
3720
|
{ name: 'tokens', internalType: 'address[]', type: 'address[]' },
|
|
3654
3721
|
{ name: 'maxIn', internalType: 'uint256[]', type: 'uint256[]' },
|
|
3655
3722
|
{ name: 'minOut', internalType: 'uint256[]', type: 'uint256[]' },
|
|
3656
|
-
{ name: '
|
|
3723
|
+
{ name: 'to', internalType: 'address', type: 'address' },
|
|
3657
3724
|
],
|
|
3658
3725
|
},
|
|
3659
3726
|
{ name: 'deadline', internalType: 'uint256', type: 'uint256' },
|
|
@@ -3683,7 +3750,7 @@ export const routerCAbi = [
|
|
|
3683
3750
|
{ name: 'L', internalType: 'uint256', type: 'uint256' },
|
|
3684
3751
|
{ name: 'maxBaseIn', internalType: 'uint256', type: 'uint256' },
|
|
3685
3752
|
{ name: 'maxQuoteIn', internalType: 'uint256', type: 'uint256' },
|
|
3686
|
-
{ name: '
|
|
3753
|
+
{ name: 'to', internalType: 'address', type: 'address' },
|
|
3687
3754
|
{ name: 'deadline', internalType: 'uint256', type: 'uint256' },
|
|
3688
3755
|
],
|
|
3689
3756
|
name: 'mintBlended',
|
|
@@ -3705,7 +3772,7 @@ export const routerCAbi = [
|
|
|
3705
3772
|
{ name: 'toCap', internalType: 'int256', type: 'int256' },
|
|
3706
3773
|
{ name: 'maxBaseIn', internalType: 'uint256', type: 'uint256' },
|
|
3707
3774
|
{ name: 'maxQuoteIn', internalType: 'uint256', type: 'uint256' },
|
|
3708
|
-
{ name: '
|
|
3775
|
+
{ name: 'to', internalType: 'address', type: 'address' },
|
|
3709
3776
|
{ name: 'deadline', internalType: 'uint256', type: 'uint256' },
|
|
3710
3777
|
],
|
|
3711
3778
|
name: 'move',
|
|
@@ -3752,7 +3819,7 @@ export const routerCAbi = [
|
|
|
3752
3819
|
{ name: 'baseIn', internalType: 'bool', type: 'bool' },
|
|
3753
3820
|
{ name: 'amountIn', internalType: 'uint256', type: 'uint256' },
|
|
3754
3821
|
{ name: 'minOut', internalType: 'uint256', type: 'uint256' },
|
|
3755
|
-
{ name: '
|
|
3822
|
+
{ name: 'to', internalType: 'address', type: 'address' },
|
|
3756
3823
|
{ name: 'deadline', internalType: 'uint256', type: 'uint256' },
|
|
3757
3824
|
],
|
|
3758
3825
|
name: 'swapExactIn',
|
|
@@ -3775,7 +3842,7 @@ export const routerCAbi = [
|
|
|
3775
3842
|
{ name: 'tokenOut', internalType: 'address', type: 'address' },
|
|
3776
3843
|
{ name: 'amountIn', internalType: 'uint256', type: 'uint256' },
|
|
3777
3844
|
{ name: 'minOut', internalType: 'uint256', type: 'uint256' },
|
|
3778
|
-
{ name: '
|
|
3845
|
+
{ name: 'to', internalType: 'address', type: 'address' },
|
|
3779
3846
|
{ name: 'deadline', internalType: 'uint256', type: 'uint256' },
|
|
3780
3847
|
],
|
|
3781
3848
|
name: 'swapExactInPath',
|
|
@@ -3791,7 +3858,7 @@ export const routerCAbi = [
|
|
|
3791
3858
|
{ name: 'baseOut', internalType: 'bool', type: 'bool' },
|
|
3792
3859
|
{ name: 'amountOut', internalType: 'uint256', type: 'uint256' },
|
|
3793
3860
|
{ name: 'maxIn', internalType: 'uint256', type: 'uint256' },
|
|
3794
|
-
{ name: '
|
|
3861
|
+
{ name: 'to', internalType: 'address', type: 'address' },
|
|
3795
3862
|
{ name: 'deadline', internalType: 'uint256', type: 'uint256' },
|
|
3796
3863
|
],
|
|
3797
3864
|
name: 'swapExactOut',
|
|
@@ -3818,7 +3885,7 @@ export const routerCAbi = [
|
|
|
3818
3885
|
{ name: 'newL', internalType: 'uint256', type: 'uint256' },
|
|
3819
3886
|
{ name: 'maxBaseIn', internalType: 'uint256', type: 'uint256' },
|
|
3820
3887
|
{ name: 'maxQuoteIn', internalType: 'uint256', type: 'uint256' },
|
|
3821
|
-
{ name: '
|
|
3888
|
+
{ name: 'to', internalType: 'address', type: 'address' },
|
|
3822
3889
|
{ name: 'deadline', internalType: 'uint256', type: 'uint256' },
|
|
3823
3890
|
],
|
|
3824
3891
|
name: 'update',
|
|
@@ -3849,7 +3916,7 @@ export const routerCAbi = [
|
|
|
3849
3916
|
{ name: 'cap', internalType: 'int256', type: 'int256' },
|
|
3850
3917
|
{ name: 'L', internalType: 'uint256', type: 'uint256' },
|
|
3851
3918
|
{ name: 'maxIn', internalType: 'uint256', type: 'uint256' },
|
|
3852
|
-
{ name: '
|
|
3919
|
+
{ name: 'to', internalType: 'address', type: 'address' },
|
|
3853
3920
|
{ name: 'deadline', internalType: 'uint256', type: 'uint256' },
|
|
3854
3921
|
],
|
|
3855
3922
|
name: 'zapIn',
|
|
@@ -3859,14 +3926,6 @@ export const routerCAbi = [
|
|
|
3859
3926
|
],
|
|
3860
3927
|
stateMutability: 'nonpayable',
|
|
3861
3928
|
},
|
|
3862
|
-
{
|
|
3863
|
-
type: 'event',
|
|
3864
|
-
anonymous: false,
|
|
3865
|
-
inputs: [
|
|
3866
|
-
{ name: 'user', internalType: 'address', type: 'address', indexed: true },
|
|
3867
|
-
],
|
|
3868
|
-
name: 'RouterCall',
|
|
3869
|
-
},
|
|
3870
3929
|
{ type: 'error', inputs: [], name: 'BadFloor' },
|
|
3871
3930
|
{ type: 'error', inputs: [], name: 'BadRecipient' },
|
|
3872
3931
|
{ type: 'error', inputs: [], name: 'DeadlineExceeded' },
|
|
@@ -4028,16 +4087,7 @@ export const routerFAbi = [
|
|
|
4028
4087
|
outputs: [{ name: 'amountOut', internalType: 'uint256', type: 'uint256' }],
|
|
4029
4088
|
stateMutability: 'nonpayable',
|
|
4030
4089
|
},
|
|
4031
|
-
{
|
|
4032
|
-
type: 'event',
|
|
4033
|
-
anonymous: false,
|
|
4034
|
-
inputs: [
|
|
4035
|
-
{ name: 'user', internalType: 'address', type: 'address', indexed: true },
|
|
4036
|
-
],
|
|
4037
|
-
name: 'RouterCall',
|
|
4038
|
-
},
|
|
4039
4090
|
{ type: 'error', inputs: [], name: 'BadRecipient' },
|
|
4040
|
-
{ type: 'error', inputs: [], name: 'BadToken' },
|
|
4041
4091
|
{ type: 'error', inputs: [], name: 'DeadlineExceeded' },
|
|
4042
4092
|
{ type: 'error', inputs: [], name: 'DrainsBase' },
|
|
4043
4093
|
{ type: 'error', inputs: [], name: 'NotManager' },
|
|
@@ -4049,6 +4099,7 @@ export const routerFAbi = [
|
|
|
4049
4099
|
{ type: 'error', inputs: [], name: 'SlippageIn' },
|
|
4050
4100
|
{ type: 'error', inputs: [], name: 'SlippageOut' },
|
|
4051
4101
|
{ type: 'error', inputs: [], name: 'UnsupportedOp' },
|
|
4102
|
+
{ type: 'error', inputs: [], name: 'WrongToken' },
|
|
4052
4103
|
{ type: 'error', inputs: [], name: 'ZeroAmount' },
|
|
4053
4104
|
];
|
|
4054
4105
|
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
package/dist/history.d.ts
CHANGED
|
@@ -50,7 +50,7 @@ export interface EventLogsQuery {
|
|
|
50
50
|
* On the chain path the node is asked for the last {@link LATEST_SCAN_BLOCKS} blocks only.
|
|
51
51
|
*/
|
|
52
52
|
latest?: number;
|
|
53
|
-
/** Only events from these transactions — e.g. the
|
|
53
|
+
/** Only events from these transactions — e.g. the other events of a page of swaps. */
|
|
54
54
|
transactionHashes?: Hex[];
|
|
55
55
|
signal?: AbortSignal;
|
|
56
56
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -22,6 +22,5 @@ export * from "./tokencache.js";
|
|
|
22
22
|
export * from "./fpool.js";
|
|
23
23
|
export * from "./fees.js";
|
|
24
24
|
export * from "./history.js";
|
|
25
|
-
export * from "./views.js";
|
|
26
25
|
export { managerCAbi, managerFAbi, lensCAbi, lensFAbi, routerCAbi, routerFAbi, routerActionsAbi, policyFAbi, policyRegistryAbi, sponsorPolicyCAbi } from "./generated.js";
|
|
27
26
|
export * from "./admin.js";
|
package/dist/index.js
CHANGED
|
@@ -22,6 +22,5 @@ export * from "./tokencache.js";
|
|
|
22
22
|
export * from "./fpool.js";
|
|
23
23
|
export * from "./fees.js";
|
|
24
24
|
export * from "./history.js";
|
|
25
|
-
export * from "./views.js";
|
|
26
25
|
export { managerCAbi, managerFAbi, lensCAbi, lensFAbi, routerCAbi, routerFAbi, routerActionsAbi, policyFAbi, policyRegistryAbi, sponsorPolicyCAbi } from "./generated.js";
|
|
27
26
|
export * from "./admin.js";
|
package/dist/liquidity.d.ts
CHANGED
|
@@ -198,7 +198,8 @@ export declare function floor(c: LogswapClient, a: EditArgs & {
|
|
|
198
198
|
*
|
|
199
199
|
* ΔQ = L (ξ' − ξ), ΔR = 0
|
|
200
200
|
*
|
|
201
|
-
* because $R = Le^{-x}$ depends on neither the floor nor the withdrawal. No base moves
|
|
201
|
+
* because $R = Le^{-x}$ depends on neither the floor nor the withdrawal. No base moves beyond one
|
|
202
|
+
* wei (the edit's mint half rounds what it pays in up; the preview returns it), the price
|
|
202
203
|
* does not move, and depth is unchanged. **The cost, which a UI must show:** the position stops
|
|
203
204
|
* bidding below ξ'. `settleIn: "base"` swaps the proceeds into base in the same batch.
|
|
204
205
|
*/
|
package/dist/liquidity.js
CHANGED
|
@@ -254,7 +254,8 @@ export async function floor(c, a) {
|
|
|
254
254
|
*
|
|
255
255
|
* ΔQ = L (ξ' − ξ), ΔR = 0
|
|
256
256
|
*
|
|
257
|
-
* because $R = Le^{-x}$ depends on neither the floor nor the withdrawal. No base moves
|
|
257
|
+
* because $R = Le^{-x}$ depends on neither the floor nor the withdrawal. No base moves beyond one
|
|
258
|
+
* wei (the edit's mint half rounds what it pays in up; the preview returns it), the price
|
|
258
259
|
* does not move, and depth is unchanged. **The cost, which a UI must show:** the position stops
|
|
259
260
|
* bidding below ξ'. `settleIn: "base"` swaps the proceeds into base in the same batch.
|
|
260
261
|
*/
|
package/dist/positions.js
CHANGED
|
@@ -14,7 +14,6 @@ const C_POSITIONS_SLOT = 4n;
|
|
|
14
14
|
const U128 = (1n << 128n) - 1n;
|
|
15
15
|
import { isPosition, NO_CAP, positionId, unpackFloorCap } from "./ids.js";
|
|
16
16
|
import { getEventLogs } from "./history.js";
|
|
17
|
-
import { poolHolders } from "./views.js";
|
|
18
17
|
/**
|
|
19
18
|
* A class's aggregate state, read through `extsload` (C version 7: the manager's public
|
|
20
19
|
* `positions` mapping is gone behind it, decisions 065). The slot is `CPoolState`'s:
|
|
@@ -182,17 +181,7 @@ export async function positionsOf(c, key, owner) {
|
|
|
182
181
|
}));
|
|
183
182
|
return rows.map((r) => ({ id: r.id, floor: r.floor, cap: NO_CAP, capped: false, shares: r.shares, L: r.L, fees: r.fees }));
|
|
184
183
|
}
|
|
185
|
-
const ID_REGISTERED = parseAbiItem("event ClassRegistered(
|
|
186
|
-
/** The class ids `owner` holds in `pool`, from the indexer's `pool_holder` view; null when the indexer cannot answer. */
|
|
187
|
-
async function heldIdsFromView(c, indexer, pool, owner) {
|
|
188
|
-
try {
|
|
189
|
-
const rows = await poolHolders(indexer, { condition: { side: "C", poolId: pool.toLowerCase(), holder: owner.toLowerCase(), manager: managerC(c).toLowerCase() } });
|
|
190
|
-
return rows.filter((r) => r.balance > 0n && !r.isBackstop).map((r) => r.id);
|
|
191
|
-
}
|
|
192
|
-
catch {
|
|
193
|
-
return null; // the view is a cache: the ClassRegistered replay below answers the same
|
|
194
|
-
}
|
|
195
|
-
}
|
|
184
|
+
const ID_REGISTERED = parseAbiItem("event ClassRegistered(bytes32 indexed poolId, uint256 indexed id, int256 floor, int256 cap, bool capped)"); // C 17: poolId first;
|
|
196
185
|
/** Every class id ever registered in `pool` (`ClassRegistered`), from the indexer's table or the node. */
|
|
197
186
|
async function registeredIds(c, pool, fromBlock, indexer) {
|
|
198
187
|
const { logs } = await getEventLogs(c, { indexer, address: managerC(c), event: ID_REGISTERED, args: { poolId: pool }, fromBlock });
|
|
@@ -211,7 +200,7 @@ async function registeredIds(c, pool, fromBlock, indexer) {
|
|
|
211
200
|
export async function holdingsOf(c, key, owner, fromBlock, opts = {}) {
|
|
212
201
|
const pool = poolId(key);
|
|
213
202
|
const indexer = opts.indexer ?? c.indexerUrl;
|
|
214
|
-
const ids =
|
|
203
|
+
const ids = await registeredIds(c, pool, fromBlock, indexer);
|
|
215
204
|
if (ids.length === 0)
|
|
216
205
|
return [];
|
|
217
206
|
// one lens call: balance, class L, fees, floor and cap for every id the owner holds
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@logswap/sdk",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.100",
|
|
4
4
|
"description": "TypeScript SDK for Logswap, the liquidity primitive introducing the logarithmic invariant — typed wrappers over the ManagerF / ManagerC, RouterF / RouterC and LensF / LensC surface.",
|
|
5
5
|
"license": "GPL-2.0-or-later",
|
|
6
6
|
"type": "module",
|
package/src/actions.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* `execute(actions, settle)` runs a list of actions — mint, burn, update, claim, swap, path, in any
|
|
5
5
|
* order, across any C markets — under ONE manager lock. Each action accrues deltas on the router
|
|
6
6
|
* and settles nothing; the batch settles once per token in `settle.tokens`, pulling at most
|
|
7
|
-
* `maxIn[i]` from the caller and taking at least `minOut[i]` to
|
|
7
|
+
* `maxIn[i]` from the caller and taking at least `minOut[i]` to `settle.to`. A touched token
|
|
8
8
|
* left off the list fails the manager's own close (`TokensNotSettled`), so the list is also the
|
|
9
9
|
* caller's statement of which tokens may move.
|
|
10
10
|
*
|
|
@@ -51,8 +51,8 @@ export interface Settle {
|
|
|
51
51
|
tokens: readonly Address[];
|
|
52
52
|
maxIn: readonly bigint[];
|
|
53
53
|
minOut: readonly bigint[];
|
|
54
|
-
/** Receives whatever is taken, and the shares the actions mint. */
|
|
55
|
-
|
|
54
|
+
/** Receives whatever is taken, and the shares the actions mint (`Settle.to`; `recipient` before C 17). */
|
|
55
|
+
to: Address;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
/* payload encoding ========================================================== */
|
|
@@ -131,13 +131,13 @@ export function settlement(a: {
|
|
|
131
131
|
tokens: readonly Address[];
|
|
132
132
|
maxIn?: readonly bigint[];
|
|
133
133
|
minOut?: readonly bigint[];
|
|
134
|
-
|
|
134
|
+
to: Address;
|
|
135
135
|
}): Settle {
|
|
136
136
|
const n = a.tokens.length;
|
|
137
137
|
const maxIn = a.maxIn ?? a.tokens.map(() => UNBOUNDED);
|
|
138
138
|
const minOut = a.minOut ?? a.tokens.map(() => 0n);
|
|
139
139
|
if (maxIn.length !== n || minOut.length !== n) throw new Error("logswap: settlement bounds length mismatch");
|
|
140
|
-
return { tokens: a.tokens, maxIn, minOut,
|
|
140
|
+
return { tokens: a.tokens, maxIn, minOut, to: a.to };
|
|
141
141
|
}
|
|
142
142
|
|
|
143
143
|
export interface PairBounds {
|
|
@@ -148,12 +148,12 @@ export interface PairBounds {
|
|
|
148
148
|
}
|
|
149
149
|
|
|
150
150
|
/** Settle both of a market's tokens, in kind. */
|
|
151
|
-
export function settleInKind(key: PoolKey,
|
|
151
|
+
export function settleInKind(key: PoolKey, to: Address, b: PairBounds = {}): Settle {
|
|
152
152
|
return settlement({
|
|
153
153
|
tokens: [key.base, key.quote],
|
|
154
154
|
maxIn: [b.maxBaseIn ?? UNBOUNDED, b.maxQuoteIn ?? UNBOUNDED],
|
|
155
155
|
minOut: [b.minBaseOut ?? 0n, b.minQuoteOut ?? 0n],
|
|
156
|
-
|
|
156
|
+
to,
|
|
157
157
|
});
|
|
158
158
|
}
|
|
159
159
|
|
|
@@ -161,13 +161,13 @@ export function settleInKind(key: PoolKey, recipient: Address, b: PairBounds = {
|
|
|
161
161
|
* Settle in ONE of a market's tokens: the other is bound to zero both ways, so the batch must have
|
|
162
162
|
* netted it — which is what a trailing `OPEN_DELTA` swap does.
|
|
163
163
|
*/
|
|
164
|
-
export function settleOnly(key: PoolKey,
|
|
164
|
+
export function settleOnly(key: PoolKey, to: Address, side: "base" | "quote", b: { maxIn?: bigint; minOut?: bigint } = {}): Settle {
|
|
165
165
|
const base = side === "base";
|
|
166
166
|
return settlement({
|
|
167
167
|
tokens: [key.base, key.quote],
|
|
168
168
|
maxIn: [base ? (b.maxIn ?? UNBOUNDED) : 0n, base ? 0n : (b.maxIn ?? UNBOUNDED)],
|
|
169
169
|
minOut: [base ? (b.minOut ?? 0n) : 0n, base ? 0n : (b.minOut ?? 0n)],
|
|
170
|
-
|
|
170
|
+
to,
|
|
171
171
|
});
|
|
172
172
|
}
|
|
173
173
|
|
|
@@ -175,14 +175,14 @@ export function settleOnly(key: PoolKey, recipient: Address, side: "base" | "quo
|
|
|
175
175
|
|
|
176
176
|
export interface ExecuteArgs extends WriteOptions {
|
|
177
177
|
actions: readonly Action[];
|
|
178
|
-
settle: Omit<Settle, "
|
|
178
|
+
settle: Omit<Settle, "to"> & { to?: Address };
|
|
179
179
|
/** Tokens the batch may pull, for the Permit2 signatures. Defaults to every token with `maxIn > 0`. */
|
|
180
180
|
pullTokens?: readonly Address[];
|
|
181
181
|
}
|
|
182
182
|
|
|
183
183
|
/** Run a batch: one lock, one settlement per token, one transaction (Permit2 signatures ride inside). */
|
|
184
184
|
export async function execute(c: LogswapClient, a: ExecuteArgs): Promise<Hash> {
|
|
185
|
-
const settle: Settle = { ...a.settle,
|
|
185
|
+
const settle: Settle = { ...a.settle, to: a.settle.to ?? resolveRecipient(c, a) };
|
|
186
186
|
const pull = a.pullTokens ?? settle.tokens.filter((_, i) => settle.maxIn[i]! > 0n);
|
|
187
187
|
return sendRouterWriteWithPermits(
|
|
188
188
|
c,
|
|
@@ -196,7 +196,7 @@ export async function simulateExecute(
|
|
|
196
196
|
c: LogswapClient,
|
|
197
197
|
a: ExecuteArgs & { account?: Address },
|
|
198
198
|
): Promise<{ results: readonly Hex[]; flows: readonly bigint[] }> {
|
|
199
|
-
const settle: Settle = { ...a.settle,
|
|
199
|
+
const settle: Settle = { ...a.settle, to: a.settle.to ?? a.account ?? resolveRecipient(c, a) };
|
|
200
200
|
const [results, flows] = await simulateRouterWrite<readonly [readonly Hex[], readonly bigint[]]>(c, {
|
|
201
201
|
side: "C",
|
|
202
202
|
abi: routerCAbi,
|
package/src/client.ts
CHANGED
|
@@ -243,7 +243,11 @@ function guardChain(wallet: WalletClient, pub: PublicClient): WalletClient {
|
|
|
243
243
|
// `PermissionsSet` are `setGates(poolId, gates, operator)` / `GatesSet`; the birth answer is `(flags, tax, operator)`; the policy's
|
|
244
244
|
// numbers (tiers, quotes, spacings, tax) are constructor immutables; the swap and mint gates are one bit each (`GATE_SWAP`,
|
|
245
245
|
// `GATE_MINT`) and the cached operator passes with no policy call. No pool id moved.
|
|
246
|
-
|
|
246
|
+
// 17 (decision 107): every event names its actor and the routers emit none (`RouterCall` is gone). `mint(poolId, payer, to, floor, cap, L)`;
|
|
247
|
+
// `PositionMinted(poolId, to, id, sender, payer, shares, dBase, dQuote)`; `ProtocolFeesCollected(poolId, sender, to, amount)`;
|
|
248
|
+
// `ClassRegistered(poolId, id, floor, cap, capped)` (poolId first); the account acted on is `owner` on `PositionBurned` (was `from`),
|
|
249
|
+
// `PositionUpdated` and `FeesClaimed` (was `holder`); `RouterC`'s entries and `Settle` name the receiver `to` (was `recipient`). No pool id moved.
|
|
250
|
+
export const EXPECTED_VERSION = 17n;
|
|
247
251
|
/**
|
|
248
252
|
* The F manager's own tag (5 — the key's salt, pool names, the sponsor registry;
|
|
249
253
|
* 4 was the income-only harvest cut).
|
|
@@ -362,7 +366,12 @@ export const EXPECTED_VERSION = 16n;
|
|
|
362
366
|
// `IncomeHarvested(poolId, to, gen, income, capital, tax, toOperator, Q)`; `GenerationFrozen` from `close` alone; `IncomeReleased` and
|
|
363
367
|
// `PolicyMigrated` are gone. The policy's name is an event (`NameSet`), its lists are per policy (`setRights`, `RightsSet`), its
|
|
364
368
|
// modes per pool (`setSwapMode` / `setMintMode`, each Open < Listed < Operator with `mintMode ≥ swapMode`).
|
|
365
|
-
|
|
369
|
+
// 42 (decision 107): every event names its actor and the routers emit none (`RouterCall` is gone). `mint(poolId, payer, to, L, maxQuoteIn)`;
|
|
370
|
+
// `claim(poolId, gen, owner, to)` (the owner or its ERC-6909 operator); `SharesMinted(poolId, to, gen, sender, payer, L, shares, dQuote,
|
|
371
|
+
// poolL, supply)`; `SharesBurned` indexes `gen` and names `owner` (was `from`), `DividendClaimed` names `owner` (was `holder`);
|
|
372
|
+
// `PoolCreated(poolId, quote, creator, policy, bases, swapFeeIdx, salt)` (`creator` a topic, `policy` data); `LiquidityDeployed`,
|
|
373
|
+
// `IncomeHarvested` and `GenerationFrozen` carry `operator` as a topic; `RouterF.BadToken` is `WrongToken`. No pool id moved.
|
|
374
|
+
export const EXPECTED_F_VERSION = 42n;
|
|
366
375
|
|
|
367
376
|
export async function assertVersion(c: LogswapClient, expected = EXPECTED_VERSION): Promise<void> {
|
|
368
377
|
const { managerCAbi, managerFAbi } = await import("./generated.js");
|
package/src/fees.ts
CHANGED
|
@@ -15,22 +15,6 @@ import { managerC, type LogswapClient } from "./client.js";
|
|
|
15
15
|
import { managerCAbi } from "./generated.js";
|
|
16
16
|
import type { DiscoveredMarket } from "./pools.js";
|
|
17
17
|
import { getEventLogs } from "./history.js";
|
|
18
|
-
import { swapFlows } from "./views.js";
|
|
19
|
-
|
|
20
|
-
/** A C market's swap fees over [fromBlock, toBlock] from the indexer's swap_flow view; null when the indexer cannot answer. */
|
|
21
|
-
async function windowFromView(c: LogswapClient, indexer: string, poolId: string, fromBlock: bigint, toBlock: bigint): Promise<{ fees: bigint; swaps: number } | null> {
|
|
22
|
-
try {
|
|
23
|
-
const rows = await swapFlows(indexer, {
|
|
24
|
-
condition: { side: "C", poolId: poolId.toLowerCase(), manager: managerC(c).toLowerCase() },
|
|
25
|
-
filter: { blockNumber: { greaterThanOrEqualTo: fromBlock.toString(), lessThanOrEqualTo: toBlock.toString() } },
|
|
26
|
-
});
|
|
27
|
-
let fees = 0n;
|
|
28
|
-
for (const r of rows) fees += r.feeQuote;
|
|
29
|
-
return { fees, swaps: rows.length };
|
|
30
|
-
} catch {
|
|
31
|
-
return null; // the view is a cache: the Swap rows answer the same
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
18
|
|
|
35
19
|
const WAD = 10n ** 18n;
|
|
36
20
|
const YEAR_SECONDS = 31_536_000;
|
|
@@ -127,15 +111,11 @@ export async function swapFees(
|
|
|
127
111
|
const ev = managerCAbi.find((x): x is Ev => x.type === "event" && x.name === "Swap");
|
|
128
112
|
if (!ev) throw new Error("logswap: Swap event missing from the generated ABI");
|
|
129
113
|
|
|
130
|
-
// the event carries the fee the swap charged (decisions 050), exactly — no re-derivation from
|
|
131
|
-
// the indexer's swap_flow view carries the same figure per swap (`feeQuote`, C)
|
|
114
|
+
// the event carries the fee the swap charged (decisions 050), exactly — no re-derivation from φ
|
|
132
115
|
let fees = 0n;
|
|
133
116
|
let swaps = 0;
|
|
134
117
|
const indexer = opts.indexer ?? c.indexerUrl;
|
|
135
|
-
|
|
136
|
-
if (viewed) {
|
|
137
|
-
({ fees, swaps } = viewed);
|
|
138
|
-
} else if (fromBlock <= toBlock) {
|
|
118
|
+
if (fromBlock <= toBlock) {
|
|
139
119
|
const { logs } = await getEventLogs<{ fee: bigint }>(c, { indexer, address: managerC(c), event: ev, args: { poolId: m.poolId }, fromBlock, toBlock });
|
|
140
120
|
for (const l of logs) fees += l.args.fee;
|
|
141
121
|
swaps = logs.length;
|