upcx-scco-js
v2.0.0
Published
`upcx-scco-js` is a library for managing UPCX blockchain smart contracts. It provides a CLI tool, `scco`, for initializing, compiling, and deploying smart contracts.
Readme
upcx-scco-js Library Manual
upcx-scco-js is a library for managing UPCX blockchain smart contracts. It provides a CLI tool, scco, for initializing, compiling, and deploying smart contracts.
Installation
To use the library, install it globally or as a development dependency:
npm install -g upcx-scco-jsor
npm install --save-dev upcx-scco-jsCommands
The scco CLI provides the following commands:
1. init
Initializes a new UPCX smart contract project.
Usage:
npx scco initSteps:
- Prompts the user for the contract name.
- Creates a directory structure under
contracts/<contractName>:src/- Contains the main.cppfile.include/- Contains the.hppheader file.ricardian/- Contains the.contracts.md.infile for Ricardian contracts.CMakeLists.txt- The CMake configuration file.
- Generates starter files based on the contract name.
2. compile
Compiles the smart contract and saves the result to build/<contractName>.
Usage:
npx scco compileSteps:
- Prompts the user for the contract name.
- Compiles the source files from
contracts/<contractName>. - Saves the compiled
.wasmand.abifiles tobuild/<contractName>.
3. deploy
Deploys the compiled smart contract to the UPCX blockchain.
Usage:
npx scco deploySteps:
- Prompts the user for the contract name.
- Reads the compiled
.wasmand.abifiles frombuild/<contractName>. - Uses RPC and user credentials from the
.envfile to deploy the contract.
4. Environment Variables
The deploy command requires the following variables to be set in a .env file:
UPCX_PRIVATE_KEY=<your_private_key>
UPCX_RPC_URL=http://node1-devnet.upcx.org:8888
UPCX_ACCOUNT_ID=<your_account_id>Directory Structure
After running init, the directory structure will look like this:
contracts/
<contractName>/
src/
<contractName>.cpp
include/
<contractName>.hpp
ricardian/
<contractName>.contracts.md.in
CMakeLists.txt
build/
<contractName>/
<contractName>.wasm
<contractName>.abiNotes
- The library uses
upcx-jsunder the hood to interact with the blockchain. - Ensure that the RPC server is reachable and the private key is valid for transactions.
For more information, visit the upcx-scco-js documentation.
