transferTokens

This action can be used to transfer tokens between wallets

You can supply an object of parameters listed below:

ParameterDescriptionRequiredExample
toThe address to send the wallet totrue"0xfbff2739978790aa7655fb1b75bb1811e347c1fd"
walletA valid WalletClient from viem or a ReservoirWallet generated from an adapter. Learn more about adapters.trueRefer to viem's documentation on WalletClients_
onProgressCallback to update UI state as execution progresses. Can also be used to get the transaction hash for a given step item.true(steps) => { console.log(steps) }
itemsList of items to transferfalse[{token: '0x30385bce01da4b415cae1db21d41e9f6eab3ba50:127', quantity: 1}]
chainIdOverride the current active chainfalse1

Example

import { getClient, Execute } from "@reservoir0x/reservoir-sdk";
import { createWalletClient, http } from 'viem'

...

wallet = createWalletClient({
  account: address,
  transport: http()
})

getClient().actions.transferTokens({
  to: to,
  items: [
    {
      token: token,
      quantity: quantity ?? 1,
    },
  ],
  wallet: wallet,
  onProgress: (steps) => {
    console.log(steps)
  },
})