@curvefi/api 1.24.3 → 1.25.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/lib/constants/abis/abis-ethereum.js +145 -5
- package/lib/constants/abis/json/2pool/swap.json +1065 -0
- package/lib/constants/abis/json/4pool/swap.json +951 -0
- package/lib/constants/abis/json/eursusd/swap.json +1199 -0
- package/lib/constants/abis/json/gauge_v5.json +958 -0
- package/lib/constants/abis/json/rai/deposit.json +228 -0
- package/lib/constants/abis/json/rai/swap.json +1039 -0
- package/lib/constants/coins-ethereum.js +4 -0
- package/lib/external-api.js +7 -13
- package/lib/pools.js +4 -2
- package/package.json +12 -3
|
@@ -90,6 +90,8 @@ exports.USD_COINS_ETHEREUM = {
|
|
|
90
90
|
busd: "0x4Fabb145d64652a948d72533023f6E7A623C7C53",
|
|
91
91
|
alusd: "0xbc6da0fe9ad5f3b0d58160288917aa56653660e9",
|
|
92
92
|
mim: "0x99d8a9c45b2eca8864373a26d1459e3dff1e17f3",
|
|
93
|
+
rai: "0x03ab458634910aad20ef5f1c8ee96f1d6ac54919",
|
|
94
|
+
wormholeust: "0xa693B19d2931d498c5B318dF961919BB4aee87a5",
|
|
93
95
|
'3crv': "0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490",
|
|
94
96
|
crv: "0xD533a949740bb3306d119CC777fa900bA034cd52",
|
|
95
97
|
cvx: "0x4e3fbd56cd56c3e72c1403e103b45db9da5b9d2b", // CVX
|
|
@@ -165,6 +167,8 @@ exports.DECIMALS_ETHEREUM = {
|
|
|
165
167
|
"0x68749665ff8d2d112fa859aa293f07a622782f38": 6,
|
|
166
168
|
"0x090185f2135308bad17527004364ebcc2d37e5f6": 18,
|
|
167
169
|
"0xCdF7028ceAB81fA0C6971208e83fa7872994beE5": 18,
|
|
170
|
+
"0xa693B19d2931d498c5B318dF961919BB4aee87a5": 6,
|
|
171
|
+
"0x03ab458634910aad20ef5f1c8ee96f1d6ac54919": 18,
|
|
168
172
|
// --- REWARD TOKENS ---
|
|
169
173
|
"0xa3BeD4E1c75D00fa6f4E5E6922DB7261B5E9AcD2": 18,
|
|
170
174
|
"0x8762db106B2c2A0bccB3A80d1Ed41273552616E8": 18,
|
package/lib/external-api.js
CHANGED
|
@@ -43,22 +43,16 @@ exports._getPoolsFromApi = void 0;
|
|
|
43
43
|
var axios_1 = __importDefault(require("axios"));
|
|
44
44
|
var memoizee_1 = __importDefault(require("memoizee"));
|
|
45
45
|
exports._getPoolsFromApi = (0, memoizee_1.default)(function (network, poolType) { return __awaiter(void 0, void 0, void 0, function () {
|
|
46
|
-
var url, response
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
var url, response;
|
|
47
|
+
var _a;
|
|
48
|
+
return __generator(this, function (_b) {
|
|
49
|
+
switch (_b.label) {
|
|
49
50
|
case 0:
|
|
50
51
|
url = "https://api.curve.fi/api/getPools/".concat(network, "/").concat(poolType);
|
|
51
|
-
|
|
52
|
+
return [4 /*yield*/, axios_1.default.get(url, { validateStatus: function () { return true; } })];
|
|
52
53
|
case 1:
|
|
53
|
-
|
|
54
|
-
return [
|
|
55
|
-
case 2:
|
|
56
|
-
response = _a.sent();
|
|
57
|
-
return [2 /*return*/, response.data.data];
|
|
58
|
-
case 3:
|
|
59
|
-
err_1 = _a.sent();
|
|
60
|
-
return [2 /*return*/, { poolData: [], tvl: 0, tvlAll: 0 }];
|
|
61
|
-
case 4: return [2 /*return*/];
|
|
54
|
+
response = _b.sent();
|
|
55
|
+
return [2 /*return*/, (_a = response.data.data) !== null && _a !== void 0 ? _a : { poolData: [], tvl: 0, tvlAll: 0 }];
|
|
62
56
|
}
|
|
63
57
|
});
|
|
64
58
|
}); }, {
|
package/lib/pools.js
CHANGED
|
@@ -294,6 +294,8 @@ var Pool = /** @class */ (function () {
|
|
|
294
294
|
case 0: return [4 /*yield*/, this._getPoolStats()];
|
|
295
295
|
case 1:
|
|
296
296
|
volume = (_c.sent()).volume;
|
|
297
|
+
if (volume === 0)
|
|
298
|
+
return [2 /*return*/, "0"];
|
|
297
299
|
if (!(this.isCrypto || (curve_1.curve.chainId === 1 && this.isFactory))) return [3 /*break*/, 2];
|
|
298
300
|
_a = 1;
|
|
299
301
|
return [3 /*break*/, 4];
|
|
@@ -2840,7 +2842,7 @@ var Pool = /** @class */ (function () {
|
|
|
2840
2842
|
switch (_a.label) {
|
|
2841
2843
|
case 0:
|
|
2842
2844
|
contract = curve_1.curve.contracts[this.swap].contract;
|
|
2843
|
-
if (!(["eurtusd", "xautusd", "crveth", "cvxeth", "spelleth", "teth"].includes(this.id) || this.isCryptoFactory)) return [3 /*break*/, 2];
|
|
2845
|
+
if (!(["eurtusd", "eursusd", "xautusd", "crveth", "cvxeth", "spelleth", "teth"].includes(this.id) || this.isCryptoFactory)) return [3 /*break*/, 2];
|
|
2844
2846
|
return [4 /*yield*/, contract.calc_token_amount(_amounts, curve_1.curve.constantOptions)];
|
|
2845
2847
|
case 1: return [2 /*return*/, _a.sent()];
|
|
2846
2848
|
case 2: return [4 /*yield*/, contract.calc_token_amount(_amounts, isDeposit, curve_1.curve.constantOptions)];
|
|
@@ -2861,7 +2863,7 @@ var Pool = /** @class */ (function () {
|
|
|
2861
2863
|
return [4 /*yield*/, contract.calc_token_amount(this.swap, _amounts, isDeposit, curve_1.curve.constantOptions)];
|
|
2862
2864
|
case 1: return [2 /*return*/, _a.sent()];
|
|
2863
2865
|
case 2:
|
|
2864
|
-
if (!["eurtusd", "xautusd"].includes(this.id)) return [3 /*break*/, 4];
|
|
2866
|
+
if (!["eurtusd", "eursusd", "xautusd"].includes(this.id)) return [3 /*break*/, 4];
|
|
2865
2867
|
return [4 /*yield*/, contract.calc_token_amount(_amounts, curve_1.curve.constantOptions)];
|
|
2866
2868
|
case 3: return [2 /*return*/, _a.sent()];
|
|
2867
2869
|
case 4: return [4 /*yield*/, contract.calc_token_amount(_amounts, isDeposit, curve_1.curve.constantOptions)];
|
package/package.json
CHANGED
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@curvefi/api",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.25.0",
|
|
4
4
|
"description": "JavaScript library for curve.fi",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
|
+
"author": "Macket",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"private": false,
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "https://github.com/curvefi/curve-js.git"
|
|
12
|
+
},
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/curvefi/curve-js/issues"
|
|
15
|
+
},
|
|
6
16
|
"scripts": {
|
|
7
17
|
"build": "rm -rf lib && tsc -p tsconfig.build.json"
|
|
8
18
|
},
|
|
9
|
-
"author": "Macket",
|
|
10
|
-
"license": "ISC",
|
|
11
19
|
"devDependencies": {
|
|
12
20
|
"@types/chai": "^4.2.18",
|
|
13
21
|
"@types/memoizee": "^0.4.7",
|
|
@@ -23,6 +31,7 @@
|
|
|
23
31
|
"vue-eslint-parser": "^7.6.0"
|
|
24
32
|
},
|
|
25
33
|
"dependencies": {
|
|
34
|
+
"@ethersproject/networks": "^5.5.0",
|
|
26
35
|
"axios": "^0.21.1",
|
|
27
36
|
"bignumber.js": "^9.0.1",
|
|
28
37
|
"ethcall": "^4.2.5",
|