Rhino.fi Swidge API Reference
API reference for @rhino.fi/wdk-protocol-swidge-rhinofi.
Community modules are developed and maintained independently by third-party contributors.
Tether and the WDK Team do not endorse or assume responsibility for their code, security, or maintenance. Use your own judgment and proceed at your own risk.
RhinofiProtocol
RhinofiProtocol extends SwidgeProtocol from @tetherto/wdk-wallet/protocols and implements the shared WDK swidge methods.
import RhinofiProtocol, {
AccountRequiredError,
ConfigurationError
} from '@rhino.fi/wdk-protocol-swidge-rhinofi'
const rhinofi = new RhinofiProtocol(account, config)Constructor
new RhinofiProtocol(account?, config)| Account | Available operations |
|---|---|
WalletAccountEvm | Discovery, quote, status, and execution. |
WalletAccountEvmErc4337 | Discovery, quote, status, and execution through a smart account. |
WalletAccountSolana | Discovery, quote, status, and execution from Solana. |
WalletAccountTron | Discovery, quote, status, and execution from Tron. |
WalletAccountReadOnlyEvm | Discovery, quotes, and status lookups without signing. |
WalletAccountReadOnlyEvmErc4337 | Discovery, quotes, and status lookups without signing. |
WalletAccountReadOnlySolana | Discovery, quotes, and status lookups without signing. |
WalletAccountReadOnlyTron | Discovery, quotes, and status lookups without signing. |
undefined | Discovery and status lookups; quotes and execution require an account. |
Methods
| Method | Description |
|---|---|
quoteSwidge(options) | Returns a Rhino.fi route quote and the raw provider quote. |
swidge(options, config?) | Executes a route and returns when the source deposit is broadcast. |
getSwidgeStatus(id, options?) | Maps Rhino.fi operation state to WDK SwidgeStatus. |
getSupportedChains() | Returns chains supported by Rhino.fi config. |
getSupportedTokens(options?) | Returns tokens supported by Rhino.fi config, optionally filtered by chain context. |
quoteSwidge(options)
quoteSwidge(options: SwidgeOptions): Promise<SwidgeQuote & { quote: object }>The source chain is derived from the account when required by the route. Pass the returned quote field to swidge() when execution must use this exact provider quote.
swidge(options, config?)
swidge(
options: SwidgeOptions,
config?: SwidgeCallConfig
): Promise<SwidgeResult>Requires a supported writable WDK source account. The method submits the source-chain deposit and returns the operation ID and source transaction hash.
getSwidgeStatus(id, options?)
getSwidgeStatus(
id: string,
options?: SwidgeStatusOptions
): Promise<SwidgeStatusResult>Use the id returned by swidge().
Config Type
type RhinofiProtocolConfig = {
apiKey: string
apiBaseUrl?: string
maxNetworkFeeBps?: number | bigint
maxProtocolFeeBps?: number | bigint
configTtlMs?: number
}Per-Call Config Type
type DepositSubmission =
| { type: 'transaction'; txHash: string }
| { type: 'user-operation'; userOpHash: string }
type SwidgeCallConfig = {
maxNetworkFeeBps?: number | bigint
maxProtocolFeeBps?: number | bigint
quote?: object
onDepositSubmitted?: (submission: DepositSubmission) => void
}Use quote to execute the exact provider quote returned by quoteSwidge(). onDepositSubmitted reports that the deposit has left the device before a settled transaction hash is available; callback errors do not abort execution.
Status Mapping
| Rhino.fi state | WDK status |
|---|---|
PENDING, PENDING_CONFIRMATION, DEPOSIT_ACCEPTED, ACCEPTED | pending |
EXECUTED | completed |
SWAP_FAILED | refund-pending |
SWAP_FAILED_REFUNDED, DEPOSIT_RECEIVED_AFTER_GRACE_PERIOD_REFUNDED | refunded |
DEPOSIT_RECEIVED_AFTER_GRACE_PERIOD | action-required |
FAILED | failed |
CANCELLED | cancelled |
Fee Mapping
| Rhino.fi quote fee | WDK fee type | Legacy field |
|---|---|---|
gasFee plus sourceGasFee | network | fee |
| Platform and percentage fee remainder | protocol | bridgeFee |
The network and protocol fee amounts are itemized in SwidgeFee[] and denominated in the input token.
Error Types
All Rhino.fi module errors extend RhinofiProtocolError.
| Error | When thrown |
|---|---|
AccountRequiredError | swidge() is called without a writable account. |
ConfigurationError | Required configuration is missing, such as apiKey. |
UnsupportedChainError | A chain is unknown, unsupported, or invalid as a source chain. |
UnsupportedTokenError | A token is unknown or unsupported on the selected chain. |
FeeLimitExceededError | Quoted fees exceed configured fee caps. |
UnknownOperationError | Status is requested for an unknown operation ID. |
SwidgeExecutionError | Rhino.fi quote or execution fails. The .code field can carry provider failure codes. |
Legacy Delegations
Inherited swap, quoteSwap, bridge, and quoteBridge calls delegate to swidge() and quoteSwidge(). Because those legacy option shapes do not carry source-chain context, the source chain must be derivable from the bound account.