Skip to main content
Use bridge transfers when your platform, or your user’s connected wallet, holds the funds and signs the deposit. One flow covers three use cases:
If you collect deposits from end customers, Smart Deposit Addresses are usually the better fit: your customers, or your platform after consolidating funds, send to an address and Rhino.fi detects and settles each deposit. Use bridge transfers when you or your end customers sign each transfer from a wallet, for example for withdrawals, treasury movements or in-app transfers. Many clients use both, with SDAs for deposits and bridge transfers for withdrawals.

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.
The examples use the rhinoFetch helper from Authentication and ethers v6 for EVM chains.

1. Load configs

For cross-chain and same-chain swaps, also load the swap token list:

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. Set amountNative 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. Pass webhookUrl in the quote only to send events for this transfer to a different URL.

Refund address

Set refundAddress 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 before expiresAt. 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.
Pass the 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 exactly payAmount 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
For non-EVM source chains, use the chain’s contract guide: Solana, Starknet, TON or TRON.

5. Track settlement

Rhino.fi detects the deposit and settles on chainOut. 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’s speed 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, set tokenOut to that token. The flow is unchanged, with two differences:
  • Read tokenIn’s address and decimals from the swap token list, not from configs.
  • 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 a BRIDGE_REFUNDED webhook.

Same-chain swaps

When chainIn and chainOut are the same EVM chain, the quote returns isAtomicSwap: true. The swap runs in a single transaction through a different contract:
  1. For ERC-20 tokens, approve configs[chainIn].sameChainSwapsAddress, not contractAddress. Native tokens need no approval.
  2. Fetch the prepared transaction with GET /bridge/swap/calldata/{quoteId}.
  3. Send it as returned.
Do not call depositWithId or depositNativeWithId for a same-chain swap. Rhino.fi rejects bridge deposits made against a same-chain swap commitment.

Full example

This example handles all three cases. It assumes rhino.js from Authentication and deposit-evm.js from above.
bridge-tokens.js
Usage
More examples for EVM, Solana and TON are in the bridge-examples repository.

Next steps

Track transactions

Follow each transfer to settlement and reconcile your history.