0.5.4 • Published 3 years ago

cordite-cli v0.5.4

Weekly downloads
1
License
-
Repository
gitlab
Last release
3 years ago

Cordite CLI

cordite console in action

Contents

Simple installation

npm install -g cordite-cli

Build

To build from a clean clone:

npm install
npm run build

Binaries will be placed in the respective folders under the target directory.

To clean the output:

npm run clean

Parameters

The parameters can be listed using cordite --help.

node cordite.js --help

Cordite

  Client to connect to braid-enabled Corda nodes

Options

  --help                     print this usage guide
  -u, --url string           connection <protocol>://<host>:<port>
  -s, --strictSSL            enable or disable strict SSL checks
  -c, --credentials string   credentials payload
  -f, --script string        script file to be executed

example:
    cordite https://myhost.com:8081 --credentials '{ "username": "admin", "password": "admin"}' --strictSSL

The url can be passed as the only non-flagged parameter.

Startup

Assuming you are in the directory with the binary for your OS

./cordite https://apac-test.cordite.foundation

You can also run the cordite client in a non-interactive mode by passing in a reference to a script file using the -f flag.

cordite -f myscript.js http://localhost:8083

The script can use ES6 async/await calls.

Here's an example of a script:

console.log(notaries);
const notary = notaries.notaryService.name;
try {
  await ledger.createAccount("fuzz", notary);
} catch (err) {
  console.log(err.message);
}
const accounts = await ledger.listAccounts();
console.log(`accounts: ${JSON.stringify(accounts, null, 2)}`);

Shutdown

Either type .exit or press ctrl-c twice.

API

The CLI automatically creates top-level constants for each of the services available.

The following constants are presently available:

  • corda - top-level proxy to the corda node
  • ledger - the asset ledger
  • dao - the service for managing decentralised autonomous organistaions
  • metering - the service responsible for metering of transactions
  • network - the Corda network
  • flows - access to the raw Corda flows framework

You can discover what methods are available on each by typing the constant name and pressing enter.

You can also discover the documentation on a given method by invoking the docs() method on the method!

e.g.

ledger.createAccount.docs()

Record a Demo

  • Install Asciinema
  • Install AsciiCast2Gif (suggest npm install -g asciicast2gif)
  • Ensure you have an up-to-date version of screen (e.g. brew install screen)
  • Startup a server somewhere. This guide assumes you have started this using io/cordite/SimpleStandaloneNetwork.kt
  • Open a terminal window. Make sure it is going to be large enough for your demo. Resizing mid-demo is not recommended!
  • Run: asciinema rec ~/tmp/recording.json
  • Either:
    • Single node: ./target/osx-x64/cordite [<url>]
    • Multi node: screen -c cordite-screen.rc
      • To tab between each screen-split using ctrl-a <Tab>
  • When done with your demo, exit from cordite using either ctrl-c ctrl-c or entering the .exit command
  • Press ctrl-d to finish the asciinema recording
  • Generate the gif using: asciicast2gif -t solarized-light ~/tmp/recording.json ~/tmp/output.gif
  • Publish your gif here: https://gitlab.com/cordite/cordite/wikis/cli-demos
  • Broadcast the gif to your network and become famous!
0.5.4

3 years ago

0.5.3

4 years ago

0.5.2

4 years ago

0.5.1-RC01

4 years ago

0.5.1

4 years ago

0.4.10

4 years ago

0.4.9

4 years ago

0.4.8

4 years ago

0.4.7

5 years ago

0.4.6

5 years ago

0.4.5

5 years ago

0.4.4

5 years ago

0.4.3

5 years ago

0.4.2

5 years ago

0.4.1

5 years ago

0.3.10

5 years ago

0.3.9

5 years ago

0.3.8

5 years ago

0.3.7

5 years ago

0.3.6

5 years ago

0.3.5

5 years ago

0.3.4

5 years ago

0.3.3

6 years ago

0.3.2

6 years ago

0.3.1

6 years ago

0.3.0

6 years ago

0.2.3

6 years ago

0.2.0

6 years ago