Add instructions to run CLI tests #58
1
.env.example
Normal file
1
.env.example
Normal file
@ -0,0 +1 @@
|
|||||||
|
TEST_ACCOUNT=
|
62
README.md
62
README.md
@ -2,12 +2,42 @@
|
|||||||
|
|
||||||
CLI utility written in TS, used to interact with laconicd. Depends on [registry-sdk](https://git.vdb.to/cerc-io/registry-sdk).
|
CLI utility written in TS, used to interact with laconicd. Depends on [registry-sdk](https://git.vdb.to/cerc-io/registry-sdk).
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
- Add `.npmrc` file in desired project to resolve package
|
||||||
|
|
||||||
|
```bash
|
||||||
|
@cerc-io:registry=https://git.vdb.to/api/packages/cerc-io/npm/
|
||||||
|
```
|
||||||
|
|
||||||
|
This will set the registry for `cerc-io` scoped packages in the project
|
||||||
|
|
||||||
|
- Install the CLI using package manager
|
||||||
|
|
||||||
|
```bash
|
||||||
|
yarn add @cerc-io/laconic-registry-cli
|
||||||
|
```
|
||||||
|
|
||||||
|
- For installing CLI globally add `.npmrc` file above in home directory and run
|
||||||
|
|
||||||
|
```bash
|
||||||
|
yarn global add @cerc-io/laconic-registry-cli
|
||||||
|
```
|
||||||
|
|
||||||
## Setup
|
## Setup
|
||||||
|
|
||||||
* Run `yarn` to install all dependencies.
|
* Run `yarn` to install all dependencies.
|
||||||
|
|
||||||
|
* Run `yarn build`.
|
||||||
|
|
||||||
* Create a `config.yml` file from [config.example.yml](./config.example.yml) file.
|
* Create a `config.yml` file from [config.example.yml](./config.example.yml) file.
|
||||||
|
|
||||||
|
* Add CLI cmd to path
|
||||||
|
|
||||||
|
```bash
|
||||||
|
export PATH="$PWD/bin:$PATH"
|
||||||
|
```
|
||||||
|
|
||||||
## Account Setup
|
## Account Setup
|
||||||
|
|
||||||
Run the chain:
|
Run the chain:
|
||||||
@ -15,13 +45,13 @@ Run the chain:
|
|||||||
- In laconicd repo run:
|
- In laconicd repo run:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
TEST_AUCTION_ENABLED=true ./init.sh
|
TEST_AUCTION_ENABLED=true ./scripts/init.sh clean
|
||||||
```
|
```
|
||||||
|
|
||||||
Registering records in registry requires an account. To get account private key run:
|
Registering records in registry requires an account. To get account private key run:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ laconicd keys export mykey --unarmored-hex --unsafe
|
laconic2d keys export alice --keyring-backend test --unarmored-hex --unsafe
|
||||||
```
|
```
|
||||||
|
|
||||||
In `config.yml` file assign the account private key to `userKey`.
|
In `config.yml` file assign the account private key to `userKey`.
|
||||||
@ -82,10 +112,10 @@ $ laconic registry status
|
|||||||
Get account details:
|
Get account details:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ laconic registry account get --address ethm133y09mveksh76uc99h4rl38nd033tk4e3y2z52
|
$ laconic registry account get --address laconic15za32wly5exgcrt2zfr8php4ya49n5y7masu7k
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"address": "ethm133y09mveksh76uc99h4rl38nd033tk4e3y2z52",
|
"address": "laconic15za32wly5exgcrt2zfr8php4ya49n5y7masu7k",
|
||||||
"pubKey": "A2BeFMnq4h0v5/hP+trvQbCtVWwGGYNSHWRJ7Ae60biS",
|
"pubKey": "A2BeFMnq4h0v5/hP+trvQbCtVWwGGYNSHWRJ7Ae60biS",
|
||||||
"number": "0",
|
"number": "0",
|
||||||
"sequence": "37",
|
"sequence": "37",
|
||||||
@ -102,10 +132,10 @@ $ laconic registry account get --address ethm133y09mveksh76uc99h4rl38nd033tk4e3y
|
|||||||
Send tokens:
|
Send tokens:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ laconic registry tokens send --address ethm1vc62ysqu504at932jjq8pwrqgjt67rx6ggn5yu --type photon --quantity 1000000000
|
$ laconic registry tokens send --address laconic15za32wly5exgcrt2zfr8php4ya49n5y7masu7k --type photon --quantity 1000000000
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"address": "ethm1lfekr7gvqtnhpp2kwdc6u2n569cqsp4ww0m4y8",
|
"address": "laconic1pmuxrcnuhhf8qdllzuf2ctj2tnwwcg6yswqnyd",
|
||||||
"pubKey": "A68/q7/xazFzNj+rrvE07ALxkMgqw1ugL35VECkWAYvt",
|
"pubKey": "A68/q7/xazFzNj+rrvE07ALxkMgqw1ugL35VECkWAYvt",
|
||||||
"number": "0",
|
"number": "0",
|
||||||
"sequence": "16",
|
"sequence": "16",
|
||||||
@ -117,7 +147,7 @@ $ laconic registry tokens send --address ethm1vc62ysqu504at932jjq8pwrqgjt67rx6gg
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"address": "ethm1vc62ysqu504at932jjq8pwrqgjt67rx6ggn5yu",
|
"address": "laconic15za32wly5exgcrt2zfr8php4ya49n5y7masu7k",
|
||||||
"pubKey": null,
|
"pubKey": null,
|
||||||
"number": "12",
|
"number": "12",
|
||||||
"sequence": "0",
|
"sequence": "0",
|
||||||
@ -220,7 +250,7 @@ $ laconic registry authority whois laconic
|
|||||||
"auction": {
|
"auction": {
|
||||||
"id": "0294fb2e3659c347b53a6faf4bef041fd934f0f3ab13df6d2468d5d63abacd48",
|
"id": "0294fb2e3659c347b53a6faf4bef041fd934f0f3ab13df6d2468d5d63abacd48",
|
||||||
"status": "commit",
|
"status": "commit",
|
||||||
"ownerAddress": "ethm1lfekr7gvqtnhpp2kwdc6u2n569cqsp4ww0m4y8",
|
"ownerAddress": "laconic15za32wly5exgcrt2zfr8php4ya49n5y7masu7k",
|
||||||
"createTime": "2022-04-26T11:43:45.679728594",
|
"createTime": "2022-04-26T11:43:45.679728594",
|
||||||
"commitsEndTime": "2022-04-26T11:44:45.679728594",
|
"commitsEndTime": "2022-04-26T11:44:45.679728594",
|
||||||
"revealsEndTime": "2022-04-26T11:45:45.679728594",
|
"revealsEndTime": "2022-04-26T11:45:45.679728594",
|
||||||
@ -259,7 +289,7 @@ $ laconic registry auction get 0294fb2e3659c347b53a6faf4bef041fd934f0f3ab13df6d2
|
|||||||
{
|
{
|
||||||
"id": "0294fb2e3659c347b53a6faf4bef041fd934f0f3ab13df6d2468d5d63abacd48",
|
"id": "0294fb2e3659c347b53a6faf4bef041fd934f0f3ab13df6d2468d5d63abacd48",
|
||||||
"status": "commit",
|
"status": "commit",
|
||||||
"ownerAddress": "ethm1lfekr7gvqtnhpp2kwdc6u2n569cqsp4ww0m4y8",
|
"ownerAddress": "laconic15za32wly5exgcrt2zfr8php4ya49n5y7masu7k",
|
||||||
"createTime": "2022-04-26T11:42:05.256059269",
|
"createTime": "2022-04-26T11:42:05.256059269",
|
||||||
"commitsEndTime": "2022-04-26T11:44:45.679728594",
|
"commitsEndTime": "2022-04-26T11:44:45.679728594",
|
||||||
"revealsEndTime": "2022-04-26T11:45:45.679728594",
|
"revealsEndTime": "2022-04-26T11:45:45.679728594",
|
||||||
@ -318,7 +348,7 @@ $ laconic registry authority reserve echo.laconic
|
|||||||
Create sub-authority (custom owner for sub-authority):
|
Create sub-authority (custom owner for sub-authority):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ laconic registry authority reserve kube.laconic --owner ethm1vc62ysqu504at932jjq8pwrqgjt67rx6ggn5yu
|
$ laconic registry authority reserve kube.laconic --owner laconic15za32wly5exgcrt2zfr8php4ya49n5y7masu7k
|
||||||
```
|
```
|
||||||
|
|
||||||
Set name:
|
Set name:
|
||||||
@ -406,7 +436,7 @@ $ laconic registry bond list
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"id": "58508984500aa2ed18e059fa8203b40fbc9828e3bfa195361335c4e4524c4785",
|
"id": "58508984500aa2ed18e059fa8203b40fbc9828e3bfa195361335c4e4524c4785",
|
||||||
"owner": "ethm1lfekr7gvqtnhpp2kwdc6u2n569cqsp4ww0m4y8",
|
"owner": "laconic15za32wly5exgcrt2zfr8php4ya49n5y7masu7k",
|
||||||
"balance": [
|
"balance": [
|
||||||
{
|
{
|
||||||
"type": "photon",
|
"type": "photon",
|
||||||
@ -416,7 +446,7 @@ $ laconic registry bond list
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "5c40abd336ae1561f2a1b55be73b12f5a083080bf879b4c9288d182d238badb0",
|
"id": "5c40abd336ae1561f2a1b55be73b12f5a083080bf879b4c9288d182d238badb0",
|
||||||
"owner": "ethm1lfekr7gvqtnhpp2kwdc6u2n569cqsp4ww0m4y8",
|
"owner": "laconic15za32wly5exgcrt2zfr8php4ya49n5y7masu7k",
|
||||||
"balance": [
|
"balance": [
|
||||||
{
|
{
|
||||||
"type": "photon",
|
"type": "photon",
|
||||||
@ -434,7 +464,7 @@ $ laconic registry bond get --id 58508984500aa2ed18e059fa8203b40fbc9828e3bfa1953
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"id": "58508984500aa2ed18e059fa8203b40fbc9828e3bfa195361335c4e4524c4785",
|
"id": "58508984500aa2ed18e059fa8203b40fbc9828e3bfa195361335c4e4524c4785",
|
||||||
"owner": "ethm1lfekr7gvqtnhpp2kwdc6u2n569cqsp4ww0m4y8",
|
"owner": "laconic15za32wly5exgcrt2zfr8php4ya49n5y7masu7k",
|
||||||
"balance": [
|
"balance": [
|
||||||
{
|
{
|
||||||
"type": "photon",
|
"type": "photon",
|
||||||
@ -448,11 +478,11 @@ $ laconic registry bond get --id 58508984500aa2ed18e059fa8203b40fbc9828e3bfa1953
|
|||||||
Query bonds by owner:
|
Query bonds by owner:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ laconic registry bond list --owner ethm1lfekr7gvqtnhpp2kwdc6u2n569cqsp4ww0m4y8
|
$ laconic registry bond list --owner laconic15za32wly5exgcrt2zfr8php4ya49n5y7masu7k
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"id": "58508984500aa2ed18e059fa8203b40fbc9828e3bfa195361335c4e4524c4785",
|
"id": "58508984500aa2ed18e059fa8203b40fbc9828e3bfa195361335c4e4524c4785",
|
||||||
"owner": "ethm1lfekr7gvqtnhpp2kwdc6u2n569cqsp4ww0m4y8",
|
"owner": "laconic15za32wly5exgcrt2zfr8php4ya49n5y7masu7k",
|
||||||
"balance": [
|
"balance": [
|
||||||
{
|
{
|
||||||
"type": "photon",
|
"type": "photon",
|
||||||
@ -462,7 +492,7 @@ $ laconic registry bond list --owner ethm1lfekr7gvqtnhpp2kwdc6u2n569cqsp4ww0m4y8
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "5c40abd336ae1561f2a1b55be73b12f5a083080bf879b4c9288d182d238badb0",
|
"id": "5c40abd336ae1561f2a1b55be73b12f5a083080bf879b4c9288d182d238badb0",
|
||||||
"owner": "ethm1lfekr7gvqtnhpp2kwdc6u2n569cqsp4ww0m4y8",
|
"owner": "laconic15za32wly5exgcrt2zfr8php4ya49n5y7masu7k",
|
||||||
"balance": [
|
"balance": [
|
||||||
{
|
{
|
||||||
"type": "photon",
|
"type": "photon",
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
services:
|
services:
|
||||||
registry:
|
registry:
|
||||||
restEndpoint: 'http://localhost:1317'
|
restEndpoint: 'http://localhost:26657'
|
||||||
gqlEndpoint: 'http://localhost:9473/api'
|
gqlEndpoint: 'http://localhost:9473/api'
|
||||||
userKey:
|
userKey:
|
||||||
bondId:
|
bondId:
|
||||||
chainId: laconic_9000-1
|
chainId: laconic_9000-1
|
||||||
|
gas: 200000
|
||||||
|
fees: 200000photon
|
||||||
|
34
test/README.md
Normal file
34
test/README.md
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
## Run CLI tests
|
||||||
|
|
||||||
|
* Follow the project `Setup` and `Account Setup` from root [README](./../README.md)
|
||||||
|
|
||||||
|
* Add laconic cmd to path
|
||||||
|
|
||||||
|
```bash
|
||||||
|
export PATH="$PWD/bin:$PATH"
|
||||||
|
```
|
||||||
|
|
||||||
|
* Create a .env file using [.env.example](./.env.example):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cp .env.example .env
|
||||||
|
```
|
||||||
|
|
||||||
|
* Get account address of test account:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
laconic2d keys list --keyring-backend test
|
||||||
|
|
||||||
|
# - address: laconic10er85pyd7ukw732e88fzv7k0jq205764hye2dx
|
||||||
|
# name: alice
|
||||||
|
# pubkey: '{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"AsDoWlNIr3W013pOiwmopaB/SaWQj6r3g56xb2d9GxYK"}'
|
||||||
|
# type: local
|
||||||
|
```
|
||||||
|
|
||||||
|
Use the `address` field from the result and assign it in `TEST_ACCOUNT` field of `.env` file
|
||||||
|
|
||||||
|
* Run CLI tests:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
yarn test
|
||||||
|
```
|
Loading…
Reference in New Issue
Block a user