@moonwell-fi/moonwell-sdk 0.20.0 → 0.20.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 +6 -0
- package/_cjs/actions/morpho/markets/common.js +25 -16
- package/_cjs/actions/morpho/markets/common.js.map +1 -1
- package/_cjs/actions/morpho/utils/graphql.js +4 -12
- package/_cjs/actions/morpho/utils/graphql.js.map +1 -1
- package/_cjs/actions/morpho/vaults/common.js +6 -24
- package/_cjs/actions/morpho/vaults/common.js.map +1 -1
- package/_cjs/errors/version.js +1 -1
- package/_esm/actions/morpho/markets/common.js +31 -19
- package/_esm/actions/morpho/markets/common.js.map +1 -1
- package/_esm/actions/morpho/utils/graphql.js +4 -12
- package/_esm/actions/morpho/utils/graphql.js.map +1 -1
- package/_esm/actions/morpho/vaults/common.js +9 -24
- package/_esm/actions/morpho/vaults/common.js.map +1 -1
- package/_esm/errors/version.js +1 -1
- package/_types/actions/morpho/utils/graphql.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/morpho/markets/common.ts +36 -28
- package/actions/morpho/utils/graphql.ts +10 -18
- package/actions/morpho/vaults/common.ts +11 -38
- package/errors/version.ts +1 -1
- package/package.json +1 -1
|
@@ -1372,11 +1372,8 @@ export async function getMorphoVaultsRewards(
|
|
|
1372
1372
|
}
|
|
1373
1373
|
id
|
|
1374
1374
|
address
|
|
1375
|
-
asset {
|
|
1376
|
-
priceUsd
|
|
1377
|
-
}
|
|
1378
1375
|
state {
|
|
1379
|
-
|
|
1376
|
+
allRewards {
|
|
1380
1377
|
asset {
|
|
1381
1378
|
address
|
|
1382
1379
|
symbol
|
|
@@ -1387,7 +1384,6 @@ export async function getMorphoVaultsRewards(
|
|
|
1387
1384
|
}
|
|
1388
1385
|
}
|
|
1389
1386
|
supplyApr
|
|
1390
|
-
amountPerSuppliedToken
|
|
1391
1387
|
}
|
|
1392
1388
|
}
|
|
1393
1389
|
}
|
|
@@ -1405,10 +1401,7 @@ export async function getMorphoVaultsRewards(
|
|
|
1405
1401
|
id
|
|
1406
1402
|
}
|
|
1407
1403
|
}
|
|
1408
|
-
|
|
1409
|
-
loanAsset {
|
|
1410
|
-
priceUsd
|
|
1411
|
-
}
|
|
1404
|
+
marketId
|
|
1412
1405
|
state {
|
|
1413
1406
|
rewards {
|
|
1414
1407
|
asset {
|
|
@@ -1421,7 +1414,6 @@ export async function getMorphoVaultsRewards(
|
|
|
1421
1414
|
}
|
|
1422
1415
|
}
|
|
1423
1416
|
supplyApr
|
|
1424
|
-
amountPerSuppliedToken
|
|
1425
1417
|
}
|
|
1426
1418
|
}
|
|
1427
1419
|
}
|
|
@@ -1437,11 +1429,8 @@ export async function getMorphoVaultsRewards(
|
|
|
1437
1429
|
};
|
|
1438
1430
|
id: string;
|
|
1439
1431
|
address: Address;
|
|
1440
|
-
asset: {
|
|
1441
|
-
priceUsd: number;
|
|
1442
|
-
};
|
|
1443
1432
|
state: {
|
|
1444
|
-
|
|
1433
|
+
allRewards: {
|
|
1445
1434
|
asset: {
|
|
1446
1435
|
address: Address;
|
|
1447
1436
|
symbol: string;
|
|
@@ -1452,7 +1441,6 @@ export async function getMorphoVaultsRewards(
|
|
|
1452
1441
|
};
|
|
1453
1442
|
};
|
|
1454
1443
|
supplyApr: number;
|
|
1455
|
-
amountPerSuppliedToken: string;
|
|
1456
1444
|
}[];
|
|
1457
1445
|
};
|
|
1458
1446
|
}[];
|
|
@@ -1468,10 +1456,7 @@ export async function getMorphoVaultsRewards(
|
|
|
1468
1456
|
id: number;
|
|
1469
1457
|
};
|
|
1470
1458
|
};
|
|
1471
|
-
|
|
1472
|
-
loanAsset: {
|
|
1473
|
-
priceUsd: number;
|
|
1474
|
-
};
|
|
1459
|
+
marketId: string;
|
|
1475
1460
|
state: {
|
|
1476
1461
|
rewards: {
|
|
1477
1462
|
asset: {
|
|
@@ -1484,7 +1469,6 @@ export async function getMorphoVaultsRewards(
|
|
|
1484
1469
|
};
|
|
1485
1470
|
};
|
|
1486
1471
|
supplyApr: number;
|
|
1487
|
-
amountPerSuppliedToken: string;
|
|
1488
1472
|
}[];
|
|
1489
1473
|
};
|
|
1490
1474
|
};
|
|
@@ -1494,22 +1478,18 @@ export async function getMorphoVaultsRewards(
|
|
|
1494
1478
|
|
|
1495
1479
|
if (result) {
|
|
1496
1480
|
try {
|
|
1481
|
+
// Morpho removed the per-supplied-token amount fields from the API
|
|
1482
|
+
// (VaultStateReward.amountPerSuppliedToken et al.), so reward amounts
|
|
1483
|
+
// can no longer be computed and are reported as 0.
|
|
1497
1484
|
const marketsRewards = result.marketPositions.items.flatMap((item) => {
|
|
1498
1485
|
const rewards = (item.market.state?.rewards || []).map((reward) => {
|
|
1499
|
-
const tokenAmountPer1000 =
|
|
1500
|
-
(Number.parseFloat(reward.amountPerSuppliedToken) /
|
|
1501
|
-
item.market.loanAsset.priceUsd) *
|
|
1502
|
-
1000;
|
|
1503
|
-
const tokenDecimals = 10 ** reward.asset.decimals;
|
|
1504
|
-
const amount = Number(tokenAmountPer1000) / tokenDecimals;
|
|
1505
|
-
|
|
1506
1486
|
return {
|
|
1507
1487
|
chainId: reward.asset.chain.id,
|
|
1508
1488
|
vaultId: item.user.address,
|
|
1509
|
-
marketId: item.market.
|
|
1489
|
+
marketId: item.market.marketId,
|
|
1510
1490
|
asset: reward.asset,
|
|
1511
1491
|
supplyApr: (reward.supplyApr || 0) * 100,
|
|
1512
|
-
supplyAmount:
|
|
1492
|
+
supplyAmount: 0,
|
|
1513
1493
|
borrowApr: 0,
|
|
1514
1494
|
borrowAmount: 0,
|
|
1515
1495
|
};
|
|
@@ -1518,21 +1498,14 @@ export async function getMorphoVaultsRewards(
|
|
|
1518
1498
|
});
|
|
1519
1499
|
|
|
1520
1500
|
const vaultsRewards = result.vaults.items.flatMap((item) => {
|
|
1521
|
-
return (item.state?.
|
|
1522
|
-
const tokenAmountPer1000 =
|
|
1523
|
-
(Number.parseFloat(reward.amountPerSuppliedToken) /
|
|
1524
|
-
item.asset.priceUsd) *
|
|
1525
|
-
1000;
|
|
1526
|
-
const tokenDecimals = 10 ** reward.asset.decimals;
|
|
1527
|
-
const amount = Number(tokenAmountPer1000) / tokenDecimals;
|
|
1528
|
-
|
|
1501
|
+
return (item.state?.allRewards || []).map((reward) => {
|
|
1529
1502
|
return {
|
|
1530
1503
|
chainId: reward.asset.chain.id,
|
|
1531
1504
|
vaultId: item.address,
|
|
1532
1505
|
marketId: undefined,
|
|
1533
1506
|
asset: reward.asset,
|
|
1534
1507
|
supplyApr: (reward.supplyApr || 0) * 100,
|
|
1535
|
-
supplyAmount:
|
|
1508
|
+
supplyAmount: 0,
|
|
1536
1509
|
borrowApr: 0,
|
|
1537
1510
|
borrowAmount: 0,
|
|
1538
1511
|
};
|
package/errors/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '0.20.
|
|
1
|
+
export const version = '0.20.1'
|