UNPKG

@iexec/dataprotector

Version:

This product enables users to confidentially store data–such as mail address, documents, personal information ...

16 lines 773 B
import { id } from 'ethers'; import { KEY_PURPOSE_SELECTOR } from '../config/config.js'; /** * Checks if a contract at the given address contains specific function selectors in its bytecode. * * @param iexec - The IExec instance. * @param whitelistAddress - The address of the contract to check. * @returns True if the contract contains the required function selectors; false otherwise. */ export const isERC734 = async (iexec, whitelistAddress) => { const contractClient = await iexec.config.resolveContractsClient(); // Fetch the contract's bytecode const contractBytecode = await contractClient.provider.getCode(whitelistAddress); return contractBytecode.includes(id(KEY_PURPOSE_SELECTOR).substring(2, 10)); }; //# sourceMappingURL=whitelist.js.map