@solana/web3.js 1.95.3 → 1.95.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.
@@ -3368,81 +3368,90 @@ function getDefaultExportFromCjs (x) {
3368
3368
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
3369
3369
  }
3370
3370
 
3371
- var objToString = Object.prototype.toString;
3372
- var objKeys = Object.keys || function(obj) {
3373
- var keys = [];
3374
- for (var name in obj) {
3375
- keys.push(name);
3376
- }
3377
- return keys;
3378
- };
3371
+ var fastStableStringify$1;
3372
+ var hasRequiredFastStableStringify;
3373
+
3374
+ function requireFastStableStringify () {
3375
+ if (hasRequiredFastStableStringify) return fastStableStringify$1;
3376
+ hasRequiredFastStableStringify = 1;
3377
+ var objToString = Object.prototype.toString;
3378
+ var objKeys = Object.keys || function(obj) {
3379
+ var keys = [];
3380
+ for (var name in obj) {
3381
+ keys.push(name);
3382
+ }
3383
+ return keys;
3384
+ };
3379
3385
 
3380
- function stringify(val, isArrayProp) {
3381
- var i, max, str, keys, key, propVal, toStr;
3382
- if (val === true) {
3383
- return "true";
3384
- }
3385
- if (val === false) {
3386
- return "false";
3387
- }
3388
- switch (typeof val) {
3389
- case "object":
3390
- if (val === null) {
3391
- return null;
3392
- } else if (val.toJSON && typeof val.toJSON === "function") {
3393
- return stringify(val.toJSON(), isArrayProp);
3394
- } else {
3395
- toStr = objToString.call(val);
3396
- if (toStr === "[object Array]") {
3397
- str = '[';
3398
- max = val.length - 1;
3399
- for(i = 0; i < max; i++) {
3400
- str += stringify(val[i], true) + ',';
3401
- }
3402
- if (max > -1) {
3403
- str += stringify(val[i], true);
3404
- }
3405
- return str + ']';
3406
- } else if (toStr === "[object Object]") {
3407
- // only object is left
3408
- keys = objKeys(val).sort();
3409
- max = keys.length;
3410
- str = "";
3411
- i = 0;
3412
- while (i < max) {
3413
- key = keys[i];
3414
- propVal = stringify(val[key], false);
3415
- if (propVal !== undefined) {
3416
- if (str) {
3417
- str += ',';
3386
+ function stringify(val, isArrayProp) {
3387
+ var i, max, str, keys, key, propVal, toStr;
3388
+ if (val === true) {
3389
+ return "true";
3390
+ }
3391
+ if (val === false) {
3392
+ return "false";
3393
+ }
3394
+ switch (typeof val) {
3395
+ case "object":
3396
+ if (val === null) {
3397
+ return null;
3398
+ } else if (val.toJSON && typeof val.toJSON === "function") {
3399
+ return stringify(val.toJSON(), isArrayProp);
3400
+ } else {
3401
+ toStr = objToString.call(val);
3402
+ if (toStr === "[object Array]") {
3403
+ str = '[';
3404
+ max = val.length - 1;
3405
+ for(i = 0; i < max; i++) {
3406
+ str += stringify(val[i], true) + ',';
3407
+ }
3408
+ if (max > -1) {
3409
+ str += stringify(val[i], true);
3410
+ }
3411
+ return str + ']';
3412
+ } else if (toStr === "[object Object]") {
3413
+ // only object is left
3414
+ keys = objKeys(val).sort();
3415
+ max = keys.length;
3416
+ str = "";
3417
+ i = 0;
3418
+ while (i < max) {
3419
+ key = keys[i];
3420
+ propVal = stringify(val[key], false);
3421
+ if (propVal !== undefined) {
3422
+ if (str) {
3423
+ str += ',';
3424
+ }
3425
+ str += JSON.stringify(key) + ':' + propVal;
3418
3426
  }
3419
- str += JSON.stringify(key) + ':' + propVal;
3427
+ i++;
3420
3428
  }
3421
- i++;
3429
+ return '{' + str + '}';
3430
+ } else {
3431
+ return JSON.stringify(val);
3422
3432
  }
3423
- return '{' + str + '}';
3424
- } else {
3425
- return JSON.stringify(val);
3426
3433
  }
3427
- }
3428
- case "function":
3429
- case "undefined":
3430
- return isArrayProp ? null : undefined;
3431
- case "string":
3432
- return JSON.stringify(val);
3433
- default:
3434
- return isFinite(val) ? val : null;
3434
+ case "function":
3435
+ case "undefined":
3436
+ return isArrayProp ? null : undefined;
3437
+ case "string":
3438
+ return JSON.stringify(val);
3439
+ default:
3440
+ return isFinite(val) ? val : null;
3441
+ }
3435
3442
  }
3436
- }
3437
3443
 
3438
- var fastStableStringify = function(val) {
3439
- var returnVal = stringify(val, false);
3440
- if (returnVal !== undefined) {
3441
- return ''+ returnVal;
3442
- }
3443
- };
3444
+ fastStableStringify$1 = function(val) {
3445
+ var returnVal = stringify(val, false);
3446
+ if (returnVal !== undefined) {
3447
+ return ''+ returnVal;
3448
+ }
3449
+ };
3450
+ return fastStableStringify$1;
3451
+ }
3444
3452
 
3445
- var fastStableStringify$1 = /*@__PURE__*/getDefaultExportFromCjs(fastStableStringify);
3453
+ var fastStableStringifyExports = /*@__PURE__*/ requireFastStableStringify();
3454
+ var fastStableStringify = /*@__PURE__*/getDefaultExportFromCjs(fastStableStringifyExports);
3446
3455
 
3447
3456
  const MINIMUM_SLOT_PER_EPOCH = 32;
3448
3457
 
@@ -4768,6 +4777,7 @@ const TokenBalanceResult = type({
4768
4777
  accountIndex: number(),
4769
4778
  mint: string(),
4770
4779
  owner: optional(string()),
4780
+ programId: optional(string()),
4771
4781
  uiTokenAmount: TokenAmountResult
4772
4782
  });
4773
4783
  const LoadedAddressesResult = type({
@@ -5297,7 +5307,7 @@ class Connection {
5297
5307
  config
5298
5308
  } = extractCommitmentFromConfig(commitmentOrConfig);
5299
5309
  const args = this._buildArgs([], commitment, undefined /* encoding */, config);
5300
- const requestHash = fastStableStringify$1(args);
5310
+ const requestHash = fastStableStringify(args);
5301
5311
  requestPromises[requestHash] = requestPromises[requestHash] ?? (async () => {
5302
5312
  try {
5303
5313
  const unsafeRes = await this._rpcRequest('getBlockHeight', args);
@@ -7616,9 +7626,10 @@ class Connection {
7616
7626
  this._subscriptionCallbacksByServerSubscriptionId[serverSubscriptionId] = subscription.callbacks;
7617
7627
  await this._updateSubscriptions();
7618
7628
  } catch (e) {
7619
- if (e instanceof Error) {
7620
- console.error(`${method} error for argument`, args, e.message);
7621
- }
7629
+ console.error(`Received ${e instanceof Error ? '' : 'JSON-RPC '}error calling \`${method}\``, {
7630
+ args,
7631
+ error: e
7632
+ });
7622
7633
  if (!isCurrentConnectionStillActive()) {
7623
7634
  return;
7624
7635
  }
@@ -7754,7 +7765,7 @@ class Connection {
7754
7765
  */
7755
7766
  args) {
7756
7767
  const clientSubscriptionId = this._nextClientSubscriptionId++;
7757
- const hash = fastStableStringify$1([subscriptionConfig.method, args]);
7768
+ const hash = fastStableStringify([subscriptionConfig.method, args]);
7758
7769
  const existingSubscription = this._subscriptionsByHash[hash];
7759
7770
  if (existingSubscription === undefined) {
7760
7771
  this._subscriptionsByHash[hash] = {