mirror of
https://github.com/pezkuwichain/pwap.git
synced 2026-07-23 22:25:43 +00:00
fix: remove unused getApprovedChainId and stale eslint-disable
This commit is contained in:
@@ -574,7 +574,6 @@ export const PezkuwiProvider: React.FC<PezkuwiProviderProps> = ({
|
|||||||
|
|
||||||
window.addEventListener('walletconnect_disconnected', handleWcDisconnect);
|
window.addEventListener('walletconnect_disconnected', handleWcDisconnect);
|
||||||
return () => window.removeEventListener('walletconnect_disconnected', handleWcDisconnect);
|
return () => window.removeEventListener('walletconnect_disconnected', handleWcDisconnect);
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
||||||
}, [walletSource]);
|
}, [walletSource]);
|
||||||
|
|
||||||
const value: PezkuwiContextType = {
|
const value: PezkuwiContextType = {
|
||||||
|
|||||||
@@ -30,28 +30,6 @@ let initPromise: Promise<SignClient> | null = null;
|
|||||||
let currentSession: SessionTypes.Struct | null = null;
|
let currentSession: SessionTypes.Struct | null = null;
|
||||||
let requestId = 0;
|
let requestId = 0;
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a chainId that is approved in the current WC session.
|
|
||||||
* The wallet determines actual signing chain from the payload's genesisHash,
|
|
||||||
* so the WC request chainId is only for WC protocol compliance.
|
|
||||||
*/
|
|
||||||
function getApprovedChainId(fallback: string): string {
|
|
||||||
if (!currentSession) return fallback;
|
|
||||||
const ns = currentSession.namespaces['polkadot'];
|
|
||||||
if (!ns) return fallback;
|
|
||||||
|
|
||||||
// Try chains array first
|
|
||||||
if (ns.chains && ns.chains.length > 0) return ns.chains[0];
|
|
||||||
|
|
||||||
// Derive from accounts (format: polkadot:<chain_id>:<address>)
|
|
||||||
if (ns.accounts && ns.accounts.length > 0) {
|
|
||||||
const parts = ns.accounts[0].split(':');
|
|
||||||
if (parts.length >= 2) return `${parts[0]}:${parts[1]}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
return fallback;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the WalletConnect SignClient (singleton with race protection)
|
* Initialize the WalletConnect SignClient (singleton with race protection)
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user