@solana/web3.js 1.95.0 → 1.95.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.cjs.js CHANGED
@@ -4478,6 +4478,19 @@ function extractCommitmentFromConfig(commitmentOrConfig) {
4478
4478
  };
4479
4479
  }
4480
4480
 
4481
+ /**
4482
+ * @internal
4483
+ */
4484
+ function applyDefaultMemcmpEncodingToFilters(filters) {
4485
+ return filters.map(filter => 'memcmp' in filter ? {
4486
+ ...filter,
4487
+ memcmp: {
4488
+ ...filter.memcmp,
4489
+ encoding: filter.memcmp.encoding ?? 'base58'
4490
+ }
4491
+ } : filter);
4492
+ }
4493
+
4481
4494
  /**
4482
4495
  * @internal
4483
4496
  */
@@ -6408,7 +6421,12 @@ class Connection {
6408
6421
  encoding,
6409
6422
  ...configWithoutEncoding
6410
6423
  } = config || {};
6411
- const args = this._buildArgs([programId.toBase58()], commitment, encoding || 'base64', configWithoutEncoding);
6424
+ const args = this._buildArgs([programId.toBase58()], commitment, encoding || 'base64', {
6425
+ ...configWithoutEncoding,
6426
+ ...(configWithoutEncoding.filters ? {
6427
+ filters: applyDefaultMemcmpEncodingToFilters(configWithoutEncoding.filters)
6428
+ } : null)
6429
+ });
6412
6430
  const unsafeRes = await this._rpcRequest('getProgramAccounts', args);
6413
6431
  const baseSchema = superstruct.array(KeyedAccountInfoResult);
6414
6432
  const res = configWithoutEncoding.withContext === true ? superstruct.create(unsafeRes, jsonRpcResultAndContext(baseSchema)) : superstruct.create(unsafeRes, jsonRpcResult(baseSchema));
@@ -8557,7 +8575,7 @@ class Connection {
8557
8575
  const args = this._buildArgs([programId.toBase58()], commitment || this._commitment || 'finalized',
8558
8576
  // Apply connection/server default.
8559
8577
  'base64' /* encoding */, config ? config : maybeFilters ? {
8560
- filters: maybeFilters
8578
+ filters: applyDefaultMemcmpEncodingToFilters(maybeFilters)
8561
8579
  } : undefined /* extra */);
8562
8580
  return this._makeSubscription({
8563
8581
  callback,