@curvefi/api 1.24.0 → 1.24.3

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 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.000211315200513239', '10000.0' ]
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
- // DAI: '10000.0',
179
- // sUSD: '10000.0',
180
- // aDAI: '10000.000211315200513239',
181
- // aSUSD: '10000.0'
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
- // { DAI: '10000.0', sUSD: '10000.0' }
189
-
187
+ // {
188
+ // '0x6B175474E89094C44Da98b954EedeAC495271d0F': '10000.0',
189
+ // '0x57Ab1ec28D129707052df4dF418D58a2D46d5f51': '10000.0'
190
+ // }
191
+
190
192
  console.log(await saave.coinBalances());
191
- // { aDAI: '10000.000211315200513239', aSUSD: '10000.0' }
193
+ // {
194
+ // '0x028171bCA77440897B824Ca71D1c56caC55b68A3': '10000.00017727177059715',
195
+ // '0x6c5024cd4f8a59110119c56f8933403a539555eb': '10000.000080108429034461'
196
+ // }
192
197
 
193
198
  console.log(await saave.allCoinBalances());
194
199
  // {
195
- // DAI: '10000.0',
196
- // sUSD: '10000.0',
197
- // aDAI: '10000.000211315200513239',
198
- // aSUSD: '10000.0'
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
- // DAI: '0.0',
209
- // sUSD: '0.0',
210
- // aDAI: '0.0',
211
- // aSUSD: '0.0'
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
- // DAI: '0.0',
221
- // sUSD: '0.0',
222
- // aDAI: '0.0',
223
- // aSUSD: '0.0'
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
- // DAI: '10000.0',
229
- // sUSD: '10000.0',
230
- // aDAI: '10000.000211315200513239',
231
- // aSUSD: '10000.0'
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
 
@@ -164,7 +164,21 @@ exports.DECIMALS_ETHEREUM = {
164
164
  "0x4e3fbd56cd56c3e72c1403e103b45db9da5b9d2b": 18,
165
165
  "0x68749665ff8d2d112fa859aa293f07a622782f38": 6,
166
166
  "0x090185f2135308bad17527004364ebcc2d37e5f6": 18,
167
- "0xCdF7028ceAB81fA0C6971208e83fa7872994beE5": 18, // T
167
+ "0xCdF7028ceAB81fA0C6971208e83fa7872994beE5": 18,
168
+ // --- REWARD TOKENS ---
169
+ "0xa3BeD4E1c75D00fa6f4E5E6922DB7261B5E9AcD2": 18,
170
+ "0x8762db106B2c2A0bccB3A80d1Ed41273552616E8": 18,
171
+ "0x20c36f062a31865bED8a5B1e512D9a1A20AA333A": 18,
172
+ "0x89Ab32156e46F46D02ade3FEcbe5Fc4243B9AAeD": 18,
173
+ "0x3c9d6c1C73b31c837832c72E04D3152f051fc1A9": 18,
174
+ "0x4da27a545c0c5b758a6ba100e3a049001de870f5": 18,
175
+ "0x5a98fcbea516cf06857215779fd812ca3bef1b32": 18,
176
+ "0xe0ad1806fd3e7edf6ff52fdb822432e847411033": 18,
177
+ "0x8290333cef9e6d528dd5618fb97a76f268f3edd4": 18,
178
+ "0x3432b6a60d23ca0dfca7761b7ab56459d9c964d0": 18,
179
+ "0x6dea81c8171d0ba574754ef6f8b412f2ed88c54d": 18,
180
+ "0xef3a930e1ffffacd2fc13434ac81bd278b0ecc8d": 18,
181
+ "0xdbdb4d16eda451d0503b854cf79d55697f90c8df": 18, // ALCX
168
182
  };
169
183
  // @ts-ignore
170
184
  exports.DECIMALS_LOWER_CASE_ETHEREUM = Object.fromEntries(Object.entries(exports.DECIMALS_ETHEREUM).map(function (entry) { return [entry[0].toLowerCase(), entry[1]]; }));
