@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/README.md +0 -3
- package/lib/index.browser.cjs.js +37 -26
- package/lib/index.browser.cjs.js.map +1 -1
- package/lib/index.browser.esm.js +37 -26
- package/lib/index.browser.esm.js.map +1 -1
- package/lib/index.cjs.js +37 -26
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.esm.js +37 -26
- package/lib/index.esm.js.map +1 -1
- package/lib/index.iife.js +37 -26
- package/lib/index.iife.js.map +1 -1
- package/lib/index.iife.min.js +1 -1
- package/lib/index.iife.min.js.map +1 -1
- package/lib/index.native.js +37 -26
- package/lib/index.native.js.map +1 -1
- package/package.json +4 -7
- package/src/connection.ts +34 -22
package/lib/index.browser.esm.js
CHANGED
|
@@ -4460,7 +4460,7 @@ class Connection {
|
|
|
4460
4460
|
* @param endpoint URL to the fullnode JSON RPC endpoint
|
|
4461
4461
|
* @param commitmentOrConfig optional default commitment level or optional ConnectionConfig configuration object
|
|
4462
4462
|
*/
|
|
4463
|
-
constructor(endpoint,
|
|
4463
|
+
constructor(endpoint, _commitmentOrConfig) {
|
|
4464
4464
|
this._commitment = void 0;
|
|
4465
4465
|
this._confirmTransactionInitialTimeout = void 0;
|
|
4466
4466
|
this._rpcEndpoint = void 0;
|
|
@@ -4488,23 +4488,47 @@ class Connection {
|
|
|
4488
4488
|
this._subscriptionCallbacksByServerSubscriptionId = {};
|
|
4489
4489
|
this._subscriptionsByHash = {};
|
|
4490
4490
|
this._subscriptionsAutoDisposedByRpc = new Set();
|
|
4491
|
+
this.getBlockHeight = (() => {
|
|
4492
|
+
const requestPromises = {};
|
|
4493
|
+
return async commitmentOrConfig => {
|
|
4494
|
+
const {
|
|
4495
|
+
commitment,
|
|
4496
|
+
config
|
|
4497
|
+
} = extractCommitmentFromConfig(commitmentOrConfig);
|
|
4498
|
+
const args = this._buildArgs([], commitment, undefined /* encoding */, config);
|
|
4499
|
+
const requestHash = fastStableStringify$1(args);
|
|
4500
|
+
requestPromises[requestHash] = requestPromises[requestHash] ?? (async () => {
|
|
4501
|
+
try {
|
|
4502
|
+
const unsafeRes = await this._rpcRequest('getBlockHeight', args);
|
|
4503
|
+
const res = create(unsafeRes, jsonRpcResult(number()));
|
|
4504
|
+
if ('error' in res) {
|
|
4505
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get block height information');
|
|
4506
|
+
}
|
|
4507
|
+
return res.result;
|
|
4508
|
+
} finally {
|
|
4509
|
+
delete requestPromises[requestHash];
|
|
4510
|
+
}
|
|
4511
|
+
})();
|
|
4512
|
+
return await requestPromises[requestHash];
|
|
4513
|
+
};
|
|
4514
|
+
})();
|
|
4491
4515
|
let wsEndpoint;
|
|
4492
4516
|
let httpHeaders;
|
|
4493
4517
|
let fetch;
|
|
4494
4518
|
let fetchMiddleware;
|
|
4495
4519
|
let disableRetryOnRateLimit;
|
|
4496
4520
|
let httpAgent;
|
|
4497
|
-
if (
|
|
4498
|
-
this._commitment =
|
|
4499
|
-
} else if (
|
|
4500
|
-
this._commitment =
|
|
4501
|
-
this._confirmTransactionInitialTimeout =
|
|
4502
|
-
wsEndpoint =
|
|
4503
|
-
httpHeaders =
|
|
4504
|
-
fetch =
|
|
4505
|
-
fetchMiddleware =
|
|
4506
|
-
disableRetryOnRateLimit =
|
|
4507
|
-
httpAgent =
|
|
4521
|
+
if (_commitmentOrConfig && typeof _commitmentOrConfig === 'string') {
|
|
4522
|
+
this._commitment = _commitmentOrConfig;
|
|
4523
|
+
} else if (_commitmentOrConfig) {
|
|
4524
|
+
this._commitment = _commitmentOrConfig.commitment;
|
|
4525
|
+
this._confirmTransactionInitialTimeout = _commitmentOrConfig.confirmTransactionInitialTimeout;
|
|
4526
|
+
wsEndpoint = _commitmentOrConfig.wsEndpoint;
|
|
4527
|
+
httpHeaders = _commitmentOrConfig.httpHeaders;
|
|
4528
|
+
fetch = _commitmentOrConfig.fetch;
|
|
4529
|
+
fetchMiddleware = _commitmentOrConfig.fetchMiddleware;
|
|
4530
|
+
disableRetryOnRateLimit = _commitmentOrConfig.disableRetryOnRateLimit;
|
|
4531
|
+
httpAgent = _commitmentOrConfig.httpAgent;
|
|
4508
4532
|
}
|
|
4509
4533
|
this._rpcEndpoint = assertEndpointUrl(endpoint);
|
|
4510
4534
|
this._rpcWsEndpoint = wsEndpoint || makeWebsocketUrl(endpoint);
|
|
@@ -5762,19 +5786,6 @@ class Connection {
|
|
|
5762
5786
|
/*
|
|
5763
5787
|
* Returns the current block height of the node
|
|
5764
5788
|
*/
|
|
5765
|
-
async getBlockHeight(commitmentOrConfig) {
|
|
5766
|
-
const {
|
|
5767
|
-
commitment,
|
|
5768
|
-
config
|
|
5769
|
-
} = extractCommitmentFromConfig(commitmentOrConfig);
|
|
5770
|
-
const args = this._buildArgs([], commitment, undefined /* encoding */, config);
|
|
5771
|
-
const unsafeRes = await this._rpcRequest('getBlockHeight', args);
|
|
5772
|
-
const res = create(unsafeRes, jsonRpcResult(number()));
|
|
5773
|
-
if ('error' in res) {
|
|
5774
|
-
throw new SolanaJSONRPCError(res.error, 'failed to get block height information');
|
|
5775
|
-
}
|
|
5776
|
-
return res.result;
|
|
5777
|
-
}
|
|
5778
5789
|
|
|
5779
5790
|
/*
|
|
5780
5791
|
* Returns recent block production information from the current or previous epoch
|
|
@@ -6440,7 +6451,7 @@ class Connection {
|
|
|
6440
6451
|
throw new Error('Invalid arguments');
|
|
6441
6452
|
}
|
|
6442
6453
|
const wireTransaction = transaction.serialize();
|
|
6443
|
-
return await this.sendRawTransaction(wireTransaction,
|
|
6454
|
+
return await this.sendRawTransaction(wireTransaction, signersOrOptions);
|
|
6444
6455
|
}
|
|
6445
6456
|
if (signersOrOptions === undefined || !Array.isArray(signersOrOptions)) {
|
|
6446
6457
|
throw new Error('Invalid arguments');
|