Skip to content
Snippets Groups Projects
Commit 117ac27a authored by Niklas P's avatar Niklas P
Browse files

fix wallet init in chrome 9

parent 71397581
No related branches found
No related tags found
No related merge requests found
......@@ -28,22 +28,26 @@ export const PolkadotExtensionProvider = ( { children } : { children : ReactNode
const initWalletExtension = async () => {
if (typeof window !== "undefined" ) {
const installedWallets = getWallets().filter(wallet => wallet.installed)
console.log( 'installedWallets', installedWallets )
const firstWallet = installedWallets[0]
console.log( 'firstWallet', firstWallet )
// enable the wallet
try {
await firstWallet?.enable( "Polkadot Tokengated Demo" )
await firstWallet?.subscribeAccounts((allAccounts: WalletAccount[] | undefined) => {
console.log("got accounts via talisman connect", allAccounts)
if ( accounts === undefined || accounts.length === 0 ) {
setAccounts( allAccounts )
setActingAccountIdx( 0 )
}
});
} catch (error) {
console.log( error )
}
setIsInitialized( true )
if (firstWallet) {
try {
await firstWallet?.enable( "Polkadot Tokengated Demo" )
await firstWallet?.subscribeAccounts((allAccounts: WalletAccount[] | undefined) => {
console.log("got accounts via talisman connect", allAccounts)
if ( accounts === undefined || accounts.length === 0 ) {
setAccounts( allAccounts )
setActingAccountIdx( 0 )
}
});
} catch (error) {
console.log( error )
}
setIsInitialized( true )
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment