@curvefi/api 2.69.8 → 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 -11
- package/lib/constants/coins/index.js +1 -11
- package/lib/constants/factory/crypto.d.ts +0 -50
- package/lib/constants/factory/crypto.js +0 -80
- package/lib/constants/factory/stable.d.ts +0 -13
- package/lib/constants/factory/stable.js +0 -139
- package/lib/constants/network_constants.js +2 -292
- package/lib/constants/pools/index.d.ts +1 -11
- package/lib/constants/pools/index.js +1 -11
- 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 -12
- package/lib/route-graph.worker.js +2 -4
- package/lib/utils.js +3 -57
- 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/DepositZapMetaUsd2Fantom.json +0 -197
- package/lib/constants/abis/factory-v2/MetaUSDGeist.json +0 -932
- package/lib/constants/abis/fusdt/swap.json +0 -1221
- package/lib/constants/abis/fusdt/zap.json +0 -215
- package/lib/constants/abis/ren-fantom/swap.json +0 -868
- package/lib/constants/abis/tricrypto/swapNoZap.json +0 -1250
- 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/fantom.d.ts +0 -5
- package/lib/constants/coins/fantom.js +0 -31
- 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/fantom.d.ts +0 -2
- package/lib/constants/pools/fantom.js +0 -185
- 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,20 +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
|
-
250: 'fantom',
|
|
360
357
|
252: 'fraxtal',
|
|
361
|
-
324: 'zksync',
|
|
362
358
|
999: 'hyperliquid',
|
|
363
|
-
1284: 'moonbeam',
|
|
364
|
-
2222: 'kava',
|
|
365
|
-
5000: 'mantle',
|
|
366
359
|
8453: 'base',
|
|
367
|
-
42220: 'celo',
|
|
368
|
-
43114: 'avalanche',
|
|
369
360
|
42161: 'arbitrum-one',
|
|
370
|
-
1313161554: 'aurora',
|
|
371
361
|
}[this.chainId];
|
|
372
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 : {
|
|
373
363
|
1: 'ethereum',
|
|
@@ -375,20 +365,10 @@ export function _getUsdRate(assetId) {
|
|
|
375
365
|
56: 'binancecoin',
|
|
376
366
|
100: 'xdai',
|
|
377
367
|
137: 'matic-network',
|
|
378
|
-
146: 'sonic-3',
|
|
379
|
-
196: 'okb',
|
|
380
|
-
250: 'fantom',
|
|
381
368
|
252: 'frax-share',
|
|
382
|
-
324: 'ethereum',
|
|
383
|
-
1284: 'moonbeam',
|
|
384
369
|
999: 'hyperliquid',
|
|
385
|
-
2222: 'kava',
|
|
386
|
-
5000: 'mantle',
|
|
387
370
|
8453: 'ethereum',
|
|
388
|
-
42220: 'celo',
|
|
389
|
-
43114: 'avalanche-2',
|
|
390
371
|
42161: 'ethereum',
|
|
391
|
-
1313161554: 'ethereum',
|
|
392
372
|
}[this.chainId];
|
|
393
373
|
if (chainName === undefined) {
|
|
394
374
|
throw Error('curve object is not initialized');
|
|
@@ -510,15 +490,6 @@ export function getGasPriceFromL2() {
|
|
|
510
490
|
if (this.chainId === 42161) {
|
|
511
491
|
return yield getBaseFeeByLastBlock.call(this);
|
|
512
492
|
}
|
|
513
|
-
if (this.chainId === 196) {
|
|
514
|
-
return yield getGasPrice.call(this); // gwei
|
|
515
|
-
}
|
|
516
|
-
if (this.chainId === 324) {
|
|
517
|
-
return yield getGasPrice.call(this); // gwei
|
|
518
|
-
}
|
|
519
|
-
if (this.chainId === 5000) {
|
|
520
|
-
return yield getGasPrice.call(this); // gwei
|
|
521
|
-
}
|
|
522
493
|
if (L2Networks.includes(this.chainId)) {
|
|
523
494
|
const gasPrice = yield this.contracts[this.constants.ALIASES.gas_oracle_blob].contract.gasPrice({ "gasPrice": "0x2000000" });
|
|
524
495
|
return Number(gasPrice);
|
|
@@ -537,25 +508,6 @@ export function getGasInfoForL2() {
|
|
|
537
508
|
maxPriorityFeePerGas: 0.01,
|
|
538
509
|
};
|
|
539
510
|
}
|
|
540
|
-
else if (this.chainId === 196) {
|
|
541
|
-
const gasPrice = yield getGasPrice.call(this);
|
|
542
|
-
return {
|
|
543
|
-
gasPrice,
|
|
544
|
-
};
|
|
545
|
-
}
|
|
546
|
-
else if (this.chainId === 324) {
|
|
547
|
-
const gasPrice = yield getGasPrice.call(this);
|
|
548
|
-
return {
|
|
549
|
-
gasPrice,
|
|
550
|
-
};
|
|
551
|
-
}
|
|
552
|
-
else if (this.chainId === 5000) {
|
|
553
|
-
const baseFee = yield getBaseFeeByLastBlock.call(this);
|
|
554
|
-
return {
|
|
555
|
-
maxFeePerGas: Number(((baseFee * 1.1) + 0.01).toFixed(2)),
|
|
556
|
-
maxPriorityFeePerGas: 0.01,
|
|
557
|
-
};
|
|
558
|
-
}
|
|
559
511
|
else {
|
|
560
512
|
throw Error("This method exists only for L2 networks");
|
|
561
513
|
}
|
|
@@ -677,24 +629,18 @@ export function getTVL() {
|
|
|
677
629
|
}
|
|
678
630
|
export function getVolumeApiController(network) {
|
|
679
631
|
return __awaiter(this, void 0, void 0, function* () {
|
|
680
|
-
if (this.isLiteChain
|
|
632
|
+
if (this.isLiteChain) {
|
|
681
633
|
throw Error('This method is not supported for the lite version');
|
|
682
634
|
}
|
|
683
635
|
if (volumeNetworks.getVolumes.includes(this.chainId)) {
|
|
684
636
|
return yield _getVolumes(network);
|
|
685
637
|
}
|
|
686
|
-
if (volumeNetworks.getFactoryAPYs.includes(this.chainId)) {
|
|
687
|
-
return yield _getFactoryAPYs(network);
|
|
688
|
-
}
|
|
689
|
-
if (volumeNetworks.getSubgraphData.includes(this.chainId)) {
|
|
690
|
-
return yield _getSubgraphData(network);
|
|
691
|
-
}
|
|
692
638
|
throw Error(`Can't get volume for network: ${network}`);
|
|
693
639
|
});
|
|
694
640
|
}
|
|
695
641
|
export function getVolume() {
|
|
696
642
|
return __awaiter(this, arguments, void 0, function* (chainId = this.chainId) {
|
|
697
|
-
if (this.isLiteChain
|
|
643
|
+
if (this.isLiteChain) {
|
|
698
644
|
throw Error('This method is not supported for the lite version');
|
|
699
645
|
}
|
|
700
646
|
const networkConstants = yield getNetworkConstants.call(this, chainId);
|