@solana/web3.js 1.32.0 → 1.34.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/lib/index.d.ts CHANGED
@@ -535,6 +535,8 @@ declare module '@solana/web3.js' {
535
535
  skipPreflight?: boolean;
536
536
  /** preflight commitment level */
537
537
  preflightCommitment?: Commitment;
538
+ /** Maximum number of times for the RPC node to retry sending the transaction to the leader. */
539
+ maxRetries?: number;
538
540
  };
539
541
  /**
540
542
  * Options for confirming transactions
@@ -546,6 +548,8 @@ declare module '@solana/web3.js' {
546
548
  commitment?: Commitment;
547
549
  /** preflight commitment level */
548
550
  preflightCommitment?: Commitment;
551
+ /** Maximum number of times for the RPC node to retry sending the transaction to the leader. */
552
+ maxRetries?: number;
549
553
  };
550
554
  /**
551
555
  * Options for getConfirmedSignaturesForAddress2
@@ -765,8 +769,14 @@ declare module '@solana/web3.js' {
765
769
  };
766
770
  /**
767
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
768
778
  */
769
- export type ParsedConfirmedTransactionMeta = {
779
+ export type ParsedTransactionMeta = {
770
780
  /** The fee charged for processing the transaction */
771
781
  fee: number;
772
782
  /** An array of cross program invoked parsed instructions */
@@ -895,14 +905,20 @@ declare module '@solana/web3.js' {
895
905
  };
896
906
  /**
897
907
  * A parsed and confirmed transaction on the ledger
908
+ *
909
+ * @deprecated Deprecated since Solana v1.8.0. Please use {@link ParsedTransactionWithMeta} instead.
898
910
  */
899
- export type ParsedConfirmedTransaction = {
911
+ export type ParsedConfirmedTransaction = ParsedTransactionWithMeta;
912
+ /**
913
+ * A parsed transaction on the ledger with meta
914
+ */
915
+ export type ParsedTransactionWithMeta = {
900
916
  /** The slot during which the transaction was processed */
901
917
  slot: number;
902
918
  /** The details of the transaction */
903
919
  transaction: ParsedTransaction;
904
920
  /** Metadata produced from the transaction */
905
- meta: ParsedConfirmedTransactionMeta | null;
921
+ meta: ParsedTransactionMeta | null;
906
922
  /** The unix timestamp of when the transaction was processed */
907
923
  blockTime?: number | null;
908
924
  };
@@ -968,9 +984,9 @@ declare module '@solana/web3.js' {
968
984
  blockTime: number | null;
969
985
  };
970
986
  /**
971
- * A ConfirmedBlock on the ledger with signatures only
987
+ * A Block on the ledger with signatures only
972
988
  */
973
- export type ConfirmedBlockSignatures = {
989
+ export type BlockSignatures = {
974
990
  /** Blockhash of this block */
975
991
  blockhash: Blockhash;
976
992
  /** Blockhash of this block's parent */
@@ -1644,6 +1660,8 @@ declare module '@solana/web3.js' {
1644
1660
  /**
1645
1661
  * Fetch a recent blockhash from the cluster, return with context
1646
1662
  * @return {Promise<RpcResponseAndContext<{blockhash: Blockhash, feeCalculator: FeeCalculator}>>}
1663
+ *
1664
+ * @deprecated Deprecated since Solana v1.8.0. Please use {@link getLatestBlockhash} instead.
1647
1665
  */
1648
1666
  getRecentBlockhashAndContext(commitment?: Commitment): Promise<
1649
1667
  RpcResponseAndContext<{
@@ -1658,6 +1676,8 @@ declare module '@solana/web3.js' {
1658
1676
  getRecentPerformanceSamples(limit?: number): Promise<Array<PerfSample>>;
1659
1677
  /**
1660
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.
1661
1681
  */
1662
1682
  getFeeCalculatorForBlockhash(
1663
1683
  blockhash: Blockhash,
@@ -1673,11 +1693,31 @@ declare module '@solana/web3.js' {
1673
1693
  /**
1674
1694
  * Fetch a recent blockhash from the cluster
1675
1695
  * @return {Promise<{blockhash: Blockhash, feeCalculator: FeeCalculator}>}
1696
+ *
1697
+ * @deprecated Deprecated since Solana v1.8.0. Please use {@link getLatestBlockhash} instead.
1676
1698
  */
1677
1699
  getRecentBlockhash(commitment?: Commitment): Promise<{
1678
1700
  blockhash: Blockhash;
1679
1701
  feeCalculator: FeeCalculator;
1680
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
+ >;
1681
1721
  /**
1682
1722
  * Fetch the node version
1683
1723
  */
@@ -1696,7 +1736,7 @@ declare module '@solana/web3.js' {
1696
1736
  },
1697
1737
  ): Promise<BlockResponse | null>;
1698
1738
  /**
1699
- * Fetch a processed transaction from the cluster.
1739
+ * Fetch a confirmed or finalized transaction from the cluster.
1700
1740
  */
1701
1741
  getTransaction(
1702
1742
  signature: string,
@@ -1704,6 +1744,20 @@ declare module '@solana/web3.js' {
1704
1744
  commitment?: Finality;
1705
1745
  },
1706
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)[]>;
1707
1761
  /**
1708
1762
  * Fetch a list of Transactions and transaction statuses from the cluster
1709
1763
  * for a confirmed block.
@@ -1722,15 +1776,26 @@ declare module '@solana/web3.js' {
1722
1776
  endSlot?: number,
1723
1777
  commitment?: Finality,
1724
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>;
1725
1786
  /**
1726
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.
1727
1790
  */
1728
1791
  getConfirmedBlockSignatures(
1729
1792
  slot: number,
1730
1793
  commitment?: Finality,
1731
- ): Promise<ConfirmedBlockSignatures>;
1794
+ ): Promise<BlockSignatures>;
1732
1795
  /**
1733
1796
  * Fetch a transaction details for a confirmed transaction
1797
+ *
1798
+ * @deprecated Deprecated since Solana v1.8.0. Please use {@link getTransaction} instead.
1734
1799
  */
1735
1800
  getConfirmedTransaction(
1736
1801
  signature: TransactionSignature,
@@ -1738,6 +1803,8 @@ declare module '@solana/web3.js' {
1738
1803
  ): Promise<ConfirmedTransaction | null>;
1739
1804
  /**
1740
1805
  * Fetch parsed transaction details for a confirmed transaction
1806
+ *
1807
+ * @deprecated Deprecated since Solana v1.8.0. Please use {@link getParsedTransaction} instead.
1741
1808
  */
1742
1809
  getParsedConfirmedTransaction(
1743
1810
  signature: TransactionSignature,
@@ -1745,6 +1812,8 @@ declare module '@solana/web3.js' {
1745
1812
  ): Promise<ParsedConfirmedTransaction | null>;
1746
1813
  /**
1747
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.
1748
1817
  */
1749
1818
  getParsedConfirmedTransactions(
1750
1819
  signatures: TransactionSignature[],
@@ -2879,6 +2948,147 @@ declare module '@solana/web3.js' {
2879
2948
  ): VoteAccount;
2880
2949
  }
2881
2950
 
2951
+ /**
2952
+ * Vote account info
2953
+ */
2954
+ export class VoteInit {
2955
+ nodePubkey: PublicKey;
2956
+ authorizedVoter: PublicKey;
2957
+ authorizedWithdrawer: PublicKey;
2958
+ commission: number; /** [0, 100] */
2959
+ constructor(
2960
+ nodePubkey: PublicKey,
2961
+ authorizedVoter: PublicKey,
2962
+ authorizedWithdrawer: PublicKey,
2963
+ commission: number,
2964
+ );
2965
+ }
2966
+ /**
2967
+ * Create vote account transaction params
2968
+ */
2969
+ export type CreateVoteAccountParams = {
2970
+ fromPubkey: PublicKey;
2971
+ votePubkey: PublicKey;
2972
+ voteInit: VoteInit;
2973
+ lamports: number;
2974
+ };
2975
+ /**
2976
+ * InitializeAccount instruction params
2977
+ */
2978
+ export type InitializeAccountParams = {
2979
+ votePubkey: PublicKey;
2980
+ nodePubkey: PublicKey;
2981
+ voteInit: VoteInit;
2982
+ };
2983
+ /**
2984
+ * Authorize instruction params
2985
+ */
2986
+ export type AuthorizeVoteParams = {
2987
+ votePubkey: PublicKey;
2988
+ /** Current vote or withdraw authority, depending on `voteAuthorizationType` */
2989
+ authorizedPubkey: PublicKey;
2990
+ newAuthorizedPubkey: PublicKey;
2991
+ voteAuthorizationType: VoteAuthorizationType;
2992
+ };
2993
+ /**
2994
+ * Withdraw from vote account transaction params
2995
+ */
2996
+ export type WithdrawFromVoteAccountParams = {
2997
+ votePubkey: PublicKey;
2998
+ authorizedWithdrawerPubkey: PublicKey;
2999
+ lamports: number;
3000
+ toPubkey: PublicKey;
3001
+ };
3002
+ /**
3003
+ * Vote Instruction class
3004
+ */
3005
+ export class VoteInstruction {
3006
+ /**
3007
+ * Decode a vote instruction and retrieve the instruction type.
3008
+ */
3009
+ static decodeInstructionType(
3010
+ instruction: TransactionInstruction,
3011
+ ): VoteInstructionType;
3012
+ /**
3013
+ * Decode an initialize vote instruction and retrieve the instruction params.
3014
+ */
3015
+ static decodeInitializeAccount(
3016
+ instruction: TransactionInstruction,
3017
+ ): InitializeAccountParams;
3018
+ /**
3019
+ * Decode an authorize instruction and retrieve the instruction params.
3020
+ */
3021
+ static decodeAuthorize(
3022
+ instruction: TransactionInstruction,
3023
+ ): AuthorizeVoteParams;
3024
+ /**
3025
+ * Decode a withdraw instruction and retrieve the instruction params.
3026
+ */
3027
+ static decodeWithdraw(
3028
+ instruction: TransactionInstruction,
3029
+ ): WithdrawFromVoteAccountParams;
3030
+ }
3031
+ /**
3032
+ * An enumeration of valid VoteInstructionType's
3033
+ */
3034
+ export type VoteInstructionType =
3035
+ | 'Authorize'
3036
+ | 'InitializeAccount'
3037
+ | 'Withdraw';
3038
+ /**
3039
+ * VoteAuthorize type
3040
+ */
3041
+ export type VoteAuthorizationType = {
3042
+ /** The VoteAuthorize index (from solana-vote-program) */
3043
+ index: number;
3044
+ };
3045
+ /**
3046
+ * An enumeration of valid VoteAuthorization layouts.
3047
+ */
3048
+ export const VoteAuthorizationLayout: Readonly<{
3049
+ Voter: {
3050
+ index: number;
3051
+ };
3052
+ Withdrawer: {
3053
+ index: number;
3054
+ };
3055
+ }>;
3056
+ /**
3057
+ * Factory class for transactions to interact with the Vote program
3058
+ */
3059
+ export class VoteProgram {
3060
+ /**
3061
+ * Public key that identifies the Vote program
3062
+ */
3063
+ static programId: PublicKey;
3064
+ /**
3065
+ * Max space of a Vote account
3066
+ *
3067
+ * This is generated from the solana-vote-program VoteState struct as
3068
+ * `VoteState::size_of()`:
3069
+ * https://docs.rs/solana-vote-program/1.9.5/solana_vote_program/vote_state/struct.VoteState.html#method.size_of
3070
+ */
3071
+ static space: number;
3072
+ /**
3073
+ * Generate an Initialize instruction.
3074
+ */
3075
+ static initializeAccount(
3076
+ params: InitializeAccountParams,
3077
+ ): TransactionInstruction;
3078
+ /**
3079
+ * Generate a transaction that creates a new Vote account.
3080
+ */
3081
+ static createAccount(params: CreateVoteAccountParams): Transaction;
3082
+ /**
3083
+ * Generate a transaction that authorizes a new Voter or Withdrawer on the Vote account.
3084
+ */
3085
+ static authorize(params: AuthorizeVoteParams): Transaction;
3086
+ /**
3087
+ * Generate a transaction to withdraw from a Vote account.
3088
+ */
3089
+ static withdraw(params: WithdrawFromVoteAccountParams): Transaction;
3090
+ }
3091
+
2882
3092
  export const SYSVAR_CLOCK_PUBKEY: PublicKey;
2883
3093
  export const SYSVAR_EPOCH_SCHEDULE_PUBKEY: PublicKey;
2884
3094
  export const SYSVAR_INSTRUCTIONS_PUBKEY: PublicKey;