Commit Graph

102 Commits

Author SHA1 Message Date
pezkuwichain b800b36b9f fix: use ClaimedRewards double-map for accurate unclaimed reward detection
- Replace legacy ledger.claimedRewards (empty in paged-rewards Substrate)
  with ClaimedRewards(era, validator) storage double-map
- Track user's page in erasStakersPaged and check against claimed pages
- Use historyDepth instead of hardcoded 10 eras
- Split batch payouts into groups of 5 to avoid block weight overflow
- Use utility.batch instead of batchAll for resilience
- Pass page to payoutStakersByPage when available
2026-02-27 03:07:14 +03:00
pezkuwichain b56760b22e fix: chat message alignment + auto-refresh for all P2P screens
- TradeChat: use authUserId for sender matching (fixes all messages
  appearing on left side instead of bubble alignment)
- BalanceCard: auto-refresh every 30s
- OfferList: auto-refresh every 15s
- MyOffers/MyTrades: auto-refresh every 15s when tab is active
2026-02-27 02:12:47 +03:00
pezkuwichain 4fbf60f940 feat: return auth_user_id from telegram-auth for P2P role matching 2026-02-27 01:51:57 +03:00
pezkuwichain 556b850ec2 fix: use auth.users UUID for trade role matching
telegram-auth now returns auth_user_id alongside public.users data.
TradeView uses authUserId (auth.users UUID) to match buyer_id/seller_id,
fixing missing action buttons (mark paid, confirm, cancel).
2026-02-27 01:51:14 +03:00
pezkuwichain 8c36b832b8 fix: fallback to PLATFORM_WALLET_MNEMONIC for withdraw TX 2026-02-27 01:17:01 +03:00
pezkuwichain 24cd89606e feat: add blockchain TX processing to withdraw function
request-withdraw-telegram now sends tokens from hot wallet to user wallet
using @pezkuwi/api, instead of leaving requests in pending state.
Falls back to pending if PLATFORM_PRIVATE_KEY is not configured.
2026-02-27 01:11:05 +03:00
pezkuwichain 705002f83f fix: prettier formatting in P2P tab highlight 2026-02-27 00:58:16 +03:00
pezkuwichain 910610491f fix: dual bot token auth + P2P UI logic fixes
- All 17 edge functions now check both TELEGRAM_BOT_TOKEN and
  TELEGRAM_BOT_TOKEN_KRD for session verification
- Add perPage:1000 to listUsers calls to prevent pagination issues
- Fix offer button label: Buy tab shows "Al" (green), Sell tab shows "Sat" (red)
- Fix active tab highlight with cyan color for visibility
- Fix modal transparency (add --card CSS variable)
- Fix withdraw tab sync (useEffect on modal open)
2026-02-27 00:53:52 +03:00
pezkuwichain b67809481e fix: pass block number hint to verify-deposit for faster verification
- Get block number from finalized block hash in frontend
- Pass as hint to verify-deposit-telegram to avoid 100-block scan
- Improve error message extraction in callEdgeFunction
2026-02-26 22:44:50 +03:00
pezkuwichain 4686453df7 feat: automate deposit flow + fix listUsers pagination
- Rewrite DepositWithdrawModal to send TX automatically via assetHubApi
  instead of manual copy-paste-hash flow
- Fix listUsers pagination bug (default 50) in 4 edge functions by
  adding perPage: 1000 - fixes P2P offers not showing for users
- Add new i18n keys for automated deposit states in all 6 languages
2026-02-26 21:53:41 +03:00
pezkuwichain 0f081545a8 fix: prettier formatting in translation files 2026-02-26 20:56:47 +03:00
pezkuwichain b711524d57 feat: add P2P deposit/withdraw flow for Telegram mini app
- New request-withdraw-telegram edge function (session token auth)
- New DepositWithdrawModal component with deposit/withdraw tabs
- Deposit: platform wallet display, TX hash verification, on-chain check
- Withdraw: token select, amount, fee display, balance validation
- BalanceCard: deposit/withdraw buttons always visible
- P2P section: modal state management and balance refresh on success
- p2p-api: verifyDeposit and requestWithdraw functions
- i18n: 24 new translation keys across all 6 languages
2026-02-26 20:33:31 +03:00
pezkuwichain 0606f93146 fix: resolve remaining lint errors in App.tsx and tr.ts
- Fix prettier formatting for lazy import in App.tsx
- Use double quotes for Turkish strings containing apostrophes
2026-02-26 19:13:55 +03:00
pezkuwichain 0b72cc4a4d fix: resolve ESLint/Prettier issues in P2P components
- Fix prettier formatting across all P2P files
- Fix setState-in-useEffect by using useCallback pattern
- Add missing React import for keyboard event type
- Wrap fetch functions in useCallback for exhaustive-deps
2026-02-26 19:03:59 +03:00
pezkuwichain 31e768de45 feat: integrate P2P trading into Telegram mini app
- Add 8 Supabase edge functions for P2P operations (get-internal-balance,
  get-payment-methods, get-p2p-offers, accept-p2p-offer, get-p2p-trades,
  trade-action, p2p-messages, p2p-dispute)
