From f59a55be171e64aa7deb021cad756ca3c69968cc Mon Sep 17 00:00:00 2001 From: Pierre Date: Fri, 20 Aug 2021 06:09:36 +1000 Subject: [PATCH] fix: handle null case in getMultipleAccountsInfo (#19307) * fix null case * make it similar in interface to getProgramAccounts Co-authored-by: Arrowana <8245419+Arrowana@users.noreply.github.com> --- web3.js/src/connection.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web3.js/src/connection.ts b/web3.js/src/connection.ts index 788d5ccc12..a250b91d89 100644 --- a/web3.js/src/connection.ts +++ b/web3.js/src/connection.ts @@ -2415,13 +2415,13 @@ export class Connection { async getMultipleAccountsInfo( publicKeys: PublicKey[], commitment?: Commitment, - ): Promise[] | null> { + ): Promise<(AccountInfo | null)[]> { const keys = publicKeys.map(key => key.toBase58()); const args = this._buildArgs([keys], commitment, 'base64'); const unsafeRes = await this._rpcRequest('getMultipleAccounts', args); const res = create( unsafeRes, - jsonRpcResultAndContext(nullable(array(AccountInfoResult))), + jsonRpcResultAndContext(array(nullable(AccountInfoResult))), ); if ('error' in res) { throw new Error(