SDK Reference
react-native
transferTokens

transferTokens Method

This method is used to transfer tokens from one wallet to another wallet.

Parameters

  • networkName - Name of the network to transfer funds.
  • tokenAddress - Address of the token to transfer.
  • recipientAddress - Address of the recipient wallet.
  • quantity - The amount of tokens to transfer.
transferTokens: (data: {
  network_name: string;
  token_address: string;
  quantity: string;
  recipient_address: string;
}) => Promise<TransferTokensData>

Example

import { useOkto, type OktoContextType} from 'okto-sdk-react-native';
 
const { transferTokens } = useOkto() as OktoContextType;
 
const networkName = "POLYGON_TESTNET"
const tokenAddress = "x2f7b97837f2d14ba2ed3a4b2282e259126a9b848"
const quantity = "1"
const recipientAddress = "0x0FC096A53343C68c1086e626661A4bb31486A9e2"
 
transferTokens({
      network_name: networkName,
      token_address: tokenAddress,
      recipient_address: recipientAddress,
      quantity: quantity
  }).then((result) => {
          console.log('Transfer success', result);
  })
  .catch((error) => {
      console.log('Transfer error', error);
  });