diff --git a/packages/sdk/src/cosmwasmclient.spec.ts b/packages/sdk/src/cosmwasmclient.spec.ts index 69cb70b4..5862ae17 100644 --- a/packages/sdk/src/cosmwasmclient.spec.ts +++ b/packages/sdk/src/cosmwasmclient.spec.ts @@ -202,6 +202,14 @@ describe("CosmWasmClient", () => { ); }); + it("can search by ID (non existent)", async () => { + pendingWithoutCosmos(); + const client = CosmWasmClient.makeReadOnly(httpUrl); + const nonExistentId = "0000000000000000000000000000000000000000000000000000000000000000"; + const result = await client.searchTx({ id: nonExistentId }); + expect(result.length).toEqual(0); + }); + it("can search by height", async () => { pendingWithoutCosmos(); assert(posted, "value must be set in beforeAll()"); diff --git a/packages/sdk/src/cosmwasmclient.ts b/packages/sdk/src/cosmwasmclient.ts index 130f8949..c94232fd 100644 --- a/packages/sdk/src/cosmwasmclient.ts +++ b/packages/sdk/src/cosmwasmclient.ts @@ -164,7 +164,7 @@ export class CosmWasmClient { } if (isSearchByIdQuery(query)) { - return [await this.restClient.txsById(query.id)]; + return (await this.restClient.txs(`tx.hash=${query.id}`)).txs; } else if (isSearchByHeightQuery(query)) { return (await this.restClient.txs(`tx.height=${query.height}`)).txs; } else if (isSearchBySentFromOrToQuery(query)) {