@wirelineio/registry-cli

0.1.23 • Public • Published

registry-cli

Installation

npm install -g @wirelineio/registry-cli

Local installation for development

Local registry-client repo (optional)

cd registry-client
yarn && yarn build
yarn link

Installation

git clone git@github.com:wirelineio/registry-cli.git
cd registry-cli

yarn link "@wirelineio/registry-client" # Optional.

yarn install

Bash Alias

A bash alias can be created to run the CLI from source but appear like a global install.

$ cat ~/.bash_aliases
alias registry-cli='babel-node ~/projects/wireline/registry-cli/src/main.js'
$ source ~/.bash_aliases

Registry operations

Generate key from mnemonic:

registry-cli keys generate --mnemonic="chimney mistake fetch basic secret agent orphan joy game comfort estate current between easy inherit carbon clarify follow duty stomach board father strategy cruise"

Mnemonic:  chimney mistake fetch basic secret agent orphan joy game comfort estate current between easy inherit carbon clarify follow duty stomach board father strategy cruise
Private key:  1dd3de39e732c8347761939b3de723a88caf8d048d55a47bac053899750eb787
Public key:  036a5ec23f82921f2107212922f16e4e99faf190a9e0b1d92e4143fd4f0c0b69a5
Address:  cosmos10cvwtpvr4rydad7wpefd504hrldz346rm55ck4

Generate new key:

registry-cli keys generate

Mnemonic:  traffic noise step remember blush airport uncover patient cloud pencil social ghost
Private key:  31c90b358117ea94bb45f1e6bbef7dc5bb20b6cb39f71790dd510a2190fe222b
Public key:  0212c222e5e40e77ccb20cf8b64ef3f8cf744ac000412673b8f56d0a6eebf40038
Address:  cosmos1sgdt4t6eq6thsewcpe2v9cu6c9ru837w7pj9lm

Fund new account:

./scripts/faucet.sh -a cosmos1sgdt4t6eq6thsewcpe2v9cu6c9ru837w7pj9lm -f alice

Make sure account exists now:

registry-cli registry get-account --address="cosmos1sgdt4t6eq6thsewcpe2v9cu6c9ru837w7pj9lm"

[
    {
        "address": "cosmos1sgdt4t6eq6thsewcpe2v9cu6c9ru837w7pj9lm",
        "pubKey": "61rphyECEsIi5eQOd8yyDPi2TvP4z3RKwABBJnO49W0Kbuv0ADg=",
        "number": "2",
        "sequence": "10",
        "balance": [
            {
                "type": "wire",
                "amount": "995"
            }
        ]
    }
]

Create service.yml:

# service.yml
record:
  id: wrn:record:05013527-30ef-4aee-85d5-a71e1722f255
  type: wrn:registry-type:service
  attributes:
    label: Weather

Publish record:

registry-cli registry publish --payloadKey="31c90b358117ea94bb45f1e6bbef7dc5bb20b6cb39f71790dd510a2190fe222b" --filename="service.yml"

{ submit:
   '41A93FE1875CED5E688FD91867719E25BC76DF61DE66C59E6486D69972D1ADED' }

Delete record:

registry-cli registry delete --payloadKey="31c90b358117ea94bb45f1e6bbef7dc5bb20b6cb39f71790dd510a2190fe222b" --filename="service.yml"

{ submit:
   '71C19ECA5CFE93751509B4C82025025303D1ACEEDFB6EE9B56DCA42D91D94DF7' }

Note: in publish/delete operations both message and transaction would be signed by payloadKey. You could provide separate option --txKey to sign transaction with different key.

Get record:

registry-cli registry get-record --id="wrn:record:05013527-30ef-4aee-85d5-a71e1722f255"

[
    {
        "id": "wrn:record:05013527-30ef-4aee-85d5-a71e1722f255",
        "type": "wrn:registry-type:service",
        "owner": "a357a9a9b966f4939d75c62833583d55a4a845d1",
        "attributes": {
            "label": "Weather"
        }
    }
]

List records:

registry-cli registry list-records

{
        "id": "wrn:record:05013527-30ef-4aee-85d5-a71e1722f255",
        "type": "wrn:registry-type:service",
        "owner": "a357a9a9b966f4939d75c62833583d55a4a845d1",
        "attributes": {
            "label": "Weather"
        }
    }
]

Get bot:

registry-cli registry get-bot --name="TestBot" --tag="edcon-demo"

[
    {
        "name": "TestBot",
        "accessKey": "35292b64121dffa7e290f997392309afdefa81c38104805601a6bee7a796a6aa",
        "record": {
            "id": "wrn:record:wireline.io/bot/test-bot",
            "type": "wrn:registry-type:bot",
            "owner": "ef554582c8203342f86e4b93bc5891ea3b65cb8c",
            "attributes": {
                "name": "TestBot",
                "tag": "edcon-demo",
                "accessKey": "35292b64121dffa7e290f997392309afdefa81c38104805601a6bee7a796a6aa"
            }
        }
    }
]

List bots:

registry-cli registry list-bots
[
    {
        "name": "TestBot",
        "accessKey": "35292b64121dffa7e290f997392309afdefa81c38104805601a6bee7a796a6aa",
        "record": {
            "id": "wrn:record:wireline.io/bot/test-bot",
            "type": "wrn:registry-type:bot",
            "owner": "ef554582c8203342f86e4b93bc5891ea3b65cb8c",
            "attributes": {
                "tag": "edcon-demo",
                "accessKey": "35292b64121dffa7e290f997392309afdefa81c38104805601a6bee7a796a6aa",
                "name": "TestBot"
            }
        }
    }
]

Readme

Keywords

none

Package Sidebar

Install

npm i @wirelineio/registry-cli

Weekly Downloads

3

Version

0.1.23

License

UNLICENSED

Unpacked Size

54.3 kB

Total Files

10

Last publish

Collaborators

  • dboreham
  • telackey
  • egorgripasov
  • richburdon
  • ashwinp