- Add frontend P2P API layer (src/lib/p2p-api.ts)
- Add 8 P2P components (BalanceCard, OfferList, TradeModal, CreateOfferModal,
  TradeView, TradeChat, DisputeModal, P2P section)
- Embed P2P as internal section in App.tsx instead of external link
- Remove old P2PModal component
- Add ~70 P2P translation keys across all 6 languages
2026-02-26 18:38:12 +03:00
pezkuwichain 2fbbce192f fix: prioritize URL path over localStorage for language detection
Bot keyboard sends language via URL path (/tr, /ar, etc.).
Previously localStorage was checked first, so once a user had
'en' saved, clicking a different language button in the bot had
no effect. Now URL path always wins over localStorage.
2026-02-25 19:46:10 +03:00
pezkuwichain fad8291c90 fix: restore URL path language detection for Telegram bot links
Bot sends users to /tr, /ar, /en etc. Previous commit removed URL path
detection entirely, breaking language selection from bot. Now URL path is
checked as secondary source (after localStorage), consumed once, persisted
to localStorage, and cleaned from the URL to prevent WebView cache issues.
2026-02-25 19:16:47 +03:00
pezkuwichain 1be1c252e0 fix: correct referral link bot username to pezkuwichainBot 2026-02-24 00:09:04 +03:00
pezkuwichain 480b5fe96b feat: P2P E2E test suite + edge function RPC fix + balance tx constraint update
- Fix process-withdraw and verify-deposit-telegram to use RPC_ENDPOINT
  env var defaulting to Asset Hub (wss://asset-hub-rpc.pezkuwichain.io)
- Add P2P E2E test script (scripts/p2p-e2e-test.py) covering full flow:
  offer creation, trade accept, payment, escrow release, cancel, visa
  user trade, and withdrawal request
- Update p2p_balance_transactions transaction_type check constraint
  to include withdraw_lock, withdraw_complete, dispute_refund
2026-02-23 21:21:12 +03:00
pezkuwichain c72782793a fix: use localStorage instead of URL path for language persistence
Telegram WebView caches URL and strips #tgWebAppData hash on reopens,
causing empty initData when URL path contained language prefix like /en.
2026-02-22 21:04:29 +03:00
pezkuwichain f2b809cb7c feat: add HEZ staking reward claim functionality
- Add staking-rewards.ts with unclaimed era detection and payoutStakers
- Show unclaimed rewards with per-era claim buttons in Scores tab
- Support batch claim via utility.batchAll
- Add translations for 6 languages
2026-02-21 18:35:05 +03:00
pezkuwichain a14bd57bbe feat: add PEZ epoch rewards display and claim functionality 2026-02-21 17:53:30 +03:00
pezkuwichain 123183038f fix: show total HEZ balance in card, use RC free for send tab
- Balance card shows RC + AH + staked total with staked note
- Tokens section shows free balances only
- Send tab checks against RC free balance to prevent failed transfers
2026-02-21 15:12:08 +03:00
pezkuwichain 9a2f74b783 fix: show total HEZ balance across RC + AH free + AH staked 2026-02-21 14:44:51 +03:00
pezkuwichain de6f41263c feat: migrate staking to Asset Hub and add citizen count card
- HEZStakingModal: switch all staking queries/tx from RC api to assetHubApi
- Add citizen count card to Rewards overview (Hejmara Kurd Le Cihane)
- Add getCitizenCount() to fetch total citizens from People Chain
- Add translations for citizen count card (6 languages)
2026-02-21 02:55:07 +03:00
pezkuwichain ef8132c82a feat: add Start Tracking and Record Trust Score buttons to Scores tab 2026-02-20 02:27:53 +03:00
pezkuwichain 714b234c76 fix: remove unreliable isEmpty check for enum KYC status 2026-02-20 01:35:04 +03:00
pezkuwichain d2969c1062 feat: add confirmCitizenship step to Rewards section 2026-02-20 01:21:26 +03:00
pezkuwichain dbd081ee64 fix: use GITHUB_TOKEN instead of PAT_TOKEN for branch sync 2026-02-19 06:21:32 +03:00
pezkuwichain 73ab592b13 ci: add sync-branches workflow to keep main and master in sync 2026-02-19 05:56:04 +03:00
pezkuwichain fca4fb231b fix: align referral and tiki score formulas with pallet source code 2026-02-17 02:33:56 +03:00
pezkuwichain db3ed21970 fix: show real staking score from CachedStakingDetails instead of hardcoded 0 2026-02-17 02:13:53 +03:00
pezkuwichain 9b97c63a26 feat: 3-state staking score UI with cached data support 2026-02-17 01:56:49 +03:00
pezkuwichain 0f63c96b2c feat: add standalone explorer page at /explorer 2026-02-16 01:27:40 +03:00
pezkuwichain b3241005ba ci: skip VPS1 deploy, only deploy to telegram.pezkiwi.app 2026-02-15 04:12:21 +03:00
pezkuwichain 0f8541b6f5 fix: preserve /citizens path in i18n URL rewriting 2026-02-15 00:14:54 +03:00
pezkuwichain e93cb143e2 fix: deploy pezkiwi.app to correct VPS (VPS2) 2026-02-15 00:06:30 +03:00
pezkuwichain 8f4b9087f3 feat: simplify Be Citizen flow - remove wallet steps, add seed phrase input
- Remove wallet setup/create/import/connect steps from CitizenPage
- Add privacy notice banner with Shield icon to form
- Add seed phrase textarea with mnemonic validation
- CitizenProcessing creates keypair directly from seed phrase
- CitizenSuccess shows 3-step next process info
- Add /citizens path support alongside ?page=citizen
- Update bot URL to /citizens
- Add 10 new i18n keys in all 6 languages
2026-02-14 23:24:59 +03:00
pezkuwichain f864ed6804 feat: update Be Citizen to new applyForCitizenship API
- Single tx (applyForCitizenship) instead of 2-step setIdentity+applyForKyc
- Keccak-256 identity hash via js-sha3
- Referral code replaced with referrer SS58 address
- Success screen shows pending referral status instead of citizen ID
- Updated all 6 translation files with new keys
2026-02-14 22:00:32 +03:00
pezkuwichain 59d4f3e6a1 fix: preserve query params in i18n URL, make seed phrase copyable in bot 2026-02-14 21:08:28 +03:00
pezkuwichain b8ab86028f feat: add Be Citizen page with 6-language support 2026-02-14 20:44:17 +03:00
pezkuwichain c4282f5870 feat(i18n): replace all hardcoded strings with translation calls
- Add translation keys for dashboard, send, receive, history, swap,
  pools, staking, lpStaking, fees, tokens, errors, validation, time,
  and context sections to types.ts and all 6 language files
- Replace hardcoded Kurdish/Turkish strings in all wallet components
  with useTranslation() hook t() calls
- Replace hardcoded strings in non-React files (crypto, utils,
  error-tracking, wallet-storage, contexts) with standalone translate()
- Fix Turkish strings incorrectly used in Kurdish codebase
2026-02-14 18:16:08 +03:00
pezkuwichain 71f142b9f4 feat(i18n): auto-detect language from Telegram user settings
- Detect language from URL path first, then Telegram WebApp language_code
- Map Telegram language codes (ku, tr, en, fa, ar, ckb) to app languages
- Auto-redirect to language-prefixed URL on first load
2026-02-14 11:53:06 +03:00
pezkuwichain 44a4b9395b feat(supabase): add pezkiwi.app CORS and multi-bot-token auth support
- Add telegram.pezkiwi.app to CORS allowed origins in all edge functions
- Support multiple bot tokens (TELEGRAM_BOT_TOKEN, TELEGRAM_BOT_TOKEN_KRD) in auth
- Dynamic origin matching for proper CORS headers
2026-02-14 11:09:14 +03:00
pezkuwichain f6125a127d feat(deploy): add telegram.pezkiwi.app as second deploy target 2026-02-14 11:08:25 +03:00
pezkuwichain 9da348bdf3 feat: add i18n support with 6 languages (en, tr, krd, ar, fa, ckb)
- Add translation system with useTranslation hook and LanguageProvider
- Auto-detect language from Telegram user settings
- Update all components and sections to use translation keys
- Support English, Turkish, Kurdish, Arabic, Persian, Sorani
2026-02-14 11:06:14 +03:00
pezkuwichain e5dd2b4b5b refactor(ci): modularize workflows into ci, code-quality, security, deploy
- Split monolithic ci.yml into focused workflow files
- Add code-quality.yml with complexity analysis and duplicate detection
- Replace template codeql.yml with comprehensive security.yml (CodeQL, dependency audit, dependency review, secret scan)
- Separate deploy into its own workflow triggered by CI success
2026-02-14 11:02:05 +03:00
pezkuwichain d48fb39c4e refactor(scores): remove frontend fallback, read all scores from blockchain
- Remove localStorage staking tracking and manual score calculation
- Read trust, referral, tiki, perwerde scores directly from People Chain
- Add SubQuery integration for staking reward history display
- Align score system with pwap/shared implementation
2026-02-13 06:26:27 +03:00
pezkuwichain 107dbbacdf feat: add platform fees for deposit networks
- TON: 0.1 USDT fee
- Polkadot: 0.1 USDT fee
- TRC20: 3 USDT fee (unchanged)
- Update fee display in Kurdish
2026-02-08 05:58:45 +03:00
pezkuwichain c45f95fa31 feat: add USDT deposit card and fix transaction history parsing
- Add prominent 'USDT Zêde Bike' card above recent activity
- Fix MultiAddress parsing for Asset Hub transactions
- Add proper token names for wUSDT, DOT, ETH, BTC
- Use correct decimals per asset type
- Remove unused userId prop from DepositUSDTModal
2026-02-08 05:31:45 +03:00