@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.cjs.js
CHANGED
|
@@ -7016,7 +7016,7 @@ class Connection {
|
|
|
7016
7016
|
* @param endpoint URL to the fullnode JSON RPC endpoint
|
|
7017
7017
|
* @param commitmentOrConfig optional default commitment level or optional ConnectionConfig configuration object
|
|
7018
7018
|
*/
|
|
7019
|
-
constructor(endpoint,
|
|
7019
|
+
constructor(endpoint, _commitmentOrConfig) {
|
|
7020
7020
|
this._commitment = void 0;
|
|
7021
7021
|
this._confirmTransactionInitialTimeout = void 0;
|
|
7022
7022
|
this._rpcEndpoint = void 0;
|
|
@@ -7044,23 +7044,47 @@ class Connection {
|
|
|
7044
7044
|
this._subscriptionCallbacksByServerSubscriptionId = {};
|
|
7045
7045
|
this._subscriptionsByHash = {};
|
|
7046
7046
|
this._subscriptionsAutoDisposedByRpc = new Set();
|
|
7047
|
+
this.getBlockHeight = (() => {
|
|
7048
|
+
const requestPromises = {};
|
|
7049
|
+
return async commitmentOrConfig => {
|
|
7050
|
+
const {
|
|
7051
|
+
commitment,
|
|
7052
|
+
config
|
|
7053
|
+
} = extractCommitmentFromConfig(commitmentOrConfig);
|
|
7054
|
+
const args = this._buildArgs([], commitment, undefined /* encoding */, config);
|
|
7055
|
+
const requestHash = fastStableStringify$1(args);
|
|
7056
|
+
requestPromises[requestHash] = requestPromises[requestHash] ?? (async () => {
|
|
7057
|
+
try {
|
|
7058
|
+
const unsafeRes = await this._rpcRequest('getBlockHeight', args);
|
|
7059
|
+
const res = superstruct.create(unsafeRes, jsonRpcResult(superstruct.number()));
|
|
7060
|
+
if ('error' in res) {
|
|
7061
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get block height information');
|
|
7062
|
+
}
|
|
7063
|
+
return res.result;
|
|
7064
|
+
} finally {
|
|
7065
|
+
delete requestPromises[requestHash];
|
|
7066
|
+
}
|
|
7067
|
+
})();
|
|
7068
|
+
return await requestPromises[requestHash];
|
|
7069
|
+
};
|
|
7070
|
+
})();
|
|
7047
7071
|
let wsEndpoint;
|
|
7048
7072
|
let httpHeaders;
|
|
7049
7073
|
let fetch;
|
|
7050
7074
|
let fetchMiddleware;
|
|
7051
7075
|
let disableRetryOnRateLimit;
|
|
7052
7076
|
let httpAgent;
|
|
7053
|
-
if (
|
|
7054
|
-
this._commitment =
|
|
7055
|
-
} else if (
|
|
7056
|
-
this._commitment =
|
|
7057
|
-
this._confirmTransactionInitialTimeout =
|
|
7058
|
-
wsEndpoint =
|
|
7059
|
-
httpHeaders =
|
|
7060
|
-
fetch =
|
|
7061
|
-
fetchMiddleware =
|
|
7062
|
-
disableRetryOnRateLimit =
|
|
7063
|
-
httpAgent =
|
|
7077
|
+
if (_commitmentOrConfig && typeof _commitmentOrConfig === 'string') {
|
|
7078
|
+
this._commitment = _commitmentOrConfig;
|
|
7079
|
+
} else if (_commitmentOrConfig) {
|
|
7080
|
+
this._commitment = _commitmentOrConfig.commitment;
|
|
7081
|
+
this._confirmTransactionInitialTimeout = _commitmentOrConfig.confirmTransactionInitialTimeout;
|
|
7082
|
+
wsEndpoint = _commitmentOrConfig.wsEndpoint;
|
|
7083
|
+
httpHeaders = _commitmentOrConfig.httpHeaders;
|
|
7084
|
+
fetch = _commitmentOrConfig.fetch;
|
|
7085
|
+
fetchMiddleware = _commitmentOrConfig.fetchMiddleware;
|
|
7086
|
+
disableRetryOnRateLimit = _commitmentOrConfig.disableRetryOnRateLimit;
|
|
7087
|
+
httpAgent = _commitmentOrConfig.httpAgent;
|
|
7064
7088
|
}
|
|
7065
7089
|
this._rpcEndpoint = assertEndpointUrl(endpoint);
|
|
7066
7090
|
this._rpcWsEndpoint = wsEndpoint || makeWebsocketUrl(endpoint);
|
|
@@ -8318,19 +8342,6 @@ class Connection {
|
|
|
8318
8342
|
/*
|
|
8319
8343
|
* Returns the current block height of the node
|
|
8320
8344
|
*/
|
|
8321
|
-
async getBlockHeight(commitmentOrConfig) {
|
|
8322
|
-
const {
|
|
8323
|
-
commitment,
|
|
8324
|
-
config
|
|
8325
|
-
} = extractCommitmentFromConfig(commitmentOrConfig);
|
|
8326
|
-
const args = this._buildArgs([], commitment, undefined /* encoding */, config);
|
|
8327
|
-
const unsafeRes = await this._rpcRequest('getBlockHeight', args);
|
|
8328
|
-
const res = superstruct.create(unsafeRes, jsonRpcResult(superstruct.number()));
|
|
8329
|
-
if ('error' in res) {
|
|
8330
|
-
throw new SolanaJSONRPCError(res.error, 'failed to get block height information');
|
|
8331
|
-
}
|
|
8332
|
-
return res.result;
|
|
8333
|
-
}
|
|
8334
8345
|
|
|
8335
8346
|
/*
|
|
8336
8347
|
* Returns recent block production information from the current or previous epoch
|
|
@@ -8996,7 +9007,7 @@ class Connection {
|
|
|
8996
9007
|
throw new Error('Invalid arguments');
|
|
8997
9008
|
}
|
|
8998
9009
|
const wireTransaction = transaction.serialize();
|
|
8999
|
-
return await this.sendRawTransaction(wireTransaction,
|
|
9010
|
+
return await this.sendRawTransaction(wireTransaction, signersOrOptions);
|
|
9000
9011
|
}
|
|
9001
9012
|
if (signersOrOptions === undefined || !Array.isArray(signersOrOptions)) {
|
|
9002
9013
|
throw new Error('Invalid arguments');
|