@curvefi/api 2.71.1 → 2.71.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.
@@ -322,7 +322,7 @@ export const basePoolIdZapDictArbitrum = {
322
322
  address: "0x803A2B40c5a9BB2B86DD630B274Fa2A9202874C2".toLowerCase(),
323
323
  ABI: MetaZapFantomABI,
324
324
  },
325
- "0xc9b8a3fdecb9d5b218d02555a8baf332e5b740d5": {
325
+ fraxbp: {
326
326
  address: "0x58AC91f5BE7dC0c35b24B96B19BAc55FBB8E705e".toLowerCase(),
327
327
  ABI: MetaZapFantomABI,
328
328
  },
@@ -332,7 +332,7 @@ export const basePoolIdZapDictOptimism = {
332
332
  address: "0x167e42a1c7ab4be03764a2222aac57f5f6754411".toLowerCase(),
333
333
  ABI: factoryDepositABI,
334
334
  },
335
- "0x29a3d66b30bc4ad674a4fdaf27578b64f6afbfe7": {
335
+ fraxbp: {
336
336
  address: "0x4244eB811D6e0Ef302326675207A95113dB4E1F8".toLowerCase(),
337
337
  ABI: MetaZapFantomABI,
338
338
  },
@@ -32,6 +32,30 @@ export const POOLS_DATA_ARBITRUM = lowerCasePoolDataAddresses({
32
32
  swap_abi: twopoolSwapABI,
33
33
  gauge_abi: gaugeChildABI,
34
34
  },
35
+ fraxbp: {
36
+ name: "fraxbp",
37
+ full_name: "fraxbp",
38
+ symbol: "fraxbp",
39
+ reference_asset: "USD",
40
+ swap_address: '0xC9B8a3FDECB9D5b218d02555a8Baf332E5B740d5',
41
+ token_address: '0xC9B8a3FDECB9D5b218d02555a8Baf332E5B740d5',
42
+ gauge_address: '0x95285Ea6fF14F80A2fD3989a6bAb993Bd6b5fA13',
43
+ is_plain: true,
44
+ underlying_coins: ['FRAX', 'USDC.e'],
45
+ wrapped_coins: ['FRAX', 'USDC.e'],
46
+ underlying_coin_addresses: [
47
+ '0x17FC002b466eEc40DaE837Fc4bE5c67993ddBd6F',
48
+ '0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8',
49
+ ],
50
+ wrapped_coin_addresses: [
51
+ '0x17FC002b466eEc40DaE837Fc4bE5c67993ddBd6F',
52
+ '0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8',
53
+ ],
54
+ underlying_decimals: [18, 6],
55
+ wrapped_decimals: [18, 6],
56
+ swap_abi: twopoolSwapABI,
57
+ gauge_abi: gaugeChildABI,
58
+ },
35
59
  tricrypto: {
36
60
  name: "tricrypto",
37
61
  full_name: "tricrypto",
@@ -1,5 +1,6 @@
1
1
  import { lowerCasePoolDataAddresses } from "../utils.js";
2
2
  import tripoolSwapABI from '../abis/3pool-optimism/swap.json' with { type: 'json' };
3
+ import twopoolSwapABI from '../abis/2pool/swap.json' with { type: 'json' };
3
4
  import wstETHSwapABI from '../abis/wsteth/swap.json' with { type: 'json' };
4
5
  import gaugeChildABI from '../abis/gauge_child.json' with { type: 'json' };
5
6
  export const POOLS_DATA_OPTIMISM = lowerCasePoolDataAddresses({
@@ -29,6 +30,30 @@ export const POOLS_DATA_OPTIMISM = lowerCasePoolDataAddresses({
29
30
  swap_abi: tripoolSwapABI,
30
31
  gauge_abi: gaugeChildABI,
31
32
  },
33
+ fraxbp: {
34
+ name: "fraxbp",
35
+ full_name: "fraxbp",
36
+ symbol: "fraxbp",
37
+ reference_asset: 'USD',
38
+ is_plain: true,
39
+ swap_address: '0x29A3d66B30Bc4AD674A4FDAF27578B64f6afbFe7',
40
+ token_address: '0x29A3d66B30Bc4AD674A4FDAF27578B64f6afbFe7',
41
+ gauge_address: '0x4B960396011A914B4ccCC3b33DFEE83A97A9D766',
42
+ underlying_coins: ['FRAX', 'USDC.e'],
43
+ wrapped_coins: ['FRAX', 'USDC.e'],
44
+ underlying_coin_addresses: [
45
+ '0x2E3D870790dC77A83DD1d18184Acc7439A53f475',
46
+ '0x7F5c764cBc14f9669B88837ca1490cCa17c31607',
47
+ ],
48
+ wrapped_coin_addresses: [
49
+ '0x2E3D870790dC77A83DD1d18184Acc7439A53f475',
50
+ '0x7F5c764cBc14f9669B88837ca1490cCa17c31607',
51
+ ],
52
+ underlying_decimals: [18, 6],
53
+ wrapped_decimals: [18, 6],
54
+ swap_abi: twopoolSwapABI,
55
+ gauge_abi: gaugeChildABI,
56
+ },
32
57
  wsteth: {
33
58
  name: "wsteth",
34
59
  full_name: "wsteth",
package/lib/curve.js CHANGED
@@ -12,6 +12,7 @@ import { Contract as MulticallContract, Provider as MulticallProvider } from "@c
12
12
  import { NETWORK_CONSTANTS } from "./constants/network_constants.js";
13
13
  import { CRYPTO_FACTORY_CONSTANTS, STABLE_FACTORY_CONSTANTS } from "./constants/factory/index.js";
14
14
  import { getFactoryPoolData } from "./factory/factory.js";
15
+ import { getLastFactoryPoolIndex } from "./factory/common.js";
15
16
  import { getFactoryPoolsDataFromApi } from "./factory/factory-api.js";
16
17
  import { getCryptoFactoryPoolData } from "./factory/factory-crypto.js";
17
18
  import { getTricryptoFactoryPoolData } from "./factory/factory-tricrypto.js";
@@ -193,52 +194,52 @@ export class Curve {
193
194
  this.fetchNewFactoryPools = () => __awaiter(this, void 0, void 0, function* () {
194
195
  if (!("factory" in this.constants.ALIASES))
195
196
  return [];
196
- const currentPoolIds = Object.keys(this.constants.FACTORY_POOLS_DATA);
197
- const lastPoolIdx = currentPoolIds.length === 0 ? -1 : Number(currentPoolIds[currentPoolIds.length - 1].split("-")[2]);
198
- const poolData = lowerCasePoolDataAddresses(yield getFactoryPoolData.call(this, lastPoolIdx + 1));
197
+ const fromIdx = yield getLastFactoryPoolIndex.call(this, this.constants.ALIASES.factory);
198
+ const poolData = lowerCasePoolDataAddresses(yield getFactoryPoolData.call(this, fromIdx));
199
+ const newPoolIds = Object.keys(poolData).filter((id) => !(id in this.constants.FACTORY_POOLS_DATA));
199
200
  this.constants.FACTORY_POOLS_DATA = Object.assign(Object.assign({}, this.constants.FACTORY_POOLS_DATA), poolData);
200
201
  this._updateDecimalsAndGauges(this.constants.FACTORY_POOLS_DATA);
201
- return Object.keys(poolData);
202
+ return newPoolIds;
202
203
  });
203
204
  this.fetchNewCryptoFactoryPools = () => __awaiter(this, void 0, void 0, function* () {
204
205
  if (!("crypto_factory" in this.constants.ALIASES))
205
206
  return [];
206
- const currentPoolIds = Object.keys(this.constants.CRYPTO_FACTORY_POOLS_DATA);
207
- const lastPoolIdx = currentPoolIds.length === 0 ? -1 : Number(currentPoolIds[currentPoolIds.length - 1].split("-")[2]);
208
- const poolData = lowerCasePoolDataAddresses(yield getCryptoFactoryPoolData.call(this, lastPoolIdx + 1));
207
+ const fromIdx = yield getLastFactoryPoolIndex.call(this, this.constants.ALIASES.crypto_factory);
208
+ const poolData = lowerCasePoolDataAddresses(yield getCryptoFactoryPoolData.call(this, fromIdx));
209
+ const newPoolIds = Object.keys(poolData).filter((id) => !(id in this.constants.CRYPTO_FACTORY_POOLS_DATA));
209
210
  this.constants.CRYPTO_FACTORY_POOLS_DATA = Object.assign(Object.assign({}, this.constants.CRYPTO_FACTORY_POOLS_DATA), poolData);
210
211
  this._updateDecimalsAndGauges(this.constants.CRYPTO_FACTORY_POOLS_DATA);
211
- return Object.keys(poolData);
212
+ return newPoolIds;
212
213
  });
213
214
  this.fetchNewStableNgFactoryPools = () => __awaiter(this, void 0, void 0, function* () {
214
215
  if (!("stable_ng_factory" in this.constants.ALIASES))
215
216
  return [];
216
- const currentPoolIds = Object.keys(this.constants.STABLE_NG_FACTORY_POOLS_DATA);
217
- const lastPoolIdx = currentPoolIds.length === 0 ? -1 : Number(currentPoolIds[currentPoolIds.length - 1].split("-")[3]);
218
- const poolData = lowerCasePoolDataAddresses(yield getFactoryPoolData.call(this, lastPoolIdx + 1, undefined, this.constants.ALIASES.stable_ng_factory));
217
+ const fromIdx = yield getLastFactoryPoolIndex.call(this, this.constants.ALIASES.stable_ng_factory);
218
+ const poolData = lowerCasePoolDataAddresses(yield getFactoryPoolData.call(this, fromIdx, undefined, this.constants.ALIASES.stable_ng_factory));
219
+ const newPoolIds = Object.keys(poolData).filter((id) => !(id in this.constants.STABLE_NG_FACTORY_POOLS_DATA));
219
220
  this.constants.STABLE_NG_FACTORY_POOLS_DATA = Object.assign(Object.assign({}, this.constants.STABLE_NG_FACTORY_POOLS_DATA), poolData);
220
221
  this._updateDecimalsAndGauges(this.constants.STABLE_NG_FACTORY_POOLS_DATA);
221
- return Object.keys(poolData);
222
+ return newPoolIds;
222
223
  });
223
224
  this.fetchNewTwocryptoFactoryPools = () => __awaiter(this, void 0, void 0, function* () {
224
225
  if (!("twocrypto_factory" in this.constants.ALIASES))
225
226
  return [];
226
- const currentPoolIds = Object.keys(this.constants.TWOCRYPTO_FACTORY_POOLS_DATA);
227
- const lastPoolIdx = currentPoolIds.length === 0 ? -1 : Number(currentPoolIds[currentPoolIds.length - 1].split("-")[2]);
228
- const poolData = lowerCasePoolDataAddresses(yield getTwocryptoFactoryPoolData.call(this, lastPoolIdx + 1));
227
+ const fromIdx = yield getLastFactoryPoolIndex.call(this, this.constants.ALIASES.twocrypto_factory);
228
+ const poolData = lowerCasePoolDataAddresses(yield getTwocryptoFactoryPoolData.call(this, fromIdx));
229
+ const newPoolIds = Object.keys(poolData).filter((id) => !(id in this.constants.TWOCRYPTO_FACTORY_POOLS_DATA));
229
230
  this.constants.TWOCRYPTO_FACTORY_POOLS_DATA = Object.assign(Object.assign({}, this.constants.TWOCRYPTO_FACTORY_POOLS_DATA), poolData);
230
231
  this._updateDecimalsAndGauges(this.constants.TWOCRYPTO_FACTORY_POOLS_DATA);
231
- return Object.keys(poolData);
232
+ return newPoolIds;
232
233
  });
233
234
  this.fetchNewTricryptoFactoryPools = () => __awaiter(this, void 0, void 0, function* () {
234
235
  if (!("tricrypto_factory" in this.constants.ALIASES))
235
236
  return [];
236
- const currentPoolIds = Object.keys(this.constants.TRICRYPTO_FACTORY_POOLS_DATA);
237
- const lastPoolIdx = currentPoolIds.length === 0 ? -1 : Number(currentPoolIds[currentPoolIds.length - 1].split("-")[2]);
238
- const poolData = lowerCasePoolDataAddresses(yield getTricryptoFactoryPoolData.call(this, lastPoolIdx + 1));
237
+ const fromIdx = yield getLastFactoryPoolIndex.call(this, this.constants.ALIASES.tricrypto_factory);
238
+ const poolData = lowerCasePoolDataAddresses(yield getTricryptoFactoryPoolData.call(this, fromIdx));
239
+ const newPoolIds = Object.keys(poolData).filter((id) => !(id in this.constants.TRICRYPTO_FACTORY_POOLS_DATA));
239
240
  this.constants.TRICRYPTO_FACTORY_POOLS_DATA = Object.assign(Object.assign({}, this.constants.TRICRYPTO_FACTORY_POOLS_DATA), poolData);
240
241
  this._updateDecimalsAndGauges(this.constants.TRICRYPTO_FACTORY_POOLS_DATA);
241
- return Object.keys(poolData);
242
+ return newPoolIds;
242
243
  });
243
244
  this.fetchRecentlyDeployedFactoryPool = (poolAddress) => __awaiter(this, void 0, void 0, function* () {
244
245
  if (!("factory" in this.constants.ALIASES))
@@ -2,3 +2,4 @@ import { ICurve, IPoolDataShort } from "../interfaces";
2
2
  import { type Curve } from "../curve.js";
3
3
  export declare function setFactoryZapContracts(this: ICurve, isCrypto: boolean): void;
4
4
  export declare function getPoolIdByAddress(this: Curve, poolList: IPoolDataShort[], address: string): string;
5
+ export declare function getLastFactoryPoolIndex(this: Curve, factoryAddress: string): Promise<number>;
@@ -1,3 +1,12 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
1
10
  import { getPoolIdBySwapAddress } from "../utils.js";
2
11
  export function setFactoryZapContracts(isCrypto) {
3
12
  var _a;
@@ -20,3 +29,10 @@ export function getPoolIdByAddress(poolList, address) {
20
29
  return getPoolIdBySwapAddress.call(this, address.toLowerCase());
21
30
  }
22
31
  }
32
+ export function getLastFactoryPoolIndex(factoryAddress) {
33
+ return __awaiter(this, void 0, void 0, function* () {
34
+ const factoryContract = this.contracts[factoryAddress].contract;
35
+ const poolCount = Number(this.formatUnits(yield factoryContract.pool_count(this.constantOptions), 0));
36
+ return poolCount === 0 ? 0 : poolCount - 1;
37
+ });
38
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@curvefi/api",
3
- "version": "2.71.1",
3
+ "version": "2.71.2",
4
4
  "description": "JavaScript library for curve.finance",
5
5
  "main": "lib/index.js",
6
6
  "author": "Macket",