@curvefi/api 2.65.28 → 2.66.0

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.
Files changed (54) hide show
  1. package/README.md +3 -0
  2. package/eslint.config.mjs +88 -0
  3. package/lib/boosting.js +13 -13
  4. package/lib/constants/coins/avalanche.js +4 -4
  5. package/lib/constants/coins/base.js +1 -1
  6. package/lib/constants/coins/celo.js +1 -1
  7. package/lib/constants/coins/ethereum.js +88 -88
  8. package/lib/constants/coins/fantom.js +5 -5
  9. package/lib/constants/coins/kava.js +1 -1
  10. package/lib/constants/coins/polygon.js +18 -18
  11. package/lib/constants/coins/zksync.js +1 -1
  12. package/lib/constants/factory/crypto.js +32 -32
  13. package/lib/constants/factory/stable.js +57 -57
  14. package/lib/constants/network_constants.js +37 -37
  15. package/lib/constants/pools/arbitrum.js +8 -8
  16. package/lib/constants/pools/aurora.js +2 -2
  17. package/lib/constants/pools/avalanche.js +13 -13
  18. package/lib/constants/pools/ethereum.js +89 -89
  19. package/lib/constants/pools/fantom.js +13 -13
  20. package/lib/constants/pools/moonbeam.js +3 -3
  21. package/lib/constants/pools/optimism.js +3 -3
  22. package/lib/constants/pools/polygon.js +21 -21
  23. package/lib/constants/pools/xdai.js +13 -13
  24. package/lib/curve.d.ts +10 -2
  25. package/lib/curve.js +80 -47
  26. package/lib/dao.js +12 -12
  27. package/lib/external-api.d.ts +0 -9
  28. package/lib/external-api.js +75 -104
  29. package/lib/factory/deploy.js +12 -12
  30. package/lib/factory/factory-api.js +13 -13
  31. package/lib/factory/factory-crypto.js +10 -10
  32. package/lib/factory/factory-tricrypto.js +11 -11
  33. package/lib/factory/factory-twocrypto.js +9 -9
  34. package/lib/factory/factory.js +13 -13
  35. package/lib/index.d.ts +60 -59
  36. package/lib/index.js +6 -3
  37. package/lib/pools/PoolTemplate.js +59 -59
  38. package/lib/pools/mixins/depositMixins.js +14 -14
  39. package/lib/pools/mixins/depositWrappedMixins.js +8 -8
  40. package/lib/pools/mixins/swapMixins.js +12 -12
  41. package/lib/pools/mixins/swapWrappedMixins.js +8 -8
  42. package/lib/pools/mixins/withdrawImbalanceMixins.js +12 -12
  43. package/lib/pools/mixins/withdrawImbalanceWrappedMixins.js +6 -6
  44. package/lib/pools/mixins/withdrawMixins.js +14 -14
  45. package/lib/pools/mixins/withdrawOneCoinMixins.js +14 -14
  46. package/lib/pools/mixins/withdrawOneCoinWrappedMixins.js +6 -6
  47. package/lib/pools/mixins/withdrawWrappedMixins.js +6 -6
  48. package/lib/pools/subClasses/gaugePool.js +4 -4
  49. package/lib/pools/subClasses/statsPool.js +3 -3
  50. package/lib/pools/utils.js +11 -11
  51. package/lib/route-graph.worker.js +3 -3
  52. package/lib/router.js +4 -5
  53. package/lib/utils.js +22 -24
  54. package/package.json +21 -18
package/lib/curve.js CHANGED
@@ -15,34 +15,34 @@ import { getFactoryPoolData } from "./factory/factory.js";
15
15
  import { getFactoryPoolsDataFromApi } from "./factory/factory-api.js";
16
16
  import { getCryptoFactoryPoolData } from "./factory/factory-crypto.js";
17
17
  import { getTricryptoFactoryPoolData } from "./factory/factory-tricrypto.js";
