From 8ab4b7b7ccd0d48903b4b2aaa64ce6f53d3602c1 Mon Sep 17 00:00:00 2001 From: Simon Warta Date: Tue, 19 Dec 2023 13:37:49 +0100 Subject: [PATCH 1/3] Add unit tests for hasProtocol --- .../src/rpcclients/rpcclient.spec.ts | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/packages/tendermint-rpc/src/rpcclients/rpcclient.spec.ts b/packages/tendermint-rpc/src/rpcclients/rpcclient.spec.ts index a5fb0310bd..9097dec2c1 100644 --- a/packages/tendermint-rpc/src/rpcclients/rpcclient.spec.ts +++ b/packages/tendermint-rpc/src/rpcclients/rpcclient.spec.ts @@ -41,3 +41,30 @@ describe("RpcClient", () => { wsClient.disconnect(); }); }); + +describe("hasProtocol", () => { + it("works", () => { + expect(hasProtocol("https://my.rpc.net")).toEqual(true); + expect(hasProtocol("https://my.rpc.net:443")).toEqual(true); + expect(hasProtocol("https://my.rpc.net:443/somewhere")).toEqual(true); + expect(hasProtocol("http://my.rpc.net")).toEqual(true); + expect(hasProtocol("http://my.rpc.net:443")).toEqual(true); + expect(hasProtocol("http://my.rpc.net:443/somewhere")).toEqual(true); + expect(hasProtocol("wss://my.rpc.net")).toEqual(true); + expect(hasProtocol("wss://my.rpc.net:443")).toEqual(true); + expect(hasProtocol("wss://my.rpc.net:443/somewhere")).toEqual(true); + expect(hasProtocol("ws://my.rpc.net")).toEqual(true); + expect(hasProtocol("ws://my.rpc.net:443")).toEqual(true); + expect(hasProtocol("ws://my.rpc.net:443/somewhere")).toEqual(true); + expect(hasProtocol("ws://my.rpc.net:443/somewhere")).toEqual(true); + expect(hasProtocol("file:///Users/joe/Library/CloudStorage/Notes.pdf")).toEqual(true); + + // Protocols without double slash is not what we want to see here + expect(hasProtocol("tel:+1-201-555-0123")).toEqual(false); + + // No protocols + expect(hasProtocol("")).toEqual(false); + expect(hasProtocol(" ")).toEqual(false); + expect(hasProtocol("/")).toEqual(false); + }); +}); From b0ccb04dacb600423832c5413f9237fce8aaecf3 Mon Sep 17 00:00:00 2001 From: Simon Warta Date: Tue, 19 Dec 2023 13:54:16 +0100 Subject: [PATCH 2/3] Require protocol to be set in endpoint URLs --- CHANGELOG.md | 8 ++++++++ .../src/comet38/comet38client.spec.ts | 12 ++---------- .../src/rpcclients/httpbatchclient.spec.ts | 4 ++-- .../src/rpcclients/httpbatchclient.ts | 6 ++++-- .../src/rpcclients/httpclient.spec.ts | 4 ++-- .../tendermint-rpc/src/rpcclients/httpclient.ts | 6 ++++-- .../tendermint-rpc/src/rpcclients/rpcclient.spec.ts | 13 +++++++------ .../src/rpcclients/websocketclient.spec.ts | 3 ++- .../src/rpcclients/websocketclient.ts | 8 +++++--- .../src/tendermint34/tendermint34client.spec.ts | 12 ++---------- .../src/tendermint37/tendermint37client.spec.ts | 12 ++---------- packages/tendermint-rpc/src/testutil.spec.ts | 1 + 12 files changed, 41 insertions(+), 48 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 66bef37269..f610ce72b9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,14 @@ and this project adheres to [#1522]: https://github.com/cosmos/cosmjs/pull/1522 +### Changed + +- @cosmjs/tendermint-rpc: Require protocol to be set in endpoint URLs (https://, + http://, wss:// or ws://). Otherwise an error is raised instead of falling + back to ws://. ([#1527]) + +[#1527]: https://github.com/cosmos/cosmjs/pull/1527 + ## [0.32.1] - 2023-12-04 ### Fixed diff --git a/packages/tendermint-rpc/src/comet38/comet38client.spec.ts b/packages/tendermint-rpc/src/comet38/comet38client.spec.ts index c949036a4b..3d411432dd 100644 --- a/packages/tendermint-rpc/src/comet38/comet38client.spec.ts +++ b/packages/tendermint-rpc/src/comet38/comet38client.spec.ts @@ -885,14 +885,6 @@ describe("Comet38Client", () => { it("can connect to a given url", async () => { pendingWithoutTendermint(); - // default connection - { - const client = await Comet38Client.connect(url); - const info = await client.abciInfo(); - expect(info).toBeTruthy(); - client.disconnect(); - } - // http connection { const client = await Comet38Client.connect("http://" + url); @@ -911,13 +903,13 @@ describe("Comet38Client", () => { }); describe("With HttpClient", () => { - defaultTestSuite(() => new HttpClient(url), expected); + defaultTestSuite(() => new HttpClient("http://" + url), expected); }); describe("With WebsocketClient", () => { // don't print out WebSocket errors if marked pending const onError = process.env.TENDERMINT_ENABLED ? console.error : () => 0; - const factory = (): WebsocketClient => new WebsocketClient(url, onError); + const factory = (): WebsocketClient => new WebsocketClient("ws://" + url, onError); defaultTestSuite(factory, expected); websocketTestSuite(factory, expected); }); diff --git a/packages/tendermint-rpc/src/rpcclients/httpbatchclient.spec.ts b/packages/tendermint-rpc/src/rpcclients/httpbatchclient.spec.ts index b05c3e56de..e25cf478ef 100644 --- a/packages/tendermint-rpc/src/rpcclients/httpbatchclient.spec.ts +++ b/packages/tendermint-rpc/src/rpcclients/httpbatchclient.spec.ts @@ -9,9 +9,9 @@ function pendingWithoutTendermint(): void { } } -const tendermintUrl = defaultInstance.url; - describe("HttpBatchClient", () => { + const tendermintUrl = "http://" + defaultInstance.url; + it("can make a simple call", async () => { pendingWithoutTendermint(); const client = new HttpBatchClient(tendermintUrl); diff --git a/packages/tendermint-rpc/src/rpcclients/httpbatchclient.ts b/packages/tendermint-rpc/src/rpcclients/httpbatchclient.ts index 4b8e4fe653..8d2267a02d 100644 --- a/packages/tendermint-rpc/src/rpcclients/httpbatchclient.ts +++ b/packages/tendermint-rpc/src/rpcclients/httpbatchclient.ts @@ -42,8 +42,10 @@ export class HttpBatchClient implements RpcClient { dispatchInterval: options.dispatchInterval ?? defaultHttpBatchClientOptions.dispatchInterval, }; if (typeof endpoint === "string") { - // accept host.name:port and assume http protocol - this.url = hasProtocol(endpoint) ? endpoint : "http://" + endpoint; + if (!hasProtocol(endpoint)) { + throw new Error("Endpoint URL is missing a protocol. Expected 'https://' or 'http://'."); + } + this.url = endpoint; } else { this.url = endpoint.url; this.headers = endpoint.headers; diff --git a/packages/tendermint-rpc/src/rpcclients/httpclient.spec.ts b/packages/tendermint-rpc/src/rpcclients/httpclient.spec.ts index 11cf707e85..8026d2e2c0 100644 --- a/packages/tendermint-rpc/src/rpcclients/httpclient.spec.ts +++ b/packages/tendermint-rpc/src/rpcclients/httpclient.spec.ts @@ -8,9 +8,9 @@ function pendingWithoutTendermint(): void { } } -const tendermintUrl = defaultInstance.url; - describe("HttpClient", () => { + const tendermintUrl = "http://" + defaultInstance.url; + it("can make a simple call", async () => { pendingWithoutTendermint(); const client = new HttpClient(tendermintUrl); diff --git a/packages/tendermint-rpc/src/rpcclients/httpclient.ts b/packages/tendermint-rpc/src/rpcclients/httpclient.ts index a17e9699e3..b4107b321b 100644 --- a/packages/tendermint-rpc/src/rpcclients/httpclient.ts +++ b/packages/tendermint-rpc/src/rpcclients/httpclient.ts @@ -28,8 +28,10 @@ export class HttpClient implements RpcClient { public constructor(endpoint: string | HttpEndpoint) { if (typeof endpoint === "string") { - // accept host.name:port and assume http protocol - this.url = hasProtocol(endpoint) ? endpoint : "http://" + endpoint; + if (!hasProtocol(endpoint)) { + throw new Error("Endpoint URL is missing a protocol. Expected 'https://' or 'http://'."); + } + this.url = endpoint; } else { this.url = endpoint.url; this.headers = endpoint.headers; diff --git a/packages/tendermint-rpc/src/rpcclients/rpcclient.spec.ts b/packages/tendermint-rpc/src/rpcclients/rpcclient.spec.ts index 9097dec2c1..8720ffd256 100644 --- a/packages/tendermint-rpc/src/rpcclients/rpcclient.spec.ts +++ b/packages/tendermint-rpc/src/rpcclients/rpcclient.spec.ts @@ -1,7 +1,7 @@ import { createJsonRpcRequest } from "../jsonrpc"; import { defaultInstance } from "../testutil.spec"; import { HttpClient } from "./httpclient"; -import { instanceOfRpcStreamingClient } from "./rpcclient"; +import { hasProtocol, instanceOfRpcStreamingClient } from "./rpcclient"; import { WebsocketClient } from "./websocketclient"; function pendingWithoutTendermint(): void { @@ -11,13 +11,14 @@ function pendingWithoutTendermint(): void { } describe("RpcClient", () => { - const tendermintUrl = defaultInstance.url; + const httpUrl = "http://" + defaultInstance.url; + const wsUrl = "ws://" + defaultInstance.url; it("has working instanceOfRpcStreamingClient()", async () => { pendingWithoutTendermint(); - const httpClient = new HttpClient(tendermintUrl); - const wsClient = new WebsocketClient(tendermintUrl); + const httpClient = new HttpClient(httpUrl); + const wsClient = new WebsocketClient(wsUrl); expect(instanceOfRpcStreamingClient(httpClient)).toEqual(false); expect(instanceOfRpcStreamingClient(wsClient)).toEqual(true); @@ -32,11 +33,11 @@ describe("RpcClient", () => { const statusRequest = createJsonRpcRequest("status"); - const httpClient = new HttpClient(tendermintUrl + "/"); + const httpClient = new HttpClient(httpUrl + "/"); expect(await httpClient.execute(statusRequest)).toBeDefined(); httpClient.disconnect(); - const wsClient = new WebsocketClient(tendermintUrl + "/"); + const wsClient = new WebsocketClient(wsUrl + "/"); expect(await wsClient.execute(statusRequest)).toBeDefined(); wsClient.disconnect(); }); diff --git a/packages/tendermint-rpc/src/rpcclients/websocketclient.spec.ts b/packages/tendermint-rpc/src/rpcclients/websocketclient.spec.ts index 8c88a450ee..9af778455f 100644 --- a/packages/tendermint-rpc/src/rpcclients/websocketclient.spec.ts +++ b/packages/tendermint-rpc/src/rpcclients/websocketclient.spec.ts @@ -14,7 +14,8 @@ function pendingWithoutTendermint(): void { } describe("WebsocketClient", () => { - const { blockTime, url: tendermintUrl } = defaultInstance; + const { blockTime, url } = defaultInstance; + const tendermintUrl = "ws://" + url; it("can make a simple call", async () => { pendingWithoutTendermint(); diff --git a/packages/tendermint-rpc/src/rpcclients/websocketclient.ts b/packages/tendermint-rpc/src/rpcclients/websocketclient.ts index d5485b3536..52803d1b62 100644 --- a/packages/tendermint-rpc/src/rpcclients/websocketclient.ts +++ b/packages/tendermint-rpc/src/rpcclients/websocketclient.ts @@ -143,11 +143,13 @@ export class WebsocketClient implements RpcStreamingClient { private readonly subscriptionStreams = new Map>(); public constructor(baseUrl: string, onError: (err: any) => void = defaultErrorHandler) { - // accept host.name:port and assume ws protocol + if (!hasProtocol(baseUrl)) { + throw new Error("Base URL is missing a protocol. Expected 'ws://' or 'wss://'."); + } + // make sure we don't end up with ...//websocket const path = baseUrl.endsWith("/") ? "websocket" : "/websocket"; - const cleanBaseUrl = hasProtocol(baseUrl) ? baseUrl : "ws://" + baseUrl; - this.url = cleanBaseUrl + path; + this.url = baseUrl + path; this.socket = new ReconnectingSocket(this.url); diff --git a/packages/tendermint-rpc/src/tendermint34/tendermint34client.spec.ts b/packages/tendermint-rpc/src/tendermint34/tendermint34client.spec.ts index eca45de830..f8f2140e87 100644 --- a/packages/tendermint-rpc/src/tendermint34/tendermint34client.spec.ts +++ b/packages/tendermint-rpc/src/tendermint34/tendermint34client.spec.ts @@ -876,14 +876,6 @@ describe("Tendermint34Client", () => { it("can connect to a given url", async () => { pendingWithoutTendermint(); - // default connection - { - const client = await Tendermint34Client.connect(url); - const info = await client.abciInfo(); - expect(info).toBeTruthy(); - client.disconnect(); - } - // http connection { const client = await Tendermint34Client.connect("http://" + url); @@ -902,13 +894,13 @@ describe("Tendermint34Client", () => { }); describe("With HttpClient", () => { - defaultTestSuite(() => new HttpClient(url), expected); + defaultTestSuite(() => new HttpClient("http://" + url), expected); }); describe("With WebsocketClient", () => { // don't print out WebSocket errors if marked pending const onError = process.env.TENDERMINT_ENABLED ? console.error : () => 0; - const factory = (): WebsocketClient => new WebsocketClient(url, onError); + const factory = (): WebsocketClient => new WebsocketClient("ws://" + url, onError); defaultTestSuite(factory, expected); websocketTestSuite(factory, expected); }); diff --git a/packages/tendermint-rpc/src/tendermint37/tendermint37client.spec.ts b/packages/tendermint-rpc/src/tendermint37/tendermint37client.spec.ts index 36732b31e7..b90653d9a3 100644 --- a/packages/tendermint-rpc/src/tendermint37/tendermint37client.spec.ts +++ b/packages/tendermint-rpc/src/tendermint37/tendermint37client.spec.ts @@ -885,14 +885,6 @@ describe("Tendermint37Client", () => { it("can connect to a given url", async () => { pendingWithoutTendermint(); - // default connection - { - const client = await Tendermint37Client.connect(url); - const info = await client.abciInfo(); - expect(info).toBeTruthy(); - client.disconnect(); - } - // http connection { const client = await Tendermint37Client.connect("http://" + url); @@ -911,13 +903,13 @@ describe("Tendermint37Client", () => { }); describe("With HttpClient", () => { - defaultTestSuite(() => new HttpClient(url), expected); + defaultTestSuite(() => new HttpClient("http://" + url), expected); }); describe("With WebsocketClient", () => { // don't print out WebSocket errors if marked pending const onError = process.env.TENDERMINT_ENABLED ? console.error : () => 0; - const factory = (): WebsocketClient => new WebsocketClient(url, onError); + const factory = (): WebsocketClient => new WebsocketClient("ws://" + url, onError); defaultTestSuite(factory, expected); websocketTestSuite(factory, expected); }); diff --git a/packages/tendermint-rpc/src/testutil.spec.ts b/packages/tendermint-rpc/src/testutil.spec.ts index e47bead89b..735805e4fa 100644 --- a/packages/tendermint-rpc/src/testutil.spec.ts +++ b/packages/tendermint-rpc/src/testutil.spec.ts @@ -15,6 +15,7 @@ export interface ExpectedValues { } export interface TendermintInstance { + /** URL without protocol. Protocol will be added in tests. */ readonly url: string; readonly version: string; /** rough block time in ms */ From 8979eac3b73b7959dd5f8363e2afbcead663f4da Mon Sep 17 00:00:00 2001 From: Simon Warta Date: Tue, 19 Dec 2023 14:12:41 +0100 Subject: [PATCH 3/3] Use blockchain RPC URLs with protocol --- packages/faucet/src/faucet.spec.ts | 2 +- .../stargate/src/modules/auth/queries.spec.ts | 6 +- .../src/modules/authz/queries.spec.ts | 8 +-- .../stargate/src/modules/bank/queries.spec.ts | 22 +++--- .../src/modules/distribution/queries.spec.ts | 20 +++--- .../stargate/src/modules/gov/messages.spec.ts | 16 +++-- .../stargate/src/modules/gov/queries.spec.ts | 22 +++--- .../stargate/src/modules/ibc/queries.spec.ts | 68 +++++++++--------- .../stargate/src/modules/mint/queries.spec.ts | 6 +- .../src/modules/slashing/queries.spec.ts | 4 +- .../src/modules/staking/messages.spec.ts | 10 +-- .../src/modules/staking/queries.spec.ts | 30 ++++---- .../stargate/src/modules/tx/queries.spec.ts | 8 +-- .../src/modules/vesting/messages.spec.ts | 4 +- packages/stargate/src/multisignature.spec.ts | 4 +- .../src/signingstargateclient.spec.ts | 72 ++++++++++--------- .../src/stargateclient.searchtx.spec.ts | 18 ++--- packages/stargate/src/stargateclient.spec.ts | 42 +++++------ packages/stargate/src/testutils.spec.ts | 2 - 19 files changed, 188 insertions(+), 176 deletions(-) diff --git a/packages/faucet/src/faucet.spec.ts b/packages/faucet/src/faucet.spec.ts index b54dfe3b2b..46cd2c3d87 100644 --- a/packages/faucet/src/faucet.spec.ts +++ b/packages/faucet/src/faucet.spec.ts @@ -32,7 +32,7 @@ const faucetMnemonic = describe("Faucet", () => { const pathBuilder = makeCosmoshubPath; - const apiUrl = "localhost:26658"; + const apiUrl = "http://localhost:26658"; const stargate = true; let originalEnvVariable: string | undefined; diff --git a/packages/stargate/src/modules/auth/queries.spec.ts b/packages/stargate/src/modules/auth/queries.spec.ts index 2ba101dc23..f7e746fc01 100644 --- a/packages/stargate/src/modules/auth/queries.spec.ts +++ b/packages/stargate/src/modules/auth/queries.spec.ts @@ -18,7 +18,7 @@ describe("AuthExtension", () => { describe("account", () => { it("works for unused account", async () => { pendingWithoutSimapp(); - const [client, cometClient] = await makeClientWithAuth(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithAuth(simapp.tendermintUrlHttp); const account = await client.auth.account(unused.address); assert(account); @@ -36,7 +36,7 @@ describe("AuthExtension", () => { it("works for account with pubkey and non-zero sequence", async () => { pendingWithoutSimapp(); - const [client, cometClient] = await makeClientWithAuth(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithAuth(simapp.tendermintUrlHttp); const account = await client.auth.account(validator.delegatorAddress); assert(account); @@ -53,7 +53,7 @@ describe("AuthExtension", () => { it("rejects for non-existent address", async () => { pendingWithoutSimapp(); - const [client, cometClient] = await makeClientWithAuth(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithAuth(simapp.tendermintUrlHttp); await expectAsync(client.auth.account(nonExistentAddress)).toBeRejectedWithError( /account cosmos1p79apjaufyphcmsn4g07cynqf0wyjuezqu84hd not found/i, diff --git a/packages/stargate/src/modules/authz/queries.spec.ts b/packages/stargate/src/modules/authz/queries.spec.ts index 839d0a61ec..6f09195a75 100644 --- a/packages/stargate/src/modules/authz/queries.spec.ts +++ b/packages/stargate/src/modules/authz/queries.spec.ts @@ -41,7 +41,7 @@ describe("AuthzExtension", () => { hdPaths: [makeCosmoshubPath(1), makeCosmoshubPath(2)], }); const client = await SigningStargateClient.connectWithSigner( - simapp.tendermintUrl, + simapp.tendermintUrlHttp, wallet, defaultSigningClientOptions, ); @@ -79,7 +79,7 @@ describe("AuthzExtension", () => { describe("grants", () => { it("works", async () => { pendingWithoutSimapp(); - const [client, cometClient] = await makeClientWithAuthz(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithAuthz(simapp.tendermintUrlHttp); const response = await client.authz.grants(granter1Address, grantee1Address, ""); expect(response.grants.length).toEqual(1); const grant = response.grants[0]; @@ -103,7 +103,7 @@ describe("AuthzExtension", () => { describe("granter grants", () => { it("works", async () => { pendingWithoutSimapp46OrHigher(); - const [client, cometClient] = await makeClientWithAuthz(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithAuthz(simapp.tendermintUrlHttp); const response = await client.authz.granterGrants(granter1Address); expect(response.grants.length).toBeGreaterThanOrEqual(1); const grant = response.grants.find( @@ -134,7 +134,7 @@ describe("AuthzExtension", () => { describe("grantee grants", () => { it("works", async () => { pendingWithoutSimapp46OrHigher(); - const [client, cometClient] = await makeClientWithAuthz(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithAuthz(simapp.tendermintUrlHttp); const response = await client.authz.granteeGrants(grantee1Address); expect(response.grants.length).toEqual(1); const grant = response.grants[0]; diff --git a/packages/stargate/src/modules/bank/queries.spec.ts b/packages/stargate/src/modules/bank/queries.spec.ts index 040ff7aa6d..6dd95fc8d6 100644 --- a/packages/stargate/src/modules/bank/queries.spec.ts +++ b/packages/stargate/src/modules/bank/queries.spec.ts @@ -19,7 +19,7 @@ describe("BankExtension", () => { describe("balance", () => { it("works for different existing balances", async () => { pendingWithoutSimapp(); - const [client, cometClient] = await makeClientWithBank(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithBank(simapp.tendermintUrlHttp); const response1 = await client.bank.balance(unused.address, simapp.denomFee); expect(response1).toEqual({ @@ -37,7 +37,7 @@ describe("BankExtension", () => { it("returns zero for non-existent balance", async () => { pendingWithoutSimapp(); - const [client, cometClient] = await makeClientWithBank(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithBank(simapp.tendermintUrlHttp); const response = await client.bank.balance(unused.address, "gintonic"); expect(response).toEqual({ @@ -50,7 +50,7 @@ describe("BankExtension", () => { it("returns zero for non-existent address", async () => { pendingWithoutSimapp(); - const [client, cometClient] = await makeClientWithBank(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithBank(simapp.tendermintUrlHttp); const response = await client.bank.balance(nonExistentAddress, simapp.denomFee); expect(response).toEqual({ @@ -65,7 +65,7 @@ describe("BankExtension", () => { describe("allBalances", () => { it("returns all balances for unused account", async () => { pendingWithoutSimapp(); - const [client, cometClient] = await makeClientWithBank(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithBank(simapp.tendermintUrlHttp); const balances = await client.bank.allBalances(unused.address); expect(balances).toEqual([ @@ -84,7 +84,7 @@ describe("BankExtension", () => { it("returns an empty list for non-existent account", async () => { pendingWithoutSimapp(); - const [client, cometClient] = await makeClientWithBank(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithBank(simapp.tendermintUrlHttp); const balances = await client.bank.allBalances(nonExistentAddress); expect(balances).toEqual([]); @@ -96,7 +96,7 @@ describe("BankExtension", () => { describe("totalSupply", () => { it("works", async () => { pendingWithoutSimapp(); - const [client, cometClient] = await makeClientWithBank(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithBank(simapp.tendermintUrlHttp); const { supply } = await client.bank.totalSupply(); expect(supply).toEqual([ @@ -117,7 +117,7 @@ describe("BankExtension", () => { describe("supplyOf", () => { it("works for existing denom", async () => { pendingWithoutSimapp(); - const [client, cometClient] = await makeClientWithBank(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithBank(simapp.tendermintUrlHttp); const response = await client.bank.supplyOf(simapp.denomFee); expect(response).toEqual({ @@ -130,7 +130,7 @@ describe("BankExtension", () => { it("returns zero for non-existent denom", async () => { pendingWithoutSimapp(); - const [client, cometClient] = await makeClientWithBank(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithBank(simapp.tendermintUrlHttp); const response = await client.bank.supplyOf("gintonic"); expect(response).toEqual({ @@ -145,7 +145,7 @@ describe("BankExtension", () => { describe("denomMetadata", () => { it("works for existent denom", async () => { pendingWithoutSimapp(); - const [client, cometClient] = await makeClientWithBank(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithBank(simapp.tendermintUrlHttp); const metadata = await client.bank.denomMetadata("ucosm"); expect(metadata).toEqual( @@ -175,7 +175,7 @@ describe("BankExtension", () => { it("works for non-existent denom", async () => { pendingWithoutSimapp(); - const [client, cometClient] = await makeClientWithBank(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithBank(simapp.tendermintUrlHttp); await expectAsync(client.bank.denomMetadata("nothere")).toBeRejectedWithError(/code = NotFound/i); @@ -186,7 +186,7 @@ describe("BankExtension", () => { describe("denomsMetadata", () => { it("works", async () => { pendingWithoutSimapp(); - const [client, cometClient] = await makeClientWithBank(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithBank(simapp.tendermintUrlHttp); const metadatas = await client.bank.denomsMetadata(); expect(metadatas.length).toEqual(1); diff --git a/packages/stargate/src/modules/distribution/queries.spec.ts b/packages/stargate/src/modules/distribution/queries.spec.ts index 0453659f03..417ee42311 100644 --- a/packages/stargate/src/modules/distribution/queries.spec.ts +++ b/packages/stargate/src/modules/distribution/queries.spec.ts @@ -35,7 +35,7 @@ describe("DistributionExtension", () => { if (simappEnabled()) { const wallet = await DirectSecp256k1HdWallet.fromMnemonic(faucet.mnemonic); const client = await SigningStargateClient.connectWithSigner( - simapp.tendermintUrl, + simapp.tendermintUrlHttp, wallet, defaultSigningClientOptions, ); @@ -60,7 +60,7 @@ describe("DistributionExtension", () => { describe("communityPool", () => { it("works", async () => { pendingWithoutSimapp(); - const [client, cometClient] = await makeClientWithDistribution(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithDistribution(simapp.tendermintUrlHttp); const response = await client.distribution.communityPool(); expect(response.pool).toBeDefined(); @@ -73,7 +73,7 @@ describe("DistributionExtension", () => { describe("delegationRewards", () => { it("works", async () => { pendingWithoutSimapp(); - const [client, cometClient] = await makeClientWithDistribution(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithDistribution(simapp.tendermintUrlHttp); const response = await client.distribution.delegationRewards( faucet.address0, @@ -89,7 +89,7 @@ describe("DistributionExtension", () => { describe("delegationTotalRewards", () => { it("works", async () => { pendingWithoutSimapp(); - const [client, cometClient] = await makeClientWithDistribution(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithDistribution(simapp.tendermintUrlHttp); const response = await client.distribution.delegationTotalRewards(faucet.address0); expect(response.rewards).toBeDefined(); @@ -102,7 +102,7 @@ describe("DistributionExtension", () => { describe("delegatorValidators", () => { it("works", async () => { pendingWithoutSimapp(); - const [client, cometClient] = await makeClientWithDistribution(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithDistribution(simapp.tendermintUrlHttp); const response = await client.distribution.delegatorValidators(faucet.address0); expect(response.validators).toBeDefined(); @@ -115,7 +115,7 @@ describe("DistributionExtension", () => { describe("delegatorWithdrawAddress", () => { it("works", async () => { pendingWithoutSimapp(); - const [client, cometClient] = await makeClientWithDistribution(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithDistribution(simapp.tendermintUrlHttp); const response = await client.distribution.delegatorWithdrawAddress(faucet.address0); expect(response.withdrawAddress).toBeDefined(); @@ -128,7 +128,7 @@ describe("DistributionExtension", () => { describe("params", () => { it("works", async () => { pendingWithoutSimapp(); - const [client, cometClient] = await makeClientWithDistribution(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithDistribution(simapp.tendermintUrlHttp); const response = await client.distribution.params(); expect(response.params).toBeDefined(); @@ -141,7 +141,7 @@ describe("DistributionExtension", () => { describe("validatorCommission", () => { it("works", async () => { pendingWithoutSimapp(); - const [client, cometClient] = await makeClientWithDistribution(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithDistribution(simapp.tendermintUrlHttp); const response = await client.distribution.validatorCommission(validator.validatorAddress); expect(response.commission).toBeDefined(); @@ -154,7 +154,7 @@ describe("DistributionExtension", () => { describe("validatorOutstandingRewards", () => { it("works", async () => { pendingWithoutSimapp(); - const [client, cometClient] = await makeClientWithDistribution(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithDistribution(simapp.tendermintUrlHttp); const response = await client.distribution.validatorOutstandingRewards(validator.validatorAddress); expect(response.rewards).toBeDefined(); @@ -167,7 +167,7 @@ describe("DistributionExtension", () => { describe("validatorSlashes", () => { it("works", async () => { pendingWithoutSimapp(); - const [client, cometClient] = await makeClientWithDistribution(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithDistribution(simapp.tendermintUrlHttp); const response = await client.distribution.validatorSlashes(validator.validatorAddress, 1, 5); expect(response.slashes).toBeDefined(); diff --git a/packages/stargate/src/modules/gov/messages.spec.ts b/packages/stargate/src/modules/gov/messages.spec.ts index d5a30f82d3..da995ad07e 100644 --- a/packages/stargate/src/modules/gov/messages.spec.ts +++ b/packages/stargate/src/modules/gov/messages.spec.ts @@ -46,7 +46,7 @@ describe("gov messages", () => { voterWallet = await DirectSecp256k1HdWallet.fromMnemonic(faucet.mnemonic, { hdPaths: voterPaths }); voterWalletAmino = await Secp256k1HdWallet.fromMnemonic(faucet.mnemonic, { hdPaths: voterPaths }); const client = await SigningStargateClient.connectWithSigner( - simapp.tendermintUrl, + simapp.tendermintUrlHttp, voterWallet, defaultSigningClientOptions, ); @@ -132,7 +132,7 @@ describe("gov messages", () => { pendingWithoutSimapp(); assert(voterWallet); assert(proposalId, "Missing proposal ID"); - const client = await SigningStargateClient.connectWithSigner(simapp.tendermintUrl, voterWallet); + const client = await SigningStargateClient.connectWithSigner(simapp.tendermintUrlHttp, voterWallet); const voteMsg: MsgVoteEncodeObject = { typeUrl: "/cosmos.gov.v1beta1.MsgVote", @@ -152,7 +152,10 @@ describe("gov messages", () => { pendingWithoutSimapp(); assert(voterWalletAmino); assert(proposalId, "Missing proposal ID"); - const client = await SigningStargateClient.connectWithSigner(simapp.tendermintUrl, voterWalletAmino); + const client = await SigningStargateClient.connectWithSigner( + simapp.tendermintUrlHttp, + voterWalletAmino, + ); const voteMsg: MsgVoteEncodeObject = { typeUrl: "/cosmos.gov.v1beta1.MsgVote", @@ -174,7 +177,7 @@ describe("gov messages", () => { pendingWithoutSimapp(); assert(voterWallet); assert(proposalId, "Missing proposal ID"); - const client = await SigningStargateClient.connectWithSigner(simapp.tendermintUrl, voterWallet); + const client = await SigningStargateClient.connectWithSigner(simapp.tendermintUrlHttp, voterWallet); const voteMsg: MsgVoteWeightedEncodeObject = { typeUrl: "/cosmos.gov.v1beta1.MsgVoteWeighted", @@ -208,7 +211,10 @@ describe("gov messages", () => { if (simapp50Enabled()) pending("Not working, see https://github.com/cosmos/cosmos-sdk/issues/18546"); assert(voterWalletAmino); assert(proposalId, "Missing proposal ID"); - const client = await SigningStargateClient.connectWithSigner(simapp.tendermintUrl, voterWalletAmino); + const client = await SigningStargateClient.connectWithSigner( + simapp.tendermintUrlHttp, + voterWalletAmino, + ); const voteMsg: MsgVoteWeightedEncodeObject = { typeUrl: "/cosmos.gov.v1beta1.MsgVoteWeighted", diff --git a/packages/stargate/src/modules/gov/queries.spec.ts b/packages/stargate/src/modules/gov/queries.spec.ts index 722cb89592..480ff3aee3 100644 --- a/packages/stargate/src/modules/gov/queries.spec.ts +++ b/packages/stargate/src/modules/gov/queries.spec.ts @@ -57,7 +57,7 @@ describe("GovExtension", () => { hdPaths: [makeCosmoshubPath(1), makeCosmoshubPath(2)], }); const client = await SigningStargateClient.connectWithSigner( - simapp.tendermintUrl, + simapp.tendermintUrlHttp, wallet, defaultSigningClientOptions, ); @@ -152,7 +152,7 @@ describe("GovExtension", () => { describe("params", () => { it("works for deposit", async () => { pendingWithoutSimapp(); - const [client, cometClient] = await makeClientWithGov(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithGov(simapp.tendermintUrlHttp); const response = await client.gov.params("deposit"); expect(response).toEqual( @@ -172,7 +172,7 @@ describe("GovExtension", () => { it("works for tallying", async () => { pendingWithoutSimapp(); - const [client, cometClient] = await makeClientWithGov(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithGov(simapp.tendermintUrlHttp); const response = await client.gov.params("tallying"); expect(response).toEqual( @@ -191,7 +191,7 @@ describe("GovExtension", () => { it("works for voting", async () => { pendingWithoutSimapp(); - const [client, cometClient] = await makeClientWithGov(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithGov(simapp.tendermintUrlHttp); const response = await client.gov.params("voting"); expect(response).toEqual( @@ -213,7 +213,7 @@ describe("GovExtension", () => { it("works", async () => { pendingWithoutSimapp(); assert(proposalId, "Missing proposal ID"); - const [client, cometClient] = await makeClientWithGov(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithGov(simapp.tendermintUrlHttp); const response = await client.gov.proposals( ProposalStatus.PROPOSAL_STATUS_VOTING_PERIOD, @@ -244,7 +244,7 @@ describe("GovExtension", () => { it("works", async () => { pendingWithoutSimapp(); assert(proposalId, "Missing proposal ID"); - const [client, cometClient] = await makeClientWithGov(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithGov(simapp.tendermintUrlHttp); const response = await client.gov.proposal(proposalId); expect(response.proposal).toEqual({ @@ -271,7 +271,7 @@ describe("GovExtension", () => { it("works", async () => { pendingWithoutSimapp(); assert(proposalId, "Missing proposal ID"); - const [client, cometClient] = await makeClientWithGov(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithGov(simapp.tendermintUrlHttp); const response = await client.gov.deposits(proposalId); expect(response.deposits).toEqual([ @@ -290,7 +290,7 @@ describe("GovExtension", () => { it("works", async () => { pendingWithoutSimapp(); assert(proposalId, "Missing proposal ID"); - const [client, cometClient] = await makeClientWithGov(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithGov(simapp.tendermintUrlHttp); const response = await client.gov.deposit(proposalId, voter1Address); expect(response.deposit).toEqual({ @@ -307,7 +307,7 @@ describe("GovExtension", () => { it("works", async () => { pendingWithoutSimapp(); assert(proposalId, "Missing proposal ID"); - const [client, cometClient] = await makeClientWithGov(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithGov(simapp.tendermintUrlHttp); const response = await client.gov.tally(proposalId); expect(response.tally).toEqual({ @@ -325,7 +325,7 @@ describe("GovExtension", () => { it("works", async () => { pendingWithoutSimapp(); assert(proposalId, "Missing proposal ID"); - const [client, cometClient] = await makeClientWithGov(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithGov(simapp.tendermintUrlHttp); const response = await client.gov.votes(proposalId); @@ -365,7 +365,7 @@ describe("GovExtension", () => { it("works", async () => { pendingWithoutSimapp(); assert(proposalId, "Missing proposal ID"); - const [client, cometClient] = await makeClientWithGov(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithGov(simapp.tendermintUrlHttp); const response = await client.gov.vote(proposalId, voter1Address); expect(response.vote).toEqual( diff --git a/packages/stargate/src/modules/ibc/queries.spec.ts b/packages/stargate/src/modules/ibc/queries.spec.ts index fe50174377..c66919eae3 100644 --- a/packages/stargate/src/modules/ibc/queries.spec.ts +++ b/packages/stargate/src/modules/ibc/queries.spec.ts @@ -15,7 +15,7 @@ describe("IbcExtension", () => { describe("channel", () => { it("works", async () => { pending("We cannot test this easily anymore since the IBC module was removed from simapp"); - const [client, cometClient] = await makeClientWithIbc(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithIbc(simapp.tendermintUrlHttp); const response = await client.ibc.channel.channel(ibcTest.portId, ibcTest.channelId); expect(response.channel).toEqual(ibcTest.channel); @@ -29,7 +29,7 @@ describe("IbcExtension", () => { describe("channels", () => { it("works", async () => { pending("We cannot test this easily anymore since the IBC module was removed from simapp"); - const [client, cometClient] = await makeClientWithIbc(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithIbc(simapp.tendermintUrlHttp); const response = await client.ibc.channel.channels(); expect(response.channels).toEqual([ibcTest.identifiedChannel]); @@ -43,7 +43,7 @@ describe("IbcExtension", () => { describe("allChannels", () => { it("works", async () => { pending("We cannot test this easily anymore since the IBC module was removed from simapp"); - const [client, cometClient] = await makeClientWithIbc(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithIbc(simapp.tendermintUrlHttp); const response = await client.ibc.channel.allChannels(); expect(response.channels).toEqual([ibcTest.identifiedChannel]); @@ -55,7 +55,7 @@ describe("IbcExtension", () => { describe("connectionChannels", () => { it("works", async () => { pending("We cannot test this easily anymore since the IBC module was removed from simapp"); - const [client, cometClient] = await makeClientWithIbc(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithIbc(simapp.tendermintUrlHttp); const response = await client.ibc.channel.connectionChannels(ibcTest.connectionId); expect(response.channels).toEqual([ibcTest.identifiedChannel]); @@ -69,7 +69,7 @@ describe("IbcExtension", () => { describe("allConnectionChannels", () => { it("works", async () => { pending("We cannot test this easily anymore since the IBC module was removed from simapp"); - const [client, cometClient] = await makeClientWithIbc(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithIbc(simapp.tendermintUrlHttp); const response = await client.ibc.channel.allConnectionChannels(ibcTest.connectionId); expect(response.channels).toEqual([ibcTest.identifiedChannel]); @@ -81,7 +81,7 @@ describe("IbcExtension", () => { describe("clientState", () => { it("works", async () => { pending("We cannot test this easily anymore since the IBC module was removed from simapp"); - const [client, cometClient] = await makeClientWithIbc(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithIbc(simapp.tendermintUrlHttp); const response = await client.ibc.channel.clientState(ibcTest.portId, ibcTest.channelId); expect(response.identifiedClientState).toEqual({ @@ -99,7 +99,7 @@ describe("IbcExtension", () => { describe("consensusState", () => { xit("works", async () => { pending("We cannot test this easily anymore since the IBC module was removed from simapp"); - const [client, cometClient] = await makeClientWithIbc(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithIbc(simapp.tendermintUrlHttp); const response = await client.ibc.channel.consensusState( ibcTest.portId, @@ -121,7 +121,7 @@ describe("IbcExtension", () => { describe("packetCommitment", () => { it("works", async () => { pending("We cannot test this easily anymore since the IBC module was removed from simapp"); - const [client, cometClient] = await makeClientWithIbc(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithIbc(simapp.tendermintUrlHttp); const response = await client.ibc.channel.packetCommitment( ibcTest.portId, @@ -139,7 +139,7 @@ describe("IbcExtension", () => { describe("packetCommitments", () => { it("works", async () => { pending("We cannot test this easily anymore since the IBC module was removed from simapp"); - const [client, cometClient] = await makeClientWithIbc(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithIbc(simapp.tendermintUrlHttp); const response = await client.ibc.channel.packetCommitments(ibcTest.portId, ibcTest.channelId); expect(response.commitments).toEqual([ibcTest.packetState]); @@ -153,7 +153,7 @@ describe("IbcExtension", () => { describe("allPacketCommitments", () => { it("works", async () => { pending("We cannot test this easily anymore since the IBC module was removed from simapp"); - const [client, cometClient] = await makeClientWithIbc(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithIbc(simapp.tendermintUrlHttp); const response = await client.ibc.channel.allPacketCommitments(ibcTest.portId, ibcTest.channelId); expect(response.commitments).toEqual([ibcTest.packetState]); @@ -165,7 +165,7 @@ describe("IbcExtension", () => { describe("packetReceipt", () => { it("works", async () => { pending("We cannot test this easily anymore since the IBC module was removed from simapp"); - const [client, cometClient] = await makeClientWithIbc(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithIbc(simapp.tendermintUrlHttp); const response = await client.ibc.channel.packetReceipt(ibcTest.portId, ibcTest.channelId, 1); expect(response.received).toEqual(false); @@ -178,7 +178,7 @@ describe("IbcExtension", () => { it("works", async () => { pending("We don't have an acknowledgement for testing at the moment"); pending("We cannot test this easily anymore since the IBC module was removed from simapp"); - const [client, cometClient] = await makeClientWithIbc(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithIbc(simapp.tendermintUrlHttp); const response = await client.ibc.channel.packetAcknowledgement( ibcTest.portId, @@ -196,7 +196,7 @@ describe("IbcExtension", () => { describe("packetAcknowledgements", () => { it("works", async () => { pending("We cannot test this easily anymore since the IBC module was removed from simapp"); - const [client, cometClient] = await makeClientWithIbc(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithIbc(simapp.tendermintUrlHttp); const response = await client.ibc.channel.packetAcknowledgements(ibcTest.portId, ibcTest.channelId); expect(response.acknowledgements).toEqual(ibcTest.packetAcknowledgements); @@ -210,7 +210,7 @@ describe("IbcExtension", () => { describe("allPacketAcknowledgements", () => { it("works", async () => { pending("We cannot test this easily anymore since the IBC module was removed from simapp"); - const [client, cometClient] = await makeClientWithIbc(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithIbc(simapp.tendermintUrlHttp); const response = await client.ibc.channel.allPacketAcknowledgements( ibcTest.portId, @@ -225,7 +225,7 @@ describe("IbcExtension", () => { describe("unreceivedPackets", () => { it("works", async () => { pending("We cannot test this easily anymore since the IBC module was removed from simapp"); - const [client, cometClient] = await makeClientWithIbc(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithIbc(simapp.tendermintUrlHttp); const response = await client.ibc.channel.unreceivedPackets( ibcTest.portId, @@ -242,7 +242,7 @@ describe("IbcExtension", () => { describe("unreceivedAcks", () => { it("works", async () => { pending("We cannot test this easily anymore since the IBC module was removed from simapp"); - const [client, cometClient] = await makeClientWithIbc(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithIbc(simapp.tendermintUrlHttp); const response = await client.ibc.channel.unreceivedAcks( ibcTest.portId, @@ -259,7 +259,7 @@ describe("IbcExtension", () => { describe("nextSequenceReceive", () => { it("works", async () => { pending("We cannot test this easily anymore since the IBC module was removed from simapp"); - const [client, cometClient] = await makeClientWithIbc(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithIbc(simapp.tendermintUrlHttp); const response = await client.ibc.channel.nextSequenceReceive(ibcTest.portId, ibcTest.channelId); expect(response.nextSequenceReceive).toEqual(BigInt(1)); @@ -275,7 +275,7 @@ describe("IbcExtension", () => { describe("state", () => { it("works", async () => { pending("We cannot test this easily anymore since the IBC module was removed from simapp"); - const [client, cometClient] = await makeClientWithIbc(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithIbc(simapp.tendermintUrlHttp); const response = await client.ibc.client.state(ibcTest.clientId); expect(response.clientState).toEqual({ @@ -290,7 +290,7 @@ describe("IbcExtension", () => { describe("states", () => { it("works", async () => { pending("We cannot test this easily anymore since the IBC module was removed from simapp"); - const [client, cometClient] = await makeClientWithIbc(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithIbc(simapp.tendermintUrlHttp); const response = await client.ibc.client.states(); expect(response.clientStates).toEqual([ @@ -311,7 +311,7 @@ describe("IbcExtension", () => { describe("allStates", () => { it("works", async () => { pending("We cannot test this easily anymore since the IBC module was removed from simapp"); - const [client, cometClient] = await makeClientWithIbc(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithIbc(simapp.tendermintUrlHttp); const response = await client.ibc.client.allStates(); expect(response.clientStates).toEqual([ @@ -331,7 +331,7 @@ describe("IbcExtension", () => { describe("consensusState", () => { it("works", async () => { pending("We cannot test this easily anymore since the IBC module was removed from simapp"); - const [client, cometClient] = await makeClientWithIbc(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithIbc(simapp.tendermintUrlHttp); const response = await client.ibc.client.consensusState(ibcTest.clientId); expect(response.consensusState).toEqual({ @@ -346,7 +346,7 @@ describe("IbcExtension", () => { describe("consensusStates", () => { it("works", async () => { pending("We cannot test this easily anymore since the IBC module was removed from simapp"); - const [client, cometClient] = await makeClientWithIbc(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithIbc(simapp.tendermintUrlHttp); const response = await client.ibc.client.consensusStates(ibcTest.clientId); expect(response.consensusStates).toEqual( @@ -368,7 +368,7 @@ describe("IbcExtension", () => { describe("allConsensusStates", () => { it("works", async () => { pending("We cannot test this easily anymore since the IBC module was removed from simapp"); - const [client, cometClient] = await makeClientWithIbc(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithIbc(simapp.tendermintUrlHttp); const response = await client.ibc.client.allConsensusStates(ibcTest.clientId); expect(response.consensusStates).toEqual( @@ -390,7 +390,7 @@ describe("IbcExtension", () => { describe("params", () => { it("works", async () => { pending("We cannot test this easily anymore since the IBC module was removed from simapp"); - const [client, cometClient] = await makeClientWithIbc(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithIbc(simapp.tendermintUrlHttp); const response = await client.ibc.client.params(); expect(response.params).toEqual({ @@ -404,7 +404,7 @@ describe("IbcExtension", () => { describe("stateTm", () => { it("works", async () => { pending("We cannot test this easily anymore since the IBC module was removed from simapp"); - const [client, cometClient] = await makeClientWithIbc(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithIbc(simapp.tendermintUrlHttp); const response = await client.ibc.client.stateTm(ibcTest.clientId); expect(response.chainId).toEqual("ibc-1"); @@ -417,7 +417,7 @@ describe("IbcExtension", () => { describe("statesTm", () => { it("works", async () => { pending("We cannot test this easily anymore since the IBC module was removed from simapp"); - const [client, cometClient] = await makeClientWithIbc(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithIbc(simapp.tendermintUrlHttp); const response = await client.ibc.client.statesTm(); expect(response).toEqual( @@ -435,7 +435,7 @@ describe("IbcExtension", () => { describe("allStatesTm", () => { it("works", async () => { pending("We cannot test this easily anymore since the IBC module was removed from simapp"); - const [client, cometClient] = await makeClientWithIbc(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithIbc(simapp.tendermintUrlHttp); const response = await client.ibc.client.allStatesTm(); expect(response).toEqual( @@ -453,7 +453,7 @@ describe("IbcExtension", () => { describe("consensusStateTm", () => { it("works", async () => { pending("We cannot test this easily anymore since the IBC module was removed from simapp"); - const [client, cometClient] = await makeClientWithIbc(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithIbc(simapp.tendermintUrlHttp); const response = await client.ibc.client.consensusStateTm(ibcTest.clientId); expect(response.nextValidatorsHash).toEqual(jasmine.any(Uint8Array)); @@ -468,7 +468,7 @@ describe("IbcExtension", () => { describe("connection", () => { it("works", async () => { pending("We cannot test this easily anymore since the IBC module was removed from simapp"); - const [client, cometClient] = await makeClientWithIbc(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithIbc(simapp.tendermintUrlHttp); const response = await client.ibc.connection.connection(ibcTest.connectionId); expect(response.connection).toEqual(ibcTest.connection); @@ -482,7 +482,7 @@ describe("IbcExtension", () => { describe("connections", () => { it("works", async () => { pending("We cannot test this easily anymore since the IBC module was removed from simapp"); - const [client, cometClient] = await makeClientWithIbc(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithIbc(simapp.tendermintUrlHttp); const response = await client.ibc.connection.connections(); expect(response.connections).toEqual([ibcTest.identifiedConnection]); @@ -496,7 +496,7 @@ describe("IbcExtension", () => { describe("allConnections", () => { it("works", async () => { pending("We cannot test this easily anymore since the IBC module was removed from simapp"); - const [client, cometClient] = await makeClientWithIbc(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithIbc(simapp.tendermintUrlHttp); const response = await client.ibc.connection.allConnections(); expect(response.connections).toEqual([ibcTest.identifiedConnection]); @@ -508,7 +508,7 @@ describe("IbcExtension", () => { describe("clientConnections", () => { it("works", async () => { pending("We cannot test this easily anymore since the IBC module was removed from simapp"); - const [client, cometClient] = await makeClientWithIbc(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithIbc(simapp.tendermintUrlHttp); const response = await client.ibc.connection.clientConnections(ibcTest.clientId); expect(response.connectionPaths).toEqual([ibcTest.connectionId]); @@ -522,7 +522,7 @@ describe("IbcExtension", () => { describe("clientState", () => { it("works", async () => { pending("We cannot test this easily anymore since the IBC module was removed from simapp"); - const [client, cometClient] = await makeClientWithIbc(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithIbc(simapp.tendermintUrlHttp); const response = await client.ibc.connection.clientState(ibcTest.connectionId); expect(response.identifiedClientState).toEqual({ @@ -540,7 +540,7 @@ describe("IbcExtension", () => { describe("consensusState", () => { xit("works", async () => { pending("We cannot test this easily anymore since the IBC module was removed from simapp"); - const [client, cometClient] = await makeClientWithIbc(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithIbc(simapp.tendermintUrlHttp); // TODO: Find valid values const response = await client.ibc.connection.consensusState(ibcTest.connectionId, 1, 1); diff --git a/packages/stargate/src/modules/mint/queries.spec.ts b/packages/stargate/src/modules/mint/queries.spec.ts index 43c1ebbc05..c1c444da24 100644 --- a/packages/stargate/src/modules/mint/queries.spec.ts +++ b/packages/stargate/src/modules/mint/queries.spec.ts @@ -13,7 +13,7 @@ describe("MintExtension", () => { describe("params", () => { it("works", async () => { pendingWithoutSimapp(); - const [client, cometClient] = await makeClientWithMint(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithMint(simapp.tendermintUrlHttp); const params = await client.mint.params(); expect(Number(params.blocksPerYear)).toBeGreaterThan(100_000); @@ -31,7 +31,7 @@ describe("MintExtension", () => { describe("inflation", () => { it("works", async () => { pendingWithoutSimapp(); - const [client, cometClient] = await makeClientWithMint(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithMint(simapp.tendermintUrlHttp); const inflation = await client.mint.inflation(); expect(inflation.toFloatApproximation()).toBeGreaterThan(0.13); @@ -44,7 +44,7 @@ describe("MintExtension", () => { describe("annualProvisions", () => { it("works", async () => { pendingWithoutSimapp(); - const [client, cometClient] = await makeClientWithMint(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithMint(simapp.tendermintUrlHttp); const annualProvisions = await client.mint.annualProvisions(); expect(annualProvisions.toFloatApproximation()).toBeGreaterThan(5_400_000_000); diff --git a/packages/stargate/src/modules/slashing/queries.spec.ts b/packages/stargate/src/modules/slashing/queries.spec.ts index c2575db524..b17ec17ed7 100644 --- a/packages/stargate/src/modules/slashing/queries.spec.ts +++ b/packages/stargate/src/modules/slashing/queries.spec.ts @@ -16,7 +16,7 @@ describe("SlashingExtension", () => { describe("signingInfos", () => { it("works", async () => { pendingWithoutSimapp(); - const [client, cometClient] = await makeClientWithSlashing(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithSlashing(simapp.tendermintUrlHttp); const response = await client.slashing.signingInfos(); expect(response.info).toBeDefined(); @@ -29,7 +29,7 @@ describe("SlashingExtension", () => { describe("params", () => { it("works", async () => { pendingWithoutSimapp(); - const [client, cometClient] = await makeClientWithSlashing(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithSlashing(simapp.tendermintUrlHttp); const response = await client.slashing.params(); expect(response.params).toBeDefined(); diff --git a/packages/stargate/src/modules/staking/messages.spec.ts b/packages/stargate/src/modules/staking/messages.spec.ts index 85f5d1ec8b..1fe96c8569 100644 --- a/packages/stargate/src/modules/staking/messages.spec.ts +++ b/packages/stargate/src/modules/staking/messages.spec.ts @@ -24,7 +24,7 @@ async function sendFeeAndStakingTokens(address: string): Promise { const wallet = await DirectSecp256k1HdWallet.fromMnemonic(faucet.mnemonic); const [firstAccount] = await wallet.getAccounts(); const client = await SigningStargateClient.connectWithSigner( - simapp.tendermintUrl, + simapp.tendermintUrlHttp, wallet, defaultSigningClientOptions, ); @@ -53,7 +53,7 @@ describe("staking messages", () => { await sendFeeAndStakingTokens(valAccount.address); const client = await SigningStargateClient.connectWithSigner( - simapp.tendermintUrl, + simapp.tendermintUrlHttp, valWallet, defaultSigningClientOptions, ); @@ -104,7 +104,7 @@ describe("staking messages", () => { await sendFeeAndStakingTokens(valAccount.address); const client = await SigningStargateClient.connectWithSigner( - simapp.tendermintUrl, + simapp.tendermintUrlHttp, valWallet, defaultSigningClientOptions, ); @@ -156,7 +156,7 @@ describe("staking messages", () => { await sendFeeAndStakingTokens(valAccount.address); const client = await SigningStargateClient.connectWithSigner( - simapp.tendermintUrl, + simapp.tendermintUrlHttp, valWallet, defaultSigningClientOptions, ); @@ -245,7 +245,7 @@ describe("staking messages", () => { await sendFeeAndStakingTokens(valAccount.address); const client = await SigningStargateClient.connectWithSigner( - simapp.tendermintUrl, + simapp.tendermintUrlHttp, valWallet, defaultSigningClientOptions, ); diff --git a/packages/stargate/src/modules/staking/queries.spec.ts b/packages/stargate/src/modules/staking/queries.spec.ts index a8d989d8da..794d579c3f 100644 --- a/packages/stargate/src/modules/staking/queries.spec.ts +++ b/packages/stargate/src/modules/staking/queries.spec.ts @@ -33,7 +33,7 @@ describe("StakingExtension", () => { if (simappEnabled()) { const wallet = await DirectSecp256k1HdWallet.fromMnemonic(faucet.mnemonic); const client = await SigningStargateClient.connectWithSigner( - simapp.tendermintUrl, + simapp.tendermintUrlHttp, wallet, defaultSigningClientOptions, ); @@ -74,7 +74,7 @@ describe("StakingExtension", () => { describe("delegation", () => { it("works", async () => { pendingWithoutSimapp(); - const [client, cometClient] = await makeClientWithStaking(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithStaking(simapp.tendermintUrlHttp); const response = await client.staking.delegation(faucet.address0, validator.validatorAddress); expect(response.delegationResponse).toBeDefined(); @@ -87,7 +87,7 @@ describe("StakingExtension", () => { describe("delegatorDelegations", () => { it("works", async () => { pendingWithoutSimapp(); - const [client, cometClient] = await makeClientWithStaking(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithStaking(simapp.tendermintUrlHttp); const response = await client.staking.delegatorDelegations(faucet.address0); expect(response.delegationResponses).toBeDefined(); @@ -100,7 +100,7 @@ describe("StakingExtension", () => { describe("delegatorUnbondingDelegations", () => { it("works", async () => { pendingWithoutSimapp(); - const [client, cometClient] = await makeClientWithStaking(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithStaking(simapp.tendermintUrlHttp); const response = await client.staking.delegatorUnbondingDelegations(faucet.address0); expect(response.unbondingResponses).toBeDefined(); @@ -113,7 +113,7 @@ describe("StakingExtension", () => { describe("delegatorValidator", () => { it("works", async () => { pendingWithoutSimapp(); - const [client, cometClient] = await makeClientWithStaking(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithStaking(simapp.tendermintUrlHttp); const response = await client.staking.delegatorValidator(faucet.address0, validator.validatorAddress); expect(response.validator).toBeDefined(); @@ -126,7 +126,7 @@ describe("StakingExtension", () => { describe("delegatorValidators", () => { it("works", async () => { pendingWithoutSimapp(); - const [client, cometClient] = await makeClientWithStaking(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithStaking(simapp.tendermintUrlHttp); const response = await client.staking.delegatorValidators(faucet.address0); expect(response.validators).toBeDefined(); @@ -139,7 +139,7 @@ describe("StakingExtension", () => { describe("historicalInfo", () => { it("works", async () => { pendingWithoutSimapp(); - const [client, cometClient] = await makeClientWithStaking(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithStaking(simapp.tendermintUrlHttp); const response = await client.staking.historicalInfo(5); expect(response.hist).toBeDefined(); @@ -152,7 +152,7 @@ describe("StakingExtension", () => { describe("params", () => { it("works", async () => { pendingWithoutSimapp(); - const [client, cometClient] = await makeClientWithStaking(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithStaking(simapp.tendermintUrlHttp); const response = await client.staking.params(); expect(response.params).toBeDefined(); @@ -165,7 +165,7 @@ describe("StakingExtension", () => { describe("pool", () => { it("works", async () => { pendingWithoutSimapp(); - const [client, cometClient] = await makeClientWithStaking(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithStaking(simapp.tendermintUrlHttp); const response = await client.staking.pool(); expect(response.pool).toBeDefined(); @@ -179,7 +179,7 @@ describe("StakingExtension", () => { it("works", async () => { // TODO: Set up a result for this test pendingWithoutSimapp(); - const [client, cometClient] = await makeClientWithStaking(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithStaking(simapp.tendermintUrlHttp); await expectAsync( client.staking.redelegations(faucet.address0, validator.validatorAddress, validator.validatorAddress), @@ -192,7 +192,7 @@ describe("StakingExtension", () => { describe("unbondingDelegation", () => { it("works", async () => { pendingWithoutSimapp(); - const [client, cometClient] = await makeClientWithStaking(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithStaking(simapp.tendermintUrlHttp); const response = await client.staking.unbondingDelegation(faucet.address0, validator.validatorAddress); expect(response.unbond).toBeDefined(); @@ -205,7 +205,7 @@ describe("StakingExtension", () => { describe("validator", () => { it("works", async () => { pendingWithoutSimapp(); - const [client, cometClient] = await makeClientWithStaking(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithStaking(simapp.tendermintUrlHttp); const response = await client.staking.validator(validator.validatorAddress); expect(response.validator).toBeDefined(); @@ -218,7 +218,7 @@ describe("StakingExtension", () => { describe("validatorDelegations", () => { it("works", async () => { pendingWithoutSimapp(); - const [client, cometClient] = await makeClientWithStaking(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithStaking(simapp.tendermintUrlHttp); const response = await client.staking.validatorDelegations(validator.validatorAddress); expect(response.delegationResponses.length).toBeGreaterThanOrEqual(2); @@ -240,7 +240,7 @@ describe("StakingExtension", () => { describe("validators", () => { it("works", async () => { pendingWithoutSimapp(); - const [client, cometClient] = await makeClientWithStaking(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithStaking(simapp.tendermintUrlHttp); const response = await client.staking.validators("BOND_STATUS_BONDED"); expect(response.validators).toBeDefined(); @@ -253,7 +253,7 @@ describe("StakingExtension", () => { describe("validatorUnbondingDelegations", () => { it("works", async () => { pendingWithoutSimapp(); - const [client, cometClient] = await makeClientWithStaking(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithStaking(simapp.tendermintUrlHttp); const response = await client.staking.validatorUnbondingDelegations(validator.validatorAddress); expect(response.unbondingResponses).toBeDefined(); diff --git a/packages/stargate/src/modules/tx/queries.spec.ts b/packages/stargate/src/modules/tx/queries.spec.ts index 73f0752ef8..1883f46aef 100644 --- a/packages/stargate/src/modules/tx/queries.spec.ts +++ b/packages/stargate/src/modules/tx/queries.spec.ts @@ -35,7 +35,7 @@ describe("TxExtension", () => { if (simappEnabled()) { const wallet = await DirectSecp256k1HdWallet.fromMnemonic(faucet.mnemonic); const client = await SigningStargateClient.connectWithSigner( - simapp.tendermintUrl, + simapp.tendermintUrlHttp, wallet, defaultSigningClientOptions, ); @@ -63,7 +63,7 @@ describe("TxExtension", () => { pendingWithoutSimapp(); assertDefined(txHash); assertDefined(memo); - const [client, cometClient] = await makeClientWithTx(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithTx(simapp.tendermintUrlHttp); const response = await client.tx.getTx(txHash); expect(response.tx?.body?.memo).toEqual(memo); @@ -77,8 +77,8 @@ describe("TxExtension", () => { pendingWithoutSimapp(); assertDefined(txHash); assertDefined(memo); - const [client, cometClient] = await makeClientWithTx(simapp.tendermintUrl); - const sequenceClient = await StargateClient.connect(simapp.tendermintUrl); + const [client, cometClient] = await makeClientWithTx(simapp.tendermintUrlHttp); + const sequenceClient = await StargateClient.connect(simapp.tendermintUrlHttp); const registry = new Registry(defaultRegistryTypes); const msg: MsgDelegate = { diff --git a/packages/stargate/src/modules/vesting/messages.spec.ts b/packages/stargate/src/modules/vesting/messages.spec.ts index 4fe0cfe21d..64649fef58 100644 --- a/packages/stargate/src/modules/vesting/messages.spec.ts +++ b/packages/stargate/src/modules/vesting/messages.spec.ts @@ -19,7 +19,7 @@ describe("vesting messages", () => { pendingWithoutSimapp(); const wallet = await DirectSecp256k1HdWallet.fromMnemonic(faucet.mnemonic); const client = await SigningStargateClient.connectWithSigner( - simapp.tendermintUrl, + simapp.tendermintUrlHttp, wallet, defaultSigningClientOptions, ); @@ -49,7 +49,7 @@ describe("vesting messages", () => { pendingWithoutSimapp46OrHigher(); // Amino JSON broken on chain before Cosmos SDK 0.46 const wallet = await Secp256k1HdWallet.fromMnemonic(faucet.mnemonic); const client = await SigningStargateClient.connectWithSigner( - simapp.tendermintUrl, + simapp.tendermintUrlHttp, wallet, defaultSigningClientOptions, ); diff --git a/packages/stargate/src/multisignature.spec.ts b/packages/stargate/src/multisignature.spec.ts index 1609e2ec92..c025b4a10e 100644 --- a/packages/stargate/src/multisignature.spec.ts +++ b/packages/stargate/src/multisignature.spec.ts @@ -176,7 +176,7 @@ describe("multisignature", () => { // On the composer's machine signing instructions are created. // The composer does not need to be one of the signers. const signingInstruction = await (async () => { - const client = await StargateClient.connect(simapp.tendermintUrl); + const client = await StargateClient.connect(simapp.tendermintUrlHttp); const accountOnChain = await client.getAccount(multisigAccountAddress); assert(accountOnChain, "Account does not exist on chain"); @@ -251,7 +251,7 @@ describe("multisignature", () => { const address3 = pubkeyToAddress(pubkey3, "cosmos"); const address4 = pubkeyToAddress(pubkey4, "cosmos"); - const broadcaster = await StargateClient.connect(simapp.tendermintUrl); + const broadcaster = await StargateClient.connect(simapp.tendermintUrlHttp); const signedTx = makeMultisignedTxBytes( multisigPubkey, signingInstruction.sequence, diff --git a/packages/stargate/src/signingstargateclient.spec.ts b/packages/stargate/src/signingstargateclient.spec.ts index c8d57cf308..6895f20131 100644 --- a/packages/stargate/src/signingstargateclient.spec.ts +++ b/packages/stargate/src/signingstargateclient.spec.ts @@ -56,7 +56,7 @@ describe("SigningStargateClient", () => { const registry = new Registry(); registry.register("/custom.MsgCustom", MsgSend); const options: SigningStargateClientOptions = { ...defaultSigningClientOptions, registry: registry }; - const client = await SigningStargateClient.connectWithSigner(simapp.tendermintUrl, wallet, options); + const client = await SigningStargateClient.connectWithSigner(simapp.tendermintUrlHttp, wallet, options); const openedClient = client as unknown as PrivateSigningStargateClient; expect(openedClient.registry.lookupType("/custom.MsgCustom")).toEqual(MsgSend); }); @@ -67,7 +67,7 @@ describe("SigningStargateClient", () => { pendingWithoutSimapp(); const wallet = await DirectSecp256k1HdWallet.fromMnemonic(faucet.mnemonic); const client = await SigningStargateClient.connectWithSigner( - simapp.tendermintUrl, + simapp.tendermintUrlHttp, wallet, defaultSigningClientOptions, ); @@ -95,7 +95,7 @@ describe("SigningStargateClient", () => { pendingWithoutSimapp(); const wallet = await DirectSecp256k1HdWallet.fromMnemonic(faucet.mnemonic); const client = await SigningStargateClient.connectWithSigner( - simapp.tendermintUrl, + simapp.tendermintUrlHttp, wallet, defaultSigningClientOptions, ); @@ -136,7 +136,7 @@ describe("SigningStargateClient", () => { pendingWithoutSimapp(); const wallet = await Secp256k1HdWallet.fromMnemonic(faucet.mnemonic); const client = await SigningStargateClient.connectWithSigner( - simapp.tendermintUrl, + simapp.tendermintUrlHttp, wallet, defaultSigningClientOptions, ); @@ -180,12 +180,12 @@ describe("SigningStargateClient", () => { }); const [{ address: signer }, { address: payer }] = await wallet.getAccounts(); const client = await SigningStargateClient.connectWithSigner( - simapp.tendermintUrl, + simapp.tendermintUrlHttp, wallet, defaultSigningClientOptions, ); - const cometClient = await Tendermint34Client.connect(simapp.tendermintUrl); + const cometClient = await Tendermint34Client.connect(simapp.tendermintUrlHttp); const queryClient = QueryClient.withExtensions(cometClient, setupFeegrantExtension); let allowanceExists: boolean; try { @@ -254,7 +254,7 @@ describe("SigningStargateClient", () => { pending("We cannot test this easily anymore since the IBC module was removed from simapp"); const wallet = await DirectSecp256k1HdWallet.fromMnemonic(faucet.mnemonic); const client = await SigningStargateClient.connectWithSigner( - simapp.tendermintUrl, + simapp.tendermintUrlHttp, wallet, defaultSigningClientOptions, ); @@ -303,7 +303,7 @@ describe("SigningStargateClient", () => { pending("We cannot test this easily anymore since the IBC module was removed from simapp"); const wallet = await Secp256k1HdWallet.fromMnemonic(faucet.mnemonic); const client = await SigningStargateClient.connectWithSigner( - simapp.tendermintUrl, + simapp.tendermintUrlHttp, wallet, defaultSigningClientOptions, ); @@ -355,7 +355,7 @@ describe("SigningStargateClient", () => { pendingWithoutSimapp(); const wallet = await DirectSecp256k1HdWallet.fromMnemonic(faucet.mnemonic); const client = await SigningStargateClient.connectWithSigner( - simapp.tendermintUrl, + simapp.tendermintUrlHttp, wallet, defaultSigningClientOptions, ); @@ -386,7 +386,7 @@ describe("SigningStargateClient", () => { pendingWithoutSimapp(); const wallet = await DirectSecp256k1HdWallet.fromMnemonic(faucet.mnemonic); const client = await SigningStargateClient.connectWithSigner( - simapp.tendermintUrl, + simapp.tendermintUrlHttp, wallet, defaultSigningClientOptions, ); @@ -415,7 +415,7 @@ describe("SigningStargateClient", () => { it("works with auto gas", async () => { pendingWithoutSimapp(); const wallet = await DirectSecp256k1HdWallet.fromMnemonic(faucet.mnemonic); - const client = await SigningStargateClient.connectWithSigner(simapp.tendermintUrl, wallet, { + const client = await SigningStargateClient.connectWithSigner(simapp.tendermintUrlHttp, wallet, { ...defaultSigningClientOptions, gasPrice: defaultGasPrice, }); @@ -437,7 +437,7 @@ describe("SigningStargateClient", () => { pendingWithoutSimapp(); const wallet = await ModifyingDirectSecp256k1HdWallet.fromMnemonic(faucet.mnemonic); const client = await SigningStargateClient.connectWithSigner( - simapp.tendermintUrl, + simapp.tendermintUrlHttp, wallet, defaultSigningClientOptions, ); @@ -476,7 +476,7 @@ describe("SigningStargateClient", () => { pendingWithoutSimapp(); const wallet = await Secp256k1HdWallet.fromMnemonic(faucet.mnemonic); const client = await SigningStargateClient.connectWithSigner( - simapp.tendermintUrl, + simapp.tendermintUrlHttp, wallet, defaultSigningClientOptions, ); @@ -503,7 +503,7 @@ describe("SigningStargateClient", () => { pendingWithoutSimapp(); const wallet = await Secp256k1HdWallet.fromMnemonic(faucet.mnemonic); const client = await SigningStargateClient.connectWithSigner( - simapp.tendermintUrl, + simapp.tendermintUrlHttp, wallet, defaultSigningClientOptions, ); @@ -530,7 +530,7 @@ describe("SigningStargateClient", () => { pendingWithoutSimapp(); const wallet = await Secp256k1HdWallet.fromMnemonic(faucet.mnemonic); const client = await SigningStargateClient.connectWithSigner( - simapp.tendermintUrl, + simapp.tendermintUrlHttp, wallet, defaultSigningClientOptions, ); @@ -641,7 +641,11 @@ describe("SigningStargateClient", () => { registry: customRegistry, aminoTypes: customAminoTypes, }; - const client = await SigningStargateClient.connectWithSigner(simapp.tendermintUrl, wallet, options); + const client = await SigningStargateClient.connectWithSigner( + simapp.tendermintUrlHttp, + wallet, + options, + ); const msg: CustomMsgDelegate = { customDelegatorAddress: faucet.address0, @@ -665,7 +669,7 @@ describe("SigningStargateClient", () => { pendingWithoutSimapp(); const wallet = await ModifyingSecp256k1HdWallet.fromMnemonic(faucet.mnemonic); const client = await SigningStargateClient.connectWithSigner( - simapp.tendermintUrl, + simapp.tendermintUrlHttp, wallet, defaultSigningClientOptions, ); @@ -706,7 +710,7 @@ describe("SigningStargateClient", () => { pendingWithoutSimapp(); const wallet = await DirectSecp256k1HdWallet.fromMnemonic(faucet.mnemonic); const client = await SigningStargateClient.connectWithSigner( - simapp.tendermintUrl, + simapp.tendermintUrlHttp, wallet, defaultSigningClientOptions, ); @@ -736,7 +740,7 @@ describe("SigningStargateClient", () => { it("works with auto gas", async () => { pendingWithoutSimapp(); const wallet = await DirectSecp256k1HdWallet.fromMnemonic(faucet.mnemonic); - const client = await SigningStargateClient.connectWithSigner(simapp.tendermintUrl, wallet, { + const client = await SigningStargateClient.connectWithSigner(simapp.tendermintUrlHttp, wallet, { ...defaultSigningClientOptions, gasPrice: defaultGasPrice, }); @@ -762,7 +766,7 @@ describe("SigningStargateClient", () => { pendingWithoutSimapp(); const wallet = await ModifyingDirectSecp256k1HdWallet.fromMnemonic(faucet.mnemonic); const client = await SigningStargateClient.connectWithSigner( - simapp.tendermintUrl, + simapp.tendermintUrlHttp, wallet, defaultSigningClientOptions, ); @@ -796,7 +800,7 @@ describe("SigningStargateClient", () => { pendingWithoutSimapp(); const wallet = await Secp256k1HdWallet.fromMnemonic(faucet.mnemonic); const client = await SigningStargateClient.connectWithSigner( - simapp.tendermintUrl, + simapp.tendermintUrlHttp, wallet, defaultSigningClientOptions, ); @@ -826,7 +830,7 @@ describe("SigningStargateClient", () => { pendingWithoutSimapp(); const wallet = await Secp256k1HdWallet.fromMnemonic(faucet.mnemonic); const client = await SigningStargateClient.connectWithSigner( - simapp.tendermintUrl, + simapp.tendermintUrlHttp, wallet, defaultSigningClientOptions, ); @@ -860,7 +864,7 @@ describe("SigningStargateClient", () => { pendingWithoutSimapp(); const wallet = await DirectSecp256k1HdWallet.fromMnemonic(faucet.mnemonic); const client = await SigningStargateClient.connectWithSigner( - simapp.tendermintUrl, + simapp.tendermintUrlHttp, wallet, defaultSigningClientOptions, ); @@ -890,7 +894,7 @@ describe("SigningStargateClient", () => { pendingWithoutSimapp(); const wallet = await ModifyingDirectSecp256k1HdWallet.fromMnemonic(faucet.mnemonic); const client = await SigningStargateClient.connectWithSigner( - simapp.tendermintUrl, + simapp.tendermintUrlHttp, wallet, defaultSigningClientOptions, ); @@ -927,7 +931,7 @@ describe("SigningStargateClient", () => { pendingWithoutSimapp(); const wallet = await DirectSecp256k1HdWallet.fromMnemonic(faucet.mnemonic); const client = await SigningStargateClient.connectWithSigner( - simapp.tendermintUrl, + simapp.tendermintUrlHttp, wallet, defaultSigningClientOptions, ); @@ -958,7 +962,7 @@ describe("SigningStargateClient", () => { pendingWithoutSimapp(); const wallet = await DirectSecp256k1HdWallet.fromMnemonic(faucet.mnemonic); const client = await SigningStargateClient.connectWithSigner( - simapp.tendermintUrl, + simapp.tendermintUrlHttp, wallet, defaultSigningClientOptions, ); @@ -997,7 +1001,7 @@ describe("SigningStargateClient", () => { pendingWithoutSimapp(); const wallet = await Secp256k1HdWallet.fromMnemonic(faucet.mnemonic); const client = await SigningStargateClient.connectWithSigner( - simapp.tendermintUrl, + simapp.tendermintUrlHttp, wallet, defaultSigningClientOptions, ); @@ -1027,7 +1031,7 @@ describe("SigningStargateClient", () => { pendingWithoutSimapp(); const wallet = await Secp256k1HdWallet.fromMnemonic(faucet.mnemonic); const client = await SigningStargateClient.connectWithSigner( - simapp.tendermintUrl, + simapp.tendermintUrlHttp, wallet, defaultSigningClientOptions, ); @@ -1141,7 +1145,11 @@ describe("SigningStargateClient", () => { registry: customRegistry, aminoTypes: customAminoTypes, }; - const client = await SigningStargateClient.connectWithSigner(simapp.tendermintUrl, wallet, options); + const client = await SigningStargateClient.connectWithSigner( + simapp.tendermintUrlHttp, + wallet, + options, + ); const msg: CustomMsgDelegate = { customDelegatorAddress: faucet.address0, @@ -1168,7 +1176,7 @@ describe("SigningStargateClient", () => { pendingWithoutSimapp(); const wallet = await ModifyingSecp256k1HdWallet.fromMnemonic(faucet.mnemonic); const client = await SigningStargateClient.connectWithSigner( - simapp.tendermintUrl, + simapp.tendermintUrlHttp, wallet, defaultSigningClientOptions, ); @@ -1205,7 +1213,7 @@ describe("SigningStargateClient", () => { pendingWithoutSimapp(); const wallet = await Secp256k1HdWallet.fromMnemonic(faucet.mnemonic); const client = await SigningStargateClient.connectWithSigner( - simapp.tendermintUrl, + simapp.tendermintUrlHttp, wallet, defaultSigningClientOptions, ); @@ -1236,7 +1244,7 @@ describe("SigningStargateClient", () => { pendingWithoutSimapp(); const wallet = await Secp256k1HdWallet.fromMnemonic(faucet.mnemonic); const client = await SigningStargateClient.connectWithSigner( - simapp.tendermintUrl, + simapp.tendermintUrlHttp, wallet, defaultSigningClientOptions, ); diff --git a/packages/stargate/src/stargateclient.searchtx.spec.ts b/packages/stargate/src/stargateclient.searchtx.spec.ts index 57803107ac..239739dbd3 100644 --- a/packages/stargate/src/stargateclient.searchtx.spec.ts +++ b/packages/stargate/src/stargateclient.searchtx.spec.ts @@ -109,7 +109,7 @@ describe("StargateClient.getTx and .searchTx", () => { beforeAll(async () => { if (simappEnabled()) { const wallet = await DirectSecp256k1HdWallet.fromMnemonic(faucet.mnemonic); - const client = await StargateClient.connect(simapp.tendermintUrl); + const client = await StargateClient.connect(simapp.tendermintUrlHttp); const unsuccessfulRecipient = makeRandomAddress(); const successfulRecipient = makeRandomAddress(); @@ -156,7 +156,7 @@ describe("StargateClient.getTx and .searchTx", () => { it("can get successful tx by ID", async () => { pendingWithoutSimapp(); assert(sendSuccessful, "value must be set in beforeAll()"); - const client = await StargateClient.connect(simapp.tendermintUrl); + const client = await StargateClient.connect(simapp.tendermintUrlHttp); const result = await client.getTx(sendSuccessful.hash); assert(result); expect(result).toEqual( @@ -180,7 +180,7 @@ describe("StargateClient.getTx and .searchTx", () => { it("can get unsuccessful tx by ID", async () => { pendingWithoutSimapp(); assert(sendUnsuccessful, "value must be set in beforeAll()"); - const client = await StargateClient.connect(simapp.tendermintUrl); + const client = await StargateClient.connect(simapp.tendermintUrlHttp); const result = await client.getTx(sendUnsuccessful.hash); assert(result); expect(result).toEqual( @@ -201,7 +201,7 @@ describe("StargateClient.getTx and .searchTx", () => { it("can get by ID (non existent)", async () => { pendingWithoutSimapp(); - const client = await StargateClient.connect(simapp.tendermintUrl); + const client = await StargateClient.connect(simapp.tendermintUrlHttp); const nonExistentId = "0000000000000000000000000000000000000000000000000000000000000000"; const result = await client.getTx(nonExistentId); expect(result).toBeNull(); @@ -212,7 +212,7 @@ describe("StargateClient.getTx and .searchTx", () => { it("can search successful tx by height", async () => { pendingWithoutSimapp(); assert(sendSuccessful, "value must be set in beforeAll()"); - const client = await StargateClient.connect(simapp.tendermintUrl); + const client = await StargateClient.connect(simapp.tendermintUrlHttp); const result = await client.searchTx(`tx.height=${sendSuccessful.height}`); expect(result.length).toBeGreaterThanOrEqual(1); expect(result).toContain( @@ -236,7 +236,7 @@ describe("StargateClient.getTx and .searchTx", () => { it("can search unsuccessful tx by height", async () => { pendingWithoutSimapp(); assert(sendUnsuccessful, "value must be set in beforeAll()"); - const client = await StargateClient.connect(simapp.tendermintUrl); + const client = await StargateClient.connect(simapp.tendermintUrlHttp); const result = await client.searchTx(`tx.height=${sendUnsuccessful.height}`); expect(result.length).toBeGreaterThanOrEqual(1); expect(result).toContain( @@ -252,7 +252,7 @@ describe("StargateClient.getTx and .searchTx", () => { it("can search by sender", async () => { pendingWithoutSimapp(); assert(sendSuccessful, "value must be set in beforeAll()"); - const client = await StargateClient.connect(simapp.tendermintUrl); + const client = await StargateClient.connect(simapp.tendermintUrlHttp); // Since Cosmos SDK 0.47 we can only combine attributes of a single event const query = `message.action = '/cosmos.bank.v1beta1.MsgSend' AND message.sender = '${sendSuccessful.sender}'`; const results = await client.searchTx(query); @@ -282,7 +282,7 @@ describe("StargateClient.getTx and .searchTx", () => { it("can search by recipient", async () => { pendingWithoutSimapp(); assert(sendSuccessful, "value must be set in beforeAll()"); - const client = await StargateClient.connect(simapp.tendermintUrl); + const client = await StargateClient.connect(simapp.tendermintUrlHttp); const results = await client.searchTx(`transfer.recipient='${sendSuccessful.recipient}'`); expect(results.length).toBeGreaterThanOrEqual(1); @@ -310,7 +310,7 @@ describe("StargateClient.getTx and .searchTx", () => { it("works with tags", async () => { pendingWithoutSimapp(); assert(sendSuccessful, "value must be set in beforeAll()"); - const client = await StargateClient.connect(simapp.tendermintUrl); + const client = await StargateClient.connect(simapp.tendermintUrlHttp); const results = await client.searchTx([{ key: "transfer.recipient", value: sendSuccessful.recipient }]); expect(results.length).toBeGreaterThanOrEqual(1); diff --git a/packages/stargate/src/stargateclient.spec.ts b/packages/stargate/src/stargateclient.spec.ts index 8761c9a968..6f0d757e17 100644 --- a/packages/stargate/src/stargateclient.spec.ts +++ b/packages/stargate/src/stargateclient.spec.ts @@ -83,7 +83,7 @@ describe("StargateClient", () => { describe("connect", () => { it("works", async () => { pendingWithoutSimapp(); - const client = await StargateClient.connect(simapp.tendermintUrl); + const client = await StargateClient.connect(simapp.tendermintUrlHttp); expect(client).toBeTruthy(); client.disconnect(); }); @@ -92,14 +92,14 @@ describe("StargateClient", () => { describe("getChainId", () => { it("works", async () => { pendingWithoutSimapp(); - const client = await StargateClient.connect(simapp.tendermintUrl); + const client = await StargateClient.connect(simapp.tendermintUrlHttp); expect(await client.getChainId()).toEqual(simapp.chainId); client.disconnect(); }); it("caches chain ID", async () => { pendingWithoutSimapp(); - const client = await StargateClient.connect(simapp.tendermintUrl); + const client = await StargateClient.connect(simapp.tendermintUrlHttp); const openedClient = client as unknown as PrivateStargateClient; const getCodeSpy = spyOn(openedClient.cometClient!, "status").and.callThrough(); @@ -115,7 +115,7 @@ describe("StargateClient", () => { describe("getHeight", () => { it("works", async () => { pendingWithoutSimapp(); - const client = await StargateClient.connect(simapp.tendermintUrl); + const client = await StargateClient.connect(simapp.tendermintUrlHttp); const height1 = await client.getHeight(); expect(height1).toBeGreaterThan(0); @@ -131,7 +131,7 @@ describe("StargateClient", () => { describe("getAccount", () => { it("works for unused account", async () => { pendingWithoutSimapp(); - const client = await StargateClient.connect(simapp.tendermintUrl); + const client = await StargateClient.connect(simapp.tendermintUrlHttp); const account = await client.getAccount(unused.address); assert(account); @@ -147,7 +147,7 @@ describe("StargateClient", () => { it("works for account with pubkey and non-zero sequence", async () => { pendingWithoutSimapp(); - const client = await StargateClient.connect(simapp.tendermintUrl); + const client = await StargateClient.connect(simapp.tendermintUrlHttp); const account = await client.getAccount(validator.delegatorAddress); assert(account); @@ -163,7 +163,7 @@ describe("StargateClient", () => { it("returns null for non-existent address", async () => { pendingWithoutSimapp(); - const client = await StargateClient.connect(simapp.tendermintUrl); + const client = await StargateClient.connect(simapp.tendermintUrlHttp); const account = await client.getAccount(nonExistentAddress); expect(account).toBeNull(); @@ -175,7 +175,7 @@ describe("StargateClient", () => { describe("getSequence", () => { it("works for unused account", async () => { pendingWithoutSimapp(); - const client = await StargateClient.connect(simapp.tendermintUrl); + const client = await StargateClient.connect(simapp.tendermintUrlHttp); const account = await client.getSequence(unused.address); assert(account); @@ -189,7 +189,7 @@ describe("StargateClient", () => { it("rejects for non-existent address", async () => { pendingWithoutSimapp(); - const client = await StargateClient.connect(simapp.tendermintUrl); + const client = await StargateClient.connect(simapp.tendermintUrlHttp); await expectAsync(client.getSequence(nonExistentAddress)).toBeRejectedWithError( /account '([a-z0-9]{10,90})' does not exist on chain/i, @@ -202,7 +202,7 @@ describe("StargateClient", () => { describe("getBlock", () => { it("works for latest block", async () => { pendingWithoutSimapp(); - const client = await StargateClient.connect(simapp.tendermintUrl); + const client = await StargateClient.connect(simapp.tendermintUrlHttp); const response = await client.getBlock(); expect(response).toEqual( @@ -226,7 +226,7 @@ describe("StargateClient", () => { it("works for block by height", async () => { pendingWithoutSimapp(); - const client = await StargateClient.connect(simapp.tendermintUrl); + const client = await StargateClient.connect(simapp.tendermintUrlHttp); const height = (await client.getBlock()).header.height; const response = await client.getBlock(height - 1); @@ -253,7 +253,7 @@ describe("StargateClient", () => { describe("getBalance", () => { it("works for different existing balances", async () => { pendingWithoutSimapp(); - const client = await StargateClient.connect(simapp.tendermintUrl); + const client = await StargateClient.connect(simapp.tendermintUrlHttp); const response1 = await client.getBalance(unused.address, simapp.denomFee); expect(response1).toEqual({ @@ -271,7 +271,7 @@ describe("StargateClient", () => { it("returns 0 for non-existent balance", async () => { pendingWithoutSimapp(); - const client = await StargateClient.connect(simapp.tendermintUrl); + const client = await StargateClient.connect(simapp.tendermintUrlHttp); const response = await client.getBalance(unused.address, "gintonic"); expect(response).toEqual({ @@ -284,7 +284,7 @@ describe("StargateClient", () => { it("returns 0 for non-existent address", async () => { pendingWithoutSimapp(); - const client = await StargateClient.connect(simapp.tendermintUrl); + const client = await StargateClient.connect(simapp.tendermintUrlHttp); const response = await client.getBalance(nonExistentAddress, simapp.denomFee); expect(response).toEqual({ @@ -299,7 +299,7 @@ describe("StargateClient", () => { describe("getAllBalances", () => { it("returns all balances for unused account", async () => { pendingWithoutSimapp(); - const client = await StargateClient.connect(simapp.tendermintUrl); + const client = await StargateClient.connect(simapp.tendermintUrlHttp); const balances = await client.getAllBalances(unused.address); expect(balances).toEqual([ @@ -318,7 +318,7 @@ describe("StargateClient", () => { it("returns an empty list for non-existent account", async () => { pendingWithoutSimapp(); - const client = await StargateClient.connect(simapp.tendermintUrl); + const client = await StargateClient.connect(simapp.tendermintUrlHttp); const balances = await client.getAllBalances(nonExistentAddress); expect(balances).toEqual([]); @@ -330,7 +330,7 @@ describe("StargateClient", () => { describe("getBalanceStaked", () => { it("works", async () => { pendingWithoutSimapp(); - const client = await StargateClient.connect(simapp.tendermintUrl); + const client = await StargateClient.connect(simapp.tendermintUrlHttp); const response = await client.getBalanceStaked(faucet.address0); expect(response).toEqual({ denom: "ustake", amount: "63474" }); @@ -342,7 +342,7 @@ describe("StargateClient", () => { describe("broadcastTx", () => { it("broadcasts a transaction", async () => { pendingWithoutSimapp(); - const client = await StargateClient.connect(simapp.tendermintUrl); + const client = await StargateClient.connect(simapp.tendermintUrlHttp); const wallet = await DirectSecp256k1HdWallet.fromMnemonic(faucet.mnemonic); const [{ address, pubkey: pubkeyBytes }] = await wallet.getAccounts(); const pubkey = encodePubkey({ @@ -410,7 +410,7 @@ describe("StargateClient", () => { it("errors immediately for a CheckTx failure", async () => { pendingWithoutSimapp(); - const client = await StargateClient.connect(simapp.tendermintUrl); + const client = await StargateClient.connect(simapp.tendermintUrlHttp); const wallet = await DirectSecp256k1HdWallet.fromMnemonic(faucet.mnemonic); const [{ address, pubkey: pubkeyBytes }] = await wallet.getAccounts(); const pubkey = encodePubkey({ @@ -491,7 +491,7 @@ describe("StargateClient", () => { it("respects user timeouts rather than RPC timeouts", async () => { pendingWithoutSlowSimapp(); - const client = await StargateClient.connect(slowSimapp.tendermintUrl); + const client = await StargateClient.connect(slowSimapp.tendermintUrlHttp); const wallet = await DirectSecp256k1HdWallet.fromMnemonic(faucet.mnemonic); const [{ address, pubkey: pubkeyBytes }] = await wallet.getAccounts(); const pubkey = encodePubkey({ @@ -575,7 +575,7 @@ describe("StargateClient", () => { describe("broadcastTxSync", () => { it("broadcasts sync a transaction, to get transaction hash", async () => { pendingWithoutSimapp(); - const client = await StargateClient.connect(simapp.tendermintUrl); + const client = await StargateClient.connect(simapp.tendermintUrlHttp); const wallet = await DirectSecp256k1HdWallet.fromMnemonic(faucet.mnemonic); const [{ address, pubkey: pubkeyBytes }] = await wallet.getAccounts(); const pubkey = encodePubkey({ diff --git a/packages/stargate/src/testutils.spec.ts b/packages/stargate/src/testutils.spec.ts index e2167bfb2f..052cf35711 100644 --- a/packages/stargate/src/testutils.spec.ts +++ b/packages/stargate/src/testutils.spec.ts @@ -81,7 +81,6 @@ export const defaultGasPrice = GasPrice.fromString("0.025ucosm"); export const defaultSendFee = calculateFee(100_000, defaultGasPrice); export const simapp = { - tendermintUrl: "localhost:26658", tendermintUrlWs: "ws://localhost:26658", tendermintUrlHttp: "http://localhost:26658", chainId: "simd-testing", @@ -93,7 +92,6 @@ export const simapp = { }; export const slowSimapp = { - tendermintUrl: "localhost:26660", tendermintUrlWs: "ws://localhost:26660", tendermintUrlHttp: "http://localhost:26660", chainId: "simd-testing",