@across-protocol/sdk 3.4.5 → 3.4.7
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/dist/cjs/gasPriceOracle/adapters/ethereum.js +5 -1
- package/dist/cjs/gasPriceOracle/adapters/ethereum.js.map +1 -1
- package/dist/cjs/gasPriceOracle/adapters/linea-viem.js +3 -3
- package/dist/cjs/gasPriceOracle/adapters/linea-viem.js.map +1 -1
- package/dist/esm/gasPriceOracle/adapters/ethereum.js +6 -2
- package/dist/esm/gasPriceOracle/adapters/ethereum.js.map +1 -1
- package/dist/esm/gasPriceOracle/adapters/linea-viem.d.ts +2 -4
- package/dist/esm/gasPriceOracle/adapters/linea-viem.js +5 -7
- package/dist/esm/gasPriceOracle/adapters/linea-viem.js.map +1 -1
- package/dist/types/gasPriceOracle/adapters/ethereum.d.ts.map +1 -1
- package/dist/types/gasPriceOracle/adapters/linea-viem.d.ts +2 -4
- package/dist/types/gasPriceOracle/adapters/linea-viem.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/gasPriceOracle/adapters/ethereum.ts +6 -2
- package/src/gasPriceOracle/adapters/linea-viem.ts +4 -6
|
@@ -14,7 +14,7 @@ function eip1559(provider, opts) {
|
|
|
14
14
|
exports.eip1559 = eip1559;
|
|
15
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, scaledPriorityFee, scaledBaseFee;
|
|
17
|
+
var _a, baseFeePerGas, _maxPriorityFeePerGas, maxPriorityFeePerGas, flooredPriorityFeePerGas, scaledPriorityFee, scaledBaseFee;
|
|
18
18
|
return tslib_1.__generator(this, function (_b) {
|
|
19
19
|
switch (_b.label) {
|
|
20
20
|
case 0: return [4, Promise.all([
|
|
@@ -24,6 +24,10 @@ function eip1559Raw(provider, chainId, baseFeeMultiplier, priorityFeeMultiplier)
|
|
|
24
24
|
case 1:
|
|
25
25
|
_a = _b.sent(), baseFeePerGas = _a[0].baseFeePerGas, _maxPriorityFeePerGas = _a[1];
|
|
26
26
|
maxPriorityFeePerGas = utils_1.BigNumber.from(_maxPriorityFeePerGas);
|
|
27
|
+
flooredPriorityFeePerGas = (0, utils_1.parseUnits)(process.env["MIN_PRIORITY_FEE_PER_GAS_".concat(chainId)] || "0", 9);
|
|
28
|
+
if (maxPriorityFeePerGas.lt(flooredPriorityFeePerGas)) {
|
|
29
|
+
maxPriorityFeePerGas = utils_1.BigNumber.from(flooredPriorityFeePerGas);
|
|
30
|
+
}
|
|
27
31
|
(0, assert_1.default)(utils_1.BigNumber.isBigNumber(baseFeePerGas), "No baseFeePerGas received on ".concat((0, utils_1.getNetworkName)(chainId)));
|
|
28
32
|
scaledPriorityFee = maxPriorityFeePerGas.mul(priorityFeeMultiplier).div(utils_1.fixedPointAdjustment);
|
|
29
33
|
scaledBaseFee = baseFeePerGas.mul(baseFeeMultiplier).div(utils_1.fixedPointAdjustment);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ethereum.js","sourceRoot":"","sources":["../../../../src/gasPriceOracle/adapters/ethereum.ts"],"names":[],"mappings":";;;;AAAA,0DAA4B;AAE5B,
|
|
1
|
+
{"version":3,"file":"ethereum.js","sourceRoot":"","sources":["../../../../src/gasPriceOracle/adapters/ethereum.ts"],"names":[],"mappings":";;;;AAAA,0DAA4B;AAE5B,qCAAkG;AAElG,gCAAwC;AAiBxC,SAAgB,OAAO,CAAC,QAA4B,EAAE,IAA6B;IACjF,IAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,gCAAyB,IAAI,CAAC,OAAO,CAAE,CAAC,KAAK,MAAM,CAAC;IAC/E,OAAO,MAAM;QACX,CAAC,CAAC,UAAU,CAAC,QAAQ,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,iBAAiB,EAAE,IAAI,CAAC,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Aa,EAAC,eAAe,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;oBAE/G,WAAO;4BACL,YAAY,EAAE,QAAQ,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC,GAAG,CAAC,4BAAoB,CAAC;4BACvE,oBAAoB,EAAE,cAAM;yBAC7B,EAAC;;;;CACH;AAVD,wBAUC"}
|
|
@@ -8,11 +8,11 @@ var utils_1 = require("../../utils");
|
|
|
8
8
|
function eip1559(provider, opts) {
|
|
9
9
|
var _a, _b, _c, _d, _e;
|
|
10
10
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
11
|
-
var unsignedTx,
|
|
11
|
+
var unsignedTx, priorityFeeMultiplier, _f, baseFeePerGas, _priorityFeePerGas, priorityFeePerGas;
|
|
12
12
|
return tslib_1.__generator(this, function (_g) {
|
|
13
13
|
switch (_g.label) {
|
|
14
14
|
case 0:
|
|
15
|
-
unsignedTx = opts.unsignedTx,
|
|
15
|
+
unsignedTx = opts.unsignedTx, priorityFeeMultiplier = opts.priorityFeeMultiplier;
|
|
16
16
|
return [4, (0, linea_1.estimateGas)(provider, {
|
|
17
17
|
account: (_a = unsignedTx === null || unsignedTx === void 0 ? void 0 : unsignedTx.from) !== null && _a !== void 0 ? _a : constants_1.DEFAULT_SIMULATED_RELAYER_ADDRESS,
|
|
18
18
|
to: (_b = unsignedTx === null || unsignedTx === void 0 ? void 0 : unsignedTx.to) !== null && _b !== void 0 ? _b : constants_1.DEFAULT_SIMULATED_RELAYER_ADDRESS,
|
|
@@ -21,7 +21,7 @@ function eip1559(provider, opts) {
|
|
|
21
21
|
})];
|
|
22
22
|
case 1:
|
|
23
23
|
_f = _g.sent(), baseFeePerGas = _f.baseFeePerGas, _priorityFeePerGas = _f.priorityFeePerGas;
|
|
24
|
-
priorityFeePerGas = (_priorityFeePerGas * BigInt(
|
|
24
|
+
priorityFeePerGas = (_priorityFeePerGas * BigInt(priorityFeeMultiplier.toString())) / BigInt(utils_1.fixedPointAdjustment.toString());
|
|
25
25
|
return [2, {
|
|
26
26
|
maxFeePerGas: baseFeePerGas + priorityFeePerGas,
|
|
27
27
|
maxPriorityFeePerGas: priorityFeePerGas,
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
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;AAmBnD,SAAsB,OAAO,CAC3B,QAAsB,EACtB,IAA6B;;;;;;;oBAErB,UAAU,GAA4B,IAAI,WAAhC,EAAE,qBAAqB,GAAK,IAAI,sBAAT,CAAU;oBACc,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,qBAAqB,CAAC,QAAQ,EAAE,CAAC,CAAC,GAAG,MAAM,CAAC,4BAAoB,CAAC,QAAQ,EAAE,CAAC,CAAC;oBAE5G,WAAO;4BACL,YAAY,EAAE,aAAa,GAAG,iBAAiB;4BAC/C,oBAAoB,EAAE,iBAAiB;yBACxC,EAAC;;;;CACH;AAlBD,0BAkBC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __awaiter, __generator } from "tslib";
|
|
2
2
|
import assert from "assert";
|
|
3
|
-
import { BigNumber, bnZero, fixedPointAdjustment, getNetworkName } from "../../utils";
|
|
3
|
+
import { BigNumber, bnZero, fixedPointAdjustment, getNetworkName, parseUnits } from "../../utils";
|
|
4
4
|
import { gasPriceError } from "../util";
|
|
5
5
|
// TODO: We intend to remove `eip1559Bad()` as an option and make eip1559Raw the only option eventually. The reason
|
|
6
6
|
// they both exist currently is because eip1559Raw is new and untested on production so we will slowly roll it out
|
|
@@ -30,7 +30,7 @@ export function eip1559(provider, opts) {
|
|
|
30
30
|
*/
|
|
31
31
|
export function eip1559Raw(provider, chainId, baseFeeMultiplier, priorityFeeMultiplier) {
|
|
32
32
|
return __awaiter(this, void 0, void 0, function () {
|
|
33
|
-
var _a, baseFeePerGas, _maxPriorityFeePerGas, maxPriorityFeePerGas, scaledPriorityFee, scaledBaseFee;
|
|
33
|
+
var _a, baseFeePerGas, _maxPriorityFeePerGas, maxPriorityFeePerGas, flooredPriorityFeePerGas, scaledPriorityFee, scaledBaseFee;
|
|
34
34
|
return __generator(this, function (_b) {
|
|
35
35
|
switch (_b.label) {
|
|
36
36
|
case 0: return [4 /*yield*/, Promise.all([
|
|
@@ -40,6 +40,10 @@ export function eip1559Raw(provider, chainId, baseFeeMultiplier, priorityFeeMult
|
|
|
40
40
|
case 1:
|
|
41
41
|
_a = _b.sent(), baseFeePerGas = _a[0].baseFeePerGas, _maxPriorityFeePerGas = _a[1];
|
|
42
42
|
maxPriorityFeePerGas = BigNumber.from(_maxPriorityFeePerGas);
|
|
43
|
+
flooredPriorityFeePerGas = parseUnits(process.env["MIN_PRIORITY_FEE_PER_GAS_".concat(chainId)] || "0", 9);
|
|
44
|
+
if (maxPriorityFeePerGas.lt(flooredPriorityFeePerGas)) {
|
|
45
|
+
maxPriorityFeePerGas = BigNumber.from(flooredPriorityFeePerGas);
|
|
46
|
+
}
|
|
43
47
|
assert(BigNumber.isBigNumber(baseFeePerGas), "No baseFeePerGas received on ".concat(getNetworkName(chainId)));
|
|
44
48
|
scaledPriorityFee = maxPriorityFeePerGas.mul(priorityFeeMultiplier).div(fixedPointAdjustment);
|
|
45
49
|
scaledBaseFee = baseFeePerGas.mul(baseFeeMultiplier).div(fixedPointAdjustment);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ethereum.js","sourceRoot":"","sources":["../../../../src/gasPriceOracle/adapters/ethereum.ts"],"names":[],"mappings":";AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"ethereum.js","sourceRoot":"","sources":["../../../../src/gasPriceOracle/adapters/ethereum.ts"],"names":[],"mappings":";AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,oBAAoB,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAElG,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAGxC,mHAAmH;AACnH,kHAAkH;AAClH,6DAA6D;AAE7D;;;;;;;;;GASG;AACH,MAAM,UAAU,OAAO,CAAC,QAA4B,EAAE,IAA6B;IACjF,IAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,gCAAyB,IAAI,CAAC,OAAO,CAAE,CAAC,KAAK,MAAM,CAAC;IAC/E,OAAO,MAAM;QACX,CAAC,CAAC,UAAU,CAAC,QAAQ,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,iBAAiB,EAAE,IAAI,CAAC,qBAAqB,CAAC;QACxF,CAAC,CAAC,UAAU,CAAC,QAAQ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sBAAO;4BACL,YAAY,EAAE,QAAQ,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC,GAAG,CAAC,oBAAoB,CAAC;4BACvE,oBAAoB,EAAE,MAAM;yBAC7B,EAAC;;;;CACH"}
|
|
@@ -12,10 +12,8 @@ import { GasPriceEstimateOptions } from "../oracle";
|
|
|
12
12
|
* to the priority fee.
|
|
13
13
|
* @param provider Viem PublicClient
|
|
14
14
|
* @param opts Relevant options for Linea are baseFeeMultiplier and unsignedTx.
|
|
15
|
-
* @param baseFeeMultiplier
|
|
16
|
-
*
|
|
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.
|
|
15
|
+
* @param baseFeeMultiplier Unused since Linea's base fee is hardcoded while its priority fee is dynamic.
|
|
16
|
+
* @param priorityFeeMultiplier Amount to multiply priority fee.
|
|
19
17
|
* @param unsignedTx Should contain any params passed to linea_estimateGas, which are listed
|
|
20
18
|
* here: https://docs.linea.build/api/reference/linea-estimategas#parameters
|
|
21
19
|
* @returns
|
|
@@ -13,10 +13,8 @@ import { fixedPointAdjustment } from "../../utils";
|
|
|
13
13
|
* to the priority fee.
|
|
14
14
|
* @param provider Viem PublicClient
|
|
15
15
|
* @param opts Relevant options for Linea are baseFeeMultiplier and unsignedTx.
|
|
16
|
-
* @param baseFeeMultiplier
|
|
17
|
-
*
|
|
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.
|
|
16
|
+
* @param baseFeeMultiplier Unused since Linea's base fee is hardcoded while its priority fee is dynamic.
|
|
17
|
+
* @param priorityFeeMultiplier Amount to multiply priority fee.
|
|
20
18
|
* @param unsignedTx Should contain any params passed to linea_estimateGas, which are listed
|
|
21
19
|
* here: https://docs.linea.build/api/reference/linea-estimategas#parameters
|
|
22
20
|
* @returns
|
|
@@ -24,11 +22,11 @@ import { fixedPointAdjustment } from "../../utils";
|
|
|
24
22
|
export function eip1559(provider, opts) {
|
|
25
23
|
var _a, _b, _c, _d, _e;
|
|
26
24
|
return __awaiter(this, void 0, void 0, function () {
|
|
27
|
-
var unsignedTx,
|
|
25
|
+
var unsignedTx, priorityFeeMultiplier, _f, baseFeePerGas, _priorityFeePerGas, priorityFeePerGas;
|
|
28
26
|
return __generator(this, function (_g) {
|
|
29
27
|
switch (_g.label) {
|
|
30
28
|
case 0:
|
|
31
|
-
unsignedTx = opts.unsignedTx,
|
|
29
|
+
unsignedTx = opts.unsignedTx, priorityFeeMultiplier = opts.priorityFeeMultiplier;
|
|
32
30
|
return [4 /*yield*/, estimateGas(provider, {
|
|
33
31
|
account: (_a = unsignedTx === null || unsignedTx === void 0 ? void 0 : unsignedTx.from) !== null && _a !== void 0 ? _a : account,
|
|
34
32
|
to: (_b = unsignedTx === null || unsignedTx === void 0 ? void 0 : unsignedTx.to) !== null && _b !== void 0 ? _b : account,
|
|
@@ -37,7 +35,7 @@ export function eip1559(provider, opts) {
|
|
|
37
35
|
})];
|
|
38
36
|
case 1:
|
|
39
37
|
_f = _g.sent(), baseFeePerGas = _f.baseFeePerGas, _priorityFeePerGas = _f.priorityFeePerGas;
|
|
40
|
-
priorityFeePerGas = (_priorityFeePerGas * BigInt(
|
|
38
|
+
priorityFeePerGas = (_priorityFeePerGas * BigInt(priorityFeeMultiplier.toString())) / BigInt(fixedPointAdjustment.toString());
|
|
41
39
|
return [2 /*return*/, {
|
|
42
40
|
maxFeePerGas: baseFeePerGas + priorityFeePerGas,
|
|
43
41
|
maxPriorityFeePerGas: priorityFeePerGas,
|
|
@@ -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,iBAA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xC,EAAC;;;;CACH"}
|
|
@@ -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,
|
|
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,EAA4D,MAAM,aAAa,CAAC;AAClG,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,CAkB3B;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"}
|
|
@@ -12,10 +12,8 @@ import { GasPriceEstimateOptions } from "../oracle";
|
|
|
12
12
|
* to the priority fee.
|
|
13
13
|
* @param provider Viem PublicClient
|
|
14
14
|
* @param opts Relevant options for Linea are baseFeeMultiplier and unsignedTx.
|
|
15
|
-
* @param baseFeeMultiplier
|
|
16
|
-
*
|
|
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.
|
|
15
|
+
* @param baseFeeMultiplier Unused since Linea's base fee is hardcoded while its priority fee is dynamic.
|
|
16
|
+
* @param priorityFeeMultiplier Amount to multiply priority fee.
|
|
19
17
|
* @param unsignedTx Should contain any params passed to linea_estimateGas, which are listed
|
|
20
18
|
* here: https://docs.linea.build/api/reference/linea-estimategas#parameters
|
|
21
19
|
* @returns
|
|
@@ -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
|
|
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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import assert from "assert";
|
|
2
2
|
import { providers } from "ethers";
|
|
3
|
-
import { BigNumber, bnZero, fixedPointAdjustment, getNetworkName } from "../../utils";
|
|
3
|
+
import { BigNumber, bnZero, fixedPointAdjustment, getNetworkName, parseUnits } from "../../utils";
|
|
4
4
|
import { GasPriceEstimate } from "../types";
|
|
5
5
|
import { gasPriceError } from "../util";
|
|
6
6
|
import { GasPriceEstimateOptions } from "../oracle";
|
|
@@ -43,7 +43,11 @@ export async function eip1559Raw(
|
|
|
43
43
|
provider.getBlock("pending"),
|
|
44
44
|
(provider as providers.JsonRpcProvider).send("eth_maxPriorityFeePerGas", []),
|
|
45
45
|
]);
|
|
46
|
-
|
|
46
|
+
let maxPriorityFeePerGas = BigNumber.from(_maxPriorityFeePerGas);
|
|
47
|
+
const flooredPriorityFeePerGas = parseUnits(process.env[`MIN_PRIORITY_FEE_PER_GAS_${chainId}`] || "0", 9);
|
|
48
|
+
if (maxPriorityFeePerGas.lt(flooredPriorityFeePerGas)) {
|
|
49
|
+
maxPriorityFeePerGas = BigNumber.from(flooredPriorityFeePerGas);
|
|
50
|
+
}
|
|
47
51
|
assert(BigNumber.isBigNumber(baseFeePerGas), `No baseFeePerGas received on ${getNetworkName(chainId)}`);
|
|
48
52
|
|
|
49
53
|
const scaledPriorityFee = maxPriorityFeePerGas.mul(priorityFeeMultiplier).div(fixedPointAdjustment);
|
|
@@ -16,10 +16,8 @@ import { fixedPointAdjustment } from "../../utils";
|
|
|
16
16
|
* to the priority fee.
|
|
17
17
|
* @param provider Viem PublicClient
|
|
18
18
|
* @param opts Relevant options for Linea are baseFeeMultiplier and unsignedTx.
|
|
19
|
-
* @param baseFeeMultiplier
|
|
20
|
-
*
|
|
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.
|
|
19
|
+
* @param baseFeeMultiplier Unused since Linea's base fee is hardcoded while its priority fee is dynamic.
|
|
20
|
+
* @param priorityFeeMultiplier Amount to multiply priority fee.
|
|
23
21
|
* @param unsignedTx Should contain any params passed to linea_estimateGas, which are listed
|
|
24
22
|
* here: https://docs.linea.build/api/reference/linea-estimategas#parameters
|
|
25
23
|
* @returns
|
|
@@ -28,7 +26,7 @@ export async function eip1559(
|
|
|
28
26
|
provider: PublicClient,
|
|
29
27
|
opts: GasPriceEstimateOptions
|
|
30
28
|
): Promise<InternalGasPriceEstimate> {
|
|
31
|
-
const { unsignedTx,
|
|
29
|
+
const { unsignedTx, priorityFeeMultiplier } = opts;
|
|
32
30
|
const { baseFeePerGas, priorityFeePerGas: _priorityFeePerGas } = await estimateGas(provider, {
|
|
33
31
|
account: (unsignedTx?.from as Address) ?? account,
|
|
34
32
|
to: (unsignedTx?.to as Address) ?? account,
|
|
@@ -36,7 +34,7 @@ export async function eip1559(
|
|
|
36
34
|
data: (unsignedTx?.data as Hex) ?? "0x",
|
|
37
35
|
});
|
|
38
36
|
const priorityFeePerGas =
|
|
39
|
-
(_priorityFeePerGas * BigInt(
|
|
37
|
+
(_priorityFeePerGas * BigInt(priorityFeeMultiplier.toString())) / BigInt(fixedPointAdjustment.toString());
|
|
40
38
|
|
|
41
39
|
return {
|
|
42
40
|
maxFeePerGas: baseFeePerGas + priorityFeePerGas,
|