Compare commits
10 Commits
Author | SHA1 | Date | |
---|---|---|---|
84035ba91e | |||
bd128d090b | |||
f791ce828d | |||
972b878674 | |||
603fe5916a | |||
b7223c1c43 | |||
e5900b2e4a | |||
913389ab9f | |||
7e18b5a8cf | |||
7eb37f894d |
@ -6,6 +6,7 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
|
- test-ci
|
||||||
- release/**
|
- release/**
|
||||||
|
|
||||||
env:
|
env:
|
||||||
@ -17,12 +18,16 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- name: Checkout laconicd
|
- name: Checkout laconicd
|
||||||
uses: actions/checkout@v3
|
# uses: actions/checkout@v3
|
||||||
with:
|
# with:
|
||||||
path: "./laconicd/"
|
# path: "./laconicd/"
|
||||||
repository: cerc-io/laconicd
|
# repository: cerc-io/laconicd
|
||||||
fetch-depth: 0
|
# fetch-depth: 0
|
||||||
ref: main
|
# ref: main
|
||||||
|
run: |
|
||||||
|
git clone https://git.vdb.to/deep-stack/laconicd.git
|
||||||
|
cd laconicd
|
||||||
|
git checkout pm-qol-improvements
|
||||||
- name: Environment
|
- name: Environment
|
||||||
run: ls -tlh && env
|
run: ls -tlh && env
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@cerc-io/laconic-sdk",
|
"name": "@cerc-io/laconic-sdk",
|
||||||
"version": "0.1.16",
|
"version": "0.1.14",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"types": "dist/index.d.ts",
|
"types": "dist/index.d.ts",
|
||||||
"repository": "git@github.com:cerc-io/laconic-sdk.git",
|
"repository": "git@github.com:cerc-io/laconic-sdk.git",
|
||||||
@ -48,7 +48,7 @@
|
|||||||
"tiny-secp256k1": "^1.1.6"
|
"tiny-secp256k1": "^1.1.6"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "jest --runInBand --verbose --testPathPattern=src",
|
"test": "jest --runInBand --verbose",
|
||||||
"test:auctions": "TEST_AUCTIONS_ENABLED=1 jest --runInBand --verbose src/auction.test.ts",
|
"test:auctions": "TEST_AUCTIONS_ENABLED=1 jest --runInBand --verbose src/auction.test.ts",
|
||||||
"test:nameservice-expiry": "TEST_NAMESERVICE_EXPIRY=1 jest --runInBand --verbose src/nameservice-expiry.test.ts",
|
"test:nameservice-expiry": "TEST_NAMESERVICE_EXPIRY=1 jest --runInBand --verbose src/nameservice-expiry.test.ts",
|
||||||
"build": "tsc"
|
"build": "tsc"
|
||||||
|
@ -54,7 +54,7 @@ import {
|
|||||||
|
|
||||||
export const DEFAULT_CHAIN_ID = 'laconic_9000-1';
|
export const DEFAULT_CHAIN_ID = 'laconic_9000-1';
|
||||||
|
|
||||||
const DEFAULT_WRITE_ERROR = 'Unable to write to laconicd';
|
const DEFAULT_WRITE_ERROR = 'Unable to write to laconicd.';
|
||||||
|
|
||||||
// Parse Tx response from cosmos-sdk.
|
// Parse Tx response from cosmos-sdk.
|
||||||
export const parseTxResponse = (result: any, parseResponse?: (data: string) => any) => {
|
export const parseTxResponse = (result: any, parseResponse?: (data: string) => any) => {
|
||||||
@ -117,8 +117,7 @@ export class Registry {
|
|||||||
console.error(error)
|
console.error(error)
|
||||||
}
|
}
|
||||||
|
|
||||||
const [lastErrorLine] = error.split("\n").slice(-1);
|
return errorMessage || DEFAULT_WRITE_ERROR;
|
||||||
return `${errorMessage || DEFAULT_WRITE_ERROR}: ${lastErrorLine}`;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(gqlUrl: string, restUrl: string = "", chainId: string = DEFAULT_CHAIN_ID) {
|
constructor(gqlUrl: string, restUrl: string = "", chainId: string = DEFAULT_CHAIN_ID) {
|
||||||
|
@ -81,10 +81,10 @@ export const parseMsgSetRecordResponse = (data: string) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const NAMESERVICE_ERRORS = [
|
export const NAMESERVICE_ERRORS = [
|
||||||
'Name already reserved',
|
'Name already reserved.',
|
||||||
'Authority bond not found',
|
'Authority bond not found.',
|
||||||
'Name authority not found',
|
'Name authority not found.',
|
||||||
'Access denied',
|
'Access denied.',
|
||||||
]
|
]
|
||||||
|
|
||||||
export interface MessageMsgReserveAuthority {
|
export interface MessageMsgReserveAuthority {
|
||||||
|
@ -19,14 +19,20 @@ const namingTests = () => {
|
|||||||
let watcherId: string;
|
let watcherId: string;
|
||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
|
console.log('running parent beforeAll')
|
||||||
|
|
||||||
registry = new Registry(gqlEndpoint, restEndpoint, chainId);
|
registry = new Registry(gqlEndpoint, restEndpoint, chainId);
|
||||||
|
console.log('registry = new Registry')
|
||||||
|
|
||||||
// Create bond.
|
// Create bond.
|
||||||
bondId = await registry.getNextBondId(privateKey);
|
bondId = await registry.getNextBondId(privateKey);
|
||||||
|
console.log('bondId', bondId)
|
||||||
await registry.createBond({ denom: 'aphoton', amount: '2000000000' }, privateKey, fee);
|
await registry.createBond({ denom: 'aphoton', amount: '2000000000' }, privateKey, fee);
|
||||||
|
console.log('done registry.createBond')
|
||||||
|
|
||||||
// Create watcher.
|
// Create watcher.
|
||||||
watcher = await ensureUpdatedConfig(WATCHER_YML_PATH);
|
watcher = await ensureUpdatedConfig(WATCHER_YML_PATH);
|
||||||
|
console.log('done await ensureUpdatedConfig')
|
||||||
const result = await registry.setRecord(
|
const result = await registry.setRecord(
|
||||||
{
|
{
|
||||||
privateKey,
|
privateKey,
|
||||||
@ -38,6 +44,9 @@ const namingTests = () => {
|
|||||||
)
|
)
|
||||||
|
|
||||||
watcherId = result.data.id;
|
watcherId = result.data.id;
|
||||||
|
console.log('watcherId', watcherId)
|
||||||
|
|
||||||
|
console.log('done running parent beforeAll')
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Authority tests', () => {
|
describe('Authority tests', () => {
|
||||||
@ -45,6 +54,7 @@ const namingTests = () => {
|
|||||||
const authorityName = `laconic-${Date.now()}`;
|
const authorityName = `laconic-${Date.now()}`;
|
||||||
|
|
||||||
await registry.reserveAuthority({ name: authorityName }, privateKey, fee);
|
await registry.reserveAuthority({ name: authorityName }, privateKey, fee);
|
||||||
|
console.log('done Reserve authority')
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('With authority reserved', () => {
|
describe('With authority reserved', () => {
|
||||||
@ -52,11 +62,13 @@ const namingTests = () => {
|
|||||||
let crn: string;
|
let crn: string;
|
||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
|
console.log('running beforeAll')
|
||||||
|
|
||||||
authorityName = `laconic-${Date.now()}`;
|
authorityName = `laconic-${Date.now()}`;
|
||||||
crn = `crn://${authorityName}/app/test`;
|
crn = `crn://${authorityName}/app/test`;
|
||||||
|
|
||||||
await registry.reserveAuthority({ name: authorityName }, privateKey, fee);
|
await registry.reserveAuthority({ name: authorityName }, privateKey, fee);
|
||||||
|
console.log('done running beforeAll')
|
||||||
})
|
})
|
||||||
|
|
||||||
test('Lookup authority.', async () => {
|
test('Lookup authority.', async () => {
|
||||||
@ -66,6 +78,7 @@ const namingTests = () => {
|
|||||||
expect(record.ownerAddress).not.toBe('');
|
expect(record.ownerAddress).not.toBe('');
|
||||||
expect(record.ownerPublicKey).not.toBe('');
|
expect(record.ownerPublicKey).not.toBe('');
|
||||||
expect(Number(record.height)).toBeGreaterThan(0);
|
expect(Number(record.height)).toBeGreaterThan(0);
|
||||||
|
console.log('done Lookup authority')
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Lookup non existing authority', async () => {
|
test('Lookup non existing authority', async () => {
|
||||||
@ -74,11 +87,13 @@ const namingTests = () => {
|
|||||||
expect(record.ownerAddress).toBe('');
|
expect(record.ownerAddress).toBe('');
|
||||||
expect(record.ownerPublicKey).toBe('');
|
expect(record.ownerPublicKey).toBe('');
|
||||||
expect(Number(record.height)).toBe(0);
|
expect(Number(record.height)).toBe(0);
|
||||||
|
console.log('done Lookup non existing authority')
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Reserve already reserved authority', async () => {
|
test('Reserve already reserved authority', async () => {
|
||||||
await expect(registry.reserveAuthority({ name: authorityName }, privateKey, fee)).
|
await expect(registry.reserveAuthority({ name: authorityName }, privateKey, fee)).
|
||||||
rejects.toThrow('Name already reserved.');
|
rejects.toThrow('Name already reserved.');
|
||||||
|
console.log('done Reserve already reserved authority')
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Reserve sub-authority.', async () => {
|
test('Reserve sub-authority.', async () => {
|
||||||
@ -90,6 +105,7 @@ const namingTests = () => {
|
|||||||
expect(record.ownerAddress).not.toBe('');
|
expect(record.ownerAddress).not.toBe('');
|
||||||
expect(record.ownerPublicKey).not.toBe('');
|
expect(record.ownerPublicKey).not.toBe('');
|
||||||
expect(Number(record.height)).toBeGreaterThan(0);
|
expect(Number(record.height)).toBeGreaterThan(0);
|
||||||
|
console.log('done Reserve sub-authority')
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Reserve sub-authority with different owner.', async () => {
|
test('Reserve sub-authority with different owner.', async () => {
|
||||||
|
@ -79,7 +79,7 @@ export class Util {
|
|||||||
const res: {[key: string]: any} = {};
|
const res: {[key: string]: any} = {};
|
||||||
|
|
||||||
attributes.forEach(attr => {
|
attributes.forEach(attr => {
|
||||||
res[attr.key] = (attr.value === null) ? null : this.fromGQLValue(attr.value);
|
res[attr.key] = this.fromGQLValue(attr.value);
|
||||||
});
|
});
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
|
Loading…
Reference in New Issue
Block a user