Skip to content

Commit

Permalink
feat: makeTendermintRpcClient
Browse files Browse the repository at this point in the history
  • Loading branch information
turadg committed Nov 6, 2024
1 parent 085db85 commit 129516a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions packages/casting/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ export * from './follower-cosmjs.js';
export * from './casting-spec.js';
export * from './leader.js';
export * from './iterable.js';
export * from './makeHttpClient.js';
5 changes: 4 additions & 1 deletion packages/casting/src/makeHttpClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const filterBadStatus = res => {
* @param {typeof window.fetch} fetch
* @returns {import('@cosmjs/tendermint-rpc').RpcClient}
*/
export const makeHttpClient = (url, fetch) => {
export const makeTendermintRpcClient = (url, fetch) => {
const headers = {}; // XXX needed?

// based on cosmjs 0.30.1:
Expand Down Expand Up @@ -54,3 +54,6 @@ export const makeHttpClient = (url, fetch) => {
},
});
};

/** @deprecated use makeTendermintRpcClient */
export const makeHttpClient = makeTendermintRpcClient;
6 changes: 3 additions & 3 deletions packages/casting/test/interpose-net-access.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
QueryChildrenResponse,
} from '@agoric/cosmic-proto/vstorage/query.js';

import { makeHttpClient } from '../src/makeHttpClient.js';
import { makeTendermintRpcClient } from '../src/makeHttpClient.js';
import { captureIO, replayIO, web1, web2 } from './net-access-fixture.js';

/** @type {import('ava').TestFn<Awaited<ReturnType<typeof makeTestContext>>>} */
Expand Down Expand Up @@ -43,7 +43,7 @@ const scenario1 = {

test('interpose net access', async t => {
const fetchMock = replayIO(web1);
const rpcClient = makeHttpClient(scenario1.endpoint, fetchMock);
const rpcClient = makeTendermintRpcClient(scenario1.endpoint, fetchMock);

t.log('raw JSON RPC');
const res = await rpcClient.execute({
Expand Down Expand Up @@ -100,7 +100,7 @@ test(`vstorage query: Children (RECORDING: ${RECORDING})`, async t => {
const { fetch: fetchMock, web } = io.recording
? captureIO(io.fetch)
: { fetch: replayIO(web2), web: new Map() };
const rpcClient = makeHttpClient(scenario2.endpoint, fetchMock);
const rpcClient = makeTendermintRpcClient(scenario2.endpoint, fetchMock);

const tmClient = await Tendermint34Client.create(rpcClient);
const qClient = new QueryClient(tmClient);
Expand Down

0 comments on commit 129516a

Please sign in to comment.