fix: add version to ContactInfo

This commit is contained in:
Justin Starry
2020-05-13 23:14:03 +08:00
committed by Michael Vines
parent c584fbdf39
commit 02a278b3b2
4 changed files with 12 additions and 6 deletions

3
web3.js/module.d.ts vendored
View File

@ -78,9 +78,10 @@ declare module '@solana/web3.js' {
export type ContactInfo = { export type ContactInfo = {
pubkey: string; pubkey: string;
gossip: string; gossip?: string;
tpu?: string; tpu?: string;
rpc?: string; rpc?: string;
version?: string;
}; };
export type ConfirmedTransactionMeta = { export type ConfirmedTransactionMeta = {

View File

@ -91,9 +91,10 @@ declare module '@solana/web3.js' {
declare export type ContactInfo = { declare export type ContactInfo = {
pubkey: string, pubkey: string,
gossip: string, gossip: string | null,
tpu: string | null, tpu: string | null,
rpc: string | null, rpc: string | null,
version: string | null,
}; };
declare export type ConfirmedTransactionMeta = { declare export type ConfirmedTransactionMeta = {

View File

@ -111,15 +111,17 @@ export type SignatureStatusConfig = {
* *
* @typedef {Object} ContactInfo * @typedef {Object} ContactInfo
* @property {string} pubkey Identity public key of the node * @property {string} pubkey Identity public key of the node
* @property {string} gossip Gossip network address for the node * @property {string|null} gossip Gossip network address for the node
* @property {string} tpu TPU network address for the node (null if not available) * @property {string|null} tpu TPU network address for the node (null if not available)
* @property {string|null} rpc JSON RPC network address for the node (null if not available) * @property {string|null} rpc JSON RPC network address for the node (null if not available)
* @property {string|null} version Software version of the node (null if not available)
*/ */
type ContactInfo = { type ContactInfo = {
pubkey: string, pubkey: string,
gossip: string, gossip: string | null,
tpu: string | null, tpu: string | null,
rpc: string | null, rpc: string | null,
version: string | null,
}; };
/** /**
@ -477,9 +479,10 @@ const GetClusterNodes = jsonRpcResult(
struct.array([ struct.array([
struct({ struct({
pubkey: 'string', pubkey: 'string',
gossip: 'string', gossip: struct.union(['null', 'string']),
tpu: struct.union(['null', 'string']), tpu: struct.union(['null', 'string']),
rpc: struct.union(['null', 'string']), rpc: struct.union(['null', 'string']),
version: struct.union(['null', 'string']),
}), }),
]), ]),
); );

View File

@ -453,6 +453,7 @@ test('get cluster nodes', async () => {
gossip: '127.0.0.0:1234', gossip: '127.0.0.0:1234',
tpu: '127.0.0.0:1235', tpu: '127.0.0.0:1235',
rpc: null, rpc: null,
version: '1.1.10',
}, },
], ],
}, },