@solana/web3.js 1.3.1 → 1.4.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.
@@ -5441,8 +5441,29 @@ class Connection {
5441
5441
  */
5442
5442
 
5443
5443
 
5444
- async getProgramAccounts(programId, commitment) {
5445
- const args = this._buildArgs([programId.toBase58()], commitment, 'base64');
5444
+ async getProgramAccounts(programId, configOrCommitment) {
5445
+ const extra = {};
5446
+ let commitment;
5447
+ let encoding;
5448
+
5449
+ if (configOrCommitment) {
5450
+ if (typeof configOrCommitment === 'string') {
5451
+ commitment = configOrCommitment;
5452
+ } else {
5453
+ commitment = configOrCommitment.commitment;
5454
+ encoding = configOrCommitment.encoding;
5455
+
5456
+ if (configOrCommitment.dataSlice) {
5457
+ extra.dataSlice = configOrCommitment.dataSlice;
5458
+ }
5459
+
5460
+ if (configOrCommitment.filters) {
5461
+ extra.filters = configOrCommitment.filters;
5462
+ }
5463
+ }
5464
+ }
5465
+
5466
+ const args = this._buildArgs([programId.toBase58()], commitment, encoding || 'base64', extra);
5446
5467
 
5447
5468
  const unsafeRes = await this._rpcRequest('getProgramAccounts', args);
5448
5469
  const res = create(unsafeRes, jsonRpcResult(array(KeyedAccountInfoResult)));
@@ -5460,8 +5481,23 @@ class Connection {
5460
5481
  */
5461
5482
 
5462
5483
 
5463
- async getParsedProgramAccounts(programId, commitment) {
5464
- const args = this._buildArgs([programId.toBase58()], commitment, 'jsonParsed');
5484
+ async getParsedProgramAccounts(programId, configOrCommitment) {
5485
+ const extra = {};
5486
+ let commitment;
5487
+
5488
+ if (configOrCommitment) {
5489
+ if (typeof configOrCommitment === 'string') {
5490
+ commitment = configOrCommitment;
5491
+ } else {
5492
+ commitment = configOrCommitment.commitment;
5493
+
5494
+ if (configOrCommitment.filters) {
5495
+ extra.filters = configOrCommitment.filters;
5496
+ }
5497
+ }
5498
+ }
5499
+
5500
+ const args = this._buildArgs([programId.toBase58()], commitment, 'jsonParsed', extra);
5465
5501
 
5466
5502
  const unsafeRes = await this._rpcRequest('getProgramAccounts', args);
5467
5503
  const res = create(unsafeRes, jsonRpcResult(array(KeyedParsedAccountInfoResult)));