@tenderly/hardhat-tenderly
Advanced tools
Comparing version 2.0.1 to 2.1.0-beta.0
@@ -26,4 +26,4 @@ import { HardhatRuntimeEnvironment } from "hardhat/types"; | ||
private _getContractData; | ||
private isVerificationOnPlatform; | ||
private _isVerificationOnPlatform; | ||
} | ||
//# sourceMappingURL=Tenderly.d.ts.map |
@@ -55,3 +55,3 @@ "use strict"; | ||
} | ||
if (this.isVerificationOnPlatform(verificationType)) { | ||
if (this._isVerificationOnPlatform(verificationType)) { | ||
logger_1.logger.info(`Network parameter is set to '${this.getNetworkName()}', redirecting to ${verificationType} verification.`); | ||
@@ -108,3 +108,3 @@ await this._throwIfUsernameOrProjectNotSet(); | ||
logger_1.logger.info("Invoked devnet verification through API request. (Multi compiler version)"); | ||
if (!(0, util_1.isTenderlyNetworkName)(this.env.network.name)) { | ||
if (!(0, util_1.isTenderlyNetworkConfig)(this.env.network.config)) { | ||
logger_1.logger.error(`Error in ${constants_2.PLUGIN_NAME}: Network parameter is not set to 'devnet' and verifyDevnetMultiCompilerAPI() is only available for tenderly devnet deployments, please use --network devnet.`); | ||
@@ -128,7 +128,7 @@ return; | ||
_getVerificationType() { | ||
if ((0, util_1.isTenderlyNetworkName)(this.env.network.name)) { | ||
if ((0, util_1.isTenderlyNetworkConfig)(this.env.network.config)) { | ||
return this.tenderlyNetwork.devnetID !== undefined ? constants_2.VERIFICATION_TYPES.DEVNET : constants_2.VERIFICATION_TYPES.FORK; | ||
} | ||
const priv = this.env.config.tenderly?.privateVerification; | ||
if (priv !== undefined && priv && !(0, util_1.isTenderlyNetworkName)(this.env.network.name)) { | ||
if (priv !== undefined && priv && !(0, util_1.isTenderlyNetworkConfig)(this.env.network.config)) { | ||
return constants_2.VERIFICATION_TYPES.PRIVATE; | ||
@@ -151,3 +151,3 @@ } | ||
logger_1.logger.info("Invoked public verification through API request."); | ||
if ((0, util_1.isTenderlyNetworkName)(this.env.network.name)) { | ||
if ((0, util_1.isTenderlyNetworkConfig)(this.env.network.config)) { | ||
if (this._getVerificationType() === constants_2.VERIFICATION_TYPES.DEVNET) { | ||
@@ -172,3 +172,3 @@ logger_1.logger.error(`Error in ${constants_2.PLUGIN_NAME}: Network parameter is set to '${this.getNetworkName()}' and verifyAPI() is not available for devnet deployments.`); | ||
logger_1.logger.info("Invoked pushing contracts through API."); | ||
if ((0, util_1.isTenderlyNetworkName)(this.env.network.name)) { | ||
if ((0, util_1.isTenderlyNetworkConfig)(this.env.network.config)) { | ||
if (this._getVerificationType() === constants_2.VERIFICATION_TYPES.DEVNET) { | ||
@@ -306,3 +306,3 @@ logger_1.logger.error(`Error in ${constants_2.PLUGIN_NAME}: Network parameter is set to '${this.getNetworkName()}' and pushAPI() is not available for devnet deployments.`); | ||
} | ||
isVerificationOnPlatform(verificationType) { | ||
_isVerificationOnPlatform(verificationType) { | ||
return verificationType === constants_2.VERIFICATION_TYPES.DEVNET || verificationType === constants_2.VERIFICATION_TYPES.FORK; | ||
@@ -309,0 +309,0 @@ } |
@@ -63,3 +63,3 @@ "use strict"; | ||
const extendProvider = (hre) => { | ||
if (!(0, util_1.isTenderlyNetworkName)(hre.network.name)) { | ||
if (!(0, util_1.isTenderlyNetworkConfig)(hre.network.config)) { | ||
logger_2.logger.info(`Used network is not 'tenderly' so there is no extending of the provider.`); | ||
@@ -66,0 +66,0 @@ return; |
@@ -46,3 +46,5 @@ "use strict"; | ||
this.host = this.tenderlyJsonRpc.defaults.baseURL; | ||
if ((0, util_1.isTenderlyNetworkName)(hre.network.name) && "url" in hre.network.config && hre.network.config.url !== undefined) { | ||
if ((0, util_1.isTenderlyNetworkConfig)(hre.network.config) && | ||
"url" in hre.network.config && | ||
hre.network.config.url !== undefined) { | ||
if (hre.network.config.url.includes("devnet")) { | ||
@@ -234,3 +236,3 @@ this.devnetID = hre.network.config.url.split("/").pop(); | ||
_checkNetwork() { | ||
if (!(0, util_1.isTenderlyNetworkName)(this.env.network.name)) { | ||
if (!(0, util_1.isTenderlyNetworkConfig)(this.env.network.config)) { | ||
logger_1.logger.error(`Warning in ${constants_2.PLUGIN_NAME}: Network is not set to 'tenderly'. Please call the task again with --network tenderly`); | ||
@@ -237,0 +239,0 @@ return false; |
import { HardhatConfig } from "hardhat/src/types/config"; | ||
import { CompilationJob, HardhatRuntimeEnvironment } from "hardhat/types"; | ||
import { CompilationJob, HardhatRuntimeEnvironment, NetworkConfig } from "hardhat/types"; | ||
import { TenderlyContract, TenderlyContractConfig, TenderlyVerifyContractsRequest } from "tenderly/types"; | ||
@@ -13,4 +13,4 @@ import { ContractByName, Metadata } from "../tenderly/types"; | ||
export declare const extractCompilerVersion: (config: HardhatConfig, sourcePath?: string, versionPragma?: string) => string; | ||
export declare const isTenderlyNetworkName: (name: string) => boolean; | ||
export declare const isTenderlyNetworkConfig: (nw: NetworkConfig) => boolean; | ||
export declare const classFunctions: (x: any) => string[]; | ||
//# sourceMappingURL=util.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.classFunctions = exports.isTenderlyNetworkName = exports.extractCompilerVersion = exports.newCompilerConfig = exports.compareConfigs = exports.resolveDependencies = exports.getContracts = exports.getCompilerDataFromContracts = exports.getCompilationJob = exports.makeVerifyContractsRequest = void 0; | ||
exports.classFunctions = exports.isTenderlyNetworkConfig = exports.extractCompilerVersion = exports.newCompilerConfig = exports.compareConfigs = exports.resolveDependencies = exports.getContracts = exports.getCompilerDataFromContracts = exports.getCompilationJob = exports.makeVerifyContractsRequest = void 0; | ||
const plugins_1 = require("hardhat/plugins"); | ||
@@ -24,10 +24,10 @@ const constants_1 = require("tenderly/common/constants"); | ||
} | ||
const network = hre.hardhatArguments.network; | ||
if (network === undefined) { | ||
const networkName = hre.hardhatArguments.network; | ||
if (networkName === undefined) { | ||
logger_1.logger.error(`Error in ${constants_2.PLUGIN_NAME}: Please provide a network via the hardhat --network argument or directly in the contract`); | ||
return null; | ||
} | ||
logger_1.logger.trace("Found network is:", network); | ||
logger_1.logger.trace("Found network is:", networkName); | ||
let chainId = undefined; | ||
if ((0, exports.isTenderlyNetworkName)(network) && platformID !== undefined) { | ||
if ((0, exports.isTenderlyNetworkConfig)(hre.config.networks[networkName]) && platformID !== undefined) { | ||
chainId = platformID; | ||
@@ -38,6 +38,6 @@ } | ||
} | ||
else if (constants_1.NETWORK_NAME_CHAIN_ID_MAP[network.toLowerCase()] !== undefined) { | ||
chainId = constants_1.NETWORK_NAME_CHAIN_ID_MAP[network.toLowerCase()].toString(); | ||
else if (constants_1.NETWORK_NAME_CHAIN_ID_MAP[networkName.toLowerCase()] !== undefined) { | ||
chainId = constants_1.NETWORK_NAME_CHAIN_ID_MAP[networkName.toLowerCase()].toString(); | ||
} | ||
logger_1.logger.trace(`ChainId for network '${network}' is ${chainId}`); | ||
logger_1.logger.trace(`ChainId for network '${networkName}' is ${chainId}`); | ||
if (chainId === undefined) { | ||
@@ -333,6 +333,21 @@ logger_1.logger.error(`Error in ${constants_2.PLUGIN_NAME}: Couldn't identify network. Please provide a chainId in the network config object`); | ||
exports.extractCompilerVersion = extractCompilerVersion; | ||
const isTenderlyNetworkName = (name) => { | ||
return name === "tenderly" || name === "devnet"; | ||
// isTenderlyNetworkConfig checks if a network is available on tenderly by checking the rpc_url. | ||
// This is done so the user can put custom network names in the hardhat config and still use them with tenderly. | ||
// This is also done so the user can use multiple tenderly networks in their hardhat config file. | ||
const isTenderlyNetworkConfig = (nw) => { | ||
if (nw === undefined || nw === null) { | ||
return false; | ||
} | ||
if (!isHttpNetworkConfig(nw)) { | ||
return false; | ||
} | ||
// The network is available on tenderly if the rpc_url contains `tenderly.co` | ||
const regex = /^.*tenderly\.co\/.*/; | ||
return regex.test(nw.url); | ||
// return name === "tenderly" || name === "devnet" | ||
}; | ||
exports.isTenderlyNetworkName = isTenderlyNetworkName; | ||
exports.isTenderlyNetworkConfig = isTenderlyNetworkConfig; | ||
function isHttpNetworkConfig(config) { | ||
return config.url !== undefined; | ||
} | ||
const determineCompilerConfig = (compilers, contractCompiler) => { | ||
@@ -339,0 +354,0 @@ for (const compiler of compilers) { |
@@ -7,3 +7,3 @@ { | ||
"description": "Hardhat plugin for integration with Tenderly", | ||
"version": "2.0.1", | ||
"version": "2.1.0-beta.0", | ||
"main": "dist/index.js", | ||
@@ -58,3 +58,3 @@ "types": "dist/index.d.ts", | ||
"hardhat-deploy": "^0.11.43", | ||
"tenderly": "^0.7.0", | ||
"tenderly": "^0.8.0-beta.0", | ||
"ts-node": "^10.9.1", | ||
@@ -61,0 +61,0 @@ "tslog": "^4.3.1", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
185369
2200
1
+ Addedtenderly@0.8.0(transitive)
- Removedtenderly@0.7.0(transitive)
Updatedtenderly@^0.8.0-beta.0