diff --git a/web3.js/src/connection.js b/web3.js/src/connection.js index 32ea54bd7b..f2d569a8fa 100644 --- a/web3.js/src/connection.js +++ b/web3.js/src/connection.js @@ -408,15 +408,20 @@ const SignatureStatusResult = pick({ err: TransactionErrorResult, }); +type Version = { + 'solana-core': string, + 'feature-set'?: number, +}; + /** * Version info for a node * * @typedef {Object} Version * @property {string} solana-core Version of solana-core */ -const Version = pick({ +const VersionResult = pick({ 'solana-core': string(), - 'feature-set': optional(nullable(number())), + 'feature-set': optional(number()), }); type SimulatedTransactionResponse = { @@ -777,7 +782,7 @@ const TokenAmountResult = pick({ amount: string(), uiAmount: nullable(number()), decimals: number(), - uiAmountString: optional(nullable(string())), + uiAmountString: optional(string()), }); /** @@ -808,7 +813,7 @@ const GetTokenLargestAccountsResult = jsonRpcResultAndContext( amount: string(), uiAmount: nullable(number()), decimals: number(), - uiAmountString: optional(nullable(string())), + uiAmountString: optional(string()), }), ), ); @@ -2375,7 +2380,7 @@ export class Connection { */ async getVersion(): Promise { const unsafeRes = await this._rpcRequest('getVersion', []); - const res = create(unsafeRes, jsonRpcResult(Version)); + const res = create(unsafeRes, jsonRpcResult(VersionResult)); if (res.error) { throw new Error('failed to get version: ' + res.error.message); }