Skip to main content
A thin, zero-dependency wrapper around the four calls in the Quickstart. Same request and response shapes as the raw API, just typed, with one error type instead of parsing HTTP status codes yourself.

Setup

string
Self-serve or enterprise key. Omit for the anonymous tier: it works immediately, at a lower rate limit. See Authentication.
string
Default https://ravn.exchange/api/v1.
function
Swap in your own fetch (React Native, a test double). Defaults to the global fetch.

Full example

Quote, execute, and track a swap end to end. execution.executionType also branches to TRANSACTION or SIGNATURE; see the Quickstart for the full switch.

Methods

Every method throws RavnApiError on a non-2xx response; see Errors below. Field meanings match the API Reference pages linked from each method.

getQuote

Wraps POST /quote. Omitting destinationAddress/refundAddress returns a preview-only quote, so check quote.executable before calling execute.

execute

Wraps POST /execute. Branch on executionType exactly as in the Quickstart. This client doesn’t sign or send anything for you.

submitSignature

Wraps POST /submit-signature. Only for SIGNATURE-type executions. Returns the statusRef to poll getStatus with.

getStatus

Wraps GET /status. ref is the statusRef from execute (for DEPOSIT) or from submitSignature (for SIGNATURE), matching the Full example above.

Errors

Every non-2xx response throws a RavnApiError, never a raw fetch or JSON error:
string
The stable, machine-readable code. See Errors for the full table.
string
Human-readable, and can change. Don’t branch on it.
unknown
Present on some codes, for example the failed fields on INVALID_REQUEST.
object
requestId and version, when the API returned an envelope at all.