18
- import ERC20Abi from './constants/abis/ERC20.json' assert { type: 'json' };
19
- import cERC20Abi from './constants/abis/cERC20.json' assert { type: 'json' };
20
- import yERC20Abi from './constants/abis/yERC20.json' assert { type: 'json' };
21
- import childGaugeFactoryABI from './constants/abis/gauge_factory/child_gauge_factory.json' assert { type: 'json' };
22
- import minterMainnetABI from './constants/abis/minter_mainnet.json' assert { type: 'json' };
23
- import votingEscrowABI from './constants/abis/votingescrow.json' assert { type: 'json' };
24
- import anycallABI from './constants/abis/anycall.json' assert { type: 'json' };
25
- import votingEscrowOracleABI from './constants/abis/voting_escrow_oracle.json' assert { type: 'json' };
26
- import votingEscrowOracleEthABI from './constants/abis/voting_escrow_oracle_eth.json' assert { type: 'json' };
27
- import feeDistributorABI from './constants/abis/fee_distributor.json' assert { type: 'json' };
28
- import feeDistributorCrvUSDABI from './constants/abis/fee_distributor_crvusd.json' assert { type: 'json' };
29
- import gaugeControllerABI from './constants/abis/gaugecontroller.json' assert { type: 'json' };
30
- import depositAndStakeABI from './constants/abis/deposit_and_stake.json' assert { type: 'json' };
31
- import depositAndStakeNgOnlyABI from './constants/abis/deposit_and_stake_ng_only.json' assert { type: 'json' };
18
+ import ERC20Abi from './constants/abis/ERC20.json' with { type: 'json' };
19
+ import cERC20Abi from './constants/abis/cERC20.json' with { type: 'json' };
20
+ import yERC20Abi from './constants/abis/yERC20.json' with { type: 'json' };
21
+ import childGaugeFactoryABI from './constants/abis/gauge_factory/child_gauge_factory.json' with { type: 'json' };
22
+ import minterMainnetABI from './constants/abis/minter_mainnet.json' with { type: 'json' };
23
+ import votingEscrowABI from './constants/abis/votingescrow.json' with { type: 'json' };
24
+ import anycallABI from './constants/abis/anycall.json' with { type: 'json' };
25
+ import votingEscrowOracleABI from './constants/abis/voting_escrow_oracle.json' with { type: 'json' };
26
+ import votingEscrowOracleEthABI from './constants/abis/voting_escrow_oracle_eth.json' with { type: 'json' };
27
+ import feeDistributorABI from './constants/abis/fee_distributor.json' with { type: 'json' };
28
+ import feeDistributorCrvUSDABI from './constants/abis/fee_distributor_crvusd.json' with { type: 'json' };
29
+ import gaugeControllerABI from './constants/abis/gaugecontroller.json' with { type: 'json' };
30
+ import depositAndStakeABI from './constants/abis/deposit_and_stake.json' with { type: 'json' };
31
+ import depositAndStakeNgOnlyABI from './constants/abis/deposit_and_stake_ng_only.json' with { type: 'json' };
32
32
  import cryptoCalcZapABI from './constants/abis/crypto_calc.json' assert { type: 'json' };
33
- import StableCalcZapABI from './constants/abis/stable_calc.json' assert { type: 'json' };
34
- import routerABI from './constants/abis/router.json' assert { type: 'json' };
35
- import routerPolygonABI from './constants/abis/routerPolygon.json' assert { type: 'json' };
36
- import routerNgPoolsOnlyABI from './constants/abis/router-ng-pools-only.json' assert { type: 'json' };
37
- import streamerABI from './constants/abis/streamer.json' assert { type: 'json' };
38
- import factoryABI from './constants/abis/factory.json' assert { type: 'json' };
39
- import factoryEywaABI from './constants/abis/factory-eywa.json' assert { type: 'json' };
40
- import factoryAdminABI from './constants/abis/factory-admin.json' assert { type: 'json' };
41
- import cryptoFactoryABI from './constants/abis/factory-crypto.json' assert { type: 'json' };
42
- import twocryptoFactoryABI from './constants/abis/factory-twocrypto-ng.json' assert { type: 'json' };
43
- import tricryptoFactoryMainnetABI from './constants/abis/factory-tricrypto-mainnet.json' assert { type: 'json' };
44
- import tricryptoFactorySidechainABI from './constants/abis/factory-tricrypto-sidechain.json' assert { type: 'json' };
45
- import stableNgFactoryABI from './constants/abis/factory-stable-ng.json' assert { type: 'json' };
33
+ import StableCalcZapABI from './constants/abis/stable_calc.json' with { type: 'json' };
34
+ import routerABI from './constants/abis/router.json' with { type: 'json' };
35
+ import routerPolygonABI from './constants/abis/routerPolygon.json' with { type: 'json' };
36
+ import routerNgPoolsOnlyABI from './constants/abis/router-ng-pools-only.json' with { type: 'json' };
37
+ import streamerABI from './constants/abis/streamer.json' with { type: 'json' };
38
+ import factoryABI from './constants/abis/factory.json' with { type: 'json' };
39
+ import factoryEywaABI from './constants/abis/factory-eywa.json' with { type: 'json' };
40
+ import factoryAdminABI from './constants/abis/factory-admin.json' with { type: 'json' };
41
+ import cryptoFactoryABI from './constants/abis/factory-crypto.json' with { type: 'json' };
42
+ import twocryptoFactoryABI from './constants/abis/factory-twocrypto-ng.json' with { type: 'json' };
43
+ import tricryptoFactoryMainnetABI from './constants/abis/factory-tricrypto-mainnet.json' with { type: 'json' };
44
+ import tricryptoFactorySidechainABI from './constants/abis/factory-tricrypto-sidechain.json' with { type: 'json' };
45
+ import stableNgFactoryABI from './constants/abis/factory-stable-ng.json' with { type: 'json' };
46
46
  import gasOracleABI from './constants/abis/gas_oracle_optimism.json' assert { type: 'json' };
47
47
  import gasOracleBlobABI from './constants/abis/gas_oracle_optimism_blob.json' assert { type: 'json' };
48
48
  import votingProposalABI from './constants/abis/voting_proposal.json' assert { type: 'json' };
@@ -84,7 +84,7 @@ class Curve {
84
84
  constructor() {
85
85
  this.initContract = memoizedContract();
86
86
  this.initMulticallContract = memoizedMulticallContract();
87
- this.fetchFactoryPools = (useApi = true) => __awaiter(this, void 0, void 0, function* () {
87
+ this.fetchFactoryPools = (...args_1) => __awaiter(this, [...args_1], void 0, function* (useApi = true) {
88
88
  if (!("factory" in this.constants.ALIASES))
89
89
  return;
90
90
  if (useApi) {
@@ -95,94 +95,112 @@ class Curve {
95
95
  }
96
96
  this.constants.FACTORY_POOLS_DATA = yield this._filterHiddenPools(this.constants.FACTORY_POOLS_DATA);
97
97
  this._updateDecimalsAndGauges(this.constants.FACTORY_POOLS_DATA);
98
- this.constants.FACTORY_GAUGE_IMPLEMENTATIONS["factory"] = yield this.contracts[this.constants.ALIASES.factory].contract.gauge_implementation(this.constantOptions);
98
+ this.constants.FACTORY_GAUGE_IMPLEMENTATIONS["factory"] = this.isNoRPC ? null : yield this.contracts[this.constants.ALIASES.factory].contract.gauge_implementation(this.constantOptions);
99
99
  });
100
- this.fetchCrvusdFactoryPools = (useApi = true) => __awaiter(this, void 0, void 0, function* () {
100
+ this.fetchCrvusdFactoryPools = (...args_1) => __awaiter(this, [...args_1], void 0, function* (useApi = true) {
101
101
  if (!("crvusd_factory" in this.constants.ALIASES))
102
102
  return;
103
103
  if (useApi) {
104
104
  this.constants.CRVUSD_FACTORY_POOLS_DATA = lowerCasePoolDataAddresses(yield getFactoryPoolsDataFromApi.call(this, "factory-crvusd"));
105
105
  }
106
106
  else {
107
+ if (this.isNoRPC) {
108
+ throw new Error('RPC connection is required');
109
+ }
107
110
  this.constants.CRVUSD_FACTORY_POOLS_DATA = lowerCasePoolDataAddresses(yield getFactoryPoolData.call(this, 0, undefined, this.constants.ALIASES.crvusd_factory));
108
111
  }
109
112
  this.constants.CRVUSD_FACTORY_POOLS_DATA = yield this._filterHiddenPools(this.constants.CRVUSD_FACTORY_POOLS_DATA);
110
113
  this._updateDecimalsAndGauges(this.constants.CRVUSD_FACTORY_POOLS_DATA);
111
114
  });
112
- this.fetchEywaFactoryPools = (useApi = true) => __awaiter(this, void 0, void 0, function* () {
115
+ this.fetchEywaFactoryPools = (...args_1) => __awaiter(this, [...args_1], void 0, function* (useApi = true) {
113
116
  if (!("eywa_factory" in this.constants.ALIASES))
114
117
  return;
115
118
  if (useApi) {
116
119
  this.constants.EYWA_FACTORY_POOLS_DATA = lowerCasePoolDataAddresses(yield getFactoryPoolsDataFromApi.call(this, "factory-eywa"));
117
120
  }
118
121
  else {
122
+ if (this.isNoRPC) {
123
+ throw new Error('RPC connection is required');
124
+ }
119
125
  this.constants.EYWA_FACTORY_POOLS_DATA = lowerCasePoolDataAddresses(yield getFactoryPoolData.call(this, 0, undefined, this.constants.ALIASES.eywa_factory));
120
126
  }
121
127
  this.constants.EYWA_FACTORY_POOLS_DATA = yield this._filterHiddenPools(this.constants.EYWA_FACTORY_POOLS_DATA);
122
128
  this._updateDecimalsAndGauges(this.constants.EYWA_FACTORY_POOLS_DATA);
123
129
  });
124
- this.fetchCryptoFactoryPools = (useApi = true) => __awaiter(this, void 0, void 0, function* () {
130
+ this.fetchCryptoFactoryPools = (...args_1) => __awaiter(this, [...args_1], void 0, function* (useApi = true) {
125
131
  if (!("crypto_factory" in this.constants.ALIASES))
126
132
  return;
127
133
  if (useApi) {
128
134
  this.constants.CRYPTO_FACTORY_POOLS_DATA = lowerCasePoolDataAddresses(yield getFactoryPoolsDataFromApi.call(this, "factory-crypto"));
129
135
  }
130
136
  else {
137
+ if (this.isNoRPC) {
138
+ throw new Error('RPC connection is required');
139
+ }
131
140
  this.constants.CRYPTO_FACTORY_POOLS_DATA = lowerCasePoolDataAddresses(yield getCryptoFactoryPoolData.call(this));
132
141
  }
133
142
  this.constants.CRYPTO_FACTORY_POOLS_DATA = yield this._filterHiddenPools(this.constants.CRYPTO_FACTORY_POOLS_DATA);
134
143
  this._updateDecimalsAndGauges(this.constants.CRYPTO_FACTORY_POOLS_DATA);
135
- this.constants.FACTORY_GAUGE_IMPLEMENTATIONS["factory-crypto"] = yield this.contracts[this.constants.ALIASES.crypto_factory].contract.gauge_implementation(this.constantOptions);
144
+ this.constants.FACTORY_GAUGE_IMPLEMENTATIONS["factory-crypto"] = this.isNoRPC ? null : yield this.contracts[this.constants.ALIASES.crypto_factory].contract.gauge_implementation(this.constantOptions);
136
145
  });
137
- this.fetchStableNgFactoryPools = (useApi = true) => __awaiter(this, void 0, void 0, function* () {
146
+ this.fetchStableNgFactoryPools = (...args_1) => __awaiter(this, [...args_1], void 0, function* (useApi = true) {
138
147
  if (!("stable_ng_factory" in this.constants.ALIASES))
139
148
  return;
140
149
  if (useApi) {
141
150
  this.constants.STABLE_NG_FACTORY_POOLS_DATA = lowerCasePoolDataAddresses(yield getFactoryPoolsDataFromApi.call(this, "factory-stable-ng"));
142
151
  }
143
152
  else {
153
+ if (this.isNoRPC) {
154
+ throw new Error('RPC connection is required');
155
+ }
144
156
  this.constants.STABLE_NG_FACTORY_POOLS_DATA = lowerCasePoolDataAddresses(yield getFactoryPoolData.call(this, 0, undefined, this.constants.ALIASES.stable_ng_factory));
145
157
  }
146
158
  this.constants.STABLE_NG_FACTORY_POOLS_DATA = yield this._filterHiddenPools(this.constants.STABLE_NG_FACTORY_POOLS_DATA);
147
159
  this._updateDecimalsAndGauges(this.constants.STABLE_NG_FACTORY_POOLS_DATA);
148
160
  });
149
- this.fetchTworyptoFactoryPools = (useApi = true) => __awaiter(this, void 0, void 0, function* () {
161
+ this.fetchTworyptoFactoryPools = (...args_1) => __awaiter(this, [...args_1], void 0, function* (useApi = true) {
150
162
  if (!("twocrypto_factory" in this.constants.ALIASES))
151
163
  return;
152
164
  if (useApi) {
153
165
  this.constants.TWOCRYPTO_FACTORY_POOLS_DATA = lowerCasePoolDataAddresses(yield getFactoryPoolsDataFromApi.call(this, "factory-twocrypto"));
154
166
  }
155
167
  else {
168
+ if (this.isNoRPC) {
169
+ throw new Error('RPC connection is required');
170
+ }
156
171
  this.constants.TWOCRYPTO_FACTORY_POOLS_DATA = lowerCasePoolDataAddresses(yield getTwocryptoFactoryPoolData.call(this));
157
172
  }
158
173
  this.constants.TWOCRYPTO_FACTORY_POOLS_DATA = yield this._filterHiddenPools(this.constants.TWOCRYPTO_FACTORY_POOLS_DATA);
159
174
  this._updateDecimalsAndGauges(this.constants.TWOCRYPTO_FACTORY_POOLS_DATA);
160
175
  if (this.chainId === 1) {
161
- this.constants.FACTORY_GAUGE_IMPLEMENTATIONS["factory-twocrypto"] =
176
+ this.constants.FACTORY_GAUGE_IMPLEMENTATIONS["factory-twocrypto"] = this.isNoRPC ? null :
162
177
  yield this.contracts[this.constants.ALIASES.twocrypto_factory].contract.gauge_implementation(this.constantOptions);
163
178
  }
164
179
  else {
165
- this.constants.FACTORY_GAUGE_IMPLEMENTATIONS["factory-twocrypto"] =
180
+ this.constants.FACTORY_GAUGE_IMPLEMENTATIONS["factory-twocrypto"] = this.isNoRPC ? null :
166
181
  yield this.contracts[this.constants.ALIASES.child_gauge_factory].contract.get_implementation(this.constantOptions);
167
182
  }
168
183
  });
169
- this.fetchTricryptoFactoryPools = (useApi = true) => __awaiter(this, void 0, void 0, function* () {
184
+ this.fetchTricryptoFactoryPools = (...args_1) => __awaiter(this, [...args_1], void 0, function* (useApi = true) {
170
185
  if (!("tricrypto_factory" in this.constants.ALIASES))
171
186
  return;
172
187
  if (useApi) {
173
188
  this.constants.TRICRYPTO_FACTORY_POOLS_DATA = lowerCasePoolDataAddresses(yield getFactoryPoolsDataFromApi.call(this, "factory-tricrypto"));
174
189
  }
175
190
  else {
191
+ if (this.isNoRPC) {
192
+ throw new Error('RPC connection is required');
193
+ }
176
194
  this.constants.TRICRYPTO_FACTORY_POOLS_DATA = lowerCasePoolDataAddresses(yield getTricryptoFactoryPoolData.call(this));
177
195
  }
178
196
  this.constants.TRICRYPTO_FACTORY_POOLS_DATA = yield this._filterHiddenPools(this.constants.TRICRYPTO_FACTORY_POOLS_DATA);
179
197
  this._updateDecimalsAndGauges(this.constants.TRICRYPTO_FACTORY_POOLS_DATA);
180
198
  if (this.chainId === 1) {
181
- this.constants.FACTORY_GAUGE_IMPLEMENTATIONS["factory-tricrypto"] =
199
+ this.constants.FACTORY_GAUGE_IMPLEMENTATIONS["factory-tricrypto"] = this.isNoRPC ? null :
182
200
  yield this.contracts[this.constants.ALIASES.tricrypto_factory].contract.gauge_implementation(this.constantOptions);
183
201
  }
184
202
  else {
185
- this.constants.FACTORY_GAUGE_IMPLEMENTATIONS["factory-tricrypto"] =
203
+ this.constants.FACTORY_GAUGE_IMPLEMENTATIONS["factory-tricrypto"] = this.isNoRPC ? null :
186
204
  yield this.contracts[this.constants.ALIASES.child_gauge_factory].contract.get_implementation(this.constantOptions);
187
205
  }
188
206
  });
@@ -308,6 +326,7 @@ class Curve {
308
326
  this.provider = null;
309
327
  // @ts-ignore
310
328
  this.signer = null;
329
+ this.isNoRPC = false;
311
330
  this.signerAddress = '';
312
331
  this.chainId = 1;
313
332
  this.isLiteChain = false;
@@ -340,10 +359,10 @@ class Curve {
340
359
  ZERO_ADDRESS: ethers.ZeroAddress,
341
360
  };
342
361
  }
343
- init(providerType, providerSettings, options = {} // gasPrice in Gwei
344
- ) {
345
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
346
- return __awaiter(this, void 0, void 0, function* () {
362
+ init(providerType_1, providerSettings_1) {
363
+ return __awaiter(this, arguments, void 0, function* (providerType, providerSettings, options = {} // gasPrice in Gwei
364
+ ) {
365
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
347
366
  // @ts-ignore
348
367
  this.provider = null;
349
368
  // @ts-ignore
@@ -425,10 +444,19 @@ class Curve {
425
444
  this.provider = new ethers.AlchemyProvider(providerSettings.network, providerSettings.apiKey);
426
445
  this.signer = null;
427
446
  }
447
+ else if (providerType.toLowerCase() === 'NoRPC'.toLowerCase()) {
448
+ providerSettings = providerSettings;
449
+ this.isNoRPC = true;
450
+ this.chainOptions = {
451
+ chainId: providerSettings.chainId,
452
+ name: providerSettings.networkName,
453
+ };
454
+ this.signer = null;
455
+ }
428
456
  else {
429
457
  throw Error('Wrong providerType');
430
458
  }
431
- const network = yield this.provider.getNetwork();
459
+ const network = this.chainOptions || (yield this.provider.getNetwork());
432
460
  console.log("CURVE-JS IS CONNECTED TO NETWORK:", { name: network.name.toUpperCase(), chainId: Number(network.chainId) });
433
461
  this.chainId = Number(network.chainId) === 133 || Number(network.chainId) === 31337 ? 1 : Number(network.chainId);
434
462
  this.isLiteChain = !(this.chainId in NETWORK_CONSTANTS);
@@ -563,8 +591,10 @@ class Curve {
563
591
  if ("factory" in this.constants.ALIASES) {
564
592
  this.setContract(this.constants.ALIASES.factory, factoryABI);
565
593
  const factoryContract = this.contracts[this.constants.ALIASES.factory].contract;
566
- this.constants.ALIASES.factory_admin = (yield factoryContract.admin(this.constantOptions)).toLowerCase();
567
- this.setContract(this.constants.ALIASES.factory_admin, factoryAdminABI);
594
+ if (!this.isNoRPC) {
595
+ this.constants.ALIASES.factory_admin = (yield factoryContract.admin(this.constantOptions)).toLowerCase();
596
+ this.setContract(this.constants.ALIASES.factory_admin, factoryAdminABI);
597
+ }
568
598
  }
569
599
  this.setContract(this.constants.ALIASES.crvusd_factory, factoryABI);
570
600
  this.setContract(this.constants.ALIASES.eywa_factory, factoryEywaABI);
@@ -676,6 +706,9 @@ class Curve {
676
706
  }
677
707
  updateFeeData() {
678
708
  return __awaiter(this, void 0, void 0, function* () {
709
+ if (this.isNoRPC) {
710
+ return;
711
+ }
679
712
  const feeData = yield this.provider.getFeeData();
680
713
  if (feeData.maxFeePerGas === null || feeData.maxPriorityFeePerGas === null) {
681
714
  delete this.options.maxFeePerGas;
package/lib/dao.js CHANGED
@@ -11,7 +11,7 @@ import { curve } from "./curve.js";
11
11
  import { Contract } from "ethers";
12
12
  import { _getAllGauges, _getDaoProposalList, _getDaoProposal } from './external-api.js';
13
13
  import { _getAddress, DIGas, ensureAllowance, ensureAllowanceEstimateGas, hasAllowance, mulBy1_3, parseUnits, smartNumber, toBN, BN, } from './utils.js';
14
- import feeDistributorViewABI from "./constants/abis/fee_distributor_view.json" assert { type: 'json' };
14
+ import feeDistributorViewABI from "./constants/abis/fee_distributor_view.json" with { type: 'json' };
15
15
  // ----------------- Refactored boosting stuff -----------------
16
16
  export const crvSupplyStats = () => __awaiter(void 0, void 0, void 0, function* () {
17
17
  if (curve.chainId !== 1)
@@ -32,14 +32,14 @@ export const crvSupplyStats = () => __awaiter(void 0, void 0, void 0, function*
32
32
  averageLockTime: toBN(_veCrv).div(toBN(_locked)).times(4).toFixed(4), // years
33
33
  };
34
34
  });
35
- export const userCrv = (address = "") => __awaiter(void 0, void 0, void 0, function* () {
35
+ export const userCrv = (...args_1) => __awaiter(void 0, [...args_1], void 0, function* (address = "") {
36
36
  if (curve.chainId !== 1)
37
37
  throw Error("Ethereum-only method");
38
38
  address = _getAddress(address);
39
39
  const _balance = yield curve.contracts[curve.constants.ALIASES.crv].contract.balanceOf(address);
40
40
  return curve.formatUnits(_balance);
41
41
  });
42
- export const userVeCrv = (address = "") => __awaiter(void 0, void 0, void 0, function* () {
42
+ export const userVeCrv = (...args_1) => __awaiter(void 0, [...args_1], void 0, function* (address = "") {
43
43
  if (curve.chainId !== 1)
44
44
  throw Error("Ethereum-only method");
45
45
  address = _getAddress(address);
@@ -165,7 +165,7 @@ export const withdrawLockedCrvEstimateGas = () => __awaiter(void 0, void 0, void
165
165
  export const withdrawLockedCrv = () => __awaiter(void 0, void 0, void 0, function* () {
166
166
  return yield _withdrawLockedCrv(false);
167
167
  });
168
- export const claimableFees = (address = "") => __awaiter(void 0, void 0, void 0, function* () {
168
+ export const claimableFees = (...args_1) => __awaiter(void 0, [...args_1], void 0, function* (address = "") {
169
169
  address = _getAddress(address);
170
170
  const contract = new Contract(curve.constants.ALIASES.fee_distributor, feeDistributorViewABI, curve.provider);
171
171
  return curve.formatUnits(yield contract.claim(address, curve.constantOptions));
@@ -180,10 +180,10 @@ const _claimFees = (address, estimateGas) => __awaiter(void 0, void 0, void 0, f
180
180
  const gasLimit = mulBy1_3(DIGas(gas));
181
181
  return (yield contract.claim(address, Object.assign(Object.assign({}, curve.options), { gasLimit }))).hash;
182
182
  });
183
- export const claimFeesEstimateGas = (address = "") => __awaiter(void 0, void 0, void 0, function* () {
183
+ export const claimFeesEstimateGas = (...args_1) => __awaiter(void 0, [...args_1], void 0, function* (address = "") {
184
184
  return yield _claimFees(address, true);
185
185
  });
186
- export const claimFees = (address = "") => __awaiter(void 0, void 0, void 0, function* () {
186
+ export const claimFees = (...args_1) => __awaiter(void 0, [...args_1], void 0, function* (address = "") {
187
187
  return yield _claimFees(address, false);
188
188
  });
189
189
  // ----------------- Gauge weights -----------------
@@ -215,8 +215,8 @@ export const getVotingGaugeList = () => __awaiter(void 0, void 0, void 0, functi
215
215
  }
216
216
  return res;
217
217
  });
218
- export const userGaugeVotes = (address = "") => __awaiter(void 0, void 0, void 0, function* () {
219
- var _c, _d;
218
+ export const userGaugeVotes = (...args_1) => __awaiter(void 0, [...args_1], void 0, function* (address = "") {
219
+ var _a, _b;
220
220
  if (curve.chainId !== 1)
221
221
  throw Error("Ethereum-only method");
222
222
  address = _getAddress(address);
@@ -243,7 +243,7 @@ export const userGaugeVotes = (address = "") => __awaiter(void 0, void 0, void 0
243
243
  userFutureVeCrv: curve.formatUnits(veCrvBalance * votes[i][1] / BigInt(10000), 18),
244
244
  expired: dt === BigInt(0),
245
245
  gaugeData: {
246
- poolUrl: ((_c = gaugeData[i].poolUrls) === null || _c === void 0 ? void 0 : _c.swap[0]) || '',
246
+ poolUrl: ((_a = gaugeData[i].poolUrls) === null || _a === void 0 ? void 0 : _a.swap[0]) || '',
247
247
  network: gaugeData[i].blockchainId,
248
248
  gaugeAddress: gaugeData[i].gauge,
249
249
  poolAddress: gaugeData[i].swap || '',
@@ -251,7 +251,7 @@ export const userGaugeVotes = (address = "") => __awaiter(void 0, void 0, void 0
251
251
  poolName: gaugeData[i].shortName,
252
252
  totalVeCrv: curve.formatUnits(gaugeData[i].gauge_controller.get_gauge_weight, 18),
253
253
  relativeWeight: curve.formatUnits(gaugeData[i].gauge_controller.gauge_relative_weight, 16),
254
- isKilled: (_d = gaugeData[i].is_killed) !== null && _d !== void 0 ? _d : false,
254
+ isKilled: (_b = gaugeData[i].is_killed) !== null && _b !== void 0 ? _b : false,
255
255
  },
256
256
  });
257
257
  powerUsed += votes[i][1];
@@ -303,7 +303,7 @@ export const getProposalList = () => __awaiter(void 0, void 0, void 0, function*
303
303
  export const getProposal = (type, id) => __awaiter(void 0, void 0, void 0, function* () {
304
304
  return yield _getDaoProposal(type, id);
305
305
  });
306
- export const userProposalVotes = (address = "") => __awaiter(void 0, void 0, void 0, function* () {
306
+ export const userProposalVotes = (...args_1) => __awaiter(void 0, [...args_1], void 0, function* (address = "") {
307
307
  if (curve.chainId !== 1)
308
308
  throw Error("Ethereum-only method");
309
309
  address = _getAddress(address);
@@ -350,7 +350,7 @@ export const voteForProposalEstimateGas = (type, id, support) => __awaiter(void
350
350
  export const voteForProposal = (type, id, support) => __awaiter(void 0, void 0, void 0, function* () {
351
351
  return yield _voteForProposal(type, id, support, false);
352
352
  });
353
- const _executeVote = (type, id, estimateGas = false) => __awaiter(void 0, void 0, void 0, function* () {
353
+ const _executeVote = (type_1, id_1, ...args_1) => __awaiter(void 0, [type_1, id_1, ...args_1], void 0, function* (type, id, estimateGas = false) {
354
354
  if (curve.chainId !== 1)
355
355
  throw Error("Ethereum-only method");
356
356
  const contractAddress = type.toUpperCase() === "PARAMETER" ? curve.constants.ALIASES.voting_parameter : curve.constants.ALIASES.voting_ownership;
@@ -5,15 +5,6 @@ export declare const _getAllPoolsFromApi: (network: INetworkName, isLiteChain?:
5
5
  export declare const _getSubgraphData: ((network: INetworkName) => Promise<IVolumeAndAPYs>) & memoize.Memoized<(network: INetworkName) => Promise<IVolumeAndAPYs>>;
6
6
  export declare const _getVolumes: ((network: string) => Promise<IVolumeAndAPYs>) & memoize.Memoized<(network: string) => Promise<IVolumeAndAPYs>>;
7
7
  export declare const _getFactoryAPYs: ((network: string) => Promise<IVolumeAndAPYs>) & memoize.Memoized<(network: string) => Promise<IVolumeAndAPYs>>;
8
- export declare const _getTotalVolumes: ((network: string) => Promise<{
9
- totalVolume: number;
10
- cryptoVolume: number;
11
- cryptoShare: number;
12
- }>) & memoize.Memoized<(network: string) => Promise<{
13
- totalVolume: number;
14
- cryptoVolume: number;
15
- cryptoShare: number;
16
- }>>;
17
8
  export declare const _getAllGauges: (() => Promise<IDict<IGaugesDataFromApi>>) & memoize.Memoized<() => Promise<IDict<IGaugesDataFromApi>>>;
18
9
  export declare const _getAllGaugesFormatted: (() => Promise<IDict<any>>) & memoize.Memoized<() => Promise<IDict<any>>>;
19
10
  export declare const _getHiddenPools: (() => Promise<IDict<string[]>>) & memoize.Memoized<() => Promise<IDict<string[]>>>;