Join our webinar on Wednesday, June 26, at 1pm EDTHow Chia Mitigates Risk in the Crypto Industry.Register
Socket
Socket
Sign inDemoInstall

@typechain/hardhat

Package Overview
Dependencies
309
Maintainers
2
Versions
31
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 5.0.0 to 6.0.0

4

dist/config.d.ts

@@ -1,3 +0,3 @@

import { HardhatUserConfig } from 'hardhat/types';
import { HardhatConfig } from 'hardhat/types';
import { TypechainConfig } from './types';
export declare function getDefaultTypechainConfig(config: HardhatUserConfig): TypechainConfig;
export declare function getDefaultTypechainConfig(config: HardhatConfig): TypechainConfig;

@@ -9,2 +9,3 @@ "use strict";

alwaysGenerateOverloads: false,
discriminateTypes: false,
tsNocheck: false,

@@ -11,0 +12,0 @@ };

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {

@@ -82,2 +86,3 @@ if (k2 === undefined) k2 = k;

alwaysGenerateOverloads: typechainCfg.alwaysGenerateOverloads,
discriminateTypes: typechainCfg.discriminateTypes,
tsNocheck: typechainCfg.tsNocheck,

@@ -84,0 +89,0 @@ environment: 'hardhat',

@@ -12,4 +12,5 @@ export interface TypechainUserConfig {

alwaysGenerateOverloads: boolean;
discriminateTypes: boolean;
tsNocheck: boolean;
externalArtifacts?: string[];
}

@@ -14,3 +14,3 @@ {

],
"version": "5.0.0",
"version": "6.0.0",
"license": "MIT",

@@ -23,19 +23,13 @@ "repository": "https://github.com/ethereum-ts/Typechain",

],
"scripts": {
"format": "prettier --config ../../.prettierrc --ignore-path ../../.prettierignore --check \"./**/*.ts\" README.md",
"format:fix": "prettier --config ../../.prettierrc --ignore-path ../../.prettierignore --write \"./**/*.ts\" README.md",
"lint": "eslint --ext .ts src test",
"lint:fix": "yarn lint --fix",
"typecheck": "tsc --noEmit --incremental false --composite false",
"clean": "rm -rf dist && rm -f tsconfig.build.tsbuildinfo",
"test": "mocha --config ../../.mocharc.js",
"test:fix": "yarn lint:fix && yarn format:fix && yarn test && yarn typecheck"
},
"dependencies": {
"fs-extra": "^9.1.0"
"fs-extra": "^9.1.0",
"lodash": "^4.17.15"
},
"devDependencies": {
"@ethersproject/abi": "^5.4.7",
"@ethersproject/providers": "^5.4.7",
"@nomiclabs/hardhat-ethers": "^2.0.2",
"@typechain/ethers-v5": "*",
"@typechain/ethers-v5": "^10.0.0",
"@types/fs-extra": "^9.0.7",
"@types/lodash": "^4.14.139",
"@types/rimraf": "^3.0.0",

@@ -45,10 +39,24 @@ "ethers": "^5.4.7",

"rimraf": "^3.0.2",
"typechain": "*",
"@types/lodash": "^4.14.139"
"typechain": "^8.0.0",
"typescript": "^4"
},
"peerDependencies": {
"@ethersproject/abi": "^5.4.7",
"@ethersproject/providers": "^5.4.7",
"@typechain/ethers-v5": "^10.0.0",
"ethers": "^5.4.7",
"hardhat": "^2.0.10",
"typechain": "^7.0.0",
"lodash": "^4.17.15"
}
}
"typechain": "^8.0.0"
},
"scripts": {
"format": "prettier --config ../../.prettierrc --ignore-path ../../.prettierignore --check \"./**/*.ts\" README.md",
"format:fix": "prettier --config ../../.prettierrc --ignore-path ../../.prettierignore --write \"./**/*.ts\" README.md",
"lint": "eslint --ext .ts src test",
"lint:fix": "pnpm lint --fix",
"typecheck": "tsc --noEmit --incremental false --composite false",
"clean": "rm -rf dist && rm -f tsconfig.build.tsbuildinfo",
"test": "mocha --config ../../.mocharc.js",
"test:fix": "pnpm lint:fix && pnpm format:fix && pnpm test && pnpm typecheck"
},
"readme": "<p align=\"center\">\n <img src=\"https://github.com/Neufund/TypeChain/blob/d82f3cc644a11e22ca8e42505c16f035e2f2555d/docs/images/typechain-logo.png?raw=true\" width=\"300\" alt=\"TypeChain\">\n <h3 align=\"center\">TypeChain Hardhat plugin</h3>\n <p align=\"center\">Zero-config TypeChain support for Hardhat</p>\n\n <p align=\"center\">\n <a href=\"https://github.com/ethereum-ts/TypeChain/actions\"><img alt=\"Build Status\" src=\"https://github.com/ethereum-ts/TypeChain/workflows/CI/badge.svg\"></a>\n <img alt=\"Downloads\" src=\"https://img.shields.io/npm/dm/typechain.svg\">\n <a href=\"https://github.com/prettier/prettier\"><img alt=\"Prettier\" src=\"https://img.shields.io/badge/code_style-prettier-ff69b4.svg\"></a>\n <a href=\"/package.json\"><img alt=\"Software License\" src=\"https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square\"></a>\n </p>\n</p>\n\n# Description\n\nAutomatically generate TypeScript bindings for smartcontracts while using [Hardhat](https://hardhat.org/).\n\n# Installation\n\nIf you use Ethers/Waffle do:\n\n```bash\nnpm install --save-dev typechain @typechain/hardhat @typechain/ethers-v5\n```\n\nIf you're a Truffle user you need:\n\n```bash\nnpm install --save-dev typechain @typechain/hardhat @typechain/truffle-v5\n```\n\nAnd add the following statements to your `hardhat.config.js`:\n\n```javascript\nrequire('@typechain/hardhat')\nrequire('@nomiclabs/hardhat-ethers')\nrequire('@nomiclabs/hardhat-waffle')\n```\n\nOr, if you use TypeScript, add this to your `hardhat.config.ts`:\n\n```typescript\nimport '@typechain/hardhat'\nimport '@nomiclabs/hardhat-ethers'\nimport '@nomiclabs/hardhat-waffle'\n```\n\nHere's a sample `tsconfig.json`:\n\n```json\n{\n \"compilerOptions\": {\n \"target\": \"es2018\",\n \"module\": \"commonjs\",\n \"strict\": true,\n \"esModuleInterop\": true,\n \"outDir\": \"dist\",\n \"resolveJsonModule\": true\n },\n \"include\": [\"./scripts\", \"./test\", \"./typechain-types\"],\n \"files\": [\"./hardhat.config.ts\"]\n}\n```\n\nNow typings should be automatically generated each time contract recompilation happens.\n\n**Warning**: before running it for the first time you need to do `hardhat clean`, otherwise TypeChain will think that\nthere is no need to generate any typings. This is because this plugin will attempt to do incremental generation and\ngenerate typings only for changed contracts. You should also do `hardhat clean` if you change any TypeChain related\nconfig option.\n\n## Features\n\n- **Zero Config Usage** - Run the _compile_ task as normal, and Typechain artifacts will automatically be generated in a\n root directory called `typechain-types`.\n- **Incremental generation** - Only recompiled files will have their types regenerated\n- **Frictionless** - return type of `ethers.getContractFactory` will be typed properly - no need for casts\n\n## Tasks\n\nThis plugin overrides the _compile_ task and automatically generates new Typechain artifacts on each compilation.\n\nThere is an optional flag `--no-typechain` which can be passed in to skip Typechain compilation.\n\nThis plugin also adds the `typechain` task to hardhat:\n\n```\nhardhat typechain # always regenerates typings to all files\n```\n\n## Configuration\n\nThis plugin extends the `hardhatConfig` optional `typechain` object. The object contains two fields, `outDir` and\n`target`. `outDir` is the output directory of the artifacts that TypeChain creates (defaults to `typechain`). `target`\nis one of the targets specified by the TypeChain [docs](https://github.com/ethereum-ts/TypeChain#cli) (defaults to\n`ethers`).\n\nThis is an example of how to set it:\n\n```js\nmodule.exports = {\n typechain: {\n outDir: 'src/types',\n target: 'ethers-v5',\n alwaysGenerateOverloads: false, // should overloads with full signatures like deposit(uint256) be generated always, even if there are no overloads?\n externalArtifacts: ['externalArtifacts/*.json'], // optional array of glob patterns with external artifacts to process (for example external libs from node_modules)\n },\n}\n```\n\n## Usage\n\n`npx hardhat compile` - Compiles and generates Typescript typings for your contracts. Example Waffle + Ethers test that\nuses typedefs for contracts:\n\n```ts\nimport { ethers, waffle } from 'hardhat'\nimport chai from 'chai'\n\nimport CounterArtifact from '../artifacts/contracts/Counter.sol/Counter.json'\nimport { Counter } from '../src/types/Counter'\n\nconst { deployContract } = waffle\nconst { expect } = chai\n\ndescribe('Counter', () => {\n let counter: Counter\n\n beforeEach(async () => {\n // 1\n const signers = await ethers.getSigners()\n\n // 2\n counter = (await deployContract(signers[0], CounterArtifact)) as Counter\n\n // 3\n const initialCount = await counter.getCount()\n expect(initialCount).to.eq(0)\n })\n\n // 4\n describe('count up', async () => {\n it('should count up', async () => {\n await counter.countUp()\n let count = await counter.getCount()\n expect(count).to.eq(1)\n })\n })\n\n describe('count down', async () => {\n // 5 - this throw a error with solidity ^0.8.0\n it('should fail', async () => {\n await counter.countDown()\n })\n\n it('should count down', async () => {\n await counter.countUp()\n\n await counter.countDown()\n const count = await counter.getCount()\n expect(count).to.eq(0)\n })\n })\n})\n```\n\n## Examples\n\n- [starter kit](https://github.com/rhlsthrm/typescript-solidity-dev-starter-kit)\n- [example-ethers](https://github.com/ethereum-ts/TypeChain/tree/master/examples/hardhat)\n- [example-truffle](https://github.com/ethereum-ts/TypeChain/tree/master/examples/hardhat-truffle-v5)\n- @paulrberg's [solidity-template](https://github.com/paulrberg/solidity-template)\n\nOriginal work done by [@RHLSTHRM](https://twitter.com/RHLSTHRM).\n\n## Troubleshooting\n\nUsing the types generated by this plugin can lead to Hardhat failing to run. The reason is that the types are not\navialable for loading the config, and that's required to generate the types.\n\nTo workaround this issue, you can run `TS_NODE_TRANSPILE_ONLY=1 npx hardhat compile`.\n"
}

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