Commit Graph

60 Commits

Author SHA1 Message Date
pezkuwichain 12d6f4f3fd 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 d40647aa50 fix: remove price_per_unit from offer insert (generated column) 2026-02-23 22:36:15 +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 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 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 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 194816c9e9 fix: compute staking score from CachedStakingDetails instead of hardcoded 0 2026-02-17 02:38:46 +03:00
pezkuwichain 226e997723 feat: staking score 3-state model and noter integration 2026-02-17 01:32:54 +03:00
pezkuwichain e9d5fef39a 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 003bff05b3 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 6a7fb4d857 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 167a7aff4e 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 fbd53b9960 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 a0ea8ac9b4 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 ba046636b8 debug: add console logs for trust score calculation 2026-02-07 01:39:11 +03:00
pezkuwichain 6b1e07dadf 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 91070435d5 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 e8808e1a06 fix: formatBalance now correctly parses hex values from blockchain 2026-02-06 22:14:56 +03:00
pezkuwichain daff782096 fix: support both sonner and shadcn toast APIs in error handler 2026-02-06 21:42:27 +03:00
pezkuwichain 789920ed80 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 47415fd75d 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 9865e32658 feat: add LP staking score and DOT/ETH/BTC tokens 2026-02-06 20:01:12 +03:00
pezkuwichain 1d6752f66d fix: restore web3FromAddress for browser extension signing 2026-02-06 19:38:59 +03:00
pezkuwichain 8750d9fe2e fix: fetch scores from correct chains (People + Relay) 2026-02-06 19:33:42 +03:00
pezkuwichain 5749f9a379 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 269e963a4d 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 ef41b996e9 fix: add null checks for welati pallet in all governance functions 2026-02-06 06:17:26 +03:00
pezkuwichain db381c803d fix: correct wHEZ asset ID from 0 to 2
tokenWrapper pallet on Asset Hub creates wHEZ as Asset ID 2, not 0.

Asset IDs on Asset Hub:
- Asset 1: PEZ
- Asset 2: wHEZ (via tokenWrapper)
- Asset 1000: wUSDT

Updated:
- shared/constants/index.ts: KNOWN_TOKENS
- shared/lib/wallet.ts: ASSET_IDS.WHEZ default
- AccountBalance.tsx: pool queries
- InitializeHezPoolModal.tsx: balance query
2026-02-04 13:52:47 +03:00
pezkuwichain 8f2b5c7136 feat: add XCM teleport and CI/CD deployment workflow
Features:
- Add XCMTeleportModal for cross-chain HEZ transfers
- Support Asset Hub and People Chain teleports
- Add "Fund Fees" button with user-friendly tooltips
- Use correct XCM V3 format with teyrchain junction

Fixes:
- Fix PEZ transfer to use Asset Hub API
- Silence unnecessary pallet availability warnings
- Fix transaction loading performance (10 blocks limit)
- Remove Supabase admin_roles dependency

CI/CD:
- Add auto-deploy to VPS on main branch push
- Add version bumping on deploy
- Upload build artifacts for deployment
2026-02-04 11:35:25 +03:00
pezkuwichain e08227772c fix: update escrow address to Treasury_3
- Update PLATFORM_ESCROW_ADDRESS in p2p-fiat.ts
- Update PLATFORM_WALLET in verify-deposit edge function
- Use controlled wallet for P2P deposits/withdrawals
2026-02-03 16:50:56 +03:00
pezkuwichain f23eee2fb9 feat(p2p): OKX-level security upgrade with Edge Functions
- Add process-withdraw Edge Function for blockchain withdrawals
- Update verify-deposit Edge Function with @pezkuwi/api
- Add withdrawal limits (daily/monthly) and fee system
- Add hot wallet configuration with production address
- Add admin roles for dispute resolution
- Add COMBINED SQL migration with full P2P system
- Encrypt payment details with AES-256-GCM
- Prevent TX hash reuse with UNIQUE constraint
2026-01-29 03:12:02 +03:00
pezkuwichain 6bc9d68e84 chore: Fix linting errors and update shared libs for mobile build 2026-01-19 03:35:33 +03:00
pezkuwichain dfc8d27c39 Add presale lib and backup file, ignore credentials 2026-01-18 01:08:42 +03:00
pezkuwichain ba74fe4298 fix: TypeScript errors, shadow deprecations, and build configuration
- Fix shadow style deprecation warnings across components (boxShadow)
- Add type declaration files (codec.d.ts, modules.d.ts)
- Update metro.config.cjs for proper asset extensions
- Update tsconfig.json with module resolution settings
- Fix TypeScript errors in shared/lib files
- Update app icons (optimized PNG files)
2026-01-15 09:37:37 +03:00
pezkuwichain 4a3694c831 Fix all shadow deprecation warnings across entire mobile app
- Replaced shadowColor/shadowOffset/shadowOpacity/shadowRadius with boxShadow
- Fixed 28 files (21 screens + 7 components)
- Preserved elevation for Android compatibility
- All React Native Web deprecation warnings resolved

