@solana/web3.js 1.21.1 → 1.22.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.d.ts CHANGED
@@ -1458,6 +1458,13 @@ declare module '@solana/web3.js' {
1458
1458
  publicKey: PublicKey,
1459
1459
  commitment?: Commitment,
1460
1460
  ): Promise<AccountInfo<Buffer> | null>;
1461
+ /**
1462
+ * Fetch all the account info for multiple accounts specified by an array of public keys
1463
+ */
1464
+ getMultipleAccountsInfo(
1465
+ publicKeys: PublicKey[],
1466
+ commitment?: Commitment,
1467
+ ): Promise<AccountInfo<Buffer>[] | null>;
1461
1468
  /**
1462
1469
  * Returns epoch activation information for a stake account that has been delegated
1463
1470
  */
package/lib/index.esm.js CHANGED
@@ -3787,6 +3787,25 @@ class Connection {
3787
3787
  throw new Error('failed to get info about account ' + publicKey.toBase58() + ': ' + e);
3788
3788
  }
3789
3789
  }
3790
+ /**
3791
+ * Fetch all the account info for multiple accounts specified by an array of public keys
3792
+ */
3793
+
3794
+
3795
+ async getMultipleAccountsInfo(publicKeys, commitment) {
3796
+ const keys = publicKeys.map(key => key.toBase58());
3797
+
3798
+ const args = this._buildArgs([keys], commitment, 'base64');
3799
+
3800
+ const unsafeRes = await this._rpcRequest('getMultipleAccounts', args);
3801
+ const res = create(unsafeRes, jsonRpcResultAndContext(nullable(array(AccountInfoResult))));
3802
+
3803
+ if ('error' in res) {
3804
+ throw new Error('failed to get info for accounts ' + keys + ': ' + res.error.message);
3805
+ }
3806
+
3807
+ return res.result.value;
3808
+ }
3790
3809
  /**
3791
3810
  * Returns epoch activation information for a stake account that has been delegated
3792
3811
  */