@logswap/sdk 0.5.87 → 0.5.89
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 +18 -1
- package/dist/actions.d.ts +1 -1
- package/dist/actions.js +8 -7
- package/dist/claims.d.ts +1 -1
- package/dist/claims.js +2 -1
- package/dist/client.d.ts +2 -2
- package/dist/client.js +8 -3
- package/dist/fpool.d.ts +3 -3
- package/dist/fpool.js +7 -7
- package/dist/generated.d.ts +423 -1422
- package/dist/generated.js +297 -782
- package/dist/history.js +1 -1
- package/dist/indexer.d.ts +1 -1
- package/dist/indexer.js +5 -5
- package/dist/liquidity.d.ts +4 -4
- package/dist/liquidity.js +19 -8
- package/dist/pools.d.ts +19 -19
- package/dist/pools.js +15 -15
- package/dist/positions.js +3 -3
- package/dist/swap.d.ts +1 -1
- package/dist/swap.js +26 -5
- package/package.json +1 -1
- package/src/actions.ts +8 -8
- package/src/claims.ts +2 -2
- package/src/client.ts +8 -3
- package/src/fpool.ts +10 -10
- package/src/generated.ts +297 -782
- package/src/history.ts +1 -1
- package/src/indexer.ts +6 -6
- package/src/liquidity.ts +21 -11
- package/src/pools.ts +35 -34
- package/src/positions.ts +3 -3
- package/src/swap.ts +26 -6
package/src/fpool.ts
CHANGED
|
@@ -67,8 +67,8 @@ export interface FPoolState {
|
|
|
67
67
|
poolId: Hex;
|
|
68
68
|
quote: Address;
|
|
69
69
|
bases: Address[];
|
|
70
|
-
/** WAD
|
|
71
|
-
|
|
70
|
+
/** Each base asset's fraction of the pool's `L`, WAD, summing to WAD, derived at each deployment (`weights` before decision 090). `L_j = liquidityWeight_j · L`. */
|
|
71
|
+
liquidityWeights: bigint[];
|
|
72
72
|
/** Per-asset log prices, WAD. Price is derived; `x` is the state. */
|
|
73
73
|
x: bigint[];
|
|
74
74
|
/** Quote reserve. The one leg a base→quote swap can exhaust. */
|
|
@@ -164,9 +164,9 @@ export async function getFPool(c: LogswapClient, poolId: Hex): Promise<FPoolStat
|
|
|
164
164
|
return {
|
|
165
165
|
poolId,
|
|
166
166
|
quote: p.quote,
|
|
167
|
-
bases: v.
|
|
168
|
-
|
|
169
|
-
x: v.
|
|
167
|
+
bases: v.baseAssets.map((l) => l.base),
|
|
168
|
+
liquidityWeights: v.baseAssets.map((l) => l.liquidityWeight),
|
|
169
|
+
x: v.baseAssets.map((l) => l.x), // derived by the manager: x_j = ln(w_j·L / R̃_j)
|
|
170
170
|
Q: p.Q,
|
|
171
171
|
L: p.L,
|
|
172
172
|
swapFee: p.swapFee,
|
|
@@ -185,9 +185,9 @@ export async function getFPool(c: LogswapClient, poolId: Hex): Promise<FPoolStat
|
|
|
185
185
|
seeded: p.seeded,
|
|
186
186
|
gen: Number(p.gen),
|
|
187
187
|
totalSupply: p.shares,
|
|
188
|
-
reserves: v.
|
|
189
|
-
virtualReserves: v.
|
|
190
|
-
kappa: v.
|
|
188
|
+
reserves: v.baseAssets.map((l) => l.reserve), // the state
|
|
189
|
+
virtualReserves: v.baseAssets.map((l) => l.virtualReserve),
|
|
190
|
+
kappa: v.baseAssets.map((l) => l.kappa),
|
|
191
191
|
};
|
|
192
192
|
}
|
|
193
193
|
|
|
@@ -355,7 +355,7 @@ export function fPoolShareValue(s: FPoolState): bigint {
|
|
|
355
355
|
v = s.Q;
|
|
356
356
|
for (let j = 0; j < s.reserves.length; j++) {
|
|
357
357
|
const rv = s.virtualReserves[j]!;
|
|
358
|
-
if (rv !== 0n) v += (((s.
|
|
358
|
+
if (rv !== 0n) v += (((s.liquidityWeights[j]! * s.L) / WAD) * s.reserves[j]!) / rv;
|
|
359
359
|
}
|
|
360
360
|
}
|
|
361
361
|
return (v * WAD) / s.totalSupply;
|
|
@@ -1004,7 +1004,7 @@ export interface FPoolCreateArgs {
|
|
|
1004
1004
|
quote: Address;
|
|
1005
1005
|
/** The pool's assets, in any order; sorted into the key's canonical order before the call. The set is fixed for the pool's life. */
|
|
1006
1006
|
bases: Address[];
|
|
1007
|
-
/** The swap fee, WAD.
|
|
1007
|
+
/** The swap fee, WAD. Base-for-base pays it once, like any swap (F 39). A curated policy admits only its listed tiers (decisions 059). */
|
|
1008
1008
|
swapFee: bigint;
|
|
1009
1009
|
/**
|
|
1010
1010
|
* The pool's mint fee, WAD of newly-minted L — the creator's pick, a key field fixed for life (F 38, decision
|