mirror of
https://github.com/pezkuwichain/pezkuwi-telegram-miniapp.git
synced 2026-04-22 03:07:55 +00:00
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
This commit is contained in:
@@ -26,8 +26,8 @@ function getCorsHeaders(origin: string | null): Record<string, string> {
|
||||
};
|
||||
}
|
||||
|
||||
// RPC endpoint for PezkuwiChain
|
||||
const RPC_ENDPOINT = 'wss://rpc.pezkuwichain.io';
|
||||
// RPC endpoint — defaults to Asset Hub where user balances live
|
||||
const RPC_ENDPOINT = Deno.env.get('RPC_ENDPOINT') || 'wss://asset-hub-rpc.pezkuwichain.io';
|
||||
|
||||
// Token decimals
|
||||
const DECIMALS = 12;
|
||||
|
||||
@@ -28,8 +28,8 @@ function getCorsHeaders(origin: string | null): Record<string, string> {
|
||||
// Platform hot wallet address (PRODUCTION) - Treasury_3
|
||||
const PLATFORM_WALLET = '5H18ZZBU4LwPYbeEZ1JBGvibCU2edhhM8HNUtFi7GgC36CgS';
|
||||
|
||||
// RPC endpoint for PezkuwiChain
|
||||
const RPC_ENDPOINT = 'wss://rpc.pezkuwichain.io';
|
||||
// RPC endpoint — defaults to Asset Hub where user balances live
|
||||
const RPC_ENDPOINT = Deno.env.get('RPC_ENDPOINT') || 'wss://asset-hub-rpc.pezkuwichain.io';
|
||||
|
||||
// Token decimals
|
||||
const DECIMALS = 12;
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
-- Update p2p_balance_transactions transaction_type check constraint
|
||||
-- Add new types needed for full P2P flow:
|
||||
-- withdraw_lock: when user requests withdrawal, balance moves available -> locked
|
||||
-- withdraw_complete: when withdrawal is processed on-chain
|
||||
-- dispute_refund: admin refunds during dispute resolution
|
||||
|
||||
ALTER TABLE p2p_balance_transactions
|
||||
DROP CONSTRAINT p2p_balance_transactions_transaction_type_check;
|
||||
|
||||
ALTER TABLE p2p_balance_transactions
|
||||
ADD CONSTRAINT p2p_balance_transactions_transaction_type_check
|
||||
CHECK (transaction_type = ANY (ARRAY[
|
||||
'deposit',
|
||||
'withdraw',
|
||||
'withdraw_lock',
|
||||
'withdraw_complete',
|
||||
'escrow_lock',
|
||||
'escrow_release',
|
||||
'escrow_refund',
|
||||
'trade_receive',
|
||||
'dispute_refund',
|
||||
'admin_adjustment'
|
||||
]));
|
||||
Reference in New Issue
Block a user