@cosmjs/tendermint-rpc
Advanced tools
Comparing version 0.26.1 to 0.26.2
import { JsonRpcRequest, JsonRpcSuccessResponse } from "@cosmjs/json-rpc"; | ||
import { RpcClient } from "./rpcclient"; | ||
/** | ||
* Helper to work around missing CORS support in Tendermint (https://github.com/tendermint/tendermint/pull/2800) | ||
* | ||
* For some reason, fetch does not complain about missing server-side CORS support. | ||
*/ | ||
export declare function http(method: "POST", url: string, request?: any): Promise<any>; | ||
export declare class HttpClient implements RpcClient { | ||
@@ -4,0 +10,0 @@ protected readonly url: string; |
@@ -6,3 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.HttpClient = void 0; | ||
exports.HttpClient = exports.http = void 0; | ||
const json_rpc_1 = require("@cosmjs/json-rpc"); | ||
@@ -22,2 +22,3 @@ const axios_1 = __importDefault(require("axios")); | ||
*/ | ||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types | ||
async function http(method, url, request) { | ||
@@ -34,2 +35,3 @@ if (typeof fetch !== "undefined") { | ||
} | ||
exports.http = http; | ||
class HttpClient { | ||
@@ -36,0 +38,0 @@ constructor(url = "http://localhost:46657") { |
@@ -11,4 +11,14 @@ "use strict"; | ||
} | ||
const tendermintUrl = testutil_spec_1.defaultInstance.url; | ||
describe("http", () => { | ||
it("can send a health request", async () => { | ||
pendingWithoutTendermint(); | ||
const response = await httpclient_1.http("POST", `http://${tendermintUrl}`, jsonrpc_1.createJsonRpcRequest("health")); | ||
expect(response).toEqual(jasmine.objectContaining({ jsonrpc: "2.0" })); | ||
}); | ||
it("errors for non-open port", async () => { | ||
await expectAsync(httpclient_1.http("POST", `http://localhost:56745`, jsonrpc_1.createJsonRpcRequest("health"))).toBeRejectedWithError(/(ECONNREFUSED|Failed to fetch)/i); | ||
}); | ||
}); | ||
describe("HttpClient", () => { | ||
const tendermintUrl = testutil_spec_1.defaultInstance.url; | ||
it("can make a simple call", async () => { | ||
@@ -15,0 +25,0 @@ pendingWithoutTendermint(); |
{ | ||
"name": "@cosmjs/tendermint-rpc", | ||
"version": "0.26.1", | ||
"version": "0.26.2", | ||
"description": "Tendermint RPC clients", | ||
@@ -45,8 +45,8 @@ "contributors": [ | ||
"dependencies": { | ||
"@cosmjs/crypto": "0.26.1", | ||
"@cosmjs/encoding": "0.26.1", | ||
"@cosmjs/json-rpc": "0.26.1", | ||
"@cosmjs/math": "0.26.1", | ||
"@cosmjs/socket": "0.26.1", | ||
"@cosmjs/stream": "0.26.1", | ||
"@cosmjs/crypto": "0.26.2", | ||
"@cosmjs/encoding": "0.26.2", | ||
"@cosmjs/json-rpc": "0.26.2", | ||
"@cosmjs/math": "0.26.2", | ||
"@cosmjs/socket": "0.26.2", | ||
"@cosmjs/stream": "0.26.2", | ||
"axios": "^0.21.2", | ||
@@ -57,3 +57,3 @@ "readonly-date": "^1.0.0", | ||
"devDependencies": { | ||
"@cosmjs/utils": "0.26.1", | ||
"@cosmjs/utils": "0.26.2", | ||
"@istanbuljs/nyc-config-typescript": "^1.0.1", | ||
@@ -60,0 +60,0 @@ "@types/eslint-plugin-prettier": "^3", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
483440
6556
+ Added@cosmjs/crypto@0.26.2(transitive)
+ Added@cosmjs/encoding@0.26.2(transitive)
+ Added@cosmjs/json-rpc@0.26.2(transitive)
+ Added@cosmjs/math@0.26.2(transitive)
+ Added@cosmjs/socket@0.26.2(transitive)
+ Added@cosmjs/stream@0.26.2(transitive)
+ Added@cosmjs/utils@0.26.2(transitive)
- Removed@cosmjs/crypto@0.26.1(transitive)
- Removed@cosmjs/encoding@0.26.1(transitive)
- Removed@cosmjs/json-rpc@0.26.1(transitive)
- Removed@cosmjs/math@0.26.1(transitive)
- Removed@cosmjs/socket@0.26.1(transitive)
- Removed@cosmjs/stream@0.26.1(transitive)
- Removed@cosmjs/utils@0.26.1(transitive)
Updated@cosmjs/crypto@0.26.2
Updated@cosmjs/encoding@0.26.2
Updated@cosmjs/json-rpc@0.26.2
Updated@cosmjs/math@0.26.2
Updated@cosmjs/socket@0.26.2
Updated@cosmjs/stream@0.26.2