mirror of
https://github.com/pezkuwichain/pwap.git
synced 2026-04-22 02:07:55 +00:00
fix: remove web3Enable cache to prevent stale extension state
This commit is contained in:
@@ -17,16 +17,6 @@ interface SignerResult {
|
||||
signer: any; // Compatible with @pezkuwi/api Signer
|
||||
}
|
||||
|
||||
// Cache web3Enable to avoid "Too many authorization requests" error
|
||||
let enablePromise: Promise<unknown[]> | null = null;
|
||||
|
||||
async function ensureWeb3Enabled(): Promise<void> {
|
||||
if (!enablePromise) {
|
||||
enablePromise = web3Enable('PezkuwiChain');
|
||||
}
|
||||
await enablePromise;
|
||||
}
|
||||
|
||||
export async function getSigner(
|
||||
address: string,
|
||||
walletSource: WalletSource,
|
||||
@@ -45,7 +35,7 @@ export async function getSigner(
|
||||
}
|
||||
|
||||
// Extension or native: use web3FromAddress
|
||||
await ensureWeb3Enabled();
|
||||
await web3Enable('PezkuwiChain');
|
||||
const injector = await web3FromAddress(address);
|
||||
return injector;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user