@across-protocol/sdk 3.4.3 → 3.4.4

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 (46) hide show
  1. package/dist/cjs/gasPriceOracle/adapters/arbitrum.js.map +1 -1
  2. package/dist/cjs/gasPriceOracle/adapters/ethereum.d.ts +2 -2
  3. package/dist/cjs/gasPriceOracle/adapters/ethereum.js +12 -10
  4. package/dist/cjs/gasPriceOracle/adapters/ethereum.js.map +1 -1
  5. package/dist/cjs/gasPriceOracle/adapters/linea-viem.js.map +1 -1
  6. package/dist/cjs/gasPriceOracle/adapters/linea.js.map +1 -1
  7. package/dist/cjs/gasPriceOracle/adapters/polygon.js +6 -4
  8. package/dist/cjs/gasPriceOracle/adapters/polygon.js.map +1 -1
  9. package/dist/cjs/gasPriceOracle/oracle.d.ts +1 -0
  10. package/dist/cjs/gasPriceOracle/oracle.js +12 -10
  11. package/dist/cjs/gasPriceOracle/oracle.js.map +1 -1
  12. package/dist/esm/gasPriceOracle/adapters/arbitrum.d.ts +4 -0
  13. package/dist/esm/gasPriceOracle/adapters/arbitrum.js +4 -0
  14. package/dist/esm/gasPriceOracle/adapters/arbitrum.js.map +1 -1
  15. package/dist/esm/gasPriceOracle/adapters/ethereum.d.ts +5 -2
  16. package/dist/esm/gasPriceOracle/adapters/ethereum.js +15 -10
  17. package/dist/esm/gasPriceOracle/adapters/ethereum.js.map +1 -1
  18. package/dist/esm/gasPriceOracle/adapters/linea-viem.d.ts +5 -3
  19. package/dist/esm/gasPriceOracle/adapters/linea-viem.js +5 -3
  20. package/dist/esm/gasPriceOracle/adapters/linea-viem.js.map +1 -1
  21. package/dist/esm/gasPriceOracle/adapters/linea.d.ts +8 -0
  22. package/dist/esm/gasPriceOracle/adapters/linea.js +8 -0
  23. package/dist/esm/gasPriceOracle/adapters/linea.js.map +1 -1
  24. package/dist/esm/gasPriceOracle/adapters/polygon.js +6 -4
  25. package/dist/esm/gasPriceOracle/adapters/polygon.js.map +1 -1
  26. package/dist/esm/gasPriceOracle/oracle.d.ts +1 -0
  27. package/dist/esm/gasPriceOracle/oracle.js +12 -10
  28. package/dist/esm/gasPriceOracle/oracle.js.map +1 -1
  29. package/dist/types/gasPriceOracle/adapters/arbitrum.d.ts +4 -0
  30. package/dist/types/gasPriceOracle/adapters/arbitrum.d.ts.map +1 -1
  31. package/dist/types/gasPriceOracle/adapters/ethereum.d.ts +5 -2
  32. package/dist/types/gasPriceOracle/adapters/ethereum.d.ts.map +1 -1
  33. package/dist/types/gasPriceOracle/adapters/linea-viem.d.ts +5 -3
  34. package/dist/types/gasPriceOracle/adapters/linea-viem.d.ts.map +1 -1
  35. package/dist/types/gasPriceOracle/adapters/linea.d.ts +8 -0
  36. package/dist/types/gasPriceOracle/adapters/linea.d.ts.map +1 -1
  37. package/dist/types/gasPriceOracle/adapters/polygon.d.ts.map +1 -1
  38. package/dist/types/gasPriceOracle/oracle.d.ts +1 -0
  39. package/dist/types/gasPriceOracle/oracle.d.ts.map +1 -1
  40. package/package.json +1 -1
  41. package/src/gasPriceOracle/adapters/arbitrum.ts +4 -0
  42. package/src/gasPriceOracle/adapters/ethereum.ts +15 -8
  43. package/src/gasPriceOracle/adapters/linea-viem.ts +5 -3
  44. package/src/gasPriceOracle/adapters/linea.ts +8 -0
  45. package/src/gasPriceOracle/adapters/polygon.ts +5 -3
  46. package/src/gasPriceOracle/oracle.ts +9 -0
@@ -1 +1 @@
1
- {"version":3,"file":"arbitrum.js","sourceRoot":"","sources":["../../../../src/gasPriceOracle/adapters/arbitrum.ts"],"names":[],"mappings":";;;;AACA,qCAAoC;AAEpC,2DAAuC;AAWvC,SAAsB,OAAO,CAAC,QAA4B,EAAE,IAA6B;;;;;wBACzB,WAAM,QAAQ,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,EAAA;;oBAA9F,KAAwD,SAAsC,EAA9E,aAAa,kBAAA,EAAE,oBAAoB,0BAAA;oBAInD,YAAY,GAAG,aAAa,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC,GAAG,CAAC,aAAK,CAAC,CAAC;oBAExE,WAAO,EAAE,oBAAoB,EAAE,aAAK,EAAE,YAAY,cAAA,EAAE,EAAC;;;;CACtD;AARD,0BAQC"}
1
+ {"version":3,"file":"arbitrum.js","sourceRoot":"","sources":["../../../../src/gasPriceOracle/adapters/arbitrum.ts"],"names":[],"mappings":";;;;AACA,qCAAoC;AAEpC,2DAAuC;AAevC,SAAsB,OAAO,CAAC,QAA4B,EAAE,IAA6B;;;;;wBACzB,WAAM,QAAQ,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,EAAA;;oBAA9F,KAAwD,SAAsC,EAA9E,aAAa,kBAAA,EAAE,oBAAoB,0BAAA;oBAInD,YAAY,GAAG,aAAa,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC,GAAG,CAAC,aAAK,CAAC,CAAC;oBAExE,WAAO,EAAE,oBAAoB,EAAE,aAAK,EAAE,YAAY,cAAA,EAAE,EAAC;;;;CACtD;AARD,0BAQC"}
@@ -3,6 +3,6 @@ import { BigNumber } from "../../utils";
3
3
  import { GasPriceEstimate } from "../types";
4
4
  import { GasPriceEstimateOptions } from "../oracle";
5
5
  export declare function eip1559(provider: providers.Provider, opts: GasPriceEstimateOptions): Promise<GasPriceEstimate>;
6
- export declare function eip1559Raw(provider: providers.Provider, chainId: number, baseFeeMultiplier: BigNumber): Promise<GasPriceEstimate>;
7
- export declare function eip1559Bad(provider: providers.Provider, chainId: number, baseFeeMultiplier: BigNumber): Promise<GasPriceEstimate>;
6
+ export declare function eip1559Raw(provider: providers.Provider, chainId: number, baseFeeMultiplier: BigNumber, priorityFeeMultiplier: BigNumber): Promise<GasPriceEstimate>;
7
+ export declare function eip1559Bad(provider: providers.Provider, chainId: number, baseFeeMultiplier: BigNumber, priorityFeeMultiplier: BigNumber): Promise<GasPriceEstimate>;
8
8
  export declare function legacy(provider: providers.Provider, opts: GasPriceEstimateOptions): Promise<GasPriceEstimate>;
@@ -8,13 +8,13 @@ var util_1 = require("../util");
8
8
  function eip1559(provider, opts) {
9
9
  var useRaw = process.env["GAS_PRICE_EIP1559_RAW_".concat(opts.chainId)] === "true";
10
10
  return useRaw
11
- ? eip1559Raw(provider, opts.chainId, opts.baseFeeMultiplier)
12
- : eip1559Bad(provider, opts.chainId, opts.baseFeeMultiplier);
11
+ ? eip1559Raw(provider, opts.chainId, opts.baseFeeMultiplier, opts.priorityFeeMultiplier)
12
+ : eip1559Bad(provider, opts.chainId, opts.baseFeeMultiplier, opts.priorityFeeMultiplier);
13
13
  }
14
14
  exports.eip1559 = eip1559;
