coinsRewards Widget

Embed the Pye Widget on your validator website so users can forward-sell future staking rewards. Supports React (Vite), Next.js, and plain HTML via CDN.


Integrating the Rewards Widget

The Rewards Widget lets stakers delegated to your validator sell their future rewards for SOL, directly from your site. You keep the delegation. They get paid up front. This guide covers the three supported integration paths: React, Next.js, and a plain HTML/CDN drop-in.

Prerequisites

You'll need four values before you start:

Value
What it is

Vote Account

Your validator's vote account address

An RPC endpoint

The public Solana endpoint works for development but recommend a dedicated endpoint for production

Supabase URL

Request access

Supabase Anon Key

Request access

Finding your vote account address

Your vote account is the on-chain address that receives staking rewards. It's not your identity account or withdraw authority. Using the wrong one will cause the widget to show no stake positions.

Where you can find it:

Configuration

Two things to configure before you drop the widget in: which mode it runs in, and which theme it uses.

Mode. Single-validator mode filters stake positions to only those delegated to your vote account. That's what you want on your own site. Universal mode shows positions across all supported validators. Use it by omitting the vote account.

Mode
What it shows
How to configure

Single-validator

Only stake accounts delegated to your validator

Pass voteAccount

Universal

All Pye-compatible stake accounts for the connected wallet

Omit voteAccount

Theme. The widget ships with pye-dark. Pass it as the theme prop (React and Next.js) or the data-theme attribute (CDN).

Value
Appearance

pye-light

Light background, purple accent

pye-dark

Dark background, purple accent

graphite

Dark background, neutral grey accent

Installation

1. Install packages

bash

Or with pnpm:

bash

Notebuffer, stream-browserify, and assert are runtime polyfills required by Solana packages in a browser Vite build.

2. Configure Vite

Update vite.config.ts to polyfill the Node.js globals that Solana packages depend on:

typescript

3. Add the Buffer polyfill

Warning — These two lines must be the very first lines of your app entry file (e.g. src/main.tsx), before any other imports. If they run after Solana packages load, the polyfill won't take effect.

4. Set environment variables

Create .env.local:

bash

5. Render the widget

Universal mode — Omit the voteAccount prop and the VITE_VOTE_ACCOUNT env variable.

RPC endpoint

circle-info

Important — The public endpoint (https://api.mainnet-beta.solana.com) works for development but has rate limits that will cause wallet and balance fetches to fail under normal production usage. Use a dedicated provider in production.

Recommended providers:

Last updated