Skip to content

Commit 802a700

Browse files
Merge pull request #37 from solidpayorg/feat/info-confirmation-status
Show confirmation status in git mark info
2 parents 4358f46 + 49f9981 commit 802a700

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

‎bin/git-mark.js‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,22 @@ async function cmdInfo() {
440440
console.log(`Current address: ${currentAddr}`);
441441
console.log(`Last commit: ${trail.states[trail.states.length - 1]}`);
442442
console.log(`Last TXO: ${trail.txo[trail.txo.length - 1]}`);
443+
444+
// Check confirmation status of latest tx
445+
const explorer = CHAINS[trail.chain]?.explorer;
446+
if (explorer && priv) {
447+
try {
448+
const txResp = await fetch(`${explorer}/tx/${priv.txid}`);
449+
if (txResp.ok) {
450+
const txData = await txResp.json();
451+
if (txData.status?.confirmed) {
452+
console.log(`Status: ✓ confirmed (block ${txData.status.block_height})`);
453+
} else {
454+
console.log(`Status: ⏳ unconfirmed`);
455+
}
456+
}
457+
} catch (e) {}
458+
}
443459
}
444460
if (priv) {
445461
console.log(`Balance: ${priv.amount} sats`);

0 commit comments

Comments
 (0)