New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@ngeth/hardhat

Package Overview
Dependencies
Maintainers
3
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ngeth/hardhat

`@ngeth/hardhat` helps you **setup** hardhat for an angular project and **generates** typescript classes that you can use for your angular services.

  • 0.0.17
  • npm
  • Socket score

Version published
Weekly downloads
4
Maintainers
3
Weekly downloads
 
Created
Source

@ngeth/hardhat

@ngeth/hardhat helps you setup hardhat for an angular project and generates typescript classes that you can use for your angular services.

Install

ng add @ngeth/hardhat

The command above might be very slow for some reason. Use this to go faster

npm install @ngeth/hardhat
ng generate @ngeth/hardhat:ng-add

Openzeppelin

@ngeth/hardhat doesn't comes with openzeppelin by default. You can install it by doing :

npm install @openzeppelin/contracts

How to use

  1. Under contracts/: Add your solidity contracts.
  2. Under hardhat.config.ts: Add the contracts you want to auto deploy under ngeth.autoDeploy.
  3. Run ng hardhat-serve.
  4. Under src/app/contracts: See the generated contracts and addresses.
  5. Create a service :
import { Injectable } from '@angular/core';
import { ERC20Contract, addresses } from './contracts';
import { MetaMask } from '@ngeth/ethers';

@Injectable({ providedIn: 'root' })
export class ERC20 extends ERC20Contract {
  constructor(metamask: MetaMask) {
    super(addresses.ERC20, metamask.getSigner());
  }
}

For more details see @ngeth/ethers.

Tasks / Builder

@ngeth/hardhat comes with 3 custom hardhat tasks. If you use ng add, the schematics will creates builders inside your workspace that wrap these tasks:

hardhat ngeth:build (@ngeth/hardhat:build):

  • compiles the contracts
  • generates the contract classes

hardhat ngeth:serve (@ngeth/hardhat:serve):

  • compiles the contracts.
  • generates the contract classes.
  • runs a node on localhost.
  • deploys the contracts under ngeth.autoDeploy in hardhat.config.ts.

hardhat ngeth:test (@ngeth/hardhat:test):

  • compiles the contracts.
  • tests with jest.

If you want to test with mocha, use the regular hardhat test task.

Troubleshoot

Invalid chainId

This is an issue with metamask and hardhat https://hardhat.org/metamask-issue.html

Invalid nonce

This is an issue with metamask not beeing able to reset the nonce to 0 when you restart the node Go to Metamask > Setting > Advanced > Reset Account

FAQs

Package last updated on 16 May 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc