Currencies and chains
The chains and tokens QBitFlow takes, live from its catalog, and how to handle amounts exactly.
23 currencies · 3 chainsLive from the API · read hourly
Ethereum
8 coins- ETHEthereumETH, 18 decimalsEthereum's own coin, which pays its network fees
- USDCUSD CoinETH:USDC, 6 decimalsUSDC's contract on Ethereum: 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 (opens in a new tab)
- USDTTether USDETH:USDT, 6 decimalsUSDT's contract on Ethereum: 0xdAC17F958D2ee523a2206206994597C13D831ec7 (opens in a new tab)
- EURCEuro CoinETH:EURC, 6 decimalsEURC's contract on Ethereum: 0x1aBaEA1f7C830bD89Acc67eC4af516284b1bC33c (opens in a new tab)
- WETHWrapped EtherETH:WETH, 18 decimalsWETH's contract on Ethereum: 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2 (opens in a new tab)
- LINKChainLink TokenETH:LINK, 18 decimalsLINK's contract on Ethereum: 0x514910771AF9Ca656af840dff83E8264EcF986CA (opens in a new tab)
- DAIDai StablecoinETH:DAI, 18 decimalsDAI's contract on Ethereum: 0x6B175474E89094C44Da98b954EedeAC495271d0F (opens in a new tab)
- WBTCWrapped BTCETH:WBTC, 8 decimalsWBTC's contract on Ethereum: 0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599 (opens in a new tab)
Base
8 coins- ETHEthereumBASE, 18 decimalsBase's own coin, which pays its network fees
- USDCUSD CoinBASE:USDC, 6 decimalsUSDC's contract on Base: 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 (opens in a new tab)
- USDTBridged Tether USDBASE:USDT, 6 decimalsUSDT's contract on Base: 0xfde4C96c8593536E31F229EA8f37b2ADa2699bb2 (opens in a new tab)
- EURCEUR CoinBASE:EURC, 6 decimalsEURC's contract on Base: 0x60a3E35Cc302bFA44Cb288Bc5a4F316Fdb1adb42 (opens in a new tab)
- WETHWrapped EtherBASE:WETH, 18 decimalsWETH's contract on Base: 0x4200000000000000000000000000000000000006 (opens in a new tab)
- DAIDai StablecoinBASE:DAI, 18 decimalsDAI's contract on Base: 0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb (opens in a new tab)
- cbBTCCoinbase Wrapped BTCBASE:cbBTC, 8 decimalscbBTC's contract on Base: 0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf (opens in a new tab)
- AEROAerodromeBASE:AERO, 18 decimalsAERO's contract on Base: 0x940181a94A35A4569E4529A3CDfB74e38FD98631 (opens in a new tab)
Solana
7 coins- SOLSolanaSOL, 9 decimalsSolana's own coin, which pays its network fees
- USDCUSD CoinSOL:USDC, 6 decimalsUSDC's contract on Solana: EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v (opens in a new tab)
- USDTTether USDSOL:USDT, 6 decimalsUSDT's contract on Solana: Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB (opens in a new tab)
- EURCEuro CoinSOL:EURC, 6 decimalsEURC's contract on Solana: HzwqbKZw8HxMN6bF2yFZNrht3c2iXXzpKcFu7uBEDKtr (opens in a new tab)
- WSOLWrapped SolSOL:WSOL, 9 decimalsWSOL's contract on Solana: So11111111111111111111111111111111111111112 (opens in a new tab)
- LINKWrapped ChainlinkSOL:LINK, 6 decimalsLINK's contract on Solana: CWE8jPTUYhdCTZYWPTe1o5DFqfdjzWKc9WKz6rSjQUdG (opens in a new tab)
- DAIDai StablecoinSOL:DAI, 8 decimalsDAI's contract on Solana: EjmyN6qEC1Tf1JxiG1ae7UTJhUxSwk1TCWNWqxWV4J6o (opens in a new tab)
The catalog
A currency is a chain's own coin or a token on a chain. The catalog above is the API's: it grows
with nothing to change on your side. A currency's numeric id is the same everywhere.
| Field | What it is |
|---|---|
id | what availableCurrencyIds (in requests) and mainCurrencyId hold |
code | BASE:USDC: chain and symbol, what requests take |
symbol, name | USDC, "USD Coin" |
chain | the chain it lives on, BASE |
decimals | the smallest unit's decimal places (6 for USDC and 18 for its chain's own coin, in the contract's examples) |
address | the token's contract (or mint); absent on a chain's own coin |
mainCurrencyId | a token's chain coin; absent on a chain's own coin |
test | a test network's currency |
currencies-list.sh
# A public route, limited to 60 requests a minute per IP: cache the list at start-up.# ?test=true lists the test networks' currencies instead.curl https://api.qbitflow.app/v2/currencies# 200: a page of Currency ({ items, hasMore: false })// A public route limited to 60 requests a minute per IP: cache the list at start-up. One bounded// list (an array): the live currencies; test: true, the test networks'; main: true, the chains'// native coins only.const currencies = await client.currencies.list();for (const { id, code, name, chain, decimals } of currencies) { console.log(`${id}: ${code} (${name} on ${chain}), ${decimals} decimals`);}# A public route limited to 60 requests a minute: cache the list at start-up. One bounded# list: the live currencies; test=True the test networks'; main=True the native coins only.currencies = client.currencies.list()for currency in currencies: print(currency.id, currency.code, currency.name, currency.chain, currency.decimals)// A public route limited to 60 requests a minute per IP: cache the list at start-up.// One bounded list (a slice): the live currencies; Test: the test networks'; Main: the// chains' native coins only.currencies, err := client.Currencies.List(ctx, nil)if err != nil { log.Fatal(err)}for _, c := range currencies { fmt.Printf("%d: %s (%s on %s), %d decimals\n", c.ID, c.Code, c.Name, c.Chain, c.Decimals)}// One bounded list: the live currencies; test: the test networks'; main: the chains' native coins only.foreach ($client->currencies->list() as $currency) { echo "{$currency->id}: {$currency->code} ({$currency->name} on {$currency->chain}), {$currency->decimals} decimals\n";}GET /currencies lists them (?test=true for test
networks), GET /currencies/
Which currencies a checkout takes
What the space's wallets accept (one per chain, with its enabled tokens): GET /wallets/409 merchant_not_ready).
How amounts work
From the contract · payment.completed
amountMinUnits, allowance.amountMinUnits, allowance.maxPerPeriodMinUnits, paidMinUnits: an integer in the smallest
unit, as a decimal string. decimals places the point: 10000000 with 6 decimals is 10 USDC.
Avoid
Parse it as a float
Do
Keep a string or a big integer
// Token amounts come both ways, as decimal strings: payment.amount ('4.99') and// payment.amountMinUnits ('4990000', with payment.currency.decimals). Convert between them with// string arithmetic, never floats.const shown = formatAmount('4990000', 6); // '4.99' (USDC has 6 decimals)const minUnits = parseAmount('4.99', 6); // '4990000'console.log(`${shown} USDC = ${minUnits} minimal units`);# Amounts in a token's smallest unit are decimal strings: never convert them through a float.shown = qbitflow. format_amount( "4990000", 6) # "4.99" (6 decimals, like USDC)min_units = qbitflow.parse_amount("4.99", 6) # "4990000"print(shown, min_units)// Exact decimal arithmetic on strings, never floats. USDC has 6 decimals.display, err := qbitflow.FormatAmount("4990000", 6)if err != nil { log.Fatal(err)}fmt.Println(display, "USDC") // 4.99 USDC minUnits, err := qbitflow.ParseAmount("4.99", 6) // more than 6 decimals is a *ValidationErrorif err != nil { log.Fatal(err)}fmt.Println(minUnits) // 4990000 // From a payment: payment.Currency.FormatAmount(payment.AmountMinUnits)// Amounts in a token's smallest unit are decimal strings: convert them exactly, never through floats.$display = \QBitFlow\Support\Amount::format( '4990000', 6); // "4.99" (USDC has 6 decimals)$minUnits = \QBitFlow\Support\Amount::parse( '4.99', 6); // "4990000"echo "{$display} USDC = {$minUnits} min units\n";- USD beside it.
amountis the token amount (an exact decimal string) andamountUsdits USD value. QBitFlow converts your USD prices when the customer picks a currency, rounding down to the smallest unit. - Amounts fit the chain. A price too large for a token, or under one unit, is refused at the intent: another token may hold it.
- A fresh price is required. Without one, or with a stablecoin off its peg, QBitFlow prepares
nothing (
503 network_unavailable): try later. - USD in requests.
priceUsdandamountUsdare decimal strings ("4.99"), never numbers. A fee line'samountUsd: above 0, at most $1,000,000, 2 decimals.