@requestnetwork/utils 0.39.1-next.1985 → 0.39.1-next.1987
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.
|
@@ -8,9 +8,11 @@ import { LogTypes, FeeTypes } from '@requestnetwork/types';
|
|
|
8
8
|
* The baseFeePerGas depends on how full the previous blocks were.
|
|
9
9
|
* - maxPriorityFeePerGas: The maximum priority fee per unit of gas for this transaction.
|
|
10
10
|
*/
|
|
11
|
-
declare function normalizeGasFees({ logger, gasPriceMin, suggestFees, }: {
|
|
11
|
+
declare function normalizeGasFees({ logger, gasPriceMin, gasPriceMax, gasPriceMultiplier, suggestFees, }: {
|
|
12
12
|
logger: LogTypes.ILogger;
|
|
13
13
|
gasPriceMin?: BigNumber;
|
|
14
|
+
gasPriceMax?: BigNumber;
|
|
15
|
+
gasPriceMultiplier?: number;
|
|
14
16
|
suggestFees: () => Promise<FeeTypes.SuggestedFees>;
|
|
15
17
|
}): Promise<FeeTypes.EstimatedGasFees>;
|
|
16
18
|
export { normalizeGasFees };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalize-gas-fees.d.ts","sourceRoot":"","sources":["../src/normalize-gas-fees.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAa,MAAM,QAAQ,CAAC;AAG9C,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAE3D;;;;;;;GAOG;AACH,iBAAe,gBAAgB,CAAC,EAC9B,MAAM,EACN,WAAW,EACX,WAAW,GACZ,EAAE;IACD,MAAM,EAAE,QAAQ,CAAC,OAAO,CAAC;IACzB,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,WAAW,EAAE,MAAM,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;CACpD,GAAG,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAC,
|
|
1
|
+
{"version":3,"file":"normalize-gas-fees.d.ts","sourceRoot":"","sources":["../src/normalize-gas-fees.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAa,MAAM,QAAQ,CAAC;AAG9C,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAE3D;;;;;;;GAOG;AACH,iBAAe,gBAAgB,CAAC,EAC9B,MAAM,EACN,WAAW,EACX,WAAW,EACX,kBAAkB,EAClB,WAAW,GACZ,EAAE;IACD,MAAM,EAAE,QAAQ,CAAC,OAAO,CAAC;IACzB,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,WAAW,EAAE,MAAM,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;CACpD,GAAG,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAgCrC;AAED,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -12,13 +12,19 @@ const index_1 = require("./index");
|
|
|
12
12
|
* The baseFeePerGas depends on how full the previous blocks were.
|
|
13
13
|
* - maxPriorityFeePerGas: The maximum priority fee per unit of gas for this transaction.
|
|
14
14
|
*/
|
|
15
|
-
function normalizeGasFees({ logger, gasPriceMin, suggestFees, }) {
|
|
15
|
+
function normalizeGasFees({ logger, gasPriceMin, gasPriceMax, gasPriceMultiplier, suggestFees, }) {
|
|
16
16
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
17
17
|
try {
|
|
18
18
|
const suggestedFee = yield suggestFees();
|
|
19
19
|
const baseFee = (0, index_1.maxBigNumber)(suggestedFee.baseFee, gasPriceMin || ethers_1.constants.Zero);
|
|
20
20
|
const maxPriorityFeePerGas = (0, index_1.maxBigNumber)(suggestedFee.maxPriorityFee, gasPriceMin || ethers_1.constants.Zero);
|
|
21
|
-
const
|
|
21
|
+
const maxFeePerGasInit = baseFee
|
|
22
|
+
.add(maxPriorityFeePerGas)
|
|
23
|
+
.mul(gasPriceMultiplier || 100)
|
|
24
|
+
.div(100);
|
|
25
|
+
const maxFeePerGas = gasPriceMax
|
|
26
|
+
? (0, index_1.minBigNumber)(maxFeePerGasInit, gasPriceMax)
|
|
27
|
+
: maxFeePerGasInit;
|
|
22
28
|
if (maxPriorityFeePerGas.eq(0) || maxFeePerGas.eq(0)) {
|
|
23
29
|
logger.warn(`normalizeGasFees: maxPriorityFeePerGas or maxFeePerGas too low (maxPriorityFeePerGas: ${maxPriorityFeePerGas.toString()} / maxFeePerGas: ${maxFeePerGas.toString()})`);
|
|
24
30
|
return {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalize-gas-fees.js","sourceRoot":"","sources":["../src/normalize-gas-fees.ts"],"names":[],"mappings":";;;;AAAA,mCAA8C;AAE9C,
|
|
1
|
+
{"version":3,"file":"normalize-gas-fees.js","sourceRoot":"","sources":["../src/normalize-gas-fees.ts"],"names":[],"mappings":";;;;AAAA,mCAA8C;AAE9C,mCAAqD;AAGrD;;;;;;;GAOG;AACH,SAAe,gBAAgB,CAAC,EAC9B,MAAM,EACN,WAAW,EACX,WAAW,EACX,kBAAkB,EAClB,WAAW,GAOZ;;QACC,IAAI;YACF,MAAM,YAAY,GAAG,MAAM,WAAW,EAAE,CAAC;YACzC,MAAM,OAAO,GAAG,IAAA,oBAAY,EAAC,YAAY,CAAC,OAAO,EAAE,WAAW,IAAI,kBAAS,CAAC,IAAI,CAAC,CAAC;YAClF,MAAM,oBAAoB,GAAG,IAAA,oBAAY,EACvC,YAAY,CAAC,cAAc,EAC3B,WAAW,IAAI,kBAAS,CAAC,IAAI,CAC9B,CAAC;YAEF,MAAM,gBAAgB,GAAG,OAAO;iBAC7B,GAAG,CAAC,oBAAoB,CAAC;iBACzB,GAAG,CAAC,kBAAkB,IAAI,GAAG,CAAC;iBAC9B,GAAG,CAAC,GAAG,CAAC,CAAC;YACZ,MAAM,YAAY,GAAG,WAAW;gBAC9B,CAAC,CAAC,IAAA,oBAAY,EAAC,gBAAgB,EAAE,WAAW,CAAC;gBAC7C,CAAC,CAAC,gBAAgB,CAAC;YAErB,IAAI,oBAAoB,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,YAAY,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE;gBACpD,MAAM,CAAC,IAAI,CACT,yFAAyF,oBAAoB,CAAC,QAAQ,EAAE,oBAAoB,YAAY,CAAC,QAAQ,EAAE,GAAG,CACvK,CAAC;gBACF,OAAO,EAAE,CAAC;aACX;YAED,OAAO;gBACL,oBAAoB;gBACpB,YAAY;aACb,CAAC;SACH;QAAC,OAAO,CAAC,EAAE;YACV,MAAM,CAAC,KAAK,CAAC,2BAA2B,CAAC,EAAE,CAAC,CAAC;YAC7C,OAAO,EAAE,CAAC;SACX;IACH,CAAC;CAAA;AAEQ,4CAAgB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@requestnetwork/utils",
|
|
3
|
-
"version": "0.39.1-next.
|
|
3
|
+
"version": "0.39.1-next.1987+aafe4df6",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"test:watch": "yarn test --watch"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@requestnetwork/types": "0.39.1-next.
|
|
43
|
+
"@requestnetwork/types": "0.39.1-next.1987+aafe4df6",
|
|
44
44
|
"@toruslabs/eccrypto": "4.0.0",
|
|
45
45
|
"ethers": "5.5.1",
|
|
46
46
|
"secp256k1": "4.0.2",
|
|
@@ -56,5 +56,5 @@
|
|
|
56
56
|
"ts-node": "10.9.1",
|
|
57
57
|
"typescript": "5.1.3"
|
|
58
58
|
},
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "aafe4df640097863de23a7f4abef66f4d09b09ad"
|
|
60
60
|
}
|