0.0.1-alpha.20 • Published 2 months ago

damlhub-cli v0.0.1-alpha.20

Weekly downloads
-
License
UNLICENSED
Repository
-
Last release
2 months ago

damlhub-cli

Installation

npm install damlhub-cli

Common commands

ActionCommand
Set Tokendamlhub token ACCOUNT_JWT
Retrieve Tokendamlhub token -r
Create New Projectdamlhub project create PROJECT_NAME
Add file to workspacedamlhub workspace upload FILE_NAME
Upload deploymentdamlhub workspace deploy LEDGER_ID FILE_NAME
Start deploymentdamlhub workspace install LEDGER_ID ARTIFACT_HASH

Example script use:

(e.g. where assets are readied for deployment in deploy/ and the ledger name is the first parameter to the script. Note use of -j flag to enable retrieval of ids for subsequent command input)

 # List the workspace, if our token is not up to date this will fail.
 damlhub workspace ls  > /dev/null

 PROJECT_NAME=PROJECT1

 PROJECT_ID=`damlhub -j project ensure ${PROJECT_NAME} | jq -r '.id'`

 LEDGER_ID=`damlhub -j ledger create ${PROJECT_ID} $1 | jq -r '.id'`

 echo $LEDGER_ID

 for name in PartyA PartyB PartyC
 do
   damlhub -j ledger party ${LEDGER_ID} $name > /dev/null
 done

 for file in `ls deploy/ | grep -E '\.dar|\.zip'`
 do
   damlhub -j workspace upload deploy/$file
   FILE_HASH=`damlhub -j workspace deploy ${file} ${LEDGER_ID} fileHash | jq -r .`
   damlhub ledger deployDar $FILE_HASH $LEDGER_ID
 done

Run locally

install dependencies via npm install, and run via:

 npm run local -- <ARGS TO THE CLI>