@curvefi/api 2.25.5 → 2.26.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.
@@ -9,6 +9,8 @@ exports.COINS_AVALANCHE = (0, utils_1.lowerCaseValues)({
9
9
  'dai.e': '0xd586E7F844cEa2F87f50152665BCbc2C279D8d70',
10
10
  'usdc.e': '0xA7D7079b0FEaD91F3e65f86E8915Cb59c1a4C664',
11
11
  'usdt.e': '0xc7198437980c041c805A1EDcbA50c1Ce5db95118',
12
+ 'usdc': '0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E',
13
+ 'usdt': '0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7',
12
14
  'avdai': '0x47AFa96Cdc9fAb46904A55a6ad4bf6660B53c38a',
13
15
  'avusdc': '0x46A51127C3ce23fb7AB1DE06226147F446e4a857',
14
16
  'avusdt': '0x532E6537FEA298397212F09A61e03311686f548e',
@@ -103,4 +103,34 @@ exports.POOLS_DATA_AVALANCHE = (0, utils_1.lowerCasePoolDataAddresses)({
103
103
  gauge_abi: gauge_child_json_1.default,
104
104
  deposit_abi: zap_json_1.default,
105
105
  },
106
+ aaveV3: {
107
+ name: "aaveV3",
108
+ full_name: "aaveV3",
109
+ symbol: "aaveV3",
110
+ reference_asset: 'USD',
111
+ swap_address: '0xD2AcAe14ae2ee0f6557aC6C6D0e407a92C36214b',
112
+ token_address: '0x5bE26703a658c332CE612eAe3A497059dA98394a',
113
+ gauge_address: '0x55f9Ba282c39793DB29C68F8f113fC97D23a6445',
114
+ is_lending: true,
115
+ underlying_coins: ['DAI.e', 'USDC', 'USDt'],
116
+ wrapped_coins: ['aAvaDAI', 'aAvaUSDC', 'aAvaUSDT'],
117
+ underlying_coin_addresses: [
118
+ '0xd586E7F844cEa2F87f50152665BCbc2C279D8d70',
119
+ '0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E',
120
+ '0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7',
121
+ ],
122
+ wrapped_coin_addresses: [
123
+ '0x82E64f49Ed5EC1bC6e43DAD4FC8Af9bb3A2312EE',
124
+ '0x625E7708f30cA75bfd92586e17077590C60eb4cD',
125
+ '0x6ab707Aca953eDAeFBc4fD23bA73294241490620',
126
+ ],
127
+ underlying_decimals: [18, 6, 6],
128
+ wrapped_decimals: [18, 6, 6],
129
+ use_lending: [true, true, true],
130
+ swap_abi: swap_json_1.default,
131
+ gauge_abi: gauge_child_json_1.default,
132
+ // sCurveRewards_abi: paaveRewardsabi,
133
+ // sCurveRewards_address: '0xB504b6EB06760019801a91B451d3f7BD9f027fC9',
134
+ // reward_token: "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7",
135
+ },
106
136
  });
@@ -60,7 +60,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
60
60
  };
61
61
  Object.defineProperty(exports, "__esModule", { value: true });
62
62
  exports.getFactoryPoolsDataFromApi = exports.lowerCasePoolDataAddresses = void 0;
63
- var axios_1 = __importDefault(require("axios"));
64
63
  var ethers_1 = require("ethers");
65
64
  var ethcall_1 = require("ethcall");
66
65
  var gauge_factory_json_1 = __importDefault(require("../constants/abis/gauge_factory.json"));
@@ -155,34 +154,20 @@ function setFactoryCoinsContracts(rawPoolList) {
155
154
  }
156
155
  function getFactoryPoolsDataFromApi(isCrypto) {
157
156
  return __awaiter(this, void 0, void 0, function () {
158
- var network, factoryType, rawPoolList, _a, mainAddresses, url, response, poolGaugeDict, _i, _b, gaugeData, i, FACTORY_POOLS_DATA;
157
+ var network, factoryType, rawPoolList, _a, mainAddresses, FACTORY_POOLS_DATA;
159
158
  var _this = this;
160
- return __generator(this, function (_c) {
161
- switch (_c.label) {
159
+ return __generator(this, function (_b) {
160
+ switch (_b.label) {
162
161
  case 0:
163
162
  network = this.constants.NETWORK_NAME;
164
163
  factoryType = isCrypto ? "factory-crypto" : "factory";
165
164
  _a = exports.lowerCasePoolDataAddresses;
166
165
  return [4 /*yield*/, (0, external_api_1._getPoolsFromApi)(network, factoryType)];
167
166
  case 1:
168
- rawPoolList = _a.apply(void 0, [(_c.sent()).poolData]);
167
+ rawPoolList = _a.apply(void 0, [(_b.sent()).poolData]);
168
+ rawPoolList = rawPoolList.filter(function (p) { return p.implementationAddress in constants_1.FACTORY_CONSTANTS[_this.chainId].implementationABIDict; });
169
169
  mainAddresses = Object.values(this.constants.POOLS_DATA).map(function (pool) { return pool.swap_address; });
170
170
  rawPoolList = rawPoolList.filter(function (p) { return !mainAddresses.includes(p.address); });
171
- if (!(this.chainId !== 1)) return [3 /*break*/, 3];
172
- url = "https://api.curve.fi/api/getFactoGauges/".concat(network);
173
- return [4 /*yield*/, axios_1.default.get(url)];
174
- case 2:
175
- response = _c.sent();
176
- poolGaugeDict = {};
177
- for (_i = 0, _b = response.data.data.gauges; _i < _b.length; _i++) {
178
- gaugeData = _b[_i];
179
- poolGaugeDict[gaugeData.swap.toLowerCase()] = gaugeData.gauge.toLowerCase();
180
- }
181
- for (i = 0; i < rawPoolList.length; i++) {
182
- rawPoolList[i].gaugeAddress = poolGaugeDict[rawPoolList[i].address];
183
- }
184
- _c.label = 3;
185
- case 3:
186
171
  setFactorySwapContracts.call(this, rawPoolList, isCrypto);
187
172
  if (isCrypto)
188
173
  setCryptoFactoryTokenContracts.call(this, rawPoolList);
@@ -383,7 +383,7 @@ function getFactoryIsMeta(factorySwapAddresses) {
383
383
  }
384
384
  function getFactoryPoolData(swapAddress) {
385
385
  return __awaiter(this, void 0, void 0, function () {
386
- var _a, poolIds, swapAddresses, _b, implementations, implementationABIDict, swapABIs, gaugeAddresses, _c, poolSymbols, poolNames, referenceAssets, coinAddresses, existingCoinAddressNameDict, coinAddressNameDict, coinAddressDecimalsDict, isMeta, implementationBasePoolIdDict, basePoolIds, FACTORY_POOLS_DATA, _loop_2, this_1, i;
386
+ var _a, rawPoolIds, rawSwapAddresses, _b, rawImplementations, poolIds, swapAddresses, implementations, implementationABIDict, i, swapABIs, gaugeAddresses, _c, poolSymbols, poolNames, referenceAssets, coinAddresses, existingCoinAddressNameDict, coinAddressNameDict, coinAddressDecimalsDict, isMeta, implementationBasePoolIdDict, basePoolIds, FACTORY_POOLS_DATA, _loop_2, this_1, i;
387
387
  return __generator(this, function (_e) {
388
388
  switch (_e.label) {
389
389
  case 0:
@@ -397,11 +397,21 @@ function getFactoryPoolData(swapAddress) {
397
397
  _b = _e.sent();
398
398
  _e.label = 4;
399
399
  case 4:
400
- _a = _b, poolIds = _a[0], swapAddresses = _a[1];
401
- return [4 /*yield*/, getFactoryImplementations.call(this, swapAddresses)];
400
+ _a = _b, rawPoolIds = _a[0], rawSwapAddresses = _a[1];
401
+ return [4 /*yield*/, getFactoryImplementations.call(this, rawSwapAddresses)];
402
402
  case 5:
403
- implementations = _e.sent();
403
+ rawImplementations = _e.sent();
404
+ poolIds = [];
405
+ swapAddresses = [];
406
+ implementations = [];
404
407
  implementationABIDict = constants_1.FACTORY_CONSTANTS[this.chainId].implementationABIDict;
408
+ for (i = 0; i < rawPoolIds.length; i++) {
409
+ if (rawImplementations[i] in implementationABIDict) {
410
+ poolIds.push(rawPoolIds[i]);
411
+ swapAddresses.push(rawSwapAddresses[i]);
412
+ implementations.push(rawImplementations[i]);
413
+ }
414
+ }
405
415
  swapABIs = implementations.map(function (addr) { return implementationABIDict[addr]; });
406
416
  setFactorySwapContracts.call(this, swapAddresses, swapABIs);
407
417
  return [4 /*yield*/, getFactoryGaugeAddresses.call(this, swapAddresses)];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@curvefi/api",
3
- "version": "2.25.5",
3
+ "version": "2.26.1",
4
4
  "description": "JavaScript library for curve.fi",
5
5
  "main": "lib/index.js",
6
6
  "author": "Macket",