package/lib/curve.js CHANGED
@@ -115,9 +115,9 @@ var Curve = /** @class */ (function () {
115
115
  ) {
116
116
  if (options === void 0) { options = {}; }
117
117
  return __awaiter(this, void 0, void 0, function () {
118
- var cTokens, yTokens, ycTokens, aTokens, network, _a, customAbiTokens, _b, _i, _c, pool, _d, _e, coinAddr, _f, _g, coinAddr, _h, _j, coinAddr, _k, _l, rewardTokenAddr, _m, _o, _p, _q, _r, addressProviderContract, _s;
119
- return __generator(this, function (_t) {
120
- switch (_t.label) {
118
+ var cTokens, yTokens, ycTokens, aTokens, network, _a, customAbiTokens, _b, _i, _c, pool, _d, _e, coinAddr, _f, _g, coinAddr, _h, _j, coinAddr, _k, _l, rewardTokenAddr, addressProviderContract, _m;
119
+ return __generator(this, function (_o) {
120
+ switch (_o.label) {
121
121
  case 0:
122
122
  // JsonRpc provider
123
123
  if (providerType.toLowerCase() === 'JsonRpc'.toLowerCase()) {
@@ -160,8 +160,8 @@ var Curve = /** @class */ (function () {
160
160
  if (_a) return [3 /*break*/, 2];
161
161
  return [4 /*yield*/, this.provider._networkPromise];
162
162
  case 1:
163
- _a = (_t.sent());
164
- _t.label = 2;
163
+ _a = (_o.sent());
164
+ _o.label = 2;
165
165
  case 2:
166
166
  network = _a;
167
167
  console.log("CURVE-JS IS CONNECTED TO NETWORK:", network);
@@ -217,100 +217,62 @@ var Curve = /** @class */ (function () {
217
217
  this.multicallProvider = new ethcall_1.Provider();
218
218
  return [4 /*yield*/, this.multicallProvider.init(this.provider)];
219
219
  case 3:
220
- _t.sent();
220
+ _o.sent();
221
221
  if (!this.signer) return [3 /*break*/, 5];
222
222
  _b = this;
223
223
  return [4 /*yield*/, this.signer.getAddress()];
224
224
  case 4:
225
- _b.signerAddress = _t.sent();
225
+ _b.signerAddress = _o.sent();
226
226
  return [3 /*break*/, 6];
227
227
  case 5:
228
228
  this.signerAddress = '';
229
- _t.label = 6;
229
+ _o.label = 6;
230
230
  case 6:
231
231
  this.feeData = { gasPrice: options.gasPrice, maxFeePerGas: options.maxFeePerGas, maxPriorityFeePerGas: options.maxPriorityFeePerGas };
232
232
  return [4 /*yield*/, this.updateFeeData()];
233
233
  case 7:
234
- _t.sent();
235
- _i = 0, _c = Object.values(exports.POOLS_DATA);
236
- _t.label = 8;
237
- case 8:
238
- if (!(_i < _c.length)) return [3 /*break*/, 13];
239
- pool = _c[_i];
240
- this.contracts[pool.swap_address] = {
241
- contract: new ethers_1.Contract(pool.swap_address, pool.swap_abi, this.signer || this.provider),
242
- multicallContract: new ethcall_1.Contract(pool.swap_address, pool.swap_abi),
243
- };
244
- this.contracts[pool.swap_address.toLowerCase()] = {
245
- contract: new ethers_1.Contract(pool.swap_address, pool.swap_abi, this.signer || this.provider),
246
- multicallContract: new ethcall_1.Contract(pool.swap_address, pool.swap_abi),
247
- };
248
- if (pool.token_address !== pool.swap_address) {
249
- this.contracts[pool.token_address] = {
250
- contract: new ethers_1.Contract(pool.token_address, ERC20_json_1.default, this.signer || this.provider),
251
- multicallContract: new ethcall_1.Contract(pool.token_address, ERC20_json_1.default),
252
- };
253
- this.contracts[pool.token_address.toLowerCase()] = {
254
- contract: new ethers_1.Contract(pool.token_address, ERC20_json_1.default, this.signer || this.provider),
255
- multicallContract: new ethcall_1.Contract(pool.token_address, ERC20_json_1.default),
256
- };
257
- }
258
- this.contracts[pool.gauge_address] = {
259
- contract: new ethers_1.Contract(pool.gauge_address, pool.gauge_abi, this.signer || this.provider),
260
- multicallContract: new ethcall_1.Contract(pool.gauge_address, pool.gauge_abi),
261
- };
262
- this.contracts[pool.gauge_address.toLowerCase()] = {
263
- contract: new ethers_1.Contract(pool.gauge_address, pool.gauge_abi, this.signer || this.provider),
264
- multicallContract: new ethcall_1.Contract(pool.gauge_address, pool.gauge_abi),
265
- };
266
- if (pool.deposit_address && this.contracts[pool.deposit_address] === undefined) {
267
- this.contracts[pool.deposit_address] = {
268
- contract: new ethers_1.Contract(pool.deposit_address, pool.deposit_abi, this.signer || this.provider),
269
- multicallContract: new ethcall_1.Contract(pool.deposit_address, pool.deposit_abi),
270
- };
271
- this.contracts[pool.deposit_address.toLowerCase()] = {
272
- contract: new ethers_1.Contract(pool.deposit_address, pool.deposit_abi, this.signer || this.provider),
273
- multicallContract: new ethcall_1.Contract(pool.deposit_address, pool.deposit_abi),
234
+ _o.sent();
235
+ // TODO delete toLowerCase()
236
+ for (_i = 0, _c = Object.values(exports.POOLS_DATA); _i < _c.length; _i++) {
237
+ pool = _c[_i];
238
+ this.contracts[pool.swap_address] = {
239
+ contract: new ethers_1.Contract(pool.swap_address, pool.swap_abi, this.signer || this.provider),
240
+ multicallContract: new ethcall_1.Contract(pool.swap_address, pool.swap_abi),
274
241
  };
275
- }
276
- for (_d = 0, _e = pool.underlying_coin_addresses; _d < _e.length; _d++) {
277
- coinAddr = _e[_d];
278
- this.contracts[coinAddr] = {
279
- contract: new ethers_1.Contract(coinAddr, ERC20_json_1.default, this.signer || this.provider),
280
- multicallContract: new ethcall_1.Contract(coinAddr, ERC20_json_1.default),
281
- };
282
- this.contracts[coinAddr.toLowerCase()] = {
283
- contract: new ethers_1.Contract(coinAddr, ERC20_json_1.default, this.signer || this.provider),
284
- multicallContract: new ethcall_1.Contract(coinAddr, ERC20_json_1.default),
242
+ this.contracts[pool.swap_address.toLowerCase()] = {
243
+ contract: new ethers_1.Contract(pool.swap_address, pool.swap_abi, this.signer || this.provider),
244
+ multicallContract: new ethcall_1.Contract(pool.swap_address, pool.swap_abi),
285
245
  };
286
- }
287
- for (_f = 0, _g = pool.coin_addresses; _f < _g.length; _f++) {
288
- coinAddr = _g[_f];
289
- if (customAbiTokens.includes(coinAddr))
290
- continue;
291
- this.contracts[coinAddr] = {
292
- contract: new ethers_1.Contract(coinAddr, ERC20_json_1.default, this.signer || this.provider),
293
- multicallContract: new ethcall_1.Contract(coinAddr, ERC20_json_1.default),
246
+ if (pool.token_address !== pool.swap_address) {
247
+ this.contracts[pool.token_address] = {
248
+ contract: new ethers_1.Contract(pool.token_address, ERC20_json_1.default, this.signer || this.provider),
249
+ multicallContract: new ethcall_1.Contract(pool.token_address, ERC20_json_1.default),
250
+ };
251
+ this.contracts[pool.token_address.toLowerCase()] = {
252
+ contract: new ethers_1.Contract(pool.token_address, ERC20_json_1.default, this.signer || this.provider),
253
+ multicallContract: new ethcall_1.Contract(pool.token_address, ERC20_json_1.default),
254
+ };
255
+ }
256
+ this.contracts[pool.gauge_address] = {
257
+ contract: new ethers_1.Contract(pool.gauge_address, pool.gauge_abi, this.signer || this.provider),
258
+ multicallContract: new ethcall_1.Contract(pool.gauge_address, pool.gauge_abi),
294
259
  };
295
- this.contracts[coinAddr.toLowerCase()] = {
296
- contract: new ethers_1.Contract(coinAddr, ERC20_json_1.default, this.signer || this.provider),
297
- multicallContract: new ethcall_1.Contract(coinAddr, ERC20_json_1.default),
260
+ this.contracts[pool.gauge_address.toLowerCase()] = {
261
+ contract: new ethers_1.Contract(pool.gauge_address, pool.gauge_abi, this.signer || this.provider),
262
+ multicallContract: new ethcall_1.Contract(pool.gauge_address, pool.gauge_abi),
298
263
  };
299
- }
300
- // TODO add all coins
301
- for (_h = 0, _j = pool.coin_addresses; _h < _j.length; _h++) {
302
- coinAddr = _j[_h];
303
- if (cTokens.includes(coinAddr)) {
304
- this.contracts[coinAddr] = {
305
- contract: new ethers_1.Contract(coinAddr, cERC20_json_1.default, this.signer || this.provider),
306
- multicallContract: new ethcall_1.Contract(coinAddr, cERC20_json_1.default),
264
+ if (pool.deposit_address && this.contracts[pool.deposit_address] === undefined) {
265
+ this.contracts[pool.deposit_address] = {
266
+ contract: new ethers_1.Contract(pool.deposit_address, pool.deposit_abi, this.signer || this.provider),
267
+ multicallContract: new ethcall_1.Contract(pool.deposit_address, pool.deposit_abi),
307
268
  };
308
- this.contracts[coinAddr.toLowerCase()] = {
309
- contract: new ethers_1.Contract(coinAddr, cERC20_json_1.default, this.signer || this.provider),
310
- multicallContract: new ethcall_1.Contract(coinAddr, cERC20_json_1.default),
269
+ this.contracts[pool.deposit_address.toLowerCase()] = {
270
+ contract: new ethers_1.Contract(pool.deposit_address, pool.deposit_abi, this.signer || this.provider),
271
+ multicallContract: new ethcall_1.Contract(pool.deposit_address, pool.deposit_abi),
311
272
  };
312
273
  }
313
- if (aTokens.includes(coinAddr)) {
274
+ for (_d = 0, _e = pool.underlying_coin_addresses; _d < _e.length; _d++) {
275
+ coinAddr = _e[_d];
314
276
  this.contracts[coinAddr] = {
315
277
  contract: new ethers_1.Contract(coinAddr, ERC20_json_1.default, this.signer || this.provider),
316
278
  multicallContract: new ethcall_1.Contract(coinAddr, ERC20_json_1.default),
@@ -320,56 +282,75 @@ var Curve = /** @class */ (function () {
320
282
  multicallContract: new ethcall_1.Contract(coinAddr, ERC20_json_1.default),
321
283
  };
322
284
  }
323
- if (yTokens.includes(coinAddr) || ycTokens.includes(coinAddr)) {
285
+ for (_f = 0, _g = pool.coin_addresses; _f < _g.length; _f++) {
286
+ coinAddr = _g[_f];
287
+ if (customAbiTokens.includes(coinAddr))
288
+ continue;
324
289
  this.contracts[coinAddr] = {
325
- contract: new ethers_1.Contract(coinAddr, yERC20_json_1.default, this.signer || this.provider),
326
- multicallContract: new ethcall_1.Contract(coinAddr, yERC20_json_1.default),
290
+ contract: new ethers_1.Contract(coinAddr, ERC20_json_1.default, this.signer || this.provider),
291
+ multicallContract: new ethcall_1.Contract(coinAddr, ERC20_json_1.default),
327
292
  };
328
293
  this.contracts[coinAddr.toLowerCase()] = {
329
- contract: new ethers_1.Contract(coinAddr, yERC20_json_1.default, this.signer || this.provider),
330
- multicallContract: new ethcall_1.Contract(coinAddr, yERC20_json_1.default),
294
+ contract: new ethers_1.Contract(coinAddr, ERC20_json_1.default, this.signer || this.provider),
295
+ multicallContract: new ethcall_1.Contract(coinAddr, ERC20_json_1.default),
296
+ };
297
+ }
298
+ // TODO add all coins
299
+ for (_h = 0, _j = pool.coin_addresses; _h < _j.length; _h++) {
300
+ coinAddr = _j[_h];
301
+ if (cTokens.includes(coinAddr)) {
302
+ this.contracts[coinAddr] = {
303
+ contract: new ethers_1.Contract(coinAddr, cERC20_json_1.default, this.signer || this.provider),
304
+ multicallContract: new ethcall_1.Contract(coinAddr, cERC20_json_1.default),
305
+ };
306
+ this.contracts[coinAddr.toLowerCase()] = {
307
+ contract: new ethers_1.Contract(coinAddr, cERC20_json_1.default, this.signer || this.provider),
308
+ multicallContract: new ethcall_1.Contract(coinAddr, cERC20_json_1.default),
309
+ };
310
+ }
311
+ if (aTokens.includes(coinAddr)) {
312
+ this.contracts[coinAddr] = {
313
+ contract: new ethers_1.Contract(coinAddr, ERC20_json_1.default, this.signer || this.provider),
314
+ multicallContract: new ethcall_1.Contract(coinAddr, ERC20_json_1.default),
315
+ };
316
+ this.contracts[coinAddr.toLowerCase()] = {
317
+ contract: new ethers_1.Contract(coinAddr, ERC20_json_1.default, this.signer || this.provider),
318
+ multicallContract: new ethcall_1.Contract(coinAddr, ERC20_json_1.default),
319
+ };
320
+ }
321
+ if (yTokens.includes(coinAddr) || ycTokens.includes(coinAddr)) {
322
+ this.contracts[coinAddr] = {
323
+ contract: new ethers_1.Contract(coinAddr, yERC20_json_1.default, this.signer || this.provider),
324
+ multicallContract: new ethcall_1.Contract(coinAddr, yERC20_json_1.default),
325
+ };
326
+ this.contracts[coinAddr.toLowerCase()] = {
327
+ contract: new ethers_1.Contract(coinAddr, yERC20_json_1.default, this.signer || this.provider),
328
+ multicallContract: new ethcall_1.Contract(coinAddr, yERC20_json_1.default),
329
+ };
330
+ }
331
+ }
332
+ if (pool.reward_contract) {
333
+ this.contracts[pool.reward_contract] = {
334
+ contract: new ethers_1.Contract(pool.reward_contract, streamer_json_1.default, this.signer || this.provider),
335
+ multicallContract: new ethcall_1.Contract(pool.reward_contract, streamer_json_1.default),
336
+ };
337
+ this.contracts[pool.reward_contract.toLowerCase()] = {
338
+ contract: new ethers_1.Contract(pool.reward_contract, streamer_json_1.default, this.signer || this.provider),
339
+ multicallContract: new ethcall_1.Contract(pool.reward_contract, streamer_json_1.default),
340
+ };
341
+ }
342
+ for (_k = 0, _l = pool.reward_tokens || []; _k < _l.length; _k++) {
343
+ rewardTokenAddr = _l[_k];
344
+ this.contracts[rewardTokenAddr] = {
345
+ contract: new ethers_1.Contract(rewardTokenAddr, ERC20_json_1.default, this.signer || this.provider),
346
+ multicallContract: new ethcall_1.Contract(rewardTokenAddr, ERC20_json_1.default),
347
+ };
348
+ this.contracts[rewardTokenAddr.toLowerCase()] = {
349
+ contract: new ethers_1.Contract(rewardTokenAddr, ERC20_json_1.default, this.signer || this.provider),
350
+ multicallContract: new ethcall_1.Contract(rewardTokenAddr, ERC20_json_1.default),
331
351
  };
332
352
  }
333
353
  }
334
- if (pool.reward_contract) {
335
- this.contracts[pool.reward_contract] = {
336
- contract: new ethers_1.Contract(pool.reward_contract, streamer_json_1.default, this.signer || this.provider),
337
- multicallContract: new ethcall_1.Contract(pool.reward_contract, streamer_json_1.default),
338
- };
339
- this.contracts[pool.reward_contract.toLowerCase()] = {
340
- contract: new ethers_1.Contract(pool.reward_contract, streamer_json_1.default, this.signer || this.provider),
341
- multicallContract: new ethcall_1.Contract(pool.reward_contract, streamer_json_1.default),
342
- };
343
- }
344
- _k = 0, _l = pool.reward_tokens || [];
345
- _t.label = 9;
346
- case 9:
347
- if (!(_k < _l.length)) return [3 /*break*/, 12];
348
- rewardTokenAddr = _l[_k];
349
- this.contracts[rewardTokenAddr] = {
350
- contract: new ethers_1.Contract(rewardTokenAddr, ERC20_json_1.default, this.signer || this.provider),
351
- multicallContract: new ethcall_1.Contract(rewardTokenAddr, ERC20_json_1.default),
352
- };
353
- this.contracts[rewardTokenAddr.toLowerCase()] = {
354
- contract: new ethers_1.Contract(rewardTokenAddr, ERC20_json_1.default, this.signer || this.provider),
355
- multicallContract: new ethcall_1.Contract(rewardTokenAddr, ERC20_json_1.default),
356
- };
357
- _m = exports.DECIMALS_LOWER_CASE;
358
- _o = rewardTokenAddr.toLowerCase();
359
- _p = Number;
360
- _r = (_q = ethers_1.ethers.utils).formatUnits;
361
- return [4 /*yield*/, this.contracts[rewardTokenAddr].contract.decimals()];
362
- case 10:
363
- _m[_o] =
364
- _p.apply(void 0, [_r.apply(_q, [_t.sent(), 0])]);
365
- _t.label = 11;
366
- case 11:
367
- _k++;
368
- return [3 /*break*/, 9];
369
- case 12:
370
- _i++;
371
- return [3 /*break*/, 8];
372
- case 13:
373
354
  this.contracts[exports.ALIASES.crv] = {
374
355
  contract: new ethers_1.Contract(exports.ALIASES.crv, ERC20_json_1.default, this.signer || this.provider),
375
356
  multicallContract: new ethcall_1.Contract(exports.ALIASES.crv, ERC20_json_1.default),
@@ -403,10 +384,10 @@ var Curve = /** @class */ (function () {
403
384
  multicallContract: new ethcall_1.Contract(exports.ALIASES.address_provider, address_provider_json_1.default),
404
385
  };
405
386
  addressProviderContract = this.contracts[exports.ALIASES.address_provider].contract;
406
- _s = exports.ALIASES;
387
+ _m = exports.ALIASES;
407
388
  return [4 /*yield*/, addressProviderContract.get_address(2, this.constantOptions)];
408
- case 14:
409
- _s.registry_exchange = _t.sent();
389
+ case 8:
390
+ _m.registry_exchange = _o.sent();
410
391
  this.contracts[exports.ALIASES.registry_exchange] = {
411
392
  contract: new ethers_1.Contract(exports.ALIASES.registry_exchange, registry_exchange_json_1.default, this.signer || this.provider),
412
393
  multicallContract: new ethcall_1.Contract(exports.ALIASES.registry_exchange, registry_exchange_json_1.default),
@@ -145,7 +145,7 @@ function setFactoryZapContracts() {
145
145
  }
146
146
  function getFactoryPoolsDataFromApi(isCrypto) {
147
147
  return __awaiter(this, void 0, void 0, function () {
148
- var network, factoryType, url, response, rawPoolList, FACTORY_POOLS_DATA;
148
+ var network, factoryType, url, response, rawPoolList, mainAddresses, FACTORY_POOLS_DATA;
149
149
  var _this = this;
150
150
  return __generator(this, function (_a) {
151
151
  switch (_a.label) {
@@ -157,6 +157,8 @@ function getFactoryPoolsDataFromApi(isCrypto) {
157
157
  case 1:
158
158
  response = _a.sent();
159
159
  rawPoolList = response.data.data.poolData;
160
+ mainAddresses = Object.values(this.constants.POOLS_DATA).map(function (pool) { return pool.swap_address.toLowerCase(); });
161
+ rawPoolList = rawPoolList.filter(function (p) { return !mainAddresses.includes(p.address.toLowerCase()); });
160
162
  setFactorySwapContracts.call(this, rawPoolList, isCrypto);
161
163
  if (isCrypto)
162
164
  setCryptoFactoryTokenContracts.call(this, rawPoolList);
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.underlyingCoins, true), this.coins, true), __spreadArray(__spreadArray([this.lpToken], this.underlyingCoinAddresses, true), this.coinAddresses, true)], addresses, false))];
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.underlyingCoins, true), this.coins, true), __spreadArray(__spreadArray([this.lpToken, this.gauge], this.underlyingCoinAddresses, true), this.coinAddresses, true)], addresses, false))];
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.underlyingCoins, this.underlyingCoinAddresses], addresses, false))];
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.coins, this.coinAddresses], addresses, false))];
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.underlyingCoins, true), this.coins, true), __spreadArray(__spreadArray([], this.underlyingCoinAddresses, true), this.coinAddresses, true)], addresses, false))];
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
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@curvefi/api",
3
- "version": "1.24.0",
3
+ "version": "1.24.3",
4
4
  "description": "JavaScript library for curve.fi",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {