fix: universal getSigner helper for WalletConnect + extension signing

Replace all web3FromAddress calls with getSigner() that auto-detects
walletSource and uses WC signer or extension signer accordingly.
This fixes all signing operations when connected via WalletConnect.
This commit is contained in:
2026-02-23 07:01:18 +03:00
parent bcee7c2a7d
commit 80d8bbbcb1
21 changed files with 139 additions and 142 deletions
+4 -5
View File
@@ -25,7 +25,7 @@ const AVAILABLE_TOKENS = [
const TokenSwap = () => {
// Use Asset Hub API for DEX operations (assetConversion pallet is on Asset Hub)
const { assetHubApi, isAssetHubReady, selectedAccount } = usePezkuwi();
const { assetHubApi, isAssetHubReady, selectedAccount, walletSource } = usePezkuwi();
const { balances, refreshBalances } = useWallet();
const { toast } = useToast();
const { t } = useTranslation();
@@ -583,10 +583,9 @@ const TokenSwap = () => {
minAmountOut: minAmountOut.toString()
});
// Get signer from extension
const { web3Enable, web3FromAddress } = await import('@pezkuwi/extension-dapp');
await web3Enable('PezkuwiChain');
const injector = await web3FromAddress(selectedAccount.address);
// Get signer (extension or WalletConnect)
const { getSigner } = await import('@/lib/get-signer');
const injector = await getSigner(selectedAccount.address, walletSource, assetHubApi);
// Build transaction based on token types
let tx;