Skip to content

Commit

Permalink
🐻‍❄️ Consider only polkadot accounts from wallet (#5696)
Browse files Browse the repository at this point in the history
  • Loading branch information
WRadoslaw committed Dec 29, 2023
1 parent bd4c461 commit 6e0d0b5
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions packages/atlas/src/providers/wallet/wallet.provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ export const WalletProvider: FC<PropsWithChildren> = ({ children }) => {

const setWalletAccounts = useCallback(
async (accounts: WalletAccount[]) => {
const mappedAccounts = accounts.map((account) => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const polkadotAccounts = accounts.filter((account: any) => account.type === 'sr25519')

const mappedAccounts = polkadotAccounts.map((account) => {
return {
...account,
address: formatJoystreamAddress(account.address),
Expand All @@ -56,16 +59,17 @@ export const WalletProvider: FC<PropsWithChildren> = ({ children }) => {
// taken from https://github.com/TalismanSociety/talisman-connect/blob/47cfefee9f1333326c0605c159d6ee8ebfba3e84/libs/wallets/src/lib/base-dotsama-wallet/index.ts#L98-L107
// should be part of future talisman-connect release
const accounts = await selectedWallet.extension.accounts.get()
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const accountsWithWallet = accounts.map((account: any) => {
return {
...account,
address: formatJoystreamAddress(account.address),
source: selectedWallet.extension?.name as string,
wallet: selectedWallet,
signer: selectedWallet.extension?.signer,
}
})
const accountsWithWallet = accounts
// eslint-disable-next-line @typescript-eslint/no-explicit-any
.map((account: any) => {
return {
...account,
address: account.address,
source: selectedWallet.extension?.name as string,
wallet: selectedWallet,
signer: selectedWallet.extension?.signer,
}
})

setWalletAccounts(accountsWithWallet)
setWallet(selectedWallet)
Expand Down

0 comments on commit 6e0d0b5

Please sign in to comment.