UNPKG

hardhat-scilla-plugin

Version:
56 lines 1.79 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ContractDeployer = void 0; const plugins_1 = require("hardhat/plugins"); const ScillaContractDeployer_1 = require("./ScillaContractDeployer"); class ContractDeployer { constructor(hre) { this.hre = hre; this.contractName = ""; this.compress = false; this.userDefinedLibraries = null; this.txParams = null; this.contractParams = []; } reset() { this.contractName = ""; this.compress = false; this.userDefinedLibraries = null; this.txParams = null; this.contractParams = []; return this; } withName(contractName) { this.contractName = contractName; return this; } withContractParams(...params) { this.contractParams = params; return this; } withTxParams(params) { this.txParams = params; return this; } withContractCompression() { this.compress = true; return this; } withUserDefinedLibraries(libraries) { this.userDefinedLibraries = libraries; return this; } async deploy() { if (this.contractName.trim().length === 0) { throw new plugins_1.HardhatPluginError("hardhat-scilla-plugin", "You must specify the contract name in order to deploy it."); } if (this.txParams) { this.contractParams.push(this.txParams); } const contract = await (0, ScillaContractDeployer_1.deploy)(this.hre, this.contractName, this.compress, this.userDefinedLibraries, ...this.contractParams); this.reset(); return contract; } } exports.ContractDeployer = ContractDeployer; //# sourceMappingURL=Deployer.js.map