solana-risk-engine 0.7.0 → 0.7.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/package.json +1 -1
- package/src/constants.js +3 -0
- package/src/markets.js +17 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "solana-risk-engine",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.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/constants.js
CHANGED
|
@@ -5,6 +5,9 @@
|
|
|
5
5
|
export const PUBLIC_RPC = "https://solana-rpc.publicnode.com";
|
|
6
6
|
export const VIBE_RPC = "https://public.rpc.solanavibestation.com";
|
|
7
7
|
export const DEX = "https://api.dexscreener.com/tokens/v1/solana/";
|
|
8
|
+
// All pools of ONE token (up to 30). tokens/v1 returns a single pool per token, not always the deepest
|
|
9
|
+
// (22/11/2026: WIF showed an $87k Orca pool while its Raydium pool had $3.6M)
|
|
10
|
+
export const DEX_PAIRS = "https://api.dexscreener.com/token-pairs/v1/solana/";
|
|
8
11
|
// SolFlag's wallet base (see base.js)
|
|
9
12
|
export const WALLET_BASE_URL = "https://solflag.com/datos/base.json";
|
|
10
13
|
export const DEX_SEARCH = "https://api.dexscreener.com/latest/dex/search?q=";
|
package/src/markets.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DEX, DEX_SEARCH, GECKO, USDC, USDT, WSOL, FAMOUS, BRANDS, brandKey, BRAND_MATURE_DAYS, BRAND_MATURE_LIQ, COPY_MIN_LIQ } from "./constants.js";
|
|
1
|
+
import { DEX, DEX_PAIRS, DEX_SEARCH, GECKO, USDC, USDT, WSOL, FAMOUS, BRANDS, brandKey, BRAND_MATURE_DAYS, BRAND_MATURE_LIQ, COPY_MIN_LIQ } from "./constants.js";
|
|
2
2
|
import { ScanError, isCancel } from "./errors.js";
|
|
3
3
|
import { sleep } from "./util.js";
|
|
4
4
|
|
|
@@ -88,6 +88,22 @@ export async function copiesOf(client, mint, pair, now) {
|
|
|
88
88
|
export async function getMarkets(client, mints, onStep) {
|
|
89
89
|
const best = {};
|
|
90
90
|
let failed = [];
|
|
91
|
+
// One token (the scanner's usual case): ask for all its pools and keep the deepest one where it is the
|
|
92
|
+
// base token. If that fails or finds nothing, fall back to the batch request below.
|
|
93
|
+
if (mints.length === 1) {
|
|
94
|
+
const m = mints[0];
|
|
95
|
+
try {
|
|
96
|
+
const pares = await client.jfetch(DEX_PAIRS + m);
|
|
97
|
+
if (Array.isArray(pares)) pares.forEach(function (p) {
|
|
98
|
+
if (!p || !p.baseToken || p.baseToken.address !== m || (p.chainId && p.chainId !== "solana")) return;
|
|
99
|
+
realLiq(p);
|
|
100
|
+
const liq = (p.liquidity && p.liquidity.usd) || 0;
|
|
101
|
+
const cur = best[m] && best[m].liquidity && best[m].liquidity.usd || 0;
|
|
102
|
+
if (!best[m] || liq > cur) best[m] = p;
|
|
103
|
+
});
|
|
104
|
+
} catch (e) { if (isCancel(e)) throw e; }
|
|
105
|
+
if (best[m]) { if (onStep) onStep(1, 1); return { data: best, failed: failed }; }
|
|
106
|
+
}
|
|
91
107
|
for (let i = 0; i < mints.length; i += 30) {
|
|
92
108
|
const lote = mints.slice(i, i + 30);
|
|
93
109
|
try {
|