@solana/web3.js 1.56.1 → 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.cjs.js CHANGED
@@ -149,12 +149,14 @@ const PUBLIC_KEY_LENGTH = 32;
149
149
 
150
150
  function isPublicKeyData(value) {
151
151
  return value._bn !== undefined;
152
- }
152
+ } // local counter used by PublicKey.unique()
153
+
154
+
155
+ let uniquePublicKeyCounter = 1;
153
156
  /**
154
157
  * A public key
155
158
  */
156
159
 
157
-
158
160
  class PublicKey extends Struct {
159
161
  /** @internal */
160
162
 
@@ -187,6 +189,16 @@ class PublicKey extends Struct {
187
189
  }
188
190
  }
189
191
  }
192
+ /**
193
+ * Returns a unique PublicKey for tests and benchmarks using acounter
194
+ */
195
+
196
+
197
+ static unique() {
198
+ const key = new PublicKey(uniquePublicKeyCounter);
199
+ uniquePublicKeyCounter += 1;
200
+ return new PublicKey(key.toBuffer());
201
+ }
190
202
  /**
191
203
  * Default public key value. (All zeros)
192
204
  */
@@ -443,6 +455,71 @@ Object.defineProperty(TransactionExpiredTimeoutError.prototype, 'name', {
443
455
  value: 'TransactionExpiredTimeoutError'
444
456
  });
445
457
 
458
+ class MessageAccountKeys {
459
+ constructor(staticAccountKeys, accountKeysFromLookups) {
460
+ this.staticAccountKeys = void 0;
461
+ this.accountKeysFromLookups = void 0;
462
+ this.staticAccountKeys = staticAccountKeys;
463
+ this.accountKeysFromLookups = accountKeysFromLookups;
464
+ }
465
+
466
+ keySegments() {
467
+ const keySegments = [this.staticAccountKeys];
468
+
469
+ if (this.accountKeysFromLookups) {
470
+ keySegments.push(this.accountKeysFromLookups.writable);
471
+ keySegments.push(this.accountKeysFromLookups.readonly);
472
+ }
473
+
474
+ return keySegments;
475
+ }
476
+
477
+ get(index) {
478
+ for (const keySegment of this.keySegments()) {
479
+ if (index < keySegment.length) {
480
+ return keySegment[index];
481
+ } else {
482
+ index -= keySegment.length;
483
+ }
484
+ }
485
+
486
+ return;
487
+ }
488
+
489
+ get length() {
490
+ return this.keySegments().flat().length;
491
+ }
492
+
493
+ compileInstructions(instructions) {
494
+ // Bail early if any account indexes would overflow a u8
495
+ const U8_MAX = 255;
496
+
497
+ if (this.length > U8_MAX + 1) {
498
+ throw new Error('Account index overflow encountered during compilation');
499
+ }
500
+
501
+ const keyIndexMap = new Map();
502
+ this.keySegments().flat().forEach((key, index) => {
503
+ keyIndexMap.set(key.toBase58(), index);
504
+ });
505
+
506
+ const findKeyIndex = key => {
507
+ const keyIndex = keyIndexMap.get(key.toBase58());
508
+ if (keyIndex === undefined) throw new Error('Encountered an unknown instruction account key during compilation');
509
+ return keyIndex;
510
+ };
511
+
512
+ return instructions.map(instruction => {
513
+ return {
514
+ programIdIndex: findKeyIndex(instruction.programId),
515
+ accountKeyIndexes: instruction.keys.map(meta => findKeyIndex(meta.pubkey)),
516
+ data: instruction.data
517
+ };
518
+ });
519
+ }
520
+
521
+ }
522
+
446
523
  /**
447
524
  * Layout for a public key
448
525
  */
@@ -568,6 +645,129 @@ function encodeLength(bytes, len) {
568
645
  }
569
646
  }
570
647
 
648
+ function assert (condition, message) {
649
+ if (!condition) {
650
+ throw new Error(message || 'Assertion failed');
651
+ }
652
+ }
653
+
654
+ class CompiledKeys {
655
+ constructor(payer, keyMetaMap) {
656
+ this.payer = void 0;
657
+ this.keyMetaMap = void 0;
658
+ this.payer = payer;
659
+ this.keyMetaMap = keyMetaMap;
660
+ }
661
+
662
+ static compile(instructions, payer) {
663
+ const keyMetaMap = new Map();
664
+
665
+ const getOrInsertDefault = pubkey => {
666
+ const address = pubkey.toBase58();
667
+ let keyMeta = keyMetaMap.get(address);
668
+
669
+ if (keyMeta === undefined) {
670
+ keyMeta = {
671
+ isSigner: false,
672
+ isWritable: false,
673
+ isInvoked: false
674
+ };
675
+ keyMetaMap.set(address, keyMeta);
676
+ }
677
+
678
+ return keyMeta;
679
+ };
680
+
681
+ const payerKeyMeta = getOrInsertDefault(payer);
682
+ payerKeyMeta.isSigner = true;
683
+ payerKeyMeta.isWritable = true;
684
+
685
+ for (const ix of instructions) {
686
+ getOrInsertDefault(ix.programId).isInvoked = true;
687
+
688
+ for (const accountMeta of ix.keys) {
689
+ const keyMeta = getOrInsertDefault(accountMeta.pubkey);
690
+ keyMeta.isSigner || (keyMeta.isSigner = accountMeta.isSigner);
691
+ keyMeta.isWritable || (keyMeta.isWritable = accountMeta.isWritable);
692
+ }
693
+ }
694
+
695
+ return new CompiledKeys(payer, keyMetaMap);
696
+ }
697
+
698
+ getMessageComponents() {
699
+ const mapEntries = [...this.keyMetaMap.entries()];
700
+ assert(mapEntries.length <= 256, 'Max static account keys length exceeded');
701
+ const writableSigners = mapEntries.filter(([, meta]) => meta.isSigner && meta.isWritable);
702
+ const readonlySigners = mapEntries.filter(([, meta]) => meta.isSigner && !meta.isWritable);
703
+ const writableNonSigners = mapEntries.filter(([, meta]) => !meta.isSigner && meta.isWritable);
704
+ const readonlyNonSigners = mapEntries.filter(([, meta]) => !meta.isSigner && !meta.isWritable);
705
+ const header = {
706
+ numRequiredSignatures: writableSigners.length + readonlySigners.length,
707
+ numReadonlySignedAccounts: readonlySigners.length,
708
+ numReadonlyUnsignedAccounts: readonlyNonSigners.length
709
+ }; // sanity checks
710
+
711
+ {
712
+ assert(writableSigners.length > 0, 'Expected at least one writable signer key');
713
+ const [payerAddress] = writableSigners[0];
714
+ assert(payerAddress === this.payer.toBase58(), 'Expected first writable signer key to be the fee payer');
715
+ }
716
+ 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))];
717
+ return [header, staticAccountKeys];
718
+ }
719
+
720
+ extractTableLookup(lookupTable) {
721
+ const [writableIndexes, drainedWritableKeys] = this.drainKeysFoundInLookupTable(lookupTable.state.addresses, keyMeta => !keyMeta.isSigner && !keyMeta.isInvoked && keyMeta.isWritable);
722
+ const [readonlyIndexes, drainedReadonlyKeys] = this.drainKeysFoundInLookupTable(lookupTable.state.addresses, keyMeta => !keyMeta.isSigner && !keyMeta.isInvoked && !keyMeta.isWritable); // Don't extract lookup if no keys were found
723
+
724
+ if (writableIndexes.length === 0 && readonlyIndexes.length === 0) {
725
+ return;
726
+ }
727
+
728
+ return [{
729
+ accountKey: lookupTable.key,
730
+ writableIndexes,
731
+ readonlyIndexes
732
+ }, {
733
+ writable: drainedWritableKeys,
734
+ readonly: drainedReadonlyKeys
735
+ }];
736
+ }
737
+ /** @internal */
738
+
739
+
740
+ drainKeysFoundInLookupTable(lookupTableEntries, keyMetaFilter) {
741
+ const lookupTableIndexes = new Array();
742
+ const drainedKeys = new Array();
743
+
744
+ for (const [address, keyMeta] of this.keyMetaMap.entries()) {
745
+ if (keyMetaFilter(keyMeta)) {
746
+ const key = new PublicKey(address);
747
+ const lookupTableIndex = lookupTableEntries.findIndex(entry => entry.equals(key));
748
+
749
+ if (lookupTableIndex >= 0) {
750
+ assert(lookupTableIndex < 256, 'Max lookup table index exceeded');
751
+ lookupTableIndexes.push(lookupTableIndex);
752
+ drainedKeys.push(key);
753
+ this.keyMetaMap.delete(address);
754
+ }
755
+ }
756
+ }
757
+
758
+ return [lookupTableIndexes, drainedKeys];
759
+ }
760
+
761
+ }
762
+
763
+ /**
764
+ * An instruction to execute by a program
765
+ *
766
+ * @property {number} programIdIndex
767
+ * @property {number[]} accounts
768
+ * @property {string} data
769
+ */
770
+
571
771
  /**
572
772
  * List of instructions to be processed atomically
573
773
  */
@@ -605,6 +805,27 @@ class Message {
605
805
  return [];
606
806
  }
607
807
 
808
+ getAccountKeys() {
809
+ return new MessageAccountKeys(this.staticAccountKeys);
810
+ }
811
+
812
+ static compile(args) {
813
+ const compiledKeys = CompiledKeys.compile(args.instructions, args.payerKey);
814
+ const [header, staticAccountKeys] = compiledKeys.getMessageComponents();
815
+ const accountKeys = new MessageAccountKeys(staticAccountKeys);
816
+ const instructions = accountKeys.compileInstructions(args.instructions).map(ix => ({
817
+ programIdIndex: ix.programIdIndex,
818
+ accounts: ix.accountKeyIndexes,
819
+ data: bs58__default["default"].encode(ix.data)
820
+ }));
821
+ return new Message({
822
+ header,
823
+ accountKeys: staticAccountKeys,
824
+ recentBlockhash: args.recentBlockhash,
825
+ instructions
826
+ });
827
+ }
828
+
608
829
  isAccountSigner(index) {
609
830
  return index < this.header.numRequiredSignatures;
610
831
  }
@@ -694,7 +915,7 @@ class Message {
694
915
  for (let i = 0; i < accountCount; i++) {
695
916
  const account = byteArray.slice(0, PUBLIC_KEY_LENGTH);
696
917
  byteArray = byteArray.slice(PUBLIC_KEY_LENGTH);
697
- accountKeys.push(bs58__default["default"].encode(buffer.Buffer.from(account)));
918
+ accountKeys.push(new PublicKey(buffer.Buffer.from(account)));
698
919
  }
699
920
 
700
921
  const recentBlockhash = byteArray.slice(0, PUBLIC_KEY_LENGTH);
@@ -733,12 +954,6 @@ class Message {
733
954
 
734
955
  }
735
956
 
736
- function assert (condition, message) {
737
- if (!condition) {
738
- throw new Error(message || 'Assertion failed');
739
- }
740
- }
741
-
742
957
  /**
743
958
  * Message constructor arguments
744
959
  */
@@ -761,6 +976,102 @@ class MessageV0 {
761
976
  return 0;
762
977
  }
763
978
 
979
+ get numAccountKeysFromLookups() {
980
+ let count = 0;
981
+
982
+ for (const lookup of this.addressTableLookups) {
983
+ count += lookup.readonlyIndexes.length + lookup.writableIndexes.length;
984
+ }
985
+
986
+ return count;
987
+ }
988
+
989
+ getAccountKeys(args) {
990
+ let accountKeysFromLookups;
991
+
992
+ if (args && 'accountKeysFromLookups' in args) {
993
+ if (this.numAccountKeysFromLookups != args.accountKeysFromLookups.writable.length + args.accountKeysFromLookups.readonly.length) {
994
+ throw new Error('Failed to get account keys because of a mismatch in the number of account keys from lookups');
995
+ }
996
+
997
+ accountKeysFromLookups = args.accountKeysFromLookups;
998
+ } else if (args && 'addressLookupTableAccounts' in args) {
999
+ accountKeysFromLookups = this.resolveAddressTableLookups(args.addressLookupTableAccounts);
1000
+ } else if (this.addressTableLookups.length > 0) {
1001
+ throw new Error('Failed to get account keys because address table lookups were not resolved');
1002
+ }
1003
+
1004
+ return new MessageAccountKeys(this.staticAccountKeys, accountKeysFromLookups);
1005
+ }
1006
+
1007
+ resolveAddressTableLookups(addressLookupTableAccounts) {
1008
+ const accountKeysFromLookups = {
1009
+ writable: [],
1010
+ readonly: []
1011
+ };
1012
+
1013
+ for (const tableLookup of this.addressTableLookups) {
1014
+ const tableAccount = addressLookupTableAccounts.find(account => account.key.equals(tableLookup.accountKey));
1015
+
1016
+ if (!tableAccount) {
1017
+ throw new Error(`Failed to find address lookup table account for table key ${tableLookup.accountKey.toBase58()}`);
1018
+ }
1019
+
1020
+ for (const index of tableLookup.writableIndexes) {
1021
+ if (index < tableAccount.state.addresses.length) {
1022
+ accountKeysFromLookups.writable.push(tableAccount.state.addresses[index]);
1023
+ } else {
1024
+ throw new Error(`Failed to find address for index ${index} in address lookup table ${tableLookup.accountKey.toBase58()}`);
1025
+ }
1026
+ }
1027
+
1028
+ for (const index of tableLookup.readonlyIndexes) {
1029
+ if (index < tableAccount.state.addresses.length) {
1030
+ accountKeysFromLookups.readonly.push(tableAccount.state.addresses[index]);
1031
+ } else {
1032
+ throw new Error(`Failed to find address for index ${index} in address lookup table ${tableLookup.accountKey.toBase58()}`);
1033
+ }
1034
+ }
1035
+ }
1036
+
1037
+ return accountKeysFromLookups;
1038
+ }
1039
+
1040
+ static compile(args) {
1041
+ const compiledKeys = CompiledKeys.compile(args.instructions, args.payerKey);
1042
+ const addressTableLookups = new Array();
1043
+ const accountKeysFromLookups = {
1044
+ writable: new Array(),
1045
+ readonly: new Array()
1046
+ };
1047
+ const lookupTableAccounts = args.addressLookupTableAccounts || [];
1048
+
1049
+ for (const lookupTable of lookupTableAccounts) {
1050
+ const extractResult = compiledKeys.extractTableLookup(lookupTable);
1051
+
1052
+ if (extractResult !== undefined) {
1053
+ const [addressTableLookup, {
1054
+ writable,
1055
+ readonly
1056
+ }] = extractResult;
1057
+ addressTableLookups.push(addressTableLookup);
1058
+ accountKeysFromLookups.writable.push(...writable);
1059
+ accountKeysFromLookups.readonly.push(...readonly);
1060
+ }
1061
+ }
1062
+
1063
+ const [header, staticAccountKeys] = compiledKeys.getMessageComponents();
1064
+ const accountKeys = new MessageAccountKeys(staticAccountKeys, accountKeysFromLookups);
1065
+ const compiledInstructions = accountKeys.compileInstructions(args.instructions);
1066
+ return new MessageV0({
1067
+ header,
1068
+ staticAccountKeys,
1069
+ recentBlockhash: args.recentBlockhash,
1070
+ compiledInstructions,
1071
+ addressTableLookups
1072
+ });
1073
+ }
1074
+
764
1075
  serialize() {
765
1076
  const encodedStaticAccountKeysLength = Array();
766
1077
  encodeLength(encodedStaticAccountKeysLength, this.staticAccountKeys.length);
@@ -1655,6 +1966,114 @@ class Transaction {
1655
1966
 
1656
1967
  }
1657
1968
 
1969
+ class TransactionMessage {
1970
+ constructor(args) {
1971
+ this.accountKeys = void 0;
1972
+ this.instructions = void 0;
1973
+ this.recentBlockhash = void 0;
1974
+ this.accountKeys = args.accountKeys;
1975
+ this.instructions = args.instructions;
1976
+ this.recentBlockhash = args.recentBlockhash;
1977
+ }
1978
+
1979
+ static decompile(message, args) {
1980
+ const {
1981
+ header,
1982
+ compiledInstructions,
1983
+ recentBlockhash
1984
+ } = message;
1985
+ const {
1986
+ numRequiredSignatures,
1987
+ numReadonlySignedAccounts,
1988
+ numReadonlyUnsignedAccounts
1989
+ } = header;
1990
+ const numWritableSignedAccounts = numRequiredSignatures - numReadonlySignedAccounts;
1991
+ assert(numWritableSignedAccounts > 0, 'Message header is invalid');
1992
+ const numWritableUnsignedAccounts = message.staticAccountKeys.length - numReadonlyUnsignedAccounts;
1993
+ assert(numWritableUnsignedAccounts >= 0, 'Message header is invalid');
1994
+ const accountKeys = message.getAccountKeys(args);
1995
+ const instructions = [];
1996
+
1997
+ for (const compiledIx of compiledInstructions) {
1998
+ const keys = [];
1999
+
2000
+ for (const keyIndex of compiledIx.accountKeyIndexes) {
2001
+ const pubkey = accountKeys.get(keyIndex);
2002
+
2003
+ if (pubkey === undefined) {
2004
+ throw new Error(`Failed to find key for account key index ${keyIndex}`);
2005
+ }
2006
+
2007
+ const isSigner = keyIndex < numRequiredSignatures;
2008
+ let isWritable;
2009
+
2010
+ if (isSigner) {
2011
+ isWritable = keyIndex < numWritableSignedAccounts;
2012
+ } else if (keyIndex < accountKeys.staticAccountKeys.length) {
2013
+ isWritable = keyIndex - numRequiredSignatures < numWritableUnsignedAccounts;
2014
+ } else {
2015
+ isWritable = keyIndex - accountKeys.staticAccountKeys.length < // accountKeysFromLookups cannot be undefined because we already found a pubkey for this index above
2016
+ accountKeys.accountKeysFromLookups.writable.length;
2017
+ }
2018
+
2019
+ keys.push({
2020
+ pubkey,
2021
+ isSigner: keyIndex < header.numRequiredSignatures,
2022
+ isWritable
2023
+ });
2024
+ }
2025
+
2026
+ const programId = accountKeys.get(compiledIx.programIdIndex);
2027
+
2028
+ if (programId === undefined) {
2029
+ throw new Error(`Failed to find program id for program id index ${compiledIx.programIdIndex}`);
2030
+ }
2031
+
2032
+ instructions.push(new TransactionInstruction({
2033
+ programId,
2034
+ data: toBuffer(compiledIx.data),
2035
+ keys
2036
+ }));
2037
+ }
2038
+
2039
+ return new TransactionMessage({
2040
+ accountKeys,
2041
+ instructions,
2042
+ recentBlockhash
2043
+ });
2044
+ }
2045
+
2046
+ compileToLegacyMessage() {
2047
+ const payerKey = this.accountKeys.get(0);
2048
+
2049
+ if (payerKey === undefined) {
2050
+ throw new Error('Failed to compile message because no account keys were found');
2051
+ }
2052
+
2053
+ return Message.compile({
2054
+ payerKey,
2055
+ recentBlockhash: this.recentBlockhash,
2056
+ instructions: this.instructions
2057
+ });
2058
+ }
2059
+
2060
+ compileToV0Message(addressLookupTableAccounts) {
2061
+ const payerKey = this.accountKeys.get(0);
2062
+
2063
+ if (payerKey === undefined) {
2064
+ throw new Error('Failed to compile message because no account keys were found');
2065
+ }
2066
+
2067
+ return MessageV0.compile({
2068
+ payerKey,
2069
+ recentBlockhash: this.recentBlockhash,
2070
+ instructions: this.instructions,
2071
+ addressLookupTableAccounts
2072
+ });
2073
+ }
2074
+
2075
+ }
2076
+
1658
2077
  /**
1659
2078
  * Versioned transaction class
1660
2079
  */
@@ -3979,7 +4398,8 @@ const ConfirmedTransactionMetaResult = superstruct.type({
3979
4398
  logMessages: superstruct.optional(superstruct.nullable(superstruct.array(superstruct.string()))),
3980
4399
  preTokenBalances: superstruct.optional(superstruct.nullable(superstruct.array(TokenBalanceResult))),
3981
4400
  postTokenBalances: superstruct.optional(superstruct.nullable(superstruct.array(TokenBalanceResult))),
3982
- loadedAddresses: superstruct.optional(LoadedAddressesResult)
4401
+ loadedAddresses: superstruct.optional(LoadedAddressesResult),
4402
+ computeUnitsConsumed: superstruct.optional(superstruct.number())
3983
4403
  });
3984
4404
  /**
3985
4405
  * @internal
@@ -3997,7 +4417,8 @@ const ParsedConfirmedTransactionMetaResult = superstruct.type({
3997
4417
  logMessages: superstruct.optional(superstruct.nullable(superstruct.array(superstruct.string()))),
3998
4418
  preTokenBalances: superstruct.optional(superstruct.nullable(superstruct.array(TokenBalanceResult))),
3999
4419
  postTokenBalances: superstruct.optional(superstruct.nullable(superstruct.array(TokenBalanceResult))),
4000
- loadedAddresses: superstruct.optional(LoadedAddressesResult)
4420
+ loadedAddresses: superstruct.optional(LoadedAddressesResult),
4421
+ computeUnitsConsumed: superstruct.optional(superstruct.number())
4001
4422
  });
4002
4423
  const TransactionVersionStruct = superstruct.union([superstruct.literal(0), superstruct.literal('legacy')]);
4003
4424
  /**
@@ -6016,10 +6437,44 @@ class Connection {
6016
6437
  }
6017
6438
  /**
6018
6439
  * Simulate a transaction
6440
+ *
6441
+ * @deprecated Instead, call {@link simulateTransaction} with {@link
6442
+ * VersionedTransaction} and {@link SimulateTransactionConfig} parameters
6019
6443
  */
6020
6444
 
6021
6445
 
6022
- async simulateTransaction(transactionOrMessage, signers, includeAccounts) {
6446
+ /**
6447
+ * Simulate a transaction
6448
+ */
6449
+ // eslint-disable-next-line no-dupe-class-members
6450
+ async simulateTransaction(transactionOrMessage, configOrSigners, includeAccounts) {
6451
+ if ('message' in transactionOrMessage) {
6452
+ const versionedTx = transactionOrMessage;
6453
+ const wireTransaction = versionedTx.serialize();
6454
+ const encodedTransaction = buffer.Buffer.from(wireTransaction).toString('base64');
6455
+
6456
+ if (Array.isArray(configOrSigners) || includeAccounts !== undefined) {
6457
+ throw new Error('Invalid arguments');
6458
+ }
6459
+
6460
+ const config = configOrSigners || {};
6461
+ config.encoding = 'base64';
6462
+
6463
+ if (!('commitment' in config)) {
6464
+ config.commitment = this.commitment;
6465
+ }
6466
+
6467
+ const args = [encodedTransaction, config];
6468
+ const unsafeRes = await this._rpcRequest('simulateTransaction', args);
6469
+ const res = superstruct.create(unsafeRes, SimulatedTransactionResponseStruct);
6470
+
6471
+ if ('error' in res) {
6472
+ throw new Error('failed to simulate transaction: ' + res.error.message);
6473
+ }
6474
+
6475
+ return res.result;
6476
+ }
6477
+
6023
6478
  let transaction;
6024
6479
 
6025
6480
  if (transactionOrMessage instanceof Transaction) {
@@ -6035,6 +6490,12 @@ class Connection {
6035
6490
  transaction._message = transaction._json = undefined;
6036
6491
  }
6037
6492
 
6493
+ if (configOrSigners !== undefined && !Array.isArray(configOrSigners)) {
6494
+ throw new Error('Invalid arguments');
6495
+ }
6496
+
6497
+ const signers = configOrSigners;
6498
+
6038
6499
  if (transaction.nonceInfo && signers) {
6039
6500
  transaction.sign(...signers);
6040
6501
  } else {
@@ -6115,12 +6576,34 @@ class Connection {
6115
6576
 
6116
6577
  return res.result;
6117
6578
  }
6579
+ /**
6580
+ * Sign and send a transaction
6581
+ *
6582
+ * @deprecated Instead, call {@link sendTransaction} with a {@link
6583
+ * VersionedTransaction}
6584
+ */
6585
+
6586
+
6118
6587
  /**
6119
6588
  * Sign and send a transaction
6120
6589
  */
6590
+ // eslint-disable-next-line no-dupe-class-members
6591
+ async sendTransaction(transaction, signersOrOptions, options) {
6592
+ if ('message' in transaction) {
6593
+ if (signersOrOptions && Array.isArray(signersOrOptions)) {
6594
+ throw new Error('Invalid arguments');
6595
+ }
6596
+
6597
+ const wireTransaction = transaction.serialize();
6598
+ return await this.sendRawTransaction(wireTransaction, options);
6599
+ }
6600
+
6601
+ if (signersOrOptions === undefined || !Array.isArray(signersOrOptions)) {
6602
+ throw new Error('Invalid arguments');
6603
+ }
6121
6604
 
6605
+ const signers = signersOrOptions;
6122
6606
 
6123
- async sendTransaction(transaction, signers, options) {
6124
6607
  if (transaction.nonceInfo) {
6125
6608
  transaction.sign(...signers);
6126
6609
  } else {
@@ -9171,6 +9654,7 @@ exports.Loader = Loader;
9171
9654
  exports.Lockup = Lockup;
9172
9655
  exports.MAX_SEED_LENGTH = MAX_SEED_LENGTH;
9173
9656
  exports.Message = Message;
9657
+ exports.MessageAccountKeys = MessageAccountKeys;
9174
9658
  exports.MessageV0 = MessageV0;
9175
9659
  exports.NONCE_ACCOUNT_LENGTH = NONCE_ACCOUNT_LENGTH;
9176
9660
  exports.NonceAccount = NonceAccount;
@@ -9205,6 +9689,7 @@ exports.Transaction = Transaction;
9205
9689
  exports.TransactionExpiredBlockheightExceededError = TransactionExpiredBlockheightExceededError;
9206
9690
  exports.TransactionExpiredTimeoutError = TransactionExpiredTimeoutError;
9207
9691
  exports.TransactionInstruction = TransactionInstruction;
9692
+ exports.TransactionMessage = TransactionMessage;
9208
9693
  exports.VALIDATOR_INFO_KEY = VALIDATOR_INFO_KEY;
9209
9694
  exports.VERSION_PREFIX_MASK = VERSION_PREFIX_MASK;
9210
9695
  exports.VOTE_PROGRAM_ID = VOTE_PROGRAM_ID;