From 7be2908d30d5ee44175545f81f21c412d07ea682 Mon Sep 17 00:00:00 2001 From: neeraj Date: Mon, 1 Apr 2024 14:34:47 +0530 Subject: [PATCH] Rename laconicd rest endpoint to rpc endpoint --- .env.example | 2 +- .gitea/workflows/test.yml | 2 +- src/auction.test.ts | 4 ++-- src/bond.test.ts | 4 ++-- src/index.test.ts | 4 ++-- src/index.ts | 8 ++++---- src/nameservice-expiry.test.ts | 4 ++-- src/naming.test.ts | 4 ++-- src/registry-client.ts | 6 +++--- src/sdk.test.ts | 6 +++--- src/testing/helper.ts | 2 +- src/util.test.ts | 4 ++-- 12 files changed, 25 insertions(+), 25 deletions(-) diff --git a/.env.example b/.env.example index f14a8fc..a56bf4f 100644 --- a/.env.example +++ b/.env.example @@ -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 diff --git a/.gitea/workflows/test.yml b/.gitea/workflows/test.yml index 0869835..e39c7ca 100644 --- a/.gitea/workflows/test.yml +++ b/.gitea/workflows/test.yml @@ -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 diff --git a/src/auction.test.ts b/src/auction.test.ts index a96af82..9e7c90a 100644 --- a/src/auction.test.ts +++ b/src/auction.test.ts @@ -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 () => { diff --git a/src/bond.test.ts b/src/bond.test.ts index 92124dc..ce4524c 100644 --- a/src/bond.test.ts +++ b/src/bond.test.ts @@ -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 () => { diff --git a/src/index.test.ts b/src/index.test.ts index b68101e..0d846fc 100644 --- a/src/index.test.ts +++ b/src/index.test.ts @@ -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 () => { diff --git a/src/index.ts b/src/index.ts index 73d8da0..1bb4239 100644 --- a/src/index.ts +++ b/src/index.ts @@ -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); } } diff --git a/src/nameservice-expiry.test.ts b/src/nameservice-expiry.test.ts index 7506eaa..c7ae38a 100644 --- a/src/nameservice-expiry.test.ts +++ b/src/nameservice-expiry.test.ts @@ -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); diff --git a/src/naming.test.ts b/src/naming.test.ts index 098d2a7..973ad13 100644 --- a/src/naming.test.ts +++ b/src/naming.test.ts @@ -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); diff --git a/src/registry-client.ts b/src/registry-client.ts index ac1f48a..69d9ab5 100644 --- a/src/registry-client.ts +++ b/src/registry-client.ts @@ -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; } /** diff --git a/src/sdk.test.ts b/src/sdk.test.ts index a69edaf..f3217f5 100644 --- a/src/sdk.test.ts +++ b/src/sdk.test.ts @@ -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); }); diff --git a/src/testing/helper.ts b/src/testing/helper.ts index 8ca88bf..67695d4 100644 --- a/src/testing/helper.ts +++ b/src/testing/helper.ts @@ -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' }], diff --git a/src/util.test.ts b/src/util.test.ts index 1b0ac12..4e198a9 100644 --- a/src/util.test.ts +++ b/src/util.test.ts @@ -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);