UNPKG

@solarity/hardhat-gobind

Version:

Generation of smart contract bindings for Golang

33 lines 1.41 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getDefaultGoBindConfig = void 0; const path_1 = require("path"); const plugins_1 = require("hardhat/plugins"); const constants_1 = require("./constants"); const getDefaultGoBindConfig = (resolvedConfig, config) => { const defaultConfig = { outdir: "./generated-types/bindings", deployable: false, runOnCompile: false, abigenVersion: "v1", verbose: false, onlyFiles: [], skipFiles: [], }; if (config.gobind === undefined) { resolvedConfig.gobind = defaultConfig; return; } if (!areRelativePaths(config.gobind.onlyFiles)) { throw new plugins_1.NomicLabsHardhatPluginError(constants_1.pluginName, "config.gobind.onlyFiles must only include relative paths"); } if (!areRelativePaths(config.gobind.skipFiles)) { throw new plugins_1.NomicLabsHardhatPluginError(constants_1.pluginName, "config.gobind.skipFiles must only include relative paths"); } const { cloneDeep } = require("lodash"); const customConfig = cloneDeep(config.gobind); resolvedConfig.gobind = { ...defaultConfig, ...customConfig }; }; exports.getDefaultGoBindConfig = getDefaultGoBindConfig; const areRelativePaths = (array) => array === undefined || array.every((p) => !(0, path_1.isAbsolute)(p)); //# sourceMappingURL=config.js.map