solana-risk-engine 0.5.5 → 0.5.6
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/package.json +1 -1
- package/src/risk.js +12 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "solana-risk-engine",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.6",
|
|
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/risk.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { EXT_POINTS, RANKS, PUMP_CURVE_DEXES, CL_POOL_LABELS, ISSUERS, OFFICIAL_TOKENS, FAMOUS } from "./constants.js";
|
|
2
2
|
import { isCancel } from "./errors.js";
|
|
3
3
|
import { short, sleep } from "./util.js";
|
|
4
|
-
import { getMint, getAuthKinds, getConc } from "./tokens.js";
|
|
4
|
+
import { getMint, getAuthKinds, getConc, kindOf } from "./tokens.js";
|
|
5
5
|
import { impostorOf, brandOf, copiesOf, fakeLiquidity, washTrades, washSignal } from "./markets.js";
|
|
6
6
|
import { rugcheckSummary, creatorLaunches } from "./rugcheck.js";
|
|
7
7
|
import { chainLaunches } from "./launch.js";
|
|
@@ -320,8 +320,8 @@ export async function assess(client, mint, pair, opts) {
|
|
|
320
320
|
// Who trades it (fake volume): one GeckoTerminal request, only for a single token and a market under 90 days
|
|
321
321
|
const youngMkt = pair && pair.pairCreatedAt && Date.now() - pair.pairCreatedAt < 90 * DAY;
|
|
322
322
|
const washPromise = youngMkt && opts.copies && !opts.noGecko && !OFFICIAL_TOKENS[mint] ? washTrades(client, pair).catch(function (e) { if (isCancel(e)) throw e; return null; }) : Promise.resolve(null);
|
|
323
|
-
let info = null, conc = null;
|
|
324
|
-
try { info = await getMint(client, mint); } catch (e) { if (isCancel(e)) throw e; }
|
|
323
|
+
let info = null, conc = null, mintFailed = false;
|
|
324
|
+
try { info = await getMint(client, mint); } catch (e) { if (isCancel(e)) throw e; mintFailed = true; }
|
|
325
325
|
if (info && info.decimals === 0 && info.supply === 1) return null; // NFT
|
|
326
326
|
// Without a market concentration is not checked: saves half the requests
|
|
327
327
|
if (info && pair && (info.mintAuth || info.freezeAuth)) {
|
|
@@ -374,7 +374,16 @@ export async function assess(client, mint, pair, opts) {
|
|
|
374
374
|
// a copy of a famous token or a real company, or liquidity faked 100 times over, is high risk even
|
|
375
375
|
// when everything else looks normal: it is built to look like something it is not
|
|
376
376
|
if (imp || (brand && brand.exact) || (fakeLiquidity(pair) && !anyIssuer(info, mint))) { if (lvl !== "HIGH") sev += 5; lvl = "HIGH"; }
|
|
377
|
+
} else if (mintFailed) {
|
|
378
|
+
// the RPC did not answer: unknown, not spam (a network error showed "probable spam" and the bot sent "worse")
|
|
379
|
+
lvl = "NO_DATA"; reasons = [sig("NO_INFO", "na")];
|
|
377
380
|
} else {
|
|
381
|
+
// without a market the authorities are not looked up on chain (one request per token, and a wallet holds
|
|
382
|
+
// hundreds of spam tokens): a key off the curve can only be a program's, which is all score() needs
|
|
383
|
+
if (info && !info.authKind) {
|
|
384
|
+
info.authKind = {};
|
|
385
|
+
[info.mintAuth, info.freezeAuth].forEach(function (k) { if (k) info.authKind[k] = kindOf(k, null, true); });
|
|
386
|
+
}
|
|
378
387
|
const s = score(info);
|
|
379
388
|
pts = s.pts; reasons = s.why; lvl = pts >= 25 ? "SPAM" : "NO_MARKET";
|
|
380
389
|
// an official token with no Solana pool (bgSOL trades on Bitget) is not spam: its issuer mints it
|