# Part 6: Transferring assets · Asset management system with React and FT4 · Learn Chromia

> This lesson shows you how to move assets from one account to another with the FT4 token standard.

Source: https://chromia.com/learn/ft4-demo-app/module-frontend-application/transfer/

Asset management system with React and FT4Lesson 15 of 16

1. [01Create an asset management system using FT4](https://chromia.com/learn/ft4-demo-app/introduction/)

Module 1: Initialize the full-stack application

1. [02Overview](https://chromia.com/learn/ft4-demo-app/module-init/)
2. [03Prepare the full-stack application](https://chromia.com/learn/ft4-demo-app/module-init/setup-application/)

Module 2: The blockchain dapp

1. [04Overview](https://chromia.com/learn/ft4-demo-app/module-blockchain/)
2. [05Part 1: Set up the blockchain dapp](https://chromia.com/learn/ft4-demo-app/module-blockchain/setup/)
3. [06Account management](https://chromia.com/learn/ft4-demo-app/module-blockchain/account-management/)
4. [07Asset Registration and Minting](https://chromia.com/learn/ft4-demo-app/module-blockchain/asset-registration/)
5. [08Test the asset management system](https://chromia.com/learn/ft4-demo-app/module-blockchain/test/)

Module 3: The frontend application

1. [09Overview](https://chromia.com/learn/ft4-demo-app/module-frontend-application/)
2. [10Part 1: Prepare the frontend application](https://chromia.com/learn/ft4-demo-app/module-frontend-application/setup/)
3. [11Part 2: Tools for Chromia development](https://chromia.com/learn/ft4-demo-app/module-frontend-application/tools/)
4. [12Part 3: Registering accounts](https://chromia.com/learn/ft4-demo-app/module-frontend-application/account-regisration/)
5. [13Part 4: Registering and minting](https://chromia.com/learn/ft4-demo-app/module-frontend-application/register-and-mint/)
6. [14Part 5: Burning tokens](https://chromia.com/learn/ft4-demo-app/module-frontend-application/burn/)
7. [15Part 6: Transferring assets](https://chromia.com/learn/ft4-demo-app/module-frontend-application/transfer/)
8. [16Part 7: Deploying onchain](https://chromia.com/learn/ft4-demo-app/module-frontend-application/deploy-onchain/)

[Learn](https://chromia.com/learn/)[Asset management system with React and FT4](https://chromia.com/learn/ft4-demo-app/)

15 / 16Module 3: The frontend applicationIntermediate

# Part 6: Transferring assets

This lesson shows you how to move assets from one account to another with the FT4 token standard.

To read account balances, call the `useGetBalances` hook from the `@chromia/react` package. Once you have the balances, you can confirm that the account holds enough tokens before sending a transfer.

asset\_management/src/hooks/token-hooks.ts

```
import { useCallback } from "react";

import { createAmount, op } from "@chromia/ft4";
import {
  useFtAccounts,
  useFtSession,
  useGetAllAssets,
  useGetBalances,
  usePostchainClient,
} from "@chromia/react";
import { useAccount } from "wagmi";

import { ensureBuffer } from "@/utils/ensure-buffer";
import { publicClientConfig as clientConfig } from "@/utils/generate-client-config";

export function useTransferTokens({
  onSuccess,
  onError,
}: {
  onSuccess?: (token: MintTokenParams) => void;
  onError?: (token: MintTokenParams) => void;
}) {
  const { data: ftAccounts } = useFtAccounts({ clientConfig });

  const { data: session } = useFtSession(
    ftAccounts?.length ? { clientConfig, account: ftAccounts[0] } : null,
  );

  const { flatData: balances } = useGetBalances(
    ftAccounts?.length
      ? {
          clientConfig,
          account: ftAccounts[0],
          params: [10],
          swrInfiniteConfiguration: {
            refreshInterval: 20_000,
          },
        }
      : null,
  );

  const transferTokens = useCallback(
    async (recipient: string, amount: number) => {
      if (!balances?.length) {
        return;
      }
      const asset = balances[0].asset;

      try {
        await session?.account.transfer(
          ensureBuffer(recipient),
          ensureBuffer(asset.id),
          createAmount(amount),
        );

        onSuccess?.({ ticker: asset.symbol, name: asset.name, amount });
      } catch (error) {
        console.error(error);

        onError?.({ ticker: asset.symbol, name: asset.name, amount });
      }
    },
    [balances, onError, onSuccess, session?.account],
  );

  return transferTokens;
}
```

The snippet defines a custom hook, `useTransferTokens`. It obtains the current session through `useFtSession`, and it fetches the account balances through `useGetBalances` to verify that enough tokens are available. When the balance is sufficient, the hook calls the `transfer` method on the session object's account property, which sends the requested amount to the recipient account.

Written for this site from Chromia’s public course. Code samples are the course’s own.

[← Previous**Part 5: Burning tokens**](https://chromia.com/learn/ft4-demo-app/module-frontend-application/burn/)[Next →**Part 7: Deploying onchain**](https://chromia.com/learn/ft4-demo-app/module-frontend-application/deploy-onchain/)
