@solana/web3.js 1.57.0 → 1.58.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
@@ -352,12 +352,17 @@ declare module '@solana/web3.js' {
352
352
  /** The message header, identifying signed and read-only `accountKeys` */
353
353
  header: MessageHeader;
354
354
  /** All the account keys used by this transaction */
355
- accountKeys: string[];
355
+ accountKeys: string[] | PublicKey[];
356
356
  /** The hash of a recent ledger block */
357
357
  recentBlockhash: Blockhash;
358
358
  /** Instructions that will be executed in sequence and committed in one atomic transaction if all succeed. */
359
359
  instructions: CompiledInstruction[];
360
360
  };
361
+ export type CompileLegacyArgs = {
362
+ payerKey: PublicKey;
363
+ instructions: Array<TransactionInstruction>;
364
+ recentBlockhash: Blockhash;
365
+ };
361
366
  /**
362
367
  * List of instructions to be processed atomically
363
368
  */
@@ -372,6 +377,8 @@ declare module '@solana/web3.js' {
372
377
  get staticAccountKeys(): Array<PublicKey>;
373
378
  get compiledInstructions(): Array<MessageCompiledInstruction>;
374
379
  get addressTableLookups(): Array<MessageAddressTableLookup>;
380
+ getAccountKeys(): MessageAccountKeys;
381
+ static compile(args: CompileLegacyArgs): Message;
375
382
  isAccountSigner(index: number): boolean;
376
383
  isAccountWritable(index: number): boolean;
377
384
  isProgramId(index: number): boolean;
@@ -1528,6 +1535,13 @@ declare module '@solana/web3.js' {
1528
1535
  recentBlockhash: Blockhash;
1529
1536
  addressLookupTableAccounts?: Array<AddressLookupTableAccount>;
1530
1537
  };
1538
+ export type GetAccountKeysArgs =
1539
+ | {
1540
+ accountKeysFromLookups: AccountKeysFromLookups;
1541
+ }
1542
+ | {
1543
+ addressLookupTableAccounts: AddressLookupTableAccount[];
1544
+ };
1531
1545
  export class MessageV0 {
1532
1546
  header: MessageHeader;
1533
1547
  staticAccountKeys: Array<PublicKey>;
@@ -1536,6 +1550,11 @@ declare module '@solana/web3.js' {
1536
1550
  addressTableLookups: Array<MessageAddressTableLookup>;
1537
1551
  constructor(args: MessageV0Args);
1538
1552
  get version(): 0;
1553
+ get numAccountKeysFromLookups(): number;
1554
+ getAccountKeys(args?: GetAccountKeysArgs): MessageAccountKeys;
1555
+ resolveAddressTableLookups(
1556
+ addressLookupTableAccounts: AddressLookupTableAccount[],
1557
+ ): AccountKeysFromLookups;
1539
1558
  static compile(args: CompileV0Args): MessageV0;
1540
1559
  serialize(): Uint8Array;
1541
1560
  private serializeInstructions;
@@ -1804,6 +1823,33 @@ declare module '@solana/web3.js' {
1804
1823
  static populate(message: Message, signatures?: Array<string>): Transaction;
1805
1824
  }
1806
1825
 
1826
+ export type TransactionMessageArgs = {
1827
+ accountKeys: MessageAccountKeys;
1828
+ instructions: Array<TransactionInstruction>;
1829
+ recentBlockhash: Blockhash;
1830
+ };
1831
+ export type DecompileArgs =
1832
+ | {
1833
+ accountKeysFromLookups: AccountKeysFromLookups;
1834
+ }
1835
+ | {
1836
+ addressLookupTableAccounts: AddressLookupTableAccount[];
1837
+ };
1838
+ export class TransactionMessage {
1839
+ accountKeys: MessageAccountKeys;
1840
+ instructions: Array<TransactionInstruction>;
1841
+ recentBlockhash: Blockhash;
1842
+ constructor(args: TransactionMessageArgs);
1843
+ static decompile(
1844
+ message: VersionedMessage,
1845
+ args?: DecompileArgs,
1846
+ ): TransactionMessage;
1847
+ compileToLegacyMessage(): Message;
1848
+ compileToV0Message(
1849
+ addressLookupTableAccounts?: AddressLookupTableAccount[],
1850
+ ): MessageV0;
1851
+ }
1852
+
1807
1853
  export type TransactionVersion = 'legacy' | 0;
1808
1854
  /**
1809
1855
  * Versioned transaction class
@@ -2190,6 +2236,21 @@ declare module '@solana/web3.js' {
2190
2236
  programId: string;
2191
2237
  data: [string, TransactionReturnDataEncoding];
2192
2238
  };
2239
+ export type SimulateTransactionConfig = {
2240
+ /** Optional parameter used to enable signature verification before simulation */
2241
+ sigVerify?: boolean;
2242
+ /** Optional parameter used to replace the simulated transaction's recent blockhash with the latest blockhash */
2243
+ replaceRecentBlockhash?: boolean;
2244
+ /** Optional parameter used to set the commitment level when selecting the latest block */
2245
+ commitment?: Commitment;
2246
+ /** Optional parameter used to specify a list of account addresses to return post simulation state for */
2247
+ accounts?: {
2248
+ encoding: 'base64';
2249
+ addresses: string[];
2250
+ };
2251
+ /** Optional parameter used to specify the minimum block slot that can be used for simulation */
2252
+ minContextSlot?: number;
2253
+ };
2193
2254
  export type SimulatedTransactionResponse = {
2194
2255
  err: TransactionError | string | null;
2195
2256
  logs: Array<string> | null;
@@ -3568,20 +3629,40 @@ declare module '@solana/web3.js' {
3568
3629
  ): Promise<RpcResponseAndContext<number>>;
3569
3630
  /**
3570
3631
  * Simulate a transaction
3632
+ *
3633
+ * @deprecated Instead, call {@link simulateTransaction} with {@link
3634
+ * VersionedTransaction} and {@link SimulateTransactionConfig} parameters
3571
3635
  */
3572
3636
  simulateTransaction(
3573
3637
  transactionOrMessage: Transaction | Message,
3574
3638
  signers?: Array<Signer>,
3575
3639
  includeAccounts?: boolean | Array<PublicKey>,
3576
3640
  ): Promise<RpcResponseAndContext<SimulatedTransactionResponse>>;
3641
+ /**
3642
+ * Simulate a transaction
3643
+ */
3644
+ simulateTransaction(
3645
+ transaction: VersionedTransaction,
3646
+ config?: SimulateTransactionConfig,
3647
+ ): Promise<RpcResponseAndContext<SimulatedTransactionResponse>>;
3577
3648
  /**
3578
3649
  * Sign and send a transaction
3650
+ *
3651
+ * @deprecated Instead, call {@link sendTransaction} with a {@link
3652
+ * VersionedTransaction}
3579
3653
  */
3580
3654
  sendTransaction(
3581
3655
  transaction: Transaction,
3582
3656
  signers: Array<Signer>,
3583
3657
  options?: SendOptions,
3584
3658
  ): Promise<TransactionSignature>;
3659
+ /**
3660
+ * Send a signed transaction
3661
+ */
3662
+ sendTransaction(
3663
+ transaction: VersionedTransaction,
3664
+ options?: SendOptions,
3665
+ ): Promise<TransactionSignature>;
3585
3666
  /**
3586
3667
  * Send a transaction that has already been signed and serialized into the
3587
3668
  * wire format