loadContract
/**
* Load a contract from an existing contract address and a template
* @param {string} template name of the template to use (ERC721Mintable, ...)
* @param {string} contractAddress address of the contract to load
* @returns {Promise<ERC721Mintable>} Contract instance
*/
async loadContract({ template, contractAddress }) {
if (!template) {
throw new Error(
errorLogger({
location: ERROR_LOG.location.SDK_loadContract,
message: ERROR_LOG.message.no_template_type_supplied,
}),
);
}
if (!contractAddress) {
throw new Error(
errorLogger({
location: ERROR_LOG.location.SDK_loadContract,
message: ERROR_LOG.message.no_address_supplied,
}),
);
}
const signer = await this.getSigner();
const contract = ContractFactory.factory(template, signer);
await contract.loadContract({ contractAddress });
return contract;
}
Copy link