Skip to content

xmtplabs/xmtp-agent-examples / skills/handling-transactions

handling-transactions

Verified

Token transactions and wallet integration for XMTP agents. Use when sending USDC, creating transaction requests, or handling transaction confirmations. Triggers on USDC transfer, wallet calls, or transaction reference.

FileKindSize
SKILL.mdskill md3.9 KB
rules/balance-check.mdmarkdown2.0 KB
rules/receive-transaction-reference.mdmarkdown1.6 KB
rules/send-usdc-transfer.mdmarkdown1.5 KB

rules/send-usdc-transfer.md

View on GitHub
---
title: Create USDC transfer requests
impact: CRITICAL
tags: transactions, usdc, transfer, wallet
---

## Create USDC transfer requests

Use the SDK 2.2.0 `createERC20TransferCalls` to create EIP-5792 compliant transfer requests.

**Basic transfer:**

```typescript
import { createERC20TransferCalls, validHex } from "@xmtp/agent-sdk";
import { parseUnits } from "viem";
import { baseSepolia } from "viem/chains";

const CHAIN = baseSepolia;
const USDC_ADDRESS = "0x036CbD53842c5426634e7929541eC2318f3dCF7e";

const walletSendCalls = createERC20TransferCalls({
  chain: CHAIN,
  tokenAddress: USDC_ADDRESS,
  from: validHex(senderAddress),
  to: validHex(recipientAddress),
  amount: parseUnits("1", 6), // 1 USDC (6 decimals)
  description: "Transfer 1 USDC on Base Sepolia",
});

await ctx.conversation.sendWalletSendCalls(walletSendCalls);
```

**Parse user input:**

```typescript
import { parseUnits } from "viem";

// Parse human-readable amount to bigint (e.g. "2.5" USDC with 6 decimals)
let amount: bigint;
try {
  amount = parseUnits(userInput, 6);
} catch {
  await ctx.conversation.sendText("Please provide a valid amount.");
  return;
}
if (amount <= 0n) {
  await ctx.conversation.sendText("Amount must be positive.");
  return;
}
```

**WalletSendCalls structure:**

The SDK's `createERC20TransferCalls` returns a `WalletSendCalls` object with `version`, `chainId`, `from`, and `calls` (each with `to`, `data`, `value`, and `metadata`: `description`, `transactionType: "transfer"`).
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 471kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 322kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 322kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 322kUpdated Claude CodeCodexVerifiedInstall