Compare commits
6
Commits
v0.2.0
...
release-v0.2.5
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
aa46032bda | ||
|
|
c67961869b | ||
|
|
acd4791355 | ||
|
|
30654bb0ef | ||
|
|
70e63c74f1 | ||
|
|
901126d23f |
@@ -33,6 +33,4 @@ jobs:
|
||||
npm config set -- '//git.vdb.to/api/packages/cerc-io/npm/:_authToken' "${{ secrets.CICD_PUBLISH_TOKEN }}"
|
||||
- name: npm publish
|
||||
run: |
|
||||
# Use beta dist-tag
|
||||
# See https://docs.npmjs.com/cli/v10/commands/npm-dist-tag and https://docs.npmjs.com/adding-dist-tags-to-packages
|
||||
npm publish --tag beta
|
||||
npm publish
|
||||
|
||||
@@ -54,7 +54,15 @@ Registering records in registry requires an account. To get account private key
|
||||
laconicd 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`:
|
||||
|
||||
```yml
|
||||
services:
|
||||
registry:
|
||||
..
|
||||
userKey: "<user-key>"
|
||||
..
|
||||
```
|
||||
|
||||
## Gas and Fees
|
||||
|
||||
@@ -68,7 +76,7 @@ The `gas` and `fees` can be set to some default values in the config, and can be
|
||||
Example:
|
||||
|
||||
```bash
|
||||
$ laconic registry bond create --type photon --quantity 1000000000 --gas 200000 --fees 200000photon
|
||||
$ laconic registry bond create --type alnt --quantity 100000000000 --gas 200000 --fees 200000alnt
|
||||
```
|
||||
|
||||
## Operations
|
||||
@@ -121,7 +129,7 @@ $ laconic registry account get --address laconic15za32wly5exgcrt2zfr8php4ya49n5y
|
||||
"sequence": "37",
|
||||
"balance": [
|
||||
{
|
||||
"type": "photon",
|
||||
"type": "alnt",
|
||||
"quantity": "89998999999999991999799300"
|
||||
}
|
||||
]
|
||||
@@ -132,33 +140,62 @@ $ laconic registry account get --address laconic15za32wly5exgcrt2zfr8php4ya49n5y
|
||||
Send tokens:
|
||||
|
||||
```bash
|
||||
$ laconic registry tokens send --address laconic15za32wly5exgcrt2zfr8php4ya49n5y7masu7k --type photon --quantity 1000000000
|
||||
[
|
||||
{
|
||||
"address": "laconic1pmuxrcnuhhf8qdllzuf2ctj2tnwwcg6yswqnyd",
|
||||
"pubKey": "A68/q7/xazFzNj+rrvE07ALxkMgqw1ugL35VECkWAYvt",
|
||||
"number": "0",
|
||||
"sequence": "16",
|
||||
"balance": [
|
||||
{
|
||||
"type": "photon",
|
||||
"quantity": "99998999999999997973999700"
|
||||
}
|
||||
]
|
||||
$ laconic registry tokens send --address laconic15za32wly5exgcrt2zfr8php4ya49n5y7masu7k --type alnt --quantity 1000000000
|
||||
{
|
||||
"tx": {
|
||||
"hash": "977152CBE474613E1BBAFEF286F12134829FAF3C9E7C8349149DE3E687B816FC",
|
||||
"height": 343369,
|
||||
"index": 0,
|
||||
"code": 0,
|
||||
"log": "",
|
||||
"sender": "laconic1pmuxrcnuhhf8qdllzuf2ctj2tnwwcg6yswqnyd",
|
||||
"recipient": "laconic15za32wly5exgcrt2zfr8php4ya49n5y7masu7k",
|
||||
"amount": "1000000000alnt"
|
||||
},
|
||||
{
|
||||
"address": "laconic15za32wly5exgcrt2zfr8php4ya49n5y7masu7k",
|
||||
"pubKey": null,
|
||||
"number": "12",
|
||||
"sequence": "0",
|
||||
"balance": [
|
||||
{
|
||||
"type": "photon",
|
||||
"quantity": "1000000000"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
"accounts": [
|
||||
{
|
||||
"address": "laconic1pmuxrcnuhhf8qdllzuf2ctj2tnwwcg6yswqnyd",
|
||||
"pubKey": "A68/q7/xazFzNj+rrvE07ALxkMgqw1ugL35VECkWAYvt",
|
||||
"number": "0",
|
||||
"sequence": "16",
|
||||
"balance": [
|
||||
{
|
||||
"type": "alnt",
|
||||
"quantity": "99998999999999997973999700"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"address": "laconic15za32wly5exgcrt2zfr8php4ya49n5y7masu7k",
|
||||
"pubKey": null,
|
||||
"number": "12",
|
||||
"sequence": "0",
|
||||
"balance": [
|
||||
{
|
||||
"type": "alnt",
|
||||
"quantity": "1000000000"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
Get token TX details:
|
||||
|
||||
```bash
|
||||
$ laconic registry tokens gettx --hash 977152CBE474613E1BBAFEF286F12134829FAF3C9E7C8349149DE3E687B816FC
|
||||
{
|
||||
"hash": "977152CBE474613E1BBAFEF286F12134829FAF3C9E7C8349149DE3E687B816FC",
|
||||
"height": 343369,
|
||||
"index": 0,
|
||||
"code": 0,
|
||||
"log": "",
|
||||
"sender": "laconic1pmuxrcnuhhf8qdllzuf2ctj2tnwwcg6yswqnyd",
|
||||
"recipient": "laconic15za32wly5exgcrt2zfr8php4ya49n5y7masu7k",
|
||||
"amount": "1000000000alnt",
|
||||
"raw": "0A91010A8E010A1C2F636F736D6F732E62616E6B2E763162657461312E4D736753656E64126E0A2E6C61636F6E696331347763303777613372377270707275343367396A786B7A68716E686D76666D34646765793673122E6C61636F6E6963317971706337637966657470676D71746B6B30756B657675676561617539703063776D6A6C73751A0C0A04616C6E7412043130303012680A500A460A1F2F636F736D6F732E63727970746F2E736563703235366B312E5075624B657912230A2102F3A1D077638F9FD828C4CF126FE82E0BE98388083F5BC1E1DD4D84132AEBFF8112040A020801185A12140A0E0A04616C6E7412063430303030301080B5181A4088DF7BA4B63EA68E185AB2887C9EC29EBC4158874BC037816B8494AD36D3B2433B5223CECC336D4624BB7FEF4DBB4A8B5F4707ACD8E55443312009E9473DF821"
|
||||
}
|
||||
```
|
||||
|
||||
Create record (generic):
|
||||
@@ -177,7 +214,7 @@ record:
|
||||
Publish record (see below for commands to create/query bonds):
|
||||
|
||||
```bash
|
||||
$ laconic registry record publish --filename watcher.yml --bond-id 58508984500aa2ed18e059fa8203b40fbc9828e3bfa195361335c4e4524c4785 --gas 250000
|
||||
$ laconic registry record publish --filename watcher.yml --bond-id 58508984500aa2ed18e059fa8203b40fbc9828e3bfa195361335c4e4524c4785 --gas 250000 --fees 250000alnt
|
||||
|
||||
{ id: 'bafyreic3auqajvgszh3vfjsouew2rsctswukc346dmlf273ln4g6iyyhba' }
|
||||
```
|
||||
@@ -255,15 +292,15 @@ $ laconic registry authority whois laconic
|
||||
"commitsEndTime": "2022-04-26T11:44:45.679728594",
|
||||
"revealsEndTime": "2022-04-26T11:45:45.679728594",
|
||||
"commitFee": {
|
||||
"type": "photon",
|
||||
"type": "alnt",
|
||||
"quantity": "1000000"
|
||||
},
|
||||
"revealFee": {
|
||||
"type": "photon",
|
||||
"type": "alnt",
|
||||
"quantity": "1000000"
|
||||
},
|
||||
"minimumBid": {
|
||||
"type": "photon",
|
||||
"type": "alnt",
|
||||
"quantity": "5000000"
|
||||
},
|
||||
"winnerAddress": "",
|
||||
@@ -294,15 +331,15 @@ $ laconic registry auction get 0294fb2e3659c347b53a6faf4bef041fd934f0f3ab13df6d2
|
||||
"commitsEndTime": "2022-04-26T11:44:45.679728594",
|
||||
"revealsEndTime": "2022-04-26T11:45:45.679728594",
|
||||
"commitFee": {
|
||||
"type": "photon",
|
||||
"type": "alnt",
|
||||
"quantity": "1000000"
|
||||
},
|
||||
"revealFee": {
|
||||
"type": "photon",
|
||||
"type": "alnt",
|
||||
"quantity": "1000000"
|
||||
},
|
||||
"minimumBid": {
|
||||
"type": "photon",
|
||||
"type": "alnt",
|
||||
"quantity": "5000000"
|
||||
},
|
||||
"winnerAddress": "",
|
||||
@@ -322,7 +359,7 @@ $ laconic registry auction get 0294fb2e3659c347b53a6faf4bef041fd934f0f3ab13df6d2
|
||||
Commit an auction bid:
|
||||
|
||||
```bash
|
||||
$ laconic registry auction bid commit 0294fb2e3659c347b53a6faf4bef041fd934f0f3ab13df6d2468d5d63abacd48 25000000 photon
|
||||
$ laconic registry auction bid commit 0294fb2e3659c347b53a6faf4bef041fd934f0f3ab13df6d2468d5d63abacd48 25000000 alnt
|
||||
|
||||
Reveal file: ./out/bafyreiay2rccax64yn4ljhvzvm3jkbebvzheyucuma5jlbpzpzd5i5gjuy.json
|
||||
```
|
||||
@@ -351,6 +388,18 @@ Create sub-authority (custom owner for sub-authority):
|
||||
$ laconic registry authority reserve kube.laconic --owner laconic15za32wly5exgcrt2zfr8php4ya49n5y7masu7k
|
||||
```
|
||||
|
||||
Get all the authorities:
|
||||
|
||||
```bash
|
||||
$ laconic registry authority list
|
||||
```
|
||||
|
||||
Get all the authorities by owner:
|
||||
|
||||
```bash
|
||||
$ laconic registry authority list --owner laconic1zayjut6pd4xy9dguut56v55hktzmeq6r777hmd
|
||||
```
|
||||
|
||||
Set name:
|
||||
|
||||
```bash
|
||||
@@ -426,7 +475,7 @@ $ laconic registry name resolve lrn://laconic/watcher/erc20
|
||||
Create bond:
|
||||
|
||||
```bash
|
||||
$ laconic registry bond create --type photon --quantity 1000
|
||||
$ laconic registry bond create --type alnt --quantity 1000
|
||||
```
|
||||
|
||||
List bonds:
|
||||
@@ -439,7 +488,7 @@ $ laconic registry bond list
|
||||
"owner": "laconic15za32wly5exgcrt2zfr8php4ya49n5y7masu7k",
|
||||
"balance": [
|
||||
{
|
||||
"type": "photon",
|
||||
"type": "alnt",
|
||||
"quantity": "698000000"
|
||||
}
|
||||
]
|
||||
@@ -449,7 +498,7 @@ $ laconic registry bond list
|
||||
"owner": "laconic15za32wly5exgcrt2zfr8php4ya49n5y7masu7k",
|
||||
"balance": [
|
||||
{
|
||||
"type": "photon",
|
||||
"type": "alnt",
|
||||
"quantity": "1000"
|
||||
}
|
||||
]
|
||||
@@ -467,7 +516,7 @@ $ laconic registry bond get --id 58508984500aa2ed18e059fa8203b40fbc9828e3bfa1953
|
||||
"owner": "laconic15za32wly5exgcrt2zfr8php4ya49n5y7masu7k",
|
||||
"balance": [
|
||||
{
|
||||
"type": "photon",
|
||||
"type": "alnt",
|
||||
"quantity": "691000000"
|
||||
}
|
||||
]
|
||||
@@ -485,7 +534,7 @@ $ laconic registry bond list --owner laconic15za32wly5exgcrt2zfr8php4ya49n5y7mas
|
||||
"owner": "laconic15za32wly5exgcrt2zfr8php4ya49n5y7masu7k",
|
||||
"balance": [
|
||||
{
|
||||
"type": "photon",
|
||||
"type": "alnt",
|
||||
"quantity": "684000000"
|
||||
}
|
||||
]
|
||||
@@ -495,7 +544,7 @@ $ laconic registry bond list --owner laconic15za32wly5exgcrt2zfr8php4ya49n5y7mas
|
||||
"owner": "laconic15za32wly5exgcrt2zfr8php4ya49n5y7masu7k",
|
||||
"balance": [
|
||||
{
|
||||
"type": "photon",
|
||||
"type": "alnt",
|
||||
"quantity": "1000"
|
||||
}
|
||||
]
|
||||
@@ -506,13 +555,13 @@ $ laconic registry bond list --owner laconic15za32wly5exgcrt2zfr8php4ya49n5y7mas
|
||||
Refill bond:
|
||||
|
||||
```bash
|
||||
$ laconic registry bond refill --id 58508984500aa2ed18e059fa8203b40fbc9828e3bfa195361335c4e4524c4785 --type photon --quantity 1000
|
||||
$ laconic registry bond refill --id 58508984500aa2ed18e059fa8203b40fbc9828e3bfa195361335c4e4524c4785 --type alnt --quantity 1000
|
||||
```
|
||||
|
||||
Withdraw funds from bond:
|
||||
|
||||
```bash
|
||||
$ laconic registry bond withdraw --id 58508984500aa2ed18e059fa8203b40fbc9828e3bfa195361335c4e4524c4785 --type photon --quantity 500
|
||||
$ laconic registry bond withdraw --id 58508984500aa2ed18e059fa8203b40fbc9828e3bfa195361335c4e4524c4785 --type alnt --quantity 500
|
||||
```
|
||||
|
||||
Cancel bond:
|
||||
|
||||
+1
-1
@@ -6,4 +6,4 @@ services:
|
||||
bondId:
|
||||
chainId: laconic_9000-1
|
||||
gas: 200000
|
||||
fees: 200000photon
|
||||
fees: 200000alnt
|
||||
|
||||
+1
-1
@@ -34,7 +34,7 @@
|
||||
# userKey: <ALICE_PRIVATE_KEY>
|
||||
|
||||
# Create a bond
|
||||
laconic --config config.yml registry bond create --type photon --quantity 100000000000
|
||||
laconic --config config.yml registry bond create --type alnt --quantity 100000000000
|
||||
|
||||
# Get the bond id
|
||||
laconic --config config.yml registry bond list | jq -r '.[].id'
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@cerc-io/laconic-registry-cli",
|
||||
"version": "0.2.0",
|
||||
"version": "0.2.5",
|
||||
"main": "index.js",
|
||||
"repository": "git@github.com:cerc-io/laconic-registry-cli.git",
|
||||
"author": "",
|
||||
@@ -29,7 +29,7 @@
|
||||
"typescript": "^4.6.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@cerc-io/registry-sdk": "^0.2.2",
|
||||
"@cerc-io/registry-sdk": "^0.2.6",
|
||||
"fs-extra": "^10.1.0",
|
||||
"js-yaml": "^3.14.1",
|
||||
"lodash": "^4.17.21",
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
import { Arguments } from 'yargs';
|
||||
import assert from 'assert';
|
||||
|
||||
import { Registry } from '@cerc-io/registry-sdk';
|
||||
|
||||
import { getConfig, getConnectionInfo, queryOutput } from '../../../util';
|
||||
|
||||
export const command = 'list';
|
||||
|
||||
export const desc = 'List authorities (optionally by owner).';
|
||||
|
||||
export const builder = {
|
||||
owner: {
|
||||
type: 'string'
|
||||
}
|
||||
};
|
||||
|
||||
export const handler = async (argv: Arguments) => {
|
||||
const { services: { registry: registryConfig } } = getConfig(argv.config as string);
|
||||
const { rpcEndpoint, gqlEndpoint, chainId } = getConnectionInfo(argv, registryConfig);
|
||||
assert(rpcEndpoint, 'Invalid registry RPC endpoint.');
|
||||
assert(gqlEndpoint, 'Invalid registry GQL endpoint.');
|
||||
assert(chainId, 'Invalid registry Chain ID.');
|
||||
|
||||
const registry = new Registry(gqlEndpoint, rpcEndpoint, chainId);
|
||||
const result = await registry.getAuthorities(argv.owner as string);
|
||||
|
||||
queryOutput(result, argv.output);
|
||||
};
|
||||
@@ -0,0 +1,54 @@
|
||||
import { Arguments } from 'yargs';
|
||||
import assert from 'assert';
|
||||
import { Account, Registry } from '@cerc-io/registry-sdk';
|
||||
|
||||
import { getConfig, getConnectionInfo, queryOutput } from '../../../util';
|
||||
import { IndexedTx } from '@cosmjs/stargate/build/stargateclient';
|
||||
|
||||
export const command = 'gettx';
|
||||
|
||||
export const desc = 'Get token transfer tx info.';
|
||||
|
||||
export const builder = {
|
||||
hash: {
|
||||
type: 'string'
|
||||
}
|
||||
};
|
||||
|
||||
export const handler = async (argv: Arguments) => {
|
||||
const hash = argv.hash as string;
|
||||
|
||||
assert(hash, 'Invalid tx hash.');
|
||||
|
||||
const { services: { registry: registryConfig } } = getConfig(argv.config as string);
|
||||
const { rpcEndpoint, gqlEndpoint, privateKey, chainId } = getConnectionInfo(argv, registryConfig);
|
||||
assert(rpcEndpoint, 'Invalid registry RPC endpoint.');
|
||||
assert(gqlEndpoint, 'Invalid registry GQL endpoint.');
|
||||
assert(privateKey, 'Invalid Transaction Key.');
|
||||
assert(chainId, 'Invalid registry Chain ID.');
|
||||
|
||||
const account = new Account(Buffer.from(privateKey, 'hex'));
|
||||
await account.init();
|
||||
|
||||
const registry = new Registry(gqlEndpoint, rpcEndpoint, chainId);
|
||||
const laconicClient = await registry.getLaconicClient(account);
|
||||
|
||||
const txResponse: IndexedTx | null = await laconicClient.getTx(hash);
|
||||
if (txResponse) {
|
||||
const transfer = txResponse.events.find(e => e.type === 'transfer' ? e.attributes.find(a => a.key === 'msg_index') : null);
|
||||
const output = {
|
||||
hash: txResponse.hash,
|
||||
height: txResponse.height,
|
||||
index: txResponse.txIndex,
|
||||
code: txResponse.code,
|
||||
log: txResponse.rawLog,
|
||||
sender: transfer?.attributes.find(a => a.key === 'sender')?.value,
|
||||
recipient: transfer?.attributes.find(a => a.key === 'recipient')?.value,
|
||||
amount: transfer?.attributes.find(a => a.key === 'amount')?.value,
|
||||
raw: Buffer.from(txResponse.tx).toString('hex').toUpperCase()
|
||||
};
|
||||
queryOutput(output, argv.output);
|
||||
} else {
|
||||
queryOutput(null, argv.output);
|
||||
}
|
||||
};
|
||||
@@ -3,6 +3,7 @@ import assert from 'assert';
|
||||
import { Account, Registry } from '@cerc-io/registry-sdk';
|
||||
|
||||
import { getConfig, getConnectionInfo, getGasAndFees, queryOutput } from '../../../util';
|
||||
import { DeliverTxResponse } from '@cosmjs/stargate';
|
||||
|
||||
export const command = 'send';
|
||||
|
||||
@@ -38,8 +39,38 @@ export const handler = async (argv: Arguments) => {
|
||||
const fromAddress = account.address;
|
||||
|
||||
const registry = new Registry(gqlEndpoint, rpcEndpoint, chainId);
|
||||
const laconicClient = await registry.getLaconicClient(account);
|
||||
const fee = getGasAndFees(argv, registryConfig);
|
||||
await registry.sendCoins({ denom, amount, destinationAddress }, privateKey, fee);
|
||||
const result = await registry.getAccounts([fromAddress, destinationAddress]);
|
||||
queryOutput(result, argv.output);
|
||||
|
||||
const txResponse: DeliverTxResponse = await laconicClient.sendTokens(
|
||||
account.address,
|
||||
destinationAddress,
|
||||
[
|
||||
{
|
||||
denom,
|
||||
amount
|
||||
}
|
||||
],
|
||||
fee);
|
||||
|
||||
assert(txResponse.code === 0, `TX Failed - Hash: ${txResponse.transactionHash}, Code: ${txResponse.code}, Message: ${txResponse.rawLog}`);
|
||||
|
||||
const transfer = txResponse.events.find(e => e.type === 'transfer' ? e.attributes.find(a => a.key === 'msg_index') : null);
|
||||
const accountResponse = await registry.getAccounts([fromAddress, destinationAddress]);
|
||||
|
||||
const output = {
|
||||
tx: {
|
||||
hash: txResponse.transactionHash,
|
||||
height: txResponse.height,
|
||||
index: txResponse.txIndex,
|
||||
code: txResponse.code,
|
||||
log: txResponse.rawLog,
|
||||
sender: transfer?.attributes.find(a => a.key === 'sender')?.value,
|
||||
recipient: transfer?.attributes.find(a => a.key === 'recipient')?.value,
|
||||
amount: transfer?.attributes.find(a => a.key === 'amount')?.value
|
||||
},
|
||||
accounts: accountResponse
|
||||
};
|
||||
|
||||
queryOutput(output, argv.output);
|
||||
};
|
||||
|
||||
+6
-1
@@ -6,11 +6,16 @@ export const getConnectionInfo = (argv: Arguments, config: any) => {
|
||||
|
||||
const result = {
|
||||
...config,
|
||||
userKey: stripHexPrefix(config.userKey),
|
||||
...clean({ server, userKey, bondId, txKey, chainId }),
|
||||
privateKey: txKey || userKey || config.userKey,
|
||||
privateKey: stripHexPrefix(txKey || userKey || config.userKey),
|
||||
gas: String(gas || config.gas),
|
||||
fees: String(fees || config.fees)
|
||||
};
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
function stripHexPrefix (hex: string): string {
|
||||
return hex && hex.startsWith('0x') ? hex.slice(2) : hex;
|
||||
}
|
||||
|
||||
+68
-6
@@ -52,7 +52,7 @@ describe('Test laconic CLI commands', () => {
|
||||
const testAccount = process.env.TEST_ACCOUNT;
|
||||
assert(testAccount, 'TEST_ACCOUNT not set in env');
|
||||
const testAccount2 = 'laconic1pmuxrcnuhhf8qdllzuf2ctj2tnwwcg6yswqnyd';
|
||||
const initialAccountBalance = Number('100000000000000000000000000');
|
||||
const initialAccountBalance = Number('1000000000000000000000000000000');
|
||||
|
||||
const testAuthorityName = 'laconic';
|
||||
const testRecordFilePath = 'test/data/watcher-record.yml';
|
||||
@@ -217,19 +217,40 @@ describe('Test laconic CLI commands', () => {
|
||||
getAccountObj({ address: testAccount2, balance: sendAmount })
|
||||
];
|
||||
|
||||
expect(outputObj.length).toEqual(2);
|
||||
expect(outputObj).toMatchObject(expectedAccounts);
|
||||
expect(outputObj.tx.code).toEqual(0);
|
||||
expect(outputObj.tx.amount).toEqual(`${sendAmount}${TOKEN_TYPE}`);
|
||||
expect(outputObj.tx.sender).toEqual(testAccount);
|
||||
expect(outputObj.tx.recipient).toEqual(testAccount2);
|
||||
expect(outputObj.accounts.length).toEqual(2);
|
||||
expect(outputObj.accounts).toMatchObject(expectedAccounts);
|
||||
});
|
||||
test('laconic registry tokens gettx --hash <hash>', async () => {
|
||||
const sendAmount = 1000000000;
|
||||
|
||||
const sendResult = spawnSync('laconic', ['registry', 'tokens', 'send', '--address', testAccount2, '--type', TOKEN_TYPE, '--quantity', sendAmount.toString()]);
|
||||
const sendOutput = checkResultAndRetrieveOutput(sendResult);
|
||||
expect(sendOutput.tx.code).toEqual(0);
|
||||
|
||||
const gettxResult = spawnSync('laconic', ['registry', 'tokens', 'gettx', '--hash', sendOutput.tx.hash]);
|
||||
const gettxOutput = checkResultAndRetrieveOutput(gettxResult);
|
||||
|
||||
expect(gettxOutput.hash).toEqual(sendOutput.tx.hash);
|
||||
expect(gettxOutput.code).toEqual(0);
|
||||
expect(gettxOutput.amount).toEqual(`${sendAmount}${TOKEN_TYPE}`);
|
||||
expect(gettxOutput.sender).toEqual(testAccount);
|
||||
expect(gettxOutput.recipient).toEqual(testAccount2);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Record operations', () => {
|
||||
const gas = 250000;
|
||||
const fees = `250000${TOKEN_TYPE}`;
|
||||
const bondBalance = 1000000000;
|
||||
|
||||
test('laconic registry record publish --filename <record_file> --bond-id <bond_id> --gas <gas>', async () => {
|
||||
test('laconic registry record publish --filename <record_file> --bond-id <bond_id> --gas <gas> --fees <fees>', async () => {
|
||||
// Create a new bond to be associated with the record
|
||||
({ bondId: testRecordBondId } = createBond(bondBalance));
|
||||
const result = spawnSync('laconic', ['registry', 'record', 'publish', '--filename', testRecordFilePath, '--bond-id', testRecordBondId, '--gas', gas.toString()]);
|
||||
const result = spawnSync('laconic', ['registry', 'record', 'publish', '--filename', testRecordFilePath, '--bond-id', testRecordBondId, '--gas', gas.toString(), '--fees', fees]);
|
||||
const outputObj = checkResultAndRetrieveOutput(result);
|
||||
|
||||
// Expect output object to resultant bond id
|
||||
@@ -397,7 +418,7 @@ describe('Test laconic CLI commands', () => {
|
||||
chainId: CHAIN_ID,
|
||||
auctionId: testAuctionId,
|
||||
bidderAddress: testAccount,
|
||||
bidAmount: `${bidAmount}photon`
|
||||
bidAmount: `${bidAmount}alnt`
|
||||
});
|
||||
}, (AUCTION_COMMIT_DURATION + 5) * 1000);
|
||||
});
|
||||
@@ -477,6 +498,47 @@ describe('Test laconic CLI commands', () => {
|
||||
expect(authorityOutputObj.length).toEqual(1);
|
||||
expect(authorityOutputObj[0]).toMatchObject(expectedAuthority);
|
||||
});
|
||||
|
||||
test('laconic registry authority list', async () => {
|
||||
const result = spawnSync('laconic', ['registry', 'authority', 'list']);
|
||||
const authoritiesOutputObj = checkResultAndRetrieveOutput(result);
|
||||
|
||||
// Expected authorities
|
||||
const expectedAuthorities = [
|
||||
{ name: 'echo.laconic', entry: { ownerAddress: testAccount, status: 'active' } },
|
||||
{ name: 'kube.laconic', entry: { ownerAddress: testAccount2, status: 'active' } },
|
||||
{ name: 'laconic', entry: { ownerAddress: testAccount, status: 'active' } }
|
||||
];
|
||||
|
||||
// Expected output
|
||||
expect(authoritiesOutputObj.length).toEqual(3);
|
||||
expect(authoritiesOutputObj).toMatchObject(expectedAuthorities);
|
||||
});
|
||||
|
||||
test('laconic registry authority list --owner <owner_address>', async () => {
|
||||
let result = spawnSync('laconic', ['registry', 'authority', 'list', '--owner', testAccount]);
|
||||
const authoritiesByOwner1 = checkResultAndRetrieveOutput(result);
|
||||
|
||||
// Expected output
|
||||
const expectedAuthoritiesByOwner1 = [
|
||||
{ name: 'echo.laconic', entry: { ownerAddress: testAccount, status: 'active' } },
|
||||
{ name: 'laconic', entry: { ownerAddress: testAccount, status: 'active' } }
|
||||
];
|
||||
|
||||
expect(authoritiesByOwner1.length).toEqual(2);
|
||||
expect(authoritiesByOwner1).toMatchObject(expectedAuthoritiesByOwner1);
|
||||
|
||||
result = spawnSync('laconic', ['registry', 'authority', 'list', '--owner', testAccount2]);
|
||||
const authoritiesByOwner2 = checkResultAndRetrieveOutput(result);
|
||||
|
||||
// Expected output
|
||||
const expectedAuthoritiesByOwner2 = [
|
||||
{ name: 'kube.laconic', entry: { ownerAddress: testAccount2, status: 'active' } }
|
||||
];
|
||||
|
||||
expect(authoritiesByOwner2.length).toEqual(1);
|
||||
expect(authoritiesByOwner2).toMatchObject(expectedAuthoritiesByOwner2);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Name operations', () => {
|
||||
|
||||
+1
-1
@@ -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 = 'photon';
|
||||
export const TOKEN_TYPE = 'alnt';
|
||||
|
||||
export const AUCTION_FEES = {
|
||||
commit: 1000000,
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@ services:
|
||||
bondId:
|
||||
chainId: $cosmos_chain_id
|
||||
gas: 200000
|
||||
fees: 200000photon
|
||||
fees: 200000alnt
|
||||
EOL
|
||||
)
|
||||
echo "$config" > "$config_file"
|
||||
|
||||
@@ -302,10 +302,10 @@
|
||||
resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
|
||||
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==
|
||||
|
||||
"@cerc-io/registry-sdk@^0.2.2":
|
||||
version "0.2.2"
|
||||
resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Fregistry-sdk/-/0.2.2/registry-sdk-0.2.2.tgz#2e8a533f069b4bb9f4cd4798e783f52e29167d0d"
|
||||
integrity sha512-ocRMbWtdewOg02ORfK1U+qbTqB46anHP4ApXokGkY4d+mFSApR3sdUEi2geHcs8oh+SG8YAp7LUJ9AAJneNY8g==
|
||||
"@cerc-io/registry-sdk@^0.2.6":
|
||||
version "0.2.6"
|
||||
resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Fregistry-sdk/-/0.2.6/registry-sdk-0.2.6.tgz#af8a5844bdb742a01d322a9d93ace90d35aad37e"
|
||||
integrity sha512-Z2rneeoPLTJk9aBTqMrR9WPKfPQZhNWShI4IYOb7kzoIorp3eD8mEals0I5bVjzStjapw/5RKf8lVnDCX9I4iA==
|
||||
dependencies:
|
||||
"@cosmjs/amino" "^0.28.1"
|
||||
"@cosmjs/crypto" "^0.28.1"
|
||||
|
||||
Reference in New Issue
Block a user