A basic example showing how to send tokens with memos on Tempo using Privy for wallet authentication.
- Transaction Memos: Attach human-readable memos to token transfers
- Privy Authentication: Embedded wallet creation and social login via Privy
- Token Transfers: Send alphaUSD tokens to other users
- Next.js 15 with App Router
- Tempo SDK (
tempo.ts) - Privy for wallet management
- Viem for Ethereum interactions
- TailwindCSS for styling
- Install dependencies:
pnpm install- Copy the example environment file and add your Privy credentials:
cp .env.example .env- Run the development server:
pnpm dev- Open http://localhost:3000 in your browser.
Privy provides two key functions in this app:
1. Sender Wallet (always used)
When you log in via email or SMS, Privy automatically creates an embedded wallet for you. No seed phrases or extensions needed. This wallet signs all your transactions.
2. Recipient Lookup (optional)
You can send to recipients in two ways:
| Recipient Type | Example | Privy Used? |
|---|---|---|
| Wallet address | 0x1234...abcd |
No - sends directly to address |
friend@example.com |
Yes - Privy looks up or creates their wallet | |
| Phone | +14155551234 |
Yes - Privy looks up or creates their wallet |
When sending to an email/phone, Privy either finds the recipient's existing wallet or creates a new one. The recipient can then log in with that email/phone to access their funds.
Memos are attached to transfers using the memo parameter (TIP-20 feature):
await client.token.transferSync({
to: recipient,
amount: parseUnits(amount, metadata.decimals),
memo: stringToHex(memo),
token: alphaUsd,
})