@curvefi/api 2.41.3 → 2.42.1

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/README.md CHANGED
@@ -381,6 +381,8 @@ import curve from "@curvefi/api";
381
381
  // [ false, false, false, false ]
382
382
  pool.inApi;
383
383
  // true
384
+ pool.isGaugeKilled;
385
+ // false
384
386
  })()
385
387
  ````
386
388
 
@@ -1169,10 +1171,8 @@ import curve from "@curvefi/api";
1169
1171
 
1170
1172
  await curve.init('JsonRpc', {}, { gasPrice: 0, maxFeePerGas: 0, maxPriorityFeePerGas: 0 });
1171
1173
 
1172
- await curve.boosting.sidechain.lastBlockhash();
1174
+ await curve.boosting.sidechain.lastEthBlock();
1173
1175
  // 16931944
1174
- await curve.boosting.sidechain.checkBlockhash(17377005);
1175
- // false
1176
1176
 
1177
1177
  await curve.boosting.sidechain.getAnycallBalance();
1178
1178
  // 0.033837278711248954
@@ -1184,14 +1184,20 @@ import curve from "@curvefi/api";
1184
1184
  // --- MAINNET (ETHEREUM) ---
1185
1185
 
1186
1186
  await curve.init('JsonRpc', {}, { gasPrice: 0, maxFeePerGas: 0, maxPriorityFeePerGas: 0 });
1187
- await curve.boosting.sidechain.sendBlockhash(17377005, 137); // Polygon
1187
+ await curve.boosting.sidechain.lastBlockSent(137); // Polygon
1188
+ // 17038505
1189
+ const blockToSend = await curve.boosting.sidechain.blockToSend(); // currentBlock - 128
1190
+ // 17377005
1191
+ await curve.boosting.sidechain.sendBlockhash(blockToSend, 137); // Polygon
1188
1192
 
1189
1193
  // --- SIDECHAIN ---
1190
-
1194
+
1195
+ // Wait until blockhash is delivered
1196
+
1191
1197
  await curve.init('JsonRpc', {}, { gasPrice: 0, maxFeePerGas: 0, maxPriorityFeePerGas: 0 });
1192
- await curve.boosting.sidechain.checkBlockhash(17377005);
1193
- // true
1194
- await curve.boosting.sidechain.submitProof(17377005, "0x33A4622B82D4c04a53e170c638B944ce27cffce3");
1198
+ const lastEthBlock = await curve.boosting.sidechain.lastEthBlock();
1199
+ // 17377005
1200
+ await curve.boosting.sidechain.submitProof(lastEthBlock, "0x33A4622B82D4c04a53e170c638B944ce27cffce3");
1195
1201
  })()
1196
1202
  ```
1197
1203
 
package/lib/boosting.d.ts CHANGED
@@ -24,11 +24,12 @@ export declare const withdrawLockedCrv: () => Promise<string>;
24
24
  export declare const claimableFees: (address?: string) => Promise<string>;
25
25
  export declare const claimFeesEstimateGas: (address?: string) => Promise<number>;
26
26
  export declare const claimFees: (address?: string) => Promise<string>;
27
- export declare const lastBlockhash: () => Promise<number>;
28
- export declare const checkBlockhash: (block: number) => Promise<boolean>;
27
+ export declare const lastEthBlock: () => Promise<number>;
29
28
  export declare const getAnycallBalance: () => Promise<string>;
30
29
  export declare const topUpAnycallEstimateGas: (amount?: number | string) => Promise<number>;
31
30
  export declare const topUpAnycall: (amount?: number | string) => Promise<string>;
31
+ export declare const lastBlockSent: (chainId: IChainId) => Promise<number>;
32
+ export declare const blockToSend: () => Promise<number>;
32
33
  export declare const sendBlockhashEstimateGas: (block: number, chainId: IChainId) => Promise<number>;
33
34
  export declare const sendBlockhash: (block: number, chainId: IChainId) => Promise<string>;
34
35
  export declare const submitProofEstimateGas: (block: number, address?: string) => Promise<number>;
package/lib/boosting.js CHANGED
@@ -402,7 +402,7 @@ export var claimFees = function (address) {
402
402
  });
403
403
  };
404
404
  // ------------ SIDECHAIN ------------
405
- export var lastBlockhash = function () { return __awaiter(void 0, void 0, void 0, function () {
405
+ export var lastEthBlock = function () { return __awaiter(void 0, void 0, void 0, function () {
406
406
  var veOracleContract, _a;
407
407
  return __generator(this, function (_b) {
408
408
  switch (_b.label) {
@@ -416,28 +416,6 @@ export var lastBlockhash = function () { return __awaiter(void 0, void 0, void 0
416
416
  }
417
417
  });
418
418
  }); };
419
- export var checkBlockhash = function (block) { return __awaiter(void 0, void 0, void 0, function () {
420
- var veOracleContract, e_1;
421
- return __generator(this, function (_a) {
422
- switch (_a.label) {
423
- case 0:
424
- if (curve.chainId === 1)
425
- throw Error("There is no checkBlockhash method on ethereum network");
426
- veOracleContract = curve.contracts[curve.constants.ALIASES.voting_escrow_oracle].contract;
427
- _a.label = 1;
428
- case 1:
429
- _a.trys.push([1, 3, , 4]);
430
- return [4 /*yield*/, veOracleContract.get_eth_blockhash(block, curve.constantOptions)];
431
- case 2:
432
- _a.sent();
433
- return [2 /*return*/, true];
434
- case 3:
435
- e_1 = _a.sent();
436
- return [2 /*return*/, false];
437
- case 4: return [2 /*return*/];
438
- }
439
- });
440
- }); };
441
419
  export var getAnycallBalance = function () { return __awaiter(void 0, void 0, void 0, function () {
442
420
  var anycallContract, _balance;
443
421
  return __generator(this, function (_a) {
@@ -499,6 +477,31 @@ export var topUpAnycall = function (amount) {
499
477
  });
500
478
  });
501
479
  };
480
+ export var lastBlockSent = function (chainId) { return __awaiter(void 0, void 0, void 0, function () {
481
+ var veOracleContract, _a;
482
+ return __generator(this, function (_b) {
483
+ switch (_b.label) {
484
+ case 0:
485
+ if (curve.chainId !== 1)
486
+ throw Error("lastBlockNumberSent method is on ethereum network only");
487
+ veOracleContract = curve.contracts[curve.constants.ALIASES.voting_escrow_oracle].contract;
488
+ _a = Number;
489
+ return [4 /*yield*/, veOracleContract.get_last_block_number_sent(chainId, curve.constantOptions)];
490
+ case 1: return [2 /*return*/, _a.apply(void 0, [_b.sent()])];
491
+ }
492
+ });
493
+ }); };
494
+ export var blockToSend = function () { return __awaiter(void 0, void 0, void 0, function () {
495
+ return __generator(this, function (_a) {
496
+ switch (_a.label) {
497
+ case 0:
498
+ if (curve.chainId !== 1)
499
+ throw Error("blockToSend method is on ethereum network only");
500
+ return [4 /*yield*/, curve.provider.getBlockNumber()];
501
+ case 1: return [2 /*return*/, (_a.sent()) - 128];
502
+ }
503
+ });
504
+ }); };
502
505
  var _sendBlockhash = function (block, chainId, estimateGas) { return __awaiter(void 0, void 0, void 0, function () {
503
506
  var veOracleContract, gas, gasLimit;
504
507
  return __generator(this, function (_a) {
package/lib/curve.js CHANGED
@@ -112,7 +112,7 @@ var _killGauges = function (poolsData) { return __awaiter(void 0, void 0, void 0
112
112
  });
113
113
  for (poolId in poolsData) {
114
114
  if (isKilled[poolsData[poolId].gauge_address]) {
115
- poolsData[poolId].gauge_address = ethers.ZeroAddress;
115
+ poolsData[poolId].is_gauge_killed = true;
116
116
  }
117
117
  }
118
118
  return [2 /*return*/];
package/lib/index.d.ts CHANGED
@@ -145,10 +145,11 @@ declare const curve: {
145
145
  claimFees: (address?: string) => Promise<number>;
146
146
  };
147
147
  sidechain: {
148
- lastBlockhash: () => Promise<number>;
149
- checkBlockhash: (block: number) => Promise<boolean>;
148
+ lastEthBlock: () => Promise<number>;
150
149
  getAnycallBalance: () => Promise<string>;
151
150
  topUpAnycall: (amount?: string | number) => Promise<string>;
151
+ lastBlockSent: (chainId: import("./interfaces.js").IChainId) => Promise<number>;
152
+ blockToSend: () => Promise<number>;
152
153
  sendBlockhash: (block: number, chainId: import("./interfaces.js").IChainId) => Promise<string>;
153
154
  submitProof: (block: number, address?: string) => Promise<string>;
154
155
  estimateGas: {
package/lib/index.js CHANGED
@@ -38,7 +38,7 @@ import { PoolTemplate, getPool } from "./pools/index.js";
38
38
  import { getUserPoolListByLiquidity, getUserPoolListByClaimable, getUserPoolList, getUserLiquidityUSD, getUserClaimable, } from "./pools/utils.js";
39
39
  import { getBestRouteAndOutput, swapExpected, swapPriceImpact, swapIsApproved, swapApproveEstimateGas, swapApprove, swapEstimateGas, swap, getSwappedAmount, } from "./router.js";
40
40
  import { curve as _curve } from "./curve.js";
41
- import { getCrv, getLockedAmountAndUnlockTime, getVeCrv, getVeCrvPct, calcUnlockTime, createLockEstimateGas, createLock, isApproved, approveEstimateGas, approve, increaseAmountEstimateGas, increaseAmount, increaseUnlockTimeEstimateGas, increaseUnlockTime, withdrawLockedCrvEstimateGas, withdrawLockedCrv, claimableFees, claimFeesEstimateGas, claimFees, lastBlockhash, checkBlockhash, getAnycallBalance, topUpAnycall, topUpAnycallEstimateGas, sendBlockhash, sendBlockhashEstimateGas, submitProof, submitProofEstimateGas, } from "./boosting.js";
41
+ import { getCrv, getLockedAmountAndUnlockTime, getVeCrv, getVeCrvPct, calcUnlockTime, createLockEstimateGas, createLock, isApproved, approveEstimateGas, approve, increaseAmountEstimateGas, increaseAmount, increaseUnlockTimeEstimateGas, increaseUnlockTime, withdrawLockedCrvEstimateGas, withdrawLockedCrv, claimableFees, claimFeesEstimateGas, claimFees, lastEthBlock, getAnycallBalance, topUpAnycall, topUpAnycallEstimateGas, lastBlockSent, blockToSend, sendBlockhash, sendBlockhashEstimateGas, submitProof, submitProofEstimateGas, } from "./boosting.js";
42
42
  import { getBalances, getAllowance, hasAllowance, ensureAllowanceEstimateGas, ensureAllowance, getUsdRate, getTVL, getCoinsData, getVolume, } from "./utils.js";
43
43
  import { deployStablePlainPool, deployStablePlainPoolEstimateGas, getDeployedStablePlainPoolAddress, setOracle, setOracleEstimateGas, deployStableMetaPool, deployStableMetaPoolEstimateGas, getDeployedStableMetaPoolAddress, deployCryptoPool, deployCryptoPoolEstimateGas, getDeployedCryptoPoolAddress, deployTricryptoPool, deployTricryptoPoolEstimateGas, getDeployedTricryptoPoolAddress, deployGauge, deployGaugeEstimateGas, getDeployedGaugeAddress, } from './factory/deploy.js';
44
44
  function init(providerType, providerSettings, options) {
@@ -179,10 +179,11 @@ var curve = {
179
179
  claimFees: claimFeesEstimateGas,
180
180
  },
181
181
  sidechain: {
182
- lastBlockhash: lastBlockhash,
183
- checkBlockhash: checkBlockhash,
182
+ lastEthBlock: lastEthBlock,
184
183
  getAnycallBalance: getAnycallBalance,
185
184
  topUpAnycall: topUpAnycall,
185
+ lastBlockSent: lastBlockSent,
186
+ blockToSend: blockToSend,
186
187
  sendBlockhash: sendBlockhash,
187
188
  submitProof: submitProof,
188
189
  estimateGas: {
@@ -41,6 +41,7 @@ export interface IPoolData {
41
41
  deposit_abi?: any;
42
42
  sCurveRewards_abi?: any;
43
43
  in_api?: boolean;
44
+ is_gauge_killed?: boolean;
44
45
  }
45
46
  export interface ICurve {
46
47
  provider: ethers.BrowserProvider | ethers.JsonRpcProvider;
@@ -30,6 +30,7 @@ export declare class PoolTemplate {
30
30
  wrappedDecimals: number[];
31
31
  useLending: boolean[];
32
32
  inApi: boolean;
33
+ isGaugeKilled: boolean;
33
34
  estimateGas: {
34
35
  depositApprove: (amounts: (number | string)[]) => Promise<number>;
35
36
  deposit: (amounts: (number | string)[]) => Promise<number>;
@@ -66,7 +66,7 @@ var YEAR = 365 * DAY;
66
66
  var PoolTemplate = /** @class */ (function () {
67
67
  function PoolTemplate(id) {
68
68
  var _this = this;
69
- var _c, _d;
69
+ var _c, _d, _e;
70
70
  this.statsParameters = function () { return __awaiter(_this, void 0, void 0, function () {
71
71
  var multicallContract, lpMulticallContract, calls, i, additionalCalls, _virtualPrice, _fee, _prices, _adminFee, _A, _lpTokenSupply, _gamma, e_1, _c, virtualPrice, fee, adminFee, A, lpTokenSupply, gamma, priceOracle, priceScale, prices, i, A_PRECISION, _d, _future_A, _initial_A, _future_A_time, _initial_A_time, _e, future_A, initial_A, future_A_time, initial_A_time;
72
72
  var _f, _g, _h;
@@ -1110,6 +1110,7 @@ var PoolTemplate = /** @class */ (function () {
1110
1110
  this.wrappedDecimals = poolData.wrapped_decimals;
1111
1111
  this.useLending = poolData.use_lending || poolData.underlying_coin_addresses.map(function () { return false; });
1112
1112
  this.inApi = (_d = poolData.in_api) !== null && _d !== void 0 ? _d : false;
1113
+ this.isGaugeKilled = (_e = poolData.is_gauge_killed) !== null && _e !== void 0 ? _e : false;
1113
1114
  this.estimateGas = {
1114
1115
  depositApprove: this.depositApproveEstimateGas.bind(this),
1115
1116
  deposit: this.depositEstimateGas.bind(this),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@curvefi/api",
3
- "version": "2.41.3",
3
+ "version": "2.42.1",
4
4
  "description": "JavaScript library for curve.fi",
5
5
  "main": "lib/index.js",
6
6
  "author": "Macket",