Rename rest endpoint to rpc endpoint
Some checks failed
Tests / sdk_tests (pull_request) Failing after 18s

This commit is contained in:
neeraj 2024-04-01 14:34:47 +05:30
parent 8378d36bf3
commit 044a787622
12 changed files with 25 additions and 25 deletions

View File

@ -1,4 +1,4 @@
PRIVATE_KEY=
COSMOS_CHAIN_ID=laconic_9000-1
LACONICD_GQL_ENDPOINT=http://localhost:9473/api
LACONICD_REST_ENDPOINT=http://127.0.0.1:26657
LACONICD_RPC_ENDPOINT=http://127.0.0.1:26657

View File

@ -20,7 +20,7 @@ jobs:
uses: actions/checkout@v3
with:
path: "./laconicd/"
repository: cerc-io/laconic2d
repository: cerc-io/laconic2d # TODO: Update to laconicd on repo renaming
fetch-depth: 0
ref: main
- name: Environment

View File

@ -3,7 +3,7 @@ import { getConfig } from './testing/helper';
import { DENOM } from './constants';
jest.setTimeout(30 * 60 * 1000);
const { chainId, restEndpoint, gqlEndpoint, privateKey, fee } = getConfig();
const { chainId, rpcEndpoint, gqlEndpoint, privateKey, fee } = getConfig();
const auctionTests = (numBidders = 3) => {
let registry: Registry;
@ -16,7 +16,7 @@ const auctionTests = (numBidders = 3) => {
beforeAll(async () => {
console.log('Running auction tests with num bidders', numBidders);
registry = new Registry(gqlEndpoint, restEndpoint, chainId);
registry = new Registry(gqlEndpoint, rpcEndpoint, chainId);
});
test('Setup bidder accounts', async () => {

View File

@ -7,7 +7,7 @@ import { DENOM } from './constants';
const WATCHER_YML_PATH = path.join(__dirname, './testing/data/watcher.yml');
const BOND_AMOUNT = '1000000000';
const { chainId, restEndpoint, gqlEndpoint, privateKey, fee } = getConfig();
const { chainId, rpcEndpoint, gqlEndpoint, privateKey, fee } = getConfig();
jest.setTimeout(90 * 1000);
@ -21,7 +21,7 @@ const bondTests = () => {
};
beforeAll(async () => {
registry = new Registry(gqlEndpoint, restEndpoint, chainId);
registry = new Registry(gqlEndpoint, rpcEndpoint, chainId);
});
test('Create bond.', async () => {

View File

@ -3,7 +3,7 @@ import { DENOM } from './constants';
import { Registry } from './index';
import { getConfig } from './testing/helper';
const { chainId, restEndpoint, gqlEndpoint, privateKey, fee } = getConfig();
const { chainId, rpcEndpoint, gqlEndpoint, privateKey, fee } = getConfig();
jest.setTimeout(90 * 1000);
@ -11,7 +11,7 @@ const registryTests = () => {
let registry: Registry;
beforeAll(async () => {
registry = new Registry(gqlEndpoint, restEndpoint, chainId);
registry = new Registry(gqlEndpoint, rpcEndpoint, chainId);
});
test('Get account info.', async () => {

View File

@ -63,13 +63,13 @@ export class Registry {
_chainID: string;
_client: RegistryClient;
constructor (gqlUrl: string, restUrl = '', chainId: string = DEFAULT_CHAIN_ID) {
constructor (gqlUrl: string, rpcUrl = '', chainId: string = DEFAULT_CHAIN_ID) {
this._endpoints = {
rest: restUrl,
rpc: rpcUrl,
gql: gqlUrl
};
this._client = new RegistryClient(gqlUrl, restUrl);
this._client = new RegistryClient(gqlUrl, rpcUrl);
this._chainID = chainId;
}
@ -432,7 +432,7 @@ export class Registry {
}
async getLaconicClient (account: Account) {
return LaconicClient.connectWithSigner(this._endpoints.rest, account.wallet);
return LaconicClient.connectWithSigner(this._endpoints.rpc, account.wallet);
}
}

View File

@ -8,7 +8,7 @@ const WATCHER_YML_PATH = path.join(__dirname, './testing/data/watcher.yml');
jest.setTimeout(120 * 1000);
const { chainId, restEndpoint, gqlEndpoint, privateKey, fee } = getConfig();
const { chainId, rpcEndpoint, gqlEndpoint, privateKey, fee } = getConfig();
const nameserviceExpiryTests = () => {
let registry: Registry;
@ -21,7 +21,7 @@ const nameserviceExpiryTests = () => {
let recordExpiryTime: Date;
beforeAll(async () => {
registry = new Registry(gqlEndpoint, restEndpoint, chainId);
registry = new Registry(gqlEndpoint, rpcEndpoint, chainId);
// Create bond.
bondId = await registry.getNextBondId(privateKey);

View File

@ -10,7 +10,7 @@ const WATCHER_YML_PATH = path.join(__dirname, './testing/data/watcher.yml');
jest.setTimeout(5 * 60 * 1000);
const { chainId, restEndpoint, gqlEndpoint, privateKey, fee } = getConfig();
const { chainId, rpcEndpoint, gqlEndpoint, privateKey, fee } = getConfig();
const namingTests = () => {
let registry: Registry;
@ -20,7 +20,7 @@ const namingTests = () => {
let watcherId: string;
beforeAll(async () => {
registry = new Registry(gqlEndpoint, restEndpoint, chainId);
registry = new Registry(gqlEndpoint, rpcEndpoint, chainId);
// Create bond.
bondId = await registry.getNextBondId(privateKey);

View File

@ -95,7 +95,7 @@ const auctionFields = `
* Registry
*/
export class RegistryClient {
_restEndpoint: string;
_rpcEndpoint: string;
_graph: any;
/**
@ -128,14 +128,14 @@ export class RegistryClient {
/**
* New Client.
*/
constructor (gqlEndpoint: string, restEndpoint: string) {
constructor (gqlEndpoint: string, rpcEndpoint: string) {
assert(gqlEndpoint);
this._graph = graphqlClient(gqlEndpoint, {
method: 'POST',
asJSON: true
});
this._restEndpoint = restEndpoint;
this._rpcEndpoint = rpcEndpoint;
}
/**

View File

@ -8,7 +8,7 @@ const WATCHER_YML_PATH = path.join(__dirname, './testing/data/watcher.yml');
jest.setTimeout(40 * 1000);
const { chainId, restEndpoint, gqlEndpoint, privateKey, fee } = getConfig();
const { chainId, rpcEndpoint, gqlEndpoint, privateKey, fee } = getConfig();
describe('Querying', () => {
let watcher: any;
@ -16,7 +16,7 @@ describe('Querying', () => {
let bondId: string;
beforeAll(async () => {
registry = new Registry(gqlEndpoint, restEndpoint, chainId);
registry = new Registry(gqlEndpoint, rpcEndpoint, chainId);
bondId = await registry.getNextBondId(privateKey);
await registry.createBond({ denom: DENOM, amount: '1000000000' }, privateKey, fee);
@ -31,7 +31,7 @@ describe('Querying', () => {
});
test('Endpoint and chain ID.', async () => {
expect(registry.endpoints.rest).toBe(restEndpoint);
expect(registry.endpoints.rpc).toBe(rpcEndpoint);
expect(registry.endpoints.gql).toBe(gqlEndpoint);
expect(registry.chainID).toBe(chainId);
});

View File

@ -25,7 +25,7 @@ export const getConfig = () => {
return {
chainId: process.env.COSMOS_CHAIN_ID || DEFAULT_CHAIN_ID,
privateKey: process.env.PRIVATE_KEY,
restEndpoint: process.env.LACONICD_REST_ENDPOINT || 'http://localhost:26657',
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' }],

View File

@ -9,7 +9,7 @@ const WATCHER_YML_PATH = path.join(__dirname, './testing/data/watcher.yml');
jest.setTimeout(90 * 1000);
const { chainId, restEndpoint, gqlEndpoint, privateKey, fee } = getConfig();
const { chainId, rpcEndpoint, gqlEndpoint, privateKey, fee } = getConfig();
const utilTests = () => {
let registry: Registry;
@ -19,7 +19,7 @@ const utilTests = () => {
let watcherId: string;
beforeAll(async () => {
registry = new Registry(gqlEndpoint, restEndpoint, chainId);
registry = new Registry(gqlEndpoint, rpcEndpoint, chainId);
// Create bond.
bondId = await registry.getNextBondId(privateKey);