Skip to content

Commit 553ab2d

Browse files
authored
Merge pull request #158 from ltfschoen/luke/evm
fix: Fixes #157 prevent crash if polkadot.js ext includes evm acct
2 parents 3506d5a + f345292 commit 553ab2d

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/components/web3/ConnectButton.tsx

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import {
1616
import Image from 'next/image'
1717
import Link from 'next/link'
1818
import { FC, useState } from 'react'
19-
import { AiOutlineCheckCircle, AiOutlineDisconnect } from 'react-icons/ai'
19+
import { AiOutlineCheckCircle, AiOutlineDisconnect, AiOutlineMeh } from 'react-icons/ai'
2020
import { FiExternalLink } from 'react-icons/fi'
2121
import { AccountName } from './AccountName' // Assuming AccountName is in the same directory
2222

@@ -138,6 +138,21 @@ export const ConnectButton: FC<ConnectButtonProps> = () => {
138138
<div className="overflow-scroll max-h-52 md:max-h-80">
139139
{chosenWallet &&
140140
(accounts || []).map((acc) => {
141+
if (acc.address.startsWith('0x')) {
142+
const truncatedEVMAddress = truncateHash(acc.address, 10)
143+
return (
144+
<div
145+
key={acc.address}
146+
className={`p-3 flex justify-between items-center cursor-pointer hover:bg-red-2 dark:hover:bg-red-18 transition duration-300}`}
147+
>
148+
<div>
149+
<AccountName account={acc} />
150+
<p className="text-xs">{truncatedEVMAddress}</p>
151+
</div>
152+
<AiOutlineMeh size={16} className="text-red-500" />
153+
</div>
154+
)
155+
}
141156
const encodedAddress = encodeAddress(acc.address, activeChain?.ss58Prefix || 42)
142157
const truncatedEncodedAddress = truncateHash(encodedAddress, 10)
143158
return (

0 commit comments

Comments
 (0)