From e51d6558bfbbddb41a867d205dcc9849186a5c95 Mon Sep 17 00:00:00 2001 From: Simon Warta Date: Tue, 25 Jun 2024 15:26:38 +0200 Subject: [PATCH] Make .create constructors non-async This is a braking follow-up to https://github.com/cosmos/cosmjs/pull/1380 --- .../cosmwasm-stargate/src/cosmwasmclient.ts | 2 +- packages/stargate/src/stargateclient.ts | 5 +- .../src/comet38/comet38client.spec.ts | 74 +++++++++---------- .../src/comet38/comet38client.ts | 2 +- .../tendermint34/tendermint34client.spec.ts | 74 +++++++++---------- .../src/tendermint34/tendermint34client.ts | 2 +- .../tendermint37/tendermint37client.spec.ts | 74 +++++++++---------- .../src/tendermint37/tendermint37client.ts | 2 +- 8 files changed, 116 insertions(+), 119 deletions(-) diff --git a/packages/cosmwasm-stargate/src/cosmwasmclient.ts b/packages/cosmwasm-stargate/src/cosmwasmclient.ts index c4b3e14c5c..ad8db35bb1 100644 --- a/packages/cosmwasm-stargate/src/cosmwasmclient.ts +++ b/packages/cosmwasm-stargate/src/cosmwasmclient.ts @@ -105,7 +105,7 @@ export class CosmWasmClient { * Creates an instance from a manually created Comet client. * Use this to use `Comet38Client` or `Tendermint37Client` instead of `Tendermint34Client`. */ - public static async create(cometClient: CometClient): Promise { + public static create(cometClient: CometClient): CosmWasmClient { return new CosmWasmClient(cometClient); } diff --git a/packages/stargate/src/stargateclient.ts b/packages/stargate/src/stargateclient.ts index d5d6c6b334..d3cf866363 100644 --- a/packages/stargate/src/stargateclient.ts +++ b/packages/stargate/src/stargateclient.ts @@ -221,10 +221,7 @@ export class StargateClient { * Creates an instance from a manually created Comet client. * Use this to use `Comet38Client` or `Tendermint37Client` instead of `Tendermint34Client`. */ - public static async create( - cometClient: CometClient, - options: StargateClientOptions = {}, - ): Promise { + public static create(cometClient: CometClient, options: StargateClientOptions = {}): StargateClient { return new StargateClient(cometClient, options); } diff --git a/packages/tendermint-rpc/src/comet38/comet38client.spec.ts b/packages/tendermint-rpc/src/comet38/comet38client.spec.ts index 3d411432dd..e1fae1cc70 100644 --- a/packages/tendermint-rpc/src/comet38/comet38client.spec.ts +++ b/packages/tendermint-rpc/src/comet38/comet38client.spec.ts @@ -25,7 +25,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) describe("create", () => { it("can auto-discover Tendermint version and communicate", async () => { pendingWithoutTendermint(); - const client = await Comet38Client.create(rpcFactory()); + const client = Comet38Client.create(rpcFactory()); const info = await client.abciInfo(); expect(info).toBeTruthy(); client.disconnect(); @@ -33,7 +33,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) it("can connect to Tendermint with known version", async () => { pendingWithoutTendermint(); - const client = await Comet38Client.create(rpcFactory()); + const client = Comet38Client.create(rpcFactory()); expect(await client.abciInfo()).toBeTruthy(); client.disconnect(); }); @@ -41,7 +41,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) it("can get genesis", async () => { pendingWithoutTendermint(); - const client = await Comet38Client.create(rpcFactory()); + const client = Comet38Client.create(rpcFactory()); const genesis = await client.genesis(); expect(genesis).toBeTruthy(); client.disconnect(); @@ -50,7 +50,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) describe("broadcastTxCommit", () => { it("can broadcast a transaction", async () => { pendingWithoutTendermint(); - const client = await Comet38Client.create(rpcFactory()); + const client = Comet38Client.create(rpcFactory()); const tx = buildKvTx(randomString(), randomString()); const response = await client.broadcastTxCommit({ tx: tx }); @@ -70,7 +70,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) describe("broadcastTxSync", () => { it("can broadcast a transaction", async () => { pendingWithoutTendermint(); - const client = await Comet38Client.create(rpcFactory()); + const client = Comet38Client.create(rpcFactory()); const tx = buildKvTx(randomString(), randomString()); const response = await client.broadcastTxSync({ tx: tx }); @@ -86,7 +86,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) describe("broadcastTxAsync", () => { it("can broadcast a transaction", async () => { pendingWithoutTendermint(); - const client = await Comet38Client.create(rpcFactory()); + const client = Comet38Client.create(rpcFactory()); const tx = buildKvTx(randomString(), randomString()); const response = await client.broadcastTxAsync({ tx: tx }); @@ -98,7 +98,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) it("gets the same tx hash from backend as calculated locally", async () => { pendingWithoutTendermint(); - const client = await Comet38Client.create(rpcFactory()); + const client = Comet38Client.create(rpcFactory()); const tx = buildKvTx(randomString(), randomString()); const calculatedTxHash = hashTx(tx); @@ -111,7 +111,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) describe("abciQuery", () => { it("can query the state", async () => { pendingWithoutTendermint(); - const client = await Comet38Client.create(rpcFactory()); + const client = Comet38Client.create(rpcFactory()); const key = randomString(); const value = randomString(); @@ -137,7 +137,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) it("can get a commit", async () => { pendingWithoutTendermint(); - const client = await Comet38Client.create(rpcFactory()); + const client = Comet38Client.create(rpcFactory()); const response = await client.commit(4); expect(response).toBeTruthy(); @@ -152,7 +152,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) it("can get validators", async () => { pendingWithoutTendermint(); - const client = await Comet38Client.create(rpcFactory()); + const client = Comet38Client.create(rpcFactory()); const response = await client.validators({}); expect(response).toBeTruthy(); @@ -170,7 +170,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) it("can get all validators", async () => { pendingWithoutTendermint(); - const client = await Comet38Client.create(rpcFactory()); + const client = Comet38Client.create(rpcFactory()); const response = await client.validatorsAll(); expect(response).toBeTruthy(); @@ -188,7 +188,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) it("can call a bunch of methods", async () => { pendingWithoutTendermint(); - const client = await Comet38Client.create(rpcFactory()); + const client = Comet38Client.create(rpcFactory()); expect(await client.block()).toBeTruthy(); expect(await client.genesis()).toBeTruthy(); @@ -200,7 +200,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) describe("status", () => { it("works", async () => { pendingWithoutTendermint(); - const client = await Comet38Client.create(rpcFactory()); + const client = Comet38Client.create(rpcFactory()); const status = await client.status(); @@ -241,7 +241,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) describe("numUnconfirmedTxs", () => { it("works", async () => { pendingWithoutTendermint(); - const client = await Comet38Client.create(rpcFactory()); + const client = Comet38Client.create(rpcFactory()); const response = await client.numUnconfirmedTxs(); @@ -255,7 +255,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) describe("blockResults", () => { it("works", async () => { pendingWithoutTendermint(); - const client = await Comet38Client.create(rpcFactory()); + const client = Comet38Client.create(rpcFactory()); const height = 3; const results = await client.blockResults(height); @@ -271,7 +271,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) describe("blockSearch", () => { beforeAll(async () => { if (tendermintEnabled()) { - const client = await Comet38Client.create(rpcFactory()); + const client = Comet38Client.create(rpcFactory()); // eslint-disable-next-line no-inner-declarations async function sendTx(): Promise { @@ -296,7 +296,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) it("can paginate over blockSearch results", async () => { pendingWithoutTendermint(); - const client = await Comet38Client.create(rpcFactory()); + const client = Comet38Client.create(rpcFactory()); const query = buildQuery({ raw: "block.height >= 1 AND block.height <= 3" }); @@ -315,7 +315,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) it("can get all search results in one call", async () => { pendingWithoutTendermint(); - const client = await Comet38Client.create(rpcFactory()); + const client = Comet38Client.create(rpcFactory()); const query = buildQuery({ raw: "block.height >= 1 AND block.height <= 3" }); @@ -334,7 +334,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) describe("blockchain", () => { it("returns latest in descending order by default", async () => { pendingWithoutTendermint(); - const client = await Comet38Client.create(rpcFactory()); + const client = Comet38Client.create(rpcFactory()); // Run in parallel to increase chance there is no block between the calls const [status, blockchain] = await Promise.all([client.status(), client.blockchain()]); @@ -351,7 +351,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) it("can limit by maxHeight", async () => { pendingWithoutTendermint(); - const client = await Comet38Client.create(rpcFactory()); + const client = Comet38Client.create(rpcFactory()); const height = (await client.status()).syncInfo.latestBlockHeight; const blockchain = await client.blockchain(undefined, height - 1); @@ -365,7 +365,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) it("works with maxHeight in the future", async () => { pendingWithoutTendermint(); - const client = await Comet38Client.create(rpcFactory()); + const client = Comet38Client.create(rpcFactory()); const height = (await client.status()).syncInfo.latestBlockHeight; const blockchain = await client.blockchain(undefined, height + 20); @@ -380,7 +380,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) it("can limit by minHeight and maxHeight", async () => { pendingWithoutTendermint(); - const client = await Comet38Client.create(rpcFactory()); + const client = Comet38Client.create(rpcFactory()); const height = (await client.status()).syncInfo.latestBlockHeight; const blockchain = await client.blockchain(height - 2, height - 1); @@ -394,7 +394,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) it("contains all the info", async () => { pendingWithoutTendermint(); - const client = await Comet38Client.create(rpcFactory()); + const client = Comet38Client.create(rpcFactory()); const height = (await client.status()).syncInfo.latestBlockHeight; const blockchain = await client.blockchain(height - 1, height - 1); @@ -423,7 +423,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) describe("tx", () => { it("can query a tx properly", async () => { pendingWithoutTendermint(); - const client = await Comet38Client.create(rpcFactory()); + const client = Comet38Client.create(rpcFactory()); const find = randomString(); const me = randomString(); @@ -463,7 +463,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) beforeAll(async () => { if (tendermintEnabled()) { - const client = await Comet38Client.create(rpcFactory()); + const client = Comet38Client.create(rpcFactory()); // eslint-disable-next-line no-inner-declarations async function sendTx(): Promise<[Uint8Array, responses.BroadcastTxCommitResponse]> { @@ -491,7 +491,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) it("finds a single tx by hash", async () => { pendingWithoutTendermint(); assert(tx1 && broadcast1); - const client = await Comet38Client.create(rpcFactory()); + const client = Comet38Client.create(rpcFactory()); const result = await client.txSearch({ query: `tx.hash='${toHex(broadcast1.hash)}'` }); expect(result.totalCount).toEqual(1); @@ -509,7 +509,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) it("finds a single tx by tags", async () => { pendingWithoutTendermint(); - const client = await Comet38Client.create(rpcFactory()); + const client = Comet38Client.create(rpcFactory()); const txKey2 = randomString(); const txValue2 = randomString(); @@ -559,7 +559,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) // Code 0.35: https://github.com/tendermint/tendermint/blob/v0.35.6/internal/rpc/core/tx.go#L93 // Code 0.37: https://github.com/cometbft/cometbft/blob/v0.37.0-rc3/rpc/core/tx.go#L87 pendingWithoutTendermint(); - const client = await Comet38Client.create(rpcFactory()); + const client = Comet38Client.create(rpcFactory()); const query = buildQuery({ tags: [{ key: "app.key", value: txKey }] }); @@ -576,7 +576,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) it("can set the order", async () => { pendingWithoutTendermint(); - const client = await Comet38Client.create(rpcFactory()); + const client = Comet38Client.create(rpcFactory()); const query = buildQuery({ tags: [{ key: "app.key", value: txKey }] }); @@ -591,7 +591,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) it("can paginate over txSearch results", async () => { pendingWithoutTendermint(); - const client = await Comet38Client.create(rpcFactory()); + const client = Comet38Client.create(rpcFactory()); const query = buildQuery({ tags: [{ key: "app.key", value: txKey }] }); @@ -610,7 +610,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) it("can get all search results in one call", async () => { pendingWithoutTendermint(); - const client = await Comet38Client.create(rpcFactory()); + const client = Comet38Client.create(rpcFactory()); const query = buildQuery({ tags: [{ key: "app.key", value: txKey }] }); @@ -634,7 +634,7 @@ function websocketTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValue (async () => { const events: responses.NewBlockHeaderEvent[] = []; - const client = await Comet38Client.create(rpcFactory()); + const client = Comet38Client.create(rpcFactory()); const stream = client.subscribeNewBlockHeader(); expect(stream).toBeTruthy(); const subscription = stream.subscribe({ @@ -693,7 +693,7 @@ function websocketTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValue const transactionData2 = buildKvTx(randomString(), randomString()); const events: responses.NewBlockEvent[] = []; - const client = await Comet38Client.create(rpcFactory()); + const client = Comet38Client.create(rpcFactory()); const stream = client.subscribeNewBlock(); const subscription = stream.subscribe({ next: (event) => { @@ -752,7 +752,7 @@ function websocketTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValue pendingWithoutTendermint(); const events: responses.TxEvent[] = []; - const client = await Comet38Client.create(rpcFactory()); + const client = Comet38Client.create(rpcFactory()); const stream = client.subscribeTx(); const subscription = stream.subscribe({ next: (event) => { @@ -796,7 +796,7 @@ function websocketTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValue const transactionData2 = buildKvTx(randomString(), randomString()); const events: responses.TxEvent[] = []; - const client = await Comet38Client.create(rpcFactory()); + const client = Comet38Client.create(rpcFactory()); const query = buildQuery({ tags: [{ key: "app.creator", value: expected.appCreator }] }); const stream = client.subscribeTx(query); expect(stream).toBeTruthy(); @@ -834,7 +834,7 @@ function websocketTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValue it("can unsubscribe and re-subscribe to the same stream", async () => { pendingWithoutTendermint(); - const client = await Comet38Client.create(rpcFactory()); + const client = Comet38Client.create(rpcFactory()); const stream = client.subscribeNewBlockHeader(); const event1 = await firstEvent(stream); @@ -867,7 +867,7 @@ function websocketTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValue it("can subscribe twice", async () => { pendingWithoutTendermint(); - const client = await Comet38Client.create(rpcFactory()); + const client = Comet38Client.create(rpcFactory()); const stream1 = client.subscribeNewBlockHeader(); const stream2 = client.subscribeNewBlockHeader(); diff --git a/packages/tendermint-rpc/src/comet38/comet38client.ts b/packages/tendermint-rpc/src/comet38/comet38client.ts index 2d20513fac..94e3239380 100644 --- a/packages/tendermint-rpc/src/comet38/comet38client.ts +++ b/packages/tendermint-rpc/src/comet38/comet38client.ts @@ -47,7 +47,7 @@ export class Comet38Client { /** * Creates a new Tendermint client given an RPC client. */ - public static async create(rpcClient: RpcClient): Promise { + public static create(rpcClient: RpcClient): Comet38Client { return new Comet38Client(rpcClient); } diff --git a/packages/tendermint-rpc/src/tendermint34/tendermint34client.spec.ts b/packages/tendermint-rpc/src/tendermint34/tendermint34client.spec.ts index f8f2140e87..322ac024c7 100644 --- a/packages/tendermint-rpc/src/tendermint34/tendermint34client.spec.ts +++ b/packages/tendermint-rpc/src/tendermint34/tendermint34client.spec.ts @@ -25,7 +25,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) describe("create", () => { it("can auto-discover Tendermint version and communicate", async () => { pendingWithoutTendermint(); - const client = await Tendermint34Client.create(rpcFactory()); + const client = Tendermint34Client.create(rpcFactory()); const info = await client.abciInfo(); expect(info).toBeTruthy(); client.disconnect(); @@ -33,7 +33,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) it("can connect to Tendermint with known version", async () => { pendingWithoutTendermint(); - const client = await Tendermint34Client.create(rpcFactory()); + const client = Tendermint34Client.create(rpcFactory()); expect(await client.abciInfo()).toBeTruthy(); client.disconnect(); }); @@ -41,7 +41,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) it("can get genesis", async () => { pendingWithoutTendermint(); - const client = await Tendermint34Client.create(rpcFactory()); + const client = Tendermint34Client.create(rpcFactory()); const genesis = await client.genesis(); expect(genesis).toBeTruthy(); client.disconnect(); @@ -50,7 +50,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) describe("broadcastTxCommit", () => { it("can broadcast a transaction", async () => { pendingWithoutTendermint(); - const client = await Tendermint34Client.create(rpcFactory()); + const client = Tendermint34Client.create(rpcFactory()); const tx = buildKvTx(randomString(), randomString()); const response = await client.broadcastTxCommit({ tx: tx }); @@ -70,7 +70,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) describe("broadcastTxSync", () => { it("can broadcast a transaction", async () => { pendingWithoutTendermint(); - const client = await Tendermint34Client.create(rpcFactory()); + const client = Tendermint34Client.create(rpcFactory()); const tx = buildKvTx(randomString(), randomString()); const response = await client.broadcastTxSync({ tx: tx }); @@ -86,7 +86,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) describe("broadcastTxAsync", () => { it("can broadcast a transaction", async () => { pendingWithoutTendermint(); - const client = await Tendermint34Client.create(rpcFactory()); + const client = Tendermint34Client.create(rpcFactory()); const tx = buildKvTx(randomString(), randomString()); const response = await client.broadcastTxAsync({ tx: tx }); @@ -98,7 +98,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) it("gets the same tx hash from backend as calculated locally", async () => { pendingWithoutTendermint(); - const client = await Tendermint34Client.create(rpcFactory()); + const client = Tendermint34Client.create(rpcFactory()); const tx = buildKvTx(randomString(), randomString()); const calculatedTxHash = hashTx(tx); @@ -111,7 +111,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) describe("abciQuery", () => { it("can query the state", async () => { pendingWithoutTendermint(); - const client = await Tendermint34Client.create(rpcFactory()); + const client = Tendermint34Client.create(rpcFactory()); const key = randomString(); const value = randomString(); @@ -137,7 +137,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) it("can get a commit", async () => { pendingWithoutTendermint(); - const client = await Tendermint34Client.create(rpcFactory()); + const client = Tendermint34Client.create(rpcFactory()); const response = await client.commit(4); expect(response).toBeTruthy(); @@ -152,7 +152,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) it("can get validators", async () => { pendingWithoutTendermint(); - const client = await Tendermint34Client.create(rpcFactory()); + const client = Tendermint34Client.create(rpcFactory()); const response = await client.validators({}); expect(response).toBeTruthy(); @@ -170,7 +170,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) it("can get all validators", async () => { pendingWithoutTendermint(); - const client = await Tendermint34Client.create(rpcFactory()); + const client = Tendermint34Client.create(rpcFactory()); const response = await client.validatorsAll(); expect(response).toBeTruthy(); @@ -188,7 +188,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) it("can call a bunch of methods", async () => { pendingWithoutTendermint(); - const client = await Tendermint34Client.create(rpcFactory()); + const client = Tendermint34Client.create(rpcFactory()); expect(await client.block()).toBeTruthy(); expect(await client.genesis()).toBeTruthy(); @@ -200,7 +200,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) describe("status", () => { it("works", async () => { pendingWithoutTendermint(); - const client = await Tendermint34Client.create(rpcFactory()); + const client = Tendermint34Client.create(rpcFactory()); const status = await client.status(); @@ -241,7 +241,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) describe("numUnconfirmedTxs", () => { it("works", async () => { pendingWithoutTendermint(); - const client = await Tendermint34Client.create(rpcFactory()); + const client = Tendermint34Client.create(rpcFactory()); const response = await client.numUnconfirmedTxs(); @@ -255,7 +255,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) describe("blockResults", () => { it("works", async () => { pendingWithoutTendermint(); - const client = await Tendermint34Client.create(rpcFactory()); + const client = Tendermint34Client.create(rpcFactory()); const height = 3; const results = await client.blockResults(height); @@ -271,7 +271,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) describe("blockSearch", () => { beforeAll(async () => { if (tendermintEnabled()) { - const client = await Tendermint34Client.create(rpcFactory()); + const client = Tendermint34Client.create(rpcFactory()); // eslint-disable-next-line no-inner-declarations async function sendTx(): Promise { @@ -296,7 +296,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) it("can paginate over blockSearch results", async () => { pendingWithoutTendermint(); - const client = await Tendermint34Client.create(rpcFactory()); + const client = Tendermint34Client.create(rpcFactory()); const query = buildQuery({ raw: "block.height >= 1 AND block.height <= 3" }); @@ -315,7 +315,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) it("can get all search results in one call", async () => { pendingWithoutTendermint(); - const client = await Tendermint34Client.create(rpcFactory()); + const client = Tendermint34Client.create(rpcFactory()); const query = buildQuery({ raw: "block.height >= 1 AND block.height <= 3" }); @@ -334,7 +334,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) describe("blockchain", () => { it("returns latest in descending order by default", async () => { pendingWithoutTendermint(); - const client = await Tendermint34Client.create(rpcFactory()); + const client = Tendermint34Client.create(rpcFactory()); // Run in parallel to increase chance there is no block between the calls const [status, blockchain] = await Promise.all([client.status(), client.blockchain()]); @@ -351,7 +351,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) it("can limit by maxHeight", async () => { pendingWithoutTendermint(); - const client = await Tendermint34Client.create(rpcFactory()); + const client = Tendermint34Client.create(rpcFactory()); const height = (await client.status()).syncInfo.latestBlockHeight; const blockchain = await client.blockchain(undefined, height - 1); @@ -365,7 +365,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) it("works with maxHeight in the future", async () => { pendingWithoutTendermint(); - const client = await Tendermint34Client.create(rpcFactory()); + const client = Tendermint34Client.create(rpcFactory()); const height = (await client.status()).syncInfo.latestBlockHeight; const blockchain = await client.blockchain(undefined, height + 20); @@ -379,7 +379,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) it("can limit by minHeight and maxHeight", async () => { pendingWithoutTendermint(); - const client = await Tendermint34Client.create(rpcFactory()); + const client = Tendermint34Client.create(rpcFactory()); const height = (await client.status()).syncInfo.latestBlockHeight; const blockchain = await client.blockchain(height - 2, height - 1); @@ -393,7 +393,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) it("contains all the info", async () => { pendingWithoutTendermint(); - const client = await Tendermint34Client.create(rpcFactory()); + const client = Tendermint34Client.create(rpcFactory()); const height = (await client.status()).syncInfo.latestBlockHeight; const blockchain = await client.blockchain(height - 1, height - 1); @@ -422,7 +422,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) describe("tx", () => { it("can query a tx properly", async () => { pendingWithoutTendermint(); - const client = await Tendermint34Client.create(rpcFactory()); + const client = Tendermint34Client.create(rpcFactory()); const find = randomString(); const me = randomString(); @@ -462,7 +462,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) beforeAll(async () => { if (tendermintEnabled()) { - const client = await Tendermint34Client.create(rpcFactory()); + const client = Tendermint34Client.create(rpcFactory()); // eslint-disable-next-line no-inner-declarations async function sendTx(): Promise<[Uint8Array, responses.BroadcastTxCommitResponse]> { @@ -490,7 +490,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) it("finds a single tx by hash", async () => { pendingWithoutTendermint(); assert(tx1 && broadcast1); - const client = await Tendermint34Client.create(rpcFactory()); + const client = Tendermint34Client.create(rpcFactory()); const result = await client.txSearch({ query: `tx.hash='${toHex(broadcast1.hash)}'` }); expect(result.totalCount).toEqual(1); @@ -508,7 +508,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) it("finds a single tx by tags", async () => { pendingWithoutTendermint(); - const client = await Tendermint34Client.create(rpcFactory()); + const client = Tendermint34Client.create(rpcFactory()); const txKey2 = randomString(); const txValue2 = randomString(); @@ -554,7 +554,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) // Docs: https://docs.tendermint.com/master/rpc/#/Info/tx_search // Code: https://github.com/tendermint/tendermint/blob/v0.34.10/rpc/core/tx.go#L89 pendingWithoutTendermint(); - const client = await Tendermint34Client.create(rpcFactory()); + const client = Tendermint34Client.create(rpcFactory()); const query = buildQuery({ tags: [{ key: "app.key", value: txKey }] }); @@ -571,7 +571,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) it("can set the order", async () => { pendingWithoutTendermint(); - const client = await Tendermint34Client.create(rpcFactory()); + const client = Tendermint34Client.create(rpcFactory()); const query = buildQuery({ tags: [{ key: "app.key", value: txKey }] }); @@ -586,7 +586,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) it("can paginate over txSearch results", async () => { pendingWithoutTendermint(); - const client = await Tendermint34Client.create(rpcFactory()); + const client = Tendermint34Client.create(rpcFactory()); const query = buildQuery({ tags: [{ key: "app.key", value: txKey }] }); @@ -605,7 +605,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) it("can get all search results in one call", async () => { pendingWithoutTendermint(); - const client = await Tendermint34Client.create(rpcFactory()); + const client = Tendermint34Client.create(rpcFactory()); const query = buildQuery({ tags: [{ key: "app.key", value: txKey }] }); @@ -629,7 +629,7 @@ function websocketTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValue (async () => { const events: responses.NewBlockHeaderEvent[] = []; - const client = await Tendermint34Client.create(rpcFactory()); + const client = Tendermint34Client.create(rpcFactory()); const stream = client.subscribeNewBlockHeader(); expect(stream).toBeTruthy(); const subscription = stream.subscribe({ @@ -687,7 +687,7 @@ function websocketTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValue const transactionData2 = buildKvTx(randomString(), randomString()); const events: responses.NewBlockEvent[] = []; - const client = await Tendermint34Client.create(rpcFactory()); + const client = Tendermint34Client.create(rpcFactory()); const stream = client.subscribeNewBlock(); const subscription = stream.subscribe({ next: (event) => { @@ -743,7 +743,7 @@ function websocketTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValue pendingWithoutTendermint(); const events: responses.TxEvent[] = []; - const client = await Tendermint34Client.create(rpcFactory()); + const client = Tendermint34Client.create(rpcFactory()); const stream = client.subscribeTx(); const subscription = stream.subscribe({ next: (event) => { @@ -787,7 +787,7 @@ function websocketTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValue const transactionData2 = buildKvTx(randomString(), randomString()); const events: responses.TxEvent[] = []; - const client = await Tendermint34Client.create(rpcFactory()); + const client = Tendermint34Client.create(rpcFactory()); const query = buildQuery({ tags: [{ key: "app.creator", value: expected.appCreator }] }); const stream = client.subscribeTx(query); expect(stream).toBeTruthy(); @@ -825,7 +825,7 @@ function websocketTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValue it("can unsubscribe and re-subscribe to the same stream", async () => { pendingWithoutTendermint(); - const client = await Tendermint34Client.create(rpcFactory()); + const client = Tendermint34Client.create(rpcFactory()); const stream = client.subscribeNewBlockHeader(); const event1 = await firstEvent(stream); @@ -858,7 +858,7 @@ function websocketTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValue it("can subscribe twice", async () => { pendingWithoutTendermint(); - const client = await Tendermint34Client.create(rpcFactory()); + const client = Tendermint34Client.create(rpcFactory()); const stream1 = client.subscribeNewBlockHeader(); const stream2 = client.subscribeNewBlockHeader(); diff --git a/packages/tendermint-rpc/src/tendermint34/tendermint34client.ts b/packages/tendermint-rpc/src/tendermint34/tendermint34client.ts index 6704a6f066..4b7dec7ed8 100644 --- a/packages/tendermint-rpc/src/tendermint34/tendermint34client.ts +++ b/packages/tendermint-rpc/src/tendermint34/tendermint34client.ts @@ -47,7 +47,7 @@ export class Tendermint34Client { /** * Creates a new Tendermint client given an RPC client. */ - public static async create(rpcClient: RpcClient): Promise { + public static create(rpcClient: RpcClient): Tendermint34Client { return new Tendermint34Client(rpcClient); } diff --git a/packages/tendermint-rpc/src/tendermint37/tendermint37client.spec.ts b/packages/tendermint-rpc/src/tendermint37/tendermint37client.spec.ts index b90653d9a3..2b4835fb91 100644 --- a/packages/tendermint-rpc/src/tendermint37/tendermint37client.spec.ts +++ b/packages/tendermint-rpc/src/tendermint37/tendermint37client.spec.ts @@ -25,7 +25,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) describe("create", () => { it("can auto-discover Tendermint version and communicate", async () => { pendingWithoutTendermint(); - const client = await Tendermint37Client.create(rpcFactory()); + const client = Tendermint37Client.create(rpcFactory()); const info = await client.abciInfo(); expect(info).toBeTruthy(); client.disconnect(); @@ -33,7 +33,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) it("can connect to Tendermint with known version", async () => { pendingWithoutTendermint(); - const client = await Tendermint37Client.create(rpcFactory()); + const client = Tendermint37Client.create(rpcFactory()); expect(await client.abciInfo()).toBeTruthy(); client.disconnect(); }); @@ -41,7 +41,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) it("can get genesis", async () => { pendingWithoutTendermint(); - const client = await Tendermint37Client.create(rpcFactory()); + const client = Tendermint37Client.create(rpcFactory()); const genesis = await client.genesis(); expect(genesis).toBeTruthy(); client.disconnect(); @@ -50,7 +50,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) describe("broadcastTxCommit", () => { it("can broadcast a transaction", async () => { pendingWithoutTendermint(); - const client = await Tendermint37Client.create(rpcFactory()); + const client = Tendermint37Client.create(rpcFactory()); const tx = buildKvTx(randomString(), randomString()); const response = await client.broadcastTxCommit({ tx: tx }); @@ -70,7 +70,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) describe("broadcastTxSync", () => { it("can broadcast a transaction", async () => { pendingWithoutTendermint(); - const client = await Tendermint37Client.create(rpcFactory()); + const client = Tendermint37Client.create(rpcFactory()); const tx = buildKvTx(randomString(), randomString()); const response = await client.broadcastTxSync({ tx: tx }); @@ -86,7 +86,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) describe("broadcastTxAsync", () => { it("can broadcast a transaction", async () => { pendingWithoutTendermint(); - const client = await Tendermint37Client.create(rpcFactory()); + const client = Tendermint37Client.create(rpcFactory()); const tx = buildKvTx(randomString(), randomString()); const response = await client.broadcastTxAsync({ tx: tx }); @@ -98,7 +98,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) it("gets the same tx hash from backend as calculated locally", async () => { pendingWithoutTendermint(); - const client = await Tendermint37Client.create(rpcFactory()); + const client = Tendermint37Client.create(rpcFactory()); const tx = buildKvTx(randomString(), randomString()); const calculatedTxHash = hashTx(tx); @@ -111,7 +111,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) describe("abciQuery", () => { it("can query the state", async () => { pendingWithoutTendermint(); - const client = await Tendermint37Client.create(rpcFactory()); + const client = Tendermint37Client.create(rpcFactory()); const key = randomString(); const value = randomString(); @@ -137,7 +137,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) it("can get a commit", async () => { pendingWithoutTendermint(); - const client = await Tendermint37Client.create(rpcFactory()); + const client = Tendermint37Client.create(rpcFactory()); const response = await client.commit(4); expect(response).toBeTruthy(); @@ -152,7 +152,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) it("can get validators", async () => { pendingWithoutTendermint(); - const client = await Tendermint37Client.create(rpcFactory()); + const client = Tendermint37Client.create(rpcFactory()); const response = await client.validators({}); expect(response).toBeTruthy(); @@ -170,7 +170,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) it("can get all validators", async () => { pendingWithoutTendermint(); - const client = await Tendermint37Client.create(rpcFactory()); + const client = Tendermint37Client.create(rpcFactory()); const response = await client.validatorsAll(); expect(response).toBeTruthy(); @@ -188,7 +188,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) it("can call a bunch of methods", async () => { pendingWithoutTendermint(); - const client = await Tendermint37Client.create(rpcFactory()); + const client = Tendermint37Client.create(rpcFactory()); expect(await client.block()).toBeTruthy(); expect(await client.genesis()).toBeTruthy(); @@ -200,7 +200,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) describe("status", () => { it("works", async () => { pendingWithoutTendermint(); - const client = await Tendermint37Client.create(rpcFactory()); + const client = Tendermint37Client.create(rpcFactory()); const status = await client.status(); @@ -241,7 +241,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) describe("numUnconfirmedTxs", () => { it("works", async () => { pendingWithoutTendermint(); - const client = await Tendermint37Client.create(rpcFactory()); + const client = Tendermint37Client.create(rpcFactory()); const response = await client.numUnconfirmedTxs(); @@ -255,7 +255,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) describe("blockResults", () => { it("works", async () => { pendingWithoutTendermint(); - const client = await Tendermint37Client.create(rpcFactory()); + const client = Tendermint37Client.create(rpcFactory()); const height = 3; const results = await client.blockResults(height); @@ -271,7 +271,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) describe("blockSearch", () => { beforeAll(async () => { if (tendermintEnabled()) { - const client = await Tendermint37Client.create(rpcFactory()); + const client = Tendermint37Client.create(rpcFactory()); // eslint-disable-next-line no-inner-declarations async function sendTx(): Promise { @@ -296,7 +296,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) it("can paginate over blockSearch results", async () => { pendingWithoutTendermint(); - const client = await Tendermint37Client.create(rpcFactory()); + const client = Tendermint37Client.create(rpcFactory()); const query = buildQuery({ raw: "block.height >= 1 AND block.height <= 3" }); @@ -315,7 +315,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) it("can get all search results in one call", async () => { pendingWithoutTendermint(); - const client = await Tendermint37Client.create(rpcFactory()); + const client = Tendermint37Client.create(rpcFactory()); const query = buildQuery({ raw: "block.height >= 1 AND block.height <= 3" }); @@ -334,7 +334,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) describe("blockchain", () => { it("returns latest in descending order by default", async () => { pendingWithoutTendermint(); - const client = await Tendermint37Client.create(rpcFactory()); + const client = Tendermint37Client.create(rpcFactory()); // Run in parallel to increase chance there is no block between the calls const [status, blockchain] = await Promise.all([client.status(), client.blockchain()]); @@ -351,7 +351,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) it("can limit by maxHeight", async () => { pendingWithoutTendermint(); - const client = await Tendermint37Client.create(rpcFactory()); + const client = Tendermint37Client.create(rpcFactory()); const height = (await client.status()).syncInfo.latestBlockHeight; const blockchain = await client.blockchain(undefined, height - 1); @@ -365,7 +365,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) it("works with maxHeight in the future", async () => { pendingWithoutTendermint(); - const client = await Tendermint37Client.create(rpcFactory()); + const client = Tendermint37Client.create(rpcFactory()); const height = (await client.status()).syncInfo.latestBlockHeight; const blockchain = await client.blockchain(undefined, height + 20); @@ -380,7 +380,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) it("can limit by minHeight and maxHeight", async () => { pendingWithoutTendermint(); - const client = await Tendermint37Client.create(rpcFactory()); + const client = Tendermint37Client.create(rpcFactory()); const height = (await client.status()).syncInfo.latestBlockHeight; const blockchain = await client.blockchain(height - 2, height - 1); @@ -394,7 +394,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) it("contains all the info", async () => { pendingWithoutTendermint(); - const client = await Tendermint37Client.create(rpcFactory()); + const client = Tendermint37Client.create(rpcFactory()); const height = (await client.status()).syncInfo.latestBlockHeight; const blockchain = await client.blockchain(height - 1, height - 1); @@ -423,7 +423,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) describe("tx", () => { it("can query a tx properly", async () => { pendingWithoutTendermint(); - const client = await Tendermint37Client.create(rpcFactory()); + const client = Tendermint37Client.create(rpcFactory()); const find = randomString(); const me = randomString(); @@ -463,7 +463,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) beforeAll(async () => { if (tendermintEnabled()) { - const client = await Tendermint37Client.create(rpcFactory()); + const client = Tendermint37Client.create(rpcFactory()); // eslint-disable-next-line no-inner-declarations async function sendTx(): Promise<[Uint8Array, responses.BroadcastTxCommitResponse]> { @@ -491,7 +491,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) it("finds a single tx by hash", async () => { pendingWithoutTendermint(); assert(tx1 && broadcast1); - const client = await Tendermint37Client.create(rpcFactory()); + const client = Tendermint37Client.create(rpcFactory()); const result = await client.txSearch({ query: `tx.hash='${toHex(broadcast1.hash)}'` }); expect(result.totalCount).toEqual(1); @@ -509,7 +509,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) it("finds a single tx by tags", async () => { pendingWithoutTendermint(); - const client = await Tendermint37Client.create(rpcFactory()); + const client = Tendermint37Client.create(rpcFactory()); const txKey2 = randomString(); const txValue2 = randomString(); @@ -559,7 +559,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) // Code 0.35: https://github.com/tendermint/tendermint/blob/v0.35.6/internal/rpc/core/tx.go#L93 // Code 0.37: https://github.com/cometbft/cometbft/blob/v0.37.0-rc3/rpc/core/tx.go#L87 pendingWithoutTendermint(); - const client = await Tendermint37Client.create(rpcFactory()); + const client = Tendermint37Client.create(rpcFactory()); const query = buildQuery({ tags: [{ key: "app.key", value: txKey }] }); @@ -576,7 +576,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) it("can set the order", async () => { pendingWithoutTendermint(); - const client = await Tendermint37Client.create(rpcFactory()); + const client = Tendermint37Client.create(rpcFactory()); const query = buildQuery({ tags: [{ key: "app.key", value: txKey }] }); @@ -591,7 +591,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) it("can paginate over txSearch results", async () => { pendingWithoutTendermint(); - const client = await Tendermint37Client.create(rpcFactory()); + const client = Tendermint37Client.create(rpcFactory()); const query = buildQuery({ tags: [{ key: "app.key", value: txKey }] }); @@ -610,7 +610,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues) it("can get all search results in one call", async () => { pendingWithoutTendermint(); - const client = await Tendermint37Client.create(rpcFactory()); + const client = Tendermint37Client.create(rpcFactory()); const query = buildQuery({ tags: [{ key: "app.key", value: txKey }] }); @@ -634,7 +634,7 @@ function websocketTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValue (async () => { const events: responses.NewBlockHeaderEvent[] = []; - const client = await Tendermint37Client.create(rpcFactory()); + const client = Tendermint37Client.create(rpcFactory()); const stream = client.subscribeNewBlockHeader(); expect(stream).toBeTruthy(); const subscription = stream.subscribe({ @@ -693,7 +693,7 @@ function websocketTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValue const transactionData2 = buildKvTx(randomString(), randomString()); const events: responses.NewBlockEvent[] = []; - const client = await Tendermint37Client.create(rpcFactory()); + const client = Tendermint37Client.create(rpcFactory()); const stream = client.subscribeNewBlock(); const subscription = stream.subscribe({ next: (event) => { @@ -752,7 +752,7 @@ function websocketTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValue pendingWithoutTendermint(); const events: responses.TxEvent[] = []; - const client = await Tendermint37Client.create(rpcFactory()); + const client = Tendermint37Client.create(rpcFactory()); const stream = client.subscribeTx(); const subscription = stream.subscribe({ next: (event) => { @@ -796,7 +796,7 @@ function websocketTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValue const transactionData2 = buildKvTx(randomString(), randomString()); const events: responses.TxEvent[] = []; - const client = await Tendermint37Client.create(rpcFactory()); + const client = Tendermint37Client.create(rpcFactory()); const query = buildQuery({ tags: [{ key: "app.creator", value: expected.appCreator }] }); const stream = client.subscribeTx(query); expect(stream).toBeTruthy(); @@ -834,7 +834,7 @@ function websocketTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValue it("can unsubscribe and re-subscribe to the same stream", async () => { pendingWithoutTendermint(); - const client = await Tendermint37Client.create(rpcFactory()); + const client = Tendermint37Client.create(rpcFactory()); const stream = client.subscribeNewBlockHeader(); const event1 = await firstEvent(stream); @@ -867,7 +867,7 @@ function websocketTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValue it("can subscribe twice", async () => { pendingWithoutTendermint(); - const client = await Tendermint37Client.create(rpcFactory()); + const client = Tendermint37Client.create(rpcFactory()); const stream1 = client.subscribeNewBlockHeader(); const stream2 = client.subscribeNewBlockHeader(); diff --git a/packages/tendermint-rpc/src/tendermint37/tendermint37client.ts b/packages/tendermint-rpc/src/tendermint37/tendermint37client.ts index 3d55949720..9f52b3bd03 100644 --- a/packages/tendermint-rpc/src/tendermint37/tendermint37client.ts +++ b/packages/tendermint-rpc/src/tendermint37/tendermint37client.ts @@ -47,7 +47,7 @@ export class Tendermint37Client { /** * Creates a new Tendermint client given an RPC client. */ - public static async create(rpcClient: RpcClient): Promise { + public static create(rpcClient: RpcClient): Tendermint37Client { return new Tendermint37Client(rpcClient); }