@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.d.ts
CHANGED
|
@@ -3355,7 +3355,7 @@ export class Connection {
|
|
|
3355
3355
|
getParsedBlock(slot: number, rawConfig: GetVersionedBlockConfig & {
|
|
3356
3356
|
transactionDetails: 'none';
|
|
3357
3357
|
}): Promise<ParsedNoneModeBlockResponse>;
|
|
3358
|
-
getBlockHeight(commitmentOrConfig?: Commitment | GetBlockHeightConfig)
|
|
3358
|
+
getBlockHeight: (commitmentOrConfig?: Commitment | GetBlockHeightConfig) => Promise<number>;
|
|
3359
3359
|
getBlockProduction(configOrCommitment?: GetBlockProductionConfig | Commitment): Promise<RpcResponseAndContext<BlockProduction>>;
|
|
3360
3360
|
/**
|
|
3361
3361
|
* Fetch a confirmed or finalized transaction from the cluster.
|
package/lib/index.esm.js
CHANGED
|
@@ -6933,7 +6933,7 @@ const LogsNotificationResult = type({
|
|
|
6933
6933
|
|
|
6934
6934
|
/** @internal */
|
|
6935
6935
|
const COMMON_HTTP_HEADERS = {
|
|
6936
|
-
'solana-client': `js/${"1.
|
|
6936
|
+
'solana-client': `js/${"1.74.1" }`
|
|
6937
6937
|
};
|
|
6938
6938
|
|
|
6939
6939
|
/**
|
|
@@ -6997,7 +6997,7 @@ class Connection {
|
|
|
6997
6997
|
* @param endpoint URL to the fullnode JSON RPC endpoint
|
|
6998
6998
|
* @param commitmentOrConfig optional default commitment level or optional ConnectionConfig configuration object
|
|
6999
6999
|
*/
|
|
7000
|
-
constructor(endpoint,
|
|
7000
|
+
constructor(endpoint, _commitmentOrConfig) {
|
|
7001
7001
|
this._commitment = void 0;
|
|
7002
7002
|
this._confirmTransactionInitialTimeout = void 0;
|
|
7003
7003
|
this._rpcEndpoint = void 0;
|
|
@@ -7025,23 +7025,47 @@ class Connection {
|
|
|
7025
7025
|
this._subscriptionCallbacksByServerSubscriptionId = {};
|
|
7026
7026
|
this._subscriptionsByHash = {};
|
|
7027
7027
|
this._subscriptionsAutoDisposedByRpc = new Set();
|
|
7028
|
+
this.getBlockHeight = (() => {
|
|
7029
|
+
const requestPromises = {};
|
|
7030
|
+
return async commitmentOrConfig => {
|
|
7031
|
+
const {
|
|
7032
|
+
commitment,
|
|
7033
|
+
config
|
|
7034
|
+
} = extractCommitmentFromConfig(commitmentOrConfig);
|
|
7035
|
+
const args = this._buildArgs([], commitment, undefined /* encoding */, config);
|
|
7036
|
+
const requestHash = fastStableStringify$1(args);
|
|
7037
|
+
requestPromises[requestHash] = requestPromises[requestHash] ?? (async () => {
|
|
7038
|
+
try {
|
|
7039
|
+
const unsafeRes = await this._rpcRequest('getBlockHeight', args);
|
|
7040
|
+
const res = create(unsafeRes, jsonRpcResult(number()));
|
|
7041
|
+
if ('error' in res) {
|
|
7042
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get block height information');
|
|
7043
|
+
}
|
|
7044
|
+
return res.result;
|
|
7045
|
+
} finally {
|
|
7046
|
+
delete requestPromises[requestHash];
|
|
7047
|
+
}
|
|
7048
|
+
})();
|
|
7049
|
+
return await requestPromises[requestHash];
|
|
7050
|
+
};
|
|
7051
|
+
})();
|
|
7028
7052
|
let wsEndpoint;
|
|
7029
7053
|
let httpHeaders;
|
|
7030
7054
|
let fetch;
|
|
7031
7055
|
let fetchMiddleware;
|
|
7032
7056
|
let disableRetryOnRateLimit;
|
|
7033
7057
|
let httpAgent;
|
|
7034
|
-
if (
|
|
7035
|
-
this._commitment =
|
|
7036
|
-
} else if (
|
|
7037
|
-
this._commitment =
|
|
7038
|
-
this._confirmTransactionInitialTimeout =
|
|
7039
|
-
wsEndpoint =
|
|
7040
|
-
httpHeaders =
|
|
7041
|
-
fetch =
|
|
7042
|
-
fetchMiddleware =
|
|
7043
|
-
disableRetryOnRateLimit =
|
|
7044
|
-
httpAgent =
|
|
7058
|
+
if (_commitmentOrConfig && typeof _commitmentOrConfig === 'string') {
|
|
7059
|
+
this._commitment = _commitmentOrConfig;
|
|
7060
|
+
} else if (_commitmentOrConfig) {
|
|
7061
|
+
this._commitment = _commitmentOrConfig.commitment;
|
|
7062
|
+
this._confirmTransactionInitialTimeout = _commitmentOrConfig.confirmTransactionInitialTimeout;
|
|
7063
|
+
wsEndpoint = _commitmentOrConfig.wsEndpoint;
|
|
7064
|
+
httpHeaders = _commitmentOrConfig.httpHeaders;
|
|
7065
|
+
fetch = _commitmentOrConfig.fetch;
|
|
7066
|
+
fetchMiddleware = _commitmentOrConfig.fetchMiddleware;
|
|
7067
|
+
disableRetryOnRateLimit = _commitmentOrConfig.disableRetryOnRateLimit;
|
|
7068
|
+
httpAgent = _commitmentOrConfig.httpAgent;
|
|
7045
7069
|
}
|
|
7046
7070
|
this._rpcEndpoint = assertEndpointUrl(endpoint);
|
|
7047
7071
|
this._rpcWsEndpoint = wsEndpoint || makeWebsocketUrl(endpoint);
|
|
@@ -8299,19 +8323,6 @@ class Connection {
|
|
|
8299
8323
|
/*
|
|
8300
8324
|
* Returns the current block height of the node
|
|
8301
8325
|
*/
|
|
8302
|
-
async getBlockHeight(commitmentOrConfig) {
|
|
8303
|
-
const {
|
|
8304
|
-
commitment,
|
|
8305
|
-
config
|
|
8306
|
-
} = extractCommitmentFromConfig(commitmentOrConfig);
|
|
8307
|
-
const args = this._buildArgs([], commitment, undefined /* encoding */, config);
|
|
8308
|
-
const unsafeRes = await this._rpcRequest('getBlockHeight', args);
|
|
8309
|
-
const res = create(unsafeRes, jsonRpcResult(number()));
|
|
8310
|
-
if ('error' in res) {
|
|
8311
|
-
throw new SolanaJSONRPCError(res.error, 'failed to get block height information');
|
|
8312
|
-
}
|
|
8313
|
-
return res.result;
|
|
8314
|
-
}
|
|
8315
8326
|
|
|
8316
8327
|
/*
|
|
8317
8328
|
* Returns recent block production information from the current or previous epoch
|