Try it out
Try out an interactive demo of our Earn Widget on our showcase page.
Customize
Customize your Earn Widget with our interactive wizard in the partner portal.
Overview
TheEarnWidget component is a self-contained package that:
- Handles wallet connections and authentication
- Fetches and displays available earning opportunities
- Manages transaction flows for deposits
- Provides a customizable UI that matches your brand
- Third provider agnostic, you can use it with any provider you want (more on that later).
Installation
Required Setup
TheEarnWidget depends on the following:
- An EVM library provider - For blockchain interactions
- A wallet connection provider - For wallet management
- An adapter - To connect the widget with your providers
Don’t have these providers? We recommend using
@turtleclub/earn-provider which provides everything you need out of the box. Check the Required Setup section below.How it Works
- The
EarnWidgetcomponent renders based on your chosen configuration and adapter - Users connect their wallet through your adapter’s
openConnectionModalmethod - The widget fetches pre-filtered Turtle Earn opportunities based on your unique distributor ID
- Users can browse and select opportunities to deposit into
- Transactions are handled through your adapter’s
sendTransactionmethod - The widget manages all UI states: loading, errors, and success states
Basic Usage
Here’s a simple example showing how to implement theEarnWidget with a custom adapter:
MyEarnWidget.tsx
Required Setup Section
If you don’t have the required providers already configured in your application, we recommend using@turtleclub/earn-provider which provides everything you need:
Earn Provider
The easiest way to implement the required providers for the Earn Widget
Types
EarnWidgetProps Interface
widget-props.ts
Adapter Interface
adapter.ts
WidgetStyleConfig Interface
style-config.ts
Advanced Usage
Custom Adapter Implementation
If you’re not using Wagmi or our default provider, you can implement your own adapter:custom-adapter.tsx
Migration from Previous Version
If you’re migrating from the oldEarnPage component:
- Package Change: Install
@turtleclub/earn-widgetinstead of@turtleclub/react - Component Name: Use
EarnWidgetinstead ofEarnPage - Props Structure:
- Replace individual props with
configandadapterobjects referralis nowdistributorId- Remove
headerprop (useconfig.logoinstead)
- Replace individual props with
- Adapter Pattern: Instead of spreading adapter props, pass the adapter object directly

