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>
This commit is contained in:
Pierre 2021-08-20 06:09:36 +10:00 committed by GitHub
parent 4982dc20f9
commit f59a55be17
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -2415,13 +2415,13 @@ export class Connection {
async getMultipleAccountsInfo(
publicKeys: PublicKey[],
commitment?: Commitment,
): Promise<AccountInfo<Buffer>[] | null> {
): Promise<(AccountInfo<Buffer> | 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(