-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Objective
Create a smooth AI-guided flow for users to transfer funds from their BYO wallet (MetaMask, WalletConnect) to their new embedded smart wallet before executing automation features.
Background
After creating an embedded wallet, users need to fund it before automation features can execute. Since automation transactions will originate from the embedded wallet's address, funds must be transferred from the user's BYO wallet (where their assets currently are) to the new embedded wallet.
This flow should be conversational, minimize friction, and clearly explain why the transfer is needed.
Acceptance Criteria
- AI detects when user wants automation feature but embedded wallet has insufficient balance
- AI generates a transfer transaction from BYO wallet to embedded wallet
- Transaction pre-fills amount, token, and destination address
- User signs transfer transaction once with their BYO wallet
- AI confirms when transfer is complete (waits for confirmation)
- Provide transaction hash and link to block explorer
- Handle error cases (insufficient balance, user rejects, network error)
- Support transferring ERC-20 tokens, native ETH, and other assets
- Allow partial funding (user doesn't have to transfer everything)
User Experience Flow
User: "Set up a TWAP order to buy $1000 ETH with my USDC"
AI: [Creates embedded wallet]
"Your smart wallet address is 0xABC...DEF
To fund your TWAP order, transfer $1000 USDC from MetaMask to your smart wallet.
I've prepared the transfer transaction. Please sign to continue."
[Shows transfer transaction details]
- From: 0x123...456 (MetaMask)
- To: 0xABC...DEF (Your Smart Wallet)
- Amount: 1000 USDC
- Network: Arbitrum
[User signs transaction]
AI: "Transfer sent! Transaction: 0xTXHASH
Waiting for confirmation..."
[30 seconds later]
AI: "Transfer confirmed! Your smart wallet now has 1000 USDC.
Now let's set up your TWAP order..."
Technical Context
Transaction Generation:
Create a transfer transaction similar to existing send functionality:
- Native transfers: simple value transfer
- ERC-20 transfers: call
transfer(address, uint256)on token contract
Files to Reference:
/apps/agentic-chat/src/hooks/useSendExecution.ts- Existing send functionality/apps/agentic-chat/src/utils/chains/evm/transaction.ts- Transaction construction
New AI Tool:
Create tool for fund migration, similar to existing swap/send tools:
interface MigrateFundsParams {
fromAddress: string // BYO wallet address
toAddress: string // Embedded wallet address
amount: string
token: string // Token symbol or address
network: string // Which chain
}Transaction Execution:
Use existing transaction infrastructure:
- Build transaction data
- Send to frontend for signing
- Wait for user signature
- Broadcast via RPC
- Wait for confirmation
- Return transaction hash
UX Considerations
Minimize Friction:
- Pre-fill all transaction details
- Show clear source/destination addresses
- Display amount in human-readable format (1000 USDC, not wei)
- Provide block explorer link
Build Trust:
- Show exactly what's being transferred
- Explain this is a standard blockchain transfer
- User can verify in their wallet before signing
- Provide confirmation with transaction hash
Flexibility:
- Allow partial funding ("Transfer $500 now, $500 later")
- Support multiple tokens
- Let user choose which BYO wallet to transfer from (if multiple)
Error Handling
- Insufficient balance in BYO wallet
- User rejects transaction
- Network error during broadcast
- Transaction fails (low gas, etc.)
- User tries to proceed without funding
For each error:
- Show clear message
- Provide recovery options
- Don't block user from continuing with BYO wallet if they prefer
Multi-Chain Considerations
If user's BYO wallet and embedded wallet are on different chains:
- Explain that a bridge would be needed (separate feature)
- Or suggest user transfer on same chain first
- Document cross-chain migration as future enhancement
Testing Scenarios
- Transfer native ETH from BYO to embedded wallet
- Transfer ERC-20 token (USDC) from BYO to embedded wallet
- User has insufficient balance
- User rejects transaction
- Transaction succeeds and confirms
- Multiple transfers to same embedded wallet
- Transfer from one BYO wallet when user has multiple connected
Dependencies
- Requires "Build Embedded Wallet Creation Flow in Chat Interface"
- Requires "Update Wallet State Management for Dual-Wallet Support"
Metadata
Metadata
Assignees
Labels
Type
Projects
Status