@clonegod/ttd-bsc-common 1.0.6 → 1.0.8
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.
|
@@ -10,6 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.BaseTxParser = void 0;
|
|
13
|
+
const dist_1 = require("@clonegod/ttd-core/dist");
|
|
13
14
|
const ethers_1 = require("ethers");
|
|
14
15
|
class BaseTxParser {
|
|
15
16
|
constructor(config) {
|
|
@@ -45,16 +46,18 @@ class BaseTxParser {
|
|
|
45
46
|
try {
|
|
46
47
|
const gasUsed = txReceipt.gasUsed || ethers_1.ethers.BigNumber.from(0);
|
|
47
48
|
const effectiveGasPrice = txReceipt.effectiveGasPrice || ethers_1.ethers.BigNumber.from(0);
|
|
48
|
-
const
|
|
49
|
-
const
|
|
49
|
+
const gasFeeBN = gasUsed.mul(effectiveGasPrice);
|
|
50
|
+
const base_fee = Number(ethers_1.ethers.utils.formatEther(gasFeeBN));
|
|
51
|
+
const priority_fee = 0;
|
|
52
|
+
const total_fee = base_fee + priority_fee;
|
|
50
53
|
return {
|
|
51
|
-
base_fee
|
|
52
|
-
priority_fee
|
|
53
|
-
total_fee
|
|
54
|
+
base_fee,
|
|
55
|
+
priority_fee,
|
|
56
|
+
total_fee
|
|
54
57
|
};
|
|
55
58
|
}
|
|
56
59
|
catch (error) {
|
|
57
|
-
|
|
60
|
+
(0, dist_1.log_error)('calculateGasFee error:', error);
|
|
58
61
|
return {
|
|
59
62
|
base_fee: 0,
|
|
60
63
|
priority_fee: 0,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@clonegod/ttd-bsc-common",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"description": "BSC common library",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"push": "npm run build && npm publish"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@clonegod/ttd-core": "2.0.
|
|
17
|
+
"@clonegod/ttd-core": "2.0.23",
|
|
18
18
|
"axios": "^1.8.4",
|
|
19
19
|
"dotenv": "^16.4.7",
|
|
20
20
|
"ethers": "^5.8.0"
|