@solana/web3.js 1.73.5 → 1.74.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.
@@ -4416,7 +4416,7 @@ const LogsNotificationResult = type({
4416
4416
 
4417
4417
  /** @internal */
4418
4418
  const COMMON_HTTP_HEADERS = {
4419
- 'solana-client': `js/${"1.73.5" }`
4419
+ 'solana-client': `js/${"1.74.1" }`
4420
4420
  };
4421
4421
 
4422
4422
  /**
@@ -4480,7 +4480,7 @@ class Connection {
4480
4480
  * @param endpoint URL to the fullnode JSON RPC endpoint
4481
4481
  * @param commitmentOrConfig optional default commitment level or optional ConnectionConfig configuration object
4482
4482
  */
4483
- constructor(endpoint, commitmentOrConfig) {
4483
+ constructor(endpoint, _commitmentOrConfig) {
4484
4484
  this._commitment = void 0;
4485
4485
  this._confirmTransactionInitialTimeout = void 0;
4486
4486
  this._rpcEndpoint = void 0;
@@ -4508,23 +4508,47 @@ class Connection {
4508
4508
  this._subscriptionCallbacksByServerSubscriptionId = {};
4509
4509
  this._subscriptionsByHash = {};
4510
4510
  this._subscriptionsAutoDisposedByRpc = new Set();
4511
+ this.getBlockHeight = (() => {
4512
+ const requestPromises = {};
4513
+ return async commitmentOrConfig => {
4514
+ const {
4515
+ commitment,
4516
+ config
4517
+ } = extractCommitmentFromConfig(commitmentOrConfig);
4518
+ const args = this._buildArgs([], commitment, undefined /* encoding */, config);
4519
+ const requestHash = fastStableStringify$1(args);
4520
+ requestPromises[requestHash] = requestPromises[requestHash] ?? (async () => {
4521
+ try {
4522
+ const unsafeRes = await this._rpcRequest('getBlockHeight', args);
4523
+ const res = create(unsafeRes, jsonRpcResult(number()));
4524
+ if ('error' in res) {
4525
+ throw new SolanaJSONRPCError(res.error, 'failed to get block height information');
4526
+ }
4527
+ return res.result;
4528
+ } finally {
4529
+ delete requestPromises[requestHash];
4530
+ }
4531
+ })();
4532
+ return await requestPromises[requestHash];
4533
+ };
4534
+ })();
4511
4535
  let wsEndpoint;
4512
4536
  let httpHeaders;
4513
4537
  let fetch;
4514
4538
  let fetchMiddleware;
4515
4539
  let disableRetryOnRateLimit;
4516
4540
  let httpAgent;
4517
- if (commitmentOrConfig && typeof commitmentOrConfig === 'string') {
4518
- this._commitment = commitmentOrConfig;
4519
- } else if (commitmentOrConfig) {
4520
- this._commitment = commitmentOrConfig.commitment;
4521
- this._confirmTransactionInitialTimeout = commitmentOrConfig.confirmTransactionInitialTimeout;
4522
- wsEndpoint = commitmentOrConfig.wsEndpoint;
4523
- httpHeaders = commitmentOrConfig.httpHeaders;
4524
- fetch = commitmentOrConfig.fetch;
4525
- fetchMiddleware = commitmentOrConfig.fetchMiddleware;
4526
- disableRetryOnRateLimit = commitmentOrConfig.disableRetryOnRateLimit;
4527
- httpAgent = commitmentOrConfig.httpAgent;
4541
+ if (_commitmentOrConfig && typeof _commitmentOrConfig === 'string') {
4542
+ this._commitment = _commitmentOrConfig;
4543
+ } else if (_commitmentOrConfig) {
4544
+ this._commitment = _commitmentOrConfig.commitment;
4545
+ this._confirmTransactionInitialTimeout = _commitmentOrConfig.confirmTransactionInitialTimeout;
4546
+ wsEndpoint = _commitmentOrConfig.wsEndpoint;
4547
+ httpHeaders = _commitmentOrConfig.httpHeaders;
4548
+ fetch = _commitmentOrConfig.fetch;
4549
+ fetchMiddleware = _commitmentOrConfig.fetchMiddleware;
4550
+ disableRetryOnRateLimit = _commitmentOrConfig.disableRetryOnRateLimit;
4551
+ httpAgent = _commitmentOrConfig.httpAgent;
4528
4552
  }
4529
4553
  this._rpcEndpoint = assertEndpointUrl(endpoint);
4530
4554
  this._rpcWsEndpoint = wsEndpoint || makeWebsocketUrl(endpoint);
@@ -5782,19 +5806,6 @@ class Connection {
5782
5806
  /*
5783
5807
  * Returns the current block height of the node
5784
5808
  */
5785
- async getBlockHeight(commitmentOrConfig) {
5786
- const {
5787
- commitment,
5788
- config
5789
- } = extractCommitmentFromConfig(commitmentOrConfig);
5790
- const args = this._buildArgs([], commitment, undefined /* encoding */, config);
5791
- const unsafeRes = await this._rpcRequest('getBlockHeight', args);
5792
- const res = create(unsafeRes, jsonRpcResult(number()));
5793
- if ('error' in res) {
5794
- throw new SolanaJSONRPCError(res.error, 'failed to get block height information');
5795
- }
5796
- return res.result;
5797
- }
5798
5809
 
5799
5810
  /*
5800
5811
  * Returns recent block production information from the current or previous epoch