mirror of
https://github.com/pezkuwichain/pwap.git
synced 2026-04-22 09:07:55 +00:00
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
This commit is contained in:
@@ -56,6 +56,7 @@ export function DepositModal({ isOpen, onClose, onSuccess }: DepositModalProps)
|
||||
const [amount, setAmount] = useState('');
|
||||
const [platformWallet, setPlatformWallet] = useState<string>('');
|
||||
const [txHash, setTxHash] = useState('');
|
||||
const [blockNumber, setBlockNumber] = useState<number | undefined>();
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [copied, setCopied] = useState(false);
|
||||
const [verifying, setVerifying] = useState(false);
|
||||
@@ -77,6 +78,7 @@ export function DepositModal({ isOpen, onClose, onSuccess }: DepositModalProps)
|
||||
setToken('HEZ');
|
||||
setAmount('');
|
||||
setTxHash('');
|
||||
setBlockNumber(undefined);
|
||||
setLoading(false);
|
||||
setCopied(false);
|
||||
setVerifying(false);
|
||||
@@ -140,6 +142,13 @@ export function DepositModal({ isOpen, onClose, onSuccess }: DepositModalProps)
|
||||
|
||||
if (hash) {
|
||||
setTxHash(hash);
|
||||
// Capture approximate block number for faster verification
|
||||
try {
|
||||
const header = await api.rpc.chain.getHeader();
|
||||
setBlockNumber(header.number.toNumber());
|
||||
} catch {
|
||||
// Non-critical - verification will still work via search
|
||||
}
|
||||
setStep('verify');
|
||||
toast.success(t('p2pDeposit.txSent'));
|
||||
}
|
||||
@@ -174,7 +183,8 @@ export function DepositModal({ isOpen, onClose, onSuccess }: DepositModalProps)
|
||||
txHash,
|
||||
token,
|
||||
expectedAmount: depositAmount,
|
||||
walletAddress: selectedAccount?.address
|
||||
walletAddress: selectedAccount?.address,
|
||||
...(blockNumber ? { blockNumber } : {})
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user