@solana/web3.js 1.77.3 → 1.78.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.d.ts CHANGED
@@ -3,7 +3,6 @@ declare module "@solana/web3.js" {
3
3
  import { Buffer } from 'buffer';
4
4
  import { Agent } from 'http';
5
5
  import { Agent as Agent$1 } from 'https';
6
- import * as nodeFetch from 'node-fetch';
7
6
 
8
7
  export class Struct {
9
8
  constructor(properties: any);
@@ -169,7 +168,8 @@ export class EpochSchedule {
169
168
  getSlotsInEpoch(epoch: number): number;
170
169
  }
171
170
 
172
- export function export_default(input: nodeFetch.RequestInfo, init?: nodeFetch.RequestInit): Promise<nodeFetch.Response>;
171
+ export const _default: typeof fetch;
172
+ //# sourceMappingURL=fetch-impl.d.ts.map
173
173
 
174
174
  /**
175
175
  * Calculator for transaction fees.
@@ -232,11 +232,13 @@ export class Keypair {
232
232
  * Create a new keypair instance.
233
233
  * Generate random keypair if no {@link Ed25519Keypair} is provided.
234
234
  *
235
- * @param keypair ed25519 keypair
235
+ * @param {Ed25519Keypair} keypair ed25519 keypair
236
236
  */
237
237
  constructor(keypair?: Ed25519Keypair);
238
238
  /**
239
239
  * Generate a new random keypair
240
+ *
241
+ * @returns {Keypair} Keypair
240
242
  */
241
243
  static generate(): Keypair;
242
244
  /**
@@ -249,7 +251,9 @@ export class Keypair {
249
251
  * @throws error if the provided secret key is invalid and validation is not skipped.
250
252
  *
251
253
  * @param secretKey secret key byte array
252
- * @param options: skip secret key validation
254
+ * @param options skip secret key validation
255
+ *
256
+ * @returns {Keypair} Keypair
253
257
  */
254
258
  static fromSecretKey(secretKey: Uint8Array, options?: {
255
259
  skipValidation?: boolean;
@@ -258,14 +262,19 @@ export class Keypair {
258
262
  * Generate a keypair from a 32 byte seed.
259
263
  *
260
264
  * @param seed seed byte array
265
+ *
266
+ * @returns {Keypair} Keypair
261
267
  */
262
268
  static fromSeed(seed: Uint8Array): Keypair;
263
269
  /**
264
270
  * The public key for this keypair
271
+ *
272
+ * @returns {PublicKey} PublicKey
265
273
  */
266
274
  get publicKey(): PublicKey;
267
275
  /**
268
276
  * The raw secret key for this keypair
277
+ * @returns {Uint8Array} Secret key in an array of Uint8 bytes
269
278
  */
270
279
  get secretKey(): Uint8Array;
271
280
  }
@@ -1576,6 +1585,8 @@ export class Transaction {
1576
1585
  signatures: Array<SignaturePubkeyPair>;
1577
1586
  /**
1578
1587
  * The first (payer) Transaction signature
1588
+ *
1589
+ * @returns {Buffer | null} Buffer of payer's signature
1579
1590
  */
1580
1591
  get signature(): Buffer | null;
1581
1592
  /**
@@ -1616,6 +1627,8 @@ export class Transaction {
1616
1627
  constructor(opts?: TransactionCtorFields_DEPRECATED);
1617
1628
  /**
1618
1629
  * Add one or more instructions to this Transaction
1630
+ *
1631
+ * @param {Array< Transaction | TransactionInstruction | TransactionInstructionCtorFields >} items - Instructions to add to the Transaction
1619
1632
  */
1620
1633
  add(...items: Array<Transaction | TransactionInstruction | TransactionInstructionCtorFields>): Transaction;
1621
1634
  /**
@@ -1628,6 +1641,10 @@ export class Transaction {
1628
1641
  serializeMessage(): Buffer;
1629
1642
  /**
1630
1643
  * Get the estimated fee associated with a transaction
1644
+ *
1645
+ * @param {Connection} connection Connection to RPC Endpoint.
1646
+ *
1647
+ * @returns {Promise<number | null>} The estimated fee for the transaction
1631
1648
  */
1632
1649
  getEstimatedFee(connection: Connection): Promise<number | null>;
1633
1650
  /**
@@ -1654,6 +1671,8 @@ export class Transaction {
1654
1671
  * rejected.
1655
1672
  *
1656
1673
  * The Transaction must be assigned a valid `recentBlockhash` before invoking this method
1674
+ *
1675
+ * @param {Array<Signer>} signers Array of signers that will sign the transaction
1657
1676
  */
1658
1677
  sign(...signers: Array<Signer>): void;
1659
1678
  /**
@@ -1662,30 +1681,50 @@ export class Transaction {
1662
1681
  * instructions.
1663
1682
  *
1664
1683
  * All the caveats from the `sign` method apply to `partialSign`
1684
+ *
1685
+ * @param {Array<Signer>} signers Array of signers that will sign the transaction
1665
1686
  */
1666
1687
  partialSign(...signers: Array<Signer>): void;
1667
1688
  /**
1668
1689
  * Add an externally created signature to a transaction. The public key
1669
1690
  * must correspond to either the fee payer or a signer account in the transaction
1670
1691
  * instructions.
1692
+ *
1693
+ * @param {PublicKey} pubkey Public key that will be added to the transaction.
1694
+ * @param {Buffer} signature An externally created signature to add to the transaction.
1671
1695
  */
1672
1696
  addSignature(pubkey: PublicKey, signature: Buffer): void;
1673
1697
  /**
1674
1698
  * Verify signatures of a Transaction
1675
1699
  * Optional parameter specifies if we're expecting a fully signed Transaction or a partially signed one.
1676
1700
  * If no boolean is provided, we expect a fully signed Transaction by default.
1701
+ *
1702
+ * @param {boolean} [requireAllSignatures=true] Require a fully signed Transaction
1677
1703
  */
1678
1704
  verifySignatures(requireAllSignatures?: boolean): boolean;
1679
1705
  /**
1680
1706
  * Serialize the Transaction in the wire format.
1707
+ *
1708
+ * @param {Buffer} [config] Config of transaction.
1709
+ *
1710
+ * @returns {Buffer} Signature of transaction in wire format.
1681
1711
  */
1682
1712
  serialize(config?: SerializeConfig): Buffer;
1683
1713
  /**
1684
1714
  * Parse a wire transaction into a Transaction object.
1715
+ *
1716
+ * @param {Buffer | Uint8Array | Array<number>} buffer Signature of wire Transaction
1717
+ *
1718
+ * @returns {Transaction} Transaction associated with the signature
1685
1719
  */
1686
1720
  static from(buffer: Buffer | Uint8Array | Array<number>): Transaction;
1687
1721
  /**
1688
1722
  * Populate Transaction object from message and signatures
1723
+ *
1724
+ * @param {Message} message Message of transaction
1725
+ * @param {Array<string>} signatures List of signatures to assign to the transaction
1726
+ *
1727
+ * @returns {Transaction} The populated Transaction
1689
1728
  */
1690
1729
  static populate(message: Message, signatures?: Array<string>): Transaction;
1691
1730
  }
@@ -1975,6 +2014,15 @@ type GetLatestBlockhashConfig = {
1975
2014
  /** The minimum slot that the request can be evaluated at */
1976
2015
  minContextSlot?: number;
1977
2016
  };
2017
+ /**
2018
+ * Configuration object for changing `isBlockhashValid` query behavior
2019
+ */
2020
+ type IsBlockhashValidConfig = {
2021
+ /** The level of commitment desired */
2022
+ commitment?: Commitment;
2023
+ /** The minimum slot that the request can be evaluated at */
2024
+ minContextSlot?: number;
2025
+ };
1978
2026
  /**
1979
2027
  * Configuration object for changing `getSlot` query behavior
1980
2028
  */
@@ -3052,7 +3100,7 @@ type HttpHeaders = {
3052
3100
  /**
3053
3101
  * The type of the JavaScript `fetch()` API
3054
3102
  */
3055
- type FetchFn = typeof export_default;
3103
+ type FetchFn = typeof _default;
3056
3104
  /**
3057
3105
  * A callback used to augment the outgoing HTTP request
3058
3106
  */
@@ -3332,6 +3380,10 @@ export class Connection {
3332
3380
  * @return {Promise<BlockhashWithExpiryBlockHeight>}
3333
3381
  */
3334
3382
  getLatestBlockhashAndContext(commitmentOrConfig?: Commitment | GetLatestBlockhashConfig): Promise<RpcResponseAndContext<BlockhashWithExpiryBlockHeight>>;
3383
+ /**
3384
+ * Returns whether a blockhash is still valid or not
3385
+ */
3386
+ isBlockhashValid(blockhash: Blockhash, rawConfig?: IsBlockhashValidConfig): Promise<RpcResponseAndContext<boolean>>;
3335
3387
  /**
3336
3388
  * Fetch the node version
3337
3389
  */
@@ -3847,6 +3899,10 @@ export const SYSVAR_STAKE_HISTORY_PUBKEY: PublicKey;
3847
3899
  type Cluster = 'devnet' | 'testnet' | 'mainnet-beta';
3848
3900
  /**
3849
3901
  * Retrieves the RPC API URL for the specified cluster
3902
+ * @param {Cluster} [cluster="devnet"] - The cluster name of the RPC API URL to use. Possible options: 'devnet' | 'testnet' | 'mainnet-beta'
3903
+ * @param {boolean} [tls="http"] - Use TLS when connecting to cluster.
3904
+ *
3905
+ * @returns {string} URL string of the RPC endpoint
3850
3906
  */
3851
3907
  export function clusterApiUrl(cluster?: Cluster, tls?: boolean): string;
3852
3908