Summary

Version 1 of the SDK introduces bridge and swap and marks the first major stable release. It also introduces a shortcut to fetch bridge and token swap configs.

Breaking changes

This release contains some minor breaking changes. Migration is very straightforward.

Bridge functions change

The first argument of the bridge and prepareBridge functions now require an additional type field with the possible values of bridge and bridgeSwap. This is required as a swap requires slighly different arguments.

To adjust your existing code, you only need to add the highlighted field to your existing bridge or prepareBridge calls:

const bridgeResult = await rhinoSdk.bridge({
  type: 'bridge',
  amount: '100',
  token: SupportedTokens.USDT,
  chainIn: SupportedChains.ARBITRUM_ONE,
  chainOut: SupportedChains.SOLANA,
  depositor: 'DEPOSITOR_ADDRESS',
  recipient: 'RECIPIENT_ADDRESS',
  mode: 'receive',
}, {
  getChainAdapter: chainConfig =>
    getEvmChainAdapterFromPrivateKey(
      'YOUR_PRIVATE_KEY',
      chainConfig,
    ),
})

Chain adapter interface changes

The getApprovalAmount function on chain adapters previously only returned the required approval amount (or undefined if no approval needed). Now this function returns an object with requiredAllowance and availableAllowance fields.
This change was neccessary to include those two fields into the approval-needed variant of the prepareBridge function. It allows integrations to display the available and required allowance before users initiate the approval transaction.

There is no action needed regarding this change unless you have implemented your own chain adapter.

Config shortcuts

Previously you might have fetched the bridge config like this:

const bridgeConfig = await rhinoSdk.api.bridge.getBridgeConfig()

To streamline this with the addition of the new swap tokens config, a new API is now available:

// New way to fetch bridge config
const bridgeConfig = await rhinoSdk.api.config.bridge()
// New token swap config
const swapTokens = await rhinoSdk.api.config.swapTokens()
// Fetch both configs in one call
const configs = await rhinoSdk.api.config.all()

The getBridgeConfig in the bridge API wrapper is still available and will keep working. However, we recommend to use the new function for more idiomatic code.