@solana/web3.js 1.7.2 → 1.8.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/module.flow.js CHANGED
@@ -1921,6 +1921,13 @@ account: AccountInfo<Buffer | ParsedAccountData>,...
1921
1921
  */
1922
1922
  getSlotLeader(commitment?: Commitment): Promise<string>;
1923
1923
 
1924
+ /**
1925
+ * Fetch `limit` number of slot leaders starting from `startSlot`
1926
+ * @param startSlot fetch slot leaders starting from this slot
1927
+ * @param limit number of slot leaders to return
1928
+ */
1929
+ getSlotLeaders(startSlot: number, limit: number): Promise<Array<PublicKey>>;
1930
+
1924
1931
  /**
1925
1932
  * Fetch the current status of a signature
1926
1933
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solana/web3.js",
3
- "version": "1.7.2",
3
+ "version": "1.8.1",
4
4
  "description": "Solana Javascript API",
5
5
  "keywords": [
6
6
  "api",
package/src/connection.ts CHANGED
@@ -2469,6 +2469,25 @@ export class Connection {
2469
2469
  return res.result;
2470
2470
  }
2471
2471
 
2472
+ /**
2473
+ * Fetch `limit` number of slot leaders starting from `startSlot`
2474
+ *
2475
+ * @param startSlot fetch slot leaders starting from this slot
2476
+ * @param limit number of slot leaders to return
2477
+ */
2478
+ async getSlotLeaders(
2479
+ startSlot: number,
2480
+ limit: number,
2481
+ ): Promise<Array<PublicKey>> {
2482
+ const args = [startSlot, limit];
2483
+ const unsafeRes = await this._rpcRequest('getSlotLeaders', args);
2484
+ const res = create(unsafeRes, jsonRpcResult(array(PublicKeyFromString)));
2485
+ if ('error' in res) {
2486
+ throw new Error('failed to get slot leaders: ' + res.error.message);
2487
+ }
2488
+ return res.result;
2489
+ }
2490
+
2472
2491
  /**
2473
2492
  * Fetch the current status of a signature
2474
2493
  */