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:
@@ -2415,13 +2415,13 @@ export class Connection {
|
|||||||
async getMultipleAccountsInfo(
|
async getMultipleAccountsInfo(
|
||||||
publicKeys: PublicKey[],
|
publicKeys: PublicKey[],
|
||||||
commitment?: Commitment,
|
commitment?: Commitment,
|
||||||
): Promise<AccountInfo<Buffer>[] | null> {
|
): Promise<(AccountInfo<Buffer> | null)[]> {
|
||||||
const keys = publicKeys.map(key => key.toBase58());
|
const keys = publicKeys.map(key => key.toBase58());
|
||||||
const args = this._buildArgs([keys], commitment, 'base64');
|
const args = this._buildArgs([keys], commitment, 'base64');
|
||||||
const unsafeRes = await this._rpcRequest('getMultipleAccounts', args);
|
const unsafeRes = await this._rpcRequest('getMultipleAccounts', args);
|
||||||
const res = create(
|
const res = create(
|
||||||
unsafeRes,
|
unsafeRes,
|
||||||
jsonRpcResultAndContext(nullable(array(AccountInfoResult))),
|
jsonRpcResultAndContext(array(nullable(AccountInfoResult))),
|
||||||
);
|
);
|
||||||
if ('error' in res) {
|
if ('error' in res) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
|
Reference in New Issue
Block a user