@solana/web3.js 1.40.1 → 1.41.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
@@ -338,14 +338,6 @@ declare module '@solana/web3.js' {
338
338
  * Transaction signature as base-58 encoded string
339
339
  */
340
340
  export type TransactionSignature = string;
341
- /**
342
- * Maximum over-the-wire size of a Transaction
343
- *
344
- * 1280 is IPv6 minimum MTU
345
- * 40 bytes is the size of the IPv6 header
346
- * 8 bytes is the size of the fragment header
347
- */
348
- export const PACKET_DATA_SIZE: number;
349
341
  /**
350
342
  * Account metadata used to define instructions
351
343
  */
@@ -535,6 +527,7 @@ declare module '@solana/web3.js' {
535
527
  static populate(message: Message, signatures?: Array<string>): Transaction;
536
528
  }
537
529
 
530
+ export type ClientSubscriptionId = number;
538
531
  export type TokenAccountsFilter =
539
532
  | {
540
533
  mint: PublicKey;
@@ -2009,13 +2002,15 @@ declare module '@solana/web3.js' {
2009
2002
  publicKey: PublicKey,
2010
2003
  callback: AccountChangeCallback,
2011
2004
  commitment?: Commitment,
2012
- ): number;
2005
+ ): ClientSubscriptionId;
2013
2006
  /**
2014
2007
  * Deregister an account notification callback
2015
2008
  *
2016
- * @param id subscription id to deregister
2009
+ * @param id client subscription id to deregister
2017
2010
  */
2018
- removeAccountChangeListener(id: number): Promise<void>;
2011
+ removeAccountChangeListener(
2012
+ clientSubscriptionId: ClientSubscriptionId,
2013
+ ): Promise<void>;
2019
2014
  /**
2020
2015
  * Register a callback to be invoked whenever accounts owned by the
2021
2016
  * specified program change
@@ -2031,13 +2026,15 @@ declare module '@solana/web3.js' {
2031
2026
  callback: ProgramAccountChangeCallback,
2032
2027
  commitment?: Commitment,
2033
2028
  filters?: GetProgramAccountsFilter[],
2034
- ): number;
2029
+ ): ClientSubscriptionId;
2035
2030
  /**
2036
2031
  * Deregister an account notification callback
2037
2032
  *
2038
- * @param id subscription id to deregister
2033
+ * @param id client subscription id to deregister
2039
2034
  */
2040
- removeProgramAccountChangeListener(id: number): Promise<void>;
2035
+ removeProgramAccountChangeListener(
2036
+ clientSubscriptionId: ClientSubscriptionId,
2037
+ ): Promise<void>;
2041
2038
  /**
2042
2039
  * Registers a callback to be invoked whenever logs are emitted.
2043
2040
  */
@@ -2045,26 +2042,30 @@ declare module '@solana/web3.js' {
2045
2042
  filter: LogsFilter,
2046
2043
  callback: LogsCallback,
2047
2044
  commitment?: Commitment,
2048
- ): number;
2045
+ ): ClientSubscriptionId;
2049
2046
  /**
2050
2047
  * Deregister a logs callback.
2051
2048
  *
2052
- * @param id subscription id to deregister.
2049
+ * @param id client subscription id to deregister.
2053
2050
  */
2054
- removeOnLogsListener(id: number): Promise<void>;
2051
+ removeOnLogsListener(
2052
+ clientSubscriptionId: ClientSubscriptionId,
2053
+ ): Promise<void>;
2055
2054
  /**
2056
2055
  * Register a callback to be invoked upon slot changes
2057
2056
  *
2058
2057
  * @param callback Function to invoke whenever the slot changes
2059
2058
  * @return subscription id
2060
2059
  */
2061
- onSlotChange(callback: SlotChangeCallback): number;
2060
+ onSlotChange(callback: SlotChangeCallback): ClientSubscriptionId;
2062
2061
  /**
2063
2062
  * Deregister a slot notification callback
2064
2063
  *
2065
- * @param id subscription id to deregister
2064
+ * @param id client subscription id to deregister
2066
2065
  */
2067
- removeSlotChangeListener(id: number): Promise<void>;
2066
+ removeSlotChangeListener(
2067
+ clientSubscriptionId: ClientSubscriptionId,
2068
+ ): Promise<void>;
2068
2069
  /**
2069
2070
  * Register a callback to be invoked upon slot updates. {@link SlotUpdate}'s
2070
2071
  * may be useful to track live progress of a cluster.
@@ -2072,13 +2073,15 @@ declare module '@solana/web3.js' {
2072
2073
  * @param callback Function to invoke whenever the slot updates
2073
2074
  * @return subscription id
2074
2075
  */
2075
- onSlotUpdate(callback: SlotUpdateCallback): number;
2076
+ onSlotUpdate(callback: SlotUpdateCallback): ClientSubscriptionId;
2076
2077
  /**
2077
2078
  * Deregister a slot update notification callback
2078
2079
  *
2079
- * @param id subscription id to deregister
2080
+ * @param id client subscription id to deregister
2080
2081
  */
2081
- removeSlotUpdateListener(id: number): Promise<void>;
2082
+ removeSlotUpdateListener(
2083
+ clientSubscriptionId: ClientSubscriptionId,
2084
+ ): Promise<void>;
2082
2085
  _buildArgs(
2083
2086
  args: Array<any>,
2084
2087
  override?: Commitment,
@@ -2097,7 +2100,7 @@ declare module '@solana/web3.js' {
2097
2100
  signature: TransactionSignature,
2098
2101
  callback: SignatureResultCallback,
2099
2102
  commitment?: Commitment,
2100
- ): number;
2103
+ ): ClientSubscriptionId;
2101
2104
  /**
2102
2105
  * Register a callback to be invoked when a transaction is
2103
2106
  * received and/or processed.
@@ -2112,26 +2115,30 @@ declare module '@solana/web3.js' {
2112
2115
  signature: TransactionSignature,
2113
2116
  callback: SignatureSubscriptionCallback,
2114
2117
  options?: SignatureSubscriptionOptions,
2115
- ): number;
2118
+ ): ClientSubscriptionId;
2116
2119
  /**
2117
2120
  * Deregister a signature notification callback
2118
2121
  *
2119
- * @param id subscription id to deregister
2122
+ * @param id client subscription id to deregister
2120
2123
  */
2121
- removeSignatureListener(id: number): Promise<void>;
2124
+ removeSignatureListener(
2125
+ clientSubscriptionId: ClientSubscriptionId,
2126
+ ): Promise<void>;
2122
2127
  /**
2123
2128
  * Register a callback to be invoked upon root changes
2124
2129
  *
2125
2130
  * @param callback Function to invoke whenever the root changes
2126
2131
  * @return subscription id
2127
2132
  */
2128
- onRootChange(callback: RootChangeCallback): number;
2133
+ onRootChange(callback: RootChangeCallback): ClientSubscriptionId;
2129
2134
  /**
2130
2135
  * Deregister a root notification callback
2131
2136
  *
2132
- * @param id subscription id to deregister
2137
+ * @param id client subscription id to deregister
2133
2138
  */
2134
- removeRootChangeListener(id: number): Promise<void>;
2139
+ removeRootChangeListener(
2140
+ clientSubscriptionId: ClientSubscriptionId,
2141
+ ): Promise<void>;
2135
2142
  }
2136
2143
 
2137
2144
  export const BPF_LOADER_PROGRAM_ID: PublicKey;
@@ -2165,6 +2172,65 @@ declare module '@solana/web3.js' {
2165
2172
  ): Promise<boolean>;
2166
2173
  }
2167
2174
 
2175
+ /**
2176
+ * Compute Budget Instruction class
2177
+ */
2178
+ export class ComputeBudgetInstruction {
2179
+ /**
2180
+ * Decode a compute budget instruction and retrieve the instruction type.
2181
+ */
2182
+ static decodeInstructionType(
2183
+ instruction: TransactionInstruction,
2184
+ ): ComputeBudgetInstructionType;
2185
+ /**
2186
+ * Decode request units compute budget instruction and retrieve the instruction params.
2187
+ */
2188
+ static decodeRequestUnits(
2189
+ instruction: TransactionInstruction,
2190
+ ): RequestUnitsParams;
2191
+ /**
2192
+ * Decode request heap frame compute budget instruction and retrieve the instruction params.
2193
+ */
2194
+ static decodeRequestHeapFrame(
2195
+ instruction: TransactionInstruction,
2196
+ ): RequestHeapFrameParams;
2197
+ }
2198
+ /**
2199
+ * An enumeration of valid ComputeBudgetInstructionType's
2200
+ */
2201
+ export type ComputeBudgetInstructionType =
2202
+ | 'RequestUnits'
2203
+ | 'RequestHeapFrame';
2204
+ /**
2205
+ * Request units instruction params
2206
+ */
2207
+ interface RequestUnitsParams {
2208
+ /** Units to request for transaction-wide compute */
2209
+ units: number;
2210
+ /** Additional fee to pay */
2211
+ additionalFee: number;
2212
+ }
2213
+ /**
2214
+ * Request heap frame instruction params
2215
+ */
2216
+ export type RequestHeapFrameParams = {
2217
+ /** Requested transaction-wide program heap size in bytes. Must be multiple of 1024. Applies to each program, including CPIs. */
2218
+ bytes: number;
2219
+ };
2220
+ /**
2221
+ * Factory class for transaction instructions to interact with the Compute Budget program
2222
+ */
2223
+ export class ComputeBudgetProgram {
2224
+ /**
2225
+ * Public key that identifies the Compute Budget program
2226
+ */
2227
+ static programId: PublicKey;
2228
+ static requestUnits(params: RequestUnitsParams): TransactionInstruction;
2229
+ static requestHeapFrame(
2230
+ params: RequestHeapFrameParams,
2231
+ ): TransactionInstruction;
2232
+ }
2233
+
2168
2234
  /**
2169
2235
  * Params for creating an ed25519 instruction using a public key
2170
2236
  */