@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.native.js
CHANGED
|
@@ -4492,7 +4492,7 @@ class Connection {
|
|
|
4492
4492
|
* @param endpoint URL to the fullnode JSON RPC endpoint
|
|
4493
4493
|
* @param commitmentOrConfig optional default commitment level or optional ConnectionConfig configuration object
|
|
4494
4494
|
*/
|
|
4495
|
-
constructor(endpoint,
|
|
4495
|
+
constructor(endpoint, _commitmentOrConfig) {
|
|
4496
4496
|
this._commitment = void 0;
|
|
4497
4497
|
this._confirmTransactionInitialTimeout = void 0;
|
|
4498
4498
|
this._rpcEndpoint = void 0;
|
|
@@ -4520,23 +4520,47 @@ class Connection {
|
|
|
4520
4520
|
this._subscriptionCallbacksByServerSubscriptionId = {};
|
|
4521
4521
|
this._subscriptionsByHash = {};
|
|
4522
4522
|
this._subscriptionsAutoDisposedByRpc = new Set();
|
|
4523
|
+
this.getBlockHeight = (() => {
|
|
4524
|
+
const requestPromises = {};
|
|
4525
|
+
return async commitmentOrConfig => {
|
|
4526
|
+
const {
|
|
4527
|
+
commitment,
|
|
4528
|
+
config
|
|
4529
|
+
} = extractCommitmentFromConfig(commitmentOrConfig);
|
|
4530
|
+
const args = this._buildArgs([], commitment, undefined /* encoding */, config);
|
|
4531
|
+
const requestHash = fastStableStringify$1(args);
|
|
4532
|
+
requestPromises[requestHash] = requestPromises[requestHash] ?? (async () => {
|
|
4533
|
+
try {
|
|
4534
|
+
const unsafeRes = await this._rpcRequest('getBlockHeight', args);
|
|
4535
|
+
const res = superstruct.create(unsafeRes, jsonRpcResult(superstruct.number()));
|
|
4536
|
+
if ('error' in res) {
|
|
4537
|
+
throw new SolanaJSONRPCError(res.error, 'failed to get block height information');
|
|
4538
|
+
}
|
|
4539
|
+
return res.result;
|
|
4540
|
+
} finally {
|
|
4541
|
+
delete requestPromises[requestHash];
|
|
4542
|
+
}
|
|
4543
|
+
})();
|
|
4544
|
+
return await requestPromises[requestHash];
|
|
4545
|
+
};
|
|
4546
|
+
})();
|
|
4523
4547
|
let wsEndpoint;
|
|
4524
4548
|
let httpHeaders;
|
|
4525
4549
|
let fetch;
|
|
4526
4550
|
let fetchMiddleware;
|
|
4527
4551
|
let disableRetryOnRateLimit;
|
|
4528
4552
|
let httpAgent;
|
|
4529
|
-
if (
|
|
4530
|
-
this._commitment =
|
|
4531
|
-
} else if (
|
|
4532
|
-
this._commitment =
|
|
4533
|
-
this._confirmTransactionInitialTimeout =
|
|
4534
|
-
wsEndpoint =
|
|
4535
|
-
httpHeaders =
|
|
4536
|
-
fetch =
|
|
4537
|
-
fetchMiddleware =
|
|
4538
|
-
disableRetryOnRateLimit =
|
|
4539
|
-
httpAgent =
|
|
4553
|
+
if (_commitmentOrConfig && typeof _commitmentOrConfig === 'string') {
|
|
4554
|
+
this._commitment = _commitmentOrConfig;
|
|
4555
|
+
} else if (_commitmentOrConfig) {
|
|
4556
|
+
this._commitment = _commitmentOrConfig.commitment;
|
|
4557
|
+
this._confirmTransactionInitialTimeout = _commitmentOrConfig.confirmTransactionInitialTimeout;
|
|
4558
|
+
wsEndpoint = _commitmentOrConfig.wsEndpoint;
|
|
4559
|
+
httpHeaders = _commitmentOrConfig.httpHeaders;
|
|
4560
|
+
fetch = _commitmentOrConfig.fetch;
|
|
4561
|
+
fetchMiddleware = _commitmentOrConfig.fetchMiddleware;
|
|
4562
|
+
disableRetryOnRateLimit = _commitmentOrConfig.disableRetryOnRateLimit;
|
|
4563
|
+
httpAgent = _commitmentOrConfig.httpAgent;
|
|
4540
4564
|
}
|
|
4541
4565
|
this._rpcEndpoint = assertEndpointUrl(endpoint);
|
|
4542
4566
|
this._rpcWsEndpoint = wsEndpoint || makeWebsocketUrl(endpoint);
|
|
@@ -5794,19 +5818,6 @@ class Connection {
|
|
|
5794
5818
|
/*
|
|
5795
5819
|
* Returns the current block height of the node
|
|
5796
5820
|
*/
|
|
5797
|
-
async getBlockHeight(commitmentOrConfig) {
|
|
5798
|
-
const {
|
|
5799
|
-
commitment,
|
|
5800
|
-
config
|
|
5801
|
-
} = extractCommitmentFromConfig(commitmentOrConfig);
|
|
5802
|
-
const args = this._buildArgs([], commitment, undefined /* encoding */, config);
|
|
5803
|
-
const unsafeRes = await this._rpcRequest('getBlockHeight', args);
|
|
5804
|
-
const res = superstruct.create(unsafeRes, jsonRpcResult(superstruct.number()));
|
|
5805
|
-
if ('error' in res) {
|
|
5806
|
-
throw new SolanaJSONRPCError(res.error, 'failed to get block height information');
|
|
5807
|
-
}
|
|
5808
|
-
return res.result;
|
|
5809
|
-
}
|
|
5810
5821
|
|
|
5811
5822
|
/*
|
|
5812
5823
|
* Returns recent block production information from the current or previous epoch
|
|
@@ -6472,7 +6483,7 @@ class Connection {
|
|
|
6472
6483
|
throw new Error('Invalid arguments');
|
|
6473
6484
|
}
|
|
6474
6485
|
const wireTransaction = transaction.serialize();
|
|
6475
|
-
return await this.sendRawTransaction(wireTransaction,
|
|
6486
|
+
return await this.sendRawTransaction(wireTransaction, signersOrOptions);
|
|
6476
6487
|
}
|
|
6477
6488
|
if (signersOrOptions === undefined || !Array.isArray(signersOrOptions)) {
|
|
6478
6489
|
throw new Error('Invalid arguments');
|