Merge pull request #139 from confio/improve-NodeInfoResponse-type
Add remaining fields to NodeInfoResponse
This commit is contained in:
commit
d53d4a34b7
@ -23,6 +23,7 @@ import {
|
||||
tendermintHeightMatcher,
|
||||
tendermintIdMatcher,
|
||||
tendermintOptionalIdMatcher,
|
||||
tendermintShortHashMatcher,
|
||||
wasmdEnabled,
|
||||
wasmdEndpoint,
|
||||
} from "./testutils.spec";
|
||||
@ -298,8 +299,27 @@ describe("RestClient", () => {
|
||||
it("works", async () => {
|
||||
pendingWithoutWasmd();
|
||||
const client = new RestClient(wasmdEndpoint);
|
||||
const info = await client.nodeInfo();
|
||||
expect(info.node_info.network).toEqual(defaultNetworkId);
|
||||
const { node_info, application_version } = await client.nodeInfo();
|
||||
|
||||
expect(node_info).toEqual({
|
||||
protocol_version: { p2p: "7", block: "10", app: "0" },
|
||||
id: jasmine.stringMatching(tendermintShortHashMatcher),
|
||||
listen_addr: "tcp://0.0.0.0:26656",
|
||||
network: defaultNetworkId,
|
||||
version: "0.33.0",
|
||||
channels: "4020212223303800",
|
||||
moniker: defaultNetworkId,
|
||||
other: { tx_index: "on", rpc_address: "tcp://0.0.0.0:26657" },
|
||||
});
|
||||
expect(application_version).toEqual({
|
||||
name: "wasm",
|
||||
server_name: "wasmd",
|
||||
client_name: "wasmcli",
|
||||
version: jasmine.stringMatching(/^0\.7\.[0-9]+(-[a-zA-Z0-9._]+)?$/),
|
||||
commit: jasmine.stringMatching(tendermintShortHashMatcher),
|
||||
build_tags: "netgo,ledger",
|
||||
go: jasmine.stringMatching(/^go version go1\.[0-9]+\.[0-9]+ linux\/amd64$/),
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@ -15,12 +15,37 @@ export interface CosmosSdkAccount {
|
||||
readonly sequence: number;
|
||||
}
|
||||
|
||||
interface NodeInfo {
|
||||
export interface NodeInfo {
|
||||
readonly protocol_version: {
|
||||
readonly p2p: string;
|
||||
readonly block: string;
|
||||
readonly app: string;
|
||||
};
|
||||
readonly id: string;
|
||||
readonly listen_addr: string;
|
||||
readonly network: string;
|
||||
readonly version: string;
|
||||
readonly channels: string;
|
||||
readonly moniker: string;
|
||||
readonly other: {
|
||||
readonly tx_index: string;
|
||||
readonly rpc_address: string;
|
||||
};
|
||||
}
|
||||
|
||||
interface NodeInfoResponse {
|
||||
export interface ApplicationVersion {
|
||||
readonly name: string;
|
||||
readonly server_name: string;
|
||||
readonly client_name: string;
|
||||
readonly version: string;
|
||||
readonly commit: string;
|
||||
readonly build_tags: string;
|
||||
readonly go: string;
|
||||
}
|
||||
|
||||
export interface NodeInfoResponse {
|
||||
readonly node_info: NodeInfo;
|
||||
readonly application_version: ApplicationVersion;
|
||||
}
|
||||
|
||||
export interface BlockId {
|
||||
|
||||
@ -60,6 +60,7 @@ export const tendermintHeightMatcher = /^[0-9]+$/;
|
||||
export const tendermintIdMatcher = /^[0-9A-F]{64}$/;
|
||||
export const tendermintOptionalIdMatcher = /^([0-9A-F]{64}|)$/;
|
||||
export const tendermintAddressMatcher = /^[0-9A-F]{40}$/;
|
||||
export const tendermintShortHashMatcher = /^[0-9a-f]{40}$/;
|
||||
|
||||
// https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki#bech32
|
||||
export const bech32AddressMatcher = /^[\x21-\x7e]{1,83}1[02-9ac-hj-np-z]{38}$/;
|
||||
|
||||
28
packages/sdk/types/restclient.d.ts
vendored
28
packages/sdk/types/restclient.d.ts
vendored
@ -8,11 +8,35 @@ export interface CosmosSdkAccount {
|
||||
readonly account_number: number;
|
||||
readonly sequence: number;
|
||||
}
|
||||
interface NodeInfo {
|
||||
export interface NodeInfo {
|
||||
readonly protocol_version: {
|
||||
readonly p2p: string;
|
||||
readonly block: string;
|
||||
readonly app: string;
|
||||
};
|
||||
readonly id: string;
|
||||
readonly listen_addr: string;
|
||||
readonly network: string;
|
||||
readonly version: string;
|
||||
readonly channels: string;
|
||||
readonly moniker: string;
|
||||
readonly other: {
|
||||
readonly tx_index: string;
|
||||
readonly rpc_address: string;
|
||||
};
|
||||
}
|
||||
interface NodeInfoResponse {
|
||||
export interface ApplicationVersion {
|
||||
readonly name: string;
|
||||
readonly server_name: string;
|
||||
readonly client_name: string;
|
||||
readonly version: string;
|
||||
readonly commit: string;
|
||||
readonly build_tags: string;
|
||||
readonly go: string;
|
||||
}
|
||||
export interface NodeInfoResponse {
|
||||
readonly node_info: NodeInfo;
|
||||
readonly application_version: ApplicationVersion;
|
||||
}
|
||||
export interface BlockId {
|
||||
readonly hash: string;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user