How it works
1
Load configs
Get the chains, tokens and contract addresses you need.
2
Request a quote
Get the fees, amounts and expiry time for the transfer.
3
Commit the quote
Lock in the quote. Its
quoteId identifies the transfer from here on.4
Deposit onchain
Send the deposit transaction on the source chain, referencing the quote ID (
quoteId).5
Track settlement
Receive webhooks or poll the status endpoint until the transfer is executed.
rhinoFetch helper from Authentication and ethers v6 for EVM chains.
1. Load configs
2. Request a quote
Choose a mode
mode decides what amount means. With pay, amount is what the depositor sends and fees come out of it, so the recipient gets slightly less. With receive, amount is exactly what the recipient gets and fees are added on top. Use receive when the recipient must get a precise amount, for example to settle an invoice.
Gas Boost
The recipient may need the destination chain’s native token (such as ETH) to pay gas for their next transaction. SetamountNative to deliver some with the transfer. It comes out of the amount received, so it can’t be larger than that amount.
Webhooks
Set a webhook URL once for your project in the Rhino.fi Console. PasswebhookUrl in the quote only to send events for this transfer to a different URL.
Refund address
SetrefundAddress only if the depositor can reliably access that address, such as a wallet they control. If funds come from a pooled source like an exchange, leave it unset. Your account manager then handles each refund and returns funds to a verified address.
Quote response
The response includes:
See the API reference for the full schema.
3. Commit the quote
Commit beforeexpiresAt. Committing confirms that you intend to send the deposit.
- If you don’t commit in time, the quote expires and is deleted. Quotes currently expire after about three minutes, but always rely on
expiresAt. Committing an expired quote returns an error saying the quote doesn’t exist or has expired, so request a new quote. - Commit each quote once. Committing a quote that is already committed returns an error.
quoteId to the deposit in the next step. To look the transfer up later, you can use either the quoteId or the deposit transaction hash.
4. Deposit onchain
Send exactlypayAmount to the bridge contract on chainIn, and pass the quote ID (quoteId) as the commitmentId. The bridge contract has two deposit functions:
depositWithId(token, amount, commitmentId)for ERC-20 tokens. It requires an allowance for the bridge contract.depositNativeWithId(commitmentId)for the chain’s native token, sent as the transaction value.
deposit-evm.js
5. Track settlement
Rhino.fi detects the deposit and settles onchainOut. The quote’s estimatedDuration gives the estimated time in milliseconds. It is an estimate, not a guarantee. Subscribe to webhooks, or poll GET /bridge/history/bridge/{quoteId}, until the state is EXECUTED. See Track transactions.
Settlement speed
Rhino.fi picks the speed for each transfer automatically, based on the amount, the confirmations the source chain needs and the liquidity on the destination chain. You can’t choose it. The quote’sspeed field tells you which applies.
Smart Deposit Address deposits follow the same speeds, plus up to about 30 seconds for deposit detection. See Bridge speed for details.
Swap tokens during a transfer
To receive a different token from the one you send, settokenOut to that token. The flow is unchanged, with two differences:
- Read
tokenIn’s address and decimals from the swap token list, not fromconfigs. - The quote includes
minReceiveAmount, the minimum guaranteed output. If the token price moves significantly after the quote, the transfer is refunded rather than settled, and you receive aBRIDGE_REFUNDEDwebhook.
Same-chain swaps
WhenchainIn and chainOut are the same EVM chain, the quote returns isAtomicSwap: true. The swap runs in a single transaction through a different contract:
- For ERC-20 tokens, approve
configs[chainIn].sameChainSwapsAddress, notcontractAddress. Native tokens need no approval. - Fetch the prepared transaction with
GET /bridge/swap/calldata/{quoteId}. - Send it as returned.
Full example
This example handles all three cases. It assumesrhino.js from Authentication and deposit-evm.js from above.
bridge-tokens.js
Usage
Next steps
Track transactions
Follow each transfer to settlement and reconcile your history.