@solana/web3.js 1.95.0 → 1.95.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solana/web3.js",
3
- "version": "1.95.0",
3
+ "version": "1.95.2",
4
4
  "description": "Solana Javascript API",
5
5
  "keywords": [
6
6
  "api",
@@ -55,7 +55,7 @@
55
55
  "test:unit:node": "cross-env NODE_ENV=test NODE_OPTIONS='--import tsx' mocha './test/**/*.test.ts'"
56
56
  },
57
57
  "dependencies": {
58
- "@babel/runtime": "^7.24.7",
58
+ "@babel/runtime": "^7.24.8",
59
59
  "@noble/curves": "^1.4.2",
60
60
  "@noble/hashes": "^1.4.0",
61
61
  "@solana/buffer-layout": "^4.0.1",
@@ -66,7 +66,7 @@
66
66
  "bs58": "^4.0.1",
67
67
  "buffer": "6.0.3",
68
68
  "fast-stable-stringify": "^1.0.0",
69
- "jayson": "^4.1.0",
69
+ "jayson": "^4.1.1",
70
70
  "node-fetch": "^2.7.0",
71
71
  "rpc-websockets": "^9.0.2",
72
72
  "superstruct": "^2.0.2"
package/src/connection.ts CHANGED
@@ -381,6 +381,25 @@ function extractCommitmentFromConfig<TConfig>(
381
381
  return {commitment, config};
382
382
  }
383
383
 
384
+ /**
385
+ * @internal
386
+ */
387
+ function applyDefaultMemcmpEncodingToFilters(
388
+ filters: GetProgramAccountsFilter[],
389
+ ): GetProgramAccountsFilter[] {
390
+ return filters.map(filter =>
391
+ 'memcmp' in filter
392
+ ? {
393
+ ...filter,
394
+ memcmp: {
395
+ ...filter.memcmp,
396
+ encoding: filter.memcmp.encoding ?? 'base58',
397
+ },
398
+ }
399
+ : filter,
400
+ );
401
+ }
402
+
384
403
  /**
385
404
  * @internal
386
405
  */
@@ -2697,9 +2716,18 @@ export type MemcmpFilter = {
2697
2716
  memcmp: {
2698
2717
  /** offset into program account data to start comparison */
2699
2718
  offset: number;
2700
- /** data to match, as base-58 encoded string and limited to less than 129 bytes */
2701
- bytes: string;
2702
- };
2719
+ } & (
2720
+ | {
2721
+ encoding?: 'base58'; // Base-58 is the default when not supplied.
2722
+ /** data to match, as base-58 encoded string and limited to less than 129 bytes */
2723
+ bytes: string;
2724
+ }
2725
+ | {
2726
+ encoding: 'base64';
2727
+ /** data to match, as base-64 encoded string */
2728
+ bytes: string;
2729
+ }
2730
+ );
2703
2731
  };
2704
2732
 
2705
2733
  /**
@@ -3731,7 +3759,16 @@ export class Connection {
3731
3759
  [programId.toBase58()],
3732
3760
  commitment,
3733
3761
  encoding || 'base64',
3734
- configWithoutEncoding,
3762
+ {
3763
+ ...configWithoutEncoding,
3764
+ ...(configWithoutEncoding.filters
3765
+ ? {
3766
+ filters: applyDefaultMemcmpEncodingToFilters(
3767
+ configWithoutEncoding.filters,
3768
+ ),
3769
+ }
3770
+ : null),
3771
+ },
3735
3772
  );
3736
3773
  const unsafeRes = await this._rpcRequest('getProgramAccounts', args);
3737
3774
  const baseSchema = array(KeyedAccountInfoResult);
@@ -6521,7 +6558,7 @@ export class Connection {
6521
6558
  config
6522
6559
  ? config
6523
6560
  : maybeFilters
6524
- ? {filters: maybeFilters}
6561
+ ? {filters: applyDefaultMemcmpEncodingToFilters(maybeFilters)}
6525
6562
  : undefined /* extra */,
6526
6563
  );
6527
6564
  return this._makeSubscription(