847 Commits

Author SHA1 Message Date
pezkuwichain 9bad24bc84 fix: add storage RLS policies for p2p-payment-proofs bucket
Allow open INSERT/SELECT/DELETE on p2p-payment-proofs bucket since
users authenticate via wallet identity, not Supabase Auth.
2026-02-24 06:28:16 +03:00
pezkuwichain b8a0d5a5f3 fix: add storage RLS policies for p2p-payment-proofs bucket
Allow open INSERT/SELECT/DELETE on p2p-payment-proofs bucket since
users authenticate via wallet identity, not Supabase Auth.
2026-02-24 06:28:16 +03:00
pezkuwichain 508f0763f4 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 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 c969e31700 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 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 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 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 72ae102f0e fix: add Sonner toast renderer for P2P trade notifications
P2P modules (TradeModal, p2p-fiat) use Sonner toast but the Sonner
Toaster component was not mounted in App.tsx. Only the shadcn Toaster
was rendered, causing all P2P toast.error/success calls to be invisible.
2026-02-24 04:46:35 +03:00
pezkuwichain 231506a9f1 fix: add Sonner toast renderer for P2P trade notifications
P2P modules (TradeModal, p2p-fiat) use Sonner toast but the Sonner
Toaster component was not mounted in App.tsx. Only the shadcn Toaster
was rendered, causing all P2P toast.error/success calls to be invisible.
2026-02-24 04:46:35 +03:00
pezkuwichain 698f2acff7 fix: update withdrawal time from 5-30 to 1-3 min in Farsi and Sorani 2026-02-24 04:11:21 +03:00
pezkuwichain 0ccac1253b fix: update withdrawal time from 5-30 to 1-3 min in Farsi and Sorani 2026-02-24 04:11:21 +03:00
pezkuwichain 3461b0fad2 fix: update P2P withdrawal processing time from 5-30 to 1-3 minutes 2026-02-24 04:07:07 +03:00
pezkuwichain d73c84e042 fix: update P2P withdrawal processing time from 5-30 to 1-3 minutes 2026-02-24 04:07:07 +03:00
pezkuwichain 6d5856a010 feat: compact OKX-style mobile P2P ad cards 2026-02-24 03:47:03 +03:00
pezkuwichain 9f35eaadf6 feat: compact OKX-style mobile P2P ad cards 2026-02-24 03:47:03 +03:00
pezkuwichain f9119943e9 feat: add P2P messages inbox and OKX-style navigation
- Add P2PMessages inbox page listing all trade conversations
- Update P2PDashboard top nav with icon+label buttons (Orders, Ads, Messages)
- Add unread message count badge with realtime subscription
- Add /p2p/messages route
- Add i18n translations for all 6 locales
2026-02-24 03:24:28 +03:00
pezkuwichain 57bbec5cdd feat: add P2P messages inbox and OKX-style navigation
- Add P2PMessages inbox page listing all trade conversations
- Update P2PDashboard top nav with icon+label buttons (Orders, Ads, Messages)
- Add unread message count badge with realtime subscription
- Add /p2p/messages route
- Add i18n translations for all 6 locales
2026-02-24 03:24:28 +03:00
pezkuwichain 4536c454a4 fix: WalletConnect multi-chain signing for Asset Hub deposits 2026-02-24 03:14:00 +03:00
pezkuwichain 42bb4140f2 fix: WalletConnect multi-chain signing for Asset Hub deposits 2026-02-24 03:14:00 +03:00
pezkuwichain 402eaf4684 fix: use PLATFORM_WALLET_MNEMONIC env var in process-withdrawal 2026-02-24 00:58:12 +03:00
pezkuwichain b1de3cc017 fix: use PLATFORM_WALLET_MNEMONIC env var in process-withdrawal 2026-02-24 00:58:12 +03:00
pezkuwichain edd733a33a fix: unify platform wallet for deposit and withdrawal
Changed PLATFORM_WALLET to deposit wallet address (5H18ZZBU...)
so both deposit and withdrawal use the same custody wallet.
2026-02-24 00:50:49 +03:00
pezkuwichain 889e0f5886 fix: unify platform wallet for deposit and withdrawal
Changed PLATFORM_WALLET to deposit wallet address (5H18ZZBU...)
so both deposit and withdrawal use the same custody wallet.
2026-02-24 00:50:49 +03:00
pezkuwichain cc986b4ed7 fix: Asset Hub AccountId32 encoding for withdrawal edge functions
Deno npm shim breaks SS58 decoding in @pezkuwi/api type registry,
causing PezspCoreCryptoAccountId32 to receive 48-byte SS58 strings
instead of 32-byte public keys. Added inline ss58ToHex decoder and
explicit hex-based nonce fetching to avoid all SS58 → AccountId32
conversions at the API level. Also adds P2P E2E test script (45/45).
2026-02-24 00:16:11 +03:00
pezkuwichain bb70bc4596 fix: Asset Hub AccountId32 encoding for withdrawal edge functions
Deno npm shim breaks SS58 decoding in @pezkuwi/api type registry,
causing PezspCoreCryptoAccountId32 to receive 48-byte SS58 strings
instead of 32-byte public keys. Added inline ss58ToHex decoder and
explicit hex-based nonce fetching to avoid all SS58 → AccountId32
conversions at the API level. Also adds P2P E2E test script (45/45).
2026-02-24 00:16:11 +03:00
pezkuwichain d40647aa50 fix: remove price_per_unit from offer insert (generated column) 2026-02-23 22:36:15 +03:00
pezkuwichain 56adb45b07 fix: remove price_per_unit from offer insert (generated column) 2026-02-23 22:36:15 +03:00
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 2150ab4997 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 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 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 646e388b28 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 a50a5dbffb 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 1f9111bdd4 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 6cfc64475c 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 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 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 aa3a49f0f6 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 b7c4937122 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 9518dcd501 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 cbf98e4dc9 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