@curvefi/api 2.66.0 → 2.66.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.
package/lib/curve.d.ts CHANGED
@@ -11,10 +11,6 @@ export type ContractItem = {
11
11
  };
12
12
  declare class Curve implements ICurve {
13
13
  provider: ethers.BrowserProvider | ethers.JsonRpcProvider;
14
- chainOptions?: {
15
- chainId: number;
16
- name: string;
17
- };
18
14
  isNoRPC: boolean;
19
15
  multicallProvider: MulticallProvider;
20
16
  signer: ethers.Signer | null;
@@ -49,10 +45,7 @@ declare class Curve implements ICurve {
49
45
  } | {
50
46
  network?: Networkish;
51
47
  apiKey?: string;
52
- } | {
53
- chainId: number;
54
- networkName: string;
55
- }, options?: {
48
+ } | 'NoRPC', options?: {
56
49
  gasPrice?: number;
57
50
  maxFeePerGas?: number;
58
51
  maxPriorityFeePerGas?: number;
package/lib/curve.js CHANGED
@@ -29,7 +29,7 @@ import feeDistributorCrvUSDABI from './constants/abis/fee_distributor_crvusd.jso
29
29
  import gaugeControllerABI from './constants/abis/gaugecontroller.json' with { type: 'json' };
30
30
  import depositAndStakeABI from './constants/abis/deposit_and_stake.json' with { type: 'json' };
31
31
  import depositAndStakeNgOnlyABI from './constants/abis/deposit_and_stake_ng_only.json' with { type: 'json' };
32
- import cryptoCalcZapABI from './constants/abis/crypto_calc.json' assert { type: 'json' };
32
+ import cryptoCalcZapABI from './constants/abis/crypto_calc.json' with { type: 'json' };
33
33
  import StableCalcZapABI from './constants/abis/stable_calc.json' with { type: 'json' };
34
34
  import routerABI from './constants/abis/router.json' with { type: 'json' };
35
35
  import routerPolygonABI from './constants/abis/routerPolygon.json' with { type: 'json' };
@@ -43,11 +43,11 @@ import twocryptoFactoryABI from './constants/abis/factory-twocrypto-ng.json' wit
43
43
  import tricryptoFactoryMainnetABI from './constants/abis/factory-tricrypto-mainnet.json' with { type: 'json' };
44
44
  import tricryptoFactorySidechainABI from './constants/abis/factory-tricrypto-sidechain.json' with { type: 'json' };
45
45
  import stableNgFactoryABI from './constants/abis/factory-stable-ng.json' with { type: 'json' };
46
- import gasOracleABI from './constants/abis/gas_oracle_optimism.json' assert { type: 'json' };
47
- import gasOracleBlobABI from './constants/abis/gas_oracle_optimism_blob.json' assert { type: 'json' };
48
- import votingProposalABI from './constants/abis/voting_proposal.json' assert { type: 'json' };
49
- import circulatingSupplyABI from './constants/abis/circulating_supply.json' assert { type: 'json' };
50
- import rootGaugeFactoryABI from "./constants/abis/gauge_factory/root_gauge_factory.json" assert { type: 'json' };
46
+ import gasOracleABI from './constants/abis/gas_oracle_optimism.json' with { type: 'json' };
47
+ import gasOracleBlobABI from './constants/abis/gas_oracle_optimism_blob.json' with { type: 'json' };
48
+ import votingProposalABI from './constants/abis/voting_proposal.json' with { type: 'json' };
49
+ import circulatingSupplyABI from './constants/abis/circulating_supply.json' with { type: 'json' };
50
+ import rootGaugeFactoryABI from "./constants/abis/gauge_factory/root_gauge_factory.json" with { type: 'json' };
51
51
  import { lowerCasePoolDataAddresses, extractDecimals, extractGauges } from "./constants/utils.js";
52
52
  import { _getHiddenPools } from "./external-api.js";
53
53
  import { L2Networks } from "./constants/L2Networks.js";
@@ -445,18 +445,16 @@ class Curve {
445
445
  this.signer = null;
446
446
  }
447
447
  else if (providerType.toLowerCase() === 'NoRPC'.toLowerCase()) {
448
- providerSettings = providerSettings;
449
448
  this.isNoRPC = true;
450
- this.chainOptions = {
451
- chainId: providerSettings.chainId,
452
- name: providerSettings.networkName,
453
- };
454
449
  this.signer = null;
450
+ if (!options.chainId) {
451
+ throw Error('ChainId is required for NoRPC provider');
452
+ }
455
453
  }
456
454
  else {
457
455
  throw Error('Wrong providerType');
458
456
  }
459
- const network = this.chainOptions || (yield this.provider.getNetwork());
457
+ const network = this.isNoRPC ? { chainId: options.chainId, name: 'NoRPC' } : yield this.provider.getNetwork();
460
458
  console.log("CURVE-JS IS CONNECTED TO NETWORK:", { name: network.name.toUpperCase(), chainId: Number(network.chainId) });
461
459
  this.chainId = Number(network.chainId) === 133 || Number(network.chainId) === 31337 ? 1 : Number(network.chainId);
462
460
  this.isLiteChain = !(this.chainId in NETWORK_CONSTANTS);
@@ -11,7 +11,7 @@ import { Contract as MulticallContract } from "@curvefi/ethcall";
11
11
  import { curve } from "../curve.js";
12
12
  import ERC20ABI from "../constants/abis/ERC20.json" with { type: 'json' };
13
13
  import PlainStableSwapNGABI from "../constants/abis/factory-stable-ng/plain-stableswap-ng.json" with { type: 'json' };
14
- import MetaStableSwapNGABI from "../constants/abis/factory-stable-ng/meta-stableswap-ng.json" assert { type: 'json' };
14
+ import MetaStableSwapNGABI from "../constants/abis/factory-stable-ng/meta-stableswap-ng.json" with { type: 'json' };
15
15
  import factoryGaugeABI from "../constants/abis/gauge_factory.json" with { type: 'json' };
16
16
  import gaugeChildABI from "../constants/abis/gauge_child.json" with { type: 'json' };
17
17
  import StableNgBasePoolZapABI from "../constants/abis/stable-ng-base-pool-zap.json" with { type: 'json' };
package/lib/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { ethers, Networkish } from "ethers";
2
2
  import { PoolTemplate } from "./pools/index.js";
3
- declare function init(providerType: 'JsonRpc' | 'Web3' | 'Infura' | 'Alchemy', providerSettings: {
3
+ declare function init(providerType: 'JsonRpc' | 'Web3' | 'Infura' | 'Alchemy' | 'NoRPC', providerSettings: {
4
4
  url?: string;
5
5
  privateKey?: string;
6
6
  batchMaxCount?: number;
@@ -9,7 +9,7 @@ declare function init(providerType: 'JsonRpc' | 'Web3' | 'Infura' | 'Alchemy', p
9
9
  } | {
10
10
  network?: Networkish;
11
11
  apiKey?: string;
12
- }, options?: {
12
+ } | 'NoRPC', options?: {
13
13
  gasPrice?: number;
14
14
  maxFeePerGas?: number;
15
15
  maxPriorityFeePerGas?: number;
package/lib/utils.js CHANGED
@@ -12,7 +12,7 @@ import { Contract as MulticallContract } from "@curvefi/ethcall";
12
12
  import BigNumber from 'bignumber.js';
13
13
  import { curve } from "./curve.js";
14
14
  import { _getAllPoolsFromApi, _getCurveLiteNetworks, _getFactoryAPYs, _getLiteNetworksData, _getSubgraphData, _getVolumes, } from "./external-api.js";
15
- import ERC20Abi from './constants/abis/ERC20.json' assert { type: 'json' };
15
+ import ERC20Abi from './constants/abis/ERC20.json' with { type: 'json' };
16
16
  import { L2Networks } from './constants/L2Networks.js';
17
17
  import { volumeNetworks } from "./constants/volumeNetworks.js";
18
18
  import { getPool } from "./pools/index.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@curvefi/api",
3
- "version": "2.66.0",
3
+ "version": "2.66.2",
4
4
  "description": "JavaScript library for curve.fi",
5
5
  "main": "lib/index.js",
6
6
  "author": "Macket",