@ravnexchange/sdk call that benefits from React state: quote
fetching with expiry tracking, execute as an async action, and status as a poll. You still bring
your own wallet; these hooks never sign or send anything.
peer dependency
Requires React 18 or later.
peer dependency
Create one
RavnClient and pass it to every hook.useRavnQuote
params changes (compared by value, not by reference, so a fresh object
literal on every render is fine), and sets isExpired on its own timer when quote.expiresAt
passes: no polling, one setTimeout per quote. Pass params: null to skip fetching, for
example when the amount hasn’t been entered yet.
Does not auto-refetch on expiry. Silently re-pricing behind the user’s back is worse than
telling them to ask again, so call
refetch() yourself in response to isExpired.QuoteDTO | null
boolean
boolean
True once
quote.expiresAt has passed. Stop letting the user sign, and call refetch().() => void
useRavnExecute
client.execute(). Branch on the returned executionType and hand
it to whatever signer you already have: wagmi, ethers, a hardware wallet. Same contract as the
Quickstart.
(params: ExecuteParams) => Promise<ExecutionDTO>
Also throws on failure. Handle the rejection or read
error, whichever fits your flow.ExecutionDTO | null
boolean
unknown
useRavnStatus
/status until the status leaves pending/processing:
expired, success, refunded, failed, not_found, and unknown all stop the poll. Pass
params: null to not poll at all, for example before execution has produced a ref.
BTC-settled
DEPOSIT routes (Chainflip, NEAR Intents, Relay, Rift) commonly take 30+ minutes, tracked
for up to 90 minutes. The 4s default is fine for EVM/Solana swaps, but pass a longer interval,
10_000–15_000, for a BTC deposit so you’re not polling every 4 seconds for half an hour.Keeps polling through a transient network or
5xx error. Stops immediately on a permanent one,
UNAUTHORIZED, INVALID_REQUEST, QUOTE_INVALID, or NOT_FOUND, since retrying with the same
arguments can never turn one of those into success.StatusDTO | null
boolean
unknown
Putting it together
statusRef comes back on execute() for DEPOSIT, and on some TRANSACTIONs. For
SIGNATURE, you get it from submitSignature() instead, after signing, so track it in state
rather than reading it off execution directly. A TRANSACTION without one uses the
transaction hash your wallet returns as the ref. Pair every ref with execution.quoteToken, not
quote.quoteToken, and poll it to a terminal state like any other swap. That poll is what
settles the swap for fee payout. See
Execution Types and Settlement.

