@solana/web3.js 1.30.2 → 1.32.2

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
@@ -53,6 +53,7 @@ declare module '@solana/web3.js' {
53
53
  * Return the base-58 representation of the public key
54
54
  */
55
55
  toBase58(): string;
56
+ toJSON(): string;
56
57
  /**
57
58
  * Return the byte array representation of the public key
58
59
  */
@@ -534,6 +535,8 @@ declare module '@solana/web3.js' {
534
535
  skipPreflight?: boolean;
535
536
  /** preflight commitment level */
536
537
  preflightCommitment?: Commitment;
538
+ /** Maximum number of times for the RPC node to retry sending the transaction to the leader. */
539
+ maxRetries?: number;
537
540
  };
538
541
  /**
539
542
  * Options for confirming transactions
@@ -545,6 +548,8 @@ declare module '@solana/web3.js' {
545
548
  commitment?: Commitment;
546
549
  /** preflight commitment level */
547
550
  preflightCommitment?: Commitment;
551
+ /** Maximum number of times for the RPC node to retry sending the transaction to the leader. */
552
+ maxRetries?: number;
548
553
  };
549
554
  /**
550
555
  * Options for getConfirmedSignaturesForAddress2
@@ -759,12 +764,19 @@ declare module '@solana/web3.js' {
759
764
  export type TokenBalance = {
760
765
  accountIndex: number;
761
766
  mint: string;
767
+ owner?: string;
762
768
  uiTokenAmount: TokenAmount;
763
769
  };
764
770
  /**
765
771
  * Metadata for a parsed confirmed transaction on the ledger
772
+ *
773
+ * @deprecated Deprecated since Solana v1.8.0. Please use {@link ParsedTransactionMeta} instead.
774
+ */
775
+ export type ParsedConfirmedTransactionMeta = ParsedTransactionMeta;
776
+ /**
777
+ * Metadata for a parsed transaction on the ledger
766
778
  */
767
- export type ParsedConfirmedTransactionMeta = {
779
+ export type ParsedTransactionMeta = {
768
780
  /** The fee charged for processing the transaction */
769
781
  fee: number;
770
782
  /** An array of cross program invoked parsed instructions */
@@ -893,14 +905,20 @@ declare module '@solana/web3.js' {
893
905
  };
894
906
  /**
895
907
  * A parsed and confirmed transaction on the ledger
908
+ *
909
+ * @deprecated Deprecated since Solana v1.8.0. Please use {@link ParsedTransactionWithMeta} instead.
896
910
  */
897
- export type ParsedConfirmedTransaction = {
911
+ export type ParsedConfirmedTransaction = ParsedTransactionWithMeta;
912
+ /**
913
+ * A parsed transaction on the ledger with meta
914
+ */
915
+ export type ParsedTransactionWithMeta = {
898
916
  /** The slot during which the transaction was processed */
899
917
  slot: number;
900
918
  /** The details of the transaction */
901
919
  transaction: ParsedTransaction;
902
920
  /** Metadata produced from the transaction */
903
- meta: ParsedConfirmedTransactionMeta | null;
921
+ meta: ParsedTransactionMeta | null;
904
922
  /** The unix timestamp of when the transaction was processed */
905
923
  blockTime?: number | null;
906
924
  };
@@ -966,9 +984,9 @@ declare module '@solana/web3.js' {
966
984
  blockTime: number | null;
967
985
  };
968
986
  /**
969
- * A ConfirmedBlock on the ledger with signatures only
987
+ * A Block on the ledger with signatures only
970
988
  */
971
- export type ConfirmedBlockSignatures = {
989
+ export type BlockSignatures = {
972
990
  /** Blockhash of this block */
973
991
  blockhash: Blockhash;
974
992
  /** Blockhash of this block's parent */
@@ -1188,6 +1206,15 @@ declare module '@solana/web3.js' {
1188
1206
  /** Optional array of filters to apply to accounts */
1189
1207
  filters?: GetProgramAccountsFilter[];
1190
1208
  };
1209
+ /**
1210
+ * Configuration object for getMultipleAccounts
1211
+ */
1212
+ export type GetMultipleAccountsConfig = {
1213
+ /** Optional commitment level */
1214
+ commitment?: Commitment;
1215
+ /** Optional encoding for account data (default base64) */
1216
+ encoding?: 'base64' | 'jsonParsed';
1217
+ };
1191
1218
  /**
1192
1219
  * Information describing an account
1193
1220
  */
@@ -1200,7 +1227,7 @@ declare module '@solana/web3.js' {
1200
1227
  lamports: number;
1201
1228
  /** Optional data assigned to the account */
1202
1229
  data: T;
1203
- /** Optional rent epoch infor for account */
1230
+ /** Optional rent epoch info for account */
1204
1231
  rentEpoch?: number;
1205
1232
  };
1206
1233
  /**
@@ -1348,7 +1375,7 @@ declare module '@solana/web3.js' {
1348
1375
  export type FetchMiddleware = (
1349
1376
  url: string,
1350
1377
  options: any,
1351
- fetch: Function,
1378
+ fetch: (modifiedUrl: string, modifiedOptions: any) => void,
1352
1379
  ) => void;
1353
1380
  /**
1354
1381
  * Configuration for instantiating a Connection
@@ -1505,8 +1532,8 @@ declare module '@solana/web3.js' {
1505
1532
  */
1506
1533
  getMultipleAccountsInfo(
1507
1534
  publicKeys: PublicKey[],
1508
- commitment?: Commitment,
1509
- ): Promise<(AccountInfo<Buffer> | null)[]>;
1535
+ configOrCommitment?: GetMultipleAccountsConfig | Commitment,
1536
+ ): Promise<(AccountInfo<Buffer | ParsedAccountData> | null)[]>;
1510
1537
  /**
1511
1538
  * Returns epoch activation information for a stake account that has been delegated
1512
1539
  */
@@ -1633,6 +1660,8 @@ declare module '@solana/web3.js' {
1633
1660
  /**
1634
1661
  * Fetch a recent blockhash from the cluster, return with context
1635
1662
  * @return {Promise<RpcResponseAndContext<{blockhash: Blockhash, feeCalculator: FeeCalculator}>>}
1663
+ *
1664
+ * @deprecated Deprecated since Solana v1.8.0. Please use {@link getLatestBlockhash} instead.
1636
1665
  */
1637
1666
  getRecentBlockhashAndContext(commitment?: Commitment): Promise<
1638
1667
  RpcResponseAndContext<{
@@ -1647,19 +1676,48 @@ declare module '@solana/web3.js' {
1647
1676
  getRecentPerformanceSamples(limit?: number): Promise<Array<PerfSample>>;
1648
1677
  /**
1649
1678
  * Fetch the fee calculator for a recent blockhash from the cluster, return with context
1679
+ *
1680
+ * @deprecated Deprecated since Solana v1.8.0. Please use {@link getFeeForMessage} instead.
1650
1681
  */
1651
1682
  getFeeCalculatorForBlockhash(
1652
1683
  blockhash: Blockhash,
1653
1684
  commitment?: Commitment,
1654
1685
  ): Promise<RpcResponseAndContext<FeeCalculator | null>>;
1686
+ /**
1687
+ * Fetch the fee for a message from the cluster, return with context
1688
+ */
1689
+ getFeeForMessage(
1690
+ message: Message,
1691
+ commitment?: Commitment,
1692
+ ): Promise<RpcResponseAndContext<number>>;
1655
1693
  /**
1656
1694
  * Fetch a recent blockhash from the cluster
1657
1695
  * @return {Promise<{blockhash: Blockhash, feeCalculator: FeeCalculator}>}
1696
+ *
1697
+ * @deprecated Deprecated since Solana v1.8.0. Please use {@link getLatestBlockhash} instead.
1658
1698
  */
1659
1699
  getRecentBlockhash(commitment?: Commitment): Promise<{
1660
1700
  blockhash: Blockhash;
1661
1701
  feeCalculator: FeeCalculator;
1662
1702
  }>;
1703
+ /**
1704
+ * Fetch the latest blockhash from the cluster
1705
+ * @return {Promise<{blockhash: Blockhash, lastValidBlockHeight: number}>}
1706
+ */
1707
+ getLatestBlockhash(commitment?: Commitment): Promise<{
1708
+ blockhash: Blockhash;
1709
+ lastValidBlockHeight: number;
1710
+ }>;
1711
+ /**
1712
+ * Fetch the latest blockhash from the cluster
1713
+ * @return {Promise<{blockhash: Blockhash, lastValidBlockHeight: number}>}
1714
+ */
1715
+ getLatestBlockhashAndContext(commitment?: Commitment): Promise<
1716
+ RpcResponseAndContext<{
1717
+ blockhash: Blockhash;
1718
+ lastValidBlockHeight: number;
1719
+ }>
1720
+ >;
1663
1721
  /**
1664
1722
  * Fetch the node version
1665
1723
  */
@@ -1678,7 +1736,7 @@ declare module '@solana/web3.js' {
1678
1736
  },
1679
1737
  ): Promise<BlockResponse | null>;
1680
1738
  /**
1681
- * Fetch a processed transaction from the cluster.
1739
+ * Fetch a confirmed or finalized transaction from the cluster.
1682
1740
  */
1683
1741
  getTransaction(
1684
1742
  signature: string,
@@ -1686,6 +1744,20 @@ declare module '@solana/web3.js' {
1686
1744
  commitment?: Finality;
1687
1745
  },
1688
1746
  ): Promise<TransactionResponse | null>;
1747
+ /**
1748
+ * Fetch parsed transaction details for a confirmed or finalized transaction
1749
+ */
1750
+ getParsedTransaction(
1751
+ signature: TransactionSignature,
1752
+ commitment?: Finality,
1753
+ ): Promise<ParsedConfirmedTransaction | null>;
1754
+ /**
1755
+ * Fetch parsed transaction details for a batch of confirmed transactions
1756
+ */
1757
+ getParsedTransactions(
1758
+ signatures: TransactionSignature[],
1759
+ commitment?: Finality,
1760
+ ): Promise<(ParsedConfirmedTransaction | null)[]>;
1689
1761
  /**
1690
1762
  * Fetch a list of Transactions and transaction statuses from the cluster
1691
1763
  * for a confirmed block.
@@ -1704,15 +1776,26 @@ declare module '@solana/web3.js' {
1704
1776
  endSlot?: number,
1705
1777
  commitment?: Finality,
1706
1778
  ): Promise<Array<number>>;
1779
+ /**
1780
+ * Fetch a list of Signatures from the cluster for a block, excluding rewards
1781
+ */
1782
+ getBlockSignatures(
1783
+ slot: number,
1784
+ commitment?: Finality,
1785
+ ): Promise<BlockSignatures>;
1707
1786
  /**
1708
1787
  * Fetch a list of Signatures from the cluster for a confirmed block, excluding rewards
1788
+ *
1789
+ * @deprecated Deprecated since Solana v1.8.0. Please use {@link getBlockSignatures} instead.
1709
1790
  */
1710
1791
  getConfirmedBlockSignatures(
1711
1792
  slot: number,
1712
1793
  commitment?: Finality,
1713
- ): Promise<ConfirmedBlockSignatures>;
1794
+ ): Promise<BlockSignatures>;
1714
1795
  /**
1715
1796
  * Fetch a transaction details for a confirmed transaction
1797
+ *
1798
+ * @deprecated Deprecated since Solana v1.8.0. Please use {@link getTransaction} instead.
1716
1799
  */
1717
1800
  getConfirmedTransaction(
1718
1801
  signature: TransactionSignature,
@@ -1720,6 +1803,8 @@ declare module '@solana/web3.js' {
1720
1803
  ): Promise<ConfirmedTransaction | null>;
1721
1804
  /**
1722
1805
  * Fetch parsed transaction details for a confirmed transaction
1806
+ *
1807
+ * @deprecated Deprecated since Solana v1.8.0. Please use {@link getParsedTransaction} instead.
1723
1808
  */
1724
1809
  getParsedConfirmedTransaction(
1725
1810
  signature: TransactionSignature,
@@ -1727,6 +1812,8 @@ declare module '@solana/web3.js' {
1727
1812
  ): Promise<ParsedConfirmedTransaction | null>;
1728
1813
  /**
1729
1814
  * Fetch parsed transaction details for a batch of confirmed transactions
1815
+ *
1816
+ * @deprecated Deprecated since Solana v1.8.0. Please use {@link getParsedTransactions} instead.
1730
1817
  */
1731
1818
  getParsedConfirmedTransactions(
1732
1819
  signatures: TransactionSignature[],
@@ -2824,20 +2911,32 @@ declare module '@solana/web3.js' {
2824
2911
  credits: number;
2825
2912
  prevCredits: number;
2826
2913
  };
2914
+ export type AuthorizedVoter = {
2915
+ epoch: number;
2916
+ authorizedVoter: PublicKey;
2917
+ };
2918
+ export type PriorVoter = {
2919
+ authorizedPubkey: PublicKey;
2920
+ epochOfLastAuthorizedSwitch: number;
2921
+ targetEpoch: number;
2922
+ };
2923
+ export type BlockTimestamp = {
2924
+ slot: number;
2925
+ timetamp: number;
2926
+ };
2827
2927
  /**
2828
2928
  * VoteAccount class
2829
2929
  */
2830
2930
  export class VoteAccount {
2831
2931
  nodePubkey: PublicKey;
2832
- authorizedVoterPubkey: PublicKey;
2833
- authorizedWithdrawerPubkey: PublicKey;
2932
+ authorizedWithdrawer: PublicKey;
2834
2933
  commission: number;
2835
- votes: Array<Lockout>;
2836
2934
  rootSlot: number | null;
2837
- epoch: number;
2838
- credits: number;
2839
- lastEpochCredits: number;
2840
- epochCredits: Array<EpochCredits>;
2935
+ votes: Lockout[];
2936
+ authorizedVoters: AuthorizedVoter[];
2937
+ priorVoters: PriorVoter[];
2938
+ epochCredits: EpochCredits[];
2939
+ lastTimestamp: BlockTimestamp;
2841
2940
  /**
2842
2941
  * Deserialize VoteAccount from the account data.
2843
2942
  *
@@ -2850,11 +2949,14 @@ declare module '@solana/web3.js' {
2850
2949
  }
2851
2950
 
2852
2951
  export const SYSVAR_CLOCK_PUBKEY: PublicKey;
2952
+ export const SYSVAR_EPOCH_SCHEDULE_PUBKEY: PublicKey;
2953
+ export const SYSVAR_INSTRUCTIONS_PUBKEY: PublicKey;
2853
2954
  export const SYSVAR_RECENT_BLOCKHASHES_PUBKEY: PublicKey;
2854
2955
  export const SYSVAR_RENT_PUBKEY: PublicKey;
2855
2956
  export const SYSVAR_REWARDS_PUBKEY: PublicKey;
2957
+ export const SYSVAR_SLOT_HASHES_PUBKEY: PublicKey;
2958
+ export const SYSVAR_SLOT_HISTORY_PUBKEY: PublicKey;
2856
2959
  export const SYSVAR_STAKE_HISTORY_PUBKEY: PublicKey;
2857
- export const SYSVAR_INSTRUCTIONS_PUBKEY: PublicKey;
2858
2960
 
2859
2961
  export class SendTransactionError extends Error {
2860
2962
  logs: string[] | undefined;