solana-risk-engine 0.4.1 → 0.4.3

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/src/client.js CHANGED
@@ -1,143 +1,157 @@
1
- import { PUBLIC_RPC, VIBE_RPC } from "./constants.js";
2
- import { ScanError, cancelled, isCancel } from "./errors.js";
3
- import { sleep } from "./util.js";
4
-
5
- // Methods PublicNode rejects with 403; if another one shows up it gets added at runtime
6
- const PN_BLOCKED_DEFAULT = ["getTokenLargestAccounts", "getTokenAccountsByOwner", "getTokenSupply"];
7
-
8
- /**
9
- * Creates the network client every engine function uses.
10
- *
11
- * @param {object} [opts]
12
- * @param {string} [opts.rpcUrl] your own RPC URL (Helius, Triton...). Without it the free
13
- * PublicNode + Solana Vibe Station combination is used.
14
- * @param {string} [opts.heliusApiKey] Helius key for PnL. If omitted it is taken from rpcUrl when
15
- * that URL is a Helius one (the key is never sent anywhere else).
16
- * @param {AbortSignal} [opts.signal] aborts every pending request with a CANCELLED ScanError
17
- * @param {Function} [opts.fetch] fetch implementation (defaults to globalThis.fetch)
18
- * @param {number} [opts.retryDelayMs] first retry delay, doubled each time (default 1200)
19
- * @param {number} [opts.vibeIntervalMs] spacing of the free Vibe Station queue (default 1100)
20
- */
21
- export function createClient(opts) {
22
- opts = opts || {};
23
- const fetchImpl = opts.fetch || globalThis.fetch;
24
- if (!fetchImpl) throw new Error("no fetch available: pass opts.fetch or use Node 18+");
25
- const rpcUrl = (opts.rpcUrl || "").trim() || PUBLIC_RPC;
26
- const publicRpc = opts.publicRpc || PUBLIC_RPC;
27
- const vibeRpc = opts.vibeRpc || VIBE_RPC;
28
- const signal = opts.signal || null;
29
- const retryDelay = opts.retryDelayMs === undefined ? 1200 : opts.retryDelayMs;
30
- const vibeInterval = opts.vibeIntervalMs === undefined ? 1100 : opts.vibeIntervalMs;
31
- const blocked = {};
32
- PN_BLOCKED_DEFAULT.forEach(function (m) { blocked[m] = 1; });
33
- let vibeNext = 0;
34
-
35
- function checkAbort() {
36
- if (signal && signal.aborted) throw cancelled();
37
- }
38
- function ownRpc() {
39
- return rpcUrl !== publicRpc;
40
- }
41
- function heliusKey() {
42
- if (opts.heliusApiKey) return opts.heliusApiKey;
43
- // Only use the key if the configured RPC really is Helius: otherwise it is never sent to api.helius.xyz
44
- try {
45
- const u = new URL(rpcUrl);
46
- if (!/(^|\.)helius-rpc\.com$|(^|\.)helius\.xyz$/i.test(u.hostname)) return null;
47
- return u.searchParams.get("api-key") || null;
48
- } catch (e) { return null; }
49
- }
50
-
51
- async function rawFetch(url, init) {
52
- checkAbort();
53
- try {
54
- return await fetchImpl(url, signal ? Object.assign({}, init, { signal: signal }) : init);
55
- } catch (e) {
56
- if (signal && signal.aborted) throw cancelled();
57
- throw e;
58
- }
59
- }
60
-
61
- // JSON fetch with retries on 429, 5xx and network errors (doubling the wait each time)
62
- async function jfetch(url, init, tries) {
63
- let wait = retryDelay, last = null;
64
- tries = tries || 4;
65
- for (let i = 0; i < tries; i++) {
66
- checkAbort();
67
- try {
68
- const r = await rawFetch(url, init);
69
- if (r.status === 429 || r.status >= 500) {
70
- last = new ScanError("HTTP", "HTTP " + r.status, { status: r.status });
71
- await sleep(wait); wait *= 2; continue;
72
- }
73
- if (!r.ok) throw new ScanError("HTTP", "HTTP " + r.status, { status: r.status });
74
- return await r.json();
75
- } catch (e) {
76
- if (isCancel(e) || (e.code === "HTTP" && e.data.status >= 400 && e.data.status < 500)) throw e;
77
- last = e; await sleep(wait); wait *= 2;
78
- }
79
- }
80
- if (last && last.code) throw last;
81
- throw new ScanError("NETWORK", (last && last.message) || "no response", { cause: last && last.message });
82
- }
83
-
84
- // Fetch that never throws (except on cancel): used for optional extras such as RugCheck,
85
- // which must never block the main result if they fail, time out or are down
86
- async function softJson(url, timeoutMs) {
87
- checkAbort();
88
- const ctrl = typeof AbortController !== "undefined" ? new AbortController() : null;
89
- let onAbort = null;
90
- if (ctrl && signal) { onAbort = function () { ctrl.abort(); }; signal.addEventListener("abort", onAbort); }
91
- const to = ctrl ? setTimeout(function () { ctrl.abort(); }, timeoutMs || 8000) : null;
92
- try {
93
- const r = await fetchImpl(url, ctrl ? { signal: ctrl.signal } : undefined);
94
- if (!r.ok) return null;
95
- return await r.json();
96
- } catch (e) {
97
- return null;
98
- } finally {
99
- if (to) clearTimeout(to);
100
- if (onAbort) signal.removeEventListener("abort", onAbort);
101
- checkAbort();
102
- }
103
- }
104
-
105
- async function rpcAt(url, method, params, tries) {
106
- const j = await jfetch(url, {
107
- method: "POST",
108
- headers: { "Content-Type": "application/json" },
109
- body: JSON.stringify({ jsonrpc: "2.0", id: 1, method: method, params: params })
110
- }, tries);
111
- if (j.error) throw new ScanError("RPC", j.error.message || "RPC error", { rpcCode: j.error.code });
112
- return j.result;
113
- }
114
-
115
- async function vibeSlot() {
116
- const now = Date.now(), at = Math.max(now, vibeNext);
117
- vibeNext = at + vibeInterval;
118
- if (at > now) await sleep(at - now);
119
- checkAbort();
120
- }
121
-
122
- async function rpc(method, params) {
123
- if (ownRpc()) return rpcAt(rpcUrl, method, params);
124
- // PublicNode accepts at most 10 accounts per getMultipleAccounts: split and merge the result
125
- if (method === "getMultipleAccounts" && params[0].length > 10) {
126
- const parts = [];
127
- for (let i = 0; i < params[0].length; i += 10) parts.push(rpc(method, [params[0].slice(i, i + 10)].concat(params.slice(1))));
128
- const rs = await Promise.all(parts);
129
- return { context: rs[0].context, value: [].concat.apply([], rs.map(function (r) { return r.value; })) };
130
- }
131
- if (!blocked[method]) {
132
- try { return await rpcAt(publicRpc, method, params); }
133
- catch (e) {
134
- if (isCancel(e) || !(e.code === "HTTP" && (e.data.status === 401 || e.data.status === 403))) throw e;
135
- blocked[method] = 1;
136
- }
137
- }
138
- await vibeSlot();
139
- return rpcAt(vibeRpc, method, params, 6); // more retries: its limit sometimes trips even when the queue is respected
140
- }
141
-
142
- return { rpc: rpc, jfetch: jfetch, softJson: softJson, ownRpc: ownRpc, heliusKey: heliusKey, checkAbort: checkAbort, rpcUrl: rpcUrl, retryDelayMs: opts.retryDelayMs };
143
- }
1
+ import { PUBLIC_RPC, VIBE_RPC } from "./constants.js";
2
+ import { ScanError, cancelled, isCancel } from "./errors.js";
3
+ import { sleep } from "./util.js";
4
+
5
+ // Methods PublicNode rejects with 403; if another one shows up it gets added at runtime
6
+ const PN_BLOCKED_DEFAULT = ["getTokenLargestAccounts", "getTokenAccountsByOwner", "getTokenSupply"];
7
+
8
+ /**
9
+ * Creates the network client every engine function uses.
10
+ *
11
+ * @param {object} [opts]
12
+ * @param {string} [opts.rpcUrl] your own RPC URL (Helius, Triton...). Without it the free
13
+ * PublicNode + Solana Vibe Station combination is used.
14
+ * @param {string} [opts.heliusApiKey] Helius key for PnL. If omitted it is taken from rpcUrl when
15
+ * that URL is a Helius one (the key is never sent anywhere else).
16
+ * @param {AbortSignal} [opts.signal] aborts every pending request with a CANCELLED ScanError
17
+ * @param {Function} [opts.fetch] fetch implementation (defaults to globalThis.fetch)
18
+ * @param {number} [opts.retryDelayMs] first retry delay, doubled each time (default 1200)
19
+ * @param {number} [opts.vibeIntervalMs] spacing of the free Vibe Station queue (default 1100)
20
+ */
21
+ export function createClient(opts) {
22
+ opts = opts || {};
23
+ const fetchImpl = opts.fetch || globalThis.fetch;
24
+ if (!fetchImpl) throw new Error("no fetch available: pass opts.fetch or use Node 18+");
25
+ const rpcUrl = (opts.rpcUrl || "").trim() || PUBLIC_RPC;
26
+ const publicRpc = opts.publicRpc || PUBLIC_RPC;
27
+ const vibeRpc = opts.vibeRpc || VIBE_RPC;
28
+ const signal = opts.signal || null;
29
+ const retryDelay = opts.retryDelayMs === undefined ? 1200 : opts.retryDelayMs;
30
+ const vibeInterval = opts.vibeIntervalMs === undefined ? 1100 : opts.vibeIntervalMs;
31
+ const blocked = {};
32
+ PN_BLOCKED_DEFAULT.forEach(function (m) { blocked[m] = 1; });
33
+ let vibeNext = 0;
34
+
35
+ function checkAbort() {
36
+ if (signal && signal.aborted) throw cancelled();
37
+ }
38
+ function ownRpc() {
39
+ return rpcUrl !== publicRpc;
40
+ }
41
+ function heliusKey() {
42
+ if (opts.heliusApiKey) return opts.heliusApiKey;
43
+ // Only use the key if the configured RPC really is Helius: otherwise it is never sent to api.helius.xyz
44
+ try {
45
+ const u = new URL(rpcUrl);
46
+ if (!/(^|\.)helius-rpc\.com$|(^|\.)helius\.xyz$/i.test(u.hostname)) return null;
47
+ return u.searchParams.get("api-key") || null;
48
+ } catch (e) { return null; }
49
+ }
50
+
51
+ async function rawFetch(url, init) {
52
+ checkAbort();
53
+ try {
54
+ return await fetchImpl(url, signal ? Object.assign({}, init, { signal: signal }) : init);
55
+ } catch (e) {
56
+ if (signal && signal.aborted) throw cancelled();
57
+ throw e;
58
+ }
59
+ }
60
+
61
+ // JSON fetch with retries on 429, 5xx and network errors (doubling the wait each time)
62
+ async function jfetch(url, init, tries) {
63
+ let wait = retryDelay, last = null;
64
+ tries = tries || 4;
65
+ for (let i = 0; i < tries; i++) {
66
+ checkAbort();
67
+ try {
68
+ const r = await rawFetch(url, init);
69
+ if (r.status === 429 || r.status >= 500) {
70
+ last = new ScanError("HTTP", "HTTP " + r.status, { status: r.status });
71
+ await sleep(wait); wait *= 2; continue;
72
+ }
73
+ if (!r.ok) throw new ScanError("HTTP", "HTTP " + r.status, { status: r.status });
74
+ return await r.json();
75
+ } catch (e) {
76
+ if (isCancel(e) || (e.code === "HTTP" && e.data.status >= 400 && e.data.status < 500)) throw e;
77
+ last = e; await sleep(wait); wait *= 2;
78
+ }
79
+ }
80
+ if (last && last.code) throw last;
81
+ throw new ScanError("NETWORK", (last && last.message) || "no response", { cause: last && last.message });
82
+ }
83
+
84
+ // Fetch that never throws (except on cancel): used for optional extras such as RugCheck,
85
+ // which must never block the main result if they fail, time out or are down
86
+ async function softJson(url, timeoutMs) {
87
+ checkAbort();
88
+ const ctrl = typeof AbortController !== "undefined" ? new AbortController() : null;
89
+ let onAbort = null;
90
+ if (ctrl && signal) { onAbort = function () { ctrl.abort(); }; signal.addEventListener("abort", onAbort); }
91
+ const to = ctrl ? setTimeout(function () { ctrl.abort(); }, timeoutMs || 8000) : null;
92
+ try {
93
+ const r = await fetchImpl(url, ctrl ? { signal: ctrl.signal } : undefined);
94
+ if (!r.ok) return null;
95
+ return await r.json();
96
+ } catch (e) {
97
+ return null;
98
+ } finally {
99
+ if (to) clearTimeout(to);
100
+ if (onAbort) signal.removeEventListener("abort", onAbort);
101
+ checkAbort();
102
+ }
103
+ }
104
+
105
+ async function rpcAt(url, method, params, tries) {
106
+ const j = await jfetch(url, {
107
+ method: "POST",
108
+ headers: { "Content-Type": "application/json" },
109
+ body: JSON.stringify({ jsonrpc: "2.0", id: 1, method: method, params: params })
110
+ }, tries);
111
+ if (j.error) throw new ScanError("RPC", j.error.message || "RPC error", { rpcCode: j.error.code });
112
+ return j.result;
113
+ }
114
+
115
+ async function vibeSlot() {
116
+ const now = Date.now(), at = Math.max(now, vibeNext);
117
+ vibeNext = at + vibeInterval;
118
+ if (at > now) await sleep(at - now);
119
+ checkAbort();
120
+ }
121
+
122
+ async function rpc(method, params) {
123
+ if (ownRpc()) return rpcAt(rpcUrl, method, params);
124
+ // PublicNode accepts at most 10 accounts per getMultipleAccounts: split and merge the result
125
+ if (method === "getMultipleAccounts" && params[0].length > 10) {
126
+ const parts = [];
127
+ for (let i = 0; i < params[0].length; i += 10) parts.push(rpc(method, [params[0].slice(i, i + 10)].concat(params.slice(1))));
128
+ const rs = await Promise.all(parts);
129
+ return { context: rs[0].context, value: [].concat.apply([], rs.map(function (r) { return r.value; })) };
130
+ }
131
+ if (!blocked[method]) {
132
+ try {
133
+ const res = await rpcAt(publicRpc, method, params);
134
+ // PublicNode only keeps a few days of history: a list that ends before filling the page, or a
135
+ // transaction it cannot find, may just be old. Vibe Station keeps it all, so it gets the last word
136
+ if (method === "getSignaturesForAddress" && Array.isArray(res) && res.length < ((params[1] && params[1].limit) || 1000)) {
137
+ await vibeSlot();
138
+ const full = await rpcAt(vibeRpc, method, params, 6).catch(function (e) { if (isCancel(e)) throw e; return null; });
139
+ return Array.isArray(full) && full.length > res.length ? full : res;
140
+ }
141
+ if (method === "getTransaction" && res === null) {
142
+ await vibeSlot();
143
+ return await rpcAt(vibeRpc, method, params, 6).catch(function (e) { if (isCancel(e)) throw e; return null; });
144
+ }
145
+ return res;
146
+ }
147
+ catch (e) {
148
+ if (isCancel(e) || !(e.code === "HTTP" && (e.data.status === 401 || e.data.status === 403))) throw e;
149
+ blocked[method] = 1;
150
+ }
151
+ }
152
+ await vibeSlot();
153
+ return rpcAt(vibeRpc, method, params, 6); // more retries: its limit sometimes trips even when the queue is respected
154
+ }
155
+
156
+ return { rpc: rpc, jfetch: jfetch, softJson: softJson, ownRpc: ownRpc, heliusKey: heliusKey, checkAbort: checkAbort, rpcUrl: rpcUrl, retryDelayMs: opts.retryDelayMs };
157
+ }
package/src/constants.js CHANGED
@@ -1,62 +1,78 @@
1
- // api.mainnet-beta.solana.com answers 403 to anything coming from a browser. PublicNode serves almost
2
- // everything (accounts, signatures, transactions) quickly, but blocks token-by-owner and largest-holder
3
- // queries. Those go to Solana Vibe Station, which accepts them without a key but only at ~1 per second,
4
- // so they go through a queue (see client.js). With your own RPC URL everything goes to that URL.
5
- export const PUBLIC_RPC = "https://solana-rpc.publicnode.com";
6
- export const VIBE_RPC = "https://public.rpc.solanavibestation.com";
7
- export const DEX = "https://api.dexscreener.com/tokens/v1/solana/";
8
- export const RUGCHECK = "https://api.rugcheck.xyz/v1/tokens/";
9
- export const GECKO = "https://api.geckoterminal.com/api/v2/networks/solana/";
10
- export const HELIUS_API = "https://api.helius.xyz/v0/addresses/";
11
- export const COINGECKO_SOL = "https://api.coingecko.com/api/v3/coins/solana/market_chart?vs_currency=usd&days=365";
12
-
13
- export const TOKEN_PROGRAM = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
14
- export const TOKEN_2022 = "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb";
15
- export const SYSTEM_PROGRAM = "11111111111111111111111111111111";
16
- export const PUMP_PROGRAM = "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P";
17
- // dexId of a token still on Pump.fun's bonding curve: DexScreener says "pumpfun", GeckoTerminal "pump-fun"
18
- export const PUMP_CURVE_DEXES = ["pumpfun", "pump-fun"];
19
-
20
- export const USDC = "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v";
21
- export const USDT = "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB";
22
- export const WSOL = "So11111111111111111111111111111111111111112";
23
-
24
- export const KNOWN = {
25
- [WSOL]: "SOL (wrapped)",
26
- [USDC]: "USDC",
27
- [USDT]: "USDT"
28
- };
29
-
30
- // Symbols that scams usually copy, with their official address (checked on DexScreener)
31
- export const FAMOUS = {
32
- USDC, USDT, SOL: WSOL, WSOL,
33
- JUP: "JUPyiwrYJFskUPiHa7hkeR8VUtAeFoSYbKedZNsDvCN", BONK: "DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263",
34
- WIF: "EKpQGSJtjMFqKZ9KQanSqYXRcF8fBopzLHYxdM65zcjm", PYTH: "HZ1JovNiVvGrGNiiYvEozEVgZ58xaU3RKwX8eACQBCt3",
35
- JTO: "jtojtomepa8beP8AuQc6eXt5FriJwfFMwQx2v2f9mCL", RAY: "4k3Dyjzvzp8eMZWUXbBCjEvwSkkk59S5iCNLY3QrkX6R",
36
- PYUSD: "2b1kV6DkPAnxd5ixfnxCpjxmKwqjjaYmCZfHsFu24GXo", MSOL: "mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So",
37
- JITOSOL: "J1toso1uCk3RLmjorhTtrVwY9HJ7X8V9yYac6Y7kGCPn", TRUMP: "6p6xgHyF7AeE6TZkSmFsko444wqoP15icUSqi2jfGiPN",
38
- PUMP: "pumpCmXqMfrsAkQ5r49WcJnRayYRqmXz6ae8H7H9Dfn", JLP: "27G8MtK7VtTcCHkpASjSDdkWWYfoqT6ggEuKidVJidD4",
39
- POPCAT: "7GCihgDB8fe6KNjn2MYtkzZcRjQy3t9GHdC8uHYmW2hr", HNT: "hntyVP6YFm1Hg25TN9WGLqM12b8TQmcknKrdu1oxWux",
40
- RENDER: "rndrizKT3MK1iimdxRdWabcF7Zg7AR5T4nud4EkHBof", ORCA: "orcaEKTdK7LKz57vaAYr9QeNsVEPfiu6QeMU1kektZE",
41
- DRIFT: "DriFtupJYLTosbwoN8koMbEYSx54aFAVLddWsbksjwg7",
42
- // Bitcoin and Ether only exist on Solana bridged: a Pump.fun token called "BTC" is never the real one
43
- BTC: "3NZ9JMVBmGAqocybic2c7LQCJScmgsAZ6vQqTDzcqmJh", WBTC: "3NZ9JMVBmGAqocybic2c7LQCJScmgsAZ6vQqTDzcqmJh",
44
- ETH: "7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs", WETH: "7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs"
45
- };
46
-
47
- // Token-2022 extensions that add risk, with the points they add to the no-market spam score
48
- export const EXT_POINTS = {
49
- permanentDelegate: 25,
50
- transferHook: 15,
51
- transferFeeConfig: 10,
52
- nonTransferable: 10,
53
- defaultAccountState: 10
54
- };
55
-
56
- // Risk levels, from worst to best (also the default sort order of results)
57
- export const LEVELS = ["HIGH", "MEDIUM", "LOW", "SPAM", "NO_DATA", "NO_MARKET"];
58
- export const TYPES = ["STABLE", "TOKENIZED", "BRIDGED", "CREATOR", "OPEN"];
59
- export const LIGHTS = ["control", "concentration", "market", "dependency"];
60
- export const RANKS = { ok: 0, na: 0, warn: 1, bad: 2 };
61
-
62
- export const ADDRESS_RE = /^[1-9A-HJ-NP-Za-km-z]{32,44}$/;
1
+ // api.mainnet-beta.solana.com answers 403 to anything coming from a browser. PublicNode serves almost
2
+ // everything (accounts, signatures, transactions) quickly, but blocks token-by-owner and largest-holder
3
+ // queries. Those go to Solana Vibe Station, which accepts them without a key but only at ~1 per second,
4
+ // so they go through a queue (see client.js). With your own RPC URL everything goes to that URL.
5
+ export const PUBLIC_RPC = "https://solana-rpc.publicnode.com";
6
+ export const VIBE_RPC = "https://public.rpc.solanavibestation.com";
7
+ export const DEX = "https://api.dexscreener.com/tokens/v1/solana/";
8
+ export const DEX_SEARCH = "https://api.dexscreener.com/latest/dex/search?q=";
9
+ export const RUGCHECK = "https://api.rugcheck.xyz/v1/tokens/";
10
+ export const GECKO = "https://api.geckoterminal.com/api/v2/networks/solana/";
11
+ export const HELIUS_API = "https://api.helius.xyz/v0/addresses/";
12
+ export const COINGECKO_SOL = "https://api.coingecko.com/api/v3/coins/solana/market_chart?vs_currency=usd&days=365";
13
+
14
+ export const TOKEN_PROGRAM = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
15
+ export const TOKEN_2022 = "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb";
16
+ export const SYSTEM_PROGRAM = "11111111111111111111111111111111";
17
+ export const PUMP_PROGRAM = "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P";
18
+ // dexId of a token still on Pump.fun's bonding curve: DexScreener says "pumpfun", GeckoTerminal "pump-fun"
19
+ export const PUMP_CURVE_DEXES = ["pumpfun", "pump-fun"];
20
+
21
+ export const USDC = "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v";
22
+ export const USDT = "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB";
23
+ export const WSOL = "So11111111111111111111111111111111111111112";
24
+
25
+ export const KNOWN = {
26
+ [WSOL]: "SOL (wrapped)",
27
+ [USDC]: "USDC",
28
+ [USDT]: "USDT"
29
+ };
30
+
31
+ // Symbols that scams usually copy, with their official address (checked on DexScreener)
32
+ export const FAMOUS = {
33
+ USDC, USDT, SOL: WSOL, WSOL,
34
+ JUP: "JUPyiwrYJFskUPiHa7hkeR8VUtAeFoSYbKedZNsDvCN", BONK: "DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263",
35
+ WIF: "EKpQGSJtjMFqKZ9KQanSqYXRcF8fBopzLHYxdM65zcjm", PYTH: "HZ1JovNiVvGrGNiiYvEozEVgZ58xaU3RKwX8eACQBCt3",
36
+ JTO: "jtojtomepa8beP8AuQc6eXt5FriJwfFMwQx2v2f9mCL", RAY: "4k3Dyjzvzp8eMZWUXbBCjEvwSkkk59S5iCNLY3QrkX6R",
37
+ PYUSD: "2b1kV6DkPAnxd5ixfnxCpjxmKwqjjaYmCZfHsFu24GXo", MSOL: "mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So",
38
+ JITOSOL: "J1toso1uCk3RLmjorhTtrVwY9HJ7X8V9yYac6Y7kGCPn", TRUMP: "6p6xgHyF7AeE6TZkSmFsko444wqoP15icUSqi2jfGiPN",
39
+ PUMP: "pumpCmXqMfrsAkQ5r49WcJnRayYRqmXz6ae8H7H9Dfn", JLP: "27G8MtK7VtTcCHkpASjSDdkWWYfoqT6ggEuKidVJidD4",
40
+ POPCAT: "7GCihgDB8fe6KNjn2MYtkzZcRjQy3t9GHdC8uHYmW2hr", HNT: "hntyVP6YFm1Hg25TN9WGLqM12b8TQmcknKrdu1oxWux",
41
+ RENDER: "rndrizKT3MK1iimdxRdWabcF7Zg7AR5T4nud4EkHBof", ORCA: "orcaEKTdK7LKz57vaAYr9QeNsVEPfiu6QeMU1kektZE",
42
+ DRIFT: "DriFtupJYLTosbwoN8koMbEYSx54aFAVLddWsbksjwg7",
43
+ // Bitcoin and Ether only exist on Solana bridged: a Pump.fun token called "BTC" is never the real one
44
+ BTC: "3NZ9JMVBmGAqocybic2c7LQCJScmgsAZ6vQqTDzcqmJh", WBTC: "3NZ9JMVBmGAqocybic2c7LQCJScmgsAZ6vQqTDzcqmJh",
45
+ ETH: "7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs", WETH: "7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs"
46
+ };
47
+
48
+ // Real companies with no token of their own on Solana: a memecoin called "Spotify" is not Spotify. Their
49
+ // genuine tokenized shares come from an issuer (xStocks, Backpack...) and are typed TOKENIZED, so they
50
+ // are never matched. Names only, lower case: stock tickers clash with real crypto symbols (META, COIN...)
51
+ export const BRANDS = {
52
+ spotify: "Spotify", shopify: "Shopify", tesla: "Tesla", apple: "Apple", nvidia: "Nvidia", amazon: "Amazon",
53
+ google: "Google", alphabet: "Alphabet", microsoft: "Microsoft", facebook: "Facebook", instagram: "Instagram",
54
+ whatsapp: "WhatsApp", netflix: "Netflix", coinbase: "Coinbase", robinhood: "Robinhood", gamestop: "GameStop",
55
+ microstrategy: "MicroStrategy", paypal: "PayPal", visa: "Visa", mastercard: "Mastercard", nike: "Nike",
56
+ disney: "Disney", starbucks: "Starbucks", mcdonalds: "McDonald's", walmart: "Walmart", uber: "Uber",
57
+ airbnb: "Airbnb", tiktok: "TikTok", youtube: "YouTube", openai: "OpenAI", chatgpt: "ChatGPT", blackrock: "BlackRock",
58
+ jpmorgan: "JPMorgan", samsung: "Samsung", sony: "Sony", nintendo: "Nintendo", playstation: "PlayStation",
59
+ ferrari: "Ferrari", lamborghini: "Lamborghini", "red bull": "Red Bull", "coca cola": "Coca-Cola", pepsi: "Pepsi",
60
+ adidas: "Adidas", gucci: "Gucci", louis_vuitton: "Louis Vuitton", rolex: "Rolex", spacex: "SpaceX", neuralink: "Neuralink"
61
+ };
62
+
63
+ // Token-2022 extensions that add risk, with the points they add to the no-market spam score
64
+ export const EXT_POINTS = {
65
+ permanentDelegate: 25,
66
+ transferHook: 15,
67
+ transferFeeConfig: 10,
68
+ nonTransferable: 10,
69
+ defaultAccountState: 10
70
+ };
71
+
72
+ // Risk levels, from worst to best (also the default sort order of results)
73
+ export const LEVELS = ["HIGH", "MEDIUM", "LOW", "SPAM", "NO_DATA", "NO_MARKET"];
74
+ export const TYPES = ["STABLE", "TOKENIZED", "BRIDGED", "CREATOR", "OPEN"];
75
+ export const LIGHTS = ["control", "concentration", "market", "dependency"];
76
+ export const RANKS = { ok: 0, na: 0, warn: 1, bad: 2 };
77
+
78
+ export const ADDRESS_RE = /^[1-9A-HJ-NP-Za-km-z]{32,44}$/;