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
@@ -67,7 +67,7 @@ const TOKENS: Token[] = [
];
export const TransferModal: React.FC<TransferModalProps> = ({ isOpen, onClose, selectedAsset }) => {
const { api, assetHubApi, isApiReady, isAssetHubReady, selectedAccount } = usePezkuwi();
const { api, assetHubApi, isApiReady, isAssetHubReady, selectedAccount, walletSource } = usePezkuwi();
const { toast } = useToast();
const { t } = useTranslation();
@@ -129,10 +129,9 @@ export const TransferModal: React.FC<TransferModalProps> = ({ isOpen, onClose, s
setTxStatus('signing');
try {
// Import web3FromAddress to get the injector
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, isAssetHubTransfer ? assetHubApi : api);
// Convert amount to smallest unit
const amountInSmallestUnit = BigInt(parseFloat(amount) * Math.pow(10, currentToken.decimals));