@curvefi/api 1.24.0 → 1.24.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/README.md +33 -27
- package/lib/pools.js +5 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -161,13 +161,12 @@ import curve from "@curvefi/api";
|
|
|
161
161
|
console.log(await curve.getBalances(['aDAI', 'aSUSD']));
|
|
162
162
|
// OR console.log(await curve.getBalances(['0x028171bCA77440897B824Ca71D1c56caC55b68A3', '0x6c5024cd4f8a59110119c56f8933403a539555eb']));
|
|
163
163
|
|
|
164
|
-
// [ '10000.
|
|
164
|
+
// [ '10000.00017727177059715', '10000.000080108429034461' ]
|
|
165
|
+
|
|
165
166
|
|
|
166
|
-
|
|
167
167
|
// --- Pool ---
|
|
168
168
|
|
|
169
169
|
const saave = new curve.Pool('saave');
|
|
170
|
-
|
|
171
170
|
|
|
172
171
|
// 1. Current address balances (signer balances)
|
|
173
172
|
|
|
@@ -175,40 +174,46 @@ import curve from "@curvefi/api";
|
|
|
175
174
|
// {
|
|
176
175
|
// lpToken: '0.0',
|
|
177
176
|
// gauge: '0.0',
|
|
178
|
-
//
|
|
179
|
-
//
|
|
180
|
-
//
|
|
181
|
-
//
|
|
177
|
+
// '0x6B175474E89094C44Da98b954EedeAC495271d0F': '10000.0',
|
|
178
|
+
// '0x57Ab1ec28D129707052df4dF418D58a2D46d5f51': '10000.0',
|
|
179
|
+
// '0x028171bCA77440897B824Ca71D1c56caC55b68A3': '10000.00017727177059715',
|
|
180
|
+
// '0x6c5024cd4f8a59110119c56f8933403a539555eb': '10000.000080108429034461'
|
|
182
181
|
// }
|
|
183
182
|
|
|
184
183
|
console.log(await saave.lpTokenBalances());
|
|
185
184
|
// { lpToken: '0.0', gauge: '0.0' }
|
|
186
185
|
|
|
187
186
|
console.log(await saave.underlyingCoinBalances());
|
|
188
|
-
// {
|
|
189
|
-
|
|
187
|
+
// {
|
|
188
|
+
// '0x6B175474E89094C44Da98b954EedeAC495271d0F': '10000.0',
|
|
189
|
+
// '0x57Ab1ec28D129707052df4dF418D58a2D46d5f51': '10000.0'
|
|
190
|
+
// }
|
|
191
|
+
|
|
190
192
|
console.log(await saave.coinBalances());
|
|
191
|
-
// {
|
|
193
|
+
// {
|
|
194
|
+
// '0x028171bCA77440897B824Ca71D1c56caC55b68A3': '10000.00017727177059715',
|
|
195
|
+
// '0x6c5024cd4f8a59110119c56f8933403a539555eb': '10000.000080108429034461'
|
|
196
|
+
// }
|
|
192
197
|
|
|
193
198
|
console.log(await saave.allCoinBalances());
|
|
194
199
|
// {
|
|
195
|
-
//
|
|
196
|
-
//
|
|
197
|
-
//
|
|
198
|
-
//
|
|
200
|
+
// '0x6B175474E89094C44Da98b954EedeAC495271d0F': '10000.0',
|
|
201
|
+
// '0x57Ab1ec28D129707052df4dF418D58a2D46d5f51': '10000.0',
|
|
202
|
+
// '0x028171bCA77440897B824Ca71D1c56caC55b68A3': '10000.00017727177059715',
|
|
203
|
+
// '0x6c5024cd4f8a59110119c56f8933403a539555eb': '10000.000080108429034461'
|
|
199
204
|
// }
|
|
200
205
|
|
|
201
|
-
|
|
206
|
+
|
|
202
207
|
// 2. For every method above you can specify the address
|
|
203
208
|
|
|
204
209
|
console.log(await saave.balances("0x0063046686E46Dc6F15918b61AE2B121458534a5"));
|
|
205
210
|
// {
|
|
206
211
|
// lpToken: '0.0',
|
|
207
212
|
// gauge: '0.0',
|
|
208
|
-
//
|
|
209
|
-
//
|
|
210
|
-
//
|
|
211
|
-
//
|
|
213
|
+
// '0x6B175474E89094C44Da98b954EedeAC495271d0F': '0.0',
|
|
214
|
+
// '0x57Ab1ec28D129707052df4dF418D58a2D46d5f51': '0.0',
|
|
215
|
+
// '0x028171bCA77440897B824Ca71D1c56caC55b68A3': '0.0',
|
|
216
|
+
// '0x6c5024cd4f8a59110119c56f8933403a539555eb': '0.0'
|
|
212
217
|
// }
|
|
213
218
|
|
|
214
219
|
// Or several addresses
|
|
@@ -217,21 +222,22 @@ import curve from "@curvefi/api";
|
|
|
217
222
|
// '0x0063046686E46Dc6F15918b61AE2B121458534a5': {
|
|
218
223
|
// lpToken: '0.0',
|
|
219
224
|
// gauge: '0.0',
|
|
220
|
-
//
|
|
221
|
-
//
|
|
222
|
-
//
|
|
223
|
-
//
|
|
225
|
+
// '0x6B175474E89094C44Da98b954EedeAC495271d0F': '0.0',
|
|
226
|
+
// '0x57Ab1ec28D129707052df4dF418D58a2D46d5f51': '0.0',
|
|
227
|
+
// '0x028171bCA77440897B824Ca71D1c56caC55b68A3': '0.0',
|
|
228
|
+
// '0x6c5024cd4f8a59110119c56f8933403a539555eb': '0.0'
|
|
224
229
|
// },
|
|
225
230
|
// '0x66aB6D9362d4F35596279692F0251Db635165871': {
|
|
226
231
|
// lpToken: '0.0',
|
|
227
232
|
// gauge: '0.0',
|
|
228
|
-
//
|
|
229
|
-
//
|
|
230
|
-
//
|
|
231
|
-
//
|
|
233
|
+
// '0x6B175474E89094C44Da98b954EedeAC495271d0F': '10000.0',
|
|
234
|
+
// '0x57Ab1ec28D129707052df4dF418D58a2D46d5f51': '10000.0',
|
|
235
|
+
// '0x028171bCA77440897B824Ca71D1c56caC55b68A3': '10000.00017727177059715',
|
|
236
|
+
// '0x6c5024cd4f8a59110119c56f8933403a539555eb': '10000.000080108429034461'
|
|
232
237
|
// }
|
|
233
238
|
// }
|
|
234
239
|
|
|
240
|
+
|
|
235
241
|
})()
|
|
236
242
|
```
|
|
237
243
|
|
package/lib/pools.js
CHANGED
|
@@ -2026,9 +2026,9 @@ var Pool = /** @class */ (function () {
|
|
|
2026
2026
|
switch (_a.label) {
|
|
2027
2027
|
case 0:
|
|
2028
2028
|
if (!(this.gauge === ethers_1.ethers.constants.AddressZero)) return [3 /*break*/, 2];
|
|
2029
|
-
return [4 /*yield*/, this._balances.apply(this, __spreadArray([__spreadArray(__spreadArray(['lpToken'], this.
|
|
2029
|
+
return [4 /*yield*/, this._balances.apply(this, __spreadArray([__spreadArray(__spreadArray(['lpToken'], this.underlyingCoinAddresses, true), this.coinAddresses, true), __spreadArray(__spreadArray([this.lpToken], this.underlyingCoinAddresses, true), this.coinAddresses, true)], addresses, false))];
|
|
2030
2030
|
case 1: return [2 /*return*/, _a.sent()];
|
|
2031
|
-
case 2: return [4 /*yield*/, this._balances.apply(this, __spreadArray([__spreadArray(__spreadArray(['lpToken', 'gauge'], this.
|
|
2031
|
+
case 2: return [4 /*yield*/, this._balances.apply(this, __spreadArray([__spreadArray(__spreadArray(['lpToken', 'gauge'], this.underlyingCoinAddresses, true), this.coinAddresses, true), __spreadArray(__spreadArray([this.lpToken, this.gauge], this.underlyingCoinAddresses, true), this.coinAddresses, true)], addresses, false))];
|
|
2032
2032
|
case 3: return [2 /*return*/, _a.sent()];
|
|
2033
2033
|
}
|
|
2034
2034
|
});
|
|
@@ -2060,7 +2060,7 @@ var Pool = /** @class */ (function () {
|
|
|
2060
2060
|
return __awaiter(_this, void 0, void 0, function () {
|
|
2061
2061
|
return __generator(this, function (_a) {
|
|
2062
2062
|
switch (_a.label) {
|
|
2063
|
-
case 0: return [4 /*yield*/, this._balances.apply(this, __spreadArray([this.
|
|
2063
|
+
case 0: return [4 /*yield*/, this._balances.apply(this, __spreadArray([this.underlyingCoinAddresses, this.underlyingCoinAddresses], addresses, false))];
|
|
2064
2064
|
case 1: return [2 /*return*/, _a.sent()];
|
|
2065
2065
|
}
|
|
2066
2066
|
});
|
|
@@ -2074,7 +2074,7 @@ var Pool = /** @class */ (function () {
|
|
|
2074
2074
|
return __awaiter(_this, void 0, void 0, function () {
|
|
2075
2075
|
return __generator(this, function (_a) {
|
|
2076
2076
|
switch (_a.label) {
|
|
2077
|
-
case 0: return [4 /*yield*/, this._balances.apply(this, __spreadArray([this.
|
|
2077
|
+
case 0: return [4 /*yield*/, this._balances.apply(this, __spreadArray([this.coinAddresses, this.coinAddresses], addresses, false))];
|
|
2078
2078
|
case 1: return [2 /*return*/, _a.sent()];
|
|
2079
2079
|
}
|
|
2080
2080
|
});
|
|
@@ -2088,7 +2088,7 @@ var Pool = /** @class */ (function () {
|
|
|
2088
2088
|
return __awaiter(_this, void 0, void 0, function () {
|
|
2089
2089
|
return __generator(this, function (_a) {
|
|
2090
2090
|
switch (_a.label) {
|
|
2091
|
-
case 0: return [4 /*yield*/, this._balances.apply(this, __spreadArray([__spreadArray(__spreadArray([], this.
|
|
2091
|
+
case 0: return [4 /*yield*/, this._balances.apply(this, __spreadArray([__spreadArray(__spreadArray([], this.underlyingCoinAddresses, true), this.coinAddresses, true), __spreadArray(__spreadArray([], this.underlyingCoinAddresses, true), this.coinAddresses, true)], addresses, false))];
|
|
2092
2092
|
case 1: return [2 /*return*/, _a.sent()];
|
|
2093
2093
|
}
|
|
2094
2094
|
});
|