Skip to content

feat(rewards): display PULSE token balance and enable on-chain reward claiming (closes #208) - #220

Open
rupesh-kumar-sah wants to merge 2 commits into
SPulse-Org:mainfrom
rupesh-kumar-sah:feat/issue-208-pulse-rewards
Open

rupesh-kumar-sah wants to merge 2 commits into
SPulse-Org:mainfrom
rupesh-kumar-sah:feat/issue-208-pulse-rewards

Conversation

@rupesh-kumar-sah

Copy link
Copy Markdown

Description

This PR resolves #208 by integrating on-chain PULSE token balance queries and enabling users to claim pending rewards directly from the connected wallet interface.

Changes

  • Contract Configuration (frontend/contracts.json):
    • Extracted contract deployment addresses into frontend/contracts.json (token, leaderboard, referral, market), removing hardcoded inline addresses.
  • Soroban Token & Reward Service (frontend/soroban.js):
    • Implemented getContracts(): dynamically loads contract mappings from contracts.json with robust fallback defaults.
    • Implemented formatTokenAmount(stroops, decimals): formats BigInt stroops into human-readable strings according to contract token decimals.
    • Implemented getPulseWalletData(address): executes read-only contract simulations to fetch token metadata (decimals, symbol), token balance (balance), and queued rewards (get_pending_reward).
    • Implemented claimPendingRewards({ address, signTransaction, onStatus }): builds, simulates, signs, and submits claim_pending_rewards transaction to the Leaderboard contract on Stellar Testnet.
  • Wallet Integration & UI (frontend/wallet.js, frontend/index.html):
    • Displays user's PULSE token balance alongside XLM in the wallet panel.
    • Surfaced an interactive Claim rewards button when pending rewards exist, providing real-time status feedback during simulation, signing, submission, and confirmation.
  • Automated Verification (tests/pulse-rewards.test.mjs):
    • Added unit test suite validating token decimal formatting, contract address patterns, and dynamic configuration loading.
    • Integrated into .github/workflows/ci.yml.

Verification

  • node scripts/validate-frontend.mjs: Passed (3 HTML pages, 10 JS files validated)
  • find frontend -type f -name '*.js' -print0 | xargs -0 -n1 node --check: Passed with 0 errors
  • node --test tests/pulse-rewards.test.mjs: All 3 tests passed 100%

Closes #208.

Muyideen-js and others added 2 commits September 12, 2026 14:50
…e-211-vendor-sdk-csp

fix(security): vendor stellar-sdk and freighter-api with strict CSP (closes SPulse-Org#211)
@vercel

vercel Bot commented Sep 17, 2026

Copy link
Copy Markdown

@rupesh-kumar-sah is attempting to deploy a commit to the Muyideen-jsx's projects Team on Vercel.

A member of the Team first needs to authorize it.

@netlify

netlify Bot commented Sep 17, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for stellar-pulse ready!

Name Link
🔨 Latest commit 515c53b
🔍 Latest deploy log https://app.netlify.com/projects/stellar-pulse/deploys/6aab9c9628d45c000860a908
😎 Deploy Preview https://deploy-preview-220--stellar-pulse.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PULSE token balances and reward claiming are invisible in the app

2 participants