The guardian runs as a hosted API. This package is a dependency-free client for it, and needs only
fetch (Node 18+, browsers, React Native). It ships as ES modules only.
- Send check
- Before a send to an exchange, find out whether that exchange accepts this exact Solana token. This covers Token-2022 tokens and deposits that are currently suspended.
- Exchange badges
- "This is Binance" the moment an address is pasted.
- Delisting notices
- Exchanges' announced delistings of Solana tokens, matched against your user's holdings on their own device.
- Swap check
- Before a swap, how much your user could lose to price impact, high-fee venues, slippage and Token-2022 transfer fees, including a fee hike that is already scheduled.
Call it from your backend. Any API key shipped inside an extension or app can be extracted. Your wallet calls your backend, and your backend calls the guardian.
Install
npm install @maranilabs/guardian
On npm: @maranilabs/guardian
Quickstart
Create the client in your backend. Then a badge when the address is pasted, a verdict when the token is chosen, and the delisting list on a timer.
import { createGuardian, isUnavailable, matchDelistings } from '@maranilabs/guardian';
const guardian = createGuardian({ apiKey: process.env.GUARDIAN_KEY! });
// calls https://api.maranilabs.com
// 1. The address is pasted: show a badge.
const badge = await guardian.address(to);
// 2. The token is chosen: get the verdict.
const verdict = await guardian.check({ to, mint, symbol });
if (isUnavailable(verdict)) {
// We couldn't check in time. Say so, and never block on it.
} else {
show(verdict.level, verdict.message);
// e.g. "block", "Binance doesn't accept USDG on Solana. …"
if (verdict.level === 'block') {
// Disable Send. If verdict.swapTo is set, offer
// "Swap to {swapTo.symbol} and send" instead.
}
}
// 3. Delistings, e.g. hourly: fetch the whole list and match it locally.
const list = await guardian.delistings();
if (!isUnavailable(list)) {
const affected = matchDelistings(list.notices, heldMints);
}
Client options
| Option | Required | Meaning |
|---|---|---|
apiKey |
yes | Your API key. |
baseUrl |
no |
Where the client calls. The default is https://api.maranilabs.com; pass it only to
reach another deployment.
|
timeoutMs |
no | The deadline for a whole call, in milliseconds. The default is 4000. |
fetch |
no | A fetch to use in place of the global one. |
When to call what
| Moment | Call | Notes |
|---|---|---|
| The address is pasted | address(to) |
A known exchange wallet answers in under about 150 ms. Any other address means reading its on-chain history, up to about 2 s. An exchange deposit address found that way is cached for every partner; an address we can't identify is read again on each call. |
| The token is chosen | check({ to, mint, symbol? }) |
mint is the token's mint, or "SOL" for native SOL. symbol is
your display symbol; it can only ever soften a verdict, and one longer than 16 characters is
ignored.
|
| The user answers our question | check({ ..., userMark }) |
After level: 'ask'. Pass an exchange id, 'other-cex' (an exchange we don't
cover) or 'not-cex', and remember the answer per address on your side. No mark
overrides an exchange's own wallet we recognise: it still answers for that exchange, with
CEX_HOT_WALLET.
|
| Before signing | check again |
Only if the recipient or the token changed. |
| Hourly, or on wallet open | delistings() then matchDelistings |
The list is small. Your users' holdings never reach us. |
| Monitoring, or to show data freshness | health() |
{ ok, dataAsOf, fetchedAt, stale }. No key needed. |
| The address is pasted | findLookalike(to, sentTo) |
Local, no call. Catches address poisoning; see below. |
| A token is picked to swap | token(mint) |
Its transfer fee now, any scheduled one, and maxFee, the most it takes from one transfer,
when the token caps it. Keep the answer per mint for the session.
|
| Every swap quote | checkSwap(quote, { sell, buy }) |
Local, no call. See below. |
Skip the call for sends to the user's own address. The service covers Solana mainnet only.
The answer
USDG, to an address your user named as their Binance deposit address:
{
"level": "block",
"code": "CEX_TOKEN_NOT_LISTED",
"message": "Binance doesn't accept USDG on Solana. If you send it, it won't be credited.",
"exchange": "binance",
"swapTo": { "symbol": "USDC", "mint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v" },
"notes": [
{
"level": "warn",
"code": "TOKEN2022_EXCHANGE_CREDIT",
"message": "Binance may be slow to credit USDG: many exchanges credit Token-2022 tokens by hand."
},
{
"level": "info",
"code": "TOKEN2022_PERMANENT_DELEGATE",
"message": "USDG's issuer can move or burn it from any wallet."
}
]
}
| Field | When | Meaning |
|---|---|---|
level |
always |
What to do: block, warn, ok or ask.
|
code |
always | Why, as a code to translate by (table below). |
message |
always | Why, as a sentence ready to show your user. |
exchange |
always | The exchange id, or null when the address isn't one or we can't tell. |
swapTo |
some blocks | The token to swap into and send instead, today USDC. Never for an exchange's own wallet, where no token sent is credited. |
feePct |
fee tokens | The token's transfer fee, percent. |
notes |
always | Anything else worth showing, worst first: {level, code, message}. Often empty. |
Listing freshness lives in health() (GET /v1/health, no key needed), not on every
answer: fetchedAt says when each exchange's table was fetched, stale lists the
exchanges whose table is more than 36 hours old, and dataAsOf is the oldest fetch among the
rest.
The badge
/v1/address answers the recipient alone:
{ "exchange": "kucoin", "addressType": "hot-wallet" }, where addressType is
deposit or hot-wallet (the exchange's own wallet). An unknown address is
{ "exchange": null }, with "likelyExchange": true added when it is probably an
exchange deposit address.
Levels: what to show
| Level | Meaning | Recommended UX |
|---|---|---|
block |
The exchange will not credit this deposit. |
Disable Send and show message. Offer "Swap to {swapTo.symbol} and send" when
swapTo is present.
|
warn |
A real risk, or something we couldn't confirm. | Show message and ask the user to confirm. |
ok |
No problems found. | Proceed. Show any info notes quietly, if at all. |
ask |
We couldn't tell whether the address is an exchange: the usual answer for a personal wallet. |
Show message (it is the question) with the exchanges in EXCHANGE_NAMES,
"Another exchange" and "No, a personal wallet", then call check again with the answer
as userMark. For "Another exchange" send other-cex: it answers
warn, because we don't check that exchange (unless we recognise the address, when it
answers for that exchange), while not-cex would switch the exchange checks off. A
lighter prompt is your call.
|
unavailable |
Comes from the client, not the service: a timeout, a 429 or a 5xx. | "Couldn't check". Never block on it. |
Exchange names
EXCHANGE_NAMES maps every exchange id this version knows to its display name, in the order to
offer them. Build your "which exchange?" list from it, and show any exchange with
exchangeName(id).
import { EXCHANGE_NAMES, exchangeName, isUnavailable, type CheckInput, type ExchangeId } from '@maranilabs/guardian';
// The ask: every exchange we cover, then the two other answers,
// each as [userMark, label].
const choices: [NonNullable<CheckInput['userMark']>, string][] = [
...(Object.entries(EXCHANGE_NAMES) as [ExchangeId, string][]),
['other-cex', 'Another exchange'],
['not-cex', 'No, a personal wallet'],
];
// The badge.
if (!isUnavailable(verdict) && verdict.exchange) showBadge(exchangeName(verdict.exchange));
Codes
message is ready in English. For other languages, translate by code, on the
answer and on each note:
| Code | Level | Our English |
|---|---|---|
CEX_TOKEN_NOT_LISTED |
block |
{exchange} doesn't accept {symbol} on Solana. If you send it, it won't be credited. |
CEX_TOKEN_NOT_LISTED |
warn |
{exchange} may not accept {symbol} on Solana. Check their deposit page before sending. |
CEX_DEPOSITS_SUSPENDED |
block |
{exchange} had {symbol} deposits switched off at our last check. A send could take days to credit, or get stuck. |
CEX_TOKEN_SUPPORTED |
ok |
{exchange} accepts {symbol} on Solana. |
CEX_TOKEN_SUPPORTED |
warn |
{exchange} appears to accept {symbol}. Confirm the token address on their deposit page. |
CEX_NO_DATA |
warn |
We can't confirm {exchange} accepts {symbol} on Solana. Check their deposit page before sending. |
CEX_HOT_WALLET |
warn |
This is {exchange}'s own wallet, not a deposit address. {exchange} credits only what you send to the deposit address it gave you. |
TOKEN2022_EXCHANGE_CREDIT |
warn |
{exchange} may be slow to credit {symbol}: many exchanges credit Token-2022 tokens by hand. |
TOKEN2022_TRANSFER_FEE |
warn |
{symbol} takes a {feePct}% fee on every transfer, so the recipient gets less than you send. |
TOKEN2022_TRANSFER_HOOK |
warn |
{symbol} runs extra code on every transfer. Some exchanges and wallets don't support that. |
TOKEN2022_PERMANENT_DELEGATE |
info |
{symbol}'s issuer can move or burn it from any wallet. |
DESTINATION_UNKNOWN |
ask |
Is this an exchange deposit address? We couldn't tell. |
DESTINATION_LIKELY_EXCHANGE |
ask |
This looks like an exchange deposit address. Which exchange gave it to you? |
TOKEN_UNREADABLE |
warn |
We couldn't read {symbol}, so this send wasn't fully checked. |
NO_ISSUES |
ok |
No problems found. |
After other-cex, CEX_NO_DATA comes with exchange: null, and its
message says "this exchange" in place of a name. A capped transfer fee says so: "{symbol} takes a
{feePct}% fee on every transfer, capped at {maxFee} {symbol}, so the recipient gets less than you send.",
with maxFee as token(mint) returns it.
New codes may be added. If you get one that isn't listed here, show message and act on the
level.
New exchanges may be added too. An exchange id missing from your version's
EXCHANGE_NAMES is still an exchange: show message, act on level, and
display it with exchangeName(id), which falls back to the id. Upgrade to add it to your
picker. A saved userMark refused with bad_user_mark names an exchange we no
longer cover: forget it and ask again.
Delisting notices
delistings() returns every active notice:
{ exchange, symbol, mint, kind, effectiveAt, announcedAt, sourceUrl }.
-
kindisdelist,deposit-suspendorwithdraw-deadline. - Every notice is pinned to an exact Solana mint. We never publish a notice by ticker alone, because tickers collide.
-
matchDelistings(notices, heldMints)keeps the ones your user holds. Run it on the device. - Link
sourceUrl, the exchange's own announcement, but don't prefetch it.
Sources today: Binance, OKX, Bybit, KuCoin, HTX, VALR and Bitvavo delisting announcements, polled hourly, and Bitget's and Digital X's, polled daily. Bybit's feed doesn't always answer our servers, so a Bybit notice can be late or missed.
Lookalike addresses
Address poisoning: a scammer grinds an address with the same first and last characters as one your user sends to, then sends them dust from it. The lookalike now sits in their history, one copy-paste away.
const real = findLookalike(to, sentTo);
// sentTo: addresses this user has sent to, or saved
if (real) {
warn(`This isn't ${short(real)}, the address you've sent to before. Check every character.`);
}
-
It flags
towhen it differs from a known address but shares at least four of its first and last four characters, ignoring case. - Pass only addresses the user sent to or saved. Don't pass addresses that only sent to them, because the lure is one of those.
- It runs on the device; the address list never reaches us.
Swap check
checkSwap tells your user how much a swap could cost them before they sign it. It runs on
the device for every quote. Only token(mint) calls us, once per token picked.
const [sell, buy] = await Promise.all([
guardian.token(quote.inputMint),
guardian.token(quote.outputMint),
]);
const verdict = checkSwap(quote, { sell, buy });
// a Jupiter quote fits as it is
if (verdict.level !== 'ok') show(verdict.level, verdict.message, verdict.notes);
| Code | warn | block | What it measures |
|---|---|---|---|
SWAP_LOSS |
5% | 15% | Value lost at the quoted price: price impact, the venues' own fees and your platform fee. The message names the venues. |
SWAP_SLIPPAGE |
5% | 20% | The slippage tolerance. Bots can take up to that much more by trading around the swap. |
TOKEN_FEE_BUY |
any | 10% | The Token-2022 fee on the token bought. It's charged on this swap and again on every later sale or send. |
TOKEN_FEE_RISING |
any rise | to 10% | A higher fee already scheduled on the token bought. It takes effect within about five days. |
TOKEN_FEE_SELL |
any | never | The fee on the token sold, which explains part of the loss. Blocking a sale wouldn't save the user anything. |
-
blockon a swap means no one-tap swap. Ask the user to confirm explicitly that they accept the loss. -
lossPctis always set. It is a percentage:lossPct / 100times the trade's value is the loss in dollars. -
Venue fees are already in the price impact. A Jupiter quote's
priceImpactPctincludes them. We checked this on Raydium, pump.fun and Meteora's Dynamic Bonding Curve, where launch fees can reach 99%.- It leaves out your platform fee, so we add
platformFee.feeBps. -
For
/swap/v2/orderquotes we usepriceImpactinstead, which already includes every fee.
- It leaves out your platform fee, so we add
-
Token fees are never in
lossPct, because a quote may already be net of them. Anunavailabletoken answer is skipped. -
Any transfer fee warns, as it does in
check. A token that takes a cut of every transfer is worth knowing about before you buy it.
Errors
| HTTP | Client behaviour | Why |
|---|---|---|
| 200 | the response | |
| 400 |
throws GuardianError (bad_address, bad_mint,
bad_user_mark, bad_body, not_a_mint)
|
A bug on the calling side. |
| 401 | throws GuardianError (unauthorized) |
A missing or wrong key. It must never fail silently. |
| 429, 5xx, timeout, network | returns { level: 'unavailable', error } |
Fail open. Your UX decides, and we recommend "couldn't check". |
The default timeout is 4 s. The service answers within about 3 s even for a never-seen address.
createGuardian throws straight away on a missing key, a baseUrl that isn't an
http(s) URL, or a runtime with no fetch. Caught later, those would read as "unavailable" on
every call.
Coverage
| Exchange | Can block | Notes |
|---|---|---|
| Binance, KuCoin, Bitget, HTX, Gate, VALR, Digital X | yes |
The exchange publishes the exact mint for each Solana deposit. Bitget (SRM), KuCoin (KINOLD) and Gate
(Z) each also list one token without an address today: a token checked under that exact symbol, or
its wrapped form, softens to warn.
|
| ZebPay, MAX | yes, once your user names the exchange |
They publish exact mints too, but we know none of their wallets, so their addresses answer
ask first.
|
| Kraken | yes, except tokenized stocks (xStocks) |
Kraken lists them but publishes no Solana deposit method for them, so an xStock (its mint starts
Xs) softens to warn when checked under its exact symbol. Checked without it,
one that no other tracked exchange lists still blocks. A coin that shares an xStock's ticker blocks
either way.
|
| Coinbase | yes |
Six of its token addresses come lowercased. We restore the mint the other exchanges agree on, and
those six answer warn ("appears to accept").
|
| MEXC | yes, except tokens it lists without a Solana address |
Those soften to warn when checked under that exact symbol or its wrapped form (WETH for
ETH), apart from USDC, USDT and USD1, which answer ok.
|
| OKX, Bybit, Bitstamp, Bitvavo, Bithumb, WhiteBIT, HashKey, Paribu, Bit2Me, Foxbit, Swyftx, Independent Reserve, Young Platform, Binance TH, Orbix, Busha, AltCoinTrader, Bitfinex | suspended deposits, and unlisted stablecoins |
They publish which Solana tokens they take and whether deposits are open, but no addresses. SOL, and
USDC, USDT, EURC and USD1 where the exchange lists them, plus OKX's xBTC, Bybit's bbSOL and XAUt0 at
Bybit and Bitfinex, answer ok; PYUSD, USDG and AUSD add a Token-2022 warning; other
tokens answer warn. Where every token it lists is identified, a missing one of these
seven stablecoins blocks.
|
-
A used deposit address is recognised when its recent transactions show a sweep we can tie to its
exchange. Otherwise, a brand-new one included, it answers
ask. -
Deposit addresses at Bit2Me, Foxbit, VALR, Swyftx, Independent Reserve,
Young Platform, ZebPay, Binance TH, Orbix, Busha, AltCoinTrader and MAX aren't recognised yet: they
answer
ask, and that exchange's table applies once your user names it (userMark). -
Listing data is refetched daily, and exchanges our automated jobs can't reach are refreshed by hand. A
table more than 36 hours old answers
CEX_NO_DATA(warn) instead ofokor a not-listedblock; a suspension it recorded still blocks.GET /v1/healthshows when each table was fetched (fetchedAt) and which are past the limit (stale). - Warn, never guarantee. The guardian reduces lost deposits; it cannot promise an exchange's crediting.
Exchange ids
binance coinbase kraken kucoin gate
bitget htx okx bybit mexc
bitstamp bitvavo bithumb whitebit hashkey
paribu bit2me foxbit valr swyftx
independentreserve youngplatform zebpay binanceth
orbix busha altcointrader digitalx max
bitfinex
Privacy
- For each check we receive the recipient address, the mint, and optionally a symbol and the user's mark. Never the sender, the amount or the user's IP (your backend makes the call).
- We keep exchange-address findings (an address that sweeps into Binance is Binance's, for every partner), token metadata, and per-key counts of verdicts. We keep no request logs with addresses.
-
Delisting matching,
findLookalikeandcheckSwaprun on the device: holdings, address lists, amounts and quotes never reach us.token(mint)sends only the mint.
License
MIT. The client is open; the guardian API behind it needs a key: hello@maranilabs.com.