forked from cerc-io/registry-sdk
Part of https://www.notion.so/Rename-laconic2d-to-laconicd-9028d0c020d24d1288e92ebcb773d7a7 Co-authored-by: neeraj <neeraj.rtly@gmail.com> Reviewed-on: cerc-io/registry-sdk#10 Co-authored-by: Prathamesh Musale <prathamesh@noreply.git.vdb.to> Co-committed-by: Prathamesh Musale <prathamesh@noreply.git.vdb.to>
36 lines
940 B
TypeScript
36 lines
940 B
TypeScript
import assert from 'assert';
|
|
import yaml from 'node-yaml';
|
|
import semver from 'semver';
|
|
|
|
import { DEFAULT_CHAIN_ID } from '../index';
|
|
|
|
export const ensureUpdatedConfig = async (path: string) => {
|
|
const conf = await yaml.read(path);
|
|
conf.record.version = semver.inc(conf.record.version, 'patch');
|
|
await yaml.write(path, conf);
|
|
|
|
return conf;
|
|
};
|
|
|
|
export const getBaseConfig = async (path: string) => {
|
|
const conf = await yaml.read(path);
|
|
conf.record.version = '0.0.1';
|
|
|
|
return conf;
|
|
};
|
|
|
|
export const getConfig = () => {
|
|
assert(process.env.PRIVATE_KEY);
|
|
|
|
return {
|
|
chainId: process.env.COSMOS_CHAIN_ID || DEFAULT_CHAIN_ID,
|
|
privateKey: process.env.PRIVATE_KEY,
|
|
rpcEndpoint: process.env.LACONICD_RPC_ENDPOINT || 'http://localhost:26657',
|
|
gqlEndpoint: process.env.LACONICD_GQL_ENDPOINT || 'http://localhost:9473/api',
|
|
fee: {
|
|
amount: [{ denom: 'photon', amount: '40' }],
|
|
gas: '400000'
|
|
}
|
|
};
|
|
};
|