diff --git a/web3.js/module.d.ts b/web3.js/module.d.ts index f1a9fbf152..e0a95c087e 100644 --- a/web3.js/module.d.ts +++ b/web3.js/module.d.ts @@ -78,9 +78,10 @@ declare module '@solana/web3.js' { export type ContactInfo = { pubkey: string; - gossip: string; + gossip?: string; tpu?: string; rpc?: string; + version?: string; }; export type ConfirmedTransactionMeta = { diff --git a/web3.js/module.flow.js b/web3.js/module.flow.js index 444b7407cf..a9af3d5d96 100644 --- a/web3.js/module.flow.js +++ b/web3.js/module.flow.js @@ -91,9 +91,10 @@ declare module '@solana/web3.js' { declare export type ContactInfo = { pubkey: string, - gossip: string, + gossip: string | null, tpu: string | null, rpc: string | null, + version: string | null, }; declare export type ConfirmedTransactionMeta = { diff --git a/web3.js/src/connection.js b/web3.js/src/connection.js index 3c5466b01a..a2cd8453a4 100644 --- a/web3.js/src/connection.js +++ b/web3.js/src/connection.js @@ -111,15 +111,17 @@ export type SignatureStatusConfig = { * * @typedef {Object} ContactInfo * @property {string} pubkey Identity public key of the node - * @property {string} gossip Gossip network address for the node - * @property {string} tpu TPU network address for the node (null if not available) + * @property {string|null} gossip Gossip network address for the node + * @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} version Software version of the node (null if not available) */ type ContactInfo = { pubkey: string, - gossip: string, + gossip: string | null, tpu: string | null, rpc: string | null, + version: string | null, }; /** @@ -477,9 +479,10 @@ const GetClusterNodes = jsonRpcResult( struct.array([ struct({ pubkey: 'string', - gossip: 'string', + gossip: struct.union(['null', 'string']), tpu: struct.union(['null', 'string']), rpc: struct.union(['null', 'string']), + version: struct.union(['null', 'string']), }), ]), ); diff --git a/web3.js/test/connection.test.js b/web3.js/test/connection.test.js index 967ba6e373..d9558851eb 100644 --- a/web3.js/test/connection.test.js +++ b/web3.js/test/connection.test.js @@ -453,6 +453,7 @@ test('get cluster nodes', async () => { gossip: '127.0.0.0:1234', tpu: '127.0.0.0:1235', rpc: null, + version: '1.1.10', }, ], },