@enjinstarter/hardhat-oklink-verify
Version:
Hardhat plugin for verifying contracts on OKLink
34 lines (32 loc) • 1.06 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.resolveOklinkApiKey = void 0;
const plugins_1 = require("hardhat/plugins");
const constants_1 = require("./constants");
const resolveOklinkApiKey = (apiKey, network) => {
if (apiKey === undefined || apiKey === "") {
throwMissingApiKeyError(network);
}
if (typeof apiKey === "string") {
return apiKey;
}
const key = apiKey[network];
if (key === undefined || key === "") {
throwMissingApiKeyError(network);
}
return key;
};
exports.resolveOklinkApiKey = resolveOklinkApiKey;
function throwMissingApiKeyError(network) {
throw new plugins_1.NomicLabsHardhatPluginError(constants_1.pluginName, `You are trying to verify a contract in '${network}', but no API token was found for this network. Please provide one in your hardhat config. For example:
{
...
oklink: {
apiKey: {
${network}: 'your API key'
}
}
}
See https://www.oklink.com/docs/en/`);
}
//# sourceMappingURL=resolveOklinkApiKey.js.map