@curvefi/api 2.69.9 → 2.69.10
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/lib/constants/chainIds.d.ts +0 -1
- package/lib/constants/chainIds.js +0 -1
- package/lib/constants/coins/index.d.ts +1 -10
- package/lib/constants/coins/index.js +1 -10
- package/lib/constants/factory/crypto.d.ts +0 -45
- package/lib/constants/factory/crypto.js +0 -72
- package/lib/constants/factory/stable.d.ts +0 -9
- package/lib/constants/factory/stable.js +0 -119
- package/lib/constants/network_constants.js +2 -258
- package/lib/constants/pools/index.d.ts +1 -10
- package/lib/constants/pools/index.js +1 -10
- package/lib/constants/rewardNetworks.js +1 -1
- package/lib/constants/volumeNetworks.d.ts +0 -2
- package/lib/constants/volumeNetworks.js +1 -3
- package/lib/curve.js +1 -4
- package/lib/external-api.d.ts +0 -2
- package/lib/external-api.js +0 -41
- package/lib/pools/PoolTemplate.js +0 -2
- package/lib/pools/subClasses/statsPool.js +2 -2
- package/lib/pools/utils.js +2 -7
- package/lib/route-graph.worker.js +2 -3
- package/lib/utils.js +3 -55
- package/package.json +1 -1
- package/lib/constants/abis/avaxcrypto/swap.json +0 -1195
- package/lib/constants/abis/avaxcrypto/zap.json +0 -250
- package/lib/constants/abis/factory-v2/MetaUSDGeist.json +0 -932
- package/lib/constants/coins/aurora.d.ts +0 -3
- package/lib/constants/coins/aurora.js +0 -9
- package/lib/constants/coins/avalanche.d.ts +0 -4
- package/lib/constants/coins/avalanche.js +0 -34
- package/lib/constants/coins/celo.d.ts +0 -3
- package/lib/constants/coins/celo.js +0 -9
- package/lib/constants/coins/kava.d.ts +0 -3
- package/lib/constants/coins/kava.js +0 -9
- package/lib/constants/coins/mantle.d.ts +0 -2
- package/lib/constants/coins/mantle.js +0 -5
- package/lib/constants/coins/moonbeam.d.ts +0 -3
- package/lib/constants/coins/moonbeam.js +0 -9
- package/lib/constants/coins/sonic.d.ts +0 -2
- package/lib/constants/coins/sonic.js +0 -5
- package/lib/constants/coins/xlayer.d.ts +0 -2
- package/lib/constants/coins/xlayer.js +0 -5
- package/lib/constants/coins/zksync.d.ts +0 -2
- package/lib/constants/coins/zksync.js +0 -6
- package/lib/constants/pools/aurora.d.ts +0 -2
- package/lib/constants/pools/aurora.js +0 -31
- package/lib/constants/pools/avalanche.d.ts +0 -2
- package/lib/constants/pools/avalanche.js +0 -166
- package/lib/constants/pools/celo.d.ts +0 -2
- package/lib/constants/pools/celo.js +0 -2
- package/lib/constants/pools/kava.d.ts +0 -2
- package/lib/constants/pools/kava.js +0 -2
- package/lib/constants/pools/mantle.d.ts +0 -2
- package/lib/constants/pools/mantle.js +0 -2
- package/lib/constants/pools/moonbeam.d.ts +0 -2
- package/lib/constants/pools/moonbeam.js +0 -31
- package/lib/constants/pools/sonic.d.ts +0 -2
- package/lib/constants/pools/sonic.js +0 -2
- package/lib/constants/pools/xlayer.d.ts +0 -2
- package/lib/constants/pools/xlayer.js +0 -2
- package/lib/constants/pools/zksync.d.ts +0 -2
- package/lib/constants/pools/zksync.js +0 -2
package/lib/utils.js
CHANGED
|
@@ -10,7 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
import { Contract, ethers } from 'ethers';
|
|
11
11
|
import { Contract as MulticallContract } from "@curvefi/ethcall";
|
|
12
12
|
import BigNumber from 'bignumber.js';
|
|
13
|
-
import { _getCurveLiteNetworks,
|
|
13
|
+
import { _getCurveLiteNetworks, _getLiteNetworksData, _getVolumes, } from "./external-api.js";
|
|
14
14
|
import { _getAllPoolsFromApi, _getUsdPricesFromApi } from "./cached.js";
|
|
15
15
|
import ERC20Abi from './constants/abis/ERC20.json' with { type: 'json' };
|
|
16
16
|
import { L2Networks } from './constants/L2Networks.js';
|
|
@@ -354,19 +354,10 @@ export function _getUsdRate(assetId) {
|
|
|
354
354
|
56: "binance-smart-chain",
|
|
355
355
|
100: 'xdai',
|
|
356
356
|
137: 'polygon-pos',
|
|
357
|
-
146: 'sonic',
|
|
358
|
-
196: 'x-layer',
|
|
359
357
|
252: 'fraxtal',
|
|
360
|
-
324: 'zksync',
|
|
361
358
|
999: 'hyperliquid',
|
|
362
|
-
1284: 'moonbeam',
|
|
363
|
-
2222: 'kava',
|
|
364
|
-
5000: 'mantle',
|
|
365
359
|
8453: 'base',
|
|
366
|
-
42220: 'celo',
|
|
367
|
-
43114: 'avalanche',
|
|
368
360
|
42161: 'arbitrum-one',
|
|
369
|
-
1313161554: 'aurora',
|
|
370
361
|
}[this.chainId];
|
|
371
362
|
const nativeTokenName = this.isLiteChain ? (_b = (_a = this.constants) === null || _a === void 0 ? void 0 : _a.API_CONSTANTS) === null || _b === void 0 ? void 0 : _b.nativeTokenName : {
|
|
372
363
|
1: 'ethereum',
|
|
@@ -374,19 +365,10 @@ export function _getUsdRate(assetId) {
|
|
|
374
365
|
56: 'binancecoin',
|
|
375
366
|
100: 'xdai',
|
|
376
367
|
137: 'matic-network',
|
|
377
|
-
146: 'sonic-3',
|
|
378
|
-
196: 'okb',
|
|
379
368
|
252: 'frax-share',
|
|
380
|
-
324: 'ethereum',
|
|
381
|
-
1284: 'moonbeam',
|
|
382
369
|
999: 'hyperliquid',
|
|
383
|
-
2222: 'kava',
|
|
384
|
-
5000: 'mantle',
|
|
385
370
|
8453: 'ethereum',
|
|
386
|
-
42220: 'celo',
|
|
387
|
-
43114: 'avalanche-2',
|
|
388
371
|
42161: 'ethereum',
|
|
389
|
-
1313161554: 'ethereum',
|
|
390
372
|
}[this.chainId];
|
|
391
373
|
if (chainName === undefined) {
|
|
392
374
|
throw Error('curve object is not initialized');
|
|
@@ -508,15 +490,6 @@ export function getGasPriceFromL2() {
|
|
|
508
490
|
if (this.chainId === 42161) {
|
|
509
491
|
return yield getBaseFeeByLastBlock.call(this);
|
|
510
492
|
}
|
|
511
|
-
if (this.chainId === 196) {
|
|
512
|
-
return yield getGasPrice.call(this); // gwei
|
|
513
|
-
}
|
|
514
|
-
if (this.chainId === 324) {
|
|
515
|
-
return yield getGasPrice.call(this); // gwei
|
|
516
|
-
}
|
|
517
|
-
if (this.chainId === 5000) {
|
|
518
|
-
return yield getGasPrice.call(this); // gwei
|
|
519
|
-
}
|
|
520
493
|
if (L2Networks.includes(this.chainId)) {
|
|
521
494
|
const gasPrice = yield this.contracts[this.constants.ALIASES.gas_oracle_blob].contract.gasPrice({ "gasPrice": "0x2000000" });
|
|
522
495
|
return Number(gasPrice);
|
|
@@ -535,25 +508,6 @@ export function getGasInfoForL2() {
|
|
|
535
508
|
maxPriorityFeePerGas: 0.01,
|
|
536
509
|
};
|
|
537
510
|
}
|
|
538
|
-
else if (this.chainId === 196) {
|
|
539
|
-
const gasPrice = yield getGasPrice.call(this);
|
|
540
|
-
return {
|
|
541
|
-
gasPrice,
|
|
542
|
-
};
|
|
543
|
-
}
|
|
544
|
-
else if (this.chainId === 324) {
|
|
545
|
-
const gasPrice = yield getGasPrice.call(this);
|
|
546
|
-
return {
|
|
547
|
-
gasPrice,
|
|
548
|
-
};
|
|
549
|
-
}
|
|
550
|
-
else if (this.chainId === 5000) {
|
|
551
|
-
const baseFee = yield getBaseFeeByLastBlock.call(this);
|
|
552
|
-
return {
|
|
553
|
-
maxFeePerGas: Number(((baseFee * 1.1) + 0.01).toFixed(2)),
|
|
554
|
-
maxPriorityFeePerGas: 0.01,
|
|
555
|
-
};
|
|
556
|
-
}
|
|
557
511
|
else {
|
|
558
512
|
throw Error("This method exists only for L2 networks");
|
|
559
513
|
}
|
|
@@ -675,24 +629,18 @@ export function getTVL() {
|
|
|
675
629
|
}
|
|
676
630
|
export function getVolumeApiController(network) {
|
|
677
631
|
return __awaiter(this, void 0, void 0, function* () {
|
|
678
|
-
if (this.isLiteChain
|
|
632
|
+
if (this.isLiteChain) {
|
|
679
633
|
throw Error('This method is not supported for the lite version');
|
|
680
634
|
}
|
|
681
635
|
if (volumeNetworks.getVolumes.includes(this.chainId)) {
|
|
682
636
|
return yield _getVolumes(network);
|
|
683
637
|
}
|
|
684
|
-
if (volumeNetworks.getFactoryAPYs.includes(this.chainId)) {
|
|
685
|
-
return yield _getFactoryAPYs(network);
|
|
686
|
-
}
|
|
687
|
-
if (volumeNetworks.getSubgraphData.includes(this.chainId)) {
|
|
688
|
-
return yield _getSubgraphData(network);
|
|
689
|
-
}
|
|
690
638
|
throw Error(`Can't get volume for network: ${network}`);
|
|
691
639
|
});
|
|
692
640
|
}
|
|
693
641
|
export function getVolume() {
|
|
694
642
|
return __awaiter(this, arguments, void 0, function* (chainId = this.chainId) {
|
|
695
|
-
if (this.isLiteChain
|
|
643
|
+
if (this.isLiteChain) {
|
|
696
644
|
throw Error('This method is not supported for the lite version');
|
|
697
645
|
}
|
|
698
646
|
const networkConstants = yield getNetworkConstants.call(this, chainId);
|