useReservoirClient

This hook exposes the underlying ReservoirKit client which is in charge of making the underlying execute requests and interacting with web3 interfaces. The hook can also be useful to get the underlying global configuration of ReservoirKit (apiBase, apiKey etc).

import { useReservoirClient } from '@reservoir0x/reservoir-kit-ui'

const client = useReservoirClient()
console.log(client?.apiBase)

It can also be useful to trigger actions in a flexible way. Actions are the underlying execute apis that ReservoirKit's ui triggers. Here's an example of how to trigger the underlying execute/buy api.

import { useReservoirClient } from '@reservoir0x/reservoir-kit-ui'

const client = useReservoirClient()
await reservoirClient.actions
      .buyToken({
        ...
      })
      .then(()=> {})
      .catch(() => {})