@logswap/sdk 0.5.81 → 0.5.83
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/dist/generated.d.ts +0 -4
- package/dist/generated.js +0 -1
- package/dist/history.js +14 -3
- package/package.json +1 -1
- package/src/generated.ts +0 -1
- package/src/history.ts +17 -3
package/dist/generated.d.ts
CHANGED
|
@@ -3431,10 +3431,6 @@ export declare const fPoolManagerAbi: readonly [{
|
|
|
3431
3431
|
readonly indexed: true;
|
|
3432
3432
|
}];
|
|
3433
3433
|
readonly name: "TreasuryProposed";
|
|
3434
|
-
}, {
|
|
3435
|
-
readonly type: "error";
|
|
3436
|
-
readonly inputs: readonly [];
|
|
3437
|
-
readonly name: "AlreadySeeded";
|
|
3438
3434
|
}, {
|
|
3439
3435
|
readonly type: "error";
|
|
3440
3436
|
readonly inputs: readonly [];
|
package/dist/generated.js
CHANGED
|
@@ -2344,7 +2344,6 @@ export const fPoolManagerAbi = [
|
|
|
2344
2344
|
],
|
|
2345
2345
|
name: 'TreasuryProposed',
|
|
2346
2346
|
},
|
|
2347
|
-
{ type: 'error', inputs: [], name: 'AlreadySeeded' },
|
|
2348
2347
|
{ type: 'error', inputs: [], name: 'AlreadyUnlocked' },
|
|
2349
2348
|
{ type: 'error', inputs: [], name: 'BadLeg' },
|
|
2350
2349
|
{ type: 'error', inputs: [], name: 'BadParam' },
|
package/dist/history.js
CHANGED
|
@@ -84,11 +84,22 @@ export function tableFor(c, address, event, contract) {
|
|
|
84
84
|
return { field: `all${plural(type)}`, type };
|
|
85
85
|
}
|
|
86
86
|
const emitters = (q) => (Array.isArray(q.address) ? [...q.address] : [q.address]);
|
|
87
|
-
|
|
87
|
+
/**
|
|
88
|
+
* A column as the indexer serves it, typed by the ABI: numbers are strings, addresses lowercase, an
|
|
89
|
+
* array a JSON array, and a tuple a JSON object keyed by component name with the same conventions
|
|
90
|
+
* inside (`LiquidityDeployed.baseAssets`, F 38: `{base, amount, priceX36}[]` with string amounts).
|
|
91
|
+
* Decoding recurses into the components, so a tuple's numbers come out as bigints like the node's.
|
|
92
|
+
*/
|
|
93
|
+
function decode(p, v) {
|
|
88
94
|
if (v === null || v === undefined)
|
|
89
95
|
return v;
|
|
96
|
+
const { type } = p;
|
|
90
97
|
if (type.endsWith("[]"))
|
|
91
|
-
return v.map((x) => decode(type.slice(0, -2), x));
|
|
98
|
+
return v.map((x) => decode({ ...p, type: type.slice(0, -2) }, x));
|
|
99
|
+
if (type === "tuple") {
|
|
100
|
+
const o = v;
|
|
101
|
+
return Object.fromEntries((p.components ?? []).map((c) => [c.name, decode(c, o[c.name])]));
|
|
102
|
+
}
|
|
92
103
|
if (type.startsWith("uint") || type.startsWith("int"))
|
|
93
104
|
return BigInt(v);
|
|
94
105
|
if (type === "address")
|
|
@@ -171,7 +182,7 @@ async function fromIndexer(c, q) {
|
|
|
171
182
|
.filter((r) => want.has(String(r.contractAddress).toLowerCase()))
|
|
172
183
|
.map((r) => ({
|
|
173
184
|
address: want.get(String(r.contractAddress).toLowerCase()),
|
|
174
|
-
args: Object.fromEntries(inputs.map((i) => [i.name, decode(i
|
|
185
|
+
args: Object.fromEntries(inputs.map((i) => [i.name, decode(i, r[column(i.name)])])),
|
|
175
186
|
blockNumber: BigInt(r.blockNumber),
|
|
176
187
|
blockTimestamp: Math.floor(Date.parse(r.blockTimestamp) / 1000),
|
|
177
188
|
transactionHash: r.txHash,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@logswap/sdk",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.83",
|
|
4
4
|
"description": "TypeScript SDK for Logswap, the liquidity primitive introducing the logarithmic invariant — typed wrappers over the CPoolManager / FPoolManager / Router / Lens surface.",
|
|
5
5
|
"license": "GPL-2.0-or-later",
|
|
6
6
|
"type": "module",
|
package/src/generated.ts
CHANGED
|
@@ -2347,7 +2347,6 @@ export const fPoolManagerAbi = [
|
|
|
2347
2347
|
],
|
|
2348
2348
|
name: 'TreasuryProposed',
|
|
2349
2349
|
},
|
|
2350
|
-
{ type: 'error', inputs: [], name: 'AlreadySeeded' },
|
|
2351
2350
|
{ type: 'error', inputs: [], name: 'AlreadyUnlocked' },
|
|
2352
2351
|
{ type: 'error', inputs: [], name: 'BadLeg' },
|
|
2353
2352
|
{ type: 'error', inputs: [], name: 'BadParam' },
|
package/src/history.ts
CHANGED
|
@@ -127,9 +127,23 @@ export function tableFor(c: LogswapClient, address: Address, event: string, cont
|
|
|
127
127
|
|
|
128
128
|
const emitters = (q: { address: Address | readonly Address[] }): Address[] => (Array.isArray(q.address) ? [...q.address] : [q.address as Address]);
|
|
129
129
|
|
|
130
|
-
|
|
130
|
+
/** An ABI parameter as far as decoding needs it: its type and, for a tuple, its components. */
|
|
131
|
+
type Param = { readonly name?: string; readonly type: string; readonly components?: readonly Param[] };
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* A column as the indexer serves it, typed by the ABI: numbers are strings, addresses lowercase, an
|
|
135
|
+
* array a JSON array, and a tuple a JSON object keyed by component name with the same conventions
|
|
136
|
+
* inside (`LiquidityDeployed.baseAssets`, F 38: `{base, amount, priceX36}[]` with string amounts).
|
|
137
|
+
* Decoding recurses into the components, so a tuple's numbers come out as bigints like the node's.
|
|
138
|
+
*/
|
|
139
|
+
function decode(p: Param, v: unknown): unknown {
|
|
131
140
|
if (v === null || v === undefined) return v;
|
|
132
|
-
|
|
141
|
+
const { type } = p;
|
|
142
|
+
if (type.endsWith("[]")) return (v as unknown[]).map((x) => decode({ ...p, type: type.slice(0, -2) }, x));
|
|
143
|
+
if (type === "tuple") {
|
|
144
|
+
const o = v as Record<string, unknown>;
|
|
145
|
+
return Object.fromEntries((p.components ?? []).map((c) => [c.name!, decode(c, o[c.name!])]));
|
|
146
|
+
}
|
|
133
147
|
if (type.startsWith("uint") || type.startsWith("int")) return BigInt(v as string);
|
|
134
148
|
if (type === "address") return getAddress(v as string);
|
|
135
149
|
return v; // bool, bytes32 (hex string), string
|
|
@@ -205,7 +219,7 @@ async function fromIndexer<A>(c: LogswapClient, q: EventLogsQuery): Promise<Hist
|
|
|
205
219
|
.filter((r) => want.has(String(r.contractAddress).toLowerCase()))
|
|
206
220
|
.map((r) => ({
|
|
207
221
|
address: want.get(String(r.contractAddress).toLowerCase())!,
|
|
208
|
-
args: Object.fromEntries(inputs.map((i) => [i.name!, decode(i
|
|
222
|
+
args: Object.fromEntries(inputs.map((i) => [i.name!, decode(i, r[column(i.name!)])])) as A,
|
|
209
223
|
blockNumber: BigInt(r.blockNumber as string),
|
|
210
224
|
blockTimestamp: Math.floor(Date.parse(r.blockTimestamp as string) / 1000),
|
|
211
225
|
transactionHash: r.txHash as Hex,
|