@solana/web3.js 1.18.1 → 1.19.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
@@ -545,6 +545,20 @@ declare module '@solana/web3.js' {
545
545
  /** Maximum transaction signatures to return (between 1 and 1,000, default: 1,000). */
546
546
  limit?: number;
547
547
  };
548
+ /**
549
+ * Options for getSignaturesForAddress
550
+ */
551
+ export type SignaturesForAddressOptions = {
552
+ /**
553
+ * Start searching backwards from this transaction signature.
554
+ * @remark If not provided the search starts from the highest max confirmed block.
555
+ */
556
+ before?: TransactionSignature;
557
+ /** Search until this transaction signature is reached, if found before `limit`. */
558
+ until?: TransactionSignature;
559
+ /** Maximum transaction signatures to return (between 1 and 1,000, default: 1,000). */
560
+ limit?: number;
561
+ };
548
562
  /**
549
563
  * RPC Response with extra contextual information
550
564
  */
@@ -1681,6 +1695,19 @@ declare module '@solana/web3.js' {
1681
1695
  options?: ConfirmedSignaturesForAddress2Options,
1682
1696
  commitment?: Finality,
1683
1697
  ): Promise<Array<ConfirmedSignatureInfo>>;
1698
+ /**
1699
+ * Returns confirmed signatures for transactions involving an
1700
+ * address backwards in time from the provided signature or most recent confirmed block
1701
+ *
1702
+ *
1703
+ * @param address queried address
1704
+ * @param options
1705
+ */
1706
+ getSignaturesForAddress(
1707
+ address: PublicKey,
1708
+ options?: SignaturesForAddressOptions,
1709
+ commitment?: Finality,
1710
+ ): Promise<Array<ConfirmedSignatureInfo>>;
1684
1711
  /**
1685
1712
  * Fetch the contents of a Nonce account from the cluster, return with context
1686
1713
  */
package/lib/index.esm.js CHANGED
@@ -2940,6 +2940,17 @@ const GetConfirmedSignaturesForAddress2RpcResult = jsonRpcResult(array(type({
2940
2940
  memo: nullable(string()),
2941
2941
  blockTime: optional(nullable(number()))
2942
2942
  })));
2943
+ /**
2944
+ * Expected JSON RPC response for the "getSignaturesForAddress" message
2945
+ */
2946
+
2947
+ const GetSignaturesForAddressRpcResult = jsonRpcResult(array(type({
2948
+ signature: string(),
2949
+ slot: number(),
2950
+ err: TransactionErrorResult,
2951
+ memo: nullable(string()),
2952
+ blockTime: optional(nullable(number()))
2953
+ })));
2943
2954
  /***
2944
2955
  * Expected JSON RPC response for the "accountNotification" message
2945
2956
  */
@@ -4525,6 +4536,28 @@ class Connection {
4525
4536
 
4526
4537
  return res.result;
4527
4538
  }
4539
+ /**
4540
+ * Returns confirmed signatures for transactions involving an
4541
+ * address backwards in time from the provided signature or most recent confirmed block
4542
+ *
4543
+ *
4544
+ * @param address queried address
4545
+ * @param options
4546
+ */
4547
+
4548
+
4549
+ async getSignaturesForAddress(address, options, commitment) {
4550
+ const args = this._buildArgsAtLeastConfirmed([address.toBase58()], commitment, undefined, options);
4551
+
4552
+ const unsafeRes = await this._rpcRequest('getSignaturesForAddress', args);
4553
+ const res = create(unsafeRes, GetSignaturesForAddressRpcResult);
4554
+
4555
+ if ('error' in res) {
4556
+ throw new Error('failed to get signatures for address: ' + res.error.message);
4557
+ }
4558
+
4559
+ return res.result;
4560
+ }
4528
4561
  /**
4529
4562
  * Fetch the contents of a Nonce account from the cluster, return with context
4530
4563
  */