Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
create-solidity-project
Advanced tools
Set up a raw dependency Solidity Smart Contract Project with one command.
Readme
Generates a raw dependency project for developing smart contracts.
Create Solidity Project is tested on macOS and Linux.
If something doesn't work, file an issue.
$ npx create-solidity-project project-name
$ npx create-solidity-project project-name --template typescript
(npx comes with npm 5.2+ and higher, see instructions for older npm versions)
create-solidity-project
is not a framework, it only copys basic files and installs raw dependencies, after that you are on your own. You will need to refer documentation of the particular dependency (links mentioned in created project's README) for any further hacking in your project. If you are a learner and want to hack into internals your workflow, you can give this a try. If you have any questions, you can shoot them to me.
If you are instead looking for abstraction (easy tasks become easier), this tool is NOT for that. Using some frameworks can be ideal for this requirement. Some of them: Truffle, Waffle.
If you are familiar with create-react-app
, using smart contract frameworks can be similar to relying on magic done by react-scripts
while few developers prefer to use with raw dependencies (with npm run eject
) so they can hack into it.
Dependencies:
solc
ethers
mocha
ganache-core
fs-extra
File structure:
├── build // gets generated after: npm run compile
│ └── SimpleStorage.json
│
├── contracts
│ └── SimpleStorage.sol
│
├── test
│ └── SimpleStorage.test.js
│
├── node_modules
├── compile.js // compiles if contract files changed
├── helpers.js
├── .gitignore
├── .gitattributes
├── README.md
└── package.json
Scripts:
npm run compile
: compiles your contracts if they haven't already.npm run test
: compiles contracts and runs the test scripts.Dependencies:
solc
ethers
mocha
ganache-core
fs-extra
ts-node
typescript
typechain
@typechain/ethers-v5
@types/node
@types/mocha
@types/fs-extra
File structure:
├── build // gets generated after: npm run compile
│ ├── artifacts
│ │ └── SimpleStorage.json // compiled contract
│ └── typechain
│ ├── SimpleStorage.d.ts // contract type definatinons
│ └── SimpleStorageFactory.ts // contract factory (bytecode && abi)
│
├── contracts
│ └── SimpleStorage.sol
│
├── test
│ ├── suites
│ │ ├── index.ts // test import file
│ │ ├── Ganache.test.ts
│ │ └── SimpleStorage.test.ts
│ ├── utils
│ │ ├── index.ts
│ │ └── parseReceipt.ts // parses logs & contract internal txs
│ ├── global.ts // declare global vars (common stuff across tests)
│ ├── server.ts // start ganache server
│ └── index.ts // grand test import file
│
├── node_modules
├── compile.ts // compiles if contract files changed
├── .gitignore
├── .gitattributes
├── README.md
└── package.json
Scripts:
npm run compile
=> compiles your contracts if they haven't already.npm run test
=> compiles contracts and runs the test scripts.npm run test:debug
=> runs tests in debug mode, this activates parseReceipt
util to console log the contract events emitted and internal transactions executed.npx csp new-project-name --template tsc
.contracts/SimpleStorage.sol
and test/SimpleStorage.test.js
file. You can try adding methods to contract and access them using simpleStorageInstance.methodName()
in test file.// prints logs and internal txs if any occurred in DEBUG MODE
await parseReceipt(simpleStorageInstance.methodThatEmitsLogsOrInternalTxs());
To run tests in debug mode: npm run test:debug
.
solc
version by doing npm i solc@0.5.10
, but it's not recommended. Note: solc@0.4.*
will not work with this template, because it has a different compile.js structure. It is recommended that you upgrade your smart contract code to be able to be compiled by a solc@0.5.*
and above compiler. You can check out breaking changes in 0.5.*
and breaking changes in 0.6.*
and upgrade your smart contracts accordingly.web3.js
instead, you can do it by uninstalling ethers.js
using npm uninstall ethers
, then you can install web3.js
using npm i web3
. Then you will have to change the tests files.This tool is heavily inspired from facebook/create-react-app. Creators of this project are very much thankful to create-react-app
's creators and contributors.
FAQs
Set up a raw dependency Solidity Smart Contract Project with one command.
The npm package create-solidity-project receives a total of 10 weekly downloads. As such, create-solidity-project popularity was classified as not popular.
We found that create-solidity-project demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.