-
Notifications
You must be signed in to change notification settings - Fork 212
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(explorer): better view on mempool (#3763)
Better detail view of mempool transactions
- Loading branch information
1 parent
d3edfe5
commit caa2837
Showing
5 changed files
with
99 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,48 @@ | ||
var express = require("express") | ||
const { createClient } = require("../baseNodeClient") | ||
var router = express.Router() | ||
|
||
/* GET mempool page. */ | ||
router.get("/:tx", async function (req, res) { | ||
let tx = JSON.parse(Buffer.from(req.params.tx, "base64")) | ||
console.log("========== stringify 2 ========") | ||
console.log(tx.inputs) | ||
console.log("===============") | ||
res.render("Mempool", { | ||
inputs: tx.inputs, | ||
outputs: tx.outputs, | ||
kernels: tx.kernels, | ||
}) | ||
router.get("/:excessSigs", async function (req, res) { | ||
try { | ||
let client = createClient() | ||
let txId = req.params.excessSigs.split("+") | ||
console.log(txId) | ||
let mempool = await client.getMempoolTransactions({}) | ||
let tx = null | ||
for (let i = 0; i < mempool.length; i++) { | ||
for (let j = 0; j < mempool[i].transaction.body.kernels.length; j++) { | ||
for (let k = 0; k < txId.length; k++) { | ||
if ( | ||
txId[k] === | ||
Buffer.from( | ||
mempool[i].transaction.body.kernels[j].excess_sig.signature | ||
).toString("hex") | ||
) { | ||
tx = mempool[i].transaction | ||
break | ||
} | ||
} | ||
if (tx) { | ||
break | ||
} | ||
} | ||
} | ||
|
||
if (!tx) { | ||
res.status(404) | ||
res.render("error", { error: "Tx not found" }) | ||
return | ||
} | ||
console.log(tx) | ||
console.log("===============") | ||
res.render("Mempool", { | ||
tx, | ||
}) | ||
} catch (error) { | ||
res.status(500) | ||
res.render("error", { error: error }) | ||
} | ||
}) | ||
|
||
module.exports = router |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters