setRoyalties
/**
* Set royalties information for the receiver address with the provided fee
* @param {string} - address
* @param {number} - fee
* @notice Warning: This method will consume gas (49000 gas estimated)
* @returns {Promise<ethers.providers.TransactionResponse>} - Transaction
*/
async setRoyalties({ publicAddress, fee }) {
if (!this.#contractDeployed && !this.contractAddress) {
throw new Error('[ERC721Mintable.setRoyalties] Contract needs to be deployed');
}
if (!publicAddress || !utils.isAddress(publicAddress)) {
throw new Error('[ERC721Mintable.setRoyalties] Address is required');
}
if (!fee || !Number.isInteger(fee) || !(fee > 0 && fee < 10000)) {
throw new Error(
'[ERC721Mintable.setRoyalties] Fee as numeric value between 0 and 10000 is required',
);
}
try {
return await this.#contractDeployed.setRoyalties(publicAddress, fee, {
gasLimit: this.#gasLimit,
});
} catch (error) {
const { message, type } = networkErrorHandler(error);
throw new Error(`${type}[ERC721Mintable.setRoyalties] An error occured: ${message}`);
}
}
Copy link