Skip to main content
This quickstart walks you through sending tokens from one wallet to another on the same blockchain. The example in this quickstart sends USDC on Arc Testnet, but you can use another supported token or blockchain.

Prerequisites

Before you begin, ensure that you’ve:

Step 1. Set up the project

This step shows you how to prepare your project and environment.

1.1. Set up your development environment

Create a new directory and install App Kit and its dependencies:
Shell
# Set up your directory and initialize a Node.js project
mkdir app-kit-quickstart-send
cd app-kit-quickstart-send
npm init -y

# Install App Kit and tools
npm install @circle-fin/app-kit @circle-fin/adapter-viem-v2 viem typescript tsx

1.2. Configure TypeScript (optional)

This step is optional. It helps prevent missing types in your IDE or editor.
Create a tsconfig.json file:
Shell
npx tsc --init
Then, update the tsconfig.json file:
Shell
cat <<'EOF' > tsconfig.json
{
  "compilerOptions": {
    "target": "ESNext",
    "module": "ESNext",
    "moduleResolution": "bundler",
    "strict": true,
    "types": ["node"]
  }
}
EOF

1.3. Configure environment variables

Create an .env file in the project directory:
Shell
touch .env
Then, add your wallet private key. Replace YOUR_PRIVATE_KEY with the private key for your wallet:
.env
PRIVATE_KEY=YOUR_PRIVATE_KEY
Edit .env files in your IDE or editor so credentials are not leaked to your shell history.

Step 2. Send tokens to recipient

This step shows you how to set up your script, send tokens from your wallet to a recipient on the same blockchain, and check the result.

2.1. Create the script

Create an index.ts file in the project directory and add the following code. This code sends 1.00 USDC from your wallet to a recipient on Arc Testnet:
Using another token or blockchain? Change the token and chain values in kit.send() and use an adapter for that chain.
TypeScript
import { AppKit } from "@circle-fin/app-kit";
import { createViemAdapterFromPrivateKey } from "@circle-fin/adapter-viem-v2";
import type { SendParams } from "@circle-fin/app-kit";
import { inspect } from "node:util";

const kit = new AppKit();

const sendTokens = async (): Promise<void> => {
  const adapter = createViemAdapterFromPrivateKey({
    privateKey: process.env.PRIVATE_KEY as string,
  });

  const sendParams: SendParams = {
    from: { adapter, chain: "Arc_Testnet" },
    to: "RECIPIENT_ADDRESS", // Replace with recipient address
    amount: "1.00",
    token: "USDC",
  };

  const estimate = await kit.estimateSend(sendParams);
  const result = await kit.send(sendParams);
  console.log(inspect(result, false, null, true));
};

void sendTokens();

2.2. Run the script

Save the index.ts file and run the script in your terminal:
Shell
npx tsx --env-file=.env index.ts

2.3. Verify the transaction

After the script finishes, find the returned result in the terminal output. Use the transaction explorer URL to verify the amount and recipient on the blockchain. The following is an example of how the result of a successful send might look in the terminal output. The values are used in this example only and are not a real transaction:
Shell
{
  name: "transfer",
  state: "success",
  txHash: "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
  explorerUrl: "https://testnet.arcscan.app/tx/0x1234567890abcdef..."
}

Next steps