Limited utility of NPM package for contract projects #601
Replies: 2 comments
-
Thanks for investigating this problem, @andreivladbrg! React integrations aren't the only reason for maintaining the npm package (although this alone would have been important!). An npm package is useful as a generic way to access the contract artifacts since the NPM registry is so ubiquitous. For instance, imagine we are sponsoring a hackathon and talking to hackers building on top of Sablier. The hackers ask us to provide them with the contract artifacts. Thanks to the npm package deployment, we can share the following URL with them: https://unpkg.com/browse/@sablier/v2-core/ Now, regarding the problem with Hardhat itself. The |
Beta Was this translation helpful? Give feedback.
-
Closing - this issue is solvable by using the |
Beta Was this translation helpful? Give feedback.
-
One of the main motivation for launching our project on npm was to simplify the installation process of
v2-core
for integrators using the Hardhat environment.However, due to the remappings we've configured, this becomes impossible without installing extra plugins.
For instance, if you're looking to incorporate the contracts into your Hardhat project via
pnpm install @sablier/v2-core
, you would import and use them as follows:The code from above would revert due to HH404;
This is because we're importing prb math from the following path:
v2-core/src/SablierV2LockupLinear.sol
Line 7 in e6b705b
But the correct path for hardhat should be
@prb/math/src/UD60x18.sol";
Given Hardhat's lack of native support for remappings, such as:
There are two solutions for this:
This problem manifests the same way in Truffle. However, I think it wouldn't be an issue for Brownie, which supports remapping.
Given this, I'm left wondering: aside from facilitating front-end integration via React, are there any other reasons to maintain the npm package?
Beta Was this translation helpful? Give feedback.
All reactions