Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If enable wallet is broken while in iframe and using pjs #702

Merged
merged 2 commits into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/pages/api/accounts-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,12 @@ async function fetchAccountsData(addresses: string[], method: 'POST' | 'GET') {
)
}

const domains = await getEnsNames(evmAddressesHuman)
let domains: Record<string, string[]> = {}
try {
domains = await getEnsNames(evmAddressesHuman)
} catch (err) {
console.error('Error fetching ENS names', err)
}

const needToFetchIdsPromise = addresses.map(async (address, i) => {
const evmAddress = evmAddressesHuman[i]
Expand Down
11 changes: 10 additions & 1 deletion src/stores/my-account.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { waitNewBlock } from '@/utils/blockchain'
import { currentNetwork } from '@/utils/network'
import { wait } from '@/utils/promise'
import { LocalStorage, LocalStorageAndForage } from '@/utils/storage'
import { isWebNotificationsEnabled } from '@/utils/window'
import { getIsInIframe, isWebNotificationsEnabled } from '@/utils/window'
import { Wallet, WalletAccount, getWallets } from '@talismn/connect-wallets'
import dayjs from 'dayjs'
import toast from 'react-hot-toast'
Expand Down Expand Up @@ -635,6 +635,15 @@ export async function enableWallet({
if (typeof unsub === 'function') unsub()
}
} catch (err) {
if (getIsInIframe() && preferredWallet.title === 'Polkadot.js') {
toast.custom((t) => (
<Toast
t={t}
title='Please retry this action in "Chat" page'
description='Click on "Chat" menu in the sidebar and retry your action in that page'
/>
))
}
console.error('Error enabling wallet', err)
onError(err)
}
Expand Down
Loading