solana-tui-explorer 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/api.js +1786 -0
- package/bin/st.js +3 -0
- package/config.js +87 -0
- package/data.js +197 -0
- package/index.js +61 -0
- package/package.json +51 -0
- package/panels/dashboard.js +2199 -0
- package/panels/token.js +53 -0
- package/panels/wallet.js +55 -0
package/panels/token.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
const chalk = require('chalk');
|
|
2
|
+
const Table = require('cli-table3');
|
|
3
|
+
const DATA = require('../data');
|
|
4
|
+
|
|
5
|
+
function renderToken(token) {
|
|
6
|
+
const t = DATA.token; // Mock uses BONK
|
|
7
|
+
|
|
8
|
+
console.log('\n' + chalk.bgHex('#ff6b00').black(` [ST] TOKEN ANALYTICS: ${t.symbol} `) + '\n');
|
|
9
|
+
|
|
10
|
+
console.log(`${chalk.gray('NAME')} ${t.name}`);
|
|
11
|
+
console.log(`${chalk.gray('MINT')} ${chalk.cyan(t.mint)}`);
|
|
12
|
+
console.log(`${chalk.gray('PRICE')} ${chalk.white.bold('$' + t.price.toFixed(8))}`);
|
|
13
|
+
console.log(`${chalk.gray('24H CHANGE')} ${chalk.greenBright('▲ ' + t.priceChange24h + '%')}`);
|
|
14
|
+
console.log(`${chalk.gray('MARKET CAP')} ${t.marketCap}`);
|
|
15
|
+
console.log(`${chalk.gray('24H VOLUME')} ${chalk.cyan(t.volume24h)}`);
|
|
16
|
+
console.log(`${chalk.gray('LIQUIDITY')} ${chalk.green(t.liquidity)}`);
|
|
17
|
+
console.log(`${chalk.gray('HOLDERS')} ${t.holders}\n`);
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
console.log(chalk.hex('#ff6b00').bold(' RISK SIGNALS '));
|
|
21
|
+
const riskTable = new Table({
|
|
22
|
+
head: [chalk.gray('LEVEL'), chalk.gray('SIGNAL'), chalk.gray('DETAIL')],
|
|
23
|
+
style: { head: [], border: ['gray'] }
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
t.riskSignals.forEach(r => {
|
|
27
|
+
const rc = r.level === 'HIGH' ? chalk.bgRed.black : r.level === 'MEDIUM' ? chalk.bgYellow.black : chalk.bgGreen.black;
|
|
28
|
+
riskTable.push([
|
|
29
|
+
rc(` ${r.level} `),
|
|
30
|
+
chalk.white(r.label),
|
|
31
|
+
chalk.gray(r.detail)
|
|
32
|
+
]);
|
|
33
|
+
});
|
|
34
|
+
console.log(riskTable.toString() + '\n');
|
|
35
|
+
|
|
36
|
+
console.log(chalk.hex('#ff6b00').bold(' TOP HOLDERS '));
|
|
37
|
+
const holdersTable = new Table({
|
|
38
|
+
head: [chalk.gray('RANK'), chalk.gray('ADDRESS'), chalk.gray('SHARE'), chalk.gray('LABEL')],
|
|
39
|
+
style: { head: [], border: ['gray'] }
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
t.topHolders.forEach(h => {
|
|
43
|
+
holdersTable.push([
|
|
44
|
+
chalk.gray(`#${h.rank}`),
|
|
45
|
+
chalk.cyan(h.address),
|
|
46
|
+
chalk.hex('#ff6b00').bold(`${h.pct}%`),
|
|
47
|
+
chalk.gray(h.label)
|
|
48
|
+
]);
|
|
49
|
+
});
|
|
50
|
+
console.log(holdersTable.toString() + '\n');
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
module.exports = { renderToken };
|
package/panels/wallet.js
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
const chalk = require('chalk');
|
|
2
|
+
const Table = require('cli-table3');
|
|
3
|
+
const DATA = require('../data');
|
|
4
|
+
|
|
5
|
+
function renderWallet(address) {
|
|
6
|
+
const w = DATA.wallet;
|
|
7
|
+
|
|
8
|
+
console.log('\n' + chalk.bgHex('#ff6b00').black(` [ST] WALLET INSIGHTS `) + '\n');
|
|
9
|
+
|
|
10
|
+
console.log(`${chalk.gray('ADDRESS')} ${chalk.cyan.underline(address || w.address)}`);
|
|
11
|
+
console.log(`${chalk.gray('PORTFOLIO VALUE')} ${chalk.white.bold('$' + w.totalValue.toLocaleString())}`);
|
|
12
|
+
console.log(`${chalk.gray('PNL (24H)')} ${chalk.green('+$' + w.pnl.day + ' (+' + w.pnl.dayPct + '%)')}`);
|
|
13
|
+
console.log(`${chalk.gray('PNL (30D)')} ${chalk.green('+$' + w.pnl.month + ' (+' + w.pnl.monthPct + '%)')}\n`);
|
|
14
|
+
|
|
15
|
+
console.log(chalk.hex('#ff6b00').bold(' HOLDINGS '));
|
|
16
|
+
const table = new Table({
|
|
17
|
+
head: [chalk.gray('TOKEN'), chalk.gray('AMOUNT'), chalk.gray('VALUE'), chalk.gray('ALLOC'), chalk.gray('24H %')],
|
|
18
|
+
style: { head: [], border: ['gray'] }
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
w.holdings.forEach(h => {
|
|
22
|
+
const c = h.change > 0 ? chalk.greenBright : h.change < 0 ? chalk.redBright : chalk.gray;
|
|
23
|
+
const arrow = h.change > 0 ? '▲' : h.change < 0 ? '▼' : '─';
|
|
24
|
+
table.push([
|
|
25
|
+
chalk.white.bold(h.token),
|
|
26
|
+
h.amount.toString(),
|
|
27
|
+
`$${h.value.toLocaleString()}`,
|
|
28
|
+
`${h.pct}%`,
|
|
29
|
+
c(`${arrow} ${Math.abs(h.change)}%`)
|
|
30
|
+
]);
|
|
31
|
+
});
|
|
32
|
+
console.log(table.toString() + '\n');
|
|
33
|
+
|
|
34
|
+
console.log(chalk.hex('#ff6b00').bold(' RECENT TRANSACTIONS '));
|
|
35
|
+
const txTable = new Table({
|
|
36
|
+
head: [chalk.gray('TIME'), chalk.gray('TYPE'), chalk.gray('FROM'), chalk.gray('TO'), chalk.gray('STATUS')],
|
|
37
|
+
style: { head: [], border: ['gray'] }
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
const typeColors = { SWAP: chalk.cyan, BUY: chalk.greenBright, SELL: chalk.redBright, STAKE: chalk.yellow };
|
|
41
|
+
|
|
42
|
+
w.recentTxns.forEach(tx => {
|
|
43
|
+
const tc = typeColors[tx.type] || chalk.white;
|
|
44
|
+
txTable.push([
|
|
45
|
+
chalk.gray(tx.time),
|
|
46
|
+
tc.bold(tx.type),
|
|
47
|
+
tx.from,
|
|
48
|
+
tx.to,
|
|
49
|
+
chalk.green(tx.status)
|
|
50
|
+
]);
|
|
51
|
+
});
|
|
52
|
+
console.log(txTable.toString() + '\n');
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
module.exports = { renderWallet };
|