WDK logoWDK documentation

Rhino.fi Swidge Configuration

Configuration options for @rhino.fi/wdk-protocol-swidge-rhinofi.

RhinofiProtocol requires a Rhino.fi API key. The SDK authenticates every call, including quote and discovery calls. Create and manage API keys in the Rhino.fi Console.

import RhinofiProtocol from '@rhino.fi/wdk-protocol-swidge-rhinofi'

const rhinofi = new RhinofiProtocol(account, {
  apiKey: process.env.RHINO_API_KEY,
  maxNetworkFeeBps: 50,
  maxProtocolFeeBps: 30
})

Constructor

new RhinofiProtocol(account?, config)
ParameterDescription
accountOptional WDK EVM account. Writable accounts can execute. Read-only accounts can quote and discover support.
configRequired RhinofiProtocolConfig. Must include apiKey.

Configuration Options

OptionTypeDescription
apiKeystringRhino.fi API key. Required for every call.
apiBaseUrlstringOptional Rhino.fi API base URL override. Use https://.
maxNetworkFeeBpsnumber | bigintRejects execution when network fees exceed this many basis points of the input amount.
maxProtocolFeeBpsnumber | bigintRejects execution when protocol fees exceed this many basis points of the input amount.
configTtlMsnumberMilliseconds to cache Rhino.fi config and swap-token lists. Defaults to 60000; set 0 to always fetch fresh.

Per-Call Overrides

Pass config to swidge(options, config) to override fee caps for a single execution.

await rhinofi.swidge(options, {
  maxNetworkFeeBps: 40,
  maxProtocolFeeBps: 25
})

API Base URL

Use https:// API URLs. http:// URLs can redirect and break authenticated SDK requests.

const rhinofi = new RhinofiProtocol(account, {
  apiKey: process.env.RHINO_API_KEY,
  apiBaseUrl: 'https://api.rhino.fi'
})

Config Caching

The module caches Rhino.fi chain config and swap-token lists for configTtlMs.

const rhinofi = new RhinofiProtocol(account, {
  apiKey: process.env.RHINO_API_KEY,
  configTtlMs: 60000
})

Set configTtlMs: 0 when you need every call to fetch fresh provider configuration.

Security Notes

  • Store apiKey in server-side or secret-managed configuration.
  • Use trusted RPC providers for WDK EVM accounts.
  • Set fee caps for user-facing flows.
  • Ask for user confirmation before calling swidge().

On this page