mirror of
https://github.com/pezkuwichain/pwap.git
synced 2026-04-22 02:07:55 +00:00
fix: hardcode chain genesis hashes in WC session to fix signing
WC session was missing Asset Hub and People Chain because their APIs weren't connected yet at session creation time. Also fix catch blocks in ExistingCitizenAuth that referenced undefined err variable.
This commit is contained in:
@@ -52,8 +52,8 @@ export const ExistingCitizenAuth: React.FC<ExistingCitizenAuthProps> = ({ onClos
|
||||
const authChallenge = generateAuthChallenge(citizenNumber);
|
||||
setChallenge(authChallenge);
|
||||
setStep('signing');
|
||||
} catch {
|
||||
if (import.meta.env.DEV) console.error('Verification error:', err);
|
||||
} catch (err) {
|
||||
console.error('Verification error:', err);
|
||||
setError(t('existingAuth.verificationFailed'));
|
||||
setStep('error');
|
||||
}
|
||||
@@ -98,9 +98,9 @@ export const ExistingCitizenAuth: React.FC<ExistingCitizenAuthProps> = ({ onClos
|
||||
onClose();
|
||||
window.location.href = '/citizens';
|
||||
}, 2000);
|
||||
} catch {
|
||||
if (import.meta.env.DEV) console.error('Signature error:', err);
|
||||
setError(t('existingAuth.signError'));
|
||||
} catch (err) {
|
||||
console.error('Signature error:', err);
|
||||
setError(err instanceof Error ? err.message : t('existingAuth.signError'));
|
||||
setStep('error');
|
||||
}
|
||||
};
|
||||
|
||||
@@ -496,10 +496,12 @@ export const PezkuwiProvider: React.FC<PezkuwiProviderProps> = ({
|
||||
setError(null);
|
||||
const genesisHash = api.genesisHash.toHex();
|
||||
|
||||
// Include Asset Hub and People Chain in WC session so cross-chain TX signing works
|
||||
const additionalHashes: string[] = [];
|
||||
if (assetHubApi?.isConnected) additionalHashes.push(assetHubApi.genesisHash.toHex());
|
||||
if (peopleApi?.isConnected) additionalHashes.push(peopleApi.genesisHash.toHex());
|
||||
// Always include Asset Hub and People Chain in WC session so cross-chain TX signing works
|
||||
// Hardcoded because APIs may not be connected yet when WC session is established
|
||||
const additionalHashes: string[] = [
|
||||
'0xe7c15092dcbe3f320260ddbbc685bfceed9125a3b3d8436db2766201dec3b949', // Asset Hub
|
||||
'0x69a8d025ab7b63363935d7d9397e0f652826c94271c1bc55c4fdfe72cccf1cfa', // People Chain
|
||||
];
|
||||
|
||||
try {
|
||||
await initWalletConnect();
|
||||
|
||||
Reference in New Issue
Block a user