@curvefi/api 2.56.9 → 2.56.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/curve.d.ts CHANGED
@@ -37,6 +37,7 @@ declare class Curve implements ICurve {
37
37
  maxFeePerGas?: number | bigint;
38
38
  maxPriorityFeePerGas?: number | bigint;
39
39
  };
40
+ L1WeightedGasPrice?: number;
40
41
  constants: {
41
42
  NATIVE_TOKEN: {
42
43
  symbol: string;
package/lib/curve.js CHANGED
@@ -1165,16 +1165,20 @@ var Curve = /** @class */ (function () {
1165
1165
  };
1166
1166
  newEstimate = function (arg) {
1167
1167
  return __awaiter(this, void 0, void 0, function () {
1168
- var L2EstimateGas, L1GasUsed, L2GasUsed;
1168
+ var L2EstimateGas, L1GasUsed, L1Fee, L2GasUsed;
1169
1169
  return __generator(this, function (_a) {
1170
1170
  switch (_a.label) {
1171
1171
  case 0:
1172
1172
  L2EstimateGas = originalEstimate_1.bind(this);
1173
- return [4 /*yield*/, curveInstance_1.contracts[curveInstance_1.constants.ALIASES.gas_oracle].contract.getL1GasUsed(arg.data)];
1173
+ return [4 /*yield*/, curveInstance_1.contracts[curveInstance_1.constants.ALIASES.gas_oracle_blob].contract.getL1GasUsed(arg.data)];
1174
1174
  case 1:
1175
1175
  L1GasUsed = _a.sent();
1176
- return [4 /*yield*/, L2EstimateGas(arg)];
1176
+ return [4 /*yield*/, curveInstance_1.contracts[curveInstance_1.constants.ALIASES.gas_oracle_blob].contract.getL1Fee(arg.data)];
1177
1177
  case 2:
1178
+ L1Fee = _a.sent();
1179
+ curveInstance_1.L1WeightedGasPrice = Number(L1Fee) / Number(L1GasUsed);
1180
+ return [4 /*yield*/, L2EstimateGas(arg)];
1181
+ case 3:
1178
1182
  L2GasUsed = _a.sent();
1179
1183
  return [2 /*return*/, [L2GasUsed, L1GasUsed]];
1180
1184
  }
package/lib/utils.js CHANGED
@@ -705,17 +705,14 @@ export var getUsdRate = function (coin) { return __awaiter(void 0, void 0, void
705
705
  });
706
706
  }); };
707
707
  export var getGasPriceFromL1 = function () { return __awaiter(void 0, void 0, void 0, function () {
708
- var gasPrice;
709
708
  return __generator(this, function (_a) {
710
- switch (_a.label) {
711
- case 0:
712
- if (!L2Networks.includes(curve.chainId)) return [3 /*break*/, 2];
713
- return [4 /*yield*/, curve.contracts[curve.constants.ALIASES.gas_oracle].contract.l1BaseFee()];
714
- case 1:
715
- gasPrice = _a.sent();
716
- return [2 /*return*/, Number(gasPrice) + 1e9]; // + 1 gwei
717
- case 2: throw Error("This method exists only for L2 networks");
709
+ if (L2Networks.includes(curve.chainId) && curve.L1WeightedGasPrice) {
710
+ return [2 /*return*/, curve.L1WeightedGasPrice + 1e9]; // + 1 gwei
711
+ }
712
+ else {
713
+ throw Error("This method exists only for L2 networks");
718
714
  }
715
+ return [2 /*return*/];
719
716
  });
720
717
  }); };
721
718
  export var getGasPriceFromL2 = function () { return __awaiter(void 0, void 0, void 0, function () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@curvefi/api",
3
- "version": "2.56.9",
3
+ "version": "2.56.10",
4
4
  "description": "JavaScript library for curve.fi",
5
5
  "main": "lib/index.js",
6
6
  "author": "Macket",