@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.
package/README.md CHANGED
@@ -23,7 +23,7 @@ Use this to interact with accounts and programs on the Solana network through th
23
23
  ### For use in Node.js or a web application
24
24
 
25
25
  ```
26
- $ npm install --save @solana/web3.js
26
+ $ npm install --save @solana/web3.js@1
27
27
  ```
28
28
 
29
29
  ### For use in a browser, without a build system
@@ -3394,81 +3394,90 @@ function getDefaultExportFromCjs (x) {
3394
3394
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
3395
3395
  }
3396
3396
 
3397
- var objToString = Object.prototype.toString;
3398
- var objKeys = Object.keys || function(obj) {
3399
- var keys = [];
3400
- for (var name in obj) {
3401
- keys.push(name);
3402
- }
3403
- return keys;
3404
- };
3397
+ var fastStableStringify$1;
3398
+ var hasRequiredFastStableStringify;
3399
+
3400
+ function requireFastStableStringify () {
3401
+ if (hasRequiredFastStableStringify) return fastStableStringify$1;
3402
+ hasRequiredFastStableStringify = 1;
3403
+ var objToString = Object.prototype.toString;
3404
+ var objKeys = Object.keys || function(obj) {
3405
+ var keys = [];
3406
+ for (var name in obj) {
3407
+ keys.push(name);
3408
+ }
3409
+ return keys;
3410
+ };
3405
3411
 
3406
- function stringify(val, isArrayProp) {
3407
- var i, max, str, keys, key, propVal, toStr;
3408
- if (val === true) {
3409
- return "true";
3410
- }
3411
- if (val === false) {
3412
- return "false";
3413
- }
3414
- switch (typeof val) {
3415
- case "object":
3416
- if (val === null) {
3417
- return null;
3418
- } else if (val.toJSON && typeof val.toJSON === "function") {
3419
- return stringify(val.toJSON(), isArrayProp);
3420
- } else {
3421
- toStr = objToString.call(val);
3422
- if (toStr === "[object Array]") {
3423
- str = '[';
3424
- max = val.length - 1;
3425
- for(i = 0; i < max; i++) {
3426
- str += stringify(val[i], true) + ',';
3427
- }
3428
- if (max > -1) {
3429
- str += stringify(val[i], true);
3430
- }
3431
- return str + ']';
3432
- } else if (toStr === "[object Object]") {
3433
- // only object is left
3434
- keys = objKeys(val).sort();
3435
- max = keys.length;
3436
- str = "";
3437
- i = 0;
3438
- while (i < max) {
3439
- key = keys[i];
3440
- propVal = stringify(val[key], false);
3441
- if (propVal !== undefined) {
3442
- if (str) {
3443
- str += ',';
3412
+ function stringify(val, isArrayProp) {
3413
+ var i, max, str, keys, key, propVal, toStr;
3414
+ if (val === true) {
3415
+ return "true";
3416
+ }
3417
+ if (val === false) {
3418
+ return "false";
3419
+ }
3420
+ switch (typeof val) {
3421
+ case "object":
3422
+ if (val === null) {
3423
+ return null;
3424
+ } else if (val.toJSON && typeof val.toJSON === "function") {
3425
+ return stringify(val.toJSON(), isArrayProp);
3426
+ } else {
3427
+ toStr = objToString.call(val);
3428
+ if (toStr === "[object Array]") {
3429
+ str = '[';
3430
+ max = val.length - 1;
3431
+ for(i = 0; i < max; i++) {
3432
+ str += stringify(val[i], true) + ',';
3433
+ }
3434
+ if (max > -1) {
3435
+ str += stringify(val[i], true);
3436
+ }
3437
+ return str + ']';
3438
+ } else if (toStr === "[object Object]") {
3439
+ // only object is left
3440
+ keys = objKeys(val).sort();
3441
+ max = keys.length;
3442
+ str = "";
3443
+ i = 0;
3444
+ while (i < max) {
3445
+ key = keys[i];
3446
+ propVal = stringify(val[key], false);
3447
+ if (propVal !== undefined) {
3448
+ if (str) {
3449
+ str += ',';
3450
+ }
3451
+ str += JSON.stringify(key) + ':' + propVal;
3444
3452
  }
3445
- str += JSON.stringify(key) + ':' + propVal;
3453
+ i++;
3446
3454
  }
3447
- i++;
3455
+ return '{' + str + '}';
3456
+ } else {
3457
+ return JSON.stringify(val);
3448
3458
  }
3449
- return '{' + str + '}';
3450
- } else {
3451
- return JSON.stringify(val);
3452
3459
  }
3453
- }
3454
- case "function":
3455
- case "undefined":
3456
- return isArrayProp ? null : undefined;
3457
- case "string":
3458
- return JSON.stringify(val);
3459
- default:
3460
- return isFinite(val) ? val : null;
3460
+ case "function":
3461
+ case "undefined":
3462
+ return isArrayProp ? null : undefined;
3463
+ case "string":
3464
+ return JSON.stringify(val);
3465
+ default:
3466
+ return isFinite(val) ? val : null;
3467
+ }
3461
3468
  }
3462
- }
3463
3469
 
3464
- var fastStableStringify = function(val) {
3465
- var returnVal = stringify(val, false);
3466
- if (returnVal !== undefined) {
3467
- return ''+ returnVal;
3468
- }
3469
- };
3470
+ fastStableStringify$1 = function(val) {
3471
+ var returnVal = stringify(val, false);
3472
+ if (returnVal !== undefined) {
3473
+ return ''+ returnVal;
3474
+ }
3475
+ };
3476
+ return fastStableStringify$1;
3477
+ }
3470
3478
 
3471
- var fastStableStringify$1 = /*@__PURE__*/getDefaultExportFromCjs(fastStableStringify);
3479
+ var fastStableStringifyExports = /*@__PURE__*/ requireFastStableStringify();
3480
+ var fastStableStringify = /*@__PURE__*/getDefaultExportFromCjs(fastStableStringifyExports);
3472
3481
 
3473
3482
  const MINIMUM_SLOT_PER_EPOCH = 32;
3474
3483
 
@@ -4794,6 +4803,7 @@ const TokenBalanceResult = superstruct.type({
4794
4803
  accountIndex: superstruct.number(),
4795
4804
  mint: superstruct.string(),
4796
4805
  owner: superstruct.optional(superstruct.string()),
4806
+ programId: superstruct.optional(superstruct.string()),
4797
4807
  uiTokenAmount: TokenAmountResult
4798
4808
  });
4799
4809
  const LoadedAddressesResult = superstruct.type({
@@ -5323,7 +5333,7 @@ class Connection {
5323
5333
  config
5324
5334
  } = extractCommitmentFromConfig(commitmentOrConfig);
5325
5335
  const args = this._buildArgs([], commitment, undefined /* encoding */, config);
5326
- const requestHash = fastStableStringify$1(args);
5336
+ const requestHash = fastStableStringify(args);
5327
5337
  requestPromises[requestHash] = requestPromises[requestHash] ?? (async () => {
5328
5338
  try {
5329
5339
  const unsafeRes = await this._rpcRequest('getBlockHeight', args);
@@ -7642,9 +7652,10 @@ class Connection {
7642
7652
  this._subscriptionCallbacksByServerSubscriptionId[serverSubscriptionId] = subscription.callbacks;
7643
7653
  await this._updateSubscriptions();
7644
7654
  } catch (e) {
7645
- if (e instanceof Error) {
7646
- console.error(`${method} error for argument`, args, e.message);
7647
- }
7655
+ console.error(`Received ${e instanceof Error ? '' : 'JSON-RPC '}error calling \`${method}\``, {
7656
+ args,
7657
+ error: e
7658
+ });
7648
7659
  if (!isCurrentConnectionStillActive()) {
7649
7660
  return;
7650
7661
  }
@@ -7780,7 +7791,7 @@ class Connection {
7780
7791
  */
7781
7792
  args) {
7782
7793
  const clientSubscriptionId = this._nextClientSubscriptionId++;
7783
- const hash = fastStableStringify$1([subscriptionConfig.method, args]);
7794
+ const hash = fastStableStringify([subscriptionConfig.method, args]);
7784
7795
  const existingSubscription = this._subscriptionsByHash[hash];
7785
7796
  if (existingSubscription === undefined) {
7786
7797
  this._subscriptionsByHash[hash] = {