This demo showcases how users can deposit tokens on any supported chain and spend them on any other supported chain, all with a single account address. For this demo we deposits on Arb and make intent on base.
- Frontend: Next.js 15 with TypeScript
- Wallet Connection: Reown AppKit with Wagmi
- Cross-Chain: Rhinestone SDK
- UI Components: shadcn/ui with Tailwind CSS
- Supported Chains: Ethereum, Arbitrum, Base, Polygon, Optimism
- Reown Project ID: Get one from Reown Dashboard
- Rhinestone API Key: Contact Rhinestone team for access
- Node.js: Version 18 or higher
- Clone the repository:
git clone <your-repo-url>
cd global-wallet-demo
- Install dependencies:
npm install
- Set up environment variables:
cp env.example .env.local
Edit .env.local
with your actual values:
NEXT_PUBLIC_PROJECT_ID=your_reown_project_id_here
NEXT_PUBLIC_RHINESTONE_API_KEY=your_rhinestone_api_key_here
- Run the development server:
npm run dev
- Open http://localhost:3000 in your browser.
- Create Account: Generate a Rhinestone account (works across all chains)
- User Deposits: User sends tokens to the account on any chain
- Cross-Chain Spending: Spend those tokens on any other chain
// User deposits 10 USDC to global wallet address on Arbitrum
// Later, user wants to send 5 USDC to someone on Base
const transaction = await rhinestoneAccount.sendTransaction({
sourceChains: [arbitrum], // Look for tokens on Arbitrum
targetChain: base, // Execute transaction on Base
calls: [
/* USDC transfer on Base */
],
tokenRequests: [{ address: usdcOnBase, amount: 5000000n }],
});
// Rhinestone automatically:
// 1. Uses USDC from Arbitrum
// 2. Bridges it to Base
// 3. Executes the transfer
// All in a single transaction!