xmtplabs/xmtp-agent-examples / skills/handling-transactions
handling-transactions
VerifiedToken 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.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 3.9 KB |
| rules/balance-check.md | markdown | 2.0 KB |
| rules/receive-transaction-reference.md | markdown | 1.6 KB |
| rules/send-usdc-transfer.md | markdown | 1.5 KB |
rules/receive-transaction-reference.md
View on GitHub---
title: Handle transaction confirmations
impact: CRITICAL
tags: transactions, reference, confirmation
---
## Handle transaction confirmations
Use the `transaction-reference` event to handle completed transactions.
**Basic handler:**
```typescript
agent.on("transaction-reference", async (ctx) => {
const transactionRef = ctx.message.content;
await ctx.conversation.sendText(
`β
Transaction confirmed!\n` +
`π Network: ${transactionRef.networkId}\n` +
`π Hash: ${transactionRef.reference}`
);
});
```
**Coinbase Wallet compatibility:**
Coinbase Wallet incorrectly wraps transaction references. Handle both formats:
```typescript
agent.on("transaction-reference", async (ctx) => {
// Handle both standard and Coinbase's nested format
// Standard: { networkId, reference, metadata }
// Coinbase: { transactionReference: { networkId, reference, metadata } }
// @ts-expect-error - Coinbase Wallet wraps incorrectly
let transactionRef = ctx.message.content.transactionReference;
if (transactionRef?.transactionReference) {
transactionRef = transactionRef.transactionReference;
} else {
transactionRef = ctx.message.content;
}
console.log("Network:", transactionRef.networkId);
console.log("Hash:", transactionRef.reference);
if (transactionRef.metadata) {
console.log("Metadata:", transactionRef.metadata);
}
});
```
**Transaction reference structure:**
```typescript
interface TransactionReference {
networkId: string; // e.g., "base-sepolia"
reference: string; // Transaction hash
metadata?: {
// Optional transaction metadata
};
}
```
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| 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: 471k | Updated | Claude CodeCodex | Verified | Install |
| 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: 322k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| 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 available | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |