Compare commits
1 Commits
main
...
zramsay-pa
Author | SHA1 | Date | |
---|---|---|---|
|
8e594d9664 |
6
.github/workflows/manual_npm_publish.yml
vendored
6
.github/workflows/manual_npm_publish.yml
vendored
@ -35,6 +35,6 @@ jobs:
|
||||
- name: Authenticate to git.vdb.to registry
|
||||
run: |
|
||||
npm config set -- '//git.vdb.to/api/packages/cerc-io/npm/:_authToken' "${{ secrets.GITEA_PUBLISH_TOKEN }}"
|
||||
- name: npm publish
|
||||
run: npm publish
|
||||
|
||||
- name: lerna publish
|
||||
run: |
|
||||
lerna publish from-package --no-git-tag-version --yes
|
||||
|
37
.github/workflows/test.yml
vendored
37
.github/workflows/test.yml
vendored
@ -1,37 +0,0 @@
|
||||
name: Tests
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- release/**
|
||||
|
||||
jobs:
|
||||
sdk_tests:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Checkout laconicd
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
path: "./laconicd/"
|
||||
repository: cerc-io/laconicd
|
||||
fetch-depth: 0
|
||||
ref: main
|
||||
- name: Environment
|
||||
run: ls -tlh && env
|
||||
- name: build registry-cli container
|
||||
run: docker build -t cerc/laconic-registry-cli:local-test --build-arg CERC_NPM_URL=https://git.vdb.to/api/packages/cerc-io/npm/ --build-arg CERC_NPM_AUTH_TOKEN="${{ secrets.GITEA_PUBLISH_TOKEN }}" .
|
||||
- name: build containers scripts
|
||||
working-directory: laconicd/tests/sdk_tests
|
||||
run: ./build-laconicd-container.sh
|
||||
- name: start laconicd container
|
||||
working-directory: laconicd/tests/sdk_tests
|
||||
run: docker compose up laconicd -d
|
||||
|
||||
- name: Run registry-cli demo commands in registry-cli container
|
||||
run : ls -tla
|
||||
- name: stop containers
|
||||
working-directory: laconicd/tests/sdk_tests
|
||||
run: docker compose down
|
||||
|
3
.gitignore
vendored
3
.gitignore
vendored
@ -4,6 +4,3 @@ dist/*
|
||||
out
|
||||
|
||||
config.yml
|
||||
*~
|
||||
|
||||
.idea
|
56
Dockerfile
56
Dockerfile
@ -1,56 +0,0 @@
|
||||
# Originally from: https://github.com/devcontainers/images/blob/main/src/javascript-node/.devcontainer/Dockerfile
|
||||
# [Choice] Node.js version (use -bullseye variants on local arm64/Apple Silicon): 18, 16, 14, 18-bullseye, 16-bullseye, 14-bullseye, 18-buster, 16-buster, 14-buster
|
||||
ARG VARIANT=16-bullseye
|
||||
FROM node:${VARIANT}
|
||||
|
||||
ARG USERNAME=node
|
||||
ARG NPM_GLOBAL=/usr/local/share/npm-global
|
||||
|
||||
# This container pulls npm packages from a local registry configured via these env vars
|
||||
ARG CERC_NPM_URL
|
||||
ARG CERC_NPM_AUTH_TOKEN
|
||||
|
||||
# Add NPM global to PATH.
|
||||
ENV PATH=${NPM_GLOBAL}/bin:${PATH}
|
||||
|
||||
RUN \
|
||||
# Configure global npm install location, use group to adapt to UID/GID changes
|
||||
if ! cat /etc/group | grep -e "^npm:" > /dev/null 2>&1; then groupadd -r npm; fi \
|
||||
&& usermod -a -G npm ${USERNAME} \
|
||||
&& umask 0002 \
|
||||
&& mkdir -p ${NPM_GLOBAL} \
|
||||
&& touch /usr/local/etc/npmrc \
|
||||
&& chown ${USERNAME}:npm ${NPM_GLOBAL} /usr/local/etc/npmrc \
|
||||
&& chmod g+s ${NPM_GLOBAL} \
|
||||
&& npm config -g set prefix ${NPM_GLOBAL} \
|
||||
&& su ${USERNAME} -c "npm config -g set prefix ${NPM_GLOBAL}" \
|
||||
# Install eslint
|
||||
&& su ${USERNAME} -c "umask 0002 && npm install -g eslint" \
|
||||
&& npm cache clean --force > /dev/null 2>&1
|
||||
|
||||
# [Optional] Uncomment this section to install additional OS packages.
|
||||
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
|
||||
&& apt-get -y install --no-install-recommends jq
|
||||
|
||||
# [Optional] Uncomment if you want to install an additional version of node using nvm
|
||||
# ARG EXTRA_NODE_VERSION=10
|
||||
# RUN su node -c "source /usr/local/share/nvm/nvm.sh && nvm install ${EXTRA_NODE_VERSION}"
|
||||
|
||||
# [Optional] Uncomment if you want to install more global node modules
|
||||
# RUN su node -c "npm install -g <your-package-list-here>"
|
||||
|
||||
# Configure the local npm registry
|
||||
RUN npm config set @lirewine:registry ${CERC_NPM_URL} \
|
||||
&& npm config set @cerc-io:registry ${CERC_NPM_URL} \
|
||||
&& npm config set -- ${CERC_NPM_URL}:_authToken ${CERC_NPM_AUTH_TOKEN}
|
||||
|
||||
# TODO: the image at this point could be made a base image for several different CLI images
|
||||
# that install different Node-based CLI commands
|
||||
|
||||
# DEBUG, remove
|
||||
RUN yarn info @cerc-io/laconic-registry-cli
|
||||
|
||||
# Globally install the cli package
|
||||
RUN yarn global add @cerc-io/laconic-registry-cli
|
||||
|
||||
ENTRYPOINT ["laconic"]
|
34
README.md
34
README.md
@ -4,20 +4,14 @@ CLI utility written in TS, used to interact with laconicd. Depends on [laconic-s
|
||||
|
||||
## Setup
|
||||
|
||||
* Run `yarn` to install all dependencies.
|
||||
`npm config set registry https://git.vdb.to/api/packages/cerc-io/npm/`
|
||||
|
||||
* Run `yarn && yarn build` to install all dependencies.
|
||||
|
||||
* Create a `config.yml` file from [config.example.yml](./config.example.yml) file.
|
||||
|
||||
## Account Setup
|
||||
|
||||
Run the chain:
|
||||
|
||||
- In laconicd repo run:
|
||||
|
||||
```bash
|
||||
TEST_AUCTION_ENABLED=true ./init.sh
|
||||
```
|
||||
|
||||
Registering records in CNS requires an account. To get account private key run:
|
||||
|
||||
```bash
|
||||
@ -136,18 +130,26 @@ Create record (generic):
|
||||
```yaml
|
||||
# watcher.yml
|
||||
record:
|
||||
type: WebsiteRegistrationRecord
|
||||
url: 'https://cerc.io'
|
||||
repo_registration_record_cid: QmSnuWmxptJZdLJpKRarxBMS2Ju2oANVrgbr2xWbie9b2D
|
||||
build_artifact_cid: QmP8jTG1m9GSDJLCbeWhVSVgEzCPPwXRdCRuJtQ5Tz9Kc9
|
||||
tls_cert_cid: QmbWqxBEKC3P8tqsKc98xmWNzrzDtRLMiMPL8wBuTGsMnR
|
||||
version: 1.0.23
|
||||
name: ERC20 Watcher
|
||||
type: watcher
|
||||
version: 1.0.0
|
||||
protocol:
|
||||
/: QmbQiRpLX5djUsfc2yDswHvTkHTGd9uQEy6oUJfxkBYwRq
|
||||
package:
|
||||
linux:
|
||||
x64:
|
||||
/: QmVRmLrQeLZS8Xee7YVzYYAQANWmXqsNgNkaPMxM8MtPLA
|
||||
arm:
|
||||
/: QmX3DDmeFunX5aVmaTNnViwQUe15Wa4UbZYcC3AwFwoWcg
|
||||
macos:
|
||||
x64:
|
||||
/: QmXogCVZZ867qZfS3CYjYdDEziPb4ARiDfgwqbd7urVKkr
|
||||
```
|
||||
|
||||
Publish record (see below for commands to create/query bonds):
|
||||
|
||||
```bash
|
||||
$ laconic cns record publish --filename watcher.yml --bond-id 58508984500aa2ed18e059fa8203b40fbc9828e3bfa195361335c4e4524c4785 --gas 250000
|
||||
$ laconic cns record publish --filename watcher.yml --bond-id 58508984500aa2ed18e059fa8203b40fbc9828e3bfa195361335c4e4524c4785
|
||||
|
||||
{ id: 'bafyreic3auqajvgszh3vfjsouew2rsctswukc346dmlf273ln4g6iyyhba' }
|
||||
```
|
||||
|
@ -1,29 +0,0 @@
|
||||
services:
|
||||
laconicd:
|
||||
restart: unless-stopped
|
||||
image: cerc-io/laconicd:local-test
|
||||
command: ["sh", "/docker-entrypoint-scripts.d/create-fixturenet.sh"]
|
||||
volumes:
|
||||
- laconicd/init.sh:/docker-entrypoint-scripts.d/create-fixturenet.sh
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-v", "http://127.0.0.1:6060"]
|
||||
interval: 1s
|
||||
timeout: 5s
|
||||
retries: 30
|
||||
ports:
|
||||
- "6060"
|
||||
- "26657"
|
||||
- "26656"
|
||||
- "9473"
|
||||
- "8545"
|
||||
- "8546"
|
||||
- "9090"
|
||||
- "9091"
|
||||
- "1317"
|
||||
|
||||
cli-test-runner:
|
||||
image: cerc/laconic-registry-cli:local-test
|
||||
depends_on:
|
||||
laconicd:
|
||||
condition: service_healthy
|
||||
command: tail -F /dev/null
|
@ -2,7 +2,7 @@ import { Arguments } from 'yargs';
|
||||
import assert from 'assert';
|
||||
import { Account, Registry } from '@cerc-io/laconic-sdk';
|
||||
|
||||
import { getConfig, getConnectionInfo, queryOutput } from '../../../util';
|
||||
import { getConfig, getConnectionInfo } from '../../../util';
|
||||
|
||||
export const command = 'get';
|
||||
|
||||
@ -24,5 +24,5 @@ export const handler = async (argv: Arguments) => {
|
||||
const registry = new Registry(gqlEndpoint, restEndpoint, chainId);
|
||||
const result = await registry.getAccounts([address]);
|
||||
|
||||
queryOutput(result,argv.output);
|
||||
console.log(JSON.stringify(result, undefined, 2));
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ import { Account, createBid, Registry } from '@cerc-io/laconic-sdk';
|
||||
import { ensureDir } from 'fs-extra';
|
||||
import fs from 'fs';
|
||||
|
||||
import { getConfig, getConnectionInfo, getGasAndFees, txOutput } from '../../../../util';
|
||||
import { getConfig, getConnectionInfo, getGasAndFees } from '../../../../util';
|
||||
|
||||
const OUT_DIR = 'out';
|
||||
|
||||
@ -43,7 +43,7 @@ export const handler = async (argv: Arguments) => {
|
||||
const fee = getGasAndFees(argv, cnsConfig);
|
||||
|
||||
const result = await registry.commitBid({ auctionId, commitHash }, privateKey, fee);
|
||||
const revealFile = `{"reveal_file":"${revealFilePath}"}`
|
||||
console.log(JSON.stringify(result, undefined, 2));
|
||||
|
||||
txOutput(result,revealFile,argv.output,argv.verbose)
|
||||
console.log(`\nReveal file: ${revealFilePath}`);
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ import path from 'path';
|
||||
import { Registry } from '@cerc-io/laconic-sdk';
|
||||
import fs from 'fs';
|
||||
|
||||
import { getConfig, getConnectionInfo, getGasAndFees, txOutput } from '../../../../util';
|
||||
import { getConfig, getConnectionInfo, getGasAndFees } from '../../../../util';
|
||||
|
||||
export const command = 'reveal [auction-id] [file-path]';
|
||||
|
||||
@ -28,7 +28,5 @@ export const handler = async (argv: Arguments) => {
|
||||
|
||||
const reveal = fs.readFileSync(path.resolve(filePath));
|
||||
const result = await registry.revealBid({ auctionId, reveal: reveal.toString('hex') }, privateKey, fee);
|
||||
const success = `{"success":${result.code==0}}`
|
||||
|
||||
txOutput(result,success,argv.output,argv.verbose)
|
||||
console.log(JSON.stringify(result, undefined, 2));
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ import { Arguments } from 'yargs';
|
||||
import assert from 'assert';
|
||||
import { Registry } from '@cerc-io/laconic-sdk';
|
||||
|
||||
import { getConfig, getConnectionInfo, queryOutput } from '../../../util';
|
||||
import { getConfig, getConnectionInfo } from '../../../util';
|
||||
|
||||
export const command = 'get [id]';
|
||||
|
||||
@ -21,5 +21,5 @@ export const handler = async (argv: Arguments) => {
|
||||
const registry = new Registry(gqlEndpoint, restEndpoint, chainId);
|
||||
const result = await registry.getAuctionsByIds([id as string]);
|
||||
|
||||
queryOutput(result,argv.output)
|
||||
console.log(JSON.stringify(result, undefined, 2));
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ import { Arguments } from 'yargs';
|
||||
import assert from 'assert';
|
||||
import { Registry } from '@cerc-io/laconic-sdk';
|
||||
|
||||
import { getConfig, getConnectionInfo, getGasAndFees, txOutput } from '../../../../util';
|
||||
import { getConfig, getConnectionInfo, getGasAndFees } from '../../../../util';
|
||||
|
||||
export const command = 'set [name] [bond-id]';
|
||||
|
||||
@ -24,7 +24,5 @@ export const handler = async (argv: Arguments) => {
|
||||
const registry = new Registry(gqlEndpoint, restEndpoint, chainId);
|
||||
const fee = getGasAndFees(argv, cnsConfig);
|
||||
const result = await registry.setAuthorityBond({ name, bondId }, privateKey, fee);
|
||||
const success = `{"success":${result.code==0}}`
|
||||
|
||||
txOutput(result,success,argv.output,argv.verbose)
|
||||
console.log(JSON.stringify(result, undefined, 2));
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ import { Arguments } from 'yargs';
|
||||
import assert from 'assert';
|
||||
import { Registry } from '@cerc-io/laconic-sdk';
|
||||
|
||||
import { getConfig, getConnectionInfo, getGasAndFees, txOutput } from '../../../util';
|
||||
import { getConfig, getConnectionInfo, getGasAndFees } from '../../../util';
|
||||
|
||||
export const command = 'reserve [name]';
|
||||
|
||||
@ -31,6 +31,5 @@ export const handler = async (argv: Arguments) => {
|
||||
const fee = getGasAndFees(argv, cnsConfig);
|
||||
const result = await registry.reserveAuthority({ name, owner }, privateKey, fee);
|
||||
|
||||
const success = `{"success":${result.code==0}}`
|
||||
txOutput(result,success,argv.output,argv.verbose)
|
||||
console.log(JSON.stringify(result, undefined, 2));
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ import { Arguments } from 'yargs';
|
||||
import assert from 'assert';
|
||||
import { Registry } from '@cerc-io/laconic-sdk';
|
||||
|
||||
import { getConfig, getConnectionInfo, queryOutput } from '../../../util';
|
||||
import { getConfig, getConnectionInfo } from '../../../util';
|
||||
|
||||
export const command = 'whois [name]';
|
||||
|
||||
@ -21,5 +21,5 @@ export const handler = async (argv: Arguments) => {
|
||||
const registry = new Registry(gqlEndpoint, restEndpoint, chainId);
|
||||
const result = await registry.lookupAuthorities([name], true);
|
||||
|
||||
queryOutput(result,argv.output)
|
||||
console.log(JSON.stringify(result, undefined, 2));
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ import { Arguments } from 'yargs';
|
||||
import assert from 'assert';
|
||||
import { Registry } from '@cerc-io/laconic-sdk';
|
||||
|
||||
import { getConfig, getConnectionInfo, getGasAndFees ,txOutput} from '../../../util';
|
||||
import { getConfig, getConnectionInfo, getGasAndFees } from '../../../util';
|
||||
|
||||
export const command = 'associate';
|
||||
|
||||
@ -30,7 +30,5 @@ export const handler = async (argv: Arguments) => {
|
||||
const registry = new Registry(gqlEndpoint, restEndpoint, chainId);
|
||||
const fee = getGasAndFees(argv, cnsConfig);
|
||||
const result = await registry.associateBond({ recordId: id, bondId }, privateKey, fee);
|
||||
const success = `{"success":${result.code==0}}`
|
||||
txOutput(result,success,argv.output,argv.verbose)
|
||||
|
||||
console.log(JSON.stringify(result, undefined, 2));
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ import { Arguments } from 'yargs';
|
||||
import assert from 'assert';
|
||||
import { Registry } from '@cerc-io/laconic-sdk';
|
||||
|
||||
import { getConfig, getConnectionInfo, getGasAndFees,txOutput } from '../../../util';
|
||||
import { getConfig, getConnectionInfo, getGasAndFees } from '../../../util';
|
||||
|
||||
export const command = 'cancel';
|
||||
|
||||
@ -22,7 +22,5 @@ export const handler = async (argv: Arguments) => {
|
||||
const registry = new Registry(gqlEndpoint, restEndpoint, chainId);
|
||||
const fee = getGasAndFees(argv, cnsConfig);
|
||||
const result = await registry.cancelBond({ id }, privateKey, fee);
|
||||
const success = `{"success":${result.code==0}}`
|
||||
txOutput(result,success,argv.output,argv.verbose)
|
||||
|
||||
console.log(JSON.stringify(result, undefined, 2));
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ import { Arguments } from 'yargs';
|
||||
import assert from 'assert';
|
||||
import { Registry } from '@cerc-io/laconic-sdk';
|
||||
|
||||
import { getConfig, getConnectionInfo, getGasAndFees ,txOutput} from '../../../util';
|
||||
import { getConfig, getConnectionInfo, getGasAndFees } from '../../../util';
|
||||
|
||||
export const command = 'create';
|
||||
|
||||
@ -34,10 +34,6 @@ export const handler = async (argv: Arguments) => {
|
||||
|
||||
const registry = new Registry(gqlEndpoint, restEndpoint, chainId);
|
||||
const fee = getGasAndFees(argv, cnsConfig);
|
||||
const bondId = await registry.getNextBondId(privateKey);
|
||||
const result = await registry.createBond({ denom, amount }, privateKey, fee);
|
||||
const jsonString=`{"bondId":"${bondId}"}`
|
||||
|
||||
txOutput(result,jsonString,argv.output,argv.verbose)
|
||||
|
||||
console.log(verbose ? JSON.stringify(result, undefined, 2) : result.data);
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ import { Arguments } from 'yargs';
|
||||
import assert from 'assert';
|
||||
import { Registry } from '@cerc-io/laconic-sdk';
|
||||
|
||||
import { getConfig, getConnectionInfo, getGasAndFees ,txOutput} from '../../../util';
|
||||
import { getConfig, getConnectionInfo, getGasAndFees } from '../../../util';
|
||||
|
||||
export const command = 'dissociate';
|
||||
|
||||
@ -22,7 +22,5 @@ export const handler = async (argv: Arguments) => {
|
||||
const registry = new Registry(gqlEndpoint, restEndpoint, chainId);
|
||||
const fee = getGasAndFees(argv, cnsConfig);
|
||||
const result = await registry.dissociateBond({ recordId: id }, privateKey, fee);
|
||||
const success = `{"success":${result.code==0}}`
|
||||
txOutput(result,success,argv.output,argv.verbose)
|
||||
|
||||
console.log(JSON.stringify(result, undefined, 2));
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ import { Arguments } from 'yargs';
|
||||
import assert from 'assert';
|
||||
import { Registry } from '@cerc-io/laconic-sdk';
|
||||
|
||||
import { getConfig, getConnectionInfo ,queryOutput} from '../../../util';
|
||||
import { getConfig, getConnectionInfo } from '../../../util';
|
||||
|
||||
export const command = 'get';
|
||||
|
||||
@ -21,6 +21,5 @@ export const handler = async (argv: Arguments) => {
|
||||
const registry = new Registry(gqlEndpoint, restEndpoint, chainId);
|
||||
|
||||
const result = await registry.getBondsByIds([id as string]);
|
||||
|
||||
queryOutput(result,argv.output)
|
||||
console.log(JSON.stringify(result, undefined, 2));
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ import { Arguments } from 'yargs';
|
||||
import assert from 'assert';
|
||||
import { Registry } from '@cerc-io/laconic-sdk';
|
||||
|
||||
import { getConfig, getConnectionInfo ,queryOutput} from '../../../util';
|
||||
import { getConfig, getConnectionInfo } from '../../../util';
|
||||
|
||||
export const command = 'list';
|
||||
|
||||
@ -25,6 +25,5 @@ export const handler = async (argv: Arguments) => {
|
||||
|
||||
const { owner } = argv;
|
||||
const result = await registry.queryBonds({ owner });
|
||||
|
||||
queryOutput(result,argv.output)
|
||||
console.log(JSON.stringify(result, undefined, 2));
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ import { Arguments } from 'yargs';
|
||||
import assert from 'assert';
|
||||
import { Registry } from '@cerc-io/laconic-sdk';
|
||||
|
||||
import { getConfig, getConnectionInfo, getGasAndFees,txOutput } from '../../../../util';
|
||||
import { getConfig, getConnectionInfo, getGasAndFees } from '../../../../util';
|
||||
|
||||
export const command = 'dissociate';
|
||||
|
||||
@ -28,7 +28,5 @@ export const handler = async (argv: Arguments) => {
|
||||
const registry = new Registry(gqlEndpoint, restEndpoint, chainId);
|
||||
const fee = getGasAndFees(argv, cnsConfig);
|
||||
const result = await registry.dissociateRecords({ bondId }, privateKey, fee);
|
||||
const success = `{"success":${result.code==0}}`
|
||||
txOutput(result,success,argv.output,argv.verbose)
|
||||
|
||||
console.log(JSON.stringify(result, undefined, 2));
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ import { Arguments } from 'yargs';
|
||||
import assert from 'assert';
|
||||
import { Registry } from '@cerc-io/laconic-sdk';
|
||||
|
||||
import { getConfig, getConnectionInfo, getGasAndFees ,txOutput} from '../../../../util';
|
||||
import { getConfig, getConnectionInfo, getGasAndFees } from '../../../../util';
|
||||
|
||||
export const command = 'reassociate';
|
||||
|
||||
@ -33,7 +33,5 @@ export const handler = async (argv: Arguments) => {
|
||||
const registry = new Registry(gqlEndpoint, restEndpoint, chainId);
|
||||
const fee = getGasAndFees(argv, cnsConfig);
|
||||
const result = await registry.reassociateRecords({ oldBondId, newBondId }, privateKey, fee);
|
||||
const success = `{"success":${result.code==0}}`
|
||||
txOutput(result,success,argv.output,argv.verbose)
|
||||
|
||||
console.log(JSON.stringify(result, undefined, 2));
|
||||
}
|
||||
|
@ -2,8 +2,7 @@ import { Arguments } from 'yargs';
|
||||
import assert from 'assert';
|
||||
import { Registry } from '@cerc-io/laconic-sdk';
|
||||
|
||||
import { getConfig, getConnectionInfo, getGasAndFees ,txOutput} from '../../../util';
|
||||
import { isNil } from 'lodash';
|
||||
import { getConfig, getConnectionInfo, getGasAndFees } from '../../../util';
|
||||
|
||||
export const command = 'refill';
|
||||
|
||||
@ -37,7 +36,5 @@ export const handler = async (argv: Arguments) => {
|
||||
const registry = new Registry(gqlEndpoint, restEndpoint, chainId);
|
||||
const fee = getGasAndFees(argv, cnsConfig);
|
||||
const result = await registry.refillBond({ id, denom, amount }, privateKey, fee);
|
||||
const success = `{"success":${result.code==0}}`
|
||||
txOutput(result,success,argv.output,argv.verbose)
|
||||
|
||||
console.log(JSON.stringify(result, undefined, 2));
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ import { Arguments } from 'yargs';
|
||||
import assert from 'assert';
|
||||
import { Registry } from '@cerc-io/laconic-sdk';
|
||||
|
||||
import { getConfig, getConnectionInfo, getGasAndFees,txOutput } from '../../../util';
|
||||
import { getConfig, getConnectionInfo, getGasAndFees } from '../../../util';
|
||||
|
||||
export const command = 'withdraw';
|
||||
|
||||
@ -36,7 +36,5 @@ export const handler = async (argv: Arguments) => {
|
||||
const registry = new Registry(gqlEndpoint, restEndpoint, chainId);
|
||||
const fee = getGasAndFees(argv, cnsConfig);
|
||||
const result = await registry.withdrawBond({ id, denom, amount }, privateKey, fee);
|
||||
const success = `{"success":${result.code==0}}`
|
||||
txOutput(result,success,argv.output,argv.verbose)
|
||||
|
||||
console.log(JSON.stringify(result, undefined, 2));
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ import { Arguments } from 'yargs';
|
||||
import assert from 'assert';
|
||||
import { Registry } from '@cerc-io/laconic-sdk';
|
||||
|
||||
import { getConfig, getConnectionInfo, getGasAndFees ,txOutput} from '../../../util';
|
||||
import { getConfig, getConnectionInfo, getGasAndFees } from '../../../util';
|
||||
|
||||
export const command = 'delete [name]';
|
||||
|
||||
@ -23,7 +23,5 @@ export const handler = async (argv: Arguments) => {
|
||||
const fee = getGasAndFees(argv, cnsConfig);
|
||||
const result = await registry.deleteName({ crn: name }, privateKey, fee);
|
||||
|
||||
const success = `{"success":${result.code==0}}`
|
||||
txOutput(result,success,argv.output,argv.verbose)
|
||||
|
||||
console.log(JSON.stringify(result, undefined, 2));
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ import { Arguments } from 'yargs';
|
||||
import assert from 'assert';
|
||||
import { Registry } from '@cerc-io/laconic-sdk';
|
||||
|
||||
import { getConfig, getConnectionInfo ,queryOutput} from '../../../util';
|
||||
import { getConfig, getConnectionInfo } from '../../../util';
|
||||
|
||||
export const command = 'lookup [name]';
|
||||
|
||||
@ -27,5 +27,5 @@ export const handler = async (argv: Arguments) => {
|
||||
const registry = new Registry(gqlEndpoint, restEndpoint, chainId);
|
||||
const result = await registry.lookupNames([name], argv.history as boolean);
|
||||
|
||||
queryOutput(result,argv.output)
|
||||
console.log(JSON.stringify(result, undefined, 2));
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ import { Arguments } from 'yargs';
|
||||
import assert from 'assert';
|
||||
import { Registry } from '@cerc-io/laconic-sdk';
|
||||
|
||||
import { getConfig, getConnectionInfo,txOutput } from '../../../util';
|
||||
import { getConfig, getConnectionInfo } from '../../../util';
|
||||
|
||||
export const command = 'resolve [name]';
|
||||
|
||||
@ -21,7 +21,5 @@ export const handler = async (argv: Arguments) => {
|
||||
const registry = new Registry(gqlEndpoint, restEndpoint, chainId);
|
||||
|
||||
const result = await registry.resolveNames([name]);
|
||||
const success = `{"success":${result.code==0}}`
|
||||
txOutput(result,success,argv.output,argv.verbose)
|
||||
|
||||
console.log(JSON.stringify(result, undefined, 4));
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ import { Arguments } from 'yargs';
|
||||
import assert from 'assert';
|
||||
import { Registry } from '@cerc-io/laconic-sdk';
|
||||
|
||||
import { getConfig, getConnectionInfo, getGasAndFees,txOutput } from '../../../util';
|
||||
import { getConfig, getConnectionInfo, getGasAndFees } from '../../../util';
|
||||
|
||||
export const command = 'set [name] [id]';
|
||||
|
||||
@ -25,7 +25,5 @@ export const handler = async (argv: Arguments) => {
|
||||
const fee = getGasAndFees(argv, cnsConfig);
|
||||
const result = await registry.setName({ crn: name, cid: id }, privateKey, fee);
|
||||
|
||||
const success = `{"success":${result.code==0}}`
|
||||
txOutput(result,success,argv.output,argv.verbose)
|
||||
|
||||
console.log(JSON.stringify(result, undefined, 2));
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ import { Arguments } from 'yargs';
|
||||
import assert from 'assert';
|
||||
import { Registry } from '@cerc-io/laconic-sdk';
|
||||
|
||||
import { getConfig, getConnectionInfo ,queryOutput} from '../../../util';
|
||||
import { getConfig, getConnectionInfo } from '../../../util';
|
||||
|
||||
export const command = 'get';
|
||||
|
||||
@ -21,5 +21,5 @@ export const handler = async (argv: Arguments) => {
|
||||
const registry = new Registry(gqlEndpoint, restEndpoint, chainId);
|
||||
const result = await registry.getRecordsByIds([id as string]);
|
||||
|
||||
queryOutput(result,argv.output)
|
||||
console.log(JSON.stringify(result, undefined, 2));
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ import { Arguments } from 'yargs';
|
||||
import assert from 'assert';
|
||||
import { Registry } from '@cerc-io/laconic-sdk';
|
||||
|
||||
import { getConfig, getConnectionInfo ,queryOutput} from '../../../util';
|
||||
import { getConfig, getConnectionInfo } from '../../../util';
|
||||
|
||||
export const command = 'list';
|
||||
|
||||
@ -36,5 +36,5 @@ export const handler = async (argv: Arguments) => {
|
||||
const registry = new Registry(gqlEndpoint, restEndpoint, chainId);
|
||||
|
||||
const result = await registry.queryRecords({ bondId, type, name }, all as boolean);
|
||||
queryOutput(result,argv.output)
|
||||
console.log(JSON.stringify(result, undefined, 2));
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ import yaml from 'js-yaml';
|
||||
import fs from 'fs';
|
||||
import { Registry } from '@cerc-io/laconic-sdk';
|
||||
|
||||
import { getConfig, getGasAndFees, getConnectionInfo, txOutput } from '../../../util';
|
||||
import { getConfig, getGasAndFees, getConnectionInfo } from '../../../util';
|
||||
|
||||
export const command = 'publish';
|
||||
|
||||
@ -40,5 +40,5 @@ export const handler = async (argv: Arguments) => {
|
||||
const fee = getGasAndFees(argv, cnsConfig);
|
||||
const result = await registry.setRecord({ privateKey: userKey, record, bondId }, txKey as string, fee);
|
||||
|
||||
txOutput(result,JSON.stringify(result.data,undefined,2),argv.output,argv.verbose)
|
||||
console.log(verbose ? JSON.stringify(result, undefined, 2) : result.data);
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ import { Arguments } from 'yargs';
|
||||
import assert from 'assert';
|
||||
import { Account, Registry } from '@cerc-io/laconic-sdk';
|
||||
|
||||
import { getConfig, getConnectionInfo, getGasAndFees, queryOutput } from '../../../util';
|
||||
import { getConfig, getConnectionInfo, getGasAndFees } from '../../../util';
|
||||
|
||||
export const command = 'send';
|
||||
|
||||
@ -40,5 +40,5 @@ export const handler = async (argv: Arguments) => {
|
||||
const fee = getGasAndFees(argv, cnsConfig);
|
||||
await registry.sendCoins({ denom, amount, destinationAddress }, privateKey, fee);
|
||||
const result = await registry.getAccounts([fromAddress, destinationAddress]);
|
||||
queryOutput(result,argv.output)
|
||||
console.log(JSON.stringify(result, undefined, 2));
|
||||
}
|
||||
|
@ -15,11 +15,6 @@ yargs(hideBin(process.argv))
|
||||
default: 'config.yml',
|
||||
describe: 'Config file path.',
|
||||
type: 'string'
|
||||
},
|
||||
output: {
|
||||
alias: 'o',
|
||||
describe: 'Gives output in json format when specified.',
|
||||
type: 'string'
|
||||
}
|
||||
})
|
||||
.commandDir('cmds')
|
||||
|
@ -1,4 +1,3 @@
|
||||
export * from './fees';
|
||||
export * from './config';
|
||||
export * from './common';
|
||||
export * from './output';
|
||||
|
@ -1,16 +0,0 @@
|
||||
|
||||
export const txOutput = (result:any,msg:string,output:unknown,verbose:unknown) => {
|
||||
if (output=="json"){
|
||||
console.log(verbose ? JSON.parse(JSON.stringify(result)) : JSON.parse(msg));
|
||||
} else {
|
||||
console.log(verbose ? JSON.stringify(result,undefined,2) : msg);
|
||||
}
|
||||
};
|
||||
|
||||
export const queryOutput = (result: any, output: unknown) => {
|
||||
if (output=="json"){
|
||||
console.log(JSON.parse(JSON.stringify(result)));
|
||||
} else {
|
||||
console.log(JSON.stringify(result,undefined,2));
|
||||
}
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
record:
|
||||
type: WebsiteRegistrationRecord
|
||||
url: 'https://cerc.io'
|
||||
repo_registration_record_cid: QmSnuWmxptJZdLJpKRarxBMS2Ju2oANVrgbr2xWbie9b2D
|
||||
build_artifact_cid: QmP8jTG1m9GSDJLCbeWhVSVgEzCPPwXRdCRuJtQ5Tz9Kc9
|
||||
tls_cert_cid: QmbWqxBEKC3P8tqsKc98xmWNzrzDtRLMiMPL8wBuTGsMnR
|
||||
version: 1.0.35
|
14
yarn.lock
14
yarn.lock
@ -2,10 +2,10 @@
|
||||
# yarn lockfile v1
|
||||
|
||||
|
||||
"@cerc-io/laconic-sdk@0.1.6":
|
||||
version "0.1.6"
|
||||
resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Flaconic-sdk/-/0.1.6/laconic-sdk-0.1.6.tgz#2c4e678800467e7c92c3198fe332401d2ab395ce"
|
||||
integrity sha512-o7G/QpfmNTFkmKQEuCf8mdZc8AePRMQ9T5kLqW30aHi9vzwA5rI7I6dXmPLzGYwdMWUdeeQcePOQhwD2qccryw==
|
||||
"@cerc-io/laconic-sdk@0.1.4":
|
||||
version "0.1.4"
|
||||
resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Flaconic-sdk/-/0.1.4/laconic-sdk-0.1.4.tgz#06159cb3c9c48325b53eba9bd642cf63420351d9"
|
||||
integrity sha512-IsXUnz5S14zF+VPWydKy52PkCdyFqRJiMs9FCv8YEJVtUasXkU9xJLBmGaz7Nuo2MyNyKy2NHM7LoB1A75ZHAQ==
|
||||
dependencies:
|
||||
"@cosmjs/amino" "^0.28.1"
|
||||
"@cosmjs/crypto" "^0.28.1"
|
||||
@ -25,6 +25,7 @@
|
||||
ethers "^5.6.2"
|
||||
evmosjs "^0.2.5"
|
||||
graphql.js "^0.6.8"
|
||||
is-url "^1.2.4"
|
||||
js-sha256 "^0.9.0"
|
||||
js-yaml "^3.14.1"
|
||||
jsonschema "^1.4.0"
|
||||
@ -1130,6 +1131,11 @@ is-hex-prefixed@1.0.0:
|
||||
resolved "https://registry.yarnpkg.com/is-hex-prefixed/-/is-hex-prefixed-1.0.0.tgz#7d8d37e6ad77e5d127148913c573e082d777f554"
|
||||
integrity sha1-fY035q135dEnFIkTxXPggtd39VQ=
|
||||
|
||||
is-url@^1.2.4:
|
||||
version "1.2.4"
|
||||
resolved "https://registry.yarnpkg.com/is-url/-/is-url-1.2.4.tgz#04a4df46d28c4cff3d73d01ff06abeb318a1aa52"
|
||||
integrity sha512-ITvGim8FhRiYe4IQ5uHSkj7pVaPDrCTkNd3yq3cV7iZAcJdHTUMPMEHcqSOy9xZ9qFenQCvi+2wjH9a1nXqHww==
|
||||
|
||||
js-sha256@^0.9.0:
|
||||
version "0.9.0"
|
||||
resolved "https://registry.yarnpkg.com/js-sha256/-/js-sha256-0.9.0.tgz#0b89ac166583e91ef9123644bd3c5334ce9d0966"
|
||||
|
Loading…
Reference in New Issue
Block a user