Repository navigation
feat(kyc): KYC tier indicator and upgrade prompt on investor profile (#475) - #487
Merged
TS-mfon merged 1 commit intoOct 18, 2026
Merged
Conversation
…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
|
@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! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_tiercontract for the connected wallet.Changes
lib/kycTier.ts) — Basic / Verified / Accredited with metadata and default per-invoice + cumulative caps, pluscalculateKycTierUsage()andisKycUpgradeRecommended()(80% threshold, never fires for uncapped/accredited tiers).lib/api/index.ts,hooks/useKycTier.ts) —fetchKycTierStatus(address)reads the indexedkyc_tiercontract; the query is keyed by wallet address so reconnecting a different wallet fetches that wallet's tier.components/dashboard/UserProfile.tsx) —KycTierBadgewith the correct tier name and icon beside the wallet address.components/investor/KycTierPanel.tsx+KycTierLimits.tsx) — progress bars for per-invoice and cumulative used/remaining, with loading, disconnected, and error states.components/investor/KycUpgradePrompt.tsx) — warning banner at ≥80% cumulative usage, CTA links to/kyc/upgrade.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
Testing
New coverage (28 tests):
lib/__tests__/kycTier.test.ts— tier ordering, usage maths, clamping, uncapped tiers, exact 80% thresholdhooks/__tests__/useKycTier.test.tsx— connected read, disconnected no-fetch, refresh on wallet reconnectcomponents/investor/__tests__/KycTierBadge.test.tsx— each tier label +data-tiercomponents/investor/__tests__/KycTierLimits.test.tsx— used/remaining/percent and uncapped renderingcomponents/investor/__tests__/KycUpgradePrompt.test.tsx— threshold behaviour and CTA hrefcomponents/investor/__tests__/KycTierPanel.test.tsx— connected/disconnected/loading/error statescomponents/investor/__tests__/KycTierUpgrade.test.tsx— available upgrades and highest-tier messageTargeted run:
npx vitest run lib/__tests__/kycTier.test.ts hooks/__tests__/useKycTier.test.tsx components/investor/__tests__→ 28 passed.Closes #475