Files fixed:
- All screen components
- All reusable components
- Navigation components
- Modal components
2026-01-14 15:05:10 +03:00
pezkuwichain 1295c36241 Rebrand: polkadot → pezkuwi build fixes
- Fixed TypeScript type assertion issues
- Updated imports from api-augment/substrate to api-augment/bizinikiwi
- Fixed imgConvert.mjs header and imports
- Added @ts-expect-error for runtime-converted types
- Fixed all @polkadot copyright headers to @pezkuwi
2026-01-07 02:32:54 +03:00
pezkuwichain fe2cd390f6 feat(p2p): add Kurdish diaspora payment methods (130+ total)
- Add 61 new payment methods for diaspora countries:
  - Germany (EUR): Sparkasse, Commerzbank, DKB, etc.
  - Sweden (SEK): Swish, Nordea, SEB, Swedbank
  - UK (GBP): Faster Payments, Barclays, HSBC, Monzo
  - France (EUR): Crédit Agricole, Lydia, BNP Paribas
  - Netherlands (EUR): iDEAL, ABN AMRO, Bunq, Tikkie
  - Belgium (EUR): Bancontact, KBC
  - Austria (EUR): Erste Bank, Raiffeisen
  - Switzerland (CHF): TWINT, UBS, PostFinance
  - Norway (NOK): Vipps, DNB, SpareBank 1
  - Denmark (DKK): MobilePay, Danske Bank
  - Australia (AUD): PayID, Commonwealth Bank
  - Canada (CAD): Interac e-Transfer, TD Bank

- Expand FiatCurrency type: SEK, GBP, CHF, NOK, DKK, AUD, CAD
- Update CreateAd, BlockTrade, ExpressMode components
- Add regional labels (Bakur, Başûr, Rojhilat, EU diaspora)
2025-12-12 03:48:57 +03:00
pezkuwichain 14f5e84d15 feat(p2p): implement OKX-style internal ledger escrow system
Phase 5 implementation - Internal Ledger Escrow (OKX Model):
- No blockchain transactions during P2P trades
- Blockchain tx only at deposit/withdraw
- Fast and fee-free P2P trading

Database:
- Add user_internal_balances table
- Add p2p_deposit_withdraw_requests table
- Add p2p_balance_transactions table
- Add lock_escrow_internal(), release_escrow_internal() functions
- Add process_deposit(), request_withdraw() functions

UI Components:
- Add InternalBalanceCard showing available/locked balances
- Add DepositModal for crypto deposits to P2P balance
- Add WithdrawModal for withdrawals from P2P balance
- Integrate balance card into P2PDashboard

Backend:
- Add process-withdrawal Edge Function
- Add verify-deposit Edge Function

Updated p2p-fiat.ts:
- createFiatOffer() uses internal balance lock
- confirmPaymentReceived() uses internal balance transfer
- Add internal balance management functions
2025-12-12 00:41:11 +03:00
pezkuwichain dcbfa4789a feat(p2p): add atomic escrow system with race condition protection
- Add p2p_platform_escrow table for tracking locked funds
- Implement accept_p2p_offer() with FOR UPDATE lock to prevent race conditions
- Add complete_p2p_trade() and cancel_p2p_trade() atomic functions
- Configure platform escrow wallet: 5DFwqK698vL4gXHEcanaewnAqhxJ2rjhAogpSTHw3iwGDwd3
- Update AdList to show user's own offers with Your Ad badge
- Remove unused getActiveOffers import (ESLint fix)
2025-12-11 20:45:14 +03:00
pezkuwichain df58d26893 feat(p2p): add Phase 4 merchant tier system and migrations
- Add merchant tier system (Lite/Super/Diamond) with tier badges
- Add advanced order filters (token, fiat, payment method, amount range)
- Add merchant dashboard with stats, ads management, tier upgrade
- Add fraud prevention system with risk scoring and trade limits
- Rename migrations to timestamp format for Supabase CLI compatibility
- Add new migrations: phase2_phase3_tables, fraud_prevention, merchant_system
2025-12-11 10:39:08 +03:00
pezkuwichain 7330b2e7a6 feat(p2p): add Phase 3 dispute system components
- Add DisputeModal.tsx with reason selection, evidence upload, terms acceptance
- Add P2PDispute.tsx page with evidence gallery, status timeline, real-time updates
- Integrate dispute button in P2PTrade.tsx
- Add /p2p/dispute/:disputeId route to App.tsx
- Add P2P test suite with MockStore pattern (32 tests passing)
- Update P2P-BUILDING-PLAN.md with Phase 3 progress (70% complete)
- Fix lint errors in test files and components
2025-12-11 09:10:04 +03:00
pezkuwichain 11678fe7cd feat(web): add network subpages and subdomains listing page
- Add /subdomains page listing all 20 PezkuwiChain subdomains
- Add Back to Home button to Subdomains page
- Create NetworkPage reusable component for network details
- Add 7 network subpages: /mainnet, /staging, /testnet, /beta, /alfa, /development, /local
- Update ChainSpecs network cards to navigate to network subpages
- Add i18n translations for chainSpecs section in en.ts
- Add SDK docs with rebranding support (rebrand-rustdoc.cjs)
- Add generate-docs-structure.cjs for automatic docs generation
- Update shared libs: endpoints, polkadot, wallet, xcm-bridge
- Add new token logos: TYR, ZGR, pezkuwi_icon
- Add new pages: Explorer, Docs, Wallet, Api, Faucet, Developers, Grants, Wiki, Forum, Telemetry
2025-12-11 00:33:47 +03:00
pezkuwichain de46a698c9 feat(admin): add USDT-wUSDT integration button
Added user-friendly toggle button in admin panel for easy USDT-wUSDT bridge control.
2025-11-21 21:09:22 +03:00
pezkuwichain 06a7ec9424 feat(frontend): align wUSDT Asset ID with SDK (1000)
This commit aligns the frontend wUSDT implementation with the SDK runtime
constants, ensuring consistency across the entire stack.

Changes:
- Update ASSET_IDS.WUSDT from 2 → 1000 (matches SDK constants)
- Add ASSET_CONFIGS with wUSDT configuration (6 decimals, min balance)
- Update all asset queries in AccountBalance.tsx to use ASSET_IDS.WUSDT
- Update pool queries for wHEZ/wUSDT and PEZ/wUSDT pools
- Update USDTBridge.tsx burn transaction to use ASSET_IDS.WUSDT
- Refactor usdt.ts to reference ASSET_CONFIGS instead of hardcoded values

Asset ID Allocation Strategy:
- 0-999: Reserved for protocol tokens (wHEZ, PEZ, etc.)
- 1000+: Bridged/wrapped external assets (wUSDT, etc.)

Technical Details:
- wUSDT uses 6 decimals (USDT standard), not 12 like native HEZ
- All frontend code now uses centralized ASSET_CONFIGS
- ESLint passes with 0 errors (8 pre-existing warnings unrelated to changes)

This is part of Phase 1 wUSDT infrastructure setup, working in parallel
with SDK benchmarking builds currently running in background.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-20 19:52:48 +03:00
pezkuwichain 4e85e28bce fix: fetch referral scores from correct pallet storage
Changed getReferralScore() to read from pallet_referral::ReferralCount
instead of non-existent pallet_trust::ReferralScores.

Changes:
- Read referral count from api.query.referral.referralCount
- Implement proper score calculation logic:
  * 0 referrals: 0 points
  * 1-5 referrals: count × 4 points
  * 6-20 referrals: 20 + (count - 5) × 2 points
  * 21+ referrals: capped at 50 points
- Add detailed documentation explaining score calculation
- Remove warning spam in production (only warn in dev mode)

This fixes the console warning "Referral scores not available in
trust pallet" by using the actual pallet_referral storage that
already exists and is properly maintained.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-20 19:10:38 +03:00
pezkuwichain 6dc8ac0183 Revert "fix: suppress referral scores warning in production"
This reverts commit cd83e0fc4f.
2025-11-20 19:09:27 +03:00
pezkuwichain c087d37801 fix: suppress referral scores warning in production
Only show "Referral scores not available in trust pallet" warning
in development mode to prevent console spam in production.

The warning occurs because api.query.trust.referralScores is not
yet implemented in the trust pallet, but getAllScores() calls it
every time user data is loaded.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-20 19:07:42 +03:00
pezkuwichain 590ac521e8 refactor(core): Apply various updates and fixes across components 2025-11-19 18:56:38 +03:00