solana-risk-engine 0.5.0 → 0.5.1
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/README.md +1 -0
- package/package.json +1 -1
- package/src/i18n/en.js +8 -1
- package/src/i18n/es.js +8 -1
- package/src/index.js +1 -0
- package/src/known.js +30 -0
- package/src/risk.js +2 -1
- package/src/tokens.js +13 -3
package/README.md
CHANGED
|
@@ -77,6 +77,7 @@ Methods (all accept `{ onProgress(step, fraction) }`):
|
|
|
77
77
|
| `analyzeAddress(addr)` | `{ kind: "token" \| "wallet", ... }`, detected automatically |
|
|
78
78
|
| `analyzeHolders(mint)` | `{ rows, clusters, groups, hotGroups, creator, mode, ageDays, signals, ... }`. Young tokens (under 14 days) also trace busy wallets; a source over 100 tx/h counts as an exchange; a group over 10% (young) or 15% (mature) of the supply gives a `HOLD_GROUP` signal. With `{ base: true }` it also reads [SolFlag's wallet base](https://solflag.com/datos/base.json) (exchanges, launch farms, distributors and serial creators its collector has seen): known exchanges are recognised without measuring them, and rows and group sources get `known` / `knownSources`. Best with your own RPC. |
|
|
79
79
|
| `loadWalletBase([url])` | SolFlag's wallet base `{ wallets: { addr: { t, ph, n, roles } } }`, or `null` if it cannot be read. Kept 10 minutes. `knownType(base, addr)` gives a wallet's type. |
|
|
80
|
+
| `knownWallet(addr)` | `{ n, t }` for a wallet with a public name (exchange hot wallets of Binance, Coinbase, OKX, Bybit, Kraken and others, each checked against its Solscan label), or `null`. Concentration leaves these exchanges out of the count and names them (`ex`, `exn` in the signal data). |
|
|
80
81
|
| `analyzeHolders(mint)` | `{ rows, clusters, groups, hotGroups, creator, mode, ageDays, signals, ... }`. Young tokens (under 14 days) also trace busy wallets; a source over 100 tx/h counts as an exchange; a group over 10% (young) or 15% (mature) of the supply gives a `HOLD_GROUP` signal. Best with your own RPC. |
|
|
81
82
|
| `connectionMap(mint, { createdAt })` | `{ mode, holders, sources, groups, nets, hub, creator, payer, signals }`: largest holders typed person / bot / exchange (over 100 tx/h) / pool, who gave each one its first SOL, groups sharing that source, RugCheck's token-transfer networks with their links. `young` (under 14 days) or `mature` decides what is traced and when it warns (`MAP_GROUP`, `MAP_SWARM` for 10+ holders from one source whatever they hold, `MAP_HUB`, `MAP_WHALE`). 20 holders, 75 with your own RPC. |
|
|
82
83
|
| `estimatePnl(wallets)` | `{ pnl: { [wallet]: { realized, unreal, total, ret, st, open } } }`. Needs Helius. |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "solana-risk-engine",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "Explainable risk analysis for Solana tokens and wallets: creator control, real holder concentration, inflated liquidity, impostor tokens, funder clusters and PnL. Zero dependencies, runs in Node and the browser.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.js",
|
package/src/i18n/en.js
CHANGED
|
@@ -5,7 +5,13 @@ function usd(n) {
|
|
|
5
5
|
}
|
|
6
6
|
function pct(n) { return Math.round(n) + "%"; }
|
|
7
7
|
function short(a) { return a.slice(0, 4) + "…" + a.slice(-4); }
|
|
8
|
-
function prog(d) {
|
|
8
|
+
function prog(d) {
|
|
9
|
+
let s = d && d.prog >= 20 ? ". Pools and programs hold " + pct(d.prog) : "";
|
|
10
|
+
// named exchanges: their users' funds, not one person who can sell (not counted)
|
|
11
|
+
if (d && d.ex >= 1) s += ". " + (d.exn && d.exn.length ? d.exn.slice(0, 2).join(" and ") + (d.exn.length > 2 ? " and other exchanges" : "") : "Exchanges") +
|
|
12
|
+
" hold" + (d.exn && d.exn.length === 1 ? "s" : "") + " " + pct(d.ex) + ": their users' funds, not counted";
|
|
13
|
+
return s;
|
|
14
|
+
}
|
|
9
15
|
|
|
10
16
|
const EXT = {
|
|
11
17
|
permanentDelegate: "The issuer can move or burn your tokens (permanent delegate). Normal for tokenized stocks, but you have to trust the issuer",
|
|
@@ -53,6 +59,7 @@ export default {
|
|
|
53
59
|
CON_SKIPPED: () => "Holder concentration not checked",
|
|
54
60
|
CON_UNAVAILABLE: () => "Could not check holder concentration (the service did not answer; try again in a while)",
|
|
55
61
|
CON_ALL_POOLS: (d) => "Almost all the supply is in pools or programs" + prog(d),
|
|
62
|
+
CON_EXCHANGES: (d) => "Almost all the supply is in exchanges, pools or programs" + prog(d),
|
|
56
63
|
CON_OK: (d) => "No worrying concentration (largest individual wallet: " + pct(d.w1) + ")" + prog(d),
|
|
57
64
|
CON_TRUSTED: (d) => "Not counted: in a token from " + d.issuer + " the large holders are its treasury, custodians, exchanges and protocols",
|
|
58
65
|
CON_ISSUER: (d) => "The largest wallet holds " + pct(d.w1) + " and the top 10 hold " + pct(d.w10) + ": with a verified issuer these are usually its treasury, custodians, exchanges or protocols, so it does not count as a risk" + prog(d),
|
package/src/i18n/es.js
CHANGED
|
@@ -8,7 +8,13 @@ function usd(n) {
|
|
|
8
8
|
}
|
|
9
9
|
function pct(n) { return Math.round(n) + "%"; }
|
|
10
10
|
function short(a) { return a.slice(0, 4) + "…" + a.slice(-4); }
|
|
11
|
-
function prog(d) {
|
|
11
|
+
function prog(d) {
|
|
12
|
+
let s = d && d.prog >= 20 ? ". Los pools y programas guardan el " + pct(d.prog) : "";
|
|
13
|
+
// exchanges con nombre: fondos de sus usuarios, no una persona que pueda vender (no cuentan)
|
|
14
|
+
if (d && d.ex >= 1) s += ". " + (d.exn && d.exn.length ? d.exn.slice(0, 2).join(" y ") + (d.exn.length > 2 ? " y otros exchanges" : "") : "Los exchanges") +
|
|
15
|
+
" guarda" + (d.exn && d.exn.length === 1 ? "" : "n") + " el " + pct(d.ex) + ": son fondos de sus usuarios y no cuentan";
|
|
16
|
+
return s;
|
|
17
|
+
}
|
|
12
18
|
|
|
13
19
|
const EXT = {
|
|
14
20
|
permanentDelegate: "El emisor puede mover o quemar tus tokens (delegado permanente). Es normal en acciones tokenizadas, pero hay que confiar en el emisor",
|
|
@@ -56,6 +62,7 @@ export default {
|
|
|
56
62
|
CON_SKIPPED: () => "Sin comprobar la concentración de holders",
|
|
57
63
|
CON_UNAVAILABLE: () => "No se pudo comprobar la concentración de holders (el servicio no respondió; prueba otra vez en un rato)",
|
|
58
64
|
CON_ALL_POOLS: (d) => "Casi todo el supply está en pools o programas" + prog(d),
|
|
65
|
+
CON_EXCHANGES: (d) => "Casi todo el supply está en exchanges, pools o programas" + prog(d),
|
|
59
66
|
CON_OK: (d) => "Sin concentración preocupante (mayor wallet individual: " + pct(d.w1) + ")" + prog(d),
|
|
60
67
|
CON_TRUSTED: (d) => "No cuenta: en un token de " + d.issuer + " los grandes holders son su tesorería, custodios, exchanges y protocolos",
|
|
61
68
|
CON_ISSUER: (d) => "La mayor wallet tiene el " + pct(d.w1) + " y las 10 mayores el " + pct(d.w10) + ": con un emisor verificado suelen ser su tesorería, custodios, exchanges o protocolos, no cuenta como riesgo" + prog(d),
|
package/src/index.js
CHANGED
|
@@ -47,6 +47,7 @@ export { createClient };
|
|
|
47
47
|
export { ScanError, isCancel } from "./errors.js";
|
|
48
48
|
export * from "./constants.js";
|
|
49
49
|
export { isOnCurve, onCurve, b58bytes } from "./curve.js";
|
|
50
|
+
export { KNOWN_WALLETS, knownWallet } from "./known.js";
|
|
50
51
|
export { getTokens, getMint, getConc, getAuthKinds, isMint, accountKinds, kindOf } from "./tokens.js";
|
|
51
52
|
export { getMarkets, realLiq, impostorOf, INFLATED_RATIO, geckoLiquidity, geckoPair, brandOf, copiesOf, fakeLiquidity, FAKE_LIQ_RATIO } from "./markets.js";
|
|
52
53
|
export { rugcheckSummary, rugcheckReport, rugcheckGraph, netBalances, creatorLaunches, CREATOR_DEAD_MCAP } from "./rugcheck.js";
|
package/src/known.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// Wallets with a public name. Each address was checked by hand against its public label on Solscan
|
|
2
|
+
// (5 Nov 2026) before being added: a wrong entry would hide a real whale, so only add what you can verify.
|
|
3
|
+
// Exchanges keep their users' funds in these hot wallets, so a big balance there is not one person
|
|
4
|
+
// who can dump: concentration names them and leaves them out of the count.
|
|
5
|
+
export const KNOWN_WALLETS = {
|
|
6
|
+
"2ojv9BAiHUrvsm9gxDe7fJSzbNZSJcxZvf8dqmWGHG8S": { n: "Binance", t: "exchange" },
|
|
7
|
+
"5tzFkiKscXHK5ZXCGbXZxdw7gTjjD1mBwuoFbhUvuAi9": { n: "Binance", t: "exchange" },
|
|
8
|
+
"9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM": { n: "Binance", t: "exchange" },
|
|
9
|
+
"3yFwqXBfZY4jBVUafQ1YEXw189y2dN3V5KQq9uzBDy1E": { n: "Binance", t: "exchange" },
|
|
10
|
+
"H8sMJSCQxfKiFTCfDR3DUMLPwcRbM61LGFJ8N4dK3WjS": { n: "Coinbase", t: "exchange" },
|
|
11
|
+
"2AQdpHJ2JpcEgPiATUXjQxA8QmafFegfQwSLWSprPicm": { n: "Coinbase", t: "exchange" },
|
|
12
|
+
"GJRs4FwHtemZ5ZE9x3FNvJ8TMwitKTh21yxdRPqn7npE": { n: "Coinbase", t: "exchange" },
|
|
13
|
+
"5VCwKtCXgCJ6kit5FybXjvriW3xELsFDhYrPSqtJNmcD": { n: "OKX", t: "exchange" },
|
|
14
|
+
"9un5wqE3q4oCjyrDkwsdD48KteCJitQX5978Vh7KKxHo": { n: "OKX", t: "exchange" },
|
|
15
|
+
"AC5RDfQFmDS1deWZos921JfqscXdByf8BKHs5ACWjtW2": { n: "Bybit", t: "exchange" },
|
|
16
|
+
"FWznbcNXWQuHTawe9RxvQ2LdCENssh12dsznf4RiouN5": { n: "Kraken", t: "exchange" },
|
|
17
|
+
"u6PJ8DtQuPFnfmwHbGFULQ4u4EgjDiyYKjVEsynXq2w": { n: "Gate", t: "exchange" },
|
|
18
|
+
"BmFdpraQhkiDQE6SnfG5omcA1VwzqfXrwtNYBwWTymy6": { n: "KuCoin", t: "exchange" },
|
|
19
|
+
"ASTyfSima4LLAdDgoFGkgqoKowG1LZFDr9fAQrg7iaJZ": { n: "MEXC", t: "exchange" },
|
|
20
|
+
"A77HErqtfN1hLLpvZ9pCtu66FEtM8BveoaKbbMoZ4RiR": { n: "Bitget", t: "exchange" },
|
|
21
|
+
"88xTWZMeKfiTgbfEmPLdsUCQcZinwUfk25EBQZ21XMAZ": { n: "HTX", t: "exchange" },
|
|
22
|
+
"6FEVkH17P9y8Q9aCkDdPcMDjvj7SVxrTETaYEm8f51Jy": { n: "Crypto.com", t: "exchange" },
|
|
23
|
+
// off the curve, so it already counts as a program; named so it can be shown
|
|
24
|
+
"1nc1nerator11111111111111111111111111111111": { n: "Incinerator", t: "burn" }
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
// {n, t} for a named wallet, or null
|
|
28
|
+
export function knownWallet(addr) {
|
|
29
|
+
return Object.prototype.hasOwnProperty.call(KNOWN_WALLETS, addr) ? KNOWN_WALLETS[addr] : null;
|
|
30
|
+
}
|
package/src/risk.js
CHANGED
|
@@ -157,7 +157,8 @@ export function buildLights(info, conc, pair, value, type, rc, now, launches) {
|
|
|
157
157
|
if (conc.w1 > 30 || conc.w10 > 70) st = "bad"; else if (conc.w1 > 15 || conc.w10 > 50) st = "warn";
|
|
158
158
|
if (soft && st === "bad") st = "warn";
|
|
159
159
|
const data = { w1: conc.w1, w10: conc.w10, prog: conc.prog, wallets: conc.nW }; // prog >= 20 is worth mentioning
|
|
160
|
-
|
|
160
|
+
if (conc.ex) { data.ex = conc.ex; data.exn = conc.exn; } // named exchanges, shown but not counted
|
|
161
|
+
let code = !conc.nW ? (conc.ex ? "CON_EXCHANGES" : "CON_ALL_POOLS") : (st === "ok" ? "CON_OK" : "CON_HIGH");
|
|
161
162
|
// under a verified issuer the big holders are its treasury, custodians, exchanges and lending
|
|
162
163
|
// protocols, not someone about to dump: shown, not counted (PYUSD 56% in one wallet, 1/11)
|
|
163
164
|
if (issuer && code === "CON_HIGH") { code = "CON_ISSUER"; st = "ok"; }
|
package/src/tokens.js
CHANGED
|
@@ -2,6 +2,7 @@ import { TOKEN_PROGRAM, TOKEN_2022, SYSTEM_PROGRAM } from "./constants.js";
|
|
|
2
2
|
import { isCancel } from "./errors.js";
|
|
3
3
|
import { onCurve, b58bytes } from "./curve.js";
|
|
4
4
|
import { uniq } from "./util.js";
|
|
5
|
+
import { knownWallet } from "./known.js";
|
|
5
6
|
|
|
6
7
|
// SOL balance and every token the wallet holds (classic SPL + Token-2022), summed by mint
|
|
7
8
|
export async function getTokens(client, wallet) {
|
|
@@ -118,14 +119,23 @@ export async function getConc(client, mint, supply) {
|
|
|
118
119
|
const kind = await accountKinds(client, uniq(owners), true); // emptied wallets (0 SOL) still count
|
|
119
120
|
const agg = {};
|
|
120
121
|
owners.forEach(function (o, i) { agg[o] = (agg[o] || 0) + amts[i]; });
|
|
121
|
-
const ws = [];
|
|
122
|
-
let prog = 0;
|
|
123
|
-
Object.keys(agg).forEach(function (o) {
|
|
122
|
+
const ws = [], exs = {};
|
|
123
|
+
let prog = 0, ex = 0;
|
|
124
|
+
Object.keys(agg).forEach(function (o) {
|
|
125
|
+
const k = knownWallet(o);
|
|
126
|
+
if (kind[o] === "wallet" && k && k.t === "exchange") { ex += agg[o]; exs[k.n] = (exs[k.n] || 0) + agg[o]; } // users' funds, not one person
|
|
127
|
+
else if (kind[o] === "wallet") ws.push(agg[o]);
|
|
128
|
+
else prog += agg[o];
|
|
129
|
+
});
|
|
124
130
|
ws.sort(function (x, y) { return y - x; });
|
|
125
131
|
out.ok = true; out.nW = ws.length;
|
|
126
132
|
out.w1 = ws.length ? ws[0] / supply * 100 : 0;
|
|
127
133
|
out.w10 = ws.slice(0, 10).reduce(function (s, x) { return s + x; }, 0) / supply * 100;
|
|
128
134
|
out.prog = prog / supply * 100;
|
|
135
|
+
if (ex) {
|
|
136
|
+
out.ex = ex / supply * 100;
|
|
137
|
+
out.exn = Object.keys(exs).sort(function (x, y) { return exs[y] - exs[x]; });
|
|
138
|
+
}
|
|
129
139
|
} catch (e) { if (isCancel(e)) throw e; }
|
|
130
140
|
return out;
|
|
131
141
|
}
|