Advanced Integration
A complete demo application showcasing the integration of OpenOcean Widget with wallet connectivity using Wagmi and RainbowKit.
Getting Started
Install Dependencies
Install the required packages for this demo:
Using npm
npm install @openocean.finance/widget wagmi @tanstack/react-query @rainbow-me/rainbowkit react react-domUsing yarn
yarn add @openocean.finance/widget wagmi @tanstack/react-query @rainbow-me/rainbowkit react react-domUsing pnpm
pnpm add @openocean.finance/widget wagmi @tanstack/react-query @rainbow-me/rainbowkit react react-domKey Dependencies
OpenOcean Widget - The main widget component for token swapping
Wagmi - Type-safe, extensible, and modular library for building Ethereum apps
RainbowKit - React library for wallet connection UI
TanStack Query - Async state manager for requests and caching
Project Structure
This demo consists of a single file implementation:
Complete Example
The entire application is implemented in a single main.tsx file:
Features
This demo includes:
Wallet Integration: Seamless wallet connection using RainbowKit
OpenOcean Widget: Full-featured token swapping widget
Custom Theme: Dark theme with custom styling
Responsive Design: Mobile-friendly interface
Single File Architecture: Everything in one
main.tsxfile for easy deployment
Running the Demo
Install dependencies:
Start the development server:
Open your browser and navigate to the local development URL
Configuration
The widget is configured with:
Variant: Compact layout
Appearance: Dark theme
Subvariant: Split view
Chains: Ethereum mainnet
Wallet Integration: RainbowKit modal
Customization
You can customize the widget by modifying the widgetConfig object in the main.tsx file. Key customization options include:
Theme colors and styling
Supported chains
Default tokens
Widget appearance and layout
Last updated