Swap API
A price, or the transactions to sign, for any two tokens: powered by Mancer.
The endpoint
The Swap API answers one request, quote: what one token is worth in another on Robinhood Chain. Asked bare, the answer is the price. Asked with the wallet that swaps, the answer is the transactions that wallet signs.
The route is found by Mancer, the dex aggregator and order layer of Robinhood Chain, and every answer says so. Every transaction is Mancer’s calldata, handed on unchanged for your user to sign. Blockhash signs and sends nothing.
The path is the endpoint, your key, the network, then quote. The key can be sent as Authorization: Bearer instead, to /swap/v1/robinhood-mainnet/quote; both at once is refused. The same key works on the RPC and the Data API.
An app’s rules hold here as at the RPC: its websites, its IP addresses, and its contracts list, which must hold both tokens, ether counted as WETH.
Any origin may call, and no cookie is read. The parameters are query parameters; a name the table does not list is refused, so a misspelled one is never dropped.
An address is 0x and 40 hex digits in either case; every address in an answer is lower case. An amount is a decimal string of raw units, digits only. Every answer carries Cache-Control: no-store and X-Request-Id, which a page on any origin can read, as it can Retry-After.
- Request
- Method
- GET
- Network
- robinhood-mainnet
- Key
- In the path, or as a Bearer token
- A quote
- 800 units
- Powered by
- Mancer
KEY="<your key>"
curl -H "authorization: Bearer $KEY" \
"https://api.blockhash.xyz/swap/v1/robinhood-mainnet/quote?tokenIn=0x0bd7d308f8e1639fab988df18a8011f41eacad73&tokenOut=0x5fc5360d0400a0fd4f2af552add042d716f1d168&amountIn=100000000000000000"const quote = await fetch(
'https://api.blockhash.xyz/swap/v1/robinhood-mainnet/quote?tokenIn=0x0bd7d308f8e1639fab988df18a8011f41eacad73&tokenOut=0x5fc5360d0400a0fd4f2af552add042d716f1d168&amountIn=100000000000000000',
{ headers: { authorization: `Bearer ${process.env.KEY}` } },
).then((answer) => answer.json())
// quote.amountOut: '180721381', quote.poweredBy: 'Mancer'Parameters
A value out of its bounds is refused, naming the parameter. It is never passed on to be clamped.
taker holds the input, signs every transaction and sends them. recipient receives the output; it is the taker where it is not sent.
The swap’s calldata carries a floor, minAmountOut in the answer: under it the swap reverts and nothing is spent but gas. It is Mancer’s estimate less slippageBps. Send the floor your user agreed to as minAmountOut: if the fresh amount out is under it, the quote is refused with slippage-exceeded, and otherwise the stronger of the two floors holds.
| Name | Type | What it means | Default |
|---|---|---|---|
tokenIn | address | Required. The token sold. 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee for ether. | |
tokenOut | address | Required. The token bought. Not the same token as tokenIn, ether and WETH counted as one. | |
amountIn | decimal string | Required. How much of tokenIn is sold, in raw units (wei for ether): 1 to 2^256 - 1, at most 78 digits. | |
taker | address | The wallet that holds tokenIn, signs and sends. With it the answer carries the transactions. Not the zero address. | a price |
recipient | address | The address that receives tokenOut. Needs taker. Not the zero address. | the taker |
slippageBps | whole number | How far under the quoted amount the swap may deliver before it reverts: 1 to 5,000 basis points. Needs taker. | Mancer’s |
minAmountOut | decimal string | The least amount out your user accepted when they saw the price, in raw units of tokenOut. Needs taker. | |
integratorFeeBps | whole number | Your own fee: 1 to 100 basis points (1%). | no fee |
integratorFeeRecipient | address | The address your fee is paid to. Required with integratorFeeBps. Not the zero address, and not one of Mancer’s own addresses. | |
integratorFeeSide | "output" or "input" | Which token pays your fee. Needs the two above. | output |
Ether
Ether is 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee in tokenIn or tokenOut, as other swap APIs spell it. The zero address is read the same, and an answer spells it as the first.
With ether sold, the swap’s value is amountIn and there is no approval.
Ether for WETH, either way, is a wrap and no swap: the two count as one token, and the request is refused. WETH is 0x0bd7d308f8e1639fab988df18a8011f41eacad73.
https://api.blockhash.xyz/swap/v1/<your key>/robinhood-mainnet/quote?tokenIn=0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee&tokenOut=0x5fc5360d0400a0fd4f2af552add042d716f1d168&amountIn=100000000000000000
{"network":"robinhood-mainnet",
"chainId":4663,
"tokenIn":"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
"tokenOut":"0x5fc5360d0400a0fd4f2af552add042d716f1d168",
"amountIn":"100000000000000000",
"routeFound":true,
"amountOut":"180721381",
"minAmountOut":null,
"amountInUsd":180.56099028739087,
"amountOutUsd":180.7213814934,
"priceImpactBps":0,
"recommendedSlippageBps":20,
"slippageBps":null,
"fees":{"mancer":{"bps":2,"token":"0x0bd7d308f8e1639fab988df18a8011f41eacad73","side":"input"},
"integrator":null},
"route":[
{"venue":"ramsescl",
"tokenIn":"0x0bd7d308f8e1639fab988df18a8011f41eacad73",
"tokenOut":"0x5fc5360d0400a0fd4f2af552add042d716f1d168",
"shareBps":10000}],
"transactions":null,
"requirements":null,
"simulation":null,
"warnings":[],
"expiresAt":null,
"poweredBy":"Mancer"}https://api.blockhash.xyz/swap/v1/<your key>/robinhood-mainnet/quote?tokenIn=0x5fc5360d0400a0fd4f2af552add042d716f1d168&tokenOut=0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee&amountIn=250000000
{"network":"robinhood-mainnet",
"chainId":4663,
"tokenIn":"0x5fc5360d0400a0fd4f2af552add042d716f1d168",
"tokenOut":"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
"amountIn":"250000000",
"routeFound":true,
"amountOut":"138282739323330531",
"minAmountOut":null,
"amountInUsd":250,
"amountOutUsd":249.68468351873685,
"priceImpactBps":0,
"recommendedSlippageBps":20,
"slippageBps":null,
"fees":{"mancer":{"bps":2,"token":"0x0bd7d308f8e1639fab988df18a8011f41eacad73","side":"output"},
"integrator":null},
"route":[
{"venue":"metric",
"tokenIn":"0x5fc5360d0400a0fd4f2af552add042d716f1d168",
"tokenOut":"0x0bd7d308f8e1639fab988df18a8011f41eacad73",
"shareBps":10000}],
"transactions":null,
"requirements":null,
"simulation":null,
"warnings":[],
"expiresAt":null,
"poweredBy":"Mancer"}A price
Asked with no taker, the answer is a price: the fields of a quote, with those of the transactions null.
The sample asks what 0.1 WETH is worth in USDG.
https://api.blockhash.xyz/swap/v1/<your key>/robinhood-mainnet/quote?tokenIn=0x0bd7d308f8e1639fab988df18a8011f41eacad73&tokenOut=0x5fc5360d0400a0fd4f2af552add042d716f1d168&amountIn=100000000000000000
{"network":"robinhood-mainnet",
"chainId":4663,
"tokenIn":"0x0bd7d308f8e1639fab988df18a8011f41eacad73",
"tokenOut":"0x5fc5360d0400a0fd4f2af552add042d716f1d168",
"amountIn":"100000000000000000",
"routeFound":true,
"amountOut":"180721381",
"minAmountOut":null,
"amountInUsd":180.56099028739087,
"amountOutUsd":180.7213814934,
"priceImpactBps":0,
"recommendedSlippageBps":20,
"slippageBps":null,
"fees":{"mancer":{"bps":2,"token":"0x0bd7d308f8e1639fab988df18a8011f41eacad73","side":"input"},
"integrator":null},
"route":[
{"venue":"ramsescl",
"tokenIn":"0x0bd7d308f8e1639fab988df18a8011f41eacad73",
"tokenOut":"0x5fc5360d0400a0fd4f2af552add042d716f1d168",
"shareBps":10000}],
"transactions":null,
"requirements":null,
"simulation":null,
"warnings":[],
"expiresAt":null,
"poweredBy":"Mancer"}KEY="<your key>"
SWAP="https://api.blockhash.xyz/swap/v1/$KEY/robinhood-mainnet"
curl -G "$SWAP/quote" \
-d tokenIn=0x0bd7d308f8e1639fab988df18a8011f41eacad73 \
-d tokenOut=0x5fc5360d0400a0fd4f2af552add042d716f1d168 \
-d amountIn=100000000000000000
{"network":"robinhood-mainnet",
"chainId":4663,
"tokenIn":"0x0bd7d308f8e1639fab988df18a8011f41eacad73",
"tokenOut":"0x5fc5360d0400a0fd4f2af552add042d716f1d168",
"amountIn":"100000000000000000",
"routeFound":true,
"amountOut":"180721381",
"minAmountOut":null,
"amountInUsd":180.56099028739087,
"amountOutUsd":180.7213814934,
"priceImpactBps":0,
"recommendedSlippageBps":20,
"slippageBps":null,
"fees":{"mancer":{"bps":2,"token":"0x0bd7d308f8e1639fab988df18a8011f41eacad73","side":"input"},
"integrator":null},
"route":[
{"venue":"ramsescl",
"tokenIn":"0x0bd7d308f8e1639fab988df18a8011f41eacad73",
"tokenOut":"0x5fc5360d0400a0fd4f2af552add042d716f1d168",
"shareBps":10000}],
"transactions":null,
"requirements":null,
"simulation":null,
"warnings":[],
"expiresAt":null,
"poweredBy":"Mancer"}A quote with transactions
Asked with taker, the answer carries the transactions that wallet signs, in order: here an approval, then the swap.
The sample sells 0.1 WETH for USDG at the tolerance Mancer recommends, 20 bps: its floor is that far under Mancer’s estimate, and the swap reverts after its expiry.
A price is asked again as a quote with transactions when your user is ready to sign, and a quote that waited is asked again, not kept.
A token Mancer swaps through a launchpad, not its router, is answered with its price alone: no transactions, and the warning transactions-unavailable. It is charged as a quote.
https://api.blockhash.xyz/swap/v1/<your key>/robinhood-mainnet/quote?tokenIn=0x0bd7d308f8e1639fab988df18a8011f41eacad73&tokenOut=0x5fc5360d0400a0fd4f2af552add042d716f1d168&amountIn=100000000000000000&taker=<a wallet>
{"network":"robinhood-mainnet",
"chainId":4663,
"tokenIn":"0x0bd7d308f8e1639fab988df18a8011f41eacad73",
"tokenOut":"0x5fc5360d0400a0fd4f2af552add042d716f1d168",
"amountIn":"100000000000000000",
"routeFound":true,
"amountOut":"180712919",
"minAmountOut":"180351492",
"amountInUsd":180.56099028739087,
"amountOutUsd":180.74906900020002,
"priceImpactBps":1,
"recommendedSlippageBps":20,
"slippageBps":20,
"fees":{"mancer":{"bps":2,"token":"0x0bd7d308f8e1639fab988df18a8011f41eacad73","side":"input"},
"integrator":null},
"route":[
{"venue":"metric",
"tokenIn":"0x0bd7d308f8e1639fab988df18a8011f41eacad73",
"tokenOut":"0x5fc5360d0400a0fd4f2af552add042d716f1d168",
"shareBps":10000}],
"transactions":[
{"type":"approval",
"to":"0x0bd7d308f8e1639fab988df18a8011f41eacad73",
"data":"0x095ea7b30000000000000000000000004c16269006db0dd87e6ae3c8a014b2807aa2e388000000000000000000000000000000000000000000000000016345785d8a0000",
"value":"0",
"gas":"79453"},
{"type":"swap",
"to":"0xa62858659c83095eb5e702f0af6a7bb7f370b3e7",
"data":"0x85e6ff1e0000000000000000000000000000000000000000000000000000000000000020…0000000000000000",
"value":"0",
"gas":"462742"}],
"requirements":{"balance":{"token":"0x0bd7d308f8e1639fab988df18a8011f41eacad73",
"amount":"100000000000000000"},
"allowance":{"token":"0x0bd7d308f8e1639fab988df18a8011f41eacad73",
"spender":"0x4c16269006db0dd87e6ae3c8a014b2807aa2e388",
"amount":"100000000000000000"}},
"simulation":{"ok":true,
"block":117043135,
"error":null,
"native":{"needed":"22006610660000","balance":"2509167418793094395","covered":true}},
"warnings":[],
"expiresAt":1794967062,
"poweredBy":"Mancer"}KEY="<your key>"
SWAP="https://api.blockhash.xyz/swap/v1/$KEY/robinhood-mainnet"
WALLET="<a wallet>"
curl -G "$SWAP/quote" \
-d tokenIn=0x0bd7d308f8e1639fab988df18a8011f41eacad73 \
-d tokenOut=0x5fc5360d0400a0fd4f2af552add042d716f1d168 \
-d amountIn=100000000000000000 \
-d taker=$WALLET
{"network":"robinhood-mainnet",
"chainId":4663,
"tokenIn":"0x0bd7d308f8e1639fab988df18a8011f41eacad73",
"tokenOut":"0x5fc5360d0400a0fd4f2af552add042d716f1d168",
"amountIn":"100000000000000000",
"routeFound":true,
"amountOut":"180712919",
"minAmountOut":"180351492",
"amountInUsd":180.56099028739087,
"amountOutUsd":180.74906900020002,
"priceImpactBps":1,
"recommendedSlippageBps":20,
"slippageBps":20,
"fees":{"mancer":{"bps":2,"token":"0x0bd7d308f8e1639fab988df18a8011f41eacad73","side":"input"},
"integrator":null},
"route":[
{"venue":"metric",
"tokenIn":"0x0bd7d308f8e1639fab988df18a8011f41eacad73",
"tokenOut":"0x5fc5360d0400a0fd4f2af552add042d716f1d168",
"shareBps":10000}],
"transactions":[
{"type":"approval",
"to":"0x0bd7d308f8e1639fab988df18a8011f41eacad73",
"data":"0x095ea7b30000000000000000000000004c16269006db0dd87e6ae3c8a014b2807aa2e388000000000000000000000000000000000000000000000000016345785d8a0000",
"value":"0",
"gas":"79453"},
{"type":"swap",
"to":"0xa62858659c83095eb5e702f0af6a7bb7f370b3e7",
"data":"0x85e6ff1e0000000000000000000000000000000000000000000000000000000000000020…0000000000000000",
"value":"0",
"gas":"462742"}],
"requirements":{"balance":{"token":"0x0bd7d308f8e1639fab988df18a8011f41eacad73",
"amount":"100000000000000000"},
"allowance":{"token":"0x0bd7d308f8e1639fab988df18a8011f41eacad73",
"spender":"0x4c16269006db0dd87e6ae3c8a014b2807aa2e388",
"amount":"100000000000000000"}},
"simulation":{"ok":true,
"block":117043135,
"error":null,
"native":{"needed":"22006610660000","balance":"2509167418793094395","covered":true}},
"warnings":[],
"expiresAt":1794967062,
"poweredBy":"Mancer"}The answer
A request that is answered is 200 with one of three bodies: a price, a quote with transactions, or no route. A price and a quote with transactions have the same fields: one that belongs to the transactions is null on a price, never missing.
| Field | Form | What it is |
|---|---|---|
network, chainId | string, number | The network asked, and its chain’s id: 4663. |
tokenIn, tokenOut, amountIn | address, address, string | What was asked, in lower case, ether as 0xeeee…eeee. |
routeFound | boolean | true; false where there is no route. |
amountOut | string | What the recipient receives, after Mancer’s fee and yours. With transactions, what Mancer’s simulation of the swap measured. The number to show. |
minAmountOut | string or null | The floor the swap’s calldata enforces. null on a price. |
amountInUsd, amountOutUsd | number or null | The two amounts in dollars, by Mancer’s reference prices. |
priceImpactBps | number or null | What the order’s size cost against its route’s marginal rate. Never negative. |
recommendedSlippageBps | number | The tolerance Mancer recommends for the pair now. |
slippageBps | number or null | The tolerance the floor was made with: yours, else the recommended one. null on a price. |
fees | object | Mancer’s fee and yours, each already taken out of amountOut. |
route | list | Each pool the swap goes through: venue, tokenIn, tokenOut, and shareBps, the leg’s share of what the route spends of its tokenIn. |
transactions | list or null | What the taker signs and sends, in order. null on a price. |
requirements | object or null | What the wallet must hold and allow before signing. null on a price. |
simulation | object or null | Whether the transactions ran from the wallet’s own balances, and why not. null on a price. |
warnings | list | What to show your user before they sign. Empty where there is nothing. |
expiresAt | number or null | The Unix second after which the swap reverts: ten minutes after it was built. null on a price. |
poweredBy | string | "Mancer". |
Fees
Mancer’s fee is taken by Mancer’s router inside the swap, out of amountOut. fees.mancer is {bps, token, side}: its rate, the token it is taken in, and the side, input, output or mid. Mancer gives no amount for it.
It is taken in the pair’s higher-ranked token: ether, then dollars, then any other, and from the input on a tie.
| Pair | Mancer’s fee |
|---|---|
| A dollar and a dollar (USDG, USDC) | Nothing |
| Ether or WETH and a dollar | 2 bps (0. |
| Every other pair | 10 bps (0. |
| Either token first seen less than 24 hours ago | 50 bps (0. |
https://api.blockhash.xyz/swap/v1/<your key>/robinhood-mainnet/quote?tokenIn=0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee&tokenOut=0x5fc5360d0400a0fd4f2af552add042d716f1d168&amountIn=100000000000000000&taker=<a wallet>&integratorFeeBps=10&integratorFeeRecipient=<your fee’s address>&integratorFeeSide=output
{"network":"robinhood-mainnet",
"chainId":4663,
"tokenIn":"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
"tokenOut":"0x5fc5360d0400a0fd4f2af552add042d716f1d168",
"amountIn":"100000000000000000",
"routeFound":true,
"amountOut":"180532207",
"minAmountOut":"180171141",
"amountInUsd":180.56099028739087,
"amountOutUsd":180.74906900120124,
"priceImpactBps":1,
"recommendedSlippageBps":20,
"slippageBps":20,
"fees":{"mancer":{"bps":2,"token":"0x0bd7d308f8e1639fab988df18a8011f41eacad73","side":"input"},
"integrator":{"bps":10,
"recipient":"0x…",
"side":"output",
"token":"0x5fc5360d0400a0fd4f2af552add042d716f1d168",
"amount":"180712"}},
"route":[
{"venue":"metric",
"tokenIn":"0x0bd7d308f8e1639fab988df18a8011f41eacad73",
"tokenOut":"0x5fc5360d0400a0fd4f2af552add042d716f1d168",
"shareBps":10000}],
"transactions":[
{"type":"swap",
"to":"0xa62858659c83095eb5e702f0af6a7bb7f370b3e7",
"data":"0x85e6ff1e0000000000000000000000000000000000000000000000000000000000000020…0000000000000000",
"value":"100000000000000000",
"gas":"526679"}],
"requirements":{"balance":{"token":"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
"amount":"100000000000000000"},
"allowance":null},
"simulation":{"ok":true,
"block":117043139,
"error":null,
"native":{"needed":"100021081907012000","balance":"2509167418793094395","covered":true}},
"warnings":[],
"expiresAt":1794967063,
"poweredBy":"Mancer"}KEY="<your key>"
SWAP="https://api.blockhash.xyz/swap/v1/$KEY/robinhood-mainnet"
WALLET="<a wallet>"
FEE_TO="<your fee’s address>"
curl -G "$SWAP/quote" \
-d tokenIn=0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee \
-d tokenOut=0x5fc5360d0400a0fd4f2af552add042d716f1d168 \
-d amountIn=100000000000000000 \
-d taker=$WALLET \
-d integratorFeeBps=10 \
-d integratorFeeRecipient=$FEE_TO \
-d integratorFeeSide=output
{"network":"robinhood-mainnet",
"chainId":4663,
"tokenIn":"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
"tokenOut":"0x5fc5360d0400a0fd4f2af552add042d716f1d168",
"amountIn":"100000000000000000",
"routeFound":true,
"amountOut":"180532207",
"minAmountOut":"180171141",
"amountInUsd":180.56099028739087,
"amountOutUsd":180.74906900120124,
"priceImpactBps":1,
"recommendedSlippageBps":20,
"slippageBps":20,
"fees":{"mancer":{"bps":2,"token":"0x0bd7d308f8e1639fab988df18a8011f41eacad73","side":"input"},
"integrator":{"bps":10,
"recipient":"0x…",
"side":"output",
"token":"0x5fc5360d0400a0fd4f2af552add042d716f1d168",
"amount":"180712"}},
"route":[
{"venue":"metric",
"tokenIn":"0x0bd7d308f8e1639fab988df18a8011f41eacad73",
"tokenOut":"0x5fc5360d0400a0fd4f2af552add042d716f1d168",
"shareBps":10000}],
"transactions":[
{"type":"swap",
"to":"0xa62858659c83095eb5e702f0af6a7bb7f370b3e7",
"data":"0x85e6ff1e0000000000000000000000000000000000000000000000000000000000000020…0000000000000000",
"value":"100000000000000000",
"gas":"526679"}],
"requirements":{"balance":{"token":"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
"amount":"100000000000000000"},
"allowance":null},
"simulation":{"ok":true,
"block":117043139,
"error":null,
"native":{"needed":"100021081907012000","balance":"2509167418793094395","covered":true}},
"warnings":[],
"expiresAt":1794967063,
"poweredBy":"Mancer"}Your own fee
- Add a fee of up to 100 bps (1%) with
integratorFeeBps, paid inside the swap tointegratorFeeRecipient. Blockhash adds no fee of its own and takes no part of yours. output, the default, pays it in the token bought: the rate of what the swap delivers, taken at its end.amountOutand the floor are after it.inputpays it in the token sold: exactly the rate ofamountIn, taken before the swap. The taker still spends the wholeamountIn.- A fee on a side that is ether is paid as ether. A recipient that refuses ether, or needs more than 30,000 gas to take it, is paid WETH.
- Your fee’s recipient may not be one of Mancer’s own addresses: its router, the router’s allowance target, WETH, MancerIntegratorFee, its DirectPoolExecutor, the key that sends MancerOrders’ fills.
- Send the same three parameters on the price and on the quote with transactions, so the price shows what your user will receive.
- The fee adds a step to the swap, and its gas is inside each transaction’s gas. Some routes cannot carry it: with a fee, such a token may find a lesser route, or none.
fees.integratoris{bps, recipient, side, token, amount}, ether as0xeeee…eeee. On the inputamountis the exact fee; on the output it is the fee at this quote.
The transactions to sign
Send transactions in order, each once the one before it has its receipt. Each is {type, to, data, value, gas}: type is approval, swap, or authorization (a launchpad’s own setup); the swap is last, and there is exactly one. Sign data as it is.
gas is a limit Mancer’s simulation proved: what the transaction spent, 30% more, and 10,000 for the chain’s data fee. It is null where the simulation did not reach it.
requirements.balance is what the taker must hold: the whole amountIn. requirements.allowance is what the spender must be allowed to take, null where ether is sold; the approval sets exactly that.
Before transactions are served, Blockhash reads the swap’s calldata and holds it to the request: the tokens, the amount, the recipient, the floor and your fee. A build that differs is not served (unavailable), and is not charged. So no transaction pays anyone you did not name.
Before it answers, Mancer runs the transactions from the taker’s own balances and allowances on the chain’s head. simulation.ok false is still a 200: the price and the transactions stand, and the wallet cannot send them now. Show why, and ask for no signature. simulation.native says whether the wallet’s ether covers every transaction’s gas and value.
The swap reverts after expiresAt, ten minutes after it was built. Today the swap goes to MancerRouter, 0xa62858659c83095eb5e702f0af6a7bb7f370b3e7, and the approval’s spender is its allowance target, 0x4c16269006db0dd87e6ae3c8a014b2807aa2e388. Both are Mancer’s to change: https://api.mancer.xyz/v1/contracts names the live ones with the hash of their code.
// 200, with the price and both transactions: the wallet cannot send them now
{"transactions":[
{"type":"approval","to":"0x0bd7d308f8e1639fab988df18a8011f41eacad73",
"data":"0x095ea7b3…","value":"0","gas":"79453"},
{"type":"swap","to":"0xa62858659c83095eb5e702f0af6a7bb7f370b3e7",
"data":"0x85e6ff1e…","value":"0","gas":null}],
"simulation":{"ok":false,"block":116741864,
"error":{"transaction":1,"reason":"Error",
"message":"step 2 (swap) reverts Error: ERC20: transfer amount exceeds balance at the head"},
"native":{"needed":null,"balance":"…","covered":null}},
…}Warnings
Each warning is {code, message}, and sell-tax also carries bps. Show it to your user before they sign. Match on the code: the message is a sentence to read.
Where Mancer refuses the trade there is nothing to warn on: it is an error, and a price is refused as its transactions would be.
| Code | When |
|---|---|
value-discrepancy | The amount out is worth half or less of the amount in, by Mancer’s reference prices, and the quote is still served. |
round-trip | Selling what the swap buys straight back would lose half or more, and the quote is still served. |
sell-gated | The route buys through a pool that accepts a sale only with its issuer’s signature. |
sell-tax | The token bought keeps a share of a later sale, given as bps. |
sell-unproven | A wallet that never bought could not sell the token in simulation, and nobody has traded it yet. |
market-note | Mancer’s own sentence about market hours, word for word. |
caution | Any other reason of Mancer’s to warn. |
transactions-unavailable | A launchpad’s token asked with a taker: its price is answered, and its transactions are not. It comes first. |
Tokenized stocks
Some tokens on Robinhood Chain are tokenized stocks. The Swap API quotes them and builds their transactions for every key, from every place.
You answer for where your own users are. Do not show, quote or build a tokenized stock for a user in a place where it may not be offered to them.
Blockhash does not check which country a request comes from, and passes nothing of where it came from on to Mancer.
Mancer’s public API says which tokens are stocks: every token there carries isStock. https://api. reads one, and https://api. lists them, up to a hundred a page. Neither needs a key.
A quote between two tokens that are not stocks can route through a stock, and its transactions can leave some of that stock with your user.
Outside US market hours a stock’s price is wide, and the answer carries the market-note warning. Show it.
None of this is legal advice about any place.
No route
Where Mancer finds no route the answer is 200 and short, with routeFound false. It is the market’s answer, and it is charged.
An amount the market cannot fill is no route, or a route at a poor price that priceImpactBps shows.
https://api.blockhash.xyz/swap/v1/<your key>/robinhood-mainnet/quote?tokenIn=0x0bd7d308f8e1639fab988df18a8011f41eacad73&tokenOut=0x000000000000000000000000000000000000dead&amountIn=10000000000000000
{"network":"robinhood-mainnet","chainId":4663,
"tokenIn":"0x0bd7d308f8e1639fab988df18a8011f41eacad73",
"tokenOut":"0x000000000000000000000000000000000000dead",
"amountIn":"10000000000000000",
"routeFound":false,"poweredBy":"Mancer"}KEY="<your key>"
SWAP="https://api.blockhash.xyz/swap/v1/$KEY/robinhood-mainnet"
curl -G "$SWAP/quote" \
-d tokenIn=0x0bd7d308f8e1639fab988df18a8011f41eacad73 \
-d tokenOut=0x000000000000000000000000000000000000dead \
-d amountIn=10000000000000000
{"network":"robinhood-mainnet","chainId":4663,
"tokenIn":"0x0bd7d308f8e1639fab988df18a8011f41eacad73",
"tokenOut":"0x000000000000000000000000000000000000dead",
"amountIn":"10000000000000000",
"routeFound":false,"poweredBy":"Mancer"}| Code | HTTP | Case | Charged |
|---|---|---|---|
invalid-key | 401 | No key, or one that does not exist or was revoked | No |
invalid-parameter | 400 | A parameter missing, malformed, out of its bounds, unknown or sent twice, the same token twice, a fee recipient that is one of Mancer’s own addresses, or the key in the path and as a Bearer both; or a request Mancer refused, such as an input-side fee that leaves nothing to swap. The message names what to fix | Where Mancer refused it |
method-not-allowed | 405 | Any method but GET, answered with Allow: GET | No |
no-such-network | 404 | A network that is not served: the message names those that are | No |
not-found | 404 | A call under the network that is not quote | No |
origin-not-allowed | 403 | A website the app’s rules leave out | No |
ip-not-allowed | 403 | An IP address the app’s rules leave out | No |
contract-not-allowed | 403 | A token the app’s contracts list leaves out, ether counted as WETH | No |
suspended | 403 | The account is suspended | No |
limit-reached | 403 | The monthly limit set on Pay as you go reached | No |
month-used | 403 | The Free plan’s month used up | No |
rate-limited | 429 | Over the account’s speed or a ceiling, or too many quotes waiting: wait the seconds in Retry-After | No |
slippage-exceeded | 409 | The price moved under minAmountOut | Yes |
sell-blocked | 409 | The token bought cannot be sold | Yes |
sell-gated | 409 | The token’s market takes a sale only with its issuer’s signature, and nothing else would buy it back | Yes |
router-refused | 409 | The token refuses a transfer out of the router, so no route can deliver it | Yes |
round-trip | 409 | Selling what the swap buys straight back would return under half | Yes |
pool-fee | 409 | A pool on the route keeps most of the trade | Yes |
value-discrepancy | 409 | The amount out is far below the reference value | Yes |
no-transaction | 409 | A price was found, and no transaction could be built that passes simulation | Yes |
refused | 409 | Any other refusal of the trade | Yes |
integrator-fee-unavailable | 503 | Your fee cannot be taken now: ask without it, or after Retry-After | No |
unavailable | 503 | Mancer did not answer, its quotes are paused, or a build did not match the request: ask again after Retry-After | No |
timeout | 504 | The quote ran past its time of 11 seconds | No |
curl -G "$SWAP/quote" \
-d tokenIn=0x0bd7d308f8e1639fab988df18a8011f41eacad73 \
-d tokenOut=0x5fc5360d0400a0fd4f2af552add042d716f1d168 \
-d amountIn=100000000000000000 \
-d slipageBps=50
HTTP 400
{"error":{"code":"invalid-parameter",
"message":"slipageBps is not a parameter of a quote: it takes tokenIn, tokenOut, amountIn, taker, recipient, slippageBps, minAmountOut, integratorFeeBps, integratorFeeRecipient, integratorFeeSide"}}curl -G "$SWAP/quote" \
-d tokenIn=0x0bd7d308f8e1639fab988df18a8011f41eacad73 \
-d tokenOut=0x5fc5360d0400a0fd4f2af552add042d716f1d168 \
-d amountIn=100000000000000000 \
-d integratorFeeBps=10 \
-d integratorFeeRecipient=0xa62858659c83095eb5e702f0af6a7bb7f370b3e7
HTTP 400
{"error":{"code":"invalid-parameter",
"message":"integratorFeeRecipient may not be one of Mancer's own addresses: its router, the router's allowance target, WETH, MancerIntegratorFee or an executor"}}curl "https://api.blockhash.xyz/swap/v1/bh_not_a_key/robinhood-mainnet/quote?tokenIn=0x0bd7d308f8e1639fab988df18a8011f41eacad73&tokenOut=0x5fc5360d0400a0fd4f2af552add042d716f1d168&amountIn=100000000000000000"
HTTP 401
{"error":{"code":"invalid-key","message":"Invalid access key"}}Units and limits
A price and a quote with transactions cost the same, 800 units, and take 50 units from the plan’s speed, which is one bucket across the RPC, the Data API and the Swap API.
A quote is charged once it is sent to Mancer and Mancer answers anything but a failure of its own: a price, transactions whatever their simulation says, no route, a trade Mancer will not build, and a request Mancer refuses as wrong. A caller who hangs up after the quote was sent is charged too: Mancer did the work.
Not charged: what Blockhash refuses before asking Mancer, Mancer refusing Blockhash’s own key or its bucket for it being full, and Mancer’s failures: no answer, a quote past its time, an answer that cannot be read, a build that does not match the request.
Past a ceiling the request is refused with rate-limited and Retry-After, and Mancer is not asked. Every figure in compute units is on Compute units.
- A quote
- 800 units
- Against the speed
- 50 units
- A refusal
- 5 units of speed
- A thousand quotes
- $0.16
| Ceiling | Figure |
|---|---|
| Quotes a second, every account together | 25 |
| Quotes a second, the free accounts together | 5 |
| Quotes a second, any one account | 10 |
| Quotes waiting on Mancer at once, every account together | 50 |
| Quotes waiting on Mancer at once, any one account | 10 |
| Seconds for an answer | 11 |