Commit Graph

459 Commits

Author SHA1 Message Date
pezkuwichain 9ed9fd1a44 fix: withdrawal end-to-end flow and UI improvements
- requestWithdraw() calls process-withdraw edge function for full flow
  (lock balance + blockchain TX + complete) instead of just DB lock
- Remove pending request block from withdrawal validation — backend
  already enforces available_balance with FOR UPDATE row lock
- Pending requests shown as info alert instead of blocking error
- Balance card: numbers right-aligned, 2 decimal places
2026-02-23 22:32:58 +03:00
pezkuwichain a50979ad52 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 fa811dcfc7 fix: wait for block finalization in verify-deposit instead of failing
Replace hard fail on unfinalized blocks with a retry loop that polls
every 6 seconds up to 60 seconds. The TX is already fully verified via
events at this point — we just wait for GRANDPA finality before crediting.
2026-02-23 22:09:46 +03:00
pezkuwichain ee50666c64 fix: route P2P deposits and verification to Asset Hub instead of relay chain
DepositModal was building transactions via relay chain API, and all three
edge functions (verify-deposit, process-withdraw, process-withdrawal) had
RPC endpoints hardcoded or defaulting to the relay chain. This caused
deposit verification to fail with "Transaction not yet finalized" and
created a chain mismatch with the withdrawal system which operates on
Asset Hub.

- DepositModal: use assetHubApi instead of api for transfer TX
- verify-deposit: RPC_HTTP/RPC_WS default to asset-hub-rpc (env override)
- process-withdraw: RPC_ENDPOINT default to asset-hub-rpc (env override)
- process-withdrawal: RPC_ENDPOINT default to asset-hub-rpc
2026-02-23 21:50:57 +03:00
pezkuwichain 6d23668535 fix: update edge functions for wallet-based auth
- process-withdraw: replace auth.getUser() with userId from request body
- process-withdrawal: fix esm.sh imports to npm: style (@pezkuwi/api@16.5.11)
2026-02-23 20:09:36 +03:00
pezkuwichain 341b6f6644 fix: replace auth.uid() RLS policies with open access for wallet-based auth
All P2P table RLS policies used auth.uid() which returns NULL since users
authenticate via wallet, not Supabase Auth. Replace with open access policies.

Financial security maintained through SECURITY DEFINER RPC functions
(escrow lock/release/refund, process_deposit, request_withdraw).
2026-02-23 20:04:20 +03:00
pezkuwichain bb772668ba 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 350b65dec3 fix: resolve critical fast-xml-parser vulnerability and block deploy on audit
- Override fast-xml-parser to ^5.3.6 (fixes CVE-2026-25896, CVE-2026-26278, CVE-2026-25128)
- Add security-audit to deploy job dependencies in quality-gate workflow
2026-02-23 18:23:55 +03:00
pezkuwichain b9024cb034 fix: use direct fetch for verify-deposit to read error responses 2026-02-23 12:29:28 +03:00
pezkuwichain d7935e2c4f fix: suppress eslint any warnings in verify-deposit edge function 2026-02-23 12:18:56 +03:00
pezkuwichain dc24f18805 fix: verify-deposit blockchain verification and wallet-based auth
- Drop auth.users FK constraints for wallet-based authentication
- Fix deferrable unique constraint on blockchain_tx_hash (ON CONFLICT compat)
- Rewrite block search: HTTP RPC + blake2b instead of WS-only @pezkuwi/api
- Add blockNumber hint for faster verification of older transactions
- Normalize SS58/hex addresses via base58 for reliable comparison
- DepositModal captures approximate block number after tx submission
2026-02-23 12:16:15 +03:00
pezkuwichain f749618d3e fix: enforce security audit - remove continue-on-error 2026-02-23 10:19:49 +03:00
pezkuwichain 776c45bbd1 fix: remove web3Enable cache to prevent stale extension state 2026-02-23 09:57:14 +03:00
pezkuwichain ac18e1b98d fix: replace Supabase Auth with on-chain sender verification in verify-deposit
Removed JWT auth requirement from edge function. Now uses wallet address
from request body and verifies it matches the on-chain transaction sender.
This works with wallet-based auth instead of Supabase Auth.
2026-02-23 08:49:18 +03:00
pezkuwichain 35a911ae5f fix: suppress eslint any warning in get-signer 2026-02-23 08:31:07 +03:00
pezkuwichain 9863f11224 fix: cache web3Enable to prevent authorization flooding
Consolidated all web3Enable/web3FromAddress calls through getSigner helper.
Cached web3Enable promise so it only runs once per session.
2026-02-23 08:24:41 +03:00
pezkuwichain 3d1c1405e5 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 fc9a92f58c 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 b2282ab70c debug: add WalletConnect debug logging to diagnose timeout 2026-02-23 00:57:38 +03:00
pezkuwichain 9ea8ab0189 fix: resolve remaining mobile app lint warnings 2026-02-23 00:33:11 +03:00
pezkuwichain b38798bbd4 fix: resolve remaining lint warnings (console.log and missing deps) 2026-02-23 00:28:32 +03:00
pezkuwichain d8ff28175f fix: resolve all lint warnings in mobile and web apps 2026-02-23 00:24:17 +03:00
pezkuwichain 87dfc249aa fix: WalletConnect race conditions, session validation and timeout handling 2026-02-23 00:16:34 +03:00
pezkuwichain 73b5ebece6 fix: only init WalletConnect when a saved session exists 2026-02-22 22:31:52 +03:00
pezkuwichain 0f2ed1c14f fix: use deep link instead of QR on mobile, show extension only on desktop 2026-02-22 22:16:55 +03:00
pezkuwichain a5eea60858 fix: show only mobile wallet option on mobile devices 2026-02-22 21:40:17 +03:00
pezkuwichain ce8169eede feat: wallet modal with two connection options and Kurdistan flag for language switcher 2026-02-22 21:29:29 +03:00
pezkuwichain 2a84cdc344 feat: two-card wallet connection UI (extension + mobile) and update Chrome Web Store link 2026-02-22 20:47:41 +03:00
pezkuwichain 7b1944c830 feat: add WalletConnect i18n keys to all locale files 2026-02-22 20:04:18 +03:00
pezkuwichain db65f7996d fix: add browser to mainFields resolution to prevent crypto-browserify bundling
ws package has a browser field pointing to a crypto-free entry point.
Without 'browser' in mainFields, Vite resolved the Node.js version
which pulled in crypto-browserify -> inherits -> runtime error.
2026-02-22 19:48:03 +03:00
pezkuwichain e8efc4f1c8 fix: alias crypto-browserify to native Web Crypto shim (inherits error) 2026-02-22 19:37:19 +03:00
pezkuwichain dbcfed6dc3 fix: remove unused imports and add missing dependency 2026-02-22 19:28:20 +03:00
pezkuwichain dd976c88a7 feat: add WalletConnect v2 integration for mobile wallet connection
- Add @walletconnect/sign-client for dApp-side WC v2 support
- Create walletconnect-service.ts with session management and Signer adapter
- Create WalletConnectModal.tsx with QR code display
- Update PezkuwiContext with connectWalletConnect(), session restore, walletSource tracking
- Update WalletContext signing router: mobile → WalletConnect → extension
- Update WalletModal with "Connect with pezWallet (Mobile)" button
- Move WalletConnect projectId to env variable
- Fix vite build: disable assetsInclude for JSON (crypto-browserify compat)
2026-02-22 18:36:29 +03:00
pezkuwichain d91a9055c3 fix: add 200 missing translation keys to all locale files
Add chainSpecs, delegation, governance, hero, identity, login,
nav, notifications, profile, proposals, team, websocket keys
to tr, kmr, ckb, ar, fa locale files.
2026-02-22 16:10:56 +03:00
pezkuwichain ef93735ef4 fix: query nominators from Asset Hub, treasury balances from both chains
NetworkStats now queries staking.nominators from Asset Hub instead of
Relay Chain (staking migrated to AH). Treasury hook fetches HEZ from RC
and PEZ from AH (asset 1) for accurate balance display.
2026-02-22 06:36:15 +03:00
pezkuwichain 3d43d2edf7 fix: add missing tokenomics, teamSection and treasury keys to en.ts 2026-02-22 05:39:44 +03:00
pezkuwichain d282f609aa feat: complete i18n support for all components (6 languages)
Add full internationalization across 127+ components and pages.
790+ translation keys in en, tr, kmr, ckb, ar, fa locales.
Remove duplicate keys and delete unused .json locale files.
2026-02-22 04:48:20 +03:00
pezkuwichain df22c9ba10 feat: clone shared i18n translations to web locale files
Add ~200 new translation keys per language from shared library.
Create separate ckb.ts for Sorani Kurdish (was using Kurmanji).
2026-02-21 17:34:38 +03:00
pezkuwichain bfb56dacab feat: add language switcher to mobile nav bar 2026-02-21 16:53:48 +03:00
pezkuwichain c36625e578 fix: calculate total staked from ledger entries instead of erasTotalStake 2026-02-21 16:35:39 +03:00
pezkuwichain c48b16a256 fix: replace trust score card with citizen count (Hejmara Kurd) 2026-02-21 16:33:16 +03:00
pezkuwichain 1837fb1f00 feat: nav 4x2 button grid + hero stats from correct chains
- Replace nav menu with 4x2 mobile-app-style button grid (responsive)
- Fetch staking stats from Asset Hub instead of Relay Chain
- Governance stats (proposals, voters) remain on Relay Chain
- Trust score: show login prompt for guests, real score for users
- Full-width root container, centered hero, node globals shim fix
2026-02-21 16:29:53 +03:00
pezkuwichain d9d5112383 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 9fd6b79249 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 a31770aabe fix: resolve eslint no-explicit-any in PEZ treasury query 2026-02-18 06:01:42 +03:00
pezkuwichain 65bc266841 fix: correct trust score divisor to 10000 and show both relay+PEZ treasury balances 2026-02-18 05:45:33 +03:00
pezkuwichain da8abecaca fix: replace mock governance data with live chain queries and fix trust score formulas 2026-02-18 05:04:01 +03:00
pezkuwichain 676d0415c0 fix: reduce hero stat card font size to prevent text overflow 2026-02-17 16:50:32 +03:00
pezkuwichain 6d70a2793a fix: hero stats - format staked tokens, real trust score, active-only proposals 2026-02-17 03:11:21 +03:00
pezkuwichain 194816c9e9 fix: compute staking score from CachedStakingDetails instead of hardcoded 0 2026-02-17 02:38:46 +03:00