fix address copy

pull/4518/head
aniket-engg 10 months ago committed by yann300
parent d9e307e9ab
commit 203272b734
  1. 5
      libs/remix-ui/run-tab/src/lib/actions/account.ts
  2. 4
      libs/remix-ui/run-tab/src/lib/components/account.tsx

@ -2,7 +2,7 @@ import { shortenAddress } from "@remix-ui/helper"
import { RunTab } from "../types/run-tab"
import { clearInstances, setAccount, setExecEnv } from "./actions"
import { displayNotification, displayPopUp, fetchAccountsListFailed, fetchAccountsListRequest, fetchAccountsListSuccess, setMatchPassphrase, setPassphrase } from "./payload"
import { RunTabState } from "../types"
import { toChecksumAddress } from '@ethereumjs/util'
export const updateAccountBalances = async (plugin: RunTab, dispatch: React.Dispatch<any>) => {
const accounts = plugin.REACT_API.accounts.loadedAccounts
@ -37,8 +37,7 @@ export const fillAccountsList = async (plugin: RunTab, dispatch: React.Dispatch<
if (provider === 'injected') {
const selectedAddress = plugin.blockchain.getInjectedWeb3Address()
if (!(Object.keys(loadedAccounts).includes(selectedAddress))) setAccount(dispatch, null)
if (!(Object.keys(loadedAccounts).includes(toChecksumAddress(selectedAddress)))) setAccount(dispatch, null)
}
dispatch(fetchAccountsListSuccess(loadedAccounts))
}).catch((e) => {

@ -18,7 +18,9 @@ export function AccountUI(props: AccountProps) {
const intl = useIntl()
useEffect(() => {
if (!selectedAccount && accounts.length > 0) props.setAccount(accounts[0])
if ((!selectedAccount || !accounts.includes(selectedAccount)) && accounts.length > 0) {
props.setAccount(accounts[0])
}
}, [accounts, selectedAccount])
useEffect(() => {

Loading…
Cancel
Save