stacks-hacker-menu-dood 1.0.0
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/balance.js +19 -0
- package/history.js +23 -0
- package/index.js +8 -0
- package/menu.js +77 -0
- package/package.json +12 -0
package/balance.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import readline from 'node:readline/promises';
|
|
2
|
+
import { stdin as input, stdout as output } from 'node:process';
|
|
3
|
+
|
|
4
|
+
async function checkBalance() {
|
|
5
|
+
const rl = readline.createInterface({ input, output });
|
|
6
|
+
|
|
7
|
+
const address = await rl.question('\nš Enter a Stacks wallet address: ');
|
|
8
|
+
|
|
9
|
+
console.log(`\nš Scanning wallet: ${address}...`);
|
|
10
|
+
const response = await fetch(`https://api.mainnet.hiro.so/extended/v1/address/${address}/balances`);
|
|
11
|
+
const data = await response.json();
|
|
12
|
+
|
|
13
|
+
const stxBalance = parseInt(data.stx.balance) / 1000000;
|
|
14
|
+
console.log(`šŖ STX Balance: ${stxBalance} STX\n`);
|
|
15
|
+
|
|
16
|
+
rl.close();
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
checkBalance();
|
package/history.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import readline from 'node:readline/promises';
|
|
2
|
+
import { stdin as input, stdout as output } from 'node:process';
|
|
3
|
+
|
|
4
|
+
async function checkTransactions() {
|
|
5
|
+
const rl = readline.createInterface({ input, output });
|
|
6
|
+
|
|
7
|
+
const address = await rl.question('\nš Enter a Stacks wallet address: ');
|
|
8
|
+
|
|
9
|
+
console.log(`\nšµļøāāļø Fetching last 5 transactions for: ${address}...`);
|
|
10
|
+
const response = await fetch(`https://api.mainnet.hiro.so/extended/v1/address/${address}/transactions?limit=5`);
|
|
11
|
+
const data = await response.json();
|
|
12
|
+
|
|
13
|
+
console.log('\nš Recent Transactions:');
|
|
14
|
+
data.results.forEach((tx, index) => {
|
|
15
|
+
console.log(`[${index + 1}] TxID: ${tx.tx_id}`);
|
|
16
|
+
console.log(` Type: ${tx.tx_type} | Status: ${tx.tx_status}`);
|
|
17
|
+
});
|
|
18
|
+
console.log('\n');
|
|
19
|
+
|
|
20
|
+
rl.close();
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
checkTransactions();
|
package/index.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
async function getLatestBlock() {
|
|
2
|
+
console.log("š” Pinging Stacks Mainnet...");
|
|
3
|
+
const response = await fetch('https://api.mainnet.hiro.so/v2/info');
|
|
4
|
+
const data = await response.json();
|
|
5
|
+
console.log('š Current Stacks Block Height:', data.stacks_tip_height);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
getLatestBlock();
|
package/menu.js
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import readline from 'node:readline/promises';
|
|
3
|
+
import { stdin as input, stdout as output } from 'node:process';
|
|
4
|
+
|
|
5
|
+
async function showMenu() {
|
|
6
|
+
const rl = readline.createInterface({ input, output });
|
|
7
|
+
let running = true;
|
|
8
|
+
|
|
9
|
+
while (running) {
|
|
10
|
+
console.log('\n==================================');
|
|
11
|
+
console.log('š STACKS HACKER TOOLKIT v3.0 š');
|
|
12
|
+
console.log('==================================');
|
|
13
|
+
console.log('1. Ping Mainnet (Block Height)');
|
|
14
|
+
console.log('2. Check STX Balance');
|
|
15
|
+
console.log('3. Scan Transaction History');
|
|
16
|
+
console.log('4. Scan NFT Holdings');
|
|
17
|
+
console.log('5. Scan Custom Coins (SIP-010)');
|
|
18
|
+
console.log('6. Exit');
|
|
19
|
+
console.log('==================================');
|
|
20
|
+
|
|
21
|
+
const choice = await rl.question('š Select an option (1-6): ');
|
|
22
|
+
|
|
23
|
+
if (choice === '1') {
|
|
24
|
+
console.log('\nš” Pinging...');
|
|
25
|
+
const response = await fetch('https://api.mainnet.hiro.so/v2/info');
|
|
26
|
+
const data = await response.json();
|
|
27
|
+
console.log('š Current Block Height:', data.stacks_tip_height);
|
|
28
|
+
} else if (choice === '2') {
|
|
29
|
+
const address = await rl.question('\nš Enter a Stacks wallet address: ');
|
|
30
|
+
const response = await fetch(`https://api.mainnet.hiro.so/extended/v1/address/${address}/balances`);
|
|
31
|
+
const data = await response.json();
|
|
32
|
+
const stxBalance = parseInt(data.stx.balance) / 1000000;
|
|
33
|
+
console.log(`\nšŖ STX Balance: ${stxBalance} STX`);
|
|
34
|
+
} else if (choice === '3') {
|
|
35
|
+
const address = await rl.question('\nš Enter a Stacks wallet address: ');
|
|
36
|
+
const response = await fetch(`https://api.mainnet.hiro.so/extended/v1/address/${address}/transactions?limit=5`);
|
|
37
|
+
const data = await response.json();
|
|
38
|
+
console.log('\nš Recent Transactions:');
|
|
39
|
+
data.results.forEach((tx, i) => console.log(`[${i + 1}] TxID: ${tx.tx_id} | Status: ${tx.tx_status}`));
|
|
40
|
+
} else if (choice === '4') {
|
|
41
|
+
const address = await rl.question('\nš Enter a Stacks wallet address: ');
|
|
42
|
+
const response = await fetch(`https://api.mainnet.hiro.so/extended/v1/tokens/nft/holdings?principal=${address}`);
|
|
43
|
+
const data = await response.json();
|
|
44
|
+
console.log('\nšØ NFT Collection:');
|
|
45
|
+
if (data.results && data.results.length > 0) {
|
|
46
|
+
data.results.forEach((nft, i) => console.log(`[${i + 1}] Asset: ${nft.asset_identifier}`));
|
|
47
|
+
} else {
|
|
48
|
+
console.log('ā No NFTs found.');
|
|
49
|
+
}
|
|
50
|
+
} else if (choice === '5') {
|
|
51
|
+
const address = await rl.question('\nš Enter a Stacks wallet address: ');
|
|
52
|
+
console.log(`\nš Fetching Custom Coins for: ${address}...`);
|
|
53
|
+
const response = await fetch(`https://api.mainnet.hiro.so/extended/v1/address/${address}/balances`);
|
|
54
|
+
const data = await response.json();
|
|
55
|
+
const tokens = Object.keys(data.fungible_tokens || {});
|
|
56
|
+
|
|
57
|
+
console.log('\nšŖ Custom Coin Portfolio:');
|
|
58
|
+
if (tokens.length > 0) {
|
|
59
|
+
tokens.forEach((token, index) => {
|
|
60
|
+
const balance = data.fungible_tokens[token].balance;
|
|
61
|
+
const tokenName = token.split('::')[1] || 'Unknown Token';
|
|
62
|
+
console.log(`[${index + 1}] ${tokenName} -> Balance: ${balance}`);
|
|
63
|
+
});
|
|
64
|
+
} else {
|
|
65
|
+
console.log('ā No custom coins found in this wallet.');
|
|
66
|
+
}
|
|
67
|
+
} else if (choice === '6') {
|
|
68
|
+
console.log('\nš Exiting toolkit. Stay safe out there!');
|
|
69
|
+
running = false;
|
|
70
|
+
} else {
|
|
71
|
+
console.log('\nā Invalid choice, please try again.');
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
rl.close();
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
showMenu();
|
package/package.json
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "stacks-hacker-menu-dood",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "A CLI toolkit for scanning the Stacks blockchain",
|
|
5
|
+
"main": "menu.js",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"bin": {
|
|
8
|
+
"stacks-menu": "menu.js"
|
|
9
|
+
},
|
|
10
|
+
"author": "Web3 King",
|
|
11
|
+
"license": "ISC"
|
|
12
|
+
}
|