@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.
- 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 +1 -1
- package/src/connection.ts +33 -21
package/package.json
CHANGED
package/src/connection.ts
CHANGED
|
@@ -4739,28 +4739,40 @@ export class Connection {
|
|
|
4739
4739
|
/*
|
|
4740
4740
|
* Returns the current block height of the node
|
|
4741
4741
|
*/
|
|
4742
|
-
|
|
4743
|
-
|
|
4744
|
-
|
|
4745
|
-
|
|
4746
|
-
|
|
4747
|
-
|
|
4748
|
-
|
|
4749
|
-
|
|
4750
|
-
|
|
4751
|
-
|
|
4752
|
-
|
|
4753
|
-
|
|
4754
|
-
const res = create(unsafeRes, jsonRpcResult(number()));
|
|
4755
|
-
if ('error' in res) {
|
|
4756
|
-
throw new SolanaJSONRPCError(
|
|
4757
|
-
res.error,
|
|
4758
|
-
'failed to get block height information',
|
|
4742
|
+
getBlockHeight = (() => {
|
|
4743
|
+
const requestPromises: {[hash: string]: Promise<number>} = {};
|
|
4744
|
+
return async (
|
|
4745
|
+
commitmentOrConfig?: Commitment | GetBlockHeightConfig,
|
|
4746
|
+
): Promise<number> => {
|
|
4747
|
+
const {commitment, config} =
|
|
4748
|
+
extractCommitmentFromConfig(commitmentOrConfig);
|
|
4749
|
+
const args = this._buildArgs(
|
|
4750
|
+
[],
|
|
4751
|
+
commitment,
|
|
4752
|
+
undefined /* encoding */,
|
|
4753
|
+
config,
|
|
4759
4754
|
);
|
|
4760
|
-
|
|
4761
|
-
|
|
4762
|
-
|
|
4763
|
-
|
|
4755
|
+
const requestHash = fastStableStringify(args);
|
|
4756
|
+
requestPromises[requestHash] =
|
|
4757
|
+
requestPromises[requestHash] ??
|
|
4758
|
+
(async () => {
|
|
4759
|
+
try {
|
|
4760
|
+
const unsafeRes = await this._rpcRequest('getBlockHeight', args);
|
|
4761
|
+
const res = create(unsafeRes, jsonRpcResult(number()));
|
|
4762
|
+
if ('error' in res) {
|
|
4763
|
+
throw new SolanaJSONRPCError(
|
|
4764
|
+
res.error,
|
|
4765
|
+
'failed to get block height information',
|
|
4766
|
+
);
|
|
4767
|
+
}
|
|
4768
|
+
return res.result;
|
|
4769
|
+
} finally {
|
|
4770
|
+
delete requestPromises[requestHash];
|
|
4771
|
+
}
|
|
4772
|
+
})();
|
|
4773
|
+
return await requestPromises[requestHash];
|
|
4774
|
+
};
|
|
4775
|
+
})();
|
|
4764
4776
|
|
|
4765
4777
|
/*
|
|
4766
4778
|
* Returns recent block production information from the current or previous epoch
|