Use registry-sdk in CLI (#56)
Part of https://www.notion.so/Create-laconic-registry-SDK-d3a636d4aba44f7cbba3bd99b7146811 - Use user key as transaction private key in record publish cmd Co-authored-by: neeraj <neeraj.rtly@gmail.com> Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com> Reviewed-on: cerc-io/laconic-registry-cli#56 Co-authored-by: Nabarun <nabarun@deepstacksoft.com> Co-committed-by: Nabarun <nabarun@deepstacksoft.com>
This commit is contained in:
+4
-4
@@ -51,7 +51,7 @@ describe('Test laconic CLI commands', () => {
|
||||
describe('laconic CNS commands', () => {
|
||||
const testAccount = process.env.TEST_ACCOUNT;
|
||||
assert(testAccount, 'TEST_ACCOUNT not set in env');
|
||||
const testAccount2 = 'ethm1vc62ysqu504at932jjq8pwrqgjt67rx6ggn5yu';
|
||||
const testAccount2 = 'laconic1pmuxrcnuhhf8qdllzuf2ctj2tnwwcg6yswqnyd';
|
||||
const initialAccountBalance = Number('100000000000000000000000000');
|
||||
|
||||
const testAuthorityName = 'laconic';
|
||||
@@ -179,7 +179,7 @@ describe('Test laconic CLI commands', () => {
|
||||
|
||||
// Expect empty object
|
||||
expect(bondOutputObj.length).toEqual(1);
|
||||
expect(bondOutputObj[0]).toEqual({ id: '', owner: '', balance: [] });
|
||||
expect(bondOutputObj[0]).toEqual(null);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -398,7 +398,7 @@ describe('Test laconic CLI commands', () => {
|
||||
chainId: CHAIN_ID,
|
||||
auctionId: testAuctionId,
|
||||
bidderAddress: testAccount,
|
||||
bidAmount: `${bidAmount}aphoton`
|
||||
bidAmount: `${bidAmount}photon`
|
||||
});
|
||||
}, (AUCTION_COMMIT_DURATION + 5) * 1000);
|
||||
});
|
||||
@@ -481,7 +481,7 @@ describe('Test laconic CLI commands', () => {
|
||||
});
|
||||
|
||||
describe('Name operations', () => {
|
||||
const testName = 'crn://laconic/watcher/erc20';
|
||||
const testName = 'lrn://laconic/watcher/erc20';
|
||||
|
||||
test('laconic cns name set <name> <record_id>', async () => {
|
||||
const result = spawnSync('laconic', ['cns', 'name', 'set', testName, testRecordId]);
|
||||
|
||||
+1
-2
@@ -3,7 +3,7 @@ import yaml from 'js-yaml';
|
||||
import { SpawnSyncReturns, spawnSync } from 'child_process';
|
||||
|
||||
export const CHAIN_ID = 'laconic_9000-1';
|
||||
export const TOKEN_TYPE = 'aphoton';
|
||||
export const TOKEN_TYPE = 'photon';
|
||||
|
||||
export const AUCTION_FEES = {
|
||||
commit: 1000000,
|
||||
@@ -21,7 +21,6 @@ export function checkResultAndRetrieveOutput (result: SpawnSyncReturns<Buffer>):
|
||||
|
||||
const output = result.stdout.toString().trim();
|
||||
expect(output.length).toBeGreaterThan(0);
|
||||
|
||||
return JSON.parse(output);
|
||||
}
|
||||
|
||||
|
||||
+11
-11
@@ -1,34 +1,34 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Get the key from laconicd
|
||||
laconicd_key=$(yes | docker compose exec laconicd laconicd keys export mykey --unarmored-hex --unsafe)
|
||||
# Get the key from laconic2d
|
||||
laconic2d_key=$(yes | docker compose exec laconic2d laconic2d keys export alice --keyring-backend test --unarmored-hex --unsafe)
|
||||
|
||||
# Get the fixturenet account address
|
||||
laconicd_account_address=$(docker compose exec laconicd laconicd keys list | awk '/- address:/ {print $3}')
|
||||
laconic2d_account_address=$(docker compose exec laconic2d laconic2d keys list --keyring-backend test | awk '/- address:/ {print $3}')
|
||||
|
||||
# Set parameters for the test suite
|
||||
cosmos_chain_id=laconic_9000-1
|
||||
laconicd_rest_endpoint=http://127.0.0.1:1317
|
||||
laconicd_gql_endpoint=http://127.0.0.1:9473/api
|
||||
laconic2d_rpc_endpoint=http://127.0.0.1:26657
|
||||
laconic2d_gql_endpoint=http://127.0.0.1:9473/api
|
||||
|
||||
# Create the required config
|
||||
config_file="config.yml"
|
||||
config=$(cat <<EOL
|
||||
services:
|
||||
cns:
|
||||
restEndpoint: $laconicd_rest_endpoint
|
||||
gqlEndpoint: $laconicd_gql_endpoint
|
||||
userKey: $laconicd_key
|
||||
restEndpoint: $laconic2d_rpc_endpoint
|
||||
gqlEndpoint: $laconic2d_gql_endpoint
|
||||
userKey: $laconic2d_key
|
||||
bondId:
|
||||
chainId: $cosmos_chain_id
|
||||
gas: 200000
|
||||
fees: 200000aphoton
|
||||
fees: 200000photon
|
||||
EOL
|
||||
)
|
||||
echo "$config" > "$config_file"
|
||||
|
||||
# Wait for the laconid endpoint to come up
|
||||
docker compose exec laconicd sh -c "curl --retry 10 --retry-delay 3 --retry-connrefused http://127.0.0.1:9473/api"
|
||||
docker compose exec laconic2d sh -c "curl --retry 10 --retry-delay 3 --retry-connrefused http://127.0.0.1:9473/api"
|
||||
|
||||
# Run tests
|
||||
TEST_ACCOUNT=$laconicd_account_address yarn test
|
||||
TEST_ACCOUNT=$laconic2d_account_address yarn test
|
||||
|
||||
Reference in New Issue
Block a user