15
- function eip1559Raw(provider, chainId, baseFeeMultiplier) {
15
+ function eip1559Raw(provider, chainId, baseFeeMultiplier, priorityFeeMultiplier) {
16
16
  return tslib_1.__awaiter(this, void 0, void 0, function () {
17
- var _a, baseFeePerGas, _maxPriorityFeePerGas, maxPriorityFeePerGas, scaledBaseFee;
17
+ var _a, baseFeePerGas, _maxPriorityFeePerGas, maxPriorityFeePerGas, scaledPriorityFee, scaledBaseFee;
18
18
  return tslib_1.__generator(this, function (_b) {
19
19
  switch (_b.label) {
20
20
  case 0: return [4, Promise.all([
@@ -25,19 +25,20 @@ function eip1559Raw(provider, chainId, baseFeeMultiplier) {
25
25
  _a = _b.sent(), baseFeePerGas = _a[0].baseFeePerGas, _maxPriorityFeePerGas = _a[1];
26
26
  maxPriorityFeePerGas = utils_1.BigNumber.from(_maxPriorityFeePerGas);
27
27
  (0, assert_1.default)(utils_1.BigNumber.isBigNumber(baseFeePerGas), "No baseFeePerGas received on ".concat((0, utils_1.getNetworkName)(chainId)));
28
+ scaledPriorityFee = maxPriorityFeePerGas.mul(priorityFeeMultiplier).div(utils_1.fixedPointAdjustment);
28
29
  scaledBaseFee = baseFeePerGas.mul(baseFeeMultiplier).div(utils_1.fixedPointAdjustment);
29
30
  return [2, {
30
- maxFeePerGas: maxPriorityFeePerGas.add(scaledBaseFee),
31
- maxPriorityFeePerGas: maxPriorityFeePerGas,
31
+ maxFeePerGas: scaledPriorityFee.add(scaledBaseFee),
32
+ maxPriorityFeePerGas: scaledPriorityFee,
32
33
  }];
33
34
  }
34
35
  });
35
36
  });
36
37
  }
37
38
  exports.eip1559Raw = eip1559Raw;
38
- function eip1559Bad(provider, chainId, baseFeeMultiplier) {
39
+ function eip1559Bad(provider, chainId, baseFeeMultiplier, priorityFeeMultiplier) {
39
40
  return tslib_1.__awaiter(this, void 0, void 0, function () {
40
- var feeData, maxPriorityFeePerGas, scaledLastBaseFeePerGas, maxFeePerGas;
41
+ var feeData, maxPriorityFeePerGas, scaledPriorityFee, scaledLastBaseFeePerGas, maxFeePerGas;
41
42
  return tslib_1.__generator(this, function (_a) {
42
43
  switch (_a.label) {
43
44
  case 0: return [4, provider.getFeeData()];
@@ -48,11 +49,12 @@ function eip1559Bad(provider, chainId, baseFeeMultiplier) {
48
49
  (0, util_1.gasPriceError)("getFeeData()", chainId, feeData);
49
50
  });
50
51
  maxPriorityFeePerGas = feeData.maxPriorityFeePerGas;
52
+ scaledPriorityFee = maxPriorityFeePerGas.mul(priorityFeeMultiplier).div(utils_1.fixedPointAdjustment);
51
53
  scaledLastBaseFeePerGas = feeData.lastBaseFeePerGas
52
54
  .mul(baseFeeMultiplier)
53
55
  .div(utils_1.fixedPointAdjustment);
54
- maxFeePerGas = maxPriorityFeePerGas.add(scaledLastBaseFeePerGas);
55
- return [2, { maxPriorityFeePerGas: maxPriorityFeePerGas, maxFeePerGas: maxFeePerGas }];
56
+ maxFeePerGas = scaledPriorityFee.add(scaledLastBaseFeePerGas);
57
+ return [2, { maxPriorityFeePerGas: scaledPriorityFee, maxFeePerGas: maxFeePerGas }];
56
58
  }
57
59
  });
58
60
  });
@@ -1 +1 @@
1
- {"version":3,"file":"ethereum.js","sourceRoot":"","sources":["../../../../src/gasPriceOracle/adapters/ethereum.ts"],"names":[],"mappings":";;;;AAAA,0DAA4B;AAE5B,qCAAsF;AAEtF,gCAAwC;AA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,CAAC,CAAC;oBAExG,WAAO;4BACL,YAAY,EAAE,aAAa,GAAG,iBAAiB;4BAC/C,oBAAoB,EAAE,iBAAiB;yBACxC,EAAC;;;;CACH;AAlBD,0BAkBC"}
1
+ {"version":3,"file":"linea-viem.js","sourceRoot":"","sources":["../../../../src/gasPriceOracle/adapters/linea-viem.ts"],"names":[],"mappings":";;;;AACA,oCAAyC;AACzC,6CAA+E;AAG/E,qCAAmD;AAqBnD,SAAsB,OAAO,CAC3B,QAAsB,EACtB,IAA6B;;;;;;;oBAErB,UAAU,GAAwB,IAAI,WAA5B,EAAE,iBAAiB,GAAK,IAAI,kBAAT,CAAU;oBACkB,WAAM,IAAA,mBAAW,EAAC,QAAQ,EAAE;4BAC3F,OAAO,EAAE,MAAC,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,IAAgB,mCAAI,6CAAO;4BACjD,EAAE,EAAE,MAAC,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,EAAc,mCAAI,6CAAO;4BAC1C,KAAK,EAAE,MAAM,CAAC,MAAA,MAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,KAAK,0CAAE,QAAQ,EAAE,mCAAI,GAAG,CAAC;4BACnD,IAAI,EAAE,MAAC,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,IAAY,mCAAI,IAAI;yBACxC,CAAC,EAAA;;oBALI,KAA2D,SAK/D,EALM,aAAa,mBAAA,EAAqB,kBAAkB,uBAAA;oBAMtD,iBAAiB,GACrB,CAAC,kBAAkB,GAAG,MAAM,CAAC,iBAAiB,CAAC,QAAQ,EAAE,CAAC,CAAC,GAAG,MAAM,CAAC,4BAAoB,CAAC,QAAQ,EAAE,CAAC,CAAC;oBAExG,WAAO;4BACL,YAAY,EAAE,aAAa,GAAG,iBAAiB;4BAC/C,oBAAoB,EAAE,iBAAiB;yBACxC,EAAC;;;;CACH;AAlBD,0BAkBC"}
@@ -1 +1 @@
1
- {"version":3,"file":"linea.js","sourceRoot":"","sources":["../../../../src/gasPriceOracle/adapters/linea.ts"],"names":[],"mappings":";;;;AAMA,2DAAuC;AAGvC,SAAgB,OAAO,CAAC,QAA4B,EAAE,IAA6B;IAKjF,OAAO,QAAQ,CAAC,MAAM,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;AACzC,CAAC;AAND,0BAMC"}
1
+ {"version":3,"file":"linea.js","sourceRoot":"","sources":["../../../../src/gasPriceOracle/adapters/linea.ts"],"names":[],"mappings":";;;;AAMA,2DAAuC;AAWvC,SAAgB,OAAO,CAAC,QAA4B,EAAE,IAA6B;IAKjF,OAAO,QAAQ,CAAC,MAAM,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;AACzC,CAAC;AAND,0BAMC"}
@@ -83,12 +83,12 @@ var MockPolygonGasStation = (function (_super) {
83
83
  }(PolygonGasStation));
84
84
  function gasStation(provider, opts) {
85
85
  return tslib_1.__awaiter(this, void 0, void 0, function () {
86
- var chainId, baseFeeMultiplier, gasStation, maxPriorityFeePerGas, maxFeePerGas, baseFeeMinusPriorityFee, scaledBaseFee, err_1, minPriorityFee, priorityDelta;
86
+ var chainId, baseFeeMultiplier, priorityFeeMultiplier, gasStation, maxPriorityFeePerGas, maxFeePerGas, baseFeeMinusPriorityFee, scaledBaseFee, scaledPriorityFee, err_1, minPriorityFee, priorityDelta;
87
87
  var _a, _b;
88
88
  return tslib_1.__generator(this, function (_c) {
89
89
  switch (_c.label) {
90
90
  case 0:
91
- chainId = opts.chainId, baseFeeMultiplier = opts.baseFeeMultiplier;
91
+ chainId = opts.chainId, baseFeeMultiplier = opts.baseFeeMultiplier, priorityFeeMultiplier = opts.priorityFeeMultiplier;
92
92
  if (process.env.TEST_POLYGON_GAS_STATION === "true") {
93
93
  gasStation = new MockPolygonGasStation();
94
94
  }
@@ -106,14 +106,16 @@ function gasStation(provider, opts) {
106
106
  (_a = _c.sent(), maxPriorityFeePerGas = _a.maxPriorityFeePerGas, maxFeePerGas = _a.maxFeePerGas);
107
107
  baseFeeMinusPriorityFee = maxFeePerGas.sub(maxPriorityFeePerGas);
108
108
  scaledBaseFee = baseFeeMinusPriorityFee.mul(baseFeeMultiplier).div(utils_1.fixedPointAdjustment);
109
- maxFeePerGas = scaledBaseFee.add(maxPriorityFeePerGas);
109
+ scaledPriorityFee = maxPriorityFeePerGas.mul(priorityFeeMultiplier).div(utils_1.fixedPointAdjustment);
110
+ maxFeePerGas = scaledBaseFee.add(scaledPriorityFee);
111
+ maxPriorityFeePerGas = scaledPriorityFee;
110
112
  return [3, 5];
111
113
  case 3:
112
114
  err_1 = _c.sent();
113
115
  return [4, (0, ethereum_1.eip1559)(provider, opts)];
114
116
  case 4:
115
117
  (_b = _c.sent(), maxPriorityFeePerGas = _b.maxPriorityFeePerGas, maxFeePerGas = _b.maxFeePerGas);
116
- minPriorityFee = (0, utils_1.parseUnits)("30", 9);
118
+ minPriorityFee = (0, utils_1.parseUnits)("30", 9).mul(priorityFeeMultiplier).div(utils_1.fixedPointAdjustment);
117
119
  if (maxPriorityFeePerGas.lt(minPriorityFee)) {
118
120
  priorityDelta = minPriorityFee.sub(maxPriorityFeePerGas);
119
121
  maxPriorityFeePerGas = minPriorityFee;
@@ -1 +1 @@
1
- {"version":3,"file":"polygon.js","sourceRoot":"","sources":["../../../../src/gasPriceOracle/adapters/polygon.ts"],"names":[],"mappings":";;;;AACA,sEAA8F;AAC9F,qCAA6F;AAC7F,6CAA4C;AAE5C,gCAAwC;AACxC,uCAAqC;AAsB7B,IAAA,OAAO,GAAK,qBAAS,QAAd,CAAe;AAE9B;IAAuC,6CAAe;IAGpD,2BAAY,EAA6E;QAAzF,iBAKC;YALW,qBAA2E,EAAE,KAAA,EAA3E,eAAiB,EAAjB,OAAO,mBAAG,OAAO,KAAA,EAAE,IAAI,UAAA,EAAE,eAAc,EAAd,OAAO,mBAAG,IAAI,KAAA,EAAE,eAAW,EAAX,OAAO,mBAAG,CAAC,KAAA;QAChE,IAAI,GAAG,CAAA,IAAI,aAAJ,IAAI,c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AAY,kBAAA,CAAmC,CAAC;oBAGnE,uBAAuB,GAAG,YAAY,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;oBACjE,aAAa,GAAG,uBAAuB,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC,GAAG,CAAC,4BAAoB,CAAC,CAAC;oBACzF,iBAAiB,GAAG,oBAAoB,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC,GAAG,CAAC,4BAAoB,CAAC,CAAC;oBACpG,YAAY,GAAG,aAAa,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;oBACpD,oBAAoB,GAAG,iBAAiB,CAAC;;;;oBAGC,WAAM,IAAA,kBAAO,EAAC,QAAQ,EAAE,IAAI,CAAC,EAAA;;oBAAvE,CAAC,KAAyC,SAA6B,EAApE,oBAAoB,0BAAA,EAAE,YAAY,kBAAA,CAAmC,CAAC;oBAInE,cAAc,GAAG,IAAA,kBAAU,EAAC,IAAI,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC,GAAG,CAAC,4BAAoB,CAAC,CAAC;oBAChG,IAAI,oBAAoB,CAAC,EAAE,CAAC,cAAc,CAAC,EAAE;wBACrC,aAAa,GAAG,cAAc,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;wBAC/D,oBAAoB,GAAG,cAAc,CAAC;wBACtC,YAAY,GAAG,YAAY,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;qBAChD;;wBAGH,WAAO,EAAE,oBAAoB,sBAAA,EAAE,YAAY,cAAA,EAAE,EAAC;;;;CAC/C;AAvCD,gCAuCC"}
@@ -4,6 +4,7 @@ import { BigNumber } from "../utils";
4
4
  import { GasPriceEstimate } from "./types";
5
5
  export interface GasPriceEstimateOptions {
6
6
  baseFeeMultiplier: BigNumber;
7
+ priorityFeeMultiplier: BigNumber;
7
8
  legacyFallback: boolean;
8
9
  chainId: number;
9
10
  unsignedTx?: PopulatedTransaction;
@@ -15,25 +15,27 @@ var GAS_PRICE_ESTIMATE_DEFAULTS = {
15
15
  legacyFallback: true,
16
16
  };
17
17
  function getGasPriceEstimate(provider, opts) {
18
- var _a, _b;
18
+ var _a, _b, _c;
19
19
  if (opts === void 0) { opts = {}; }
20
20
  return tslib_1.__awaiter(this, void 0, void 0, function () {
21
- var baseFeeMultiplier, chainId, _c, optsWithDefaults, useViem;
22
- return tslib_1.__generator(this, function (_d) {
23
- switch (_d.label) {
21
+ var baseFeeMultiplier, priorityFeeMultiplier, chainId, _d, optsWithDefaults, useViem;
22
+ return tslib_1.__generator(this, function (_e) {
23
+ switch (_e.label) {
24
24
  case 0:
25
25
  baseFeeMultiplier = (_a = opts.baseFeeMultiplier) !== null && _a !== void 0 ? _a : (0, utils_1.toBNWei)("1");
26
26
  (0, assert_1.default)(baseFeeMultiplier.gte((0, utils_1.toBNWei)("1.0")) && baseFeeMultiplier.lte((0, utils_1.toBNWei)("5")), "Require 1.0 < base fee multiplier (".concat(baseFeeMultiplier, ") <= 5.0 for a total gas multiplier within [+1.0, +5.0]"));
27
- if (!((_b = opts.chainId) !== null && _b !== void 0)) return [3, 1];
28
- _c = _b;
27
+ priorityFeeMultiplier = (_b = opts.priorityFeeMultiplier) !== null && _b !== void 0 ? _b : (0, utils_1.toBNWei)("1");
28
+ (0, assert_1.default)(priorityFeeMultiplier.gte((0, utils_1.toBNWei)("1.0")) && priorityFeeMultiplier.lte((0, utils_1.toBNWei)("5")), "Require 1.0 < priority fee multiplier (".concat(priorityFeeMultiplier, ") <= 5.0 for a total gas multiplier within [+1.0, +5.0]"));
29
+ if (!((_c = opts.chainId) !== null && _c !== void 0)) return [3, 1];
30
+ _d = _c;
29
31
  return [3, 3];
30
32
  case 1: return [4, provider.getNetwork()];
31
33
  case 2:
32
- _c = (_d.sent()).chainId;
33
- _d.label = 3;
34
+ _d = (_e.sent()).chainId;
35
+ _e.label = 3;
34
36
  case 3:
35
- chainId = _c;
36
- optsWithDefaults = tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, GAS_PRICE_ESTIMATE_DEFAULTS), { baseFeeMultiplier: baseFeeMultiplier }), opts), { chainId: chainId });
37
+ chainId = _d;
38
+ optsWithDefaults = tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, GAS_PRICE_ESTIMATE_DEFAULTS), { baseFeeMultiplier: baseFeeMultiplier, priorityFeeMultiplier: priorityFeeMultiplier }), opts), { chainId: chainId });
37
39
  useViem = process.env["NEW_GAS_PRICE_ORACLE_".concat(chainId)] === "true";
38
40
  return [2, useViem
39
41
  ? _getViemGasPriceEstimate(chainId, optsWithDefaults)
@@ -1 +1 @@
1
- {"version":3,"file":"oracle.js","sourceRoot":"","sources":["../../../src/gasPriceOracle/oracle.ts"],"names":[],"mappings":";;;;AAAA,0DAA4B;AAG5B,0CAAyC;AACzC,kCAAoF;AAEpF,+BAAyC;AACzC,oEAAgD;AAChD,oEAAgD;AAChD,8DAA0C;AAC1C,kEAA8C;AAC9C,uEAAmD;AAenD,IAAM,2BAA2B,GAAG;IAClC,cAAc,EAAE,IAAI;CACrB,CAAC;AAQF,SAAsB,mBAAmB,CACvC,QAA4B,EAC5B,IAA2C;;IAA3C,qBAAA,EAAA,SAA2C;;;;;;oBAErC,iBAAiB,GAAG,MAAA,IAAI,CAAC,iBAAiB,mCAAI,IAAA,eAAO,EAAC,GAAG,CAAC,CAAC;oBACjE,IAAA,gBAAM,EACJ,iBAAiB,CAAC,GAAG,CAAC,IAAA,eAAO,EAAC,KAAK,CAAC,CAAC,IAAI,iBAAiB,CAAC,GAAG,CAAC,IAAA,eAAO,EAAC,GAAG,CAAC,CAAC,EAC5E,6CAAsC,iBAAiB,4DAAyD,CACjH,CAAC;gCACc,IAAI,CAAC,OAAO;;;wBAAK,WAAM,QAAQ,CAAC,UAAU,EAAE,EAAA;;oBAA5B,KAAA,CAAC,SAA2B,CAAC,CAAC,OAAO,CAAA;;;oBAA/D,OAAO,KAAwD;oBAC/D,gBAAgB,2EACjB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ApB,oBAAoB,cAApB,oBAAoB,IAApB,oBAAoB,GAAK,MAAM,CAAC,CAAC,CAAC,EAAC;;wBAGrC,WAAO;wBACL,YAAY,EAAE,iBAAS,CAAC,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAC;wBACrD,oBAAoB,EAAE,iBAAS,CAAC,IAAI,CAAC,oBAAoB,CAAC,QAAQ,EAAE,CAAC;qBACtE,EAAC;;;;CACH;AA9BD,4DA8BC"}
@@ -7,6 +7,10 @@ import { GasPriceEstimateOptions } from "../oracle";
7
7
  * Reference: https://docs.arbitrum.io/how-arbitrum-works/gas-fees so we hardcode the priority fee
8
8
  * to 1 wei.
9
9
  * @param provider Ethers Provider
10
+ * @param opts See notes below on specific parameters.
11
+ * @param baseFeeMultiplier Amount to multiply base fee.
12
+ * @param priorityFeeMultiplier Unused in this function because arbitrum priority fee is hardcoded to 1 wei by this
13
+ * function.
10
14
  * @returns GasPriceEstimate
11
15
  */
12
16
  export declare function eip1559(provider: providers.Provider, opts: GasPriceEstimateOptions): Promise<GasPriceEstimate>;
@@ -7,6 +7,10 @@ import * as ethereum from "./ethereum";
7
7
  * Reference: https://docs.arbitrum.io/how-arbitrum-works/gas-fees so we hardcode the priority fee
8
8
  * to 1 wei.
9
9
  * @param provider Ethers Provider
10
+ * @param opts See notes below on specific parameters.
11
+ * @param baseFeeMultiplier Amount to multiply base fee.
12
+ * @param priorityFeeMultiplier Unused in this function because arbitrum priority fee is hardcoded to 1 wei by this
13
+ * function.
10
14
  * @returns GasPriceEstimate
11
15
  */
12
16
  export function eip1559(provider, opts) {
@@ -1 +1 @@
1
- {"version":3,"file":"arbitrum.js","sourceRoot":"","sources":["../../../../src/gasPriceOracle/adapters/arbitrum.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAC;AAGvC;;;;;;;GAOG;AACH,MAAM,UAAgB,OAAO,CAAC,QAA4B,EAAE,IAA6B;;;;;wBACzB,qBAAM,QAAQ,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,EAAA;;oBAA9F,KAAwD,SAAsC,EAA9E,aAAa,kBAAA,EAAE,oBAAoB,0BAAA;oBAInD,YAAY,GAAG,aAAa,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;oBAExE,sBAAO,EAAE,oBAAoB,EAAE,KAAK,EAAE,YAAY,cAAA,EAAE,EAAC;;;;CACtD"}
1
+ {"version":3,"file":"arbitrum.js","sourceRoot":"","sources":["../../../../src/gasPriceOracle/adapters/arbitrum.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAC;AAGvC;;;;;;;;;;;GAWG;AACH,MAAM,UAAgB,OAAO,CAAC,QAA4B,EAAE,IAA6B;;;;;wBACzB,qBAAM,QAAQ,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,EAAA;;oBAA9F,KAAwD,SAAsC,EAA9E,aAAa,kBAAA,EAAE,oBAAoB,0BAAA;oBAInD,YAAY,GAAG,aAAa,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;oBAExE,sBAAO,EAAE,oBAAoB,EAAE,KAAK,EAAE,YAAY,cAAA,EAAE,EAAC;;;;CACtD"}
@@ -7,6 +7,9 @@ import { GasPriceEstimateOptions } from "../oracle";
7
7
  * eth_getBlock("pending").baseFee to eth_maxPriorityFeePerGas, otherwise calls the ethers provider's
8
8
  * getFeeData() method which adds eth_getBlock("latest").baseFee to a hardcoded priority fee of 1.5 gwei.
9
9
  * @param provider ethers RPC provider instance.
10
+ * @param {GasPriceEstimateOptions} opts See notes below on specific parameters.
11
+ * @param baseFeeMultiplier Amount to multiply base fee or total fee for legacy gas pricing.
12
+ * @param priorityFeeMultiplier Amount to multiply priority fee or unused for legacy gas pricing.
10
13
  * @returns Promise of gas price estimate object.
11
14
  */
12
15
  export declare function eip1559(provider: providers.Provider, opts: GasPriceEstimateOptions): Promise<GasPriceEstimate>;
@@ -17,7 +20,7 @@ export declare function eip1559(provider: providers.Provider, opts: GasPriceEsti
17
20
  * @param chainId Chain ID of the provider instance.
18
21
  * @returns Promise of gas price estimate object.
19
22
  */
20
- export declare function eip1559Raw(provider: providers.Provider, chainId: number, baseFeeMultiplier: BigNumber): Promise<GasPriceEstimate>;
23
+ export declare function eip1559Raw(provider: providers.Provider, chainId: number, baseFeeMultiplier: BigNumber, priorityFeeMultiplier: BigNumber): Promise<GasPriceEstimate>;
21
24
  /**
22
25
  * @notice Returns fee data using provider's getFeeData() method.
23
26
  * @note Resolves priority gas pricing poorly, because the priority fee is hardcoded to 1.5 Gwei in ethers v5's
@@ -27,7 +30,7 @@ export declare function eip1559Raw(provider: providers.Provider, chainId: number
27
30
  * @param chainId Chain ID of the provider instance.
28
31
  * @returns Promise of gas price estimate object.
29
32
  */
30
- export declare function eip1559Bad(provider: providers.Provider, chainId: number, baseFeeMultiplier: BigNumber): Promise<GasPriceEstimate>;
33
+ export declare function eip1559Bad(provider: providers.Provider, chainId: number, baseFeeMultiplier: BigNumber, priorityFeeMultiplier: BigNumber): Promise<GasPriceEstimate>;
31
34
  /**
32
35
  * @notice Returns result of eth_gasPrice RPC call
33
36
  * @dev Its recommended to use the eip1559Raw method over this one where possible as it will be more accurate.
@@ -10,13 +10,16 @@ import { gasPriceError } from "../util";
10
10
  * eth_getBlock("pending").baseFee to eth_maxPriorityFeePerGas, otherwise calls the ethers provider's
11
11
  * getFeeData() method which adds eth_getBlock("latest").baseFee to a hardcoded priority fee of 1.5 gwei.
12
12
  * @param provider ethers RPC provider instance.
13
+ * @param {GasPriceEstimateOptions} opts See notes below on specific parameters.
14
+ * @param baseFeeMultiplier Amount to multiply base fee or total fee for legacy gas pricing.
15
+ * @param priorityFeeMultiplier Amount to multiply priority fee or unused for legacy gas pricing.
13
16
  * @returns Promise of gas price estimate object.
14
17
  */
15
18
  export function eip1559(provider, opts) {
16
19
  var useRaw = process.env["GAS_PRICE_EIP1559_RAW_".concat(opts.chainId)] === "true";
17
20
  return useRaw
18
- ? eip1559Raw(provider, opts.chainId, opts.baseFeeMultiplier)
19
- : eip1559Bad(provider, opts.chainId, opts.baseFeeMultiplier);
21
+ ? eip1559Raw(provider, opts.chainId, opts.baseFeeMultiplier, opts.priorityFeeMultiplier)
22
+ : eip1559Bad(provider, opts.chainId, opts.baseFeeMultiplier, opts.priorityFeeMultiplier);
20
23
  }
21
24
  /**
22
25
  * @note Performs direct RPC calls to retrieve the RPC-suggested priority fee for the next block.
@@ -25,9 +28,9 @@ export function eip1559(provider, opts) {
25
28
  * @param chainId Chain ID of the provider instance.
26
29
  * @returns Promise of gas price estimate object.
27
30
  */
28
- export function eip1559Raw(provider, chainId, baseFeeMultiplier) {
31
+ export function eip1559Raw(provider, chainId, baseFeeMultiplier, priorityFeeMultiplier) {
29
32
  return __awaiter(this, void 0, void 0, function () {
30
- var _a, baseFeePerGas, _maxPriorityFeePerGas, maxPriorityFeePerGas, scaledBaseFee;
33
+ var _a, baseFeePerGas, _maxPriorityFeePerGas, maxPriorityFeePerGas, scaledPriorityFee, scaledBaseFee;
31
34
  return __generator(this, function (_b) {
32
35
  switch (_b.label) {
33
36
  case 0: return [4 /*yield*/, Promise.all([
@@ -38,10 +41,11 @@ export function eip1559Raw(provider, chainId, baseFeeMultiplier) {
38
41
  _a = _b.sent(), baseFeePerGas = _a[0].baseFeePerGas, _maxPriorityFeePerGas = _a[1];
39
42
  maxPriorityFeePerGas = BigNumber.from(_maxPriorityFeePerGas);
40
43
  assert(BigNumber.isBigNumber(baseFeePerGas), "No baseFeePerGas received on ".concat(getNetworkName(chainId)));
44
+ scaledPriorityFee = maxPriorityFeePerGas.mul(priorityFeeMultiplier).div(fixedPointAdjustment);
41
45
  scaledBaseFee = baseFeePerGas.mul(baseFeeMultiplier).div(fixedPointAdjustment);
42
46
  return [2 /*return*/, {
43
- maxFeePerGas: maxPriorityFeePerGas.add(scaledBaseFee),
44
- maxPriorityFeePerGas: maxPriorityFeePerGas,
47
+ maxFeePerGas: scaledPriorityFee.add(scaledBaseFee),
48
+ maxPriorityFeePerGas: scaledPriorityFee,
45
49
  }];
46
50
  }
47
51
  });
@@ -56,9 +60,9 @@ export function eip1559Raw(provider, chainId, baseFeeMultiplier) {
56
60
  * @param chainId Chain ID of the provider instance.
57
61
  * @returns Promise of gas price estimate object.
58
62
  */
59
- export function eip1559Bad(provider, chainId, baseFeeMultiplier) {
63
+ export function eip1559Bad(provider, chainId, baseFeeMultiplier, priorityFeeMultiplier) {
60
64
  return __awaiter(this, void 0, void 0, function () {
61
- var feeData, maxPriorityFeePerGas, scaledLastBaseFeePerGas, maxFeePerGas;
65
+ var feeData, maxPriorityFeePerGas, scaledPriorityFee, scaledLastBaseFeePerGas, maxFeePerGas;
62
66
  return __generator(this, function (_a) {
63
67
  switch (_a.label) {
64
68
  case 0: return [4 /*yield*/, provider.getFeeData()];
@@ -69,11 +73,12 @@ export function eip1559Bad(provider, chainId, baseFeeMultiplier) {
69
73
  gasPriceError("getFeeData()", chainId, feeData);
70
74
  });
71
75
  maxPriorityFeePerGas = feeData.maxPriorityFeePerGas;
76
+ scaledPriorityFee = maxPriorityFeePerGas.mul(priorityFeeMultiplier).div(fixedPointAdjustment);
72
77
  scaledLastBaseFeePerGas = feeData.lastBaseFeePerGas
73
78
  .mul(baseFeeMultiplier)
74
79
  .div(fixedPointAdjustment);
75
- maxFeePerGas = maxPriorityFeePerGas.add(scaledLastBaseFeePerGas);
76
- return [2 /*return*/, { maxPriorityFeePerGas: maxPriorityFeePerGas, maxFeePerGas: maxFeePerGas }];
80
+ maxFeePerGas = scaledPriorityFee.add(scaledLastBaseFeePerGas);
81
+ return [2 /*return*/, { maxPriorityFeePerGas: scaledPriorityFee, maxFeePerGas: maxFeePerGas }];
77
82
  }
78
83
  });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C,CAAC;oBAC9F,uBAAuB,GAAI,OAAO,CAAC,iBAA+B;yBACrE,GAAG,CAAC,iBAAiB,CAAC;yBACtB,GAAG,CAAC,oBAAoB,CAAC,CAAC;oBACvB,YAAY,GAAG,iBAAiB,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC;oBAEpE,sBAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,YAAY,cAAA,EAAE,EAAC;;;;CAClE;AAED;;;;GAIG;AACH,MAAM,UAAgB,MAAM,CAAC,QAA4B,EAAE,IAA6B;;;;;;oBAC9E,OAAO,GAAwB,IAAI,QAA5B,EAAE,iBAAiB,GAAK,IAAI,kBAAT,CAAU;oBAC3B,qBAAM,QAAQ,CAAC,WAAW,EAAE,EAAA;;oBAAvC,QAAQ,GAAG,SAA4B;oBAE7C,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC,EAAE,CAAC,MAAM,CAAC;wBAAE,aAAa,CAAC,eAAe,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;oBAE/G,sBAAO;4BACL,YAAY,EAAE,QAAQ,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC,GAAG,CAAC,oBAAoB,CAAC;4BACvE,oBAAoB,EAAE,MAAM;yBAC7B,EAAC;;;;CACH"}
@@ -11,10 +11,12 @@ import { GasPriceEstimateOptions } from "../oracle";
11
11
  * @dev Because the Linea priority fee is more volatile than the base fee, the base fee multiplier will be applied
12
12
  * to the priority fee.
13
13
  * @param provider Viem PublicClient
14
- * @param _chainId Unused in this adapter
14
+ * @param opts Relevant options for Linea are baseFeeMultiplier and unsignedTx.
15
15
  * @param baseFeeMultiplier Amount to multiply priority fee, since Linea's base fee is hardcoded while its priority
16
- * fee is dynamic
17
- * @param _unsignedTx Should contain any params passed to linea_estimateGas, which are listed
16
+ * fee is dynamic.
17
+ * @param priorityFeeMultiplier Unused in this function because the baseFeeMultiplier is applied to the dynamic
18
+ * Linea priority fee while the base fee is hardcoded.
19
+ * @param unsignedTx Should contain any params passed to linea_estimateGas, which are listed
18
20
  * here: https://docs.linea.build/api/reference/linea-estimategas#parameters
19
21
  * @returns
20
22
  */
@@ -12,10 +12,12 @@ import { fixedPointAdjustment } from "../../utils";
12
12
  * @dev Because the Linea priority fee is more volatile than the base fee, the base fee multiplier will be applied
13
13
  * to the priority fee.
14
14
  * @param provider Viem PublicClient
15
- * @param _chainId Unused in this adapter
15
+ * @param opts Relevant options for Linea are baseFeeMultiplier and unsignedTx.
16
16
  * @param baseFeeMultiplier Amount to multiply priority fee, since Linea's base fee is hardcoded while its priority
17
- * fee is dynamic
18
- * @param _unsignedTx Should contain any params passed to linea_estimateGas, which are listed
17
+ * fee is dynamic.
18
+ * @param priorityFeeMultiplier Unused in this function because the baseFeeMultiplier is applied to the dynamic
19
+ * Linea priority fee while the base fee is hardcoded.
20
+ * @param unsignedTx Should contain any params passed to linea_estimateGas, which are listed
19
21
  * here: https://docs.linea.build/api/reference/linea-estimategas#parameters
20
22
  * @returns
21
23
  */
@@ -1 +1 @@
1
- {"version":3,"file":"linea-viem.js","sourceRoot":"","sources":["../../../../src/gasPriceOracle/adapters/linea-viem.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,iCAAiC,IAAI,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAG/E,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAEnD;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAgB,OAAO,CAC3B,QAAsB,EACtB,IAA6B;;;;;;;oBAErB,UAAU,GAAwB,IAAI,WAA5B,EAAE,iBAAiB,GAAK,IAAI,kBAAT,CAAU;oBACkB,qBAAM,WAAW,CAAC,QAAQ,EAAE;4BAC3F,OAAO,EAAE,MAAC,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,IAAgB,mCAAI,OAAO;4BACjD,EAAE,EAAE,MAAC,U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O;4BAC1C,KAAK,EAAE,MAAM,CAAC,MAAA,MAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,KAAK,0CAAE,QAAQ,EAAE,mCAAI,GAAG,CAAC;4BACnD,IAAI,EAAE,MAAC,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,IAAY,mCAAI,IAAI;yBACxC,CAAC,EAAA;;oBALI,KAA2D,SAK/D,EALM,aAAa,mBAAA,EAAqB,kBAAkB,uBAAA;oBAMtD,iBAAiB,GACrB,CAAC,kBAAkB,GAAG,MAAM,CAAC,iBAAiB,CAAC,QAAQ,EAAE,CAAC,CAAC,GAAG,MAAM,CAAC,oBAAoB,CAAC,QAAQ,EAAE,CAAC,CAAC;oBAExG,sBAAO;4BACL,YAAY,EAAE,aAAa,GAAG,iBAAiB;4BAC/C,oBAAoB,EAAE,iBAAiB;yBACxC,EAAC;;;;CACH"}
@@ -1,4 +1,12 @@
1
1
  import { providers } from "ethers";
2
2
  import { GasPriceEstimate } from "../types";
3
3
  import { GasPriceEstimateOptions } from "../oracle";
4
+ /**
5
+ * Returns Linea gas price using the legacy eth_gasPrice RPC call.
6
+ * @param provider
7
+ * @param opts See notes below on specific parameters.
8
+ * @param baseFeeMultiplier Amount to multiply total fee because this function defaults to legacy gas pricing.
9
+ * @param priorityFeeMultiplier Unused in this function because this defaults to legacy gas computation.
10
+ * @returns
11
+ */
4
12
  export declare function eip1559(provider: providers.Provider, opts: GasPriceEstimateOptions): Promise<GasPriceEstimate>;
@@ -1,4 +1,12 @@
1
1
  import * as ethereum from "./ethereum";
2
+ /**
3
+ * Returns Linea gas price using the legacy eth_gasPrice RPC call.
4
+ * @param provider
5
+ * @param opts See notes below on specific parameters.
6
+ * @param baseFeeMultiplier Amount to multiply total fee because this function defaults to legacy gas pricing.
7
+ * @param priorityFeeMultiplier Unused in this function because this defaults to legacy gas computation.
8
+ * @returns
9
+ */
2
10
  export function eip1559(provider, opts) {
3
11
  // We use the legacy method to call `eth_gasPrice` which empirically returns a more accurate
4
12
  // gas price estimate than `eth_maxPriorityFeePerGas` or ethersProvider.getFeeData in the EIP1559 "raw" or "bad"
@@ -1 +1 @@
1
- {"version":3,"file":"linea.js","sourceRoot":"","sources":["../../../../src/gasPriceOracle/adapters/linea.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAC;AAGvC,MAAM,UAAU,OAAO,CAAC,QAA4B,EAAE,IAA6B;IACjF,4FAA4F;IAC5F,gHAAgH;IAChH,8GAA8G;IAC9G,iDAAiD;IACjD,OAAO,QAAQ,CAAC,MAAM,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;AACzC,CAAC"}
1
+ {"version":3,"file":"linea.js","sourceRoot":"","sources":["../../../../src/gasPriceOracle/adapters/linea.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAC;AAGvC;;;;;;;GAOG;AACH,MAAM,UAAU,OAAO,CAAC,QAA4B,EAAE,IAA6B;IACjF,4FAA4F;IAC5F,gHAAgH;IAChH,8GAA8G;IAC9G,iDAAiD;IACjD,OAAO,QAAQ,CAAC,MAAM,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;AACzC,CAAC"}
@@ -85,12 +85,12 @@ var MockPolygonGasStation = /** @class */ (function (_super) {
85
85
  */
86
86
  export function gasStation(provider, opts) {
87
87
  return __awaiter(this, void 0, void 0, function () {
88
- var chainId, baseFeeMultiplier, gasStation, maxPriorityFeePerGas, maxFeePerGas, baseFeeMinusPriorityFee, scaledBaseFee, err_1, minPriorityFee, priorityDelta;
88
+ var chainId, baseFeeMultiplier, priorityFeeMultiplier, gasStation, maxPriorityFeePerGas, maxFeePerGas, baseFeeMinusPriorityFee, scaledBaseFee, scaledPriorityFee, err_1, minPriorityFee, priorityDelta;
89
89
  var _a, _b;
90
90
  return __generator(this, function (_c) {
91
91
  switch (_c.label) {
92
92
  case 0:
93
- chainId = opts.chainId, baseFeeMultiplier = opts.baseFeeMultiplier;
93
+ chainId = opts.chainId, baseFeeMultiplier = opts.baseFeeMultiplier, priorityFeeMultiplier = opts.priorityFeeMultiplier;
94
94
  if (process.env.TEST_POLYGON_GAS_STATION === "true") {
95
95
  gasStation = new MockPolygonGasStation();
96
96
  }
@@ -108,7 +108,9 @@ export function gasStation(provider, opts) {
108
108
  (_a = _c.sent(), maxPriorityFeePerGas = _a.maxPriorityFeePerGas, maxFeePerGas = _a.maxFeePerGas);
109
109
  baseFeeMinusPriorityFee = maxFeePerGas.sub(maxPriorityFeePerGas);
110
110
  scaledBaseFee = baseFeeMinusPriorityFee.mul(baseFeeMultiplier).div(fixedPointAdjustment);
111
- maxFeePerGas = scaledBaseFee.add(maxPriorityFeePerGas);
111
+ scaledPriorityFee = maxPriorityFeePerGas.mul(priorityFeeMultiplier).div(fixedPointAdjustment);
112
+ maxFeePerGas = scaledBaseFee.add(scaledPriorityFee);
113
+ maxPriorityFeePerGas = scaledPriorityFee;
112
114
  return [3 /*break*/, 5];
113
115
  case 3:
114
116
  err_1 = _c.sent();
@@ -116,7 +118,7 @@ export function gasStation(provider, opts) {
116
118
  case 4:
117
119
  // Fall back to the RPC provider. May be less accurate.
118
120
  (_b = _c.sent(), maxPriorityFeePerGas = _b.maxPriorityFeePerGas, maxFeePerGas = _b.maxFeePerGas);
119
- minPriorityFee = parseUnits("30", 9);
121
+ minPriorityFee = parseUnits("30", 9).mul(priorityFeeMultiplier).div(fixedPointAdjustment);
120
122
  if (maxPriorityFeePerGas.lt(minPriorityFee)) {
121
123
  priorityDelta = minPriorityFee.sub(maxPriorityFeePerGas);
122
124
  maxPriorityFeePerGas = minPriorityFee;
@@ -1 +1 @@
1
- {"version":3,"file":"polygon.js","sourceRoot":"","sources":["../../../../src/gasPriceOracle/adapters/polygon.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,eAAe,EAAuB,MAAM,wCAAwC,CAAC;AAC9F,OAAO,EAAa,MAAM,EAAE,oBAAoB,EAAE,SAAS,EAAE,UAAU,EAAE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AAE;wBACrC,aAAa,GAAG,cAAc,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;wBAC/D,oBAAoB,GAAG,cAAc,CAAC;wBACtC,YAAY,GAAG,YAAY,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;qBAChD;;wBAGH,sBAAO,EAAE,oBAAoB,sBAAA,EAAE,YAAY,cAAA,EAAE,EAAC;;;;CAC/C"}
@@ -4,6 +4,7 @@ import { BigNumber } from "../utils";
4
4
  import { GasPriceEstimate } from "./types";
5
5
  export interface GasPriceEstimateOptions {
6
6
  baseFeeMultiplier: BigNumber;
7
+ priorityFeeMultiplier: BigNumber;
7
8
  legacyFallback: boolean;
8
9
  chainId: number;
9
10
  unsignedTx?: PopulatedTransaction;
@@ -18,25 +18,27 @@ var GAS_PRICE_ESTIMATE_DEFAULTS = {
18
18
  * @returns An object of type GasPriceEstimate.
19
19
  */
20
20
  export function getGasPriceEstimate(provider, opts) {
21
- var _a, _b;
21
+ var _a, _b, _c;
22
22
  if (opts === void 0) { opts = {}; }
23
23
  return __awaiter(this, void 0, void 0, function () {
24
- var baseFeeMultiplier, chainId, _c, optsWithDefaults, useViem;
25
- return __generator(this, function (_d) {
26
- switch (_d.label) {
24
+ var baseFeeMultiplier, priorityFeeMultiplier, chainId, _d, optsWithDefaults, useViem;
25
+ return __generator(this, function (_e) {
26
+ switch (_e.label) {
27
27
  case 0:
28
28
  baseFeeMultiplier = (_a = opts.baseFeeMultiplier) !== null && _a !== void 0 ? _a : toBNWei("1");
29
29
  assert(baseFeeMultiplier.gte(toBNWei("1.0")) && baseFeeMultiplier.lte(toBNWei("5")), "Require 1.0 < base fee multiplier (".concat(baseFeeMultiplier, ") <= 5.0 for a total gas multiplier within [+1.0, +5.0]"));
30
- if (!((_b = opts.chainId) !== null && _b !== void 0)) return [3 /*break*/, 1];
31
- _c = _b;
30
+ priorityFeeMultiplier = (_b = opts.priorityFeeMultiplier) !== null && _b !== void 0 ? _b : toBNWei("1");
31
+ assert(priorityFeeMultiplier.gte(toBNWei("1.0")) && priorityFeeMultiplier.lte(toBNWei("5")), "Require 1.0 < priority fee multiplier (".concat(priorityFeeMultiplier, ") <= 5.0 for a total gas multiplier within [+1.0, +5.0]"));
32
+ if (!((_c = opts.chainId) !== null && _c !== void 0)) return [3 /*break*/, 1];
33
+ _d = _c;
32
34
  return [3 /*break*/, 3];
33
35
  case 1: return [4 /*yield*/, provider.getNetwork()];
34
36
  case 2:
35
- _c = (_d.sent()).chainId;
36
- _d.label = 3;
37
+ _d = (_e.sent()).chainId;
38
+ _e.label = 3;
37
39
  case 3:
38
- chainId = _c;
39
- optsWithDefaults = __assign(__assign(__assign(__assign({}, GAS_PRICE_ESTIMATE_DEFAULTS), { baseFeeMultiplier: baseFeeMultiplier }), opts), { chainId: chainId });
40
+ chainId = _d;
41
+ optsWithDefaults = __assign(__assign(__assign(__assign({}, GAS_PRICE_ESTIMATE_DEFAULTS), { baseFeeMultiplier: baseFeeMultiplier, priorityFeeMultiplier: priorityFeeMultiplier }), opts), { chainId: chainId });
40
42
  useViem = process.env["NEW_GAS_PRICE_ORACLE_".concat(chainId)] === "true";
41
43
  return [2 /*return*/, useViem
42
44
  ? _getViemGasPriceEstimate(chainId, optsWithDefaults)
@@ -1 +1 @@
1
- {"version":3,"file":"oracle.js","sourceRoot":"","sources":["../../../src/gasPriceOracle/oracle.ts"],"names":[],"mappings":";AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAG5B,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,oBAAoB,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAEpF,OAAO,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AACzC,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAC;AAChD,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAC;AAChD,OAAO,KAAK,KAAK,MAAM,kBAAkB,CAAC;AAC1C,OAAO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7,6 +7,10 @@ import { GasPriceEstimateOptions } from "../oracle";
7
7
  * Reference: https://docs.arbitrum.io/how-arbitrum-works/gas-fees so we hardcode the priority fee
8
8
  * to 1 wei.
9
9
  * @param provider Ethers Provider
10
+ * @param opts See notes below on specific parameters.
11
+ * @param baseFeeMultiplier Amount to multiply base fee.
12
+ * @param priorityFeeMultiplier Unused in this function because arbitrum priority fee is hardcoded to 1 wei by this
13
+ * function.
10
14
  * @returns GasPriceEstimate
11
15
  */
12
16
  export declare function eip1559(provider: providers.Provider, opts: GasPriceEstimateOptions): Promise<GasPriceEstimate>;
@@ -1 +1 @@
1
- {"version":3,"file":"arbitrum.d.ts","sourceRoot":"","sources":["../../../../src/gasPriceOracle/adapters/arbitrum.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAEnC,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE5C,OAAO,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC;AAEpD;;;;;;;GAOG;AACH,wBAAsB,OAAO,CAAC,QAAQ,EAAE,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,uBAAuB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAQpH"}
1
+ {"version":3,"file":"arbitrum.d.ts","sourceRoot":"","sources":["../../../../src/gasPriceOracle/adapters/arbitrum.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAEnC,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE5C,OAAO,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC;AAEpD;;;;;;;;;;;GAWG;AACH,wBAAsB,OAAO,CAAC,QAAQ,EAAE,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,uBAAuB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAQpH"}
@@ -7,6 +7,9 @@ import { GasPriceEstimateOptions } from "../oracle";
7
7
  * eth_getBlock("pending").baseFee to eth_maxPriorityFeePerGas, otherwise calls the ethers provider's
8
8
  * getFeeData() method which adds eth_getBlock("latest").baseFee to a hardcoded priority fee of 1.5 gwei.
9
9
  * @param provider ethers RPC provider instance.
10
+ * @param {GasPriceEstimateOptions} opts See notes below on specific parameters.
11
+ * @param baseFeeMultiplier Amount to multiply base fee or total fee for legacy gas pricing.
12
+ * @param priorityFeeMultiplier Amount to multiply priority fee or unused for legacy gas pricing.
10
13
  * @returns Promise of gas price estimate object.
11
14
  */
12
15
  export declare function eip1559(provider: providers.Provider, opts: GasPriceEstimateOptions): Promise<GasPriceEstimate>;
@@ -17,7 +20,7 @@ export declare function eip1559(provider: providers.Provider, opts: GasPriceEsti
17
20
  * @param chainId Chain ID of the provider instance.
18
21
  * @returns Promise of gas price estimate object.
19
22
  */
20
- export declare function eip1559Raw(provider: providers.Provider, chainId: number, baseFeeMultiplier: BigNumber): Promise<GasPriceEstimate>;
23
+ export declare function eip1559Raw(provider: providers.Provider, chainId: number, baseFeeMultiplier: BigNumber, priorityFeeMultiplier: BigNumber): Promise<GasPriceEstimate>;
21
24
  /**
22
25
  * @notice Returns fee data using provider's getFeeData() method.
23
26
  * @note Resolves priority gas pricing poorly, because the priority fee is hardcoded to 1.5 Gwei in ethers v5's
@@ -27,7 +30,7 @@ export declare function eip1559Raw(provider: providers.Provider, chainId: number
27
30
  * @param chainId Chain ID of the provider instance.
28
31
  * @returns Promise of gas price estimate object.
29
32
  */
30
- export declare function eip1559Bad(provider: providers.Provider, chainId: number, baseFeeMultiplier: BigNumber): Promise<GasPriceEstimate>;
33
+ export declare function eip1559Bad(provider: providers.Provider, chainId: number, baseFeeMultiplier: BigNumber, priorityFeeMultiplier: BigNumber): Promise<GasPriceEstimate>;
31
34
  /**
32
35
  * @notice Returns result of eth_gasPrice RPC call
33
36
  * @dev Its recommended to use the eip1559Raw method over this one where possible as it will be more accurate.
@@ -1 +1 @@
1
- {"version":3,"file":"ethereum.d.ts","sourceRoot":"","sources":["../../../../src/gasPriceOracle/adapters/ethereum.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,EAAE,SAAS,EAAgD,MAAM,aAAa,CAAC;AACtF,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE5C,OAAO,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC;AAMpD;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,QAAQ,EAAE,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,uBAAuB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAK9G;AAED;;;;;;GAMG;AACH,wBAAsB,UAAU,CAC9B,QAAQ,EAAE,SAAS,CAAC,QAAQ,EAC5B,OAAO,EAAE,MAAM,EACf,iBAAiB,EAAE,SAAS,GAC3B,OAAO,CAAC,gBAAgB,CAAC,CAa3B;AAED;;;;;;;;GAQG;AACH,wBAAsB,UAAU,CAC9B,QAAQ,EAAE,SAAS,CAAC,QAAQ,EAC5B,OAAO,EAAE,MAAM,EACf,iBAAiB,EAAE,SAAS,GAC3B,OAAO,CAAC,gBAAgB,CAAC,CAc3B;AAED;;;;GAIG;AACH,wBAAsB,MAAM,CAAC,QAAQ,EAAE,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,uBAAuB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAUnH"}
1
+ {"version":3,"file":"ethereum.d.ts","sourceRoot":"","sources":["../../../../src/gasPriceOracle/adapters/ethereum.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,EAAE,SAAS,EAAgD,MAAM,aAAa,CAAC;AACtF,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE5C,OAAO,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC;AAMpD;;;;;;;;;GASG;AACH,wBAAgB,OAAO,CAAC,QAAQ,EAAE,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,uBAAuB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAK9G;AAED;;;;;;GAMG;AACH,wBAAsB,UAAU,CAC9B,QAAQ,EAAE,SAAS,CAAC,QAAQ,EAC5B,OAAO,EAAE,MAAM,EACf,iBAAiB,EAAE,SAAS,EAC5B,qBAAqB,EAAE,SAAS,GAC/B,OAAO,CAAC,gBAAgB,CAAC,CAc3B;AAED;;;;;;;;GAQG;AACH,wBAAsB,UAAU,CAC9B,QAAQ,EAAE,SAAS,CAAC,QAAQ,EAC5B,OAAO,EAAE,MAAM,EACf,iBAAiB,EAAE,SAAS,EAC5B,qBAAqB,EAAE,SAAS,GAC/B,OAAO,CAAC,gBAAgB,CAAC,CAe3B;AAED;;;;GAIG;AACH,wBAAsB,MAAM,CAAC,QAAQ,EAAE,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,uBAAuB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAUnH"}
@@ -11,10 +11,12 @@ import { GasPriceEstimateOptions } from "../oracle";
11
11
  * @dev Because the Linea priority fee is more volatile than the base fee, the base fee multiplier will be applied
12
12
  * to the priority fee.
13
13
  * @param provider Viem PublicClient
14
- * @param _chainId Unused in this adapter
14
+ * @param opts Relevant options for Linea are baseFeeMultiplier and unsignedTx.
15
15
  * @param baseFeeMultiplier Amount to multiply priority fee, since Linea's base fee is hardcoded while its priority
16
- * fee is dynamic
17
- * @param _unsignedTx Should contain any params passed to linea_estimateGas, which are listed
16
+ * fee is dynamic.
17
+ * @param priorityFeeMultiplier Unused in this function because the baseFeeMultiplier is applied to the dynamic
18
+ * Linea priority fee while the base fee is hardcoded.
19
+ * @param unsignedTx Should contain any params passed to linea_estimateGas, which are listed
18
20
  * here: https://docs.linea.build/api/reference/linea-estimategas#parameters
19
21
  * @returns
20
22
  */
@@ -1 +1 @@
1
- {"version":3,"file":"linea-viem.d.ts","sourceRoot":"","sources":["../../../../src/gasPriceOracle/adapters/linea-viem.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,YAAY,EAAE,MAAM,MAAM,CAAC;AAGlD,OAAO,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC;AAGpD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,OAAO,CAC3B,QAAQ,EAAE,YAAY,EACtB,IAAI,EAAE,uBAAuB,GAC5B,OAAO,CAAC,wBAAwB,CAAC,CAenC"}
1
+ {"version":3,"file":"linea-viem.d.ts","sourceRoot":"","sources":["../../../../src/gasPriceOracle/adapters/linea-viem.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,YAAY,EAAE,MAAM,MAAM,CAAC;AAGlD,OAAO,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC;AAGpD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,OAAO,CAC3B,QAAQ,EAAE,YAAY,EACtB,IAAI,EAAE,uBAAuB,GAC5B,OAAO,CAAC,wBAAwB,CAAC,CAenC"}
@@ -1,5 +1,13 @@
1
1
  import { providers } from "ethers";
2
2
  import { GasPriceEstimate } from "../types";
3
3
  import { GasPriceEstimateOptions } from "../oracle";
4
+ /**
5
+ * Returns Linea gas price using the legacy eth_gasPrice RPC call.
6
+ * @param provider
7
+ * @param opts See notes below on specific parameters.
8
+ * @param baseFeeMultiplier Amount to multiply total fee because this function defaults to legacy gas pricing.
9
+ * @param priorityFeeMultiplier Unused in this function because this defaults to legacy gas computation.
10
+ * @returns
11
+ */
4
12
  export declare function eip1559(provider: providers.Provider, opts: GasPriceEstimateOptions): Promise<GasPriceEstimate>;
5
13
  //# sourceMappingURL=linea.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"linea.d.ts","sourceRoot":"","sources":["../../../../src/gasPriceOracle/adapters/linea.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE5C,OAAO,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC;AAEpD,wBAAgB,OAAO,CAAC,QAAQ,EAAE,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,uBAAuB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAM9G"}
1
+ {"version":3,"file":"linea.d.ts","sourceRoot":"","sources":["../../../../src/gasPriceOracle/adapters/linea.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE5C,OAAO,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC;AAEpD;;;;;;;GAOG;AACH,wBAAgB,OAAO,CAAC,QAAQ,EAAE,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,uBAAuB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAM9G"}
@@ -1 +1 @@
1
- {"version":3,"file":"polygon.d.ts","sourceRoot":"","sources":["../../../../src/gasPriceOracle/adapters/polygon.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC9F,OAAO,EAAE,SAAS,EAAuD,MAAM,aAAa,CAAC;AAE7F,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAG5C,OAAO,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC;AAEpD,KAAK,mBAAmB,GAAG;IACzB,cAAc,EAAE,MAAM,GAAG,MAAM,CAAC;IAChC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;CACzB,CAAC;AAWF,KAAK,cAAc,GAAG,mBAAmB,GAAG;IAC1C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,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AAe;IACpD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;gBAEb,EAAE,OAAiB,EAAE,IAAI,EAAE,OAAc,EAAE,OAAW,EAAE,GAAE,cAAmB;IAOnF,UAAU,CAAC,QAAQ,GAAE,SAAS,GAAG,UAAU,GAAG,MAAe,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAqB/F,SAAS,CAAC,qBAAqB,CAAC,QAAQ,EAAE,OAAO,GAAG,QAAQ,IAAI,mBAAmB;CAOpF;AAQD,eAAO,MAAM,4BAA4B,iBAA4B,CAAC;AACtE,eAAO,MAAM,gCAAgC,iBAA2B,CAAC;AAWzE;;;;;GAKG;AACH,wBAAsB,UAAU,CAC9B,QAAQ,EAAE,SAAS,CAAC,QAAQ,EAC5B,IAAI,EAAE,uBAAuB,GAC5B,OAAO,CAAC,gBAAgB,CAAC,CAoC3B"}
@@ -4,6 +4,7 @@ import { BigNumber } from "../utils";
4
4
  import { GasPriceEstimate } from "./types";
5
5
  export interface GasPriceEstimateOptions {
6
6
  baseFeeMultiplier: BigNumber;
7
+ priorityFeeMultiplier: BigNumber;
7
8
  legacyFallback: boolean;
8
9
  chainId: number;
9
10
  unsignedTx?: PopulatedTransaction;
@@ -1 +1 @@
1
- {"version":3,"file":"oracle.d.ts","sourceRoot":"","sources":["../../../src/gasPriceOracle/oracle.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AACjC,OAAO,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAEzD,OAAO,EAAE,SAAS,EAAiD,MAAM,UAAU,CAAC;AACpF,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAQ3C,MAAM,WAAW,uBAAuB;IAEtC,iBAAiB,EAAE,SAAS,CAAC;IAE7B,cAAc,EAAE,OAAO,CAAC;IAExB,OAAO,EAAE,MAAM,CAAC;IAEhB,UAAU,CAAC,EAAE,oBAAoB,CAAC;IAElC,SAAS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json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@across-protocol/sdk",
3
3
  "author": "UMA Team",
4
- "version": "3.4.3",
4
+ "version": "3.4.4",
5
5
  "license": "AGPL-3.0",
6
6
  "homepage": "https://docs.across.to/reference/sdk",
7
7
  "files": [
@@ -10,6 +10,10 @@ import { GasPriceEstimateOptions } from "../oracle";
10
10
  * Reference: https://docs.arbitrum.io/how-arbitrum-works/gas-fees so we hardcode the priority fee
11
11
  * to 1 wei.
12
12
  * @param provider Ethers Provider
13
+ * @param opts See notes below on specific parameters.
14
+ * @param baseFeeMultiplier Amount to multiply base fee.
15
+ * @param priorityFeeMultiplier Unused in this function because arbitrum priority fee is hardcoded to 1 wei by this
16
+ * function.
13
17
  * @returns GasPriceEstimate
14
18
  */
15
19
  export async function eip1559(provider: providers.Provider, opts: GasPriceEstimateOptions): Promise<GasPriceEstimate> {
@@ -14,13 +14,16 @@ import { GasPriceEstimateOptions } from "../oracle";
14
14
  * eth_getBlock("pending").baseFee to eth_maxPriorityFeePerGas, otherwise calls the ethers provider's
15
15
  * getFeeData() method which adds eth_getBlock("latest").baseFee to a hardcoded priority fee of 1.5 gwei.
16
16
  * @param provider ethers RPC provider instance.
17
+ * @param {GasPriceEstimateOptions} opts See notes below on specific parameters.
18
+ * @param baseFeeMultiplier Amount to multiply base fee or total fee for legacy gas pricing.
19
+ * @param priorityFeeMultiplier Amount to multiply priority fee or unused for legacy gas pricing.
17
20
  * @returns Promise of gas price estimate object.
18
21
  */
19
22
  export function eip1559(provider: providers.Provider, opts: GasPriceEstimateOptions): Promise<GasPriceEstimate> {
20
23
  const useRaw = process.env[`GAS_PRICE_EIP1559_RAW_${opts.chainId}`] === "true";
21
24
  return useRaw
22
- ? eip1559Raw(provider, opts.chainId, opts.baseFeeMultiplier)
23
- : eip1559Bad(provider, opts.chainId, opts.baseFeeMultiplier);
25
+ ? eip1559Raw(provider, opts.chainId, opts.baseFeeMultiplier, opts.priorityFeeMultiplier)
26
+ : eip1559Bad(provider, opts.chainId, opts.baseFeeMultiplier, opts.priorityFeeMultiplier);
24
27
  }
25
28
 
26
29
  /**
@@ -33,7 +36,8 @@ export function eip1559(provider: providers.Provider, opts: GasPriceEstimateOpti
33
36
  export async function eip1559Raw(
34
37
  provider: providers.Provider,
35
38
  chainId: number,
36
- baseFeeMultiplier: BigNumber
39
+ baseFeeMultiplier: BigNumber,
40
+ priorityFeeMultiplier: BigNumber
37
41
  ): Promise<GasPriceEstimate> {
38
42
  const [{ baseFeePerGas }, _maxPriorityFeePerGas] = await Promise.all([
39
43
  provider.getBlock("pending"),
@@ -42,10 +46,11 @@ export async function eip1559Raw(
42
46
  const maxPriorityFeePerGas = BigNumber.from(_maxPriorityFeePerGas);
43
47
  assert(BigNumber.isBigNumber(baseFeePerGas), `No baseFeePerGas received on ${getNetworkName(chainId)}`);
44
48
 
49
+ const scaledPriorityFee = maxPriorityFeePerGas.mul(priorityFeeMultiplier).div(fixedPointAdjustment);
45
50
  const scaledBaseFee = baseFeePerGas.mul(baseFeeMultiplier).div(fixedPointAdjustment);
46
51
  return {
47
- maxFeePerGas: maxPriorityFeePerGas.add(scaledBaseFee),
48
- maxPriorityFeePerGas,
52
+ maxFeePerGas: scaledPriorityFee.add(scaledBaseFee),
53
+ maxPriorityFeePerGas: scaledPriorityFee,
49
54
  };
50
55
  }
51
56
 
@@ -61,7 +66,8 @@ export async function eip1559Raw(
61
66
  export async function eip1559Bad(
62
67
  provider: providers.Provider,
63
68
  chainId: number,
64
- baseFeeMultiplier: BigNumber
69
+ baseFeeMultiplier: BigNumber,
70
+ priorityFeeMultiplier: BigNumber
65
71
  ): Promise<GasPriceEstimate> {
66
72
  const feeData = await provider.getFeeData();
67
73
 
@@ -70,12 +76,13 @@ export async function eip1559Bad(
70
76
  });
71
77
 
72
78
  const maxPriorityFeePerGas = feeData.maxPriorityFeePerGas as BigNumber;
79
+ const scaledPriorityFee = maxPriorityFeePerGas.mul(priorityFeeMultiplier).div(fixedPointAdjustment);
73
80
  const scaledLastBaseFeePerGas = (feeData.lastBaseFeePerGas as BigNumber)
74
81
  .mul(baseFeeMultiplier)
75
82
  .div(fixedPointAdjustment);
76
- const maxFeePerGas = maxPriorityFeePerGas.add(scaledLastBaseFeePerGas);
83
+ const maxFeePerGas = scaledPriorityFee.add(scaledLastBaseFeePerGas);
77
84
 
78
- return { maxPriorityFeePerGas, maxFeePerGas };
85
+ return { maxPriorityFeePerGas: scaledPriorityFee, maxFeePerGas };
79
86
  }
80
87
 
81
88
  /**
@@ -15,10 +15,12 @@ import { fixedPointAdjustment } from "../../utils";
15
15
  * @dev Because the Linea priority fee is more volatile than the base fee, the base fee multiplier will be applied
16
16
  * to the priority fee.
17
17
  * @param provider Viem PublicClient
18
- * @param _chainId Unused in this adapter
18
+ * @param opts Relevant options for Linea are baseFeeMultiplier and unsignedTx.
19
19
  * @param baseFeeMultiplier Amount to multiply priority fee, since Linea's base fee is hardcoded while its priority
20
- * fee is dynamic
21
- * @param _unsignedTx Should contain any params passed to linea_estimateGas, which are listed
20
+ * fee is dynamic.
21
+ * @param priorityFeeMultiplier Unused in this function because the baseFeeMultiplier is applied to the dynamic
22
+ * Linea priority fee while the base fee is hardcoded.
23
+ * @param unsignedTx Should contain any params passed to linea_estimateGas, which are listed
22
24
  * here: https://docs.linea.build/api/reference/linea-estimategas#parameters
23
25
  * @returns
24
26
  */
@@ -7,6 +7,14 @@ import { GasPriceEstimate } from "../types";
7
7
  import * as ethereum from "./ethereum";
8
8
  import { GasPriceEstimateOptions } from "../oracle";
9
9
 
10
+ /**
11
+ * Returns Linea gas price using the legacy eth_gasPrice RPC call.
12
+ * @param provider
13
+ * @param opts See notes below on specific parameters.
14
+ * @param baseFeeMultiplier Amount to multiply total fee because this function defaults to legacy gas pricing.
15
+ * @param priorityFeeMultiplier Unused in this function because this defaults to legacy gas computation.
16
+ * @returns
17
+ */
10
18
  export function eip1559(provider: providers.Provider, opts: GasPriceEstimateOptions): Promise<GasPriceEstimate> {
11
19
  // We use the legacy method to call `eth_gasPrice` which empirically returns a more accurate
12
20
  // gas price estimate than `eth_maxPriorityFeePerGas` or ethersProvider.getFeeData in the EIP1559 "raw" or "bad"
@@ -96,7 +96,7 @@ export async function gasStation(
96
96
  provider: providers.Provider,
97
97
  opts: GasPriceEstimateOptions
98
98
  ): Promise<GasPriceEstimate> {
99
- const { chainId, baseFeeMultiplier } = opts;
99
+ const { chainId, baseFeeMultiplier, priorityFeeMultiplier } = opts;
100
100
  let gasStation: PolygonGasStation;
101
101
  if (process.env.TEST_POLYGON_GAS_STATION === "true") {
102
102
  gasStation = new MockPolygonGasStation();
@@ -113,14 +113,16 @@ export async function gasStation(
113
113
  // the baseFeeMultiplier.
114
114
  const baseFeeMinusPriorityFee = maxFeePerGas.sub(maxPriorityFeePerGas);
115
115
  const scaledBaseFee = baseFeeMinusPriorityFee.mul(baseFeeMultiplier).div(fixedPointAdjustment);
116
- maxFeePerGas = scaledBaseFee.add(maxPriorityFeePerGas);
116
+ const scaledPriorityFee = maxPriorityFeePerGas.mul(priorityFeeMultiplier).div(fixedPointAdjustment);
117
+ maxFeePerGas = scaledBaseFee.add(scaledPriorityFee);
118
+ maxPriorityFeePerGas = scaledPriorityFee;
117
119
  } catch (err) {
118
120
  // Fall back to the RPC provider. May be less accurate.
119
121
  ({ maxPriorityFeePerGas, maxFeePerGas } = await eip1559(provider, opts));
120
122
 
121
123
  // Per the GasStation docs, the minimum priority fee on Polygon is 30 Gwei.
122
124
  // https://docs.polygon.technology/tools/gas/polygon-gas-station/#interpretation
123
- const minPriorityFee = parseUnits("30", 9);
125
+ const minPriorityFee = parseUnits("30", 9).mul(priorityFeeMultiplier).div(fixedPointAdjustment);
124
126
  if (maxPriorityFeePerGas.lt(minPriorityFee)) {
125
127
  const priorityDelta = minPriorityFee.sub(maxPriorityFeePerGas);
126
128
  maxPriorityFeePerGas = minPriorityFee;
@@ -14,6 +14,8 @@ import * as lineaViem from "./adapters/linea-viem";
14
14
  export interface GasPriceEstimateOptions {
15
15
  // baseFeeMultiplier Multiplier applied to base fee for EIP1559 gas prices (or total fee for legacy).
16
16
  baseFeeMultiplier: BigNumber;
17
+ // priorityFeeMultiplier Multiplier applied to priority fee for EIP1559 gas prices (ignored for legacy).
18
+ priorityFeeMultiplier: BigNumber;
17
19
  // legacyFallback In the case of an unrecognized chain, fall back to type 0 gas estimation.
18
20
  legacyFallback: boolean;
19
21
  // chainId The chain ID to query for gas prices. If omitted can be inferred by provider.
@@ -43,10 +45,17 @@ export async function getGasPriceEstimate(
43
45
  baseFeeMultiplier.gte(toBNWei("1.0")) && baseFeeMultiplier.lte(toBNWei("5")),
44
46
  `Require 1.0 < base fee multiplier (${baseFeeMultiplier}) <= 5.0 for a total gas multiplier within [+1.0, +5.0]`
45
47
  );
48
+ const priorityFeeMultiplier = opts.priorityFeeMultiplier ?? toBNWei("1");
49
+ assert(
50
+ priorityFeeMultiplier.gte(toBNWei("1.0")) && priorityFeeMultiplier.lte(toBNWei("5")),
51
+ `Require 1.0 < priority fee multiplier (${priorityFeeMultiplier}) <= 5.0 for a total gas multiplier within [+1.0, +5.0]`
52
+ );
53
+
46
54
  const chainId = opts.chainId ?? (await provider.getNetwork()).chainId;
47
55
  const optsWithDefaults: GasPriceEstimateOptions = {
48
56
  ...GAS_PRICE_ESTIMATE_DEFAULTS,
49
57
  baseFeeMultiplier,
58
+ priorityFeeMultiplier,
50
59
  ...opts,
51
60
  chainId,
52
61
  };