Skip to content

Add token rescue feature for recovering stuck USDC#2102

Merged
MusabShakeel576 merged 2 commits into
masterfrom
claude/trusting-tesla-xaC2V
May 28, 2026
Merged

Add token rescue feature for recovering stuck USDC#2102
MusabShakeel576 merged 2 commits into
masterfrom
claude/trusting-tesla-xaC2V

Conversation

@MusabShakeel576
Copy link
Copy Markdown
Contributor

Summary

This PR adds a new token rescue feature that allows users to recover USDC that was accidentally sent to their signer wallet on Ethereum instead of their Solid Safe wallet.

Key Changes

  • New rescue token page (app/(protected)/rescue-token.tsx): A dedicated UI for the token recovery flow that displays:

    • Stuck USDC balance in the signer wallet
    • Destination Safe wallet address
    • Required ETH gas fees with helpful tooltip
    • Action button to initiate the rescue transaction
  • New rescue token hook (hooks/useRescueToken.ts): Core logic for executing the rescue transaction that:

    • Validates user wallet and Safe addresses
    • Creates a Turnkey passkey-authenticated account
    • Executes an ERC20 transfer of USDC to the user's Safe wallet
    • Waits for transaction confirmation and validates success
    • Includes comprehensive error handling and Sentry logging
  • Gas estimation: Intelligently estimates gas costs for the USDC transfer with:

    • On-chain gas estimation when user has USDC balance
    • Fallback gas estimate (65,000 units) when estimation fails
    • Proper fee calculation using maxFeePerGas or gasPrice
  • Navigation and routing:

    • Added rescue-token route to protected layout with slide animation
    • Added RESCUE_TOKEN path constant for navigation

Notable Implementation Details

  • Uses Turnkey's passkey authentication for secure transaction signing
  • Implements a workaround for signTypedData by routing through raw sign (consistent with existing useUser.safeAA pattern)
  • Includes user-friendly error messages and success toasts with Etherscan links
  • Validates sufficient ETH balance before allowing rescue attempt
  • Properly handles edge cases like zero USDC balance and gas estimation failures

https://claude.ai/code/session_01U9boKN8kBrUytLY72BfSbB

Adds a /rescue-token screen that lets users move USDC accidentally
sent to their Turnkey signer address (user.walletAddress) into their
Safe (user.safeAddress) on Ethereum, signed via the existing passkey
flow. Displays the stuck balance, destination Safe address, and the
ETH gas required with an info tooltip explaining users can reach out
to the Solid team if they can't cover gas.

https://claude.ai/code/session_01U9boKN8kBrUytLY72BfSbB
@vercel
Copy link
Copy Markdown

vercel Bot commented May 28, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

2 Skipped Deployments
Project Deployment Actions Updated (UTC)
solid-app Ignored Ignored Preview May 28, 2026 8:13am
solid-app-staging Ignored Ignored Preview May 28, 2026 8:13am

Request Review

Adds a RESCUE_TOKEN transaction type (incoming wallet transfer) and
wires useRescueToken through createActivity/updateActivity so the
recovery shows up in the activity feed: PENDING when the user signs,
PROCESSING once the tx hash is broadcast (with Etherscan link), then
SUCCESS or FAILED based on the receipt.

https://claude.ai/code/session_01U9boKN8kBrUytLY72BfSbB
@MusabShakeel576 MusabShakeel576 merged commit 4ec6838 into master May 28, 2026
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants