Skip to content

Commit

Permalink
fix: handle null case in getMultipleAccountsInfo (#19307)
Browse files Browse the repository at this point in the history
* fix null case

* make it similar in interface to getProgramAccounts

Co-authored-by: Arrowana <8245419+Arrowana@users.noreply.github.com>
  • Loading branch information
Arrowana and Arrowana committed Aug 19, 2021
1 parent 5509815 commit ace20f5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/connection.ts
Expand Up @@ -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(
Expand Down

0 comments on commit ace20f5

Please sign in to comment.