@moonwell-fi/moonwell-sdk 0.13.0 → 0.13.1
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 +10 -0
- package/_cjs/actions/core/markets/common.js +11 -4
- package/_cjs/actions/core/markets/common.js.map +1 -1
- package/_cjs/actions/core/user-rewards/common.js +6 -5
- package/_cjs/actions/core/user-rewards/common.js.map +1 -1
- package/_cjs/actions/governance/getStakingInfo.js +113 -31
- package/_cjs/actions/governance/getStakingInfo.js.map +1 -1
- package/_cjs/actions/governance/getUserStakingInfo.js +106 -18
- package/_cjs/actions/governance/getUserStakingInfo.js.map +1 -1
- package/_cjs/actions/governance/getWellPrice.js +26 -0
- package/_cjs/actions/governance/getWellPrice.js.map +1 -0
- package/_cjs/actions/morpho/user-rewards/common.js +10 -3
- package/_cjs/actions/morpho/user-rewards/common.js.map +1 -1
- package/_cjs/actions/morpho/vaults/common.js +19 -6
- package/_cjs/actions/morpho/vaults/common.js.map +1 -1
- package/_cjs/errors/version.js +1 -1
- package/_esm/actions/core/markets/common.js +11 -4
- package/_esm/actions/core/markets/common.js.map +1 -1
- package/_esm/actions/core/user-rewards/common.js +6 -5
- package/_esm/actions/core/user-rewards/common.js.map +1 -1
- package/_esm/actions/governance/getStakingInfo.js +136 -32
- package/_esm/actions/governance/getStakingInfo.js.map +1 -1
- package/_esm/actions/governance/getUserStakingInfo.js +120 -19
- package/_esm/actions/governance/getUserStakingInfo.js.map +1 -1
- package/_esm/actions/governance/getWellPrice.js +50 -0
- package/_esm/actions/governance/getWellPrice.js.map +1 -0
- package/_esm/actions/morpho/user-rewards/common.js +10 -3
- package/_esm/actions/morpho/user-rewards/common.js.map +1 -1
- package/_esm/actions/morpho/vaults/common.js +19 -6
- package/_esm/actions/morpho/vaults/common.js.map +1 -1
- package/_esm/errors/version.js +1 -1
- package/_types/actions/core/markets/common.d.ts.map +1 -1
- package/_types/actions/core/user-rewards/common.d.ts.map +1 -1
- package/_types/actions/governance/getStakingInfo.d.ts +1 -1
- package/_types/actions/governance/getStakingInfo.d.ts.map +1 -1
- package/_types/actions/governance/getUserStakingInfo.d.ts.map +1 -1
- package/_types/actions/governance/getWellPrice.d.ts +29 -0
- package/_types/actions/governance/getWellPrice.d.ts.map +1 -0
- package/_types/actions/morpho/user-rewards/common.d.ts.map +1 -1
- package/_types/actions/morpho/vaults/common.d.ts.map +1 -1
- package/_types/errors/version.d.ts +1 -1
- package/actions/core/markets/common.ts +11 -6
- package/actions/core/user-rewards/common.ts +6 -5
- package/actions/governance/getStakingInfo.ts +195 -87
- package/actions/governance/getUserStakingInfo.ts +168 -54
- package/actions/governance/getWellPrice.ts +66 -0
- package/actions/morpho/user-rewards/common.ts +10 -3
- package/actions/morpho/vaults/common.ts +19 -12
- package/errors/version.ts +1 -1
- package/package.json +1 -1
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
} from "../../../environments/utils/index.js";
|
|
13
13
|
import type { MorphoUserReward } from "../../../types/morphoUserReward.js";
|
|
14
14
|
import type { MorphoUserStakingReward } from "../../../types/morphoUserStakingReward.js";
|
|
15
|
+
import { getGovernanceTokenPriceFor } from "../../governance/getWellPrice.js";
|
|
15
16
|
|
|
16
17
|
/**
|
|
17
18
|
* Error thrown for any failure communicating with the Merkl API: non-ok HTTP
|
|
@@ -164,11 +165,17 @@ export async function getUserMorphoStakingRewardsData(params: {
|
|
|
164
165
|
await Promise.all([
|
|
165
166
|
viewsContract?.read.getAllMarketsInfo(),
|
|
166
167
|
homeViewsContract?.read.getNativeTokenPrice(),
|
|
167
|
-
|
|
168
|
+
getGovernanceTokenPriceFor(params.environment).catch((err) => {
|
|
169
|
+
params.environment.onError?.(err, {
|
|
170
|
+
source: "governance-token-price",
|
|
171
|
+
chainId: params.environment.chainId,
|
|
172
|
+
});
|
|
173
|
+
return 0n;
|
|
174
|
+
}),
|
|
168
175
|
]);
|
|
169
176
|
|
|
170
|
-
const governanceTokenPrice = new Amount(governanceTokenPriceRaw
|
|
171
|
-
const nativeTokenPrice = new Amount(nativeTokenPriceRaw
|
|
177
|
+
const governanceTokenPrice = new Amount(governanceTokenPriceRaw, 18);
|
|
178
|
+
const nativeTokenPrice = new Amount(nativeTokenPriceRaw ?? 0n, 18);
|
|
172
179
|
|
|
173
180
|
let tokenPrices =
|
|
174
181
|
allMarkets
|
|
@@ -19,6 +19,7 @@ import type {
|
|
|
19
19
|
MorphoVault,
|
|
20
20
|
MorphoVaultMarket,
|
|
21
21
|
} from "../../../types/morphoVault.js";
|
|
22
|
+
import { getGovernanceTokenPriceFor } from "../../governance/getWellPrice.js";
|
|
22
23
|
import { getGraphQL, getVaultV2Apy } from "../utils/graphql.js";
|
|
23
24
|
import {
|
|
24
25
|
SECONDS_PER_YEAR,
|
|
@@ -321,16 +322,19 @@ async function getMorphoVaultsDataFromIndexer(params: {
|
|
|
321
322
|
const data = await Promise.all([
|
|
322
323
|
viewsContract?.read.getAllMarketsInfo(),
|
|
323
324
|
homeViewsContract?.read.getNativeTokenPrice(),
|
|
324
|
-
|
|
325
|
+
getGovernanceTokenPriceFor(environment).catch((err) => {
|
|
326
|
+
environment.onError?.(err, {
|
|
327
|
+
source: "governance-token-price",
|
|
328
|
+
chainId: environment.chainId,
|
|
329
|
+
});
|
|
330
|
+
return 0n;
|
|
331
|
+
}),
|
|
325
332
|
]);
|
|
326
333
|
|
|
327
334
|
const [allMarkets, nativeTokenPriceRaw, governanceTokenPriceRaw] = data;
|
|
328
335
|
|
|
329
|
-
const governanceTokenPrice = new Amount(
|
|
330
|
-
|
|
331
|
-
18,
|
|
332
|
-
);
|
|
333
|
-
const nativeTokenPrice = new Amount(nativeTokenPriceRaw || 0n, 18);
|
|
336
|
+
const governanceTokenPrice = new Amount(governanceTokenPriceRaw, 18);
|
|
337
|
+
const nativeTokenPrice = new Amount(nativeTokenPriceRaw ?? 0n, 18);
|
|
334
338
|
|
|
335
339
|
let tokenPrices =
|
|
336
340
|
allMarkets
|
|
@@ -1056,16 +1060,19 @@ async function getMorphoVaultsDataFromOnChain(params: {
|
|
|
1056
1060
|
const data = await Promise.all([
|
|
1057
1061
|
viewsContract?.read.getAllMarketsInfo(),
|
|
1058
1062
|
homeViewsContract?.read.getNativeTokenPrice(),
|
|
1059
|
-
|
|
1063
|
+
getGovernanceTokenPriceFor(environment).catch((err) => {
|
|
1064
|
+
environment.onError?.(err, {
|
|
1065
|
+
source: "governance-token-price",
|
|
1066
|
+
chainId: environment.chainId,
|
|
1067
|
+
});
|
|
1068
|
+
return 0n;
|
|
1069
|
+
}),
|
|
1060
1070
|
]);
|
|
1061
1071
|
|
|
1062
1072
|
const [allMarkets, nativeTokenPriceRaw, governanceTokenPriceRaw] = data;
|
|
1063
1073
|
|
|
1064
|
-
const governanceTokenPrice = new Amount(
|
|
1065
|
-
|
|
1066
|
-
18,
|
|
1067
|
-
);
|
|
1068
|
-
const nativeTokenPrice = new Amount(nativeTokenPriceRaw || 0n, 18);
|
|
1074
|
+
const governanceTokenPrice = new Amount(governanceTokenPriceRaw, 18);
|
|
1075
|
+
const nativeTokenPrice = new Amount(nativeTokenPriceRaw ?? 0n, 18);
|
|
1069
1076
|
|
|
1070
1077
|
let tokenPrices =
|
|
1071
1078
|
allMarkets
|
package/errors/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '0.13.
|
|
1
|
+
export const version = '0.13.1'
|