@gearbox-protocol/sdk 3.0.0-next.260 → 3.0.0-next.261
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/lib/apy/index.d.ts +1 -0
- package/lib/apy/index.js +1 -0
- package/lib/apy/pendleAPY.d.ts +5 -0
- package/lib/apy/pendleAPY.js +26 -0
- package/package.json +1 -1
package/lib/apy/index.d.ts
CHANGED
package/lib/apy/index.js
CHANGED
|
@@ -106,5 +106,6 @@ exports.isFarmToken = isFarmToken;
|
|
|
106
106
|
__exportStar(require("./curveAPY"), exports);
|
|
107
107
|
__exportStar(require("./defiLamaAPY"), exports);
|
|
108
108
|
__exportStar(require("./lidoAPY"), exports);
|
|
109
|
+
__exportStar(require("./pendleAPY"), exports);
|
|
109
110
|
__exportStar(require("./skyAPY"), exports);
|
|
110
111
|
__exportStar(require("./yearnAPY"), exports);
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { PartialRecord, SupportedToken } from "@gearbox-protocol/sdk-gov";
|
|
2
|
+
type PendleTokens = Extract<SupportedToken, "sUSDe">;
|
|
3
|
+
export type PendleAPYResult = PartialRecord<PendleTokens, number>;
|
|
4
|
+
export declare function getPendleAPY(): Promise<PendleAPYResult>;
|
|
5
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getPendleAPY = void 0;
|
|
7
|
+
const sdk_gov_1 = require("@gearbox-protocol/sdk-gov");
|
|
8
|
+
const axios_1 = __importDefault(require("axios"));
|
|
9
|
+
const getAPYURL = () => "https://api-v2.pendle.finance/core/v2/1/markets/0xcdd26eb5eb2ce0f203a84553853667ae69ca29ce/data";
|
|
10
|
+
async function getPendleAPY() {
|
|
11
|
+
try {
|
|
12
|
+
const resp = await axios_1.default.get(getAPYURL());
|
|
13
|
+
const apyInfo = resp?.data;
|
|
14
|
+
const rate = apyInfo?.underlyingInterestApy || 0;
|
|
15
|
+
return {
|
|
16
|
+
sUSDe: numberToAPY(Number(rate)),
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
catch (e) {
|
|
20
|
+
return {};
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.getPendleAPY = getPendleAPY;
|
|
24
|
+
function numberToAPY(baseApy) {
|
|
25
|
+
return Math.round(baseApy * Number(sdk_gov_1.PERCENTAGE_FACTOR) * Number(sdk_gov_1.PERCENTAGE_DECIMALS));
|
|
26
|
+
}
|