Parameters

ParameterDescriptionRequired
clientA RelayClient instance. You can create one using the SDK or retrieve one using the useRelayClient hook from the UI kit.
optionsOptions that map directly to the price API.
onResponseA callback function that triggers when a response is returned.
queryOptionsTanstack query options. Refer to the Tanstack docs.

Return Data

The hook returns an object with the base Tanstack Query response. The data returned will be the response from the price API.

Usage

Query Function

import { queryPrice } from "@reservoir0x/relay-kit-hooks";

const response = queryPrice("https://api.relay.link", {
  user: address,
  originChainId: 1,
  destinationChainId: 10,
  originCurrency: "0x0000000000000000000000000000000000000000",
  destinationCurrency: "0x0000000000000000000000000000000000000000",
  tradeType: "EXACT_INPUT",
  amount: "10000000",
});