111 Commits

Author SHA1 Message Date
pezkuwichain 672682558f chore: migrate git dependencies to Gitea mirror (git.pezkuwichain.io) 2026-04-21 18:52:54 +03:00
pezkuwichain e3beba7538 fix: correct KycLevel enum map and restrict founder bypass
1. Fixed enum map missing NotStarted at index 0, causing all status
   indices to be off by one (ReferrerApproved decoded as PendingReferral)
2. Restricted founder bypass to only show applications with no referrer,
   not all applications regardless of referrer
2026-03-01 22:08:40 +03:00
pezkuwichain a8505a4d50 fix: use dynamic SS58 prefix in referral/KYC address encoding
Replace hardcoded SS58 prefix 42 with api.registry.chainSS58 ?? 42
for robustness in getPendingApprovalsForReferrer, getReferralInfo,
and getMyReferrals functions.
2026-02-28 01:59:04 +03:00
pezkuwichain fd57a75fd9 fix: handle all kycStatus formats in pending approvals check
toJSON() for Substrate enums can return string, object ({"approved":null}),
or number (enum index). Previous code assumed string only, causing already
approved applications to appear as pending.
2026-02-27 04:14:35 +03:00
pezkuwichain abdb67f6ca fix: convert hex AccountId to SS58 in referral/KYC queries
toJSON() returns hex format for AccountId fields but comparison was
against SS58 addresses, causing referrer matching to always fail.
- citizenship-workflow: encodeAddress for referrer in getPendingApprovals
- citizenship-workflow: handle both PascalCase and camelCase KycStatus
- referral: encodeAddress for referrer in getMyReferrals and getReferralInfo
2026-02-27 03:57:36 +03:00
pezkuwichain 8232cdb0e1 fix: extract actual error from process-withdraw edge function response
Supabase JS client wraps non-2xx responses as generic FunctionsHttpError
("Edge Function returned a non-2xx status code"), hiding the real error.
Now reads the response body to show the actual error message.

Also adds migration to drop auth.users FK on p2p_withdrawal_limits
(already absent in production, added for migration completeness).
2026-02-24 23:01:50 +03:00
pezkuwichain 87b081fa60 update: upgrade @pezkuwi/api to 16.5.36, clean up images and assets
- Upgrade @pezkuwi/api 16.5.11 -> 16.5.36 in supabase edge functions
- Remove manual SS58-to-hex workaround, use native SS58 addresses
- Add kurdistan flag and Dijital Kurdistan images
- Add PezkuwiExplorer to web public assets
- Remove unused react-logo and telegram_welcome images
- Add *.bak to gitignore
2026-02-24 10:28:47 +03:00
pezkuwichain 607ef72948 fix: payment proof lifecycle, repeating toast, and escrow migrations
- Replace IPFS/Pinata upload with Supabase Storage for payment proofs
- Add 1-day auto-expiry for proof images (retained if disputed)
- Fix repeating "payment deadline expired" toast (fire once, clear interval)
- Fix cancel_reason → cancellation_reason column reference
- Add payment proof lifecycle migration (proof_expires_at, cleanup functions)
- Add atomic escrow migration (accept_p2p_offer, complete/cancel trade)
- Add cleanup-proofs edge function for daily expired proof deletion
2026-02-24 06:15:22 +03:00
pezkuwichain d380e6a3cd fix: correct cancel_reason column name to cancellation_reason
Also add migration to drop remaining auth.users FK constraints
on p2p_messages, notifications, ratings, audit_log tables.
2026-02-24 05:34:42 +03:00
pezkuwichain 0a9349f2b3 fix: show actual Supabase error details in P2P toast messages
PostgrestError is not instanceof Error, so catch blocks were falling
through to generic messages. Now extracts .message and .details from
Supabase errors for better debugging.
2026-02-24 05:00:45 +03:00
pezkuwichain 56adb45b07 fix: remove price_per_unit from offer insert (generated column) 2026-02-23 22:36:15 +03:00
pezkuwichain b839a1834d fix: withdrawal calls process-withdraw edge function, balance card UI improvements
- requestWithdraw() now calls process-withdraw edge function instead of
  just locking balance in DB. This triggers the full flow: lock balance,
  send blockchain TX, complete withdrawal.
- Balance card: numbers right-aligned, 2 decimal places instead of 4
- Added public SELECT RLS policy on payment_methods table (was blocking
  anon users from loading payment method dropdown)
2026-02-23 22:19:06 +03:00
pezkuwichain a80a2cfb07 feat: replace supabase auth with citizen/visa identity system for P2P
Replace all supabase.auth.getUser() calls with P2PIdentityContext that
resolves identity from on-chain citizen NFT or off-chain visa system.

- Add identityToUUID() in shared/lib/identity.ts (UUID v5 from citizen/visa number)
- Add P2PIdentityContext with citizen NFT detection and visa fallback
- Add p2p_visa migration for off-chain visa issuance
- Refactor p2p-fiat.ts: all functions now accept userId parameter
- Fix all P2P components to use useP2PIdentity() instead of useAuth()
- Update verify-deposit edge function: walletToUUID -> identityToUUID
- Add P2PLayout with identity gate (wallet/citizen/visa checks)
- Wrap all P2P routes with P2PLayout in App.tsx
2026-02-23 19:54:57 +03:00
pezkuwichain 80d8bbbcb1 fix: universal getSigner helper for WalletConnect + extension signing
Replace all web3FromAddress calls with getSigner() that auto-detects
walletSource and uses WC signer or extension signer accordingly.
This fixes all signing operations when connected via WalletConnect.
2026-02-23 07:01:18 +03:00
pezkuwichain bcee7c2a7d fix: mobile UI improvements and web3Enable for WalletConnect signing
- Compact stat cards on mobile (Dashboard, Referral, P2P)
- Hide unnecessary sections on mobile (Recent Activity, NFTs, Score Calculation, Liquidity Pools, Recent Swaps)
- Fix back arrow overlapping title on all pages
- Swap Settings and Governance nav positions for better mobile dropdown
- Add back arrow to Presale page
- Add web3Enable before all web3FromAddress calls for WalletConnect compatibility
- Fix citizenship authentication signing with WalletConnect
2026-02-23 06:22:12 +03:00
pezkuwichain e4abee939f feat: migrate staking from Relay Chain to Asset Hub
- shared/staking.ts: update for AH (remove babe dep, remove validatorPool, bonding 2 eras)
- StakingDashboard: switch all staking operations from api (RC) to assetHubApi (AH)
2026-02-21 02:55:27 +03:00
pezkuwichain 6ac55ecf88 fix: citizenship pending approvals not showing for founder
Application struct has no status field - was filtering by
appData.status === 'PendingReferral' which always returned false.
Now checks kycStatuses storage instead, and allows founder to see
all pending applications.
2026-02-20 00:44:05 +03:00
pezkuwichain 64caf56612 fix: compute staking score from CachedStakingDetails instead of hardcoded 0 2026-02-17 02:38:46 +03:00
pezkuwichain b7d7d008dc feat: staking score 3-state model and noter integration 2026-02-17 01:32:54 +03:00
pezkuwichain ce35392d67 fix: update admin wallet whitelist with correct addresses 2026-02-17 00:25:51 +03:00
pezkuwichain 86dc8c1fcd fix: rewrite citizenship workflow to referral-based model
- Replace governance-based KYC with trustless referral workflow
- New 3-step flow: applyForCitizenship -> approveReferral -> confirmCitizenship
- Fix FOUNDER_ADDRESS (was Alice test address)
- Use applications storage instead of legacy pendingKycApplications
- Add approveReferral, cancelApplication, confirmCitizenship functions
- Rewrite KycApprovalTab as referrer approval panel (no governance)
- Fix InviteUserModal to use peopleApi for referral pallet
- Add pending approvals section to ReferralDashboard
2026-02-16 02:56:27 +03:00
pezkuwichain da2fed7f1e Add telegram welcome image 2026-02-14 08:35:30 +03:00
pezkuwichain 82ba29c1b0 fix(scores): use correct PezRewards storage query names from live chain metadata
Storage names were wrong (from integration test dev node, not live chain):
- getCurrentEpochInfo → epochInfo
- getUserTrustScoreForEpoch → userEpochScores
- getClaimedReward → claimedRewards
- getEpochRewardPool → epochRewardPools
2026-02-13 20:44:40 +03:00
pezkuwichain f3450d1207 feat: align frontend scoring with People Chain pallet queries
- Update staking score/tracking calls from relayApi to peopleApi
- Fix referral score to use on-chain tiered scoring with penalties
- Fix perwerde score to query studentCourses + enrollments storage
- Update Dashboard and StakingDashboard for People Chain API
2026-02-13 20:13:55 +03:00
pezkuwichain 9963a759d3 fix: fix Zagros endpoints, hide PEZ Rewards when pallet unavailable
- Remove Asset Hub and People Chain endpoints from Zagros/Development config (relay chain only)
- Default network now always mainnet
- PEZ Rewards card only renders when pallet is available on chain
- Dynamic grid layout when PEZ Rewards card is hidden
2026-02-13 18:11:24 +03:00
pezkuwichain 6fe061cef2 feat(pez-rewards): align frontend with blockchain pallet storage queries
- Fix storage query names: getCurrentEpochInfo, epochStatus, getUserTrustScoreForEpoch, getClaimedReward, getEpochRewardPool
- Add recordTrustScore() and claimPezReward() extrinsic functions
- Add EpochStatus type and epoch status display (Open/ClaimPeriod/Closed)
- Move PezRewardInfo and getPezRewards from staking.ts to scores.ts
- Add PEZ Rewards error/success messages to error-handler.ts
- Add PEZ Rewards card with Record/Claim to Dashboard, Wallet, and Staking pages
- Add recordTrustScore to TransactionHistory tracking
2026-02-13 17:37:10 +03:00
pezkuwichain b378aeb171 refactor(scores): remove frontend fallback, read all scores from blockchain
Remove all frontend staking/trust score calculation and localStorage
fallback code. All scores now read directly from People Chain pallets
(pezpallet-trust, pezpallet-referral, pezpallet-tiki). Trust pallet
computes composite score on-chain.
2026-02-13 03:14:57 +03:00
pezkuwichain fc0907f8ac fix(tiki): fetch roleNFTs from blockchain instead of returning empty array
- getAllTikiNFTDetails now calls fetchUserTikiNFTs to query UserTikis storage
- This enables proper authorization check for government roles like Serok
2026-02-10 22:56:22 +03:00
pezkuwichain fbbb0486eb fix: remove unused variables (lint errors) 2026-02-10 18:14:33 +03:00
pezkuwichain e12d08d356 fix: use getAllScoresWithFallback in Dashboard.tsx
Both AccountBalance.tsx and Dashboard.tsx now use the same
frontend fallback for trust score calculation until runtime upgrade.
2026-02-07 01:48:06 +03:00
pezkuwichain e787eaac15 debug: add console logs for trust score calculation 2026-02-07 01:39:11 +03:00
pezkuwichain 598c9f2fec fix: use frontend fallback for trust score calculation
On-chain trust pallet exists but StakingInfoProvider returns None,
causing trust score to be 0 even when user has stake. Use frontend
calculation until runtime upgrade is deployed.
2026-02-07 01:25:05 +03:00
pezkuwichain 90b8204c25 feat: add frontend fallback for staking and trust scores
Until runtime upgrade is deployed, calculate scores on frontend:

shared/lib/scores.ts:
- getFrontendStakingScore: Read stake from Relay Chain, track in localStorage
- getFrontendTrustScore: Calculate using pallet formula
- getAllScoresWithFallback: Combined score fetching with fallback

Formula (matching pezpallet-trust):
- weighted_sum = staking*100 + referral*300 + perwerde*300 + tiki*300
- trust_score = (staking * weighted_sum) / 100

Components updated:
- AccountBalance.tsx: Use getAllScoresWithFallback
- HeroSection.tsx: Use getTrustScoreWithFallback
2026-02-07 00:44:04 +03:00
pezkuwichain f93681ed96 fix: formatBalance now correctly parses hex values from blockchain 2026-02-06 22:14:56 +03:00
pezkuwichain 13646d6e8c fix: support both sonner and shadcn toast APIs in error handler 2026-02-06 21:42:27 +03:00
pezkuwichain 6b26f434dd fix: query pezRewards and stakingScore from People Chain
- pezRewards pallet is on People Chain, not Relay Chain
- stakingScore pallet is also on People Chain
- Update getStakingInfo to accept optional peopleApi parameter
- Update StakingDashboard to pass peopleApi
2026-02-06 21:28:56 +03:00
pezkuwichain 61eb5cff20 fix: update score system to use correct People Chain APIs
- Remove LP staking score (not available in blockchain)
- All scores now fetched from People Chain
- Add Start Score Tracking button to Dashboard
- Add staking status display showing tracking duration
2026-02-06 20:48:27 +03:00
pezkuwichain b0c3626e7a feat: add LP staking score and DOT/ETH/BTC tokens 2026-02-06 20:01:12 +03:00
pezkuwichain 1f14cd475f fix: restore web3FromAddress for browser extension signing 2026-02-06 19:38:59 +03:00
pezkuwichain 9fd0805a97 fix: fetch scores from correct chains (People + Relay) 2026-02-06 19:33:42 +03:00
pezkuwichain 842dc9d8c2 feat: add HEZ/DOT pool support and fix user-facing token names
- Add HEZ/DOT pool to PoolDashboard
- Display DOT, ETH, BTC instead of wDOT, wETH, wBTC to users
- Update priceOracle with correct symbol mappings
- Fix lint errors in check_all_pools.mjs
- Extract MINTABLE_ASSETS to separate file for fast refresh
2026-02-06 11:06:28 +03:00
pezkuwichain 884d68714b feat: implement hybrid oracle AMM with CoinGecko prices
- Add priceOracle service for fetching CoinGecko prices
- Update SwapInterface to use oracle prices instead of pool reserves
- All swaps route through USDT as base currency
- Multi-hop routing for non-USDT pairs (X → USDT → Y)
- Display real-time USD prices from CoinGecko
- Auto-refresh prices every 30 seconds
2026-02-06 10:41:52 +03:00
pezkuwichain 800b956c91 feat: add wDOT, wETH, wBTC mint functionality to DEX admin panel 2026-02-06 10:10:52 +03:00
pezkuwichain 04e7eedd53 fix: update RPC endpoints to correct production URLs
- Relay Chain: wss://rpc.pezkuwichain.io
- Asset Hub: wss://asset-hub-rpc.pezkuwichain.io
- People Chain: wss://people-rpc.pezkuwichain.io
- Add Zagros testnet configuration
- Remove legacy staging/dev endpoints
- Fix port suffix in Edge Functions
2026-02-06 06:27:37 +03:00
pezkuwichain 3445eea8dd fix: add null checks for welati pallet in all governance functions 2026-02-06 06:17:26 +03:00
pezkuwichain 2800f52cfb fix: re-export NATIVE_TOKEN_ID from utils/dex.ts 2026-02-05 01:44:05 +03:00
pezkuwichain 51904c206c feat: add LP token support and display in wallet
- Add LP_TOKENS definition in shared/types/dex.ts
- Fetch LP token balances from poolAssets pallet
- Add HEZ-PEZ-LP and HEZ-USDT-LP to TokenBalances
- Add lp_token_512.png logo
2026-02-05 00:35:46 +03:00
pezkuwichain 7e3b2b6d86 fix: correct XCM location parsing for pool discovery
- Handle lowercase keys from chain (x2, generalIndex, here)
- Fix pool key args structure (tuple inside array)
- Native token now correctly identified as -1
2026-02-05 00:07:54 +03:00
pezkuwichain cd6da00ef8 fix: DEX improvements - Asset Hub balance fetching and Treasury admin support
- WalletContext: Use Asset Hub API for PEZ/wHEZ/wUSDT balance queries
- AddLiquidityModal: Handle native token balance via system.account
- auth.ts: Add Treasury accounts to admin list for pool creation and minting

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 23:27:36 +03:00
pezkuwichain 6d0437a3af fix: add DEVELOPMENT endpoint alias and change Total text to Toplam 2026-02-04 22:11:25 +03:00