hardhat-scilla-plugin
Version:
Hardhat TypeScript plugin for scilla testing
59 lines • 3.89 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.scillaChaiEventMatcher = exports.BN = exports.ZilliqaHardhatObject = exports.initZilliqa = void 0;
const config_1 = require("hardhat/config");
const plugins_1 = require("hardhat/plugins");
const Deployer_1 = require("./deployer/Deployer");
const ScillaContractDeployer_1 = require("./deployer/ScillaContractDeployer");
const ScillaContractInteractor_1 = require("./deployer/ScillaContractInteractor");
const ScillaContractsInfoUpdater_1 = require("./parser/ScillaContractsInfoUpdater");
require("./task-extensions");
// This import is needed to let the TypeScript compiler know that it should include your type
// extensions in your npm package's types file.
require("./type-extensions");
const ZilliqaHardhatObject_1 = require("./ZilliqaHardhatObject");
var ScillaContractDeployer_2 = require("./deployer/ScillaContractDeployer");
Object.defineProperty(exports, "initZilliqa", { enumerable: true, get: function () { return ScillaContractDeployer_2.initZilliqa; } });
var ZilliqaHardhatObject_2 = require("./ZilliqaHardhatObject");
Object.defineProperty(exports, "ZilliqaHardhatObject", { enumerable: true, get: function () { return ZilliqaHardhatObject_2.ZilliqaHardhatObject; } });
var util_1 = require("@zilliqa-js/util");
Object.defineProperty(exports, "BN", { enumerable: true, get: function () { return util_1.BN; } });
var ScillaChaiMatchers_1 = require("./chai-matcher/ScillaChaiMatchers");
Object.defineProperty(exports, "scillaChaiEventMatcher", { enumerable: true, get: function () { return ScillaChaiMatchers_1.scillaChaiEventMatcher; } });
(0, config_1.extendEnvironment)((hre) => {
// We add a field to the Hardhat Runtime Environment here.
// We use lazyObject to avoid initializing things until they are actually
// needed.
hre.scillaContracts = (0, plugins_1.lazyObject)(() => (0, ScillaContractsInfoUpdater_1.loadScillaContractsInfo)());
hre.contractDeployer = (0, plugins_1.lazyObject)(() => new Deployer_1.ContractDeployer(hre));
hre.setScillaDefaults = (0, plugins_1.lazyFunction)(() => (params) => {
return (0, ScillaContractDeployer_1.updateSetup)(params);
});
hre.interactWithScillaContract = (0, plugins_1.lazyFunction)(() => async (contractAddress) => {
return (0, ScillaContractInteractor_1.contractFromAddress)(hre, contractAddress);
});
hre.deployScillaContract = (0, plugins_1.lazyFunction)(() => async (contractName, ...args) => {
return (0, ScillaContractDeployer_1.deploy)(hre, contractName, false, [], ...args);
});
hre.deployScillaContractWithLib = (0, plugins_1.lazyFunction)(() => async (contractName, userDefinedLibraries, ...args) => {
return (0, ScillaContractDeployer_1.deploy)(hre, contractName, false, userDefinedLibraries, ...args);
});
hre.deployScillaLibrary = (0, plugins_1.lazyFunction)(() => async (libraryName, compress) => {
return (0, ScillaContractDeployer_1.deployLibrary)(hre, libraryName, compress);
});
hre.deployScillaFile = (0, plugins_1.lazyFunction)(() => async (contractPath, init, compress) => {
return (0, ScillaContractDeployer_1.deployFromFile)(contractPath, init, compress, {});
});
hre.zilliqa = (0, plugins_1.lazyObject)(() => (0, ZilliqaHardhatObject_1.loadZilliqaHardhatObject)(hre));
hre.getZilliqaChainId = (0, plugins_1.lazyFunction)(() => () => hre.network.config.chainId & 0x7fff);
hre.getNetworkUrl = (0, plugins_1.lazyFunction)(() => () => {
return hre.network.config.url;
});
hre.getPrivateKeys = (0, plugins_1.lazyFunction)(() => () => {
return hre.network.config.accounts;
});
hre.setActiveAccount = (0, plugins_1.lazyFunction)(() => (indexOrAccount) => {
(0, ScillaContractDeployer_1.setAccount)(indexOrAccount);
});
});
//# sourceMappingURL=index.js.map