deploy
/**
* Deploy Contract on the blockchain
* @param {string} template name of the template to use (ERC721Mintable, ...)
* @param {object} params template parameters (name, symbol, contractURI, ...)
* @returns {Promise<ERC721Mintable>} Contract instance
*/
async deploy({ template, params }) {
if (!template) {
throw new Error(
errorLogger({
location: ERROR_LOG.location.SDK_deploy,
message: ERROR_LOG.message.no_template_type_supplied,
}),
);
}
if (Object.keys(params).length === 0) {
throw new Error(
errorLogger({
location: ERROR_LOG.location.SDK_deploy,
message: ERROR_LOG.message.no_parameters_supplied,
}),
);
}
const signer = await this.getSigner();
const contract = ContractFactory.factory(template, signer);
await contract.deploy(params);
return contract;
}
Copy link