@curvefi/api 1.17.1 → 1.17.2
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/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/utils.d.ts +1 -0
- package/lib/utils.js +13 -1
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -23,6 +23,7 @@ declare function setCustomFeeData(customFeeData: {
|
|
|
23
23
|
declare const curve: {
|
|
24
24
|
init: typeof init;
|
|
25
25
|
getPoolList: () => string[];
|
|
26
|
+
getUsdRate: (coin: string) => Promise<number>;
|
|
26
27
|
setCustomFeeData: typeof setCustomFeeData;
|
|
27
28
|
signerAddress: string;
|
|
28
29
|
chainId: number;
|
package/lib/index.js
CHANGED
package/lib/utils.d.ts
CHANGED
|
@@ -23,3 +23,4 @@ export declare const getPoolNameBySwapAddress: (swapAddress: string) => string;
|
|
|
23
23
|
export declare const _getUsdRate: (assetId: string) => Promise<number>;
|
|
24
24
|
export declare const _getStatsUrl: (isCrypto?: boolean) => string;
|
|
25
25
|
export declare const getPoolList: () => string[];
|
|
26
|
+
export declare const getUsdRate: (coin: string) => Promise<number>;
|
package/lib/utils.js
CHANGED
|
@@ -59,7 +59,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
59
59
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
60
60
|
};
|
|
61
61
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
62
|
-
exports.getPoolList = exports._getStatsUrl = exports._getUsdRate = exports.getPoolNameBySwapAddress = exports.ensureAllowance = exports.ensureAllowanceEstimateGas = exports._ensureAllowance = exports.hasAllowance = exports.getAllowance = exports._getAllowance = exports.getBalances = exports._prepareAddresses = exports._getBalances = exports._getCoinDecimals = exports._getCoinAddresses = exports.getEthIndex = exports.isEth = exports.fromBN = exports.toStringFromBN = exports.toBN = exports.BN = exports.MAX_ALLOWANCE = void 0;
|
|
62
|
+
exports.getUsdRate = exports.getPoolList = exports._getStatsUrl = exports._getUsdRate = exports.getPoolNameBySwapAddress = exports.ensureAllowance = exports.ensureAllowanceEstimateGas = exports._ensureAllowance = exports.hasAllowance = exports.getAllowance = exports._getAllowance = exports.getBalances = exports._prepareAddresses = exports._getBalances = exports._getCoinDecimals = exports._getCoinAddresses = exports.getEthIndex = exports.isEth = exports.fromBN = exports.toStringFromBN = exports.toBN = exports.BN = exports.MAX_ALLOWANCE = void 0;
|
|
63
63
|
var axios_1 = __importDefault(require("axios"));
|
|
64
64
|
var ethers_1 = require("ethers");
|
|
65
65
|
var bignumber_js_1 = __importDefault(require("bignumber.js"));
|
|
@@ -431,3 +431,15 @@ var _getStatsUrl = function (isCrypto) {
|
|
|
431
431
|
exports._getStatsUrl = _getStatsUrl;
|
|
432
432
|
var getPoolList = function () { return Object.keys(curve_1.POOLS_DATA); };
|
|
433
433
|
exports.getPoolList = getPoolList;
|
|
434
|
+
var getUsdRate = function (coin) { return __awaiter(void 0, void 0, void 0, function () {
|
|
435
|
+
var coinAddress;
|
|
436
|
+
return __generator(this, function (_a) {
|
|
437
|
+
switch (_a.label) {
|
|
438
|
+
case 0:
|
|
439
|
+
coinAddress = (0, exports._getCoinAddresses)(coin)[0];
|
|
440
|
+
return [4 /*yield*/, (0, exports._getUsdRate)(coinAddress)];
|
|
441
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
442
|
+
}
|
|
443
|
+
});
|
|
444
|
+
}); };
|
|
445
|
+
exports.getUsdRate = getUsdRate;
|