From 98e70579e59fd4f9495dc2b4ed58f7a369174ba1 Mon Sep 17 00:00:00 2001 From: neeraj Date: Wed, 20 Mar 2024 11:12:31 +0530 Subject: [PATCH 1/3] Add steps to run registry cli test --- .env.example | 1 + README.md | 33 +++++++++++++++++++++++++++++++-- config.example.yml | 4 +++- 3 files changed, 35 insertions(+), 3 deletions(-) create mode 100644 .env.example diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..683b140 --- /dev/null +++ b/.env.example @@ -0,0 +1 @@ +TEST_ACCOUNT= diff --git a/README.md b/README.md index aa847f9..7eca4c0 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,8 @@ CLI utility written in TS, used to interact with laconicd. Depends on [registry- * Run `yarn` to install all dependencies. +* Run `yarn build`. + * Create a `config.yml` file from [config.example.yml](./config.example.yml) file. ## Account Setup @@ -15,17 +17,44 @@ Run the chain: - In laconicd repo run: ```bash - TEST_AUCTION_ENABLED=true ./init.sh + TEST_AUCTION_ENABLED=true ./scripts/init.sh ``` Registering records in registry requires an account. To get account private key run: ```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`. +## Run test + +* Create .env file using .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 laconic registry cli test + + ```bash + yarn test + ``` + ## Gas and Fees https://docs.evmos.org/users/basics/gas.html diff --git a/config.example.yml b/config.example.yml index a424c65..45b0c25 100644 --- a/config.example.yml +++ b/config.example.yml @@ -1,7 +1,9 @@ services: registry: - restEndpoint: 'http://localhost:1317' + restEndpoint: 'http://localhost:26657' gqlEndpoint: 'http://localhost:9473/api' userKey: bondId: chainId: laconic_9000-1 + gas: 200000 + fees: 200000photon -- 2.45.2 From 0425f0ee5815bf5f59c88559b669fd7745e8d0a8 Mon Sep 17 00:00:00 2001 From: neeraj Date: Wed, 20 Mar 2024 11:44:14 +0530 Subject: [PATCH 2/3] Update README --- README.md | 57 +++++++++++++------------------------------------- test/README.md | 28 +++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 42 deletions(-) create mode 100644 test/README.md diff --git a/README.md b/README.md index 7eca4c0..c7b38ba 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ Run the chain: - In laconicd repo run: ```bash - TEST_AUCTION_ENABLED=true ./scripts/init.sh + TEST_AUCTION_ENABLED=true ./scripts/init.sh clean ``` Registering records in registry requires an account. To get account private key run: @@ -28,33 +28,6 @@ laconic2d keys export alice --keyring-backend test --unarmored-hex --unsafe In `config.yml` file assign the account private key to `userKey`. -## Run test - -* Create .env file using .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 laconic registry cli test - - ```bash - yarn test - ``` - ## Gas and Fees https://docs.evmos.org/users/basics/gas.html @@ -111,10 +84,10 @@ $ laconic registry status Get account details: ```bash -$ laconic registry account get --address ethm133y09mveksh76uc99h4rl38nd033tk4e3y2z52 +$ laconic registry account get --address laconic15za32wly5exgcrt2zfr8php4ya49n5y7masu7k [ { - "address": "ethm133y09mveksh76uc99h4rl38nd033tk4e3y2z52", + "address": "laconic15za32wly5exgcrt2zfr8php4ya49n5y7masu7k", "pubKey": "A2BeFMnq4h0v5/hP+trvQbCtVWwGGYNSHWRJ7Ae60biS", "number": "0", "sequence": "37", @@ -131,10 +104,10 @@ $ laconic registry account get --address ethm133y09mveksh76uc99h4rl38nd033tk4e3y Send tokens: ```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", "number": "0", "sequence": "16", @@ -146,7 +119,7 @@ $ laconic registry tokens send --address ethm1vc62ysqu504at932jjq8pwrqgjt67rx6gg ] }, { - "address": "ethm1vc62ysqu504at932jjq8pwrqgjt67rx6ggn5yu", + "address": "laconic15za32wly5exgcrt2zfr8php4ya49n5y7masu7k", "pubKey": null, "number": "12", "sequence": "0", @@ -249,7 +222,7 @@ $ laconic registry authority whois laconic "auction": { "id": "0294fb2e3659c347b53a6faf4bef041fd934f0f3ab13df6d2468d5d63abacd48", "status": "commit", - "ownerAddress": "ethm1lfekr7gvqtnhpp2kwdc6u2n569cqsp4ww0m4y8", + "ownerAddress": "laconic15za32wly5exgcrt2zfr8php4ya49n5y7masu7k", "createTime": "2022-04-26T11:43:45.679728594", "commitsEndTime": "2022-04-26T11:44:45.679728594", "revealsEndTime": "2022-04-26T11:45:45.679728594", @@ -288,7 +261,7 @@ $ laconic registry auction get 0294fb2e3659c347b53a6faf4bef041fd934f0f3ab13df6d2 { "id": "0294fb2e3659c347b53a6faf4bef041fd934f0f3ab13df6d2468d5d63abacd48", "status": "commit", - "ownerAddress": "ethm1lfekr7gvqtnhpp2kwdc6u2n569cqsp4ww0m4y8", + "ownerAddress": "laconic15za32wly5exgcrt2zfr8php4ya49n5y7masu7k", "createTime": "2022-04-26T11:42:05.256059269", "commitsEndTime": "2022-04-26T11:44:45.679728594", "revealsEndTime": "2022-04-26T11:45:45.679728594", @@ -347,7 +320,7 @@ $ laconic registry authority reserve echo.laconic Create sub-authority (custom owner for sub-authority): ```bash -$ laconic registry authority reserve kube.laconic --owner ethm1vc62ysqu504at932jjq8pwrqgjt67rx6ggn5yu +$ laconic registry authority reserve kube.laconic --owner laconic15za32wly5exgcrt2zfr8php4ya49n5y7masu7k ``` Set name: @@ -435,7 +408,7 @@ $ laconic registry bond list [ { "id": "58508984500aa2ed18e059fa8203b40fbc9828e3bfa195361335c4e4524c4785", - "owner": "ethm1lfekr7gvqtnhpp2kwdc6u2n569cqsp4ww0m4y8", + "owner": "laconic15za32wly5exgcrt2zfr8php4ya49n5y7masu7k", "balance": [ { "type": "photon", @@ -445,7 +418,7 @@ $ laconic registry bond list }, { "id": "5c40abd336ae1561f2a1b55be73b12f5a083080bf879b4c9288d182d238badb0", - "owner": "ethm1lfekr7gvqtnhpp2kwdc6u2n569cqsp4ww0m4y8", + "owner": "laconic15za32wly5exgcrt2zfr8php4ya49n5y7masu7k", "balance": [ { "type": "photon", @@ -463,7 +436,7 @@ $ laconic registry bond get --id 58508984500aa2ed18e059fa8203b40fbc9828e3bfa1953 [ { "id": "58508984500aa2ed18e059fa8203b40fbc9828e3bfa195361335c4e4524c4785", - "owner": "ethm1lfekr7gvqtnhpp2kwdc6u2n569cqsp4ww0m4y8", + "owner": "laconic15za32wly5exgcrt2zfr8php4ya49n5y7masu7k", "balance": [ { "type": "photon", @@ -477,11 +450,11 @@ $ laconic registry bond get --id 58508984500aa2ed18e059fa8203b40fbc9828e3bfa1953 Query bonds by owner: ```bash -$ laconic registry bond list --owner ethm1lfekr7gvqtnhpp2kwdc6u2n569cqsp4ww0m4y8 +$ laconic registry bond list --owner laconic15za32wly5exgcrt2zfr8php4ya49n5y7masu7k [ { "id": "58508984500aa2ed18e059fa8203b40fbc9828e3bfa195361335c4e4524c4785", - "owner": "ethm1lfekr7gvqtnhpp2kwdc6u2n569cqsp4ww0m4y8", + "owner": "laconic15za32wly5exgcrt2zfr8php4ya49n5y7masu7k", "balance": [ { "type": "photon", @@ -491,7 +464,7 @@ $ laconic registry bond list --owner ethm1lfekr7gvqtnhpp2kwdc6u2n569cqsp4ww0m4y8 }, { "id": "5c40abd336ae1561f2a1b55be73b12f5a083080bf879b4c9288d182d238badb0", - "owner": "ethm1lfekr7gvqtnhpp2kwdc6u2n569cqsp4ww0m4y8", + "owner": "laconic15za32wly5exgcrt2zfr8php4ya49n5y7masu7k", "balance": [ { "type": "photon", diff --git a/test/README.md b/test/README.md new file mode 100644 index 0000000..877f65a --- /dev/null +++ b/test/README.md @@ -0,0 +1,28 @@ +## Run CLI tests + +* Follow the project `Setup` and `Account Setup` from root [README](./../README.md) + +* 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 + ``` -- 2.45.2 From cd52a9ae93a10c3772b3799a04fa812b82b209ea Mon Sep 17 00:00:00 2001 From: Nabarun Date: Thu, 21 Mar 2024 16:29:47 +0530 Subject: [PATCH 3/3] Update readme to set CLI in path --- README.md | 28 ++++++++++++++++++++++++++++ test/README.md | 6 ++++++ 2 files changed, 34 insertions(+) diff --git a/README.md b/README.md index c7b38ba..4fed61f 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,28 @@ 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 * Run `yarn` to install all dependencies. @@ -10,6 +32,12 @@ CLI utility written in TS, used to interact with laconicd. Depends on [registry- * 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 Run the chain: diff --git a/test/README.md b/test/README.md index 877f65a..1a2e3fb 100644 --- a/test/README.md +++ b/test/README.md @@ -2,6 +2,12 @@ * 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 -- 2.45.2