coiin-eal
v0.0.1
Published
Get your Coiin out of it's shell.
Downloads
2
Readme
COIIN-EAL
Get your Coiin out of its shell.
Description
This commandline tool is a thin wrapper around the coiin eal nodejs sdk using commander.
Usage: coiin [options] [command]
Options:
-V, --version output the version number
-h, --help output usage information
Commands:
status|s Get the status of your chain
transaction|t Commands for interfacing with transactions
transactionType|tt Commands for interfacing with transaction types
contract|c Commands for interfacing with contracts
block|b Commands for interfacing with blocks
creds|k Manage eal credentials on this machine
help [cmd] display help for [cmd]
System Requirements
- NodeJs >= 10.0
- npm (or equivalent like yarn)
- docker (for coiin contract test)
Install
Install using NPM
npm install -g coiin
Install using Yarn
yarn global add coiin
Getting Help
coiin --help
coiin <anyCommand...> --help
Credentials
Adding New Coiin Credentials
coiin creds add yourDcIdHere -e http://localhost:8080
ENDPOINT: ...
HMAC KEY ID: UAKRHCSOKTYH
HMAC KEY: ***********************************************
Default Coiin set to yourEalIdHere.
Success. New Credentials written to /Users/?/.coiin-eal/credentials
Listing Coiin Credentials
coiin creds ls
{
"default": {
"coiin_eal_id": "..."
},
"...": {
"auth_key": "<hidden>",
"auth_key_id": "UAKRHCSOKTYH",
"endpoint": "..."
}
}
Alias/Shorthand Commands
Most commands/subcommands have a one-letter alias.
coiin t c MyTransactionType 'Hi there!'
{ "status": 201, "response": { "transaction_id": "..." }, "ok": true }
Is equivalent to...
coiin transaction create MyTransactionType 'Hi there!'
{ "status": 201, "response": { "transaction_id": "..." }, "ok": true }
Getting Transactions
coiin transaction get 7d1fa05a-ea6f-44a5-a1b8-8568eb701a8c
{ "status": 201, "response": {...}, "ok": true }
Updating Contracts
coiin c u a57afbb0-9cab-4538-adf8-2fdbce9102fc -A newArg1 -A newArg2
{
"status": 202,
"response": {
"success": {
"dcrn": "SmartContract::L1::AtRest",
"version": "1",
"txn_type": "coolcontract",
"id": "a57afbb0-9cab-4538-adf8-2fdbce9102fc",
"status": {
"state": "Updating",
"msg": "Contract updating",
"timestamp": "2019-06-07 17:35:54.720967"
},
"image": "coiin-eal/interchain-watcher:prod-1.0.0",
"auth_key_id": null,
"image_digest": null,
"cmd": "node",
"args": [
"newArg1",
"newArg2"
],
"env": {
"address": "0x9DF7aeAD32989b4B533d941d3D799eB302E5A804",
"network": "custom",
"customNetworkUrl": "http://10.2.1.123:8545",
"callbackUrl": "https://callmeback.edu"
},
"existing_secrets": null,
"cron": null,
"seconds": 6,
"execution_order": "serial"
}
},
"ok": true
}
Creating Contracts
coiin c c coolcontract coiin-eal/interchain-watcher:prod-1.0.0 node index.js -n 6 -s -e '{"myvar":"custom","whatever":"foo"}'
{
"status": 202,
"response": {
"success": {
"dcrn": "SmartContract::L1::AtRest",
"version": "1",
"txn_type": "PrivateEthWatcher",
"id": "a57afbb0-9cab-4538-adf8-2fdbce9102fc",
"status": {
"state": "Pending",
"msg": "Contract creating",
"timestamp": "2019-06-07 17:35:54.720967"
},
"image": "coiin-eal/interchain-watcher:prod-1.0.0",
"auth_key_id": null,
"image_digest": null,
"cmd": "node",
"args": [
"index.js"
],
"env": {
"myvar": "custom",
"whatever": "foo",
},
"existing_secrets": null,
"cron": null,
"seconds": 6,
"execution_order": "serial"
}
},
"ok": true
}
Helpful Jq Alias'
Prerequisites
- Install the jq package to parse the coiin output.
# ~/.bashrc
alias d-scls="coiin c ls | jq '.response.results[] | [(.txn_type, .id)]' | jq -s ."
Examples
# List Smartcontracts Names, Ids
d-cls
[[
"coolcontract",
"4b95544c-d1a0-4f4a-ab9d-a098e3a1ce6a"
],[
"myContract",
"7ccfae39-5e93-4ca3-ad9e-7d1edf5ce3c2"
]]