@curvefi/api 2.51.1 → 2.51.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.
@@ -371,39 +371,6 @@
371
371
  }
372
372
  ]
373
373
  },
374
- {
375
- "stateMutability": "nonpayable",
376
- "type": "function",
377
- "name": "exchange",
378
- "inputs": [
379
- {
380
- "name": "i",
381
- "type": "int128"
382
- },
383
- {
384
- "name": "j",
385
- "type": "int128"
386
- },
387
- {
388
- "name": "_dx",
389
- "type": "uint256"
390
- },
391
- {
392
- "name": "_min_dy",
393
- "type": "uint256"
394
- },
395
- {
396
- "name": "_receiver",
397
- "type": "address"
398
- }
399
- ],
400
- "outputs": [
401
- {
402
- "name": "",
403
- "type": "uint256"
404
- }
405
- ]
406
- },
407
374
  {
408
375
  "stateMutability": "nonpayable",
409
376
  "type": "function",
@@ -433,39 +400,6 @@
433
400
  }
434
401
  ]
435
402
  },
436
- {
437
- "stateMutability": "nonpayable",
438
- "type": "function",
439
- "name": "exchange_received",
440
- "inputs": [
441
- {
442
- "name": "i",
443
- "type": "int128"
444
- },
445
- {
446
- "name": "j",
447
- "type": "int128"
448
- },
449
- {
450
- "name": "_dx",
451
- "type": "uint256"
452
- },
453
- {
454
- "name": "_min_dy",
455
- "type": "uint256"
456
- },
457
- {
458
- "name": "_receiver",
459
- "type": "address"
460
- }
461
- ],
462
- "outputs": [
463
- {
464
- "name": "",
465
- "type": "uint256"
466
- }
467
- ]
468
- },
469
403
  {
470
404
  "stateMutability": "nonpayable",
471
405
  "type": "function",
@@ -554,35 +488,6 @@
554
488
  }
555
489
  ]
556
490
  },
557
- {
558
- "stateMutability": "nonpayable",
559
- "type": "function",
560
- "name": "remove_liquidity",
561
- "inputs": [
562
- {
563
- "name": "_burn_amount",
564
- "type": "uint256"
565
- },
566
- {
567
- "name": "_min_amounts",
568
- "type": "uint256[]"
569
- },
570
- {
571
- "name": "_receiver",
572
- "type": "address"
573
- },
574
- {
575
- "name": "_claim_admin_fees",
576
- "type": "bool"
577
- }
578
- ],
579
- "outputs": [
580
- {
581
- "name": "",
582
- "type": "uint256[]"
583
- }
584
- ]
585
- },
586
491
  {
587
492
  "stateMutability": "nonpayable",
588
493
  "type": "function",
@@ -1,2 +1,3 @@
1
- import { ICurve } from "../interfaces";
1
+ import { ICurve, IPoolDataShort } from "../interfaces";
2
2
  export declare function setFactoryZapContracts(this: ICurve, isCrypto: boolean): void;
3
+ export declare function getPoolIdByAddress(poolList: IPoolDataShort[], address: string): string;
@@ -1,5 +1,6 @@
1
1
  import { FACTORY_CONSTANTS } from "./constants.js";
2
2
  import { CRYPTO_FACTORY_CONSTANTS } from "./constants-crypto.js";
3
+ import { getPoolIdBySwapAddress } from "../utils.js";
3
4
  export function setFactoryZapContracts(isCrypto) {
4
5
  var basePoolIdZapDict = (isCrypto ? CRYPTO_FACTORY_CONSTANTS : FACTORY_CONSTANTS)[this.chainId].basePoolIdZapDict;
5
6
  for (var basePoolId in basePoolIdZapDict) {
@@ -11,3 +12,12 @@ export function setFactoryZapContracts(isCrypto) {
11
12
  this.setContract(basePool.address, basePool.ABI);
12
13
  }
13
14
  }
15
+ export function getPoolIdByAddress(poolList, address) {
16
+ var pool = poolList.find(function (item) { return item.address.toLowerCase() === address.toLowerCase(); });
17
+ if (pool) {
18
+ return pool.id;
19
+ }
20
+ else {
21
+ return getPoolIdBySwapAddress(address.toLowerCase());
22
+ }
23
+ }
@@ -12,19 +12,6 @@ export declare const implementationABIDictCelo: IDict<any>;
12
12
  export declare const implementationABIDictZkSync: IDict<any>;
13
13
  export declare const implementationABIDictBase: IDict<any>;
14
14
  export declare const implementationABIDictBsc: IDict<any>;
15
- export declare const implementationBasePoolIdDictEthereum: IDict<string>;
16
- export declare const implementationBasePoolIdDictPolygon: IDict<string>;
17
- export declare const implementationBasePoolIdDictFantom: IDict<string>;
18
- export declare const implementationBasePoolIdDictAvalanche: IDict<string>;
19
- export declare const implementationBasePoolIdDictArbitrum: IDict<string>;
20
- export declare const implementationBasePoolIdDictOptimism: IDict<string>;
21
- export declare const implementationBasePoolIdDictXDai: IDict<string>;
22
- export declare const implementationBasePoolIdDictMoonbeam: IDict<string>;
23
- export declare const implementationBasePoolIdDictKava: IDict<string>;
24
- export declare const implementationBasePoolIdDictCelo: IDict<string>;
25
- export declare const implementationBasePoolIdDictZkSync: IDict<string>;
26
- export declare const implementationBasePoolIdDictBase: IDict<string>;
27
- export declare const implementationBasePoolIdDictBsc: IDict<string>;
28
15
  export declare const basePoolIdZapDictEthereum: IDict<{
29
16
  address: string;
30
17
  ABI: any;
@@ -80,7 +67,6 @@ export declare const basePoolIdZapDictBsc: IDict<{
80
67
  export declare const FACTORY_CONSTANTS: {
81
68
  [index: number]: {
82
69
  implementationABIDict: IDict<any>;
83
- implementationBasePoolIdDict: IDict<string>;
84
70
  basePoolIdZapDict: IDict<{
85
71
  address: string;
86
72
  ABI: any;
@@ -27,7 +27,8 @@ import Plain6BasicABI from "../constants/abis/factory-v2/Plain6Basic.json" asser
27
27
  import Plain6BalancesABI from "../constants/abis/factory-v2/Plain6Balances.json" assert { type: 'json' };
28
28
  import Plain6ETHABI from "../constants/abis/factory-v2/Plain6ETH.json" assert { type: 'json' };
29
29
  import Plain6OptimizedABI from "../constants/abis/factory-v2/Plain6Optimized.json" assert { type: 'json' };
30
- import PlainStableswapNGABI from "../constants/abis/factory-stable-ng/plain-stableswap-ng.json" assert { type: 'json' };
30
+ import PlainStableSwapNGABI from "../constants/abis/factory-stable-ng/plain-stableswap-ng.json" assert { type: 'json' };
31
+ import MetaStableSwapNGABI from "../constants/abis/factory-stable-ng/meta-stableswap-ng.json" assert { type: 'json' };
31
32
  // --- ZAPS --
32
33
  import factoryDepositABI from "../constants/abis/factoryPools/deposit.json" assert { type: 'json' };
33
34
  import fraxusdcMetaZapABI from "../constants/abis/fraxusdc/meta_zap.json" assert { type: 'json' };
@@ -72,7 +73,11 @@ export var implementationABIDictEthereum = lowerCaseKeys({
72
73
  "0xd35B58386705CE75CE6d09842E38E9BE9CDe5bF6": Plain4BalancesABI,
73
74
  "0x88855cdF2b0A8413D470B86952E726684de915be": Plain4ETHABI,
74
75
  "0xaD4753D045D3Aed5C1a6606dFb6a7D7AD67C1Ad7": Plain4OptimizedABI,
75
- "0x3E3B5F27bbf5CC967E074b70E9f4046e31663181": PlainStableswapNGABI,
76
+ //"0x3E3B5F27bbf5CC967E074b70E9f4046e31663181": PlainStableSwapNGABI,
77
+ //"0x64afa95e0c3d8410240a4262df9fd82b12b64edd": MetaStableSwapNGABI,
78
+ //"0x1f7C86AffE5bCF7a1D74a8c8E2ef9E03BF31c1BD": MetaStableSwapNGABI,
79
+ "0x933f4769DCC27fC7345D9d5975AE48EC4D0F829C": PlainStableSwapNGABI,
80
+ "0xDD7EBB1C49780519dD9755B8B1A23a6f42CE099E": MetaStableSwapNGABI,
76
81
  });
77
82
  export var implementationABIDictPolygon = lowerCaseKeys({
78
83
  "0x4fb93D7d320E8A263F22f62C2059dFC2A8bCbC4c": MetaUSDABI,
@@ -91,7 +96,10 @@ export var implementationABIDictPolygon = lowerCaseKeys({
91
96
  "0xC7c46488566b9ef9B981b87E328939CaA5ca152f": Plain4BalancesABI,
92
97
  "0xf31bcdf0B9a5eCD7AB463eB905551fBc32e51856": Plain4ETHABI,
93
98
  "0xAc273d5b4FC06625d8b1abA3BE8De15bDFb8E39f": Plain4OptimizedABI,
94
- "0x506F594ceb4E33F5161139bAe3Ee911014df9f7f": PlainStableswapNGABI,
99
+ //"0x506F594ceb4E33F5161139bAe3Ee911014df9f7f": PlainStableSwapNGABI,
100
+ //"0x87FE17697D0f14A222e8bEf386a0860eCffDD617": MetaStableSwapNGABI,
101
+ "0xa7Ba18EeFcD9513230987eC2faB6711AF5AbD9c2": PlainStableSwapNGABI,
102
+ "0x7C2085419BE6a04f4ad88ea91bC9F5C6E6C463D8": MetaStableSwapNGABI,
95
103
  });
96
104
  export var implementationABIDictFantom = lowerCaseKeys({
97
105
  "0xfCE359115dFe1533a2458650123F86C454BC0213": MetaUSDABI,
@@ -117,7 +125,10 @@ export var implementationABIDictFantom = lowerCaseKeys({
117
125
  "0x2C996b11a73276787Eb637D4459d1A7fea16B310": Plain6BalancesABI,
118
126
  "0xa4Fc50E45aF5bF22b519468c7c342C704e1F3d44": Plain6ETHABI,
119
127
  "0x65e38C41CcE6D9Bc202209Cc546B2f63985D4139": Plain6OptimizedABI,
120
- "0xd2002373543Ce3527023C75e7518C274A51ce712": PlainStableswapNGABI,
128
+ //"0xd2002373543Ce3527023C75e7518C274A51ce712": PlainStableSwapNGABI,
129
+ //"0x686bdb3D24Bc6F3ED89ed3d3B659765c54aC78B4": MetaStableSwapNGABI,
130
+ "0xd7E72f3615aa65b92A4DBdC211E296a35512988B": PlainStableSwapNGABI,
131
+ "0xbC0797015fcFc47d9C1856639CaE50D0e69FbEE8": MetaStableSwapNGABI,
121
132
  });
122
133
  export var implementationABIDictAvalanche = lowerCaseKeys({
123
134
  "0xA237034249290De2B07988Ac64b96f22c0E76fE0": MetaUSDABI,
@@ -158,7 +169,10 @@ export var implementationABIDictArbitrum = lowerCaseKeys({
158
169
  "0x2ac56cEBc2D27c9bB51a11773355E44371Eb88D3": Plain4BalancesABI,
159
170
  "0x89287c32c2CAC1C76227F6d300B2DBbab6b75C08": Plain4ETHABI,
160
171
  "0x06e3C4da96fd076b97b7ca3Ae23527314b6140dF": Plain4OptimizedABI,
161
- "0x76303e4fDcA0AbF28aB3ee42Ce086E6503431F1D": PlainStableswapNGABI,
172
+ //"0x76303e4fDcA0AbF28aB3ee42Ce086E6503431F1D": PlainStableSwapNGABI,
173
+ //"0xd125E7a0cEddF89c6473412d85835450897be6Dc": MetaStableSwapNGABI,
174
+ "0x0458ea5f4cd00e873264be2031ceb8f9d9b3116c": PlainStableSwapNGABI,
175
+ "0xc6c09471ee39c7e30a067952fcc89c8922f9ab53": MetaStableSwapNGABI,
162
176
  });
163
177
  export var implementationABIDictOptimism = lowerCaseKeys({
164
178
  "0x78CF256256C8089d68Cde634Cf7cDEFb39286470": MetaUSDABI,
@@ -179,7 +193,10 @@ export var implementationABIDictOptimism = lowerCaseKeys({
179
193
  "0xF6bDc2619FFDA72c537Cd9605e0A274Dc48cB1C9": Plain4BalancesABI,
180
194
  "0x1AEf73d49Dedc4b1778d0706583995958Dc862e6": Plain4ETHABI,
181
195
  "0x8474DdbE98F5aA3179B3B3F5942D724aFcdec9f6": Plain4OptimizedABI,
182
- "0x87FE17697D0f14A222e8bEf386a0860eCffDD617": PlainStableswapNGABI,
196
+ //"0x87FE17697D0f14A222e8bEf386a0860eCffDD617": PlainStableSwapNGABI,
197
+ //"0x1764ee18e8B3ccA4787249Ceb249356192594585": MetaStableSwapNGABI,
198
+ "0x06452f9c013fc37169B57Eab8F50A7A48c9198A3": PlainStableSwapNGABI,
199
+ "0xd7E72f3615aa65b92A4DBdC211E296a35512988B": MetaStableSwapNGABI,
183
200
  });
184
201
  export var implementationABIDictXDai = lowerCaseKeys({
185
202
  "0x4A5bF7Ab9A8202692051c19B102d3eDD62aaBAE6": MetaUSDABI,
@@ -196,7 +213,10 @@ export var implementationABIDictXDai = lowerCaseKeys({
196
213
  "0xcB4eB43E31C830e22baF764c64F11F32C280496c": Plain4BalancesABI,
197
214
  "0xc1C49622b63B961ce1D352ecb7D8261Ab5556695": Plain4ETHABI,
198
215
  "0x0E2615ce69Cd3Dc3Ff6f66a975bEa0655F3bA7b9": Plain4OptimizedABI,
199
- "0xd2002373543Ce3527023C75e7518C274A51ce712": PlainStableswapNGABI,
216
+ //"0xd2002373543Ce3527023C75e7518C274A51ce712": PlainStableSwapNGABI,
217
+ //"0xd3B17f862956464ae4403cCF829CE69199856e1e": MetaStableSwapNGABI,
218
+ "0xc9Fe0C63Af9A39402e8a5514f9c43Af0322b665F": PlainStableSwapNGABI,
219
+ "0x166c4084Ad2434E8F2425C64dabFE6875A0D45c5": MetaStableSwapNGABI,
200
220
  });
201
221
  export var implementationABIDictMoonbeam = lowerCaseKeys({
202
222
  "0x6842E0412AC1c00464dc48961330156a07268d14": Plain2BasicABI,
@@ -225,7 +245,10 @@ export var implementationABIDictKava = lowerCaseKeys({
225
245
  "0xd59c875dccb6cdcb3a75b91b58a363b5e4b0ca9a": Plain4BalancesABI,
226
246
  "0x6378dd741b24bd884f3590d7bc7555fdb2f5b003": Plain4ETHABI,
227
247
  "0x509495dfeec3a53acb2f60669985d868131ad9a5": Plain4OptimizedABI,
228
- "0x1764ee18e8B3ccA4787249Ceb249356192594585": PlainStableswapNGABI,
248
+ //"0x1764ee18e8B3ccA4787249Ceb249356192594585": PlainStableSwapNGABI,
249
+ //"0x87FE17697D0f14A222e8bEf386a0860eCffDD617": MetaStableSwapNGABI,
250
+ "0xa7Ba18EeFcD9513230987eC2faB6711AF5AbD9c2": PlainStableSwapNGABI,
251
+ "0x7C2085419BE6a04f4ad88ea91bC9F5C6E6C463D8": MetaStableSwapNGABI,
229
252
  });
230
253
  export var implementationABIDictCelo = lowerCaseKeys({
231
254
  "0xfEE7166C32Bdf6356Ef60636f43400AA55551A96": Plain2BasicABI,
@@ -240,7 +263,10 @@ export var implementationABIDictCelo = lowerCaseKeys({
240
263
  "0x3730D8B82BF3fF6Cc6dFDBe2Fd7B2A655e74eAae": Plain4BalancesABI,
241
264
  "0x0F5390AB4C5456a769056C96E4D7C71770b52319": Plain4ETHABI,
242
265
  "0xA73b02a97B45604cd9f0BBAA153eCfe01f409350": Plain4OptimizedABI,
243
- "0x506F594ceb4E33F5161139bAe3Ee911014df9f7f": PlainStableswapNGABI,
266
+ //"0x506F594ceb4E33F5161139bAe3Ee911014df9f7f": PlainStableSwapNGABI,
267
+ //"0x87FE17697D0f14A222e8bEf386a0860eCffDD617": MetaStableSwapNGABI,
268
+ "0xa7Ba18EeFcD9513230987eC2faB6711AF5AbD9c2": PlainStableSwapNGABI,
269
+ "0x7C2085419BE6a04f4ad88ea91bC9F5C6E6C463D8": MetaStableSwapNGABI,
244
270
  });
245
271
  export var implementationABIDictZkSync = lowerCaseKeys({
246
272
  "0x7c2a205C52361410233540008f7095dEF5915843": Plain2BasicABI,
@@ -269,7 +295,10 @@ export var implementationABIDictBase = lowerCaseKeys({
269
295
  "0x2FdDeDF2D842f23da2B81b9144e75cEcb691Bf19": Plain4BalancesABI,
270
296
  "0x50E09Ee7080b32aef3e92346891dD2DD389B5fAf": Plain4ETHABI,
271
297
  "0x44d9B3f4EE15AC81FEb918501fca0ddc9d83C976": Plain4OptimizedABI,
272
- "0x1764ee18e8B3ccA4787249Ceb249356192594585": PlainStableswapNGABI,
298
+ //"0x1764ee18e8B3ccA4787249Ceb249356192594585": PlainStableSwapNGABI,
299
+ //"0x5eee3091f747e60a045a2e715a4c71e600e31f6e": MetaStableSwapNGABI,
300
+ "0x604388Bb1159AFd21eB5191cE22b4DeCdEE2Ae22": PlainStableSwapNGABI,
301
+ "0x06452f9c013fc37169B57Eab8F50A7A48c9198A3": MetaStableSwapNGABI,
273
302
  });
274
303
  export var implementationABIDictBsc = lowerCaseKeys({
275
304
  "0xB90B9B1F91a01Ea22A182CD84C1E22222e39B415": Plain2BasicABI,
@@ -284,67 +313,11 @@ export var implementationABIDictBsc = lowerCaseKeys({
284
313
  "0x0Cc51c9786f3777a6d50961CEBb2BB6E69ec5e07": Plain4BalancesABI,
285
314
  "0x0a31527a8dE2Ee97BBD8cCE14Db8E8826a0b6C4f": Plain4ETHABI,
286
315
  "0x1086F023146f9026A9Bb22983CE866813C59518A": Plain4OptimizedABI,
287
- "0x604388Bb1159AFd21eB5191cE22b4DeCdEE2Ae22": PlainStableswapNGABI,
316
+ //"0x604388Bb1159AFd21eB5191cE22b4DeCdEE2Ae22": PlainStableSwapNGABI,
317
+ //"0x06452f9c013fc37169B57Eab8F50A7A48c9198A3": MetaStableSwapNGABI,
318
+ "0x64379C265Fc6595065D7d835AAaa731c0584dB80": PlainStableSwapNGABI,
319
+ "0xd3B17f862956464ae4403cCF829CE69199856e1e": MetaStableSwapNGABI,
288
320
  });
289
- export var implementationBasePoolIdDictEthereum = lowerCaseKeys({
290
- "0x5F890841f657d90E081bAbdB532A05996Af79Fe6": "3pool",
291
- "0x213be373FDff327658139C7df330817DAD2d5bBE": "3pool",
292
- "0x55Aa9BF126bCABF0bDC17Fa9E39Ec9239e1ce7A9": "3pool",
293
- "0x33bB0e62d5e8C688E645Dd46DFb48Cd613250067": "fraxusdc",
294
- "0x2EB24483Ef551dA247ab87Cf18e1Cc980073032D": "fraxusdc",
295
- "0xF9B62b61d108232Ef0C9DD143bb3c22c7D4A715a": "fraxusdp",
296
- "0xB172AC2Fe440B5dA74Dc460e5E9d96bc2BF6261F": "fraxusdp",
297
- "0xC6A8466d128Fbfd34AdA64a9FFFce325D57C9a52": "sbtc",
298
- "0xc4C78b08fA0c3d0a312605634461A88184Ecd630": "sbtc",
299
- "0xECAaecd9d2193900b424774133B1f51ae0F29d9E": "ren",
300
- "0x40fD58D44cFE63E8517c9Bb3ac98676838Ea56A8": "ren",
301
- "0x008CFa89df5B0c780cA3462fc2602D7F8c7Ac315": "sbtc2",
302
- "0xAbc533EbCDdeD41215C46ee078C5818B5b0A252F": "sbtc2",
303
- });
304
- export var implementationBasePoolIdDictPolygon = lowerCaseKeys({
305
- "0x4fb93D7d320E8A263F22f62C2059dFC2A8bCbC4c": "aave",
306
- "0x39fE1824f98CD828050D7c51dA443E84121c7cf1": "aave",
307
- "0xC05EB760A135d3D0c839f1141423002681157a17": "ren",
308
- "0xD8336532f6ED7b94282fAF724fe41d6145E07Cfc": "ren",
309
- });
310
- export var implementationBasePoolIdDictFantom = lowerCaseKeys({
311
- "0xfCE359115dFe1533a2458650123F86C454BC0213": "2pool",
312
- "0x09C62ad0694e3f1ad8cF8876aaBe56138C586f5F": "2pool",
313
- "0xC9438d8928486bD9621D326002F4672bF684187A": "ren",
314
- "0x2b70A5B878665FfDB4A06Ba40a264d6c70f68F4B": "ren",
315
- "0x210C806F6AE850279f7E298dE749EC4B427d00DD": "geist",
316
- "0xf82162bB68aD5a168345bb7EFb2faA0EDCCA5177": "geist",
317
- });
318
- export var implementationBasePoolIdDictAvalanche = lowerCaseKeys({
319
- "0xA237034249290De2B07988Ac64b96f22c0E76fE0": "aave",
320
- "0xc50C05Ca1f8C2346664bd0d4a1eb6aC1Da38414f": "aave",
321
- "0xa27f39E9C21b3376F43266E13Ad5A5d6E9BdB320": "ren",
322
- "0x505C34ED8dBE96d2D5C7D83158aA844887770970": "ren",
323
- });
324
- export var implementationBasePoolIdDictArbitrum = lowerCaseKeys({
325
- "0x09672362833d8f703D5395ef3252D4Bfa51c15ca": "2pool",
326
- "0xBE175115BF33E12348ff77CcfEE4726866A0Fbd5": "2pool",
327
- "0x094d12e5b541784701FD8d65F11fc0598FBC6332": "ren",
328
- "0xF1f85a74AD6c64315F85af52d3d46bF715236ADc": "ren",
329
- "0x8DEb66a4A40E370355bEe35f12E55Fe9c755d686": "factory-v2-41",
330
- "0x3edE9b145F82e9e46C03f8A8F67B77aEE847b632": "factory-v2-41", // fraxbp
331
- });
332
- export var implementationBasePoolIdDictOptimism = lowerCaseKeys({
333
- "0x78CF256256C8089d68Cde634Cf7cDEFb39286470": "3pool",
334
- "0xADf698e4d8Df08b3E2c79682891636eF00F6e205": "3pool",
335
- "0xe8269B33E47761f552E1a3070119560d5fa8bBD6": "factory-v2-16",
336
- "0x114C4042B11a2b16F58Fe1BFe847589a122F678a": "factory-v2-16", // fraxusdc
337
- });
338
- export var implementationBasePoolIdDictXDai = lowerCaseKeys({
339
- "0x4A5bF7Ab9A8202692051c19B102d3eDD62aaBAE6": "3pool",
340
- "0x0B4dc7A945695D11FD83e40B2DfC2B896A02395F": "3pool",
341
- });
342
- export var implementationBasePoolIdDictMoonbeam = lowerCaseKeys({});
343
- export var implementationBasePoolIdDictKava = lowerCaseKeys({});
344
- export var implementationBasePoolIdDictCelo = lowerCaseKeys({});
345
- export var implementationBasePoolIdDictZkSync = lowerCaseKeys({});
346
- export var implementationBasePoolIdDictBase = lowerCaseKeys({});
347
- export var implementationBasePoolIdDictBsc = lowerCaseKeys({});
348
321
  export var basePoolIdZapDictEthereum = {
349
322
  '3pool': {
350
323
  address: "0xA79828DF1850E8a3A3064576f380D90aECDD3359".toLowerCase(),
@@ -444,67 +417,54 @@ export var basePoolIdZapDictBsc = {};
444
417
  export var FACTORY_CONSTANTS = {
445
418
  1: {
446
419
  implementationABIDict: implementationABIDictEthereum,
447
- implementationBasePoolIdDict: implementationBasePoolIdDictEthereum,
448
420
  basePoolIdZapDict: basePoolIdZapDictEthereum,
449
421
  },
450
422
  10: {
451
423
  implementationABIDict: implementationABIDictOptimism,
452
- implementationBasePoolIdDict: implementationBasePoolIdDictOptimism,
453
424
  basePoolIdZapDict: basePoolIdZapDictOptimism,
454
425
  },
455
426
  56: {
456
427
  implementationABIDict: implementationABIDictBsc,
457
- implementationBasePoolIdDict: implementationBasePoolIdDictBsc,
458
428
  basePoolIdZapDict: basePoolIdZapDictBsc,
459
429
  },
460
430
  100: {
461
431
  implementationABIDict: implementationABIDictXDai,
462
- implementationBasePoolIdDict: implementationBasePoolIdDictXDai,
463
432
  basePoolIdZapDict: basePoolIdZapDictXDai,
464
433
  },
465
434
  137: {
466
435
  implementationABIDict: implementationABIDictPolygon,
467
- implementationBasePoolIdDict: implementationBasePoolIdDictPolygon,
468
436
  basePoolIdZapDict: basePoolIdZapDictPolygon,
469
437
  },
470
438
  250: {
471
439
  implementationABIDict: implementationABIDictFantom,
472
- implementationBasePoolIdDict: implementationBasePoolIdDictFantom,
473
440
  basePoolIdZapDict: basePoolIdZapDictFantom,
474
441
  },
475
442
  324: {
476
443
  implementationABIDict: implementationABIDictZkSync,
477
- implementationBasePoolIdDict: implementationBasePoolIdDictZkSync,
478
444
  basePoolIdZapDict: basePoolIdZapDictZkSync,
479
445
  },
480
446
  1284: {
481
447
  implementationABIDict: implementationABIDictMoonbeam,
482
- implementationBasePoolIdDict: implementationBasePoolIdDictMoonbeam,
483
448
  basePoolIdZapDict: basePoolIdZapDictMoonbeam,
484
449
  },
485
450
  2222: {
486
451
  implementationABIDict: implementationABIDictKava,
487
- implementationBasePoolIdDict: implementationBasePoolIdDictKava,
488
452
  basePoolIdZapDict: basePoolIdZapDictKava,
489
453
  },
490
454
  8453: {
491
455
  implementationABIDict: implementationABIDictBase,
492
- implementationBasePoolIdDict: implementationBasePoolIdDictBase,
493
456
  basePoolIdZapDict: basePoolIdZapDictBase,
494
457
  },
495
458
  42220: {
496
459
  implementationABIDict: implementationABIDictCelo,
497
- implementationBasePoolIdDict: implementationBasePoolIdDictCelo,
498
460
  basePoolIdZapDict: basePoolIdZapDictCelo,
499
461
  },
500
462
  43114: {
501
463
  implementationABIDict: implementationABIDictAvalanche,
502
- implementationBasePoolIdDict: implementationBasePoolIdDictAvalanche,
503
464
  basePoolIdZapDict: basePoolIdZapDictAvalanche,
504
465
  },
505
466
  42161: {
506
467
  implementationABIDict: implementationABIDictArbitrum,
507
- implementationBasePoolIdDict: implementationBasePoolIdDictArbitrum,
508
468
  basePoolIdZapDict: basePoolIdZapDictArbitrum,
509
469
  },
510
470
  };
@@ -62,7 +62,7 @@ import cryptoFactorySwapABI from "../constants/abis/factory-crypto/factory-crypt
62
62
  import tricryptoFactorySwapABI from "../constants/abis/factory-tricrypto/factory-tricrypto-pool.json" assert { type: 'json' };
63
63
  import { FACTORY_CONSTANTS } from "./constants.js";
64
64
  import { CRYPTO_FACTORY_CONSTANTS } from "./constants-crypto.js";
65
- import { setFactoryZapContracts } from "./common.js";
65
+ import { getPoolIdByAddress, setFactoryZapContracts } from "./common.js";
66
66
  import { _getPoolsFromApi } from "../external-api.js";
67
67
  import { assetTypeNameHandler, getPoolName } from "../utils.js";
68
68
  export var lowerCasePoolDataAddresses = function (poolsData) {
@@ -158,6 +158,7 @@ export function getFactoryPoolsDataFromApi(factoryType) {
158
158
  setFactoryZapContracts.call(this, isCrypto);
159
159
  FACTORY_POOLS_DATA = {};
160
160
  rawPoolList.forEach(function (pool) {
161
+ var _a, _b, _c;
161
162
  var nativeToken = _this.constants.NATIVE_TOKEN;
162
163
  var coinAddresses = pool.coins.map(function (c) { return c.address; });
163
164
  if (_this.chainId === 137) {
@@ -228,22 +229,14 @@ export function getFactoryPoolsDataFromApi(factoryType) {
228
229
  };
229
230
  }
230
231
  }
231
- else if (pool.implementation.includes("meta")) {
232
+ else if (pool.isMetaPool) {
232
233
  var implementationABIDict = FACTORY_CONSTANTS[_this.chainId].implementationABIDict;
233
- var implementationBasePoolIdDict = FACTORY_CONSTANTS[_this.chainId].implementationBasePoolIdDict;
234
- var basePoolIds = Object.values(implementationBasePoolIdDict).filter(function (poolId, i, arr) { return arr.indexOf(poolId) === i; });
235
- var allPoolsData_1 = __assign(__assign({}, _this.constants.POOLS_DATA), FACTORY_POOLS_DATA);
236
- // @ts-ignore
237
- var basePoolIdCoinsDict = Object.fromEntries(basePoolIds.map(function (poolId) { var _a; return [poolId, (_a = allPoolsData_1[poolId]) === null || _a === void 0 ? void 0 : _a.underlying_coins]; }));
238
- // @ts-ignore
239
- var basePoolIdCoinAddressesDict = Object.fromEntries(basePoolIds.map(function (poolId) { var _a; return [poolId, (_a = allPoolsData_1[poolId]) === null || _a === void 0 ? void 0 : _a.underlying_coin_addresses]; }));
240
- // @ts-ignore
241
- var basePoolIdDecimalsDict = Object.fromEntries(basePoolIds.map(function (poolId) { var _a; return [poolId, (_a = allPoolsData_1[poolId]) === null || _a === void 0 ? void 0 : _a.underlying_decimals]; }));
234
+ var allPoolsData = __assign(__assign({}, _this.constants.POOLS_DATA), FACTORY_POOLS_DATA);
235
+ var basePoolId = getPoolIdByAddress(rawPoolList, pool.basePoolAddress);
236
+ var basePoolCoinNames = (_a = allPoolsData[basePoolId]) === null || _a === void 0 ? void 0 : _a.underlying_coins;
237
+ var basePoolCoinAddresses = (_b = allPoolsData[basePoolId]) === null || _b === void 0 ? void 0 : _b.underlying_coin_addresses;
238
+ var basePoolDecimals = (_c = allPoolsData[basePoolId]) === null || _c === void 0 ? void 0 : _c.underlying_decimals;
242
239
  var basePoolIdZapDict = FACTORY_CONSTANTS[_this.chainId].basePoolIdZapDict;
243
- var basePoolId = implementationBasePoolIdDict[pool.implementationAddress];
244
- var basePoolCoinNames = basePoolIdCoinsDict[basePoolId];
245
- var basePoolCoinAddresses = basePoolIdCoinAddressesDict[basePoolId];
246
- var basePoolDecimals = basePoolIdDecimalsDict[basePoolId];
247
240
  var basePoolZap = basePoolIdZapDict[basePoolId];
248
241
  FACTORY_POOLS_DATA[pool.id] = {
249
242
  name: getPoolName(pool.name),
@@ -1,5 +1,6 @@
1
- import { IDict, IPoolData, ICurve } from "../interfaces";
1
+ import { IDict, IPoolData, ICurve, IPoolDataShort } from "../interfaces";
2
2
  export declare const BLACK_LIST: {
3
3
  [index: number]: any;
4
4
  };
5
+ export declare function getBasePoolIds(this: ICurve, factoryAddress: string, rawSwapAddresses: string[], tmpPools: IPoolDataShort[]): Promise<Array<string>>;
5
6
  export declare function getFactoryPoolData(this: ICurve, fromIdx?: number, swapAddress?: string, factoryAddress?: string): Promise<IDict<IPoolData>>;
@@ -59,7 +59,7 @@ import { curve } from "../curve.js";
59
59
  import ERC20ABI from "../constants/abis/ERC20.json" assert { type: 'json' };
60
60
  import factoryGaugeABI from "../constants/abis/gauge_factory.json" assert { type: 'json' };
61
61
  import gaugeChildABI from "../constants/abis/gauge_child.json" assert { type: 'json' };
62
- import { setFactoryZapContracts } from "./common.js";
62
+ import { getPoolIdByAddress, setFactoryZapContracts } from "./common.js";
63
63
  import { FACTORY_CONSTANTS } from "./constants.js";
64
64
  import { getPoolName } from "../utils.js";
65
65
  export var BLACK_LIST = {
@@ -77,6 +77,35 @@ export var BLACK_LIST = {
77
77
  ],
78
78
  };
79
79
  var deepFlatten = function (arr) { return [].concat.apply([], arr.map(function (v) { return (Array.isArray(v) ? deepFlatten(v) : v); })); };
80
+ export function getBasePoolIds(factoryAddress, rawSwapAddresses, tmpPools) {
81
+ return __awaiter(this, void 0, void 0, function () {
82
+ var factoryMulticallContract, calls, _i, rawSwapAddresses_1, addr, result, basePoolIds;
83
+ return __generator(this, function (_a) {
84
+ switch (_a.label) {
85
+ case 0:
86
+ factoryMulticallContract = this.contracts[factoryAddress].multicallContract;
87
+ calls = [];
88
+ for (_i = 0, rawSwapAddresses_1 = rawSwapAddresses; _i < rawSwapAddresses_1.length; _i++) {
89
+ addr = rawSwapAddresses_1[_i];
90
+ calls.push(factoryMulticallContract.get_base_pool(addr));
91
+ }
92
+ return [4 /*yield*/, this.multicallProvider.all(calls)];
93
+ case 1:
94
+ result = _a.sent();
95
+ basePoolIds = [];
96
+ result.forEach(function (item) {
97
+ if (item !== '0x0000000000000000000000000000000000000000') {
98
+ basePoolIds.push(getPoolIdByAddress(tmpPools, item));
99
+ }
100
+ else {
101
+ basePoolIds.push('');
102
+ }
103
+ });
104
+ return [2 /*return*/, basePoolIds];
105
+ }
106
+ });
107
+ });
108
+ }
80
109
  function getRecentlyCreatedPoolId(swapAddress) {
81
110
  return __awaiter(this, void 0, void 0, function () {
82
111
  var factoryContract, poolCount, _a, _b, _c, i, address;
@@ -159,7 +188,7 @@ function _handleCoinAddresses(coinAddresses) {
159
188
  }
160
189
  function getPoolsData(factorySwapAddresses, factoryAddress) {
161
190
  return __awaiter(this, void 0, void 0, function () {
162
- var factoryMulticallContract, isFactoryGaugeNull, isStableNgFactory, factoryGaugeContract, calls, _i, factorySwapAddresses_1, addr, tempSwapContract, res, implememntationAddresses, gaugeAddresses, referenceAssets, symbols, names, isMeta, coinAddresses;
191
+ var factoryMulticallContract, isFactoryGaugeNull, isStableNgFactory, factoryGaugeContract, calls, _i, factorySwapAddresses_1, addr, tempSwapContract, res, index, index, implememntationAddresses, gaugeAddresses, referenceAssets, symbols, names, isMeta, coinAddresses;
163
192
  return __generator(this, function (_a) {
164
193
  switch (_a.label) {
165
194
  case 0:
@@ -190,18 +219,18 @@ function getPoolsData(factorySwapAddresses, factoryAddress) {
190
219
  case 1:
191
220
  res = _a.sent();
192
221
  if (isFactoryGaugeNull) {
193
- res.forEach(function (item, index) {
222
+ for (index = 0; index < res.length; index++) {
194
223
  if (index % 7 == 1) {
195
224
  res.splice(index, 0, '0x0000000000000000000000000000000000000000');
196
225
  }
197
- });
226
+ }
198
227
  }
199
228
  if (isStableNgFactory) {
200
- res.forEach(function (item, index) {
229
+ for (index = 0; index < res.length; index++) {
201
230
  if (index % 7 == 2) {
202
231
  res.splice(index, 0, -1);
203
232
  }
204
- });
233
+ }
205
234
  }
206
235
  implememntationAddresses = res.filter(function (a, i) { return i % 7 == 0; }).map(function (a) { return a.toLowerCase(); });
207
236
  gaugeAddresses = res.filter(function (a, i) { return i % 7 == 1; }).map(function (a) { return a.toLowerCase(); });
@@ -301,7 +330,7 @@ export function getFactoryPoolData(fromIdx, swapAddress, factoryAddress) {
301
330
  if (fromIdx === void 0) { fromIdx = 0; }
302
331
  if (factoryAddress === void 0) { factoryAddress = curve.constants.ALIASES.factory; }
303
332
  return __awaiter(this, void 0, void 0, function () {
304
- var _a, rawPoolIds, rawSwapAddresses, _b, _c, rawImplementations, rawGauges, rawReferenceAssets, rawPoolSymbols, rawPoolNames, rawIsMeta, rawCoinAddresses, poolIds, swapAddresses, implementations, gaugeAddresses, referenceAssets, poolSymbols, poolNames, isMeta, coinAddresses, implementationABIDict, i, swapABIs, _e, coinAddressNameDict, coinAddressDecimalsDict, implementationBasePoolIdDict, basePoolIds, FACTORY_POOLS_DATA, _loop_2, this_1, i;
333
+ var _a, rawPoolIds, rawSwapAddresses, _b, _c, rawImplementations, rawGauges, rawReferenceAssets, rawPoolSymbols, rawPoolNames, rawIsMeta, rawCoinAddresses, poolIds, swapAddresses, implementations, gaugeAddresses, referenceAssets, poolSymbols, poolNames, isMeta, coinAddresses, implementationABIDict, i, swapABIs, _e, coinAddressNameDict, coinAddressDecimalsDict, tmpPools, basePoolIds, FACTORY_POOLS_DATA, _loop_2, this_1, i;
305
334
  return __generator(this, function (_f) {
306
335
  switch (_f.label) {
307
336
  case 0:
@@ -352,8 +381,16 @@ export function getFactoryPoolData(fromIdx, swapAddress, factoryAddress) {
352
381
  return [4 /*yield*/, getCoinsData.call(this, coinAddresses, getExistingCoinAddressNameDict.call(this), this.constants.DECIMALS)];
353
382
  case 6:
354
383
  _e = _f.sent(), coinAddressNameDict = _e[0], coinAddressDecimalsDict = _e[1];
355
- implementationBasePoolIdDict = FACTORY_CONSTANTS[this.chainId].implementationBasePoolIdDict;
356
- basePoolIds = implementations.map(function (addr) { return implementationBasePoolIdDict[addr]; });
384
+ tmpPools = [];
385
+ poolIds.forEach(function (item, index) {
386
+ tmpPools.push({
387
+ id: item,
388
+ address: swapAddresses[index],
389
+ });
390
+ });
391
+ return [4 /*yield*/, getBasePoolIds.call(this, factoryAddress, swapAddresses, tmpPools)];
392
+ case 7:
393
+ basePoolIds = _f.sent();
357
394
  FACTORY_POOLS_DATA = {};
358
395
  _loop_2 = function (i) {
359
396
  if (!isMeta[i]) {
@@ -118,6 +118,8 @@ export interface IPoolDataFromApi {
118
118
  symbol: string;
119
119
  assetTypeName: string;
120
120
  address: string;
121
+ isMetaPool: boolean;
122
+ basePoolAddress?: string;
121
123
  lpTokenAddress?: string;
122
124
  gaugeAddress?: string;
123
125
  implementation: string;
@@ -129,6 +131,10 @@ export interface IPoolDataFromApi {
129
131
  amplificationCoefficient: string;
130
132
  gaugeCrvApy: [number | null, number | null];
131
133
  }
134
+ export interface IPoolDataShort {
135
+ id: string;
136
+ address: string;
137
+ }
132
138
  export interface ISubgraphPoolData {
133
139
  address: string;
134
140
  volumeUSD: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@curvefi/api",
3
- "version": "2.51.1",
3
+ "version": "2.51.3",
4
4
  "description": "JavaScript library for curve.fi",
5
5
  "main": "lib/index.js",
6
6
  "author": "Macket",