UNPKG

@matterlabs/hardhat-zksync-deploy

Version:
47 lines 2.2 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.DeployerExtension = void 0; const deployer_helper_1 = require("./deployer-helper"); const plugin_1 = require("./plugin"); class DeployerExtension { constructor(_hre) { this._hre = _hre; } async loadArtifact(contractNameOrFullyQualifiedName) { return await (0, deployer_helper_1.loadArtifact)(this._hre, contractNameOrFullyQualifiedName); } async deploy(contractNameOrArtifact, constructorArguments = [], deploymentType, overrides, additionalFactoryDeps) { if (!this.wallet) { this.wallet = await this.getWallet(); } return await (0, deployer_helper_1.deploy)(this._hre, contractNameOrArtifact, constructorArguments, this.wallet, deploymentType, overrides, additionalFactoryDeps); } async estimateDeployFee(artifact, constructorArguments) { if (!this.wallet) { this.wallet = await this.getWallet(); } return await (0, deployer_helper_1.estimateDeployFee)(this._hre, artifact, constructorArguments, this.wallet); } async estimateDeployGas(artifact, constructorArguments, deploymentType) { if (!this.wallet) { this.wallet = await this.getWallet(); } return await (0, deployer_helper_1.estimateDeployGas)(this._hre, artifact, constructorArguments, this.wallet, deploymentType); } setWallet(wallet) { this.wallet = wallet; } async getWallet(privateKeyOrAccountNumber) { if (!this.ethWeb3Provider || !this.zkWeb3Provider) { const { ethWeb3Provider, zkWeb3Provider } = (0, deployer_helper_1.createProviders)(this._hre.config.networks, this._hre.network); this.ethWeb3Provider = ethWeb3Provider; this.zkWeb3Provider = zkWeb3Provider; } const wallet = (await (0, plugin_1.getWallet)(this._hre, privateKeyOrAccountNumber ?? (0, plugin_1.getNetworkAccount)(this._hre))) .connect(this.zkWeb3Provider) .connectToL1(this.ethWeb3Provider); return wallet; } } exports.DeployerExtension = DeployerExtension; //# sourceMappingURL=deployer-extension.js.map