@moonwell-fi/moonwell-sdk 0.20.4 → 0.21.0
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/CHANGELOG.md +20 -0
- package/_cjs/actions/core/markets/getMarketSnapshots.js +1 -83
- package/_cjs/actions/core/markets/getMarketSnapshots.js.map +1 -1
- package/_cjs/actions/core/user-positions/getUserPositionSnapshots.js +1 -59
- package/_cjs/actions/core/user-positions/getUserPositionSnapshots.js.map +1 -1
- package/_cjs/actions/governance/common.js +15 -2
- package/_cjs/actions/governance/common.js.map +1 -1
- package/_cjs/actions/governance/getCirculatingSupplySnapshots.js +1 -49
- package/_cjs/actions/governance/getCirculatingSupplySnapshots.js.map +1 -1
- package/_cjs/actions/governance/getStakingSnapshots.js +1 -41
- package/_cjs/actions/governance/getStakingSnapshots.js.map +1 -1
- package/_cjs/actions/governance/proposals/common.js +1 -1
- package/_cjs/actions/governance/proposals/common.js.map +1 -1
- package/_cjs/environments/definitions/governance.js +0 -7
- package/_cjs/environments/definitions/governance.js.map +1 -1
- package/_cjs/errors/version.js +1 -1
- package/_esm/actions/core/markets/getMarketSnapshots.js +1 -83
- package/_esm/actions/core/markets/getMarketSnapshots.js.map +1 -1
- package/_esm/actions/core/user-positions/getUserPositionSnapshots.js +3 -62
- package/_esm/actions/core/user-positions/getUserPositionSnapshots.js.map +1 -1
- package/_esm/actions/governance/common.js +29 -3
- package/_esm/actions/governance/common.js.map +1 -1
- package/_esm/actions/governance/getCirculatingSupplySnapshots.js +2 -50
- package/_esm/actions/governance/getCirculatingSupplySnapshots.js.map +1 -1
- package/_esm/actions/governance/getStakingSnapshots.js +1 -41
- package/_esm/actions/governance/getStakingSnapshots.js.map +1 -1
- package/_esm/actions/governance/proposals/common.js +12 -1
- package/_esm/actions/governance/proposals/common.js.map +1 -1
- package/_esm/actions/lunar-indexer-client.js +1 -1
- package/_esm/environments/definitions/governance.js +0 -7
- package/_esm/environments/definitions/governance.js.map +1 -1
- package/_esm/errors/version.js +1 -1
- package/_types/actions/core/markets/getMarketSnapshots.d.ts.map +1 -1
- package/_types/actions/core/user-positions/getUserPositionSnapshots.d.ts +1 -2
- package/_types/actions/core/user-positions/getUserPositionSnapshots.d.ts.map +1 -1
- package/_types/actions/governance/common.d.ts.map +1 -1
- package/_types/actions/governance/getCirculatingSupplySnapshots.d.ts.map +1 -1
- package/_types/actions/governance/getStakingSnapshots.d.ts.map +1 -1
- package/_types/actions/governance/proposals/common.d.ts.map +1 -1
- package/_types/actions/lunar-indexer-client.d.ts +1 -1
- package/_types/environments/definitions/governance.d.ts +0 -7
- package/_types/environments/definitions/governance.d.ts.map +1 -1
- package/_types/errors/version.d.ts +1 -1
- package/actions/core/markets/getMarketSnapshots.ts +1 -118
- package/actions/core/user-positions/getUserPositionSnapshots.ts +2 -91
- package/actions/governance/common.ts +39 -3
- package/actions/governance/getCirculatingSupplySnapshots.ts +3 -72
- package/actions/governance/getStakingSnapshots.ts +1 -59
- package/actions/governance/proposals/common.ts +12 -1
- package/actions/lunar-indexer-client.ts +1 -1
- package/environments/definitions/governance.ts +0 -7
- package/errors/version.ts +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getMarketSnapshots.d.ts","sourceRoot":"","sources":["../../../../actions/core/markets/getMarketSnapshots.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AAC9E,OAAO,EACL,KAAK,cAAc,EAMpB,MAAM,0BAA0B,CAAC;AAElC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AACrE,OAAO,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"getMarketSnapshots.d.ts","sourceRoot":"","sources":["../../../../actions/core/markets/getMarketSnapsh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AAE,CAAC,CA2B3B"}
|
|
@@ -33,8 +33,7 @@ export type GetUserPositionSnapshotsReturnType = Promise<UserPositionSnapshot[]>
|
|
|
33
33
|
* @remarks
|
|
34
34
|
* - Default behavior (no time parameters): Returns 365 days of history
|
|
35
35
|
* - Parameter priority: Custom timestamps > period > default (365 days)
|
|
36
|
-
* -
|
|
37
|
-
* - Snapshots are filtered to start-of-day for "1d" granularity
|
|
36
|
+
* - Environments without a Lunar Indexer configured return an empty array
|
|
38
37
|
*/
|
|
39
38
|
export declare function getUserPositionSnapshots<environments, Network extends Chain | undefined>(client: MoonwellClient, args: GetUserPositionSnapshotsParameters<environments, Network>): GetUserPositionSnapshotsReturnType;
|
|
40
39
|
//# sourceMappingURL=getUserPositionSnapshots.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getUserPositionSnapshots.d.ts","sourceRoot":"","sources":["../../../../actions/core/user-positions/getUserPositionSnapshots.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AAC9E,OAAO,EACL,KAAK,cAAc,
|
|
1
|
+
{"version":3,"file":"getUserPositionSnapshots.d.ts","sourceRoot":"","sources":["../../../../actions/core/user-positions/getUserPositionSnapshots.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AAC9E,OAAO,EACL,KAAK,cAAc,EAKpB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AACrE,OAAO,KAAK,EAAE,KAAK,EAAe,MAAM,gCAAgC,CAAC;AACzE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AAO3E,MAAM,MAAM,kCAAkC,CAC5C,YAAY,EACZ,OAAO,SAAS,KAAK,GAAG,SAAS,IAC/B,oBAAoB,CAAC,YAAY,EAAE,OAAO,CAAC,GAAG;IAChD,kBAAkB;IAClB,WAAW,EAAE,OAAO,CAAC;IACrB,2CAA2C;IAC3C,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,kHAAkH;IAClH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gHAAgH;IAChH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,yCAAyC;IACzC,WAAW,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,kCAAkC,GAAG,OAAO,CACtD,oBAAoB,EAAE,CACvB,CAAC;AAEF;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,wBAAwB,CAC5C,YAAY,EACZ,OAAO,SAAS,KAAK,GAAG,SAAS,EAEjC,MAAM,EAAE,cAAc,EACtB,IAAI,EAAE,kCAAkC,CAAC,YAAY,EAAE,OAAO,CAAC,GAC9D,kCAAkC,CAepC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../actions/governance/common.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AA2CpC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE;QACL,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE,MAAM,CAAC;QACjB,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;IACF,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../actions/governance/common.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AA2CpC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE;QACL,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE,MAAM,CAAC;QACjB,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;IACF,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAqCF,+EAA+E;AAC/E,wBAAgB,0BAA0B,IAAI,IAAI,CAEjD;AAED;;;GAGG;AACH,wBAAsB,mBAAmB,CACvC,eAAe,CAAC,EAAE,MAAM,GACvB,OAAO,CAAC,MAAM,EAAE,CAAC,CAiCnB;AAED,wBAAsB,mBAAmB,CACvC,UAAU,EAAE,MAAM,EAAE,EACpB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,OAAO,EAChB,eAAe,CAAC,EAAE,MAAM,GACvB,OAAO,CAAC,WAAW,EAAE,CAAC,CAiHxB;AAED,wBAAsB,kBAAkB,CACtC,eAAe,EAAE,MAAM,EACvB,eAAe,CAAC,EAAE,MAAM,GACvB,OAAO,CAAC,MAAM,CAAC,CA6BjB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getCirculatingSupplySnapshots.d.ts","sourceRoot":"","sources":["../../../actions/governance/getCirculatingSupplySnapshots.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AAE3E,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AAC1E,OAAO,KAAK,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"getCirculatingSupplySnapshots.d.ts","sourceRoot":"","sources":["../../../actions/governance/getCirculatingSupplySnapshots.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AAE3E,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AAC1E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;AAGlF,MAAM,MAAM,uCAAuC,CACjD,YAAY,EACZ,OAAO,SAAS,KAAK,GAAG,SAAS,IAC/B,4BAA4B,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;AAExD,MAAM,MAAM,uCAAuC,GAAG,OAAO,CAC3D,yBAAyB,EAAE,CAC5B,CAAC;AAgDF,wBAAsB,6BAA6B,CACjD,YAAY,EACZ,OAAO,SAAS,KAAK,GAAG,SAAS,EAEjC,MAAM,EAAE,cAAc,EACtB,IAAI,CAAC,EAAE,uCAAuC,CAAC,YAAY,EAAE,OAAO,CAAC,GACpE,uCAAuC,CA2CzC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getStakingSnapshots.d.ts","sourceRoot":"","sources":["../../../actions/governance/getStakingSnapshots.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AAC3E,OAAO,EACL,KAAK,cAAc,EAKpB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"getStakingSnapshots.d.ts","sourceRoot":"","sources":["../../../actions/governance/getStakingSnapshots.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AAC3E,OAAO,EACL,KAAK,cAAc,EAKpB,MAAM,uBAAuB,C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AAC;CACvB,CAAC;AA0CF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,uBAAuB,GAClC,SAAS,MAAM,KACd,WAAW,GAAG,SAGd,CAAC;AAEJ,eAAO,MAAM,qBAAqB,GAChC,cAAc,WAAW,EAAE,EAC3B,uBAAuB,WAAW,KACjC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CA6B7B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,uBAAuB,GAClC,cAAc,WAAW,EAAE,EAC3B,uBAAuB,WAAW,EAClC,UAAU;IAAE,iBAAiB,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,KACpD,OAAO,CAAC,mBAAmB,EAAE,CAqM/B,CAAC"}
|
|
@@ -198,7 +198,7 @@ export declare class LunarIndexerError extends Error {
|
|
|
198
198
|
constructor(message: string, statusCode?: number | undefined, endpoint?: string | undefined, originalError?: Error | undefined);
|
|
199
199
|
}
|
|
200
200
|
/**
|
|
201
|
-
* Determine if an error should trigger fallback to
|
|
201
|
+
* Determine if an error should trigger fallback to on-chain data
|
|
202
202
|
*/
|
|
203
203
|
export declare function shouldFallback(error: unknown): boolean;
|
|
204
204
|
export declare const DEFAULT_LUNAR_TIMEOUT_MS = 10000;
|
|
@@ -9,13 +9,6 @@ export interface GovernanceTokensType {
|
|
|
9
9
|
[token: string]: GovernanceTokenInfo;
|
|
10
10
|
}
|
|
11
11
|
export declare const GovernanceTokensConfig: {
|
|
12
|
-
WELL_TESTNET: {
|
|
13
|
-
id: string;
|
|
14
|
-
symbol: string;
|
|
15
|
-
name: string;
|
|
16
|
-
chainIds: number[];
|
|
17
|
-
testnet: true;
|
|
18
|
-
};
|
|
19
12
|
WELL: {
|
|
20
13
|
id: string;
|
|
21
14
|
symbol: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"governance.d.ts","sourceRoot":"","sources":["../../../environments/definitions/governance.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACxB,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,oBAAoB;IACnC,CAAC,KAAK,EAAE,MAAM,GAAG,mBAAmB,CAAC;CACtC;AAQD,eAAO,MAAM,sBAAsB;;;;;
|
|
1
|
+
{"version":3,"file":"governance.d.ts","sourceRoot":"","sources":["../../../environments/definitions/governance.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACxB,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,oBAAoB;IACnC,CAAC,KAAK,EAAE,MAAM,GAAG,mBAAmB,CAAC;CACtC;AAQD,eAAO,MAAM,sBAAsB;;;;;kBAK8B,MAAM,EAAE;;;;;;;kBAOzC,MAAM,EAAE;;;CAGtC,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,MAAM,OAAO,sBAAsB,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const version = "0.
|
|
1
|
+
export declare const version = "0.21.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
|
@@ -11,7 +11,6 @@ import { buildMarketId } from "../../../common/lunar-indexer-helpers.js";
|
|
|
11
11
|
import type { NetworkParameterType } from "../../../common/types.js";
|
|
12
12
|
import type { Chain, Environment } from "../../../environments/index.js";
|
|
13
13
|
import type { MarketSnapshot } from "../../../types/market.js";
|
|
14
|
-
import { postWithRetry } from "../../axiosWithRetry.js";
|
|
15
14
|
import {
|
|
16
15
|
DEFAULT_LUNAR_TIMEOUT_MS,
|
|
17
16
|
createLunarIndexerClient,
|
|
@@ -141,23 +140,7 @@ async function fetchCoreMarketSnapshots(
|
|
|
141
140
|
endTime?: number,
|
|
142
141
|
): Promise<MarketSnapshot[]> {
|
|
143
142
|
if (!environment.lunarIndexerUrl) {
|
|
144
|
-
|
|
145
|
-
try {
|
|
146
|
-
return await fetchCoreMarketSnapshotsFromPonder(
|
|
147
|
-
marketAddress,
|
|
148
|
-
environment,
|
|
149
|
-
);
|
|
150
|
-
} catch (error) {
|
|
151
|
-
console.warn(
|
|
152
|
-
`[getMarketSnapshots] Ponder failed for chain ${environment.chainId}:`,
|
|
153
|
-
error,
|
|
154
|
-
);
|
|
155
|
-
environment.onError?.(error, {
|
|
156
|
-
source: "market-snapshots-ponder",
|
|
157
|
-
chainId: environment.chainId,
|
|
158
|
-
});
|
|
159
|
-
return [];
|
|
160
|
-
}
|
|
143
|
+
return [];
|
|
161
144
|
}
|
|
162
145
|
try {
|
|
163
146
|
return await fetchCoreMarketSnapshotsFromLunar(
|
|
@@ -180,106 +163,6 @@ async function fetchCoreMarketSnapshots(
|
|
|
180
163
|
}
|
|
181
164
|
}
|
|
182
165
|
|
|
183
|
-
async function fetchCoreMarketSnapshotsFromPonder(
|
|
184
|
-
marketAddress: string,
|
|
185
|
-
environment: Environment,
|
|
186
|
-
): Promise<MarketSnapshot[]> {
|
|
187
|
-
if (!environment.indexerUrl) return [];
|
|
188
|
-
|
|
189
|
-
interface MarketDailyData {
|
|
190
|
-
totalBorrows: number;
|
|
191
|
-
totalBorrowsUSD: number;
|
|
192
|
-
totalSupplies: number;
|
|
193
|
-
totalSuppliesUSD: number;
|
|
194
|
-
totalLiquidity: number;
|
|
195
|
-
totalLiquidityUSD: number;
|
|
196
|
-
baseSupplyApy: number;
|
|
197
|
-
baseBorrowApy: number;
|
|
198
|
-
timestamp: number;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
const dailyData: MarketDailyData[] = [];
|
|
202
|
-
let hasNextPage = true;
|
|
203
|
-
let endCursor: string | undefined;
|
|
204
|
-
|
|
205
|
-
while (hasNextPage) {
|
|
206
|
-
const result = await postWithRetry<{
|
|
207
|
-
data: {
|
|
208
|
-
marketDailySnapshots: {
|
|
209
|
-
items: MarketDailyData[];
|
|
210
|
-
pageInfo: { hasNextPage: boolean; endCursor: string };
|
|
211
|
-
};
|
|
212
|
-
};
|
|
213
|
-
}>(environment.indexerUrl, {
|
|
214
|
-
query: `
|
|
215
|
-
query {
|
|
216
|
-
marketDailySnapshots (
|
|
217
|
-
limit: 1000,
|
|
218
|
-
orderBy: "timestamp"
|
|
219
|
-
orderDirection: "desc"
|
|
220
|
-
where: {marketAddress: "${marketAddress.toLowerCase()}", chainId: ${environment.chainId}}
|
|
221
|
-
${endCursor ? `after: "${endCursor}"` : ""}
|
|
222
|
-
) {
|
|
223
|
-
items {
|
|
224
|
-
totalBorrows
|
|
225
|
-
totalBorrowsUSD
|
|
226
|
-
totalSupplies
|
|
227
|
-
totalSuppliesUSD
|
|
228
|
-
totalLiquidity
|
|
229
|
-
totalLiquidityUSD
|
|
230
|
-
baseSupplyApy
|
|
231
|
-
baseBorrowApy
|
|
232
|
-
timestamp
|
|
233
|
-
}
|
|
234
|
-
pageInfo {
|
|
235
|
-
hasNextPage
|
|
236
|
-
endCursor
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
`,
|
|
241
|
-
});
|
|
242
|
-
|
|
243
|
-
dailyData.push(
|
|
244
|
-
...result.data.data.marketDailySnapshots.items.filter(
|
|
245
|
-
(f: { timestamp: number }) => isStartOfDay(f.timestamp),
|
|
246
|
-
),
|
|
247
|
-
);
|
|
248
|
-
hasNextPage = result.data.data.marketDailySnapshots.pageInfo.hasNextPage;
|
|
249
|
-
endCursor = result.data.data.marketDailySnapshots.pageInfo.endCursor;
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
if (dailyData.length === 0) return [];
|
|
253
|
-
|
|
254
|
-
return dailyData.map((point) => {
|
|
255
|
-
const supplied = Number(point.totalSupplies);
|
|
256
|
-
const borrow = Number(point.totalBorrows);
|
|
257
|
-
const borrowUsd = Number(point.totalBorrowsUSD);
|
|
258
|
-
const suppliedUsd = Number(point.totalSuppliesUSD);
|
|
259
|
-
const liquidity = Math.max(point.totalLiquidity, 0);
|
|
260
|
-
const liquidityUsd = Math.max(point.totalLiquidityUSD, 0);
|
|
261
|
-
const price = suppliedUsd / supplied;
|
|
262
|
-
|
|
263
|
-
return {
|
|
264
|
-
marketId: marketAddress.toLowerCase(),
|
|
265
|
-
chainId: environment.chainId,
|
|
266
|
-
timestamp: point.timestamp * 1000,
|
|
267
|
-
totalSupply: supplied,
|
|
268
|
-
totalSupplyUsd: suppliedUsd,
|
|
269
|
-
totalBorrows: borrow,
|
|
270
|
-
totalBorrowsUsd: borrowUsd,
|
|
271
|
-
totalLiquidity: liquidity,
|
|
272
|
-
totalLiquidityUsd: liquidityUsd,
|
|
273
|
-
totalReallocatableLiquidity: 0,
|
|
274
|
-
totalReallocatableLiquidityUsd: 0,
|
|
275
|
-
baseSupplyApy: point.baseSupplyApy,
|
|
276
|
-
baseBorrowApy: point.baseBorrowApy,
|
|
277
|
-
collateralTokenPrice: price,
|
|
278
|
-
loanTokenPrice: price,
|
|
279
|
-
};
|
|
280
|
-
});
|
|
281
|
-
}
|
|
282
|
-
|
|
283
166
|
async function fetchCoreMarketSnapshotsFromLunar(
|
|
284
167
|
marketAddress: string,
|
|
285
168
|
environment: Environment,
|
|
@@ -5,13 +5,11 @@ import {
|
|
|
5
5
|
applyGranularity,
|
|
6
6
|
calculateTimeRange,
|
|
7
7
|
getEnvironmentFromArgs,
|
|
8
|
-
isStartOfDay,
|
|
9
8
|
toApiGranularity,
|
|
10
9
|
} from "../../../common/index.js";
|
|
11
10
|
import type { NetworkParameterType } from "../../../common/types.js";
|
|
12
11
|
import type { Chain, Environment } from "../../../environments/index.js";
|
|
13
12
|
import type { UserPositionSnapshot } from "../../../types/userPosition.js";
|
|
14
|
-
import { postWithRetry } from "../../axiosWithRetry.js";
|
|
15
13
|
import {
|
|
16
14
|
DEFAULT_LUNAR_TIMEOUT_MS,
|
|
17
15
|
createLunarIndexerClient,
|
|
@@ -54,8 +52,7 @@ export type GetUserPositionSnapshotsReturnType = Promise<
|
|
|
54
52
|
* @remarks
|
|
55
53
|
* - Default behavior (no time parameters): Returns 365 days of history
|
|
56
54
|
* - Parameter priority: Custom timestamps > period > default (365 days)
|
|
57
|
-
* -
|
|
58
|
-
* - Snapshots are filtered to start-of-day for "1d" granularity
|
|
55
|
+
* - Environments without a Lunar Indexer configured return an empty array
|
|
59
56
|
*/
|
|
60
57
|
export async function getUserPositionSnapshots<
|
|
61
58
|
environments,
|
|
@@ -89,23 +86,7 @@ async function fetchUserPositionSnapshots(
|
|
|
89
86
|
granularity?: "6h" | "1d",
|
|
90
87
|
): Promise<UserPositionSnapshot[]> {
|
|
91
88
|
if (!environment.lunarIndexerUrl) {
|
|
92
|
-
|
|
93
|
-
try {
|
|
94
|
-
return await fetchUserPositionSnapshotsFromPonder(
|
|
95
|
-
userAddress,
|
|
96
|
-
environment,
|
|
97
|
-
);
|
|
98
|
-
} catch (error) {
|
|
99
|
-
console.warn(
|
|
100
|
-
`[getUserPositionSnapshots] Ponder failed for chain ${environment.chainId}:`,
|
|
101
|
-
error,
|
|
102
|
-
);
|
|
103
|
-
environment.onError?.(error, {
|
|
104
|
-
source: "user-position-snapshots-ponder",
|
|
105
|
-
chainId: environment.chainId,
|
|
106
|
-
});
|
|
107
|
-
return [];
|
|
108
|
-
}
|
|
89
|
+
return [];
|
|
109
90
|
}
|
|
110
91
|
try {
|
|
111
92
|
return await fetchUserPositionSnapshotsFromLunar(
|
|
@@ -186,73 +167,3 @@ async function fetchUserPositionSnapshotsFromLunar(
|
|
|
186
167
|
resolvedGranularity,
|
|
187
168
|
);
|
|
188
169
|
}
|
|
189
|
-
|
|
190
|
-
async function fetchUserPositionSnapshotsFromPonder(
|
|
191
|
-
userAddress: Address,
|
|
192
|
-
environment: Environment,
|
|
193
|
-
): Promise<UserPositionSnapshot[]> {
|
|
194
|
-
if (!environment.indexerUrl) return [];
|
|
195
|
-
|
|
196
|
-
interface UserDailyData {
|
|
197
|
-
totalBorrowsUSD: string;
|
|
198
|
-
totalSuppliesUSD: string;
|
|
199
|
-
totalCollateralUSD: string;
|
|
200
|
-
timestamp: number;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
const dailyData: UserDailyData[] = [];
|
|
204
|
-
let hasNextPage = true;
|
|
205
|
-
let endCursor: string | undefined;
|
|
206
|
-
|
|
207
|
-
while (hasNextPage) {
|
|
208
|
-
const result = await postWithRetry<{
|
|
209
|
-
data: {
|
|
210
|
-
accountDailySnapshots: {
|
|
211
|
-
items: UserDailyData[];
|
|
212
|
-
pageInfo: { hasNextPage: boolean; endCursor: string };
|
|
213
|
-
};
|
|
214
|
-
};
|
|
215
|
-
}>(environment.indexerUrl, {
|
|
216
|
-
query: `
|
|
217
|
-
query {
|
|
218
|
-
accountDailySnapshots(
|
|
219
|
-
limit: 365,
|
|
220
|
-
orderDirection: "desc",
|
|
221
|
-
orderBy: "timestamp",
|
|
222
|
-
where: { accountAddress: "${userAddress.toLowerCase()}", chainId: ${environment.chainId} }
|
|
223
|
-
${endCursor ? `after: "${endCursor}"` : ""}
|
|
224
|
-
) {
|
|
225
|
-
items {
|
|
226
|
-
timestamp,
|
|
227
|
-
totalBorrowsUSD,
|
|
228
|
-
totalSuppliesUSD,
|
|
229
|
-
totalCollateralUSD,
|
|
230
|
-
}
|
|
231
|
-
pageInfo {
|
|
232
|
-
hasNextPage
|
|
233
|
-
endCursor
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
`,
|
|
238
|
-
});
|
|
239
|
-
|
|
240
|
-
dailyData.push(
|
|
241
|
-
...result.data.data.accountDailySnapshots.items.filter(
|
|
242
|
-
(f: { timestamp: number }) => isStartOfDay(f.timestamp),
|
|
243
|
-
),
|
|
244
|
-
);
|
|
245
|
-
hasNextPage = result.data.data.accountDailySnapshots.pageInfo.hasNextPage;
|
|
246
|
-
endCursor = result.data.data.accountDailySnapshots.pageInfo.endCursor;
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
if (dailyData.length === 0) return [];
|
|
250
|
-
|
|
251
|
-
return dailyData.map((point) => ({
|
|
252
|
-
chainId: environment.chainId,
|
|
253
|
-
timestamp: point.timestamp * 1000,
|
|
254
|
-
totalSupplyUsd: Number(point.totalSuppliesUSD),
|
|
255
|
-
totalBorrowsUsd: Number(point.totalBorrowsUSD),
|
|
256
|
-
totalCollateralUsd: Number(point.totalCollateralUSD),
|
|
257
|
-
}));
|
|
258
|
-
}
|
|
@@ -70,10 +70,24 @@ type CampaignIdsCache = {
|
|
|
70
70
|
fetchedAt: number;
|
|
71
71
|
};
|
|
72
72
|
|
|
73
|
+
type MerklBreakdown =
|
|
74
|
+
MerklRewardsResponse["rewards"][number]["breakdowns"][number];
|
|
75
|
+
|
|
73
76
|
const MOONWELL_MERKL_CREATOR = "0x8b621804a7637b781e2BbD58e256a591F2dF7d51";
|
|
74
77
|
const CAMPAIGN_IDS_CACHE_TTL_MS = 4 * 60 * 60 * 1000; // 4 hours
|
|
75
78
|
const MAX_BREAKDOWN_PAGES = 10;
|
|
76
79
|
|
|
80
|
+
/**
|
|
81
|
+
* Stable identity for a Merkl reward breakdown. The Merkl `/rewards` endpoint
|
|
82
|
+
* clamps an out-of-range `breakdownPage` back to the first page instead of
|
|
83
|
+
* returning an empty page, so appending each page's breakdowns blindly
|
|
84
|
+
* re-counts the same rewards and inflates the total by the page count (up to
|
|
85
|
+
* 10x). Keying on the full breakdown content lets us skip exact repeats while
|
|
86
|
+
* still keeping genuinely distinct distributions that share a campaignId.
|
|
87
|
+
*/
|
|
88
|
+
const breakdownKey = (b: MerklBreakdown): string =>
|
|
89
|
+
`${b.campaignId}|${b.reason}|${b.amount}|${b.claimed}|${b.pending}|${b.subCampaignId ?? ""}`;
|
|
90
|
+
|
|
77
91
|
let campaignIdsCache: CampaignIdsCache | null = null;
|
|
78
92
|
|
|
79
93
|
/** Resets the in-memory campaign IDs cache. Intended for use in tests only. */
|
|
@@ -150,6 +164,14 @@ export async function getMerklRewardsData(
|
|
|
150
164
|
return [];
|
|
151
165
|
}
|
|
152
166
|
|
|
167
|
+
// Track breakdowns already collected (seeded from page 0) so repeated
|
|
168
|
+
// pages don't double-count. See breakdownKey for why Merkl repeats them.
|
|
169
|
+
const seenBreakdowns = new Set(
|
|
170
|
+
data.flatMap((reward) =>
|
|
171
|
+
reward.rewards.flatMap((r) => r.breakdowns.map(breakdownKey)),
|
|
172
|
+
),
|
|
173
|
+
);
|
|
174
|
+
|
|
153
175
|
// Paginate through remaining breakdown pages to collect all breakdowns
|
|
154
176
|
for (let page = 1; page < MAX_BREAKDOWN_PAGES; page++) {
|
|
155
177
|
const pageResponse = await fetch(
|
|
@@ -173,7 +195,8 @@ export async function getMerklRewardsData(
|
|
|
173
195
|
break;
|
|
174
196
|
}
|
|
175
197
|
|
|
176
|
-
// Merge breakdowns
|
|
198
|
+
// Merge only breakdowns we haven't collected yet.
|
|
199
|
+
let addedNewBreakdown = false;
|
|
177
200
|
for (const pageReward of pageData) {
|
|
178
201
|
const baseReward = data.find((d) => d.chain.id === pageReward.chain.id);
|
|
179
202
|
if (!baseReward) continue;
|
|
@@ -184,11 +207,24 @@ export async function getMerklRewardsData(
|
|
|
184
207
|
r.token.address.toLowerCase() ===
|
|
185
208
|
pageRewardEntry.token.address.toLowerCase(),
|
|
186
209
|
);
|
|
187
|
-
if (baseRewardEntry)
|
|
188
|
-
|
|
210
|
+
if (!baseRewardEntry) continue;
|
|
211
|
+
|
|
212
|
+
for (const breakdown of pageRewardEntry.breakdowns) {
|
|
213
|
+
const key = breakdownKey(breakdown);
|
|
214
|
+
if (seenBreakdowns.has(key)) continue;
|
|
215
|
+
seenBreakdowns.add(key);
|
|
216
|
+
baseRewardEntry.breakdowns.push(breakdown);
|
|
217
|
+
addedNewBreakdown = true;
|
|
189
218
|
}
|
|
190
219
|
}
|
|
191
220
|
}
|
|
221
|
+
|
|
222
|
+
// A page that only repeats breakdowns we've already seen means the API
|
|
223
|
+
// has stopped advancing (out-of-range page clamped to page 0), so
|
|
224
|
+
// continuing would just re-count the same rewards.
|
|
225
|
+
if (!addedNewBreakdown) {
|
|
226
|
+
break;
|
|
227
|
+
}
|
|
192
228
|
}
|
|
193
229
|
|
|
194
230
|
return data
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { MoonwellClient } from "../../client/createMoonwellClient.js";
|
|
2
2
|
import { getEnvironmentFromArgs } from "../../common/index.js";
|
|
3
3
|
import type { OptionalNetworkParameterType } from "../../common/types.js";
|
|
4
|
-
import type { Chain
|
|
4
|
+
import type { Chain } from "../../environments/index.js";
|
|
5
5
|
import type { CirculatingSupplySnapshot } from "../../types/circulatingSupply.js";
|
|
6
|
-
import { getWithRetry
|
|
6
|
+
import { getWithRetry } from "../axiosWithRetry.js";
|
|
7
7
|
|
|
8
8
|
export type GetCirculatingSupplySnapshotsParameters<
|
|
9
9
|
environments,
|
|
@@ -74,9 +74,7 @@ export async function getCirculatingSupplySnapshots<
|
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
if (!environment.lunarIndexerUrl) {
|
|
77
|
-
return
|
|
78
|
-
? fetchCirculatingSupplyFromPonder(environment)
|
|
79
|
-
: [];
|
|
77
|
+
return [];
|
|
80
78
|
}
|
|
81
79
|
|
|
82
80
|
try {
|
|
@@ -112,70 +110,3 @@ export async function getCirculatingSupplySnapshots<
|
|
|
112
110
|
return [];
|
|
113
111
|
}
|
|
114
112
|
}
|
|
115
|
-
|
|
116
|
-
async function fetchCirculatingSupplyFromPonder(
|
|
117
|
-
environment: Environment,
|
|
118
|
-
): Promise<CirculatingSupplySnapshot[]> {
|
|
119
|
-
if (!environment.indexerUrl) return [];
|
|
120
|
-
try {
|
|
121
|
-
const response = await postWithRetry<{
|
|
122
|
-
data: {
|
|
123
|
-
circulatingSupplyDailySnapshots: {
|
|
124
|
-
items: {
|
|
125
|
-
chainId: number;
|
|
126
|
-
tokenAddress: string;
|
|
127
|
-
circulatingSupply: number;
|
|
128
|
-
timestamp: number;
|
|
129
|
-
}[];
|
|
130
|
-
};
|
|
131
|
-
};
|
|
132
|
-
}>(environment.indexerUrl, {
|
|
133
|
-
query: `
|
|
134
|
-
{
|
|
135
|
-
circulatingSupplyDailySnapshots(
|
|
136
|
-
where: { chainId: ${environment.chainId} }
|
|
137
|
-
orderBy: "timestamp"
|
|
138
|
-
orderDirection: "desc"
|
|
139
|
-
limit: 1000
|
|
140
|
-
) {
|
|
141
|
-
items {
|
|
142
|
-
chainId
|
|
143
|
-
tokenAddress
|
|
144
|
-
circulatingSupply
|
|
145
|
-
timestamp
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
`,
|
|
150
|
-
});
|
|
151
|
-
|
|
152
|
-
if (
|
|
153
|
-
response.status === 200 &&
|
|
154
|
-
response.data?.data?.circulatingSupplyDailySnapshots
|
|
155
|
-
) {
|
|
156
|
-
return response.data.data.circulatingSupplyDailySnapshots.items.flatMap(
|
|
157
|
-
(item) => {
|
|
158
|
-
const token = Object.values(environment.config.tokens).find(
|
|
159
|
-
(t) => t.address.toLowerCase() === item.tokenAddress.toLowerCase(),
|
|
160
|
-
);
|
|
161
|
-
if (!token) return [];
|
|
162
|
-
return [
|
|
163
|
-
{
|
|
164
|
-
chainId: item.chainId,
|
|
165
|
-
token,
|
|
166
|
-
circulatingSupply: item.circulatingSupply,
|
|
167
|
-
timestamp: item.timestamp,
|
|
168
|
-
},
|
|
169
|
-
];
|
|
170
|
-
},
|
|
171
|
-
);
|
|
172
|
-
}
|
|
173
|
-
return [];
|
|
174
|
-
} catch (ex) {
|
|
175
|
-
console.error(
|
|
176
|
-
"An error occurred while fetching getCirculatingSupplySnapshots...",
|
|
177
|
-
ex,
|
|
178
|
-
);
|
|
179
|
-
return [];
|
|
180
|
-
}
|
|
181
|
-
}
|
|
@@ -9,7 +9,6 @@ import {
|
|
|
9
9
|
import type { NetworkParameterType } from "../../common/types.js";
|
|
10
10
|
import type { Chain } from "../../environments/index.js";
|
|
11
11
|
import type { StakingSnapshot } from "../../types/staking.js";
|
|
12
|
-
import { postWithRetry } from "../axiosWithRetry.js";
|
|
13
12
|
import {
|
|
14
13
|
DEFAULT_LUNAR_TIMEOUT_MS,
|
|
15
14
|
createLunarIndexerClient,
|
|
@@ -47,18 +46,7 @@ export async function getStakingSnapshots<
|
|
|
47
46
|
} = (args ?? {}) as GetStakingSnapshotsParameters<environments, undefined>;
|
|
48
47
|
|
|
49
48
|
if (!environment.lunarIndexerUrl) {
|
|
50
|
-
|
|
51
|
-
period,
|
|
52
|
-
customStartTime,
|
|
53
|
-
customEndTime,
|
|
54
|
-
);
|
|
55
|
-
return environment.indexerUrl
|
|
56
|
-
? fetchStakingSnapshotsFromPonder(
|
|
57
|
-
environment.chainId,
|
|
58
|
-
environment.indexerUrl,
|
|
59
|
-
startTime,
|
|
60
|
-
)
|
|
61
|
-
: [];
|
|
49
|
+
return [];
|
|
62
50
|
}
|
|
63
51
|
|
|
64
52
|
try {
|
|
@@ -122,49 +110,3 @@ async function fetchStakingSnapshotsFromLunar(
|
|
|
122
110
|
allSnapshots.sort((a, b) => a.timestamp - b.timestamp);
|
|
123
111
|
return applyGranularity(allSnapshots, granularity);
|
|
124
112
|
}
|
|
125
|
-
|
|
126
|
-
async function fetchStakingSnapshotsFromPonder(
|
|
127
|
-
chainId: number,
|
|
128
|
-
indexerUrl: string,
|
|
129
|
-
startTime?: number,
|
|
130
|
-
): Promise<StakingSnapshot[]> {
|
|
131
|
-
try {
|
|
132
|
-
const response = await postWithRetry<{
|
|
133
|
-
data: {
|
|
134
|
-
stakingDailySnapshots: {
|
|
135
|
-
items: StakingSnapshot[];
|
|
136
|
-
};
|
|
137
|
-
};
|
|
138
|
-
}>(indexerUrl, {
|
|
139
|
-
query: `
|
|
140
|
-
query {
|
|
141
|
-
stakingDailySnapshots(
|
|
142
|
-
limit: 365,
|
|
143
|
-
orderBy: "timestamp"
|
|
144
|
-
orderDirection: "desc"
|
|
145
|
-
where: {chainId: ${chainId}}
|
|
146
|
-
) {
|
|
147
|
-
items {
|
|
148
|
-
chainId
|
|
149
|
-
totalStaked
|
|
150
|
-
totalStakedUSD
|
|
151
|
-
timestamp
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
`,
|
|
156
|
-
});
|
|
157
|
-
|
|
158
|
-
if (response.status === 200 && response.data?.data?.stakingDailySnapshots) {
|
|
159
|
-
const items = response.data.data.stakingDailySnapshots.items;
|
|
160
|
-
return startTime
|
|
161
|
-
? items.filter((item) => item.timestamp >= startTime)
|
|
162
|
-
: items;
|
|
163
|
-
} else {
|
|
164
|
-
return [];
|
|
165
|
-
}
|
|
166
|
-
} catch (ex) {
|
|
167
|
-
console.error("An error occured while fetching getStakingSnapshots...", ex);
|
|
168
|
-
return [];
|
|
169
|
-
}
|
|
170
|
-
}
|
|
@@ -497,7 +497,18 @@ export const getProposalsOnChainData = async (
|
|
|
497
497
|
let eta = 0;
|
|
498
498
|
|
|
499
499
|
if (proposalData) {
|
|
500
|
-
|
|
500
|
+
// The eta lives at a different tuple index per governor: the legacy
|
|
501
|
+
// single-chain governor's `proposals()` returns
|
|
502
|
+
// (id, proposer, eta, startTimestamp, endTimestamp, ...) so eta is at
|
|
503
|
+
// index 2, whereas the multichain governor's returns
|
|
504
|
+
// (proposer, voteSnapshotTimestamp, votingStartTime, votingEndTime,
|
|
505
|
+
// crossChainVoteCollectionEndTimestamp, ...) so its execution-available
|
|
506
|
+
// timestamp is at index 4. Reading index 4 for a legacy Moonriver
|
|
507
|
+
// proposal picked up `endTimestamp` (the voting-end time, already in the
|
|
508
|
+
// past once voting closes), which made the timeline flip straight to
|
|
509
|
+
// "Timelock Ready to Execute" and surfaced the Execute button before the
|
|
510
|
+
// timelock had actually elapsed (MOO-611).
|
|
511
|
+
const onChainEta = Number(proposalData[isMultichain ? 4 : 2]);
|
|
501
512
|
if (onChainEta === 0 && isMultichain && p.votingEndTime) {
|
|
502
513
|
eta = p.votingEndTime + 86400; // 1 day
|
|
503
514
|
} else {
|
|
@@ -244,7 +244,7 @@ export class LunarIndexerError extends Error {
|
|
|
244
244
|
}
|
|
245
245
|
|
|
246
246
|
/**
|
|
247
|
-
* Determine if an error should trigger fallback to
|
|
247
|
+
* Determine if an error should trigger fallback to on-chain data
|
|
248
248
|
*/
|
|
249
249
|
export function shouldFallback(error: unknown): boolean {
|
|
250
250
|
if (axios.isAxiosError(error)) {
|
|
@@ -19,13 +19,6 @@ function createGovernanceTokensConfig<T extends GovernanceTokensType>(
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
export const GovernanceTokensConfig = createGovernanceTokensConfig({
|
|
22
|
-
WELL_TESTNET: {
|
|
23
|
-
id: "WELL_TESTNET",
|
|
24
|
-
symbol: "WELL",
|
|
25
|
-
name: "WELL (Testnet)",
|
|
26
|
-
chainIds: [] as number[],
|
|
27
|
-
testnet: true,
|
|
28
|
-
},
|
|
29
22
|
WELL: {
|
|
30
23
|
id: "WELL",
|
|
31
24
|
symbol: "WELL",
|
package/errors/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '0.
|
|
1
|
+
export const version = '0.21.0'
|