Catch the TypeError which occours when contractCode is undefined (#2314)
This commit is contained in:
parent
08953e36c0
commit
24069ca5bf
|
@ -62,7 +62,7 @@ const isHardwareWallet = (walletName: string) =>
|
||||||
const isSmartContractWallet = async (web3Provider: Web3, account: string): Promise<boolean> => {
|
const isSmartContractWallet = async (web3Provider: Web3, account: string): Promise<boolean> => {
|
||||||
const contractCode = await web3Provider.eth.getCode(account)
|
const contractCode = await web3Provider.eth.getCode(account)
|
||||||
|
|
||||||
return contractCode.replace(EMPTY_DATA, '').replace(/0/g, '') !== ''
|
return !!contractCode && contractCode.replace(EMPTY_DATA, '').replace(/0/g, '') !== ''
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getProviderInfo = async (web3Instance: Web3, providerName = 'Wallet'): Promise<ProviderProps> => {
|
export const getProviderInfo = async (web3Instance: Web3, providerName = 'Wallet'): Promise<ProviderProps> => {
|
||||||
|
|
Loading…
Reference in New Issue