Add getRecordsByIds method and sdk tests (#3)

* Implement getRecordsByIds method

* Add tests for sdk
This commit is contained in:
nabarun authored and GitHub committed 2022-04-25 15:12:46 +05:30
1 parent 003cfcbf5c
commit 3d103b5fca
6 files changed
+205 -3

No files matched your search

+16
View File
@@ -1,6 +1,9 @@
import assert from 'assert';
import yaml from 'node-yaml';
import semver from 'semver';
import { Fee } from '@tharsis/transactions';
import { Registry } from '../index';
export const ensureUpdatedConfig = async (path: string) => {
const conf = await yaml.read(path);
@@ -17,6 +20,19 @@ export const getBaseConfig = async (path: string) => {
return conf;
};
/**
* Provision a bond for record registration.
*/
export const provisionBondId = async (registry: Registry, privateKey: string, fee: Fee) => {
let bonds = await registry.queryBonds();
if (!bonds.length) {
await registry.createBond({ denom: 'uwire', amount: '1000000000' }, privateKey, fee);
bonds = await registry.queryBonds();
}
return bonds[0].id;
};
export const getConfig = () => {
assert(process.env.PRIVATE_KEY);