@solana/web3.js 1.57.1 → 1.58.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.
@@ -639,6 +639,121 @@ function encodeLength(bytes, len) {
639
639
  }
640
640
  }
641
641
 
642
+ function assert (condition, message) {
643
+ if (!condition) {
644
+ throw new Error(message || 'Assertion failed');
645
+ }
646
+ }
647
+
648
+ class CompiledKeys {
649
+ constructor(payer, keyMetaMap) {
650
+ this.payer = void 0;
651
+ this.keyMetaMap = void 0;
652
+ this.payer = payer;
653
+ this.keyMetaMap = keyMetaMap;
654
+ }
655
+
656
+ static compile(instructions, payer) {
657
+ const keyMetaMap = new Map();
658
+
659
+ const getOrInsertDefault = pubkey => {
660
+ const address = pubkey.toBase58();
661
+ let keyMeta = keyMetaMap.get(address);
662
+
663
+ if (keyMeta === undefined) {
664
+ keyMeta = {
665
+ isSigner: false,
666
+ isWritable: false,
667
+ isInvoked: false
668
+ };
669
+ keyMetaMap.set(address, keyMeta);
670
+ }
671
+
672
+ return keyMeta;
673
+ };
674
+
675
+ const payerKeyMeta = getOrInsertDefault(payer);
676
+ payerKeyMeta.isSigner = true;
677
+ payerKeyMeta.isWritable = true;
678
+
679
+ for (const ix of instructions) {
680
+ getOrInsertDefault(ix.programId).isInvoked = true;
681
+
682
+ for (const accountMeta of ix.keys) {
683
+ const keyMeta = getOrInsertDefault(accountMeta.pubkey);
684
+ keyMeta.isSigner || (keyMeta.isSigner = accountMeta.isSigner);
685
+ keyMeta.isWritable || (keyMeta.isWritable = accountMeta.isWritable);
686
+ }
687
+ }
688
+
689
+ return new CompiledKeys(payer, keyMetaMap);
690
+ }
691
+
692
+ getMessageComponents() {
693
+ const mapEntries = [...this.keyMetaMap.entries()];
694
+ assert(mapEntries.length <= 256, 'Max static account keys length exceeded');
695
+ const writableSigners = mapEntries.filter(([, meta]) => meta.isSigner && meta.isWritable);
696
+ const readonlySigners = mapEntries.filter(([, meta]) => meta.isSigner && !meta.isWritable);
697
+ const writableNonSigners = mapEntries.filter(([, meta]) => !meta.isSigner && meta.isWritable);
698
+ const readonlyNonSigners = mapEntries.filter(([, meta]) => !meta.isSigner && !meta.isWritable);
699
+ const header = {
700
+ numRequiredSignatures: writableSigners.length + readonlySigners.length,
701
+ numReadonlySignedAccounts: readonlySigners.length,
702
+ numReadonlyUnsignedAccounts: readonlyNonSigners.length
703
+ }; // sanity checks
704
+
705
+ {
706
+ assert(writableSigners.length > 0, 'Expected at least one writable signer key');
707
+ const [payerAddress] = writableSigners[0];
708
+ assert(payerAddress === this.payer.toBase58(), 'Expected first writable signer key to be the fee payer');
709
+ }
710
+ const staticAccountKeys = [...writableSigners.map(([address]) => new PublicKey(address)), ...readonlySigners.map(([address]) => new PublicKey(address)), ...writableNonSigners.map(([address]) => new PublicKey(address)), ...readonlyNonSigners.map(([address]) => new PublicKey(address))];
711
+ return [header, staticAccountKeys];
712
+ }
713
+
714
+ extractTableLookup(lookupTable) {
715
+ const [writableIndexes, drainedWritableKeys] = this.drainKeysFoundInLookupTable(lookupTable.state.addresses, keyMeta => !keyMeta.isSigner && !keyMeta.isInvoked && keyMeta.isWritable);
716
+ const [readonlyIndexes, drainedReadonlyKeys] = this.drainKeysFoundInLookupTable(lookupTable.state.addresses, keyMeta => !keyMeta.isSigner && !keyMeta.isInvoked && !keyMeta.isWritable); // Don't extract lookup if no keys were found
717
+
718
+ if (writableIndexes.length === 0 && readonlyIndexes.length === 0) {
719
+ return;
720
+ }
721
+
722
+ return [{
723
+ accountKey: lookupTable.key,
724
+ writableIndexes,
725
+ readonlyIndexes
726
+ }, {
727
+ writable: drainedWritableKeys,
728
+ readonly: drainedReadonlyKeys
729
+ }];
730
+ }
731
+ /** @internal */
732
+
733
+
734
+ drainKeysFoundInLookupTable(lookupTableEntries, keyMetaFilter) {
735
+ const lookupTableIndexes = new Array();
736
+ const drainedKeys = new Array();
737
+
738
+ for (const [address, keyMeta] of this.keyMetaMap.entries()) {
739
+ if (keyMetaFilter(keyMeta)) {
740
+ const key = new PublicKey(address);
741
+ const lookupTableIndex = lookupTableEntries.findIndex(entry => entry.equals(key));
742
+
743
+ if (lookupTableIndex >= 0) {
744
+ assert(lookupTableIndex < 256, 'Max lookup table index exceeded');
745
+ lookupTableIndexes.push(lookupTableIndex);
746
+ drainedKeys.push(key);
747
+ this.keyMetaMap.delete(address);
748
+ }
749
+ }
750
+ }
751
+
752
+ return [lookupTableIndexes, drainedKeys];
753
+ }
754
+
755
+ }
756
+
642
757
  const END_OF_BUFFER_ERROR_MESSAGE = 'Reached end of buffer unexpectedly';
643
758
  /**
644
759
  * Delegates to `Array#shift`, but throws if the array is zero-length.
@@ -714,6 +829,27 @@ class Message {
714
829
  return [];
715
830
  }
716
831
 
832
+ getAccountKeys() {
833
+ return new MessageAccountKeys(this.staticAccountKeys);
834
+ }
835
+
836
+ static compile(args) {
837
+ const compiledKeys = CompiledKeys.compile(args.instructions, args.payerKey);
838
+ const [header, staticAccountKeys] = compiledKeys.getMessageComponents();
839
+ const accountKeys = new MessageAccountKeys(staticAccountKeys);
840
+ const instructions = accountKeys.compileInstructions(args.instructions).map(ix => ({
841
+ programIdIndex: ix.programIdIndex,
842
+ accounts: ix.accountKeyIndexes,
843
+ data: bs58__default["default"].encode(ix.data)
844
+ }));
845
+ return new Message({
846
+ header,
847
+ accountKeys: staticAccountKeys,
848
+ recentBlockhash: args.recentBlockhash,
849
+ instructions
850
+ });
851
+ }
852
+
717
853
  isAccountSigner(index) {
718
854
  return index < this.header.numRequiredSignatures;
719
855
  }
@@ -802,7 +938,7 @@ class Message {
802
938
 
803
939
  for (let i = 0; i < accountCount; i++) {
804
940
  const account = guardedSplice(byteArray, 0, PUBLIC_KEY_LENGTH);
805
- accountKeys.push(bs58__default["default"].encode(buffer.Buffer.from(account)));
941
+ accountKeys.push(new PublicKey(buffer.Buffer.from(account)));
806
942
  }
807
943
 
808
944
  const recentBlockhash = guardedSplice(byteArray, 0, PUBLIC_KEY_LENGTH);
@@ -838,141 +974,87 @@ class Message {
838
974
 
839
975
  }
840
976
 
841
- function assert (condition, message) {
842
- if (!condition) {
843
- throw new Error(message || 'Assertion failed');
844
- }
845
- }
977
+ /**
978
+ * Message constructor arguments
979
+ */
846
980
 
847
- class CompiledKeys {
848
- constructor(payer, keyMetaMap) {
849
- this.payer = void 0;
850
- this.keyMetaMap = void 0;
851
- this.payer = payer;
852
- this.keyMetaMap = keyMetaMap;
981
+ class MessageV0 {
982
+ constructor(args) {
983
+ this.header = void 0;
984
+ this.staticAccountKeys = void 0;
985
+ this.recentBlockhash = void 0;
986
+ this.compiledInstructions = void 0;
987
+ this.addressTableLookups = void 0;
988
+ this.header = args.header;
989
+ this.staticAccountKeys = args.staticAccountKeys;
990
+ this.recentBlockhash = args.recentBlockhash;
991
+ this.compiledInstructions = args.compiledInstructions;
992
+ this.addressTableLookups = args.addressTableLookups;
853
993
  }
854
994
 
855
- static compile(instructions, payer) {
856
- const keyMetaMap = new Map();
857
-
858
- const getOrInsertDefault = pubkey => {
859
- const address = pubkey.toBase58();
860
- let keyMeta = keyMetaMap.get(address);
861
-
862
- if (keyMeta === undefined) {
863
- keyMeta = {
864
- isSigner: false,
865
- isWritable: false,
866
- isInvoked: false
867
- };
868
- keyMetaMap.set(address, keyMeta);
869
- }
870
-
871
- return keyMeta;
872
- };
873
-
874
- const payerKeyMeta = getOrInsertDefault(payer);
875
- payerKeyMeta.isSigner = true;
876
- payerKeyMeta.isWritable = true;
995
+ get version() {
996
+ return 0;
997
+ }
877
998
 
878
- for (const ix of instructions) {
879
- getOrInsertDefault(ix.programId).isInvoked = true;
999
+ get numAccountKeysFromLookups() {
1000
+ let count = 0;
880
1001
 
881
- for (const accountMeta of ix.keys) {
882
- const keyMeta = getOrInsertDefault(accountMeta.pubkey);
883
- keyMeta.isSigner || (keyMeta.isSigner = accountMeta.isSigner);
884
- keyMeta.isWritable || (keyMeta.isWritable = accountMeta.isWritable);
885
- }
1002
+ for (const lookup of this.addressTableLookups) {
1003
+ count += lookup.readonlyIndexes.length + lookup.writableIndexes.length;
886
1004
  }
887
1005
 
888
- return new CompiledKeys(payer, keyMetaMap);
1006
+ return count;
889
1007
  }
890
1008
 
891
- getMessageComponents() {
892
- const mapEntries = [...this.keyMetaMap.entries()];
893
- assert(mapEntries.length <= 256, 'Max static account keys length exceeded');
894
- const writableSigners = mapEntries.filter(([, meta]) => meta.isSigner && meta.isWritable);
895
- const readonlySigners = mapEntries.filter(([, meta]) => meta.isSigner && !meta.isWritable);
896
- const writableNonSigners = mapEntries.filter(([, meta]) => !meta.isSigner && meta.isWritable);
897
- const readonlyNonSigners = mapEntries.filter(([, meta]) => !meta.isSigner && !meta.isWritable);
898
- const header = {
899
- numRequiredSignatures: writableSigners.length + readonlySigners.length,
900
- numReadonlySignedAccounts: readonlySigners.length,
901
- numReadonlyUnsignedAccounts: readonlyNonSigners.length
902
- }; // sanity checks
903
-
904
- {
905
- assert(writableSigners.length > 0, 'Expected at least one writable signer key');
906
- const [payerAddress] = writableSigners[0];
907
- assert(payerAddress === this.payer.toBase58(), 'Expected first writable signer key to be the fee payer');
908
- }
909
- const staticAccountKeys = [...writableSigners.map(([address]) => new PublicKey(address)), ...readonlySigners.map(([address]) => new PublicKey(address)), ...writableNonSigners.map(([address]) => new PublicKey(address)), ...readonlyNonSigners.map(([address]) => new PublicKey(address))];
910
- return [header, staticAccountKeys];
911
- }
1009
+ getAccountKeys(args) {
1010
+ let accountKeysFromLookups;
912
1011
 
913
- extractTableLookup(lookupTable) {
914
- const [writableIndexes, drainedWritableKeys] = this.drainKeysFoundInLookupTable(lookupTable.state.addresses, keyMeta => !keyMeta.isSigner && !keyMeta.isInvoked && keyMeta.isWritable);
915
- const [readonlyIndexes, drainedReadonlyKeys] = this.drainKeysFoundInLookupTable(lookupTable.state.addresses, keyMeta => !keyMeta.isSigner && !keyMeta.isInvoked && !keyMeta.isWritable); // Don't extract lookup if no keys were found
1012
+ if (args && 'accountKeysFromLookups' in args) {
1013
+ if (this.numAccountKeysFromLookups != args.accountKeysFromLookups.writable.length + args.accountKeysFromLookups.readonly.length) {
1014
+ throw new Error('Failed to get account keys because of a mismatch in the number of account keys from lookups');
1015
+ }
916
1016
 
917
- if (writableIndexes.length === 0 && readonlyIndexes.length === 0) {
918
- return;
1017
+ accountKeysFromLookups = args.accountKeysFromLookups;
1018
+ } else if (args && 'addressLookupTableAccounts' in args) {
1019
+ accountKeysFromLookups = this.resolveAddressTableLookups(args.addressLookupTableAccounts);
1020
+ } else if (this.addressTableLookups.length > 0) {
1021
+ throw new Error('Failed to get account keys because address table lookups were not resolved');
919
1022
  }
920
1023
 
921
- return [{
922
- accountKey: lookupTable.key,
923
- writableIndexes,
924
- readonlyIndexes
925
- }, {
926
- writable: drainedWritableKeys,
927
- readonly: drainedReadonlyKeys
928
- }];
1024
+ return new MessageAccountKeys(this.staticAccountKeys, accountKeysFromLookups);
929
1025
  }
930
- /** @internal */
931
1026
 
1027
+ resolveAddressTableLookups(addressLookupTableAccounts) {
1028
+ const accountKeysFromLookups = {
1029
+ writable: [],
1030
+ readonly: []
1031
+ };
932
1032
 
933
- drainKeysFoundInLookupTable(lookupTableEntries, keyMetaFilter) {
934
- const lookupTableIndexes = new Array();
935
- const drainedKeys = new Array();
1033
+ for (const tableLookup of this.addressTableLookups) {
1034
+ const tableAccount = addressLookupTableAccounts.find(account => account.key.equals(tableLookup.accountKey));
936
1035
 
937
- for (const [address, keyMeta] of this.keyMetaMap.entries()) {
938
- if (keyMetaFilter(keyMeta)) {
939
- const key = new PublicKey(address);
940
- const lookupTableIndex = lookupTableEntries.findIndex(entry => entry.equals(key));
1036
+ if (!tableAccount) {
1037
+ throw new Error(`Failed to find address lookup table account for table key ${tableLookup.accountKey.toBase58()}`);
1038
+ }
941
1039
 
942
- if (lookupTableIndex >= 0) {
943
- assert(lookupTableIndex < 256, 'Max lookup table index exceeded');
944
- lookupTableIndexes.push(lookupTableIndex);
945
- drainedKeys.push(key);
946
- this.keyMetaMap.delete(address);
1040
+ for (const index of tableLookup.writableIndexes) {
1041
+ if (index < tableAccount.state.addresses.length) {
1042
+ accountKeysFromLookups.writable.push(tableAccount.state.addresses[index]);
1043
+ } else {
1044
+ throw new Error(`Failed to find address for index ${index} in address lookup table ${tableLookup.accountKey.toBase58()}`);
947
1045
  }
948
1046
  }
949
- }
950
-
951
- return [lookupTableIndexes, drainedKeys];
952
- }
953
-
954
- }
955
1047
 
956
- /**
957
- * Message constructor arguments
958
- */
959
-
960
- class MessageV0 {
961
- constructor(args) {
962
- this.header = void 0;
963
- this.staticAccountKeys = void 0;
964
- this.recentBlockhash = void 0;
965
- this.compiledInstructions = void 0;
966
- this.addressTableLookups = void 0;
967
- this.header = args.header;
968
- this.staticAccountKeys = args.staticAccountKeys;
969
- this.recentBlockhash = args.recentBlockhash;
970
- this.compiledInstructions = args.compiledInstructions;
971
- this.addressTableLookups = args.addressTableLookups;
972
- }
1048
+ for (const index of tableLookup.readonlyIndexes) {
1049
+ if (index < tableAccount.state.addresses.length) {
1050
+ accountKeysFromLookups.readonly.push(tableAccount.state.addresses[index]);
1051
+ } else {
1052
+ throw new Error(`Failed to find address for index ${index} in address lookup table ${tableLookup.accountKey.toBase58()}`);
1053
+ }
1054
+ }
1055
+ }
973
1056
 
974
- get version() {
975
- return 0;
1057
+ return accountKeysFromLookups;
976
1058
  }
977
1059
 
978
1060
  static compile(args) {
@@ -1903,6 +1985,114 @@ class Transaction {
1903
1985
 
1904
1986
  }
1905
1987
 
1988
+ class TransactionMessage {
1989
+ constructor(args) {
1990
+ this.accountKeys = void 0;
1991
+ this.instructions = void 0;
1992
+ this.recentBlockhash = void 0;
1993
+ this.accountKeys = args.accountKeys;
1994
+ this.instructions = args.instructions;
1995
+ this.recentBlockhash = args.recentBlockhash;
1996
+ }
1997
+
1998
+ static decompile(message, args) {
1999
+ const {
2000
+ header,
2001
+ compiledInstructions,
2002
+ recentBlockhash
2003
+ } = message;
2004
+ const {
2005
+ numRequiredSignatures,
2006
+ numReadonlySignedAccounts,
2007
+ numReadonlyUnsignedAccounts
2008
+ } = header;
2009
+ const numWritableSignedAccounts = numRequiredSignatures - numReadonlySignedAccounts;
2010
+ assert(numWritableSignedAccounts > 0, 'Message header is invalid');
2011
+ const numWritableUnsignedAccounts = message.staticAccountKeys.length - numReadonlyUnsignedAccounts;
2012
+ assert(numWritableUnsignedAccounts >= 0, 'Message header is invalid');
2013
+ const accountKeys = message.getAccountKeys(args);
2014
+ const instructions = [];
2015
+
2016
+ for (const compiledIx of compiledInstructions) {
2017
+ const keys = [];
2018
+
2019
+ for (const keyIndex of compiledIx.accountKeyIndexes) {
2020
+ const pubkey = accountKeys.get(keyIndex);
2021
+
2022
+ if (pubkey === undefined) {
2023
+ throw new Error(`Failed to find key for account key index ${keyIndex}`);
2024
+ }
2025
+
2026
+ const isSigner = keyIndex < numRequiredSignatures;
2027
+ let isWritable;
2028
+
2029
+ if (isSigner) {
2030
+ isWritable = keyIndex < numWritableSignedAccounts;
2031
+ } else if (keyIndex < accountKeys.staticAccountKeys.length) {
2032
+ isWritable = keyIndex - numRequiredSignatures < numWritableUnsignedAccounts;
2033
+ } else {
2034
+ isWritable = keyIndex - accountKeys.staticAccountKeys.length < // accountKeysFromLookups cannot be undefined because we already found a pubkey for this index above
2035
+ accountKeys.accountKeysFromLookups.writable.length;
2036
+ }
2037
+
2038
+ keys.push({
2039
+ pubkey,
2040
+ isSigner: keyIndex < header.numRequiredSignatures,
2041
+ isWritable
2042
+ });
2043
+ }
2044
+
2045
+ const programId = accountKeys.get(compiledIx.programIdIndex);
2046
+
2047
+ if (programId === undefined) {
2048
+ throw new Error(`Failed to find program id for program id index ${compiledIx.programIdIndex}`);
2049
+ }
2050
+
2051
+ instructions.push(new TransactionInstruction({
2052
+ programId,
2053
+ data: toBuffer(compiledIx.data),
2054
+ keys
2055
+ }));
2056
+ }
2057
+
2058
+ return new TransactionMessage({
2059
+ accountKeys,
2060
+ instructions,
2061
+ recentBlockhash
2062
+ });
2063
+ }
2064
+
2065
+ compileToLegacyMessage() {
2066
+ const payerKey = this.accountKeys.get(0);
2067
+
2068
+ if (payerKey === undefined) {
2069
+ throw new Error('Failed to compile message because no account keys were found');
2070
+ }
2071
+
2072
+ return Message.compile({
2073
+ payerKey,
2074
+ recentBlockhash: this.recentBlockhash,
2075
+ instructions: this.instructions
2076
+ });
2077
+ }
2078
+
2079
+ compileToV0Message(addressLookupTableAccounts) {
2080
+ const payerKey = this.accountKeys.get(0);
2081
+
2082
+ if (payerKey === undefined) {
2083
+ throw new Error('Failed to compile message because no account keys were found');
2084
+ }
2085
+
2086
+ return MessageV0.compile({
2087
+ payerKey,
2088
+ recentBlockhash: this.recentBlockhash,
2089
+ instructions: this.instructions,
2090
+ addressLookupTableAccounts
2091
+ });
2092
+ }
2093
+
2094
+ }
2095
+
1906
2096
  /**
1907
2097
  * Versioned transaction class
1908
2098
  */
@@ -4346,7 +4536,7 @@ const LogsNotificationResult = superstruct.type({
4346
4536
 
4347
4537
  /** @internal */
4348
4538
  const COMMON_HTTP_HEADERS = {
4349
- 'solana-client': `js/${(_process$env$npm_pack = "1.57.1") !== null && _process$env$npm_pack !== void 0 ? _process$env$npm_pack : 'UNKNOWN'}`
4539
+ 'solana-client': `js/${(_process$env$npm_pack = "1.58.1") !== null && _process$env$npm_pack !== void 0 ? _process$env$npm_pack : 'UNKNOWN'}`
4350
4540
  };
4351
4541
  /**
4352
4542
  * A connection to a fullnode JSON RPC endpoint
@@ -6204,12 +6394,46 @@ class Connection {
6204
6394
 
6205
6395
  return res.result;
6206
6396
  }
6397
+ /**
6398
+ * Simulate a transaction
6399
+ *
6400
+ * @deprecated Instead, call {@link simulateTransaction} with {@link
6401
+ * VersionedTransaction} and {@link SimulateTransactionConfig} parameters
6402
+ */
6403
+
6404
+
6207
6405
  /**
6208
6406
  * Simulate a transaction
6209
6407
  */
6408
+ // eslint-disable-next-line no-dupe-class-members
6409
+ async simulateTransaction(transactionOrMessage, configOrSigners, includeAccounts) {
6410
+ if ('message' in transactionOrMessage) {
6411
+ const versionedTx = transactionOrMessage;
6412
+ const wireTransaction = versionedTx.serialize();
6413
+ const encodedTransaction = buffer.Buffer.from(wireTransaction).toString('base64');
6414
+
6415
+ if (Array.isArray(configOrSigners) || includeAccounts !== undefined) {
6416
+ throw new Error('Invalid arguments');
6417
+ }
6418
+
6419
+ const config = configOrSigners || {};
6420
+ config.encoding = 'base64';
6421
+
6422
+ if (!('commitment' in config)) {
6423
+ config.commitment = this.commitment;
6424
+ }
6210
6425
 
6426
+ const args = [encodedTransaction, config];
6427
+ const unsafeRes = await this._rpcRequest('simulateTransaction', args);
6428
+ const res = superstruct.create(unsafeRes, SimulatedTransactionResponseStruct);
6429
+
6430
+ if ('error' in res) {
6431
+ throw new Error('failed to simulate transaction: ' + res.error.message);
6432
+ }
6433
+
6434
+ return res.result;
6435
+ }
6211
6436
 
6212
- async simulateTransaction(transactionOrMessage, signers, includeAccounts) {
6213
6437
  let transaction;
6214
6438
 
6215
6439
  if (transactionOrMessage instanceof Transaction) {
@@ -6225,6 +6449,12 @@ class Connection {
6225
6449
  transaction._message = transaction._json = undefined;
6226
6450
  }
6227
6451
 
6452
+ if (configOrSigners !== undefined && !Array.isArray(configOrSigners)) {
6453
+ throw new Error('Invalid arguments');
6454
+ }
6455
+
6456
+ const signers = configOrSigners;
6457
+
6228
6458
  if (transaction.nonceInfo && signers) {
6229
6459
  transaction.sign(...signers);
6230
6460
  } else {
@@ -6307,10 +6537,32 @@ class Connection {
6307
6537
  }
6308
6538
  /**
6309
6539
  * Sign and send a transaction
6540
+ *
6541
+ * @deprecated Instead, call {@link sendTransaction} with a {@link
6542
+ * VersionedTransaction}
6310
6543
  */
6311
6544
 
6312
6545
 
6313
- async sendTransaction(transaction, signers, options) {
6546
+ /**
6547
+ * Sign and send a transaction
6548
+ */
6549
+ // eslint-disable-next-line no-dupe-class-members
6550
+ async sendTransaction(transaction, signersOrOptions, options) {
6551
+ if ('message' in transaction) {
6552
+ if (signersOrOptions && Array.isArray(signersOrOptions)) {
6553
+ throw new Error('Invalid arguments');
6554
+ }
6555
+
6556
+ const wireTransaction = transaction.serialize();
6557
+ return await this.sendRawTransaction(wireTransaction, options);
6558
+ }
6559
+
6560
+ if (signersOrOptions === undefined || !Array.isArray(signersOrOptions)) {
6561
+ throw new Error('Invalid arguments');
6562
+ }
6563
+
6564
+ const signers = signersOrOptions;
6565
+
6314
6566
  if (transaction.nonceInfo) {
6315
6567
  transaction.sign(...signers);
6316
6568
  } else {
@@ -9394,6 +9646,7 @@ exports.Transaction = Transaction;
9394
9646
  exports.TransactionExpiredBlockheightExceededError = TransactionExpiredBlockheightExceededError;
9395
9647
  exports.TransactionExpiredTimeoutError = TransactionExpiredTimeoutError;
9396
9648
  exports.TransactionInstruction = TransactionInstruction;
9649
+ exports.TransactionMessage = TransactionMessage;
9397
9650
  exports.VALIDATOR_INFO_KEY = VALIDATOR_INFO_KEY;
9398
9651
  exports.VERSION_PREFIX_MASK = VERSION_PREFIX_MASK;
9399
9652
  exports.VOTE_PROGRAM_ID = VOTE_PROGRAM_ID;