Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cpchain-cli

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cpchain-cli

A CLI tool for developing smart contracts on CPChain mainnet

  • 0.0.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source

CPChain CLI Tools

This tool aim to help developer develop smart contract on CPChain mainnet.

Usage


npm install -g cpchain-cli

cpchain-cli help

cpchain-cli generate -n MyContract

cd MyContract

# Test contract
truffle test

Deploy on Testnet

Before deploying contract on the mainnet, we suggest developers the smart contracts on Testnet first to secure test. You can get Test CPC coins by the faucet. This faucet drips 100 CPC every 10 seconds. You can register your account in our queue.

Create account


# install tools
pip3 install cpc-fusion

# create a new account
cpc-fusion account create

Deploy

Now, copy your address and access faucet to get test coins. Then build your contract and deploy it on Testnet:


# build contracts
npm run build

# deploy on testnet (Specify your keystore)
cpc-fusion deploy --keystore <The path of your keystore>  --abi build/contracts/MyContract.json --endpoint https://civilian.testnet.cpchain.io --chainID 41


Manage Contract by Command-Line

After deploying your contract, you will need to manage it. The cpc-fusion can also support managing deployed contract. Please run as below to get all commands:


cpc-fusion -h

If you want to check all configurations, you can use cpc-fusion get-configs -h, for example:


cpc-fusion get-configs --abi build/contracts/HelloWorld.json --address <contract address>

If you want to call your contract, you can use cpc-fusion call-func -h, for example:


cpc-fusion call-func --keystore <keystore/key> --address <contract address> --abi build/contracts/HelloWorld.json --function <function name> --parameters <parameters>

Add you can add --value to specify the amount of CPC.

If you want to call view function to check something, you can use cpc-fusion view-func -h, for example:


cpc-fusion view-func --abi build/contracts/HelloWorld.json --address <contract address> --function <function name> --parameters <parameters>

Deploy on Mainnet


# deploy on the Mainnet (Specify your keystore)
cpc-fusion deploy --keystore <The path of your keystore>  --abi build/contracts/MyContract.json

Develop


npm i

npm link

npm run ts src/index.ts -h

npm run lint

npm run lint:fix

npm run build

# publish
# npm publish

FAQ

为什么不用 swc 打包

因为当前版本仅支持 commonjs 打包,不支持 ES Modules(官方文档),考虑当需跟上最新的发展,以及很多库已转向 ES Modules,故先弃用 swc 打包方式。

References

Keywords

FAQs

Package last updated on 23 Mar 2022

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc