@solana/web3.js 1.91.3 → 1.91.5

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
@@ -8,6 +8,7 @@ var sha256 = require('@noble/hashes/sha256');
8
8
  var borsh = require('borsh');
9
9
  var BufferLayout = require('@solana/buffer-layout');
10
10
  var bigintBuffer = require('bigint-buffer');
11
+ var fastStableStringify = require('@solana/fast-stable-stringify');
11
12
  var require$$0 = require('util');
12
13
  var require$$0$1 = require('http');
13
14
  var require$$0$2 = require('https');
@@ -42,6 +43,7 @@ function _interopNamespaceCompat(e) {
42
43
  var BN__default = /*#__PURE__*/_interopDefaultCompat(BN);
43
44
  var bs58__default = /*#__PURE__*/_interopDefaultCompat(bs58);
44
45
  var BufferLayout__namespace = /*#__PURE__*/_interopNamespaceCompat(BufferLayout);
46
+ var fastStableStringify__default = /*#__PURE__*/_interopDefaultCompat(fastStableStringify);
45
47
  var require$$0__default = /*#__PURE__*/_interopDefaultCompat(require$$0);
46
48
  var require$$0__default$1 = /*#__PURE__*/_interopDefaultCompat(require$$0$1);
47
49
  var require$$0__default$2 = /*#__PURE__*/_interopDefaultCompat(require$$0$2);
@@ -3961,82 +3963,6 @@ agentkeepalive.exports.constants = constants;
3961
3963
  var agentkeepaliveExports = agentkeepalive.exports;
3962
3964
  var HttpKeepAliveAgent = /*@__PURE__*/getDefaultExportFromCjs(agentkeepaliveExports);
3963
3965
 
3964
- var objToString = Object.prototype.toString;
3965
- var objKeys = Object.keys || function(obj) {
3966
- var keys = [];
3967
- for (var name in obj) {
3968
- keys.push(name);
3969
- }
3970
- return keys;
3971
- };
3972
-
3973
- function stringify(val, isArrayProp) {
3974
- var i, max, str, keys, key, propVal, toStr;
3975
- if (val === true) {
3976
- return "true";
3977
- }
3978
- if (val === false) {
3979
- return "false";
3980
- }
3981
- switch (typeof val) {
3982
- case "object":
3983
- if (val === null) {
3984
- return null;
3985
- } else if (val.toJSON && typeof val.toJSON === "function") {
3986
- return stringify(val.toJSON(), isArrayProp);
3987
- } else {
3988
- toStr = objToString.call(val);
3989
- if (toStr === "[object Array]") {
3990
- str = '[';
3991
- max = val.length - 1;
3992
- for(i = 0; i < max; i++) {
3993
- str += stringify(val[i], true) + ',';
3994
- }
3995
- if (max > -1) {
3996
- str += stringify(val[i], true);
3997
- }
3998
- return str + ']';
3999
- } else if (toStr === "[object Object]") {
4000
- // only object is left
4001
- keys = objKeys(val).sort();
4002
- max = keys.length;
4003
- str = "";
4004
- i = 0;
4005
- while (i < max) {
4006
- key = keys[i];
4007
- propVal = stringify(val[key], false);
4008
- if (propVal !== undefined) {
4009
- if (str) {
4010
- str += ',';
4011
- }
4012
- str += JSON.stringify(key) + ':' + propVal;
4013
- }
4014
- i++;
4015
- }
4016
- return '{' + str + '}';
4017
- } else {
4018
- return JSON.stringify(val);
4019
- }
4020
- }
4021
- case "function":
4022
- case "undefined":
4023
- return isArrayProp ? null : undefined;
4024
- case "string":
4025
- return JSON.stringify(val);
4026
- default:
4027
- return isFinite(val) ? val : null;
4028
- }
4029
- }
4030
-
4031
- var fastStableStringify = function(val) {
4032
- var returnVal = stringify(val, false);
4033
- if (returnVal !== undefined) {
4034
- return ''+ returnVal;
4035
- }
4036
- };
4037
-
4038
- var fastStableStringify$1 = /*@__PURE__*/getDefaultExportFromCjs(fastStableStringify);
4039
-
4040
3966
  const MINIMUM_SLOT_PER_EPOCH = 32;
4041
3967
 
4042
3968
  // Returns the number of trailing zeros in the binary representation of self.
@@ -5936,7 +5862,7 @@ class Connection {
5936
5862
  config
5937
5863
  } = extractCommitmentFromConfig(commitmentOrConfig);
5938
5864
  const args = this._buildArgs([], commitment, undefined /* encoding */, config);
5939
- const requestHash = fastStableStringify$1(args);
5865
+ const requestHash = fastStableStringify__default.default(args);
5940
5866
  requestPromises[requestHash] = requestPromises[requestHash] ?? (async () => {
5941
5867
  try {
5942
5868
  const unsafeRes = await this._rpcRequest('getBlockHeight', args);
@@ -8027,7 +7953,8 @@ class Connection {
8027
7953
  encoding: 'base64'
8028
7954
  };
8029
7955
  const skipPreflight = options && options.skipPreflight;
8030
- const preflightCommitment = options && options.preflightCommitment || this.commitment;
7956
+ const preflightCommitment = skipPreflight === true ? 'processed' // FIXME Remove when https://github.com/anza-xyz/agave/pull/483 is deployed.
7957
+ : options && options.preflightCommitment || this.commitment;
8031
7958
  if (options && options.maxRetries != null) {
8032
7959
  config.maxRetries = options.maxRetries;
8033
7960
  }
@@ -8371,7 +8298,7 @@ class Connection {
8371
8298
  */
8372
8299
  args) {
8373
8300
  const clientSubscriptionId = this._nextClientSubscriptionId++;
8374
- const hash = fastStableStringify$1([subscriptionConfig.method, args], true /* isArrayProp */);
8301
+ const hash = fastStableStringify__default.default([subscriptionConfig.method, args]);
8375
8302
  const existingSubscription = this._subscriptionsByHash[hash];
8376
8303
  if (existingSubscription === undefined) {
8377
8304
  this._subscriptionsByHash[hash] = {