mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-25 11:28:51 +01:00
13 lines
340 B
JavaScript
13 lines
340 B
JavaScript
|
export const readAddressAsContract = async (ethQuery, address) => {
|
||
|
let contractCode;
|
||
|
try {
|
||
|
contractCode = await ethQuery.getCode(address);
|
||
|
} catch (e) {
|
||
|
contractCode = null;
|
||
|
}
|
||
|
|
||
|
const isContractAddress =
|
||
|
contractCode && contractCode !== '0x' && contractCode !== '0x0';
|
||
|
return { contractCode, isContractAddress };
|
||
|
};
|