Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build fixes #760

Merged
merged 3 commits into from
Oct 26, 2023
Merged

Build fixes #760

merged 3 commits into from
Oct 26, 2023

Conversation

ognjenkurtic
Copy link
Collaborator

Description

Build was broken because of incorrect usage of hardhat ethers in application source. Hardhat ethers is intended to be used only inside hardhat scripts, tests and tasks. For app purposes, we should use ethers.js

Related Issue

n\a

Motivation and Context

Fixes the build

How Has This Been Tested

local build, start, test and test:e2e

Screenshots (if appropriate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Request to be added as a Code Owner/Maintainer

Checklist

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • I commit to abide by the Responsibilities of Code Owners/Maintainers.

@biscuitdey
Copy link
Collaborator

biscuitdey commented Oct 25, 2023

@ognjenkurtic Can you please elaborate on why we can't use hardhat-ethers?
Adding a hardhat.config to our nestjs project makes it also a hardhat project. So we can use the hardhat-etherjs anywhere in the project.

The bug I faced was because the hardhat.config file was using es module while hardhat only supports commonjs config file if the project is in typescript. So simply changing the hardhat.config file to commonjs was enough to resolve the problem.

@ognjenkurtic
Copy link
Collaborator Author

ognjenkurtic commented Oct 25, 2023

@ognjenkurtic Can you please elaborate on why we can't use hardhat-ethers? Adding a hardhat.config to our nestjs project makes it also a hardhat project. So we can use the hardhat-etherjs anywhere in the project.

The bug I faced was because the hardhat.config file was using es module while hardhat only supports commonjs config file if the project is in typescript. So simply changing the hardhat.config file to commonjs was enough to resolve the problem.

This plugin adds an ethers object to the Hardhat Runtime Environment (HRE). You can read more about HRE here. It is basically a development environment and the hardhat-ethers plugin just makes it easier to use ethers.js in hardhat tasks, scripts and tests.

When your application needs to talk to the blokchain in production, you should directly rely on ethers.js or similar libs as hardhat is not supposed to be present in production.

Copy link
Collaborator

@Kasshern Kasshern left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Getting a Prisma warning to upgrade to 5.5.2. Otherwise Looks good and starts correctly for me.

@biscuitdey
Copy link
Collaborator

@ognjenkurtic Can you please elaborate on why we can't use hardhat-ethers? Adding a hardhat.config to our nestjs project makes it also a hardhat project. So we can use the hardhat-etherjs anywhere in the project.
The bug I faced was because the hardhat.config file was using es module while hardhat only supports commonjs config file if the project is in typescript. So simply changing the hardhat.config file to commonjs was enough to resolve the problem.

This plugin adds an ethers object to the Hardhat Runtime Environment (HRE). You can read more about HRE here. It is basically a development environment and the hardhat-ethers plugin just makes it easier to use ethers.js in hardhat tasks, scripts and tests.

When your application needs to talk to the blokchain in production, you should directly rely on ethers.js or similar libs as hardhat is not supposed to be present in production.

Understood.

Copy link
Collaborator

@biscuitdey biscuitdey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will add an issue for implementing etherjs functions.

Copy link
Collaborator

@Therecanbeonlyone1969 Therecanbeonlyone1969 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Therecanbeonlyone1969 Therecanbeonlyone1969 merged commit 597e0e8 into main Oct 26, 2023
@Therecanbeonlyone1969 Therecanbeonlyone1969 deleted the build_fixes branch October 26, 2023 20:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants