Skip to content

feat(kyc): KYC tier indicator and upgrade prompt on investor profile (#475) - #487

Merged
TS-mfon merged 1 commit into
StellarState:devfrom
solomonadzape95:feature/475-kyc-tier-indicator
Oct 18, 2026
Merged

TS-mfon merged 1 commit into
StellarState:devfrom
solomonadzape95:feature/475-kyc-tier-indicator

Conversation

@solomonadzape95

Copy link
Copy Markdown
Contributor

Summary

Implements #475 — the investor profile now shows their KYC tier with per-invoice and cumulative limit usage, and surfaces a contextual upgrade prompt once cumulative usage reaches 80% of the tier cap. Tier data is read from the on-chain kyc_tier contract for the connected wallet.

Changes

  • Tier model (lib/kycTier.ts) — Basic / Verified / Accredited with metadata and default per-invoice + cumulative caps, plus calculateKycTierUsage() and isKycUpgradeRecommended() (80% threshold, never fires for uncapped/accredited tiers).
  • On-chain read (lib/api/index.ts, hooks/useKycTier.ts) — fetchKycTierStatus(address) reads the indexed kyc_tier contract; the query is keyed by wallet address so reconnecting a different wallet fetches that wallet's tier.
  • Profile header (components/dashboard/UserProfile.tsx) — KycTierBadge with the correct tier name and icon beside the wallet address.
  • Limits panel (components/investor/KycTierPanel.tsx + KycTierLimits.tsx) — progress bars for per-invoice and cumulative used/remaining, with loading, disconnected, and error states.
  • Upgrade prompt (components/investor/KycUpgradePrompt.tsx) — warning banner at ≥80% cumulative usage, CTA links to /kyc/upgrade.
  • Upgrade flow (app/kyc/upgrade/page.tsx, components/investor/KycTierUpgrade.tsx) — shows the current tier and the tiers above it with their requirements/caps, handing off to the KYC onboarding flow.

Acceptance criteria

  • KYC tier badge displays correct tier and icon
  • Limit progress bars reflect accurate used and remaining amounts
  • Upgrade banner appears correctly at 80% threshold
  • Upgrade CTA navigates to correct upgrade flow
  • Tier data updates correctly after wallet reconnect

Testing

New coverage (28 tests):

  • lib/__tests__/kycTier.test.ts — tier ordering, usage maths, clamping, uncapped tiers, exact 80% threshold
  • hooks/__tests__/useKycTier.test.tsx — connected read, disconnected no-fetch, refresh on wallet reconnect
  • components/investor/__tests__/KycTierBadge.test.tsx — each tier label + data-tier
  • components/investor/__tests__/KycTierLimits.test.tsx — used/remaining/percent and uncapped rendering
  • components/investor/__tests__/KycUpgradePrompt.test.tsx — threshold behaviour and CTA href
  • components/investor/__tests__/KycTierPanel.test.tsx — connected/disconnected/loading/error states
  • components/investor/__tests__/KycTierUpgrade.test.tsx — available upgrades and highest-tier message

Targeted run: npx vitest run lib/__tests__/kycTier.test.ts hooks/__tests__/useKycTier.test.tsx components/investor/__tests__ → 28 passed.

Note: this branches from dev, which already has pre-existing failing tests/build errors unrelated to this change. Full suite goes from 174 → 174 failing with the 28 new tests passing (no new failures).

Closes #475

…ile (StellarState#475)

- Add Basic/Verified/Accredited tier model with per-invoice and cumulative limits (lib/kycTier.ts)
- Read tier + usage from the on-chain kyc_tier contract via useKycTier/fetchKycTierStatus, keyed by wallet address
- Show KycTierBadge in the profile header and a KycTierPanel with limit progress bars
- Surface an upgrade prompt at 80% cumulative usage linking to the new /kyc/upgrade flow
- Cover tier maths, wallet-reconnect refresh, badge/limits/prompt states and the upgrade flow with tests
@drips-wave

drips-wave Bot commented Oct 18, 2026

Copy link
Copy Markdown

@solomonadzape95 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@TS-mfon
TS-mfon merged commit 1d6099f into StellarState:dev Oct 18, 2026
1 check failed
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.

Add KYC tier indicator and upgrade prompt to investor profile

2 participants