@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/lib/index.cjs.js
CHANGED
|
@@ -6972,7 +6972,7 @@ const LogsNotificationResult = superstruct.type({
|
|
|
6972
6972
|
|
|
6973
6973
|
/** @internal */
|
|
6974
6974
|
const COMMON_HTTP_HEADERS = {
|
|
6975
|
-
'solana-client': `js/${"1.
|
|
6975
|
+
'solana-client': `js/${"1.74.1" }`
|
|
6976
6976
|
};
|
|
6977
6977
|
|
|
6978
6978
|
/**
|
|
@@ -7036,7 +7036,7 @@ class Connection {
|
|
|
7036
7036
|
* @param endpoint URL to the fullnode JSON RPC endpoint
|
|
7037
7037
|
* @param commitmentOrConfig optional default commitment level or optional ConnectionConfig configuration object
|
|
7038
7038
|
*/
|
|
7039
|
-
constructor(endpoint,
|
|
7039
|
+
constructor(endpoint, _commitmentOrConfig) {
|
|
7040
7040
|
this._commitment = void 0;
|
|
7041
7041
|
this._confirmTransactionInitialTimeout = void 0;
|
|
7042
7042
|
this._rpcEndpoint = void 0;
|
|
@@ -7064,23 +7064,47 @@ class Connection {
|
|
|
7064
7064
|
this._subscriptionCallbacksByServerSubscriptionId = {};
|
|
7065
7065
|
this._subscriptionsByHash = {};
|
|
7066
7066
|
this._subscriptionsAutoDisposedByRpc = new Set();
|
|
7067
|
+
this.getBlockHeight = (() => {
|
|
7068
|
+
const requestPromises = {};
|
|
7069
|
+
return async commitmentOrConfig => {
|
|
7070
|
+
const {
|
|
7071
|
+
commitment,
|
|
7072
|
+
config
|
|
7073
|
+
} = extractCommitmentFromConfig(commitmentOrConfig);
|
|
7074
|
+
const args = this._buildArgs([], commitment, undefined /* encoding */, config);
|
|
7075
|
+
const requestHash = fastStableStringify$1(args);
|
|
7076
|
+
requestPromises[requestHash] = requestPromises[requestHash] ?? (async () => {
|
|
7077
|
+
try {
|
|
7078
|
+
const unsafeRes = await this._rpcRequest('getBlockHeight', args);
|
|
7079
|
+
const res = superstruct.create(unsafeRes, jsonRpcResult(superstruct.number()));
|
|
7080
|
+
if ('error' in res) {
|
|
7081
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get block height information');
|
|
7082
|
+
}
|
|
7083
|
+
return res.result;
|
|
7084
|
+
} finally {
|
|
7085
|
+
delete requestPromises[requestHash];
|
|
7086
|
+
}
|
|
7087
|
+
})();
|
|
7088
|
+
return await requestPromises[requestHash];
|
|
7089
|
+
};
|
|
7090
|
+
})();
|
|
7067
7091
|
let wsEndpoint;
|
|
7068
7092
|
let httpHeaders;
|
|
7069
7093
|
let fetch;
|
|
7070
7094
|
let fetchMiddleware;
|
|
7071
7095
|
let disableRetryOnRateLimit;
|
|
7072
7096
|
let httpAgent;
|
|
7073
|
-
if (
|
|
7074
|
-
this._commitment =
|
|
7075
|
-
} else if (
|
|
7076
|
-
this._commitment =
|
|
7077
|
-
this._confirmTransactionInitialTimeout =
|
|
7078
|
-
wsEndpoint =
|
|
7079
|
-
httpHeaders =
|
|
7080
|
-
fetch =
|
|
7081
|
-
fetchMiddleware =
|
|
7082
|
-
disableRetryOnRateLimit =
|
|
7083
|
-
httpAgent =
|
|
7097
|
+
if (_commitmentOrConfig && typeof _commitmentOrConfig === 'string') {
|
|
7098
|
+
this._commitment = _commitmentOrConfig;
|
|
7099
|
+
} else if (_commitmentOrConfig) {
|
|
7100
|
+
this._commitment = _commitmentOrConfig.commitment;
|
|
7101
|
+
this._confirmTransactionInitialTimeout = _commitmentOrConfig.confirmTransactionInitialTimeout;
|
|
7102
|
+
wsEndpoint = _commitmentOrConfig.wsEndpoint;
|
|
7103
|
+
httpHeaders = _commitmentOrConfig.httpHeaders;
|
|
7104
|
+
fetch = _commitmentOrConfig.fetch;
|
|
7105
|
+
fetchMiddleware = _commitmentOrConfig.fetchMiddleware;
|
|
7106
|
+
disableRetryOnRateLimit = _commitmentOrConfig.disableRetryOnRateLimit;
|
|
7107
|
+
httpAgent = _commitmentOrConfig.httpAgent;
|
|
7084
7108
|
}
|
|
7085
7109
|
this._rpcEndpoint = assertEndpointUrl(endpoint);
|
|
7086
7110
|
this._rpcWsEndpoint = wsEndpoint || makeWebsocketUrl(endpoint);
|
|
@@ -8338,19 +8362,6 @@ class Connection {
|
|
|
8338
8362
|
/*
|
|
8339
8363
|
* Returns the current block height of the node
|
|
8340
8364
|
*/
|
|
8341
|
-
async getBlockHeight(commitmentOrConfig) {
|
|
8342
|
-
const {
|
|
8343
|
-
commitment,
|
|
8344
|
-
config
|
|
8345
|
-
} = extractCommitmentFromConfig(commitmentOrConfig);
|
|
8346
|
-
const args = this._buildArgs([], commitment, undefined /* encoding */, config);
|
|
8347
|
-
const unsafeRes = await this._rpcRequest('getBlockHeight', args);
|
|
8348
|
-
const res = superstruct.create(unsafeRes, jsonRpcResult(superstruct.number()));
|
|
8349
|
-
if ('error' in res) {
|
|
8350
|
-
throw new SolanaJSONRPCError(res.error, 'failed to get block height information');
|
|
8351
|
-
}
|
|
8352
|
-
return res.result;
|
|
8353
|
-
}
|
|
8354
8365
|
|
|
8355
8366
|
/*
|
|
8356
8367
|
* Returns recent block production information from the current or previous epoch
|