mirror of
https://github.com/pezkuwichain/pwap.git
synced 2026-04-23 03:37:55 +00:00
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:
@@ -11,7 +11,7 @@ import { Alert, AlertDescription } from '@/components/ui/alert';
|
||||
|
||||
export function CommissionSetupTab() {
|
||||
const { t } = useTranslation();
|
||||
const { api, isApiReady, selectedAccount } = usePezkuwi();
|
||||
const { api, isApiReady, selectedAccount, walletSource } = usePezkuwi();
|
||||
const { toast } = useToast();
|
||||
|
||||
const [loading, setLoading] = useState(true);
|
||||
@@ -70,9 +70,8 @@ export function CommissionSetupTab() {
|
||||
|
||||
setProcessing(true);
|
||||
try {
|
||||
const { web3Enable, web3FromAddress } = await import('@pezkuwi/extension-dapp');
|
||||
await web3Enable('PezkuwiChain');
|
||||
const injector = await web3FromAddress(selectedAccount.address);
|
||||
const { getSigner } = await import('@/lib/get-signer');
|
||||
const injector = await getSigner(selectedAccount.address, walletSource, api);
|
||||
|
||||
// Parse addresses (one per line, trim whitespace)
|
||||
const newAddresses = newMemberAddress
|
||||
@@ -175,9 +174,8 @@ export function CommissionSetupTab() {
|
||||
|
||||
setProcessing(true);
|
||||
try {
|
||||
const { web3Enable, web3FromAddress } = await import('@pezkuwi/extension-dapp');
|
||||
await web3Enable('PezkuwiChain');
|
||||
const injector = await web3FromAddress(selectedAccount.address);
|
||||
const { getSigner } = await import('@/lib/get-signer');
|
||||
const injector = await getSigner(selectedAccount.address, walletSource, api);
|
||||
|
||||
if (import.meta.env.DEV) console.log('Initializing KYC Commission...');
|
||||
if (import.meta.env.DEV) console.log('Proxy account:', COMMISSIONS.KYC.proxyAccount);
|
||||
|
||||
@@ -28,7 +28,7 @@ interface Proposal {
|
||||
|
||||
export function CommissionVotingTab() {
|
||||
const { t } = useTranslation();
|
||||
const { api, isApiReady, selectedAccount } = usePezkuwi();
|
||||
const { api, isApiReady, selectedAccount, walletSource } = usePezkuwi();
|
||||
const { toast } = useToast();
|
||||
|
||||
const [loading, setLoading] = useState(true);
|
||||
@@ -150,9 +150,8 @@ export function CommissionVotingTab() {
|
||||
|
||||
setVoting(proposal.hash);
|
||||
try {
|
||||
const { web3Enable, web3FromAddress } = await import('@pezkuwi/extension-dapp');
|
||||
await web3Enable('PezkuwiChain');
|
||||
const injector = await web3FromAddress(selectedAccount.address);
|
||||
const { getSigner } = await import('@/lib/get-signer');
|
||||
const injector = await getSigner(selectedAccount.address, walletSource, api);
|
||||
|
||||
if (import.meta.env.DEV) console.log(`Voting ${approve ? 'AYE' : 'NAY'} on proposal:`, proposal.hash);
|
||||
|
||||
@@ -258,9 +257,8 @@ export function CommissionVotingTab() {
|
||||
|
||||
setVoting(proposal.hash);
|
||||
try {
|
||||
const { web3Enable, web3FromAddress } = await import('@pezkuwi/extension-dapp');
|
||||
await web3Enable('PezkuwiChain');
|
||||
const injector = await web3FromAddress(selectedAccount.address);
|
||||
const { getSigner } = await import('@/lib/get-signer');
|
||||
const injector = await getSigner(selectedAccount.address, walletSource, api);
|
||||
|
||||
if (import.meta.env.DEV) console.log('Executing proposal:', proposal.hash);
|
||||
|
||||
@@ -433,9 +431,8 @@ export function CommissionVotingTab() {
|
||||
if (!api || !selectedAccount) return;
|
||||
|
||||
try {
|
||||
const { web3Enable, web3FromAddress } = await import('@pezkuwi/extension-dapp');
|
||||
await web3Enable('PezkuwiChain');
|
||||
const injector = await web3FromAddress(selectedAccount.address);
|
||||
const { getSigner } = await import('@/lib/get-signer');
|
||||
const injector = await getSigner(selectedAccount.address, walletSource, api);
|
||||
|
||||
// Get current members
|
||||
const currentMembers = await api.query.dynamicCommissionCollective.members();
|
||||
|
||||
@@ -21,7 +21,7 @@ import type { PendingApproval } from '@pezkuwi/lib/citizenship-workflow';
|
||||
export function KycApprovalTab() {
|
||||
const { t } = useTranslation();
|
||||
// identityKyc pallet is on People Chain - use peopleApi
|
||||
const { peopleApi, isPeopleReady, selectedAccount, connectWallet } = usePezkuwi();
|
||||
const { peopleApi, isPeopleReady, selectedAccount, connectWallet, walletSource } = usePezkuwi();
|
||||
const { toast } = useToast();
|
||||
|
||||
const [loading, setLoading] = useState(true);
|
||||
@@ -75,7 +75,7 @@ export function KycApprovalTab() {
|
||||
|
||||
setProcessingAddress(applicantAddress);
|
||||
try {
|
||||
const result = await approveReferral(peopleApi, selectedAccount, applicantAddress);
|
||||
const result = await approveReferral(peopleApi, selectedAccount, applicantAddress, walletSource);
|
||||
|
||||
if (!result.success) {
|
||||
toast({
|
||||
|
||||
Reference in New Issue
Block a user