=== Bounmee Wallet Leaderboard ===
Contributors: bounmee
Tags: polymarket, prediction markets, leaderboard, trading, wallets
Requires at least: 5.5
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 3.8.0
License: GPL-2.0+
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Embed a live Polymarket top-wallet leaderboard on any page. Top 10 by PNL, 30D/7D/24H toggle, category filters, 5-minute cache, two themes.

== Description ==

**Bounmee Wallet Leaderboard** fetches the top 10 Polymarket traders from the official Polymarket Data API and renders them in a clean, responsive widget using a single shortcode.

All API requests go through WordPress (admin-ajax.php), so there are no CORS issues and the browser never calls Polymarket directly. Each category and period is cached for 5 minutes on your server; if Polymarket is unreachable, the last good copy (up to 24 hours old) is shown with its time. The plugin never shows invented or demo wallets.

**Features:**

* Live top-10 leaderboard ranked by PNL
* **30D / 7D / 24H period toggle** — switch the ranking window on the widget, no page reload
* **Two themes** — White (default, clean light design) and Navy Blue (dark gradient background, full contrast adaptation)
* Category filters: All, Politics, Crypto, Sports, Culture, Tech, Finance, Macro
* Top wallet card: the #1 wallet's PNL, volume and PNL to volume ratio, share to X *(optional)*
* Side-by-side wallet compare tool with PNL, volume and PNL to volume ratio (not a win rate) *(optional)*
* Optional CopyTrade button per row linking to an external copy-trading service *(opt-in, off by default)*
* Server-side AJAX proxy — no CORS issues on any host
* 5-minute server cache: at most 24 upstream calls per 5 minutes, whatever your traffic
* System fonts only: no Google Fonts or other third-party requests in the browser
* Zero first-paint spinner — data seeded server-side on page load
* Mobile responsive: card layout on small screens, table on desktop
* Fully theme-isolated CSS — scoped under a unique ID, immune to theme interference in both directions
* No external JavaScript dependencies — pure vanilla JS, no jQuery required

**Shortcode:**

`[polymarket_leaderboard]`

Optional default category:

`[polymarket_leaderboard category="CRYPTO"]`

Valid values: `OVERALL` `POLITICS` `SPORTS` `CRYPTO` `CULTURE` `ECONOMICS` `TECH` `FINANCE`

== Installation ==

1. Upload the `bounmee-wallet-leaderboard` folder to `/wp-content/plugins/`, or install via **Plugins → Add New → Upload Plugin**.
2. Activate the plugin via **Plugins → Installed Plugins**.
3. Add `[polymarket_leaderboard]` to any page or post.
4. Visit **Settings → Polymarket LB** to choose your theme, enable optional features.

== Frequently Asked Questions ==

= Does this plugin slow down my site? =

No. Scripts and API calls only run on pages where `[polymarket_leaderboard]` is placed. Nothing is injected globally.

= What happens if the Polymarket API is down? =

The widget keeps showing the last real data it received, labelled with its time, or says live data is unavailable. It never shows demo wallets. Clicking Refresh or switching a filter retries.

= Can I set a default category? =

Yes. Use `[polymarket_leaderboard category="POLITICS"]` to pre-select a category on load. Valid values: OVERALL, POLITICS, SPORTS, CRYPTO, CULTURE, ECONOMICS, TECH, FINANCE.

= Does it work with page caching plugins? =

Yes. The initial seed data is rendered server-side and AJAX calls happen client-side after page load, so full-page caching is fully compatible. The Refresh button and period toggle go through the plugin's proxy, which serves data at most 5 minutes old.

= Will the widget break my theme's styles? =

No. All widget CSS is scoped under a unique ID with high specificity. It cannot affect your theme, and your theme cannot override the widget styles.

= What is the CopyTrade button? =

An optional button that appears on each leaderboard row when enabled in Settings. It links to an external copy-trading service of your choice and is marked rel="sponsored nofollow". Disabled by default — you must consciously enable it and set your URL in Settings. This is an affiliate/referral feature — full disclosure is shown in the setup panel per WP.org guideline 10.

= What is the 30D / 7D toggle? =

A pill toggle in the widget controls bar that switches the leaderboard between 30-day (MONTH) and 7-day (WEEK) best wallets by calling the Polymarket API with the corresponding `timePeriod` parameter. The leaderboard, mobile cards, Wallet of the Day, and compare tool all update accordingly.

= How do I change the theme? =

Go to **Settings → Polymarket LB** and choose White or Navy Blue under Widget Theme. Save — the change applies immediately to all shortcode instances.

= What data does this plugin collect? =

None. The plugin only fetches public data from the Polymarket API. No visitor data is collected or transmitted.

== External Services ==

This plugin connects to the **Polymarket Data API** to retrieve public leaderboard data.

* **Service:** Polymarket Data API
* **Endpoint:** `https://data-api.polymarket.com/v1/leaderboard`
* **When it is called:** From your server only, at most once per category and period every 5 minutes, when a page with `[polymarket_leaderboard]` is viewed or a visitor changes filter, period or refreshes
* **Data sent:** Query parameters only — leaderboard category, time period (MONTH, WEEK or DAY), result limit, and sort order. No user data of any kind is transmitted.
* **Data received:** Public on-chain wallet rankings including rank, wallet address, username (if set), PNL, volume, profile image URL, and X username (if set). All data is public on-chain information.
* **Polymarket Terms of Service:** https://polymarket.com/tos
* **Polymarket Privacy Policy:** https://polymarket.com/privacy-policy

No other external service is used: the widget uses system fonts and loads no third-party scripts.

== Privacy Policy ==

This plugin does not collect, store, or transmit any personal data about site visitors.

On page load and on user interactions (filter changes, period toggle, refresh), the plugin makes requests to the public Polymarket Data API. These requests contain only query parameters (category, time period, limit) — no user information is included.

No analytics, tracking pixels, or third-party beacons are included.

== Changelog ==

= 3.8.0 =
* New: 5-minute server cache per category and period; the last good copy (up to 24 hours) is served if Polymarket fails
* Fix: demo wallets removed; on failure the widget keeps the last real data with its time or says live data is unavailable
* Fix: the browser only calls the WordPress proxy, never the Polymarket API directly
* Fix: removed the "minimum 30 resolved trades and 60%+ win rate" note (no such filter exists) and the generated "why" badges and verdicts; the top wallet card shows numbers only
* Fix: "PNL/Vol" renamed "PNL to volume ratio" (it is not a win rate); title says "by PNL" instead of "Today"
* Fix: CopyTrade links use rel="sponsored nofollow noopener"
* Privacy: Google Fonts removed, system font stack
* Uninstall now also deletes the cache

= 3.7.1 =
* Fix: Tested up to WordPress 7.1 — no code changes required; the plugin's shortcode/AJAX-proxy/Settings-page architecture doesn't touch the areas 7.1 changed (Site Editor iframing, media library, Notes, comment-notification filter)
* Housekeeping: version bump only, for the WP.org "tested up to" freshness signal

= 3.7.0 =
* New: 24H period toggle now shows period-aware Wallet of the Day badge and subtitle
* Fix: Tested up to WordPress 7.0
* Fix: Minor CSS scoping improvements for theme compatibility

= 3.6.4 =
* New: 24H period toggle — adds a "🔥 24H" button alongside 30D and 7D, fetching `timePeriod=DAY` from the Polymarket API to surface wallets that are hot right now rather than long-term PNL leaders
* New: Period-aware badge copy — the #1 wallet why-badge shows "🔥 Hottest wallet right now" in 24H mode instead of the standard monthly/weekly label
* New: Subtitle label updates to "last 24-hour PNL" when 24H is active, consistent with 30D/7D behaviour
* Fix: PHP period whitelist now includes `DAY` so AJAX proxy correctly passes the new period to the Polymarket API

= 3.6.3 =
* Fix: `shortcode_atts` filter tag was `bounwale_leaderboard` instead of `polymarket_leaderboard` — caused `[polymarket_leaderboard]` shortcode to not work correctly on sites using shortcode attribute filters
* Fix: `wp_register_script/style` called with `false` as src (invalid) — changed to empty string `''`, the correct WordPress approach for inline-only asset handles
* Fix: Table loading row used `colspan="6"` on a 5-column table — corrected to `colspan="5"` (affected both the PHP seed markup and the JS loading state)
* Fix: `bounwale_maybe_redirect_setup` on `admin_init` now guards with `is_admin()` to prevent redirect loops on non-admin requests
* Fix: `admin_enqueue_scripts` hook check now uses exact match `settings_page_bounwale-leaderboard` instead of `strpos` — prevents accidental asset loading on unrelated admin pages; also fixes the `false`-src registers for admin handles
* Fix: `uninstall.php` was deleting `ttg_options` / `ttg_setup_redirect` (legacy keys from an old version) instead of `bounwale_options` / `bounwale_setup_redirect` — plugin options were never cleaned up on deletion
* Fix: readme.txt 3.6.1 changelog entry was self-contradictory (listed two conflicting rename targets); corrected to reflect final slug `bounmee-wallet-leaderboard`
* Fix: README.md Plugin URI pointed to old slug `prediction-market-wallet-leaderboard`; updated to `bounmee-wallet-leaderboard`

= 3.6.2 =
* Plugin officially renamed to "Bounmee Wallet Leaderboard"; slug `bounmee-wallet-leaderboard`
* Fix: Layout never scrolls horizontally — root container enforces `overflow-x:hidden`; table uses `table-layout:fixed` instead of fixed `min-width`
* Fix: Responsive breakpoints extended — new 900px, 360px breakpoints ensure widget fills its container cleanly at all screen sizes without breaking or overflowing
* Fix: Mobile card actions stack to single column on phones ≤480px for better tap targets
* Fix: Filter buttons, WOTD stats, and card padding tightened on very small screens (≤360px)

= 3.6.1 =
* Fix: Wallet of the Day "Share on X" button on mobile now correctly populated with wallet stats (was always `href="#"`)
* Fix: PHP category whitelist trimmed to match UI — removed unused `MENTIONS` and `WEATHER` values
* Plugin renamed to "Bounmee Wallet Leaderboard"; slug updated to `bounmee-wallet-leaderboard`

= 3.6.0 =
* Fix: All inline `<script>` and `<style>` tags replaced with proper WordPress enqueue API (`wp_register_script/style`, `wp_add_inline_script/style`) — required for WP.org compliance
* Fix: Admin JS registered under its own handle; admin assets hooked via `admin_enqueue_scripts` with page-scoped check

= 3.5.0 — 3.5.1 =
* Fix: Controls row (live dot + 30D/7D + Refresh) centred on both themes, desktop and mobile
* Fix: "Compare Any Two Wallets" heading centred on both themes

= 3.4.1 — 3.4.9 =
* Fix: Table row colour bleed eliminated; text sizes increased for readability
* Fix: 7D volume fallback chain (`vol → volume → tradedAmount → notional`)
* Fix: Share on X split into desktop and mobile copies, both updated by JS
* Fix: Navy Blue theme rendered as rounded card with padding and shadow
* Fix: Compare accordion alignment and text stacking on all themes

= 3.3.0 =
* New: White / Navy Blue theme selector in Settings
* New: 30D / 7D period toggle — switches `timePeriod` on the Polymarket API; all UI elements reflect the selected period
* Removed all transient and sessionStorage caching — always-live data
* Fixed: WCAG AA contrast on PNL green, rank badges, and wallet addresses in both themes

= 3.2.0 — 3.2.3 =
* Added first-run setup wizard and Settings page with opt-in feature controls
* All external links off by default (WP.org guideline 10)
* Full CSS isolation scoped under `#ttg-lb-root-wp`

= 3.0.0 — 3.1.0 =
* Initial release: server-side AJAX proxy, category filters, Wallet of the Day, compare tool, mobile card layout, demo data fallback
* Google Fonts loaded via `wp_enqueue_style`; `uninstall.php` added

== Upgrade Notice ==

= 3.8.0 =
Adds a 5-minute cache, removes demo data and Google Fonts, and makes every label factual. No shortcode or settings change.

= 3.7.1 =
Confirms compatibility with WordPress 7.1. No functional changes — safe to update.

= 3.7.0 =
Minor improvements to period-aware UI and CSS scoping. No breaking changes — existing shortcodes continue to work unchanged.

= 3.6.1 =
Fixes mobile "Share on X" button in Wallet of the Day, trims unused API categories, and renames the plugin. No breaking changes — existing shortcodes continue to work unchanged.

= 3.6.0 =
Replaces all inline script/style tags with proper WordPress enqueue API calls. Required for WP.org compliance. No breaking changes.

= 3.3.0 =
Adds White/Navy Blue theme selector, 30D/7D period toggle, and always-live data. Recommended upgrade for all users.
