mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +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 };
|
||
|
};
|