Socket
Socket
Sign inDemoInstall

@nomiclabs/hardhat-ethers

Package Overview
Dependencies
293
Maintainers
4
Versions
18
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.1.1 to 2.2.0

2

internal/helpers.d.ts

@@ -12,3 +12,5 @@ import type { ethers } from "ethers";

export declare function getContractAt(hre: HardhatRuntimeEnvironment, nameOrAbi: string | any[], address: string, signer?: ethers.Signer): Promise<ethers.Contract>;
export declare function deployContract(hre: HardhatRuntimeEnvironment, name: string, args?: any[], signerOrOptions?: ethers.Signer | FactoryOptions): Promise<ethers.Contract>;
export declare function deployContract(hre: HardhatRuntimeEnvironment, name: string, signerOrOptions?: ethers.Signer | FactoryOptions): Promise<ethers.Contract>;
export declare function getContractAtFromArtifact(hre: HardhatRuntimeEnvironment, artifact: Artifact, address: string, signer?: ethers.Signer): Promise<ethers.Contract>;
//# sourceMappingURL=helpers.d.ts.map

@@ -22,3 +22,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.getContractAtFromArtifact = exports.getContractAt = exports.getContractFactoryFromArtifact = exports.getContractFactory = exports.getImpersonatedSigner = exports.getSigner = exports.getSigners = void 0;
exports.getContractAtFromArtifact = exports.deployContract = exports.getContractAt = exports.getContractFactoryFromArtifact = exports.getContractFactory = exports.getImpersonatedSigner = exports.getSigner = exports.getSigners = void 0;
const plugins_1 = require("hardhat/plugins");

@@ -70,3 +70,2 @@ const pluginName = "hardhat-ethers";

async function getContractFactoryFromArtifact(hre, artifact, signerOrOptions) {
var _a;
let libraries = {};

@@ -79,3 +78,3 @@ let signer;

signer = signerOrOptions.signer;
libraries = (_a = signerOrOptions.libraries) !== null && _a !== void 0 ? _a : {};
libraries = signerOrOptions.libraries ?? {};
}

@@ -195,2 +194,14 @@ else {

exports.getContractAt = getContractAt;
async function deployContract(hre, name, argsOrSignerOrOptions, signerOrOptions) {
let args = [];
if (Array.isArray(argsOrSignerOrOptions)) {
args = argsOrSignerOrOptions;
}
else {
signerOrOptions = argsOrSignerOrOptions;
}
const factory = await getContractFactory(hre, name, signerOrOptions);
return factory.deploy(...args);
}
exports.deployContract = deployContract;
async function getContractAtFromArtifact(hre, artifact, address, signer) {

@@ -230,3 +241,6 @@ if (!isArtifact(artifact)) {

}
modifiedAbi.push(Object.assign(Object.assign({}, abiElement), { gas: gasLimit }));
modifiedAbi.push({
...abiElement,
gas: gasLimit,
});
}

@@ -233,0 +247,0 @@ return modifiedAbi;

@@ -19,8 +19,18 @@ "use strict";

const providerProxy = createProviderProxy(hre.network.provider);
return Object.assign(Object.assign({}, ethers), { provider: providerProxy, getSigner: (address) => (0, helpers_1.getSigner)(hre, address), getSigners: () => (0, helpers_1.getSigners)(hre), getImpersonatedSigner: (address) => (0, helpers_1.getImpersonatedSigner)(hre, address),
return {
...ethers,
provider: providerProxy,
getSigner: (address) => (0, helpers_1.getSigner)(hre, address),
getSigners: () => (0, helpers_1.getSigners)(hre),
getImpersonatedSigner: (address) => (0, helpers_1.getImpersonatedSigner)(hre, address),
// We cast to any here as we hit a limitation of Function#bind and
// overloads. See: https://github.com/microsoft/TypeScript/issues/28582
getContractFactory: helpers_1.getContractFactory.bind(null, hre), getContractFactoryFromArtifact: helpers_1.getContractFactoryFromArtifact.bind(null, hre), getContractAt: helpers_1.getContractAt.bind(null, hre), getContractAtFromArtifact: helpers_1.getContractAtFromArtifact.bind(null, hre) });
getContractFactory: helpers_1.getContractFactory.bind(null, hre),
getContractFactoryFromArtifact: helpers_1.getContractFactoryFromArtifact.bind(null, hre),
getContractAt: helpers_1.getContractAt.bind(null, hre),
getContractAtFromArtifact: helpers_1.getContractAtFromArtifact.bind(null, hre),
deployContract: helpers_1.deployContract.bind(null, hre),
};
});
});
//# sourceMappingURL=index.js.map

6

package.json
{
"name": "@nomiclabs/hardhat-ethers",
"version": "2.1.1",
"version": "2.2.0",
"description": "Hardhat plugin for ethers",

@@ -44,4 +44,4 @@ "homepage": "https://github.com/nomiclabs/hardhat/tree/master/packages/hardhat-ethers",

"@types/mocha": "^9.1.0",
"@types/node": "^12.0.0",
"@typescript-eslint/eslint-plugin": "4.29.2",
"@types/node": "^14.0.0",
"@typescript-eslint/eslint-plugin": "^5.30.7",
"@typescript-eslint/parser": "4.29.2",

@@ -48,0 +48,0 @@ "chai": "^4.2.0",

@@ -339,2 +339,31 @@ import type { ethers } from "ethers";

export async function deployContract(
hre: HardhatRuntimeEnvironment,
name: string,
args?: any[],
signerOrOptions?: ethers.Signer | FactoryOptions
): Promise<ethers.Contract>;
export async function deployContract(
hre: HardhatRuntimeEnvironment,
name: string,
signerOrOptions?: ethers.Signer | FactoryOptions
): Promise<ethers.Contract>;
export async function deployContract(
hre: HardhatRuntimeEnvironment,
name: string,
argsOrSignerOrOptions?: any[] | ethers.Signer | FactoryOptions,
signerOrOptions?: ethers.Signer | FactoryOptions
): Promise<ethers.Contract> {
let args = [];
if (Array.isArray(argsOrSignerOrOptions)) {
args = argsOrSignerOrOptions;
} else {
signerOrOptions = argsOrSignerOrOptions;
}
const factory = await getContractFactory(hre, name, signerOrOptions);
return factory.deploy(...args);
}
export async function getContractAtFromArtifact(

@@ -341,0 +370,0 @@ hre: HardhatRuntimeEnvironment,

@@ -15,2 +15,3 @@ import type EthersT from "ethers";

getSigners,
deployContract,
} from "./helpers";

@@ -56,4 +57,5 @@ import "./type-extensions";

getContractAtFromArtifact: getContractAtFromArtifact.bind(null, hre),
deployContract: deployContract.bind(null, hre) as any,
};
});
});

@@ -25,2 +25,13 @@ import type * as ethers from "ethers";

export declare function deployContract(
name: string,
signerOrOptions?: ethers.Signer | FactoryOptions
): Promise<ethers.Contract>;
export declare function deployContract(
name: string,
args: any[],
signerOrOptions?: ethers.Signer | FactoryOptions
): Promise<ethers.Contract>;
export interface HardhatEthersHelpers {

@@ -47,2 +58,3 @@ provider: ethers.providers.JsonRpcProvider;

getImpersonatedSigner: (address: string) => Promise<SignerWithAddress>;
deployContract: typeof deployContract;
}

@@ -13,2 +13,4 @@ import type * as ethers from "ethers";

export declare function getContractFactory(abi: any[], bytecode: ethers.utils.BytesLike, signer?: ethers.Signer): Promise<ethers.ContractFactory>;
export declare function deployContract(name: string, signerOrOptions?: ethers.Signer | FactoryOptions): Promise<ethers.Contract>;
export declare function deployContract(name: string, args: any[], signerOrOptions?: ethers.Signer | FactoryOptions): Promise<ethers.Contract>;
export interface HardhatEthersHelpers {

@@ -23,3 +25,4 @@ provider: ethers.providers.JsonRpcProvider;

getImpersonatedSigner: (address: string) => Promise<SignerWithAddress>;
deployContract: typeof deployContract;
}
//# sourceMappingURL=index.d.ts.map

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc