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:
parent
4982dc20f9
commit
f59a55be17
|
@ -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(
|
||||
|
|
Loading…
Reference in New Issue