hardhat-deal
Version:
🎩🪄 Easily deal any amount of any ERC20 tokens to any account on the hardhat network
25 lines (24 loc) • 1.44 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.deal = void 0;
const config_1 = require("hardhat/config");
const cache_1 = require("./cache");
const constants_1 = require("./constants");
require("./tasks");
require("./types");
var helpers_1 = require("./helpers");
Object.defineProperty(exports, "deal", { enumerable: true, get: function () { return helpers_1.deal; } });
const defaultRpcEndpoints = {
setStorageAt: "hardhat_setStorageAt",
};
(0, config_1.extendConfig)((config, userConfig) => {
var _a, _b, _c, _d;
config.dealSlots = Object.assign(Object.assign({}, constants_1.defaultSlots), (0, cache_1.loadCache)((0, cache_1.getCachePath)((_b = (_a = userConfig.paths) === null || _a === void 0 ? void 0 : _a.cache) !== null && _b !== void 0 ? _b : config.paths.cache)), Object.fromEntries(Object.entries((_c = userConfig.dealSlots) !== null && _c !== void 0 ? _c : {}).map(([address, slot]) => [
address.toLowerCase(),
slot,
])));
for (const [networkName, network] of Object.entries((_d = userConfig.networks) !== null && _d !== void 0 ? _d : {})) {
const rpcEndpoints = ((network === null || network === void 0 ? void 0 : network.chainId) !== 1337 && (network === null || network === void 0 ? void 0 : network.rpcEndpoints)) || {};
config.networks[networkName].rpcEndpoints = Object.assign({}, defaultRpcEndpoints, rpcEndpoints);
}
});