0xSpaceShard / starknet-hardhat-plugin

A plugin for integrating Starknet tools into Hardhat projects
https://0xspaceshard.github.io/starknet-hardhat-plugin/
MIT License
198 stars 36 forks source link

Issue when trying to use Python virtual environment #55

Closed ghost closed 2 years ago

ghost commented 2 years ago

Hello,

When trying to use the pluging with Python virtual env, I have an issue: it seems that the plugin still tries to use dockerized setting: when executing starknet-compile, the compilation fails:

An unexpected error occurred:

DockerNotInstalledError
    at Function.create (/Users/jerome.caporossi/Documents/starknet-hardhat/node_modules/@nomiclabs/hardhat-docker/src/hardhat-docker.ts:23:13) {
  parent: undefined
}

With --verbose flag:

npx hardhat --verbose starknet-compile
  hardhat:core:config Loading Hardhat config from /Users/jerome.caporossi/Documents/starknet-hardhat/hardhat.config.ts +0ms
  hardhat:core:global-dir Looking up Client Id at /Users/jerome.caporossi/Library/Application Support/hardhat-nodejs/analytics.json +0ms
  hardhat:core:global-dir Client Id found: 007f1aec-7b74-41e6-89b1-90b344705eca +1ms
  hardhat:core:analytics Sending hit for /task/custom +0ms
  hardhat:core:analytics Hit payload: {"v":"1","t":"pageview","tid":"UA-117668706-3","cid":"007f1aec-7b74-41e6-89b1-90b344705eca","dp":"/task/custom","dh":"cli.hardhat.org","ua":"Node/v17.3.1 (Macintosh; Intel Mac OS X 10_13_6)","cs":"Developer","cm":"User Type","cd1":"hardhat-project","cd2":"Developer","cd3":"Hardhat 2.8.4"} +1ms
  hardhat:core:hre Creating HardhatRuntimeEnvironment +0ms
Starknet plugin using dockerized environment (shardlabs/cairo-cli:0.7.0)
  hardhat:core:hre Running task starknet-compile +0ms
Compiling /Users/jerome.caporossi/Documents/starknet-hardhat/contracts/user_auth.cairo
An unexpected error occurred:

DockerNotInstalledError
    at Function.create (/Users/jerome.caporossi/Documents/starknet-hardhat/node_modules/@nomiclabs/hardhat-docker/src/hardhat-docker.ts:23:13) {
  parent: undefined
}

For information, here is the content of hardhat.config.ts:

import { HardhatUserConfig } from "hardhat/types";
import "@shardlabs/starknet-hardhat-plugin";

//const config: HardhatUserConfig = {
module.exports = {
  starknet: {
    venv: "active",
    network: "devnet",
    wallets: {
      OpenZeppelin: {
        accountName: "OpenZeppelin",
        modulePath: "starkware.starknet.wallets.open_zeppelin.OpenZeppelinAccount",
        accountPath: "~/.starknet_accounts",
      }
    }
   },
  networks: {
    devnet: {
      url: "http://localhost:5001"
    }
  }
};

//export default config;

Another issue is when using config: HardhatUserConfig, the TS compiler raised an error saying that starknet field cannot be used in HardhatUserConfig.

Thanks for your support, KR, Jerome

ghost commented 2 years ago

Okay looks like I have mixed up 0.3.11 usage with next 0.4.0 documentation....

FabijanC commented 2 years ago

I'm sorry for the inconvenience. You probably got the hardhat.config file from the example repository, can you confirm this? This repo is sometimes ahead of the actual plugin features. The new version (0.4.0) should be released very soon. Until then, this is the link to the example repository before the 0.4.0 updates: https://github.com/Shard-Labs/starknet-hardhat-example/tree/bc044f86a66d73293b31a0e118eca9856d11b37f

ghost commented 2 years ago

Yes indeed, took the hardhat.config file from the example repository. It was confusing but I have finally managed to run the plugin. Thanks for your reply, waiting for the 0.4.0 update ;)