Merge pull request #935 from cosmos/remove-default-url

Remove default URLs from HttpClient and WebsocketClient
This commit is contained in:
Simon Warta 2021-11-19 10:42:15 +01:00 committed by GitHub
commit a6bf588c46
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 2 deletions

View File

@ -14,11 +14,14 @@ and this project adheres to
queries remain available in the `IbcExtension` because for IBC the storage
layout is standardized. Such queries can still be implemented in CosmJS caller
code that only needs to support one backend. ([#865])
- @cosmjs/tendermint-rpc: Remove default URL from `HttpClient` and
`WebsocketClient` constructors ([#897]).
- all: Upgrade cosmjs-types to 0.3. This includes the types of the Cosmos SDK
0.44 modules x/authz and x/feegrant. It causes a few breaking changes by
adding fields to interfaces. ([#928])
[#865]: https://github.com/cosmos/cosmjs/issues/865
[#897]: https://github.com/cosmos/cosmjs/issues/897
[#928]: https://github.com/cosmos/cosmjs/issues/928
### Added

View File

@ -39,7 +39,7 @@ export async function http(method: "POST", url: string, request?: any): Promise<
export class HttpClient implements RpcClient {
protected readonly url: string;
public constructor(url = "http://localhost:46657") {
public constructor(url: string) {
// accept host.name:port and assume http protocol
this.url = hasProtocol(url) ? url : "http://" + url;
}

View File

@ -142,7 +142,7 @@ export class WebsocketClient implements RpcStreamingClient {
// map is never cleared and there is no need to do so. But unsubscribe all the subscriptions!
private readonly subscriptionStreams = new Map<string, Stream<SubscriptionEvent>>();
public constructor(baseUrl = "ws://localhost:46657", onError: (err: any) => void = defaultErrorHandler) {
public constructor(baseUrl: string, onError: (err: any) => void = defaultErrorHandler) {
// accept host.name:port and assume ws protocol
// make sure we don't end up with ...//websocket
const path = baseUrl.endsWith("/") ? "websocket" : "/websocket";