Install the package

npm install @rhino.fi/sdk

Initialize the SDK

rhino-sdk.ts
import { RhinoSdk } from '@rhino.fi/sdk'

export const rhinoSdk = RhinoSdk({
  apiKey: 'YOUR_API_KEY',
})

Reach out to us for an API key

We’ll get back to you as soon as possible!

Make a bridge

bridge.ts
import { SupportedChains, SupportedTokens } from '@rhino.fi/sdk'
import { getEvmChainAdapterFromPrivateKey } from '@rhino.fi/sdk/adapters/evm'
import { rhinoSdk } from './rhino-sdk'

const bridgeResult = await rhinoSdk.bridge({
  amount: '100',
  token: SupportedTokens.USDT,
  chainIn: SupportedChains.ARBITRUM_ONE,
  chainOut: SupportedChains.SOLANA,
  depositor: 'DEPOSITOR_ADDRESS',
  recipient: 'RECIPIENT_ADDRESS',
  mode: 'receive',
  gasBoost: {
    amountNative: '4'
  }
}, {
  getChainAdapter: chainConfig =>
    getEvmChainAdapterFromPrivateKey(
      'YOUR_PRIVATE_KEY',
      chainConfig,
    ),
    hooks: {
      checkQuote: quote => quote.fees.feeUsd < 5,
      onBridgeStatusChange: status => console.log('Bridge status changed', status),
    },
})

if (bridgeResult.data) {
  console.log('Bridge successful', bridgeResult.data.withdrawTxHash)
} else {
  console.log('Bridge error', bridgeResult.error)
}

This would bridge 100 USDT from Arbitrum to Base while also receiving 4 SOL tokens at the recipient address. Through the checkQuote hook a bridge that would cost over $5 in fees would be aborted.

Resources