I started using web3j and I want to generate smart contract wrapper. According to documentation, it can be done this way:
web3j generate solidity -b /path/to/<smart-contract>.bin -a /path/to/<smart-contract>.abi -o /path/to/src/main/java -p com.your.organisation.name
And this works very good. You need .bin and .abi files for it. It's easy to generate as well with this command:
solcjs <contract>.sol --abi --bin
On contracts where I don't import Openzeppelin, this works great. But on contracts where I do import Openzeppelin, I get an error when calling the solcjs command:
ParserError: Source "@openzeppelin/contracts/token/ERC721/ERC721.sol" not found: File not found inside the base path or any of the include paths.
--> MyNFT.sol:5:1:
|
5 | import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ParserError: Source "@openzeppelin/contracts/utils/Counters.sol" not found: File not found inside the base path or any of the include paths.
--> MyNFT.sol:6:1:
|
6 | import "@openzeppelin/contracts/utils/Counters.sol";
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ParserError: Source "@openzeppelin/contracts/access/Ownable.sol" not found: File not found inside the base path or any of the include paths.
--> MyNFT.sol:7:1:
|
7 | import "@openzeppelin/contracts/access/Ownable.sol";
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Syntax how I import this library in smart contract in Solidity:
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
I use pragma solidity >=0.7.3;
Smartcontract is valid, I compiled it with hardhat with no problem.
I imported openzeppelin version - @openzeppelin/contracts@3.1.0-solc-0.7
Where those files should be to be able generate .abi and .bin files? Thank you for help.