@solana/web3.js 1.73.3 → 1.74.0

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.iife.js CHANGED
@@ -18293,7 +18293,7 @@ var solanaWeb3 = (function (exports) {
18293
18293
  * @param endpoint URL to the fullnode JSON RPC endpoint
18294
18294
  * @param commitmentOrConfig optional default commitment level or optional ConnectionConfig configuration object
18295
18295
  */
18296
- constructor(endpoint, commitmentOrConfig) {
18296
+ constructor(endpoint, _commitmentOrConfig) {
18297
18297
  this._commitment = void 0;
18298
18298
  this._confirmTransactionInitialTimeout = void 0;
18299
18299
  this._rpcEndpoint = void 0;
@@ -18321,23 +18321,47 @@ var solanaWeb3 = (function (exports) {
18321
18321
  this._subscriptionCallbacksByServerSubscriptionId = {};
18322
18322
  this._subscriptionsByHash = {};
18323
18323
  this._subscriptionsAutoDisposedByRpc = new Set();
18324
+ this.getBlockHeight = (() => {
18325
+ const requestPromises = {};
18326
+ return async commitmentOrConfig => {
18327
+ const {
18328
+ commitment,
18329
+ config
18330
+ } = extractCommitmentFromConfig(commitmentOrConfig);
18331
+ const args = this._buildArgs([], commitment, undefined /* encoding */, config);
18332
+ const requestHash = fastStableStringify$1(args);
18333
+ requestPromises[requestHash] = requestPromises[requestHash] ?? (async () => {
18334
+ try {
18335
+ const unsafeRes = await this._rpcRequest('getBlockHeight', args);
18336
+ const res = create(unsafeRes, jsonRpcResult(number()));
18337
+ if ('error' in res) {
18338
+ throw new SolanaJSONRPCError(res.error, 'failed to get block height information');
18339
+ }
18340
+ return res.result;
18341
+ } finally {
18342
+ delete requestPromises[requestHash];
18343
+ }
18344
+ })();
18345
+ return await requestPromises[requestHash];
18346
+ };
18347
+ })();
18324
18348
  let wsEndpoint;
18325
18349
  let httpHeaders;
18326
18350
  let fetch;
18327
18351
  let fetchMiddleware;
18328
18352
  let disableRetryOnRateLimit;
18329
18353
  let httpAgent;
18330
- if (commitmentOrConfig && typeof commitmentOrConfig === 'string') {
18331
- this._commitment = commitmentOrConfig;
18332
- } else if (commitmentOrConfig) {
18333
- this._commitment = commitmentOrConfig.commitment;
18334
- this._confirmTransactionInitialTimeout = commitmentOrConfig.confirmTransactionInitialTimeout;
18335
- wsEndpoint = commitmentOrConfig.wsEndpoint;
18336
- httpHeaders = commitmentOrConfig.httpHeaders;
18337
- fetch = commitmentOrConfig.fetch;
18338
- fetchMiddleware = commitmentOrConfig.fetchMiddleware;
18339
- disableRetryOnRateLimit = commitmentOrConfig.disableRetryOnRateLimit;
18340
- httpAgent = commitmentOrConfig.httpAgent;
18354
+ if (_commitmentOrConfig && typeof _commitmentOrConfig === 'string') {
18355
+ this._commitment = _commitmentOrConfig;
18356
+ } else if (_commitmentOrConfig) {
18357
+ this._commitment = _commitmentOrConfig.commitment;
18358
+ this._confirmTransactionInitialTimeout = _commitmentOrConfig.confirmTransactionInitialTimeout;
18359
+ wsEndpoint = _commitmentOrConfig.wsEndpoint;
18360
+ httpHeaders = _commitmentOrConfig.httpHeaders;
18361
+ fetch = _commitmentOrConfig.fetch;
18362
+ fetchMiddleware = _commitmentOrConfig.fetchMiddleware;
18363
+ disableRetryOnRateLimit = _commitmentOrConfig.disableRetryOnRateLimit;
18364
+ httpAgent = _commitmentOrConfig.httpAgent;
18341
18365
  }
18342
18366
  this._rpcEndpoint = assertEndpointUrl(endpoint);
18343
18367
  this._rpcWsEndpoint = wsEndpoint || makeWebsocketUrl(endpoint);
@@ -19595,19 +19619,6 @@ var solanaWeb3 = (function (exports) {
19595
19619
  /*
19596
19620
  * Returns the current block height of the node
19597
19621
  */
19598
- async getBlockHeight(commitmentOrConfig) {
19599
- const {
19600
- commitment,
19601
- config
19602
- } = extractCommitmentFromConfig(commitmentOrConfig);
19603
- const args = this._buildArgs([], commitment, undefined /* encoding */, config);
19604
- const unsafeRes = await this._rpcRequest('getBlockHeight', args);
19605
- const res = create(unsafeRes, jsonRpcResult(number()));
19606
- if ('error' in res) {
19607
- throw new SolanaJSONRPCError(res.error, 'failed to get block height information');
19608
- }
19609
- return res.result;
19610
- }
19611
19622
 
19612
19623
  /*
19613
19624
  * Returns recent block production information from the current or previous epoch
@@ -20273,7 +20284,7 @@ var solanaWeb3 = (function (exports) {
20273
20284
  throw new Error('Invalid arguments');
20274
20285
  }
20275
20286
  const wireTransaction = transaction.serialize();
20276
- return await this.sendRawTransaction(wireTransaction, options);
20287
+ return await this.sendRawTransaction(wireTransaction, signersOrOptions);
20277
20288
  }
20278
20289
  if (signersOrOptions === undefined || !Array.isArray(signersOrOptions)) {
20279
20290
  throw new Error('Invalid arguments');