@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.iife.js CHANGED
@@ -8308,12 +8308,14 @@ var solanaWeb3 = (function (exports) {
8308
8308
 
8309
8309
  function isPublicKeyData(value) {
8310
8310
  return value._bn !== undefined;
8311
- }
8311
+ } // local counter used by PublicKey.unique()
8312
+
8313
+
8314
+ let uniquePublicKeyCounter = 1;
8312
8315
  /**
8313
8316
  * A public key
8314
8317
  */
8315
8318
 
8316
-
8317
8319
  class PublicKey extends Struct$1 {
8318
8320
  /** @internal */
8319
8321
 
@@ -8346,6 +8348,16 @@ var solanaWeb3 = (function (exports) {
8346
8348
  }
8347
8349
  }
8348
8350
  }
8351
+ /**
8352
+ * Returns a unique PublicKey for tests and benchmarks using acounter
8353
+ */
8354
+
8355
+
8356
+ static unique() {
8357
+ const key = new PublicKey(uniquePublicKeyCounter);
8358
+ uniquePublicKeyCounter += 1;
8359
+ return new PublicKey(key.toBuffer());
8360
+ }
8349
8361
  /**
8350
8362
  * Default public key value. (All zeros)
8351
8363
  */
@@ -10885,6 +10897,71 @@ var solanaWeb3 = (function (exports) {
10885
10897
  value: 'TransactionExpiredTimeoutError'
10886
10898
  });
10887
10899
 
10900
+ class MessageAccountKeys {
10901
+ constructor(staticAccountKeys, accountKeysFromLookups) {
10902
+ this.staticAccountKeys = void 0;
10903
+ this.accountKeysFromLookups = void 0;
10904
+ this.staticAccountKeys = staticAccountKeys;
10905
+ this.accountKeysFromLookups = accountKeysFromLookups;
10906
+ }
10907
+
10908
+ keySegments() {
10909
+ const keySegments = [this.staticAccountKeys];
10910
+
10911
+ if (this.accountKeysFromLookups) {
10912
+ keySegments.push(this.accountKeysFromLookups.writable);
10913
+ keySegments.push(this.accountKeysFromLookups.readonly);
10914
+ }
10915
+
10916
+ return keySegments;
10917
+ }
10918
+
10919
+ get(index) {
10920
+ for (const keySegment of this.keySegments()) {
10921
+ if (index < keySegment.length) {
10922
+ return keySegment[index];
10923
+ } else {
10924
+ index -= keySegment.length;
10925
+ }
10926
+ }
10927
+
10928
+ return;
10929
+ }
10930
+
10931
+ get length() {
10932
+ return this.keySegments().flat().length;
10933
+ }
10934
+
10935
+ compileInstructions(instructions) {
10936
+ // Bail early if any account indexes would overflow a u8
10937
+ const U8_MAX = 255;
10938
+
10939
+ if (this.length > U8_MAX + 1) {
10940
+ throw new Error('Account index overflow encountered during compilation');
10941
+ }
10942
+
10943
+ const keyIndexMap = new Map();
10944
+ this.keySegments().flat().forEach((key, index) => {
10945
+ keyIndexMap.set(key.toBase58(), index);
10946
+ });
10947
+
10948
+ const findKeyIndex = key => {
10949
+ const keyIndex = keyIndexMap.get(key.toBase58());
10950
+ if (keyIndex === undefined) throw new Error('Encountered an unknown instruction account key during compilation');
10951
+ return keyIndex;
10952
+ };
10953
+
10954
+ return instructions.map(instruction => {
10955
+ return {
10956
+ programIdIndex: findKeyIndex(instruction.programId),
10957
+ accountKeyIndexes: instruction.keys.map(meta => findKeyIndex(meta.pubkey)),
10958
+ data: instruction.data
10959
+ };
10960
+ });
10961
+ }
10962
+
10963
+ }
10964
+
10888
10965
  /**
10889
10966
  * Layout for a public key
10890
10967
  */
@@ -11010,6 +11087,129 @@ var solanaWeb3 = (function (exports) {
11010
11087
  }
11011
11088
  }
11012
11089
 
11090
+ function assert$1 (condition, message) {
11091
+ if (!condition) {
11092
+ throw new Error(message || 'Assertion failed');
11093
+ }
11094
+ }
11095
+
11096
+ class CompiledKeys {
11097
+ constructor(payer, keyMetaMap) {
11098
+ this.payer = void 0;
11099
+ this.keyMetaMap = void 0;
11100
+ this.payer = payer;
11101
+ this.keyMetaMap = keyMetaMap;
11102
+ }
11103
+
11104
+ static compile(instructions, payer) {
11105
+ const keyMetaMap = new Map();
11106
+
11107
+ const getOrInsertDefault = pubkey => {
11108
+ const address = pubkey.toBase58();
11109
+ let keyMeta = keyMetaMap.get(address);
11110
+
11111
+ if (keyMeta === undefined) {
11112
+ keyMeta = {
11113
+ isSigner: false,
11114
+ isWritable: false,
11115
+ isInvoked: false
11116
+ };
11117
+ keyMetaMap.set(address, keyMeta);
11118
+ }
11119
+
11120
+ return keyMeta;
11121
+ };
11122
+
11123
+ const payerKeyMeta = getOrInsertDefault(payer);
11124
+ payerKeyMeta.isSigner = true;
11125
+ payerKeyMeta.isWritable = true;
11126
+
11127
+ for (const ix of instructions) {
11128
+ getOrInsertDefault(ix.programId).isInvoked = true;
11129
+
11130
+ for (const accountMeta of ix.keys) {
11131
+ const keyMeta = getOrInsertDefault(accountMeta.pubkey);
11132
+ keyMeta.isSigner || (keyMeta.isSigner = accountMeta.isSigner);
11133
+ keyMeta.isWritable || (keyMeta.isWritable = accountMeta.isWritable);
11134
+ }
11135
+ }
11136
+
11137
+ return new CompiledKeys(payer, keyMetaMap);
11138
+ }
11139
+
11140
+ getMessageComponents() {
11141
+ const mapEntries = [...this.keyMetaMap.entries()];
11142
+ assert$1(mapEntries.length <= 256, 'Max static account keys length exceeded');
11143
+ const writableSigners = mapEntries.filter(([, meta]) => meta.isSigner && meta.isWritable);
11144
+ const readonlySigners = mapEntries.filter(([, meta]) => meta.isSigner && !meta.isWritable);
11145
+ const writableNonSigners = mapEntries.filter(([, meta]) => !meta.isSigner && meta.isWritable);
11146
+ const readonlyNonSigners = mapEntries.filter(([, meta]) => !meta.isSigner && !meta.isWritable);
11147
+ const header = {
11148
+ numRequiredSignatures: writableSigners.length + readonlySigners.length,
11149
+ numReadonlySignedAccounts: readonlySigners.length,
11150
+ numReadonlyUnsignedAccounts: readonlyNonSigners.length
11151
+ }; // sanity checks
11152
+
11153
+ {
11154
+ assert$1(writableSigners.length > 0, 'Expected at least one writable signer key');
11155
+ const [payerAddress] = writableSigners[0];
11156
+ assert$1(payerAddress === this.payer.toBase58(), 'Expected first writable signer key to be the fee payer');
11157
+ }
11158
+ 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))];
11159
+ return [header, staticAccountKeys];
11160
+ }
11161
+
11162
+ extractTableLookup(lookupTable) {
11163
+ const [writableIndexes, drainedWritableKeys] = this.drainKeysFoundInLookupTable(lookupTable.state.addresses, keyMeta => !keyMeta.isSigner && !keyMeta.isInvoked && keyMeta.isWritable);
11164
+ const [readonlyIndexes, drainedReadonlyKeys] = this.drainKeysFoundInLookupTable(lookupTable.state.addresses, keyMeta => !keyMeta.isSigner && !keyMeta.isInvoked && !keyMeta.isWritable); // Don't extract lookup if no keys were found
11165
+
11166
+ if (writableIndexes.length === 0 && readonlyIndexes.length === 0) {
11167
+ return;
11168
+ }
11169
+
11170
+ return [{
11171
+ accountKey: lookupTable.key,
11172
+ writableIndexes,
11173
+ readonlyIndexes
11174
+ }, {
11175
+ writable: drainedWritableKeys,
11176
+ readonly: drainedReadonlyKeys
11177
+ }];
11178
+ }
11179
+ /** @internal */
11180
+
11181
+
11182
+ drainKeysFoundInLookupTable(lookupTableEntries, keyMetaFilter) {
11183
+ const lookupTableIndexes = new Array();
11184
+ const drainedKeys = new Array();
11185
+
11186
+ for (const [address, keyMeta] of this.keyMetaMap.entries()) {
11187
+ if (keyMetaFilter(keyMeta)) {
11188
+ const key = new PublicKey(address);
11189
+ const lookupTableIndex = lookupTableEntries.findIndex(entry => entry.equals(key));
11190
+
11191
+ if (lookupTableIndex >= 0) {
11192
+ assert$1(lookupTableIndex < 256, 'Max lookup table index exceeded');
11193
+ lookupTableIndexes.push(lookupTableIndex);
11194
+ drainedKeys.push(key);
11195
+ this.keyMetaMap.delete(address);
11196
+ }
11197
+ }
11198
+ }
11199
+
11200
+ return [lookupTableIndexes, drainedKeys];
11201
+ }
11202
+
11203
+ }
11204
+
11205
+ /**
11206
+ * An instruction to execute by a program
11207
+ *
11208
+ * @property {number} programIdIndex
11209
+ * @property {number[]} accounts
11210
+ * @property {string} data
11211
+ */
11212
+
11013
11213
  /**
11014
11214
  * List of instructions to be processed atomically
11015
11215
  */
@@ -11047,6 +11247,27 @@ var solanaWeb3 = (function (exports) {
11047
11247
  return [];
11048
11248
  }
11049
11249
 
11250
+ getAccountKeys() {
11251
+ return new MessageAccountKeys(this.staticAccountKeys);
11252
+ }
11253
+
11254
+ static compile(args) {
11255
+ const compiledKeys = CompiledKeys.compile(args.instructions, args.payerKey);
11256
+ const [header, staticAccountKeys] = compiledKeys.getMessageComponents();
11257
+ const accountKeys = new MessageAccountKeys(staticAccountKeys);
11258
+ const instructions = accountKeys.compileInstructions(args.instructions).map(ix => ({
11259
+ programIdIndex: ix.programIdIndex,
11260
+ accounts: ix.accountKeyIndexes,
11261
+ data: bs58$1.encode(ix.data)
11262
+ }));
11263
+ return new Message({
11264
+ header,
11265
+ accountKeys: staticAccountKeys,
11266
+ recentBlockhash: args.recentBlockhash,
11267
+ instructions
11268
+ });
11269
+ }
11270
+
11050
11271
  isAccountSigner(index) {
11051
11272
  return index < this.header.numRequiredSignatures;
11052
11273
  }
@@ -11136,7 +11357,7 @@ var solanaWeb3 = (function (exports) {
11136
11357
  for (let i = 0; i < accountCount; i++) {
11137
11358
  const account = byteArray.slice(0, PUBLIC_KEY_LENGTH);
11138
11359
  byteArray = byteArray.slice(PUBLIC_KEY_LENGTH);
11139
- accountKeys.push(bs58$1.encode(buffer.Buffer.from(account)));
11360
+ accountKeys.push(new PublicKey(buffer.Buffer.from(account)));
11140
11361
  }
11141
11362
 
11142
11363
  const recentBlockhash = byteArray.slice(0, PUBLIC_KEY_LENGTH);
@@ -11175,12 +11396,6 @@ var solanaWeb3 = (function (exports) {
11175
11396
 
11176
11397
  }
11177
11398
 
11178
- function assert$1 (condition, message) {
11179
- if (!condition) {
11180
- throw new Error(message || 'Assertion failed');
11181
- }
11182
- }
11183
-
11184
11399
  /**
11185
11400
  * Message constructor arguments
11186
11401
  */
@@ -11203,6 +11418,102 @@ var solanaWeb3 = (function (exports) {
11203
11418
  return 0;
11204
11419
  }
11205
11420
 
11421
+ get numAccountKeysFromLookups() {
11422
+ let count = 0;
11423
+
11424
+ for (const lookup of this.addressTableLookups) {
11425
+ count += lookup.readonlyIndexes.length + lookup.writableIndexes.length;
11426
+ }
11427
+
11428
+ return count;
11429
+ }
11430
+
11431
+ getAccountKeys(args) {
11432
+ let accountKeysFromLookups;
11433
+
11434
+ if (args && 'accountKeysFromLookups' in args) {
11435
+ if (this.numAccountKeysFromLookups != args.accountKeysFromLookups.writable.length + args.accountKeysFromLookups.readonly.length) {
11436
+ throw new Error('Failed to get account keys because of a mismatch in the number of account keys from lookups');
11437
+ }
11438
+
11439
+ accountKeysFromLookups = args.accountKeysFromLookups;
11440
+ } else if (args && 'addressLookupTableAccounts' in args) {
11441
+ accountKeysFromLookups = this.resolveAddressTableLookups(args.addressLookupTableAccounts);
11442
+ } else if (this.addressTableLookups.length > 0) {
11443
+ throw new Error('Failed to get account keys because address table lookups were not resolved');
11444
+ }
11445
+
11446
+ return new MessageAccountKeys(this.staticAccountKeys, accountKeysFromLookups);
11447
+ }
11448
+
11449
+ resolveAddressTableLookups(addressLookupTableAccounts) {
11450
+ const accountKeysFromLookups = {
11451
+ writable: [],
11452
+ readonly: []
11453
+ };
11454
+
11455
+ for (const tableLookup of this.addressTableLookups) {
11456
+ const tableAccount = addressLookupTableAccounts.find(account => account.key.equals(tableLookup.accountKey));
11457
+
11458
+ if (!tableAccount) {
11459
+ throw new Error(`Failed to find address lookup table account for table key ${tableLookup.accountKey.toBase58()}`);
11460
+ }
11461
+
11462
+ for (const index of tableLookup.writableIndexes) {
11463
+ if (index < tableAccount.state.addresses.length) {
11464
+ accountKeysFromLookups.writable.push(tableAccount.state.addresses[index]);
11465
+ } else {
11466
+ throw new Error(`Failed to find address for index ${index} in address lookup table ${tableLookup.accountKey.toBase58()}`);
11467
+ }
11468
+ }
11469
+
11470
+ for (const index of tableLookup.readonlyIndexes) {
11471
+ if (index < tableAccount.state.addresses.length) {
11472
+ accountKeysFromLookups.readonly.push(tableAccount.state.addresses[index]);
11473
+ } else {
11474
+ throw new Error(`Failed to find address for index ${index} in address lookup table ${tableLookup.accountKey.toBase58()}`);
11475
+ }
11476
+ }
11477
+ }
11478
+
11479
+ return accountKeysFromLookups;
11480
+ }
11481
+
11482
+ static compile(args) {
11483
+ const compiledKeys = CompiledKeys.compile(args.instructions, args.payerKey);
11484
+ const addressTableLookups = new Array();
11485
+ const accountKeysFromLookups = {
11486
+ writable: new Array(),
11487
+ readonly: new Array()
11488
+ };
11489
+ const lookupTableAccounts = args.addressLookupTableAccounts || [];
11490
+
11491
+ for (const lookupTable of lookupTableAccounts) {
11492
+ const extractResult = compiledKeys.extractTableLookup(lookupTable);
11493
+
11494
+ if (extractResult !== undefined) {
11495
+ const [addressTableLookup, {
11496
+ writable,
11497
+ readonly
11498
+ }] = extractResult;
11499
+ addressTableLookups.push(addressTableLookup);
11500
+ accountKeysFromLookups.writable.push(...writable);
11501
+ accountKeysFromLookups.readonly.push(...readonly);
11502
+ }
11503
+ }
11504
+
11505
+ const [header, staticAccountKeys] = compiledKeys.getMessageComponents();
11506
+ const accountKeys = new MessageAccountKeys(staticAccountKeys, accountKeysFromLookups);
11507
+ const compiledInstructions = accountKeys.compileInstructions(args.instructions);
11508
+ return new MessageV0({
11509
+ header,
11510
+ staticAccountKeys,
11511
+ recentBlockhash: args.recentBlockhash,
11512
+ compiledInstructions,
11513
+ addressTableLookups
11514
+ });
11515
+ }
11516
+
11206
11517
  serialize() {
11207
11518
  const encodedStaticAccountKeysLength = Array();
11208
11519
  encodeLength(encodedStaticAccountKeysLength, this.staticAccountKeys.length);
@@ -12097,6 +12408,114 @@ var solanaWeb3 = (function (exports) {
12097
12408
 
12098
12409
  }
12099
12410
 
12411
+ class TransactionMessage {
12412
+ constructor(args) {
12413
+ this.accountKeys = void 0;
12414
+ this.instructions = void 0;
12415
+ this.recentBlockhash = void 0;
12416
+ this.accountKeys = args.accountKeys;
12417
+ this.instructions = args.instructions;
12418
+ this.recentBlockhash = args.recentBlockhash;
12419
+ }
12420
+
12421
+ static decompile(message, args) {
12422
+ const {
12423
+ header,
12424
+ compiledInstructions,
12425
+ recentBlockhash
12426
+ } = message;
12427
+ const {
12428
+ numRequiredSignatures,
12429
+ numReadonlySignedAccounts,
12430
+ numReadonlyUnsignedAccounts
12431
+ } = header;
12432
+ const numWritableSignedAccounts = numRequiredSignatures - numReadonlySignedAccounts;
12433
+ assert$1(numWritableSignedAccounts > 0, 'Message header is invalid');
12434
+ const numWritableUnsignedAccounts = message.staticAccountKeys.length - numReadonlyUnsignedAccounts;
12435
+ assert$1(numWritableUnsignedAccounts >= 0, 'Message header is invalid');
12436
+ const accountKeys = message.getAccountKeys(args);
12437
+ const instructions = [];
12438
+
12439
+ for (const compiledIx of compiledInstructions) {
12440
+ const keys = [];
12441
+
12442
+ for (const keyIndex of compiledIx.accountKeyIndexes) {
12443
+ const pubkey = accountKeys.get(keyIndex);
12444
+
12445
+ if (pubkey === undefined) {
12446
+ throw new Error(`Failed to find key for account key index ${keyIndex}`);
12447
+ }
12448
+
12449
+ const isSigner = keyIndex < numRequiredSignatures;
12450
+ let isWritable;
12451
+
12452
+ if (isSigner) {
12453
+ isWritable = keyIndex < numWritableSignedAccounts;
12454
+ } else if (keyIndex < accountKeys.staticAccountKeys.length) {
12455
+ isWritable = keyIndex - numRequiredSignatures < numWritableUnsignedAccounts;
12456
+ } else {
12457
+ isWritable = keyIndex - accountKeys.staticAccountKeys.length < // accountKeysFromLookups cannot be undefined because we already found a pubkey for this index above
12458
+ accountKeys.accountKeysFromLookups.writable.length;
12459
+ }
12460
+
12461
+ keys.push({
12462
+ pubkey,
12463
+ isSigner: keyIndex < header.numRequiredSignatures,
12464
+ isWritable
12465
+ });
12466
+ }
12467
+
12468
+ const programId = accountKeys.get(compiledIx.programIdIndex);
12469
+
12470
+ if (programId === undefined) {
12471
+ throw new Error(`Failed to find program id for program id index ${compiledIx.programIdIndex}`);
12472
+ }
12473
+
12474
+ instructions.push(new TransactionInstruction({
12475
+ programId,
12476
+ data: toBuffer(compiledIx.data),
12477
+ keys
12478
+ }));
12479
+ }
12480
+
12481
+ return new TransactionMessage({
12482
+ accountKeys,
12483
+ instructions,
12484
+ recentBlockhash
12485
+ });
12486
+ }
12487
+
12488
+ compileToLegacyMessage() {
12489
+ const payerKey = this.accountKeys.get(0);
12490
+
12491
+ if (payerKey === undefined) {
12492
+ throw new Error('Failed to compile message because no account keys were found');
12493
+ }
12494
+
12495
+ return Message.compile({
12496
+ payerKey,
12497
+ recentBlockhash: this.recentBlockhash,
12498
+ instructions: this.instructions
12499
+ });
12500
+ }
12501
+
12502
+ compileToV0Message(addressLookupTableAccounts) {
12503
+ const payerKey = this.accountKeys.get(0);
12504
+
12505
+ if (payerKey === undefined) {
12506
+ throw new Error('Failed to compile message because no account keys were found');
12507
+ }
12508
+
12509
+ return MessageV0.compile({
12510
+ payerKey,
12511
+ recentBlockhash: this.recentBlockhash,
12512
+ instructions: this.instructions,
12513
+ addressLookupTableAccounts
12514
+ });
12515
+ }
12516
+
12517
+ }
12518
+
12100
12519
  /**
12101
12520
  * Versioned transaction class
12102
12521
  */
@@ -17526,7 +17945,8 @@ var solanaWeb3 = (function (exports) {
17526
17945
  logMessages: optional(nullable(array(string()))),
17527
17946
  preTokenBalances: optional(nullable(array(TokenBalanceResult))),
17528
17947
  postTokenBalances: optional(nullable(array(TokenBalanceResult))),
17529
- loadedAddresses: optional(LoadedAddressesResult)
17948
+ loadedAddresses: optional(LoadedAddressesResult),
17949
+ computeUnitsConsumed: optional(number())
17530
17950
  });
17531
17951
  /**
17532
17952
  * @internal
@@ -17544,7 +17964,8 @@ var solanaWeb3 = (function (exports) {
17544
17964
  logMessages: optional(nullable(array(string()))),
17545
17965
  preTokenBalances: optional(nullable(array(TokenBalanceResult))),
17546
17966
  postTokenBalances: optional(nullable(array(TokenBalanceResult))),
17547
- loadedAddresses: optional(LoadedAddressesResult)
17967
+ loadedAddresses: optional(LoadedAddressesResult),
17968
+ computeUnitsConsumed: optional(number())
17548
17969
  });
17549
17970
  const TransactionVersionStruct = union([literal(0), literal('legacy')]);
17550
17971
  /**
@@ -19563,10 +19984,44 @@ var solanaWeb3 = (function (exports) {
19563
19984
  }
19564
19985
  /**
19565
19986
  * Simulate a transaction
19987
+ *
19988
+ * @deprecated Instead, call {@link simulateTransaction} with {@link
19989
+ * VersionedTransaction} and {@link SimulateTransactionConfig} parameters
19566
19990
  */
19567
19991
 
19568
19992
 
19569
- async simulateTransaction(transactionOrMessage, signers, includeAccounts) {
19993
+ /**
19994
+ * Simulate a transaction
19995
+ */
19996
+ // eslint-disable-next-line no-dupe-class-members
19997
+ async simulateTransaction(transactionOrMessage, configOrSigners, includeAccounts) {
19998
+ if ('message' in transactionOrMessage) {
19999
+ const versionedTx = transactionOrMessage;
20000
+ const wireTransaction = versionedTx.serialize();
20001
+ const encodedTransaction = buffer.Buffer.from(wireTransaction).toString('base64');
20002
+
20003
+ if (Array.isArray(configOrSigners) || includeAccounts !== undefined) {
20004
+ throw new Error('Invalid arguments');
20005
+ }
20006
+
20007
+ const config = configOrSigners || {};
20008
+ config.encoding = 'base64';
20009
+
20010
+ if (!('commitment' in config)) {
20011
+ config.commitment = this.commitment;
20012
+ }
20013
+
20014
+ const args = [encodedTransaction, config];
20015
+ const unsafeRes = await this._rpcRequest('simulateTransaction', args);
20016
+ const res = create(unsafeRes, SimulatedTransactionResponseStruct);
20017
+
20018
+ if ('error' in res) {
20019
+ throw new Error('failed to simulate transaction: ' + res.error.message);
20020
+ }
20021
+
20022
+ return res.result;
20023
+ }
20024
+
19570
20025
  let transaction;
19571
20026
 
19572
20027
  if (transactionOrMessage instanceof Transaction) {
@@ -19582,6 +20037,12 @@ var solanaWeb3 = (function (exports) {
19582
20037
  transaction._message = transaction._json = undefined;
19583
20038
  }
19584
20039
 
20040
+ if (configOrSigners !== undefined && !Array.isArray(configOrSigners)) {
20041
+ throw new Error('Invalid arguments');
20042
+ }
20043
+
20044
+ const signers = configOrSigners;
20045
+
19585
20046
  if (transaction.nonceInfo && signers) {
19586
20047
  transaction.sign(...signers);
19587
20048
  } else {
@@ -19662,12 +20123,34 @@ var solanaWeb3 = (function (exports) {
19662
20123
 
19663
20124
  return res.result;
19664
20125
  }
20126
+ /**
20127
+ * Sign and send a transaction
20128
+ *
20129
+ * @deprecated Instead, call {@link sendTransaction} with a {@link
20130
+ * VersionedTransaction}
20131
+ */
20132
+
20133
+
19665
20134
  /**
19666
20135
  * Sign and send a transaction
19667
20136
  */
20137
+ // eslint-disable-next-line no-dupe-class-members
20138
+ async sendTransaction(transaction, signersOrOptions, options) {
20139
+ if ('message' in transaction) {
20140
+ if (signersOrOptions && Array.isArray(signersOrOptions)) {
20141
+ throw new Error('Invalid arguments');
20142
+ }
20143
+
20144
+ const wireTransaction = transaction.serialize();
20145
+ return await this.sendRawTransaction(wireTransaction, options);
20146
+ }
20147
+
20148
+ if (signersOrOptions === undefined || !Array.isArray(signersOrOptions)) {
20149
+ throw new Error('Invalid arguments');
20150
+ }
19668
20151
 
20152
+ const signers = signersOrOptions;
19669
20153
 
19670
- async sendTransaction(transaction, signers, options) {
19671
20154
  if (transaction.nonceInfo) {
19672
20155
  transaction.sign(...signers);
19673
20156
  } else {
@@ -24390,6 +24873,7 @@ var solanaWeb3 = (function (exports) {
24390
24873
  exports.Lockup = Lockup;
24391
24874
  exports.MAX_SEED_LENGTH = MAX_SEED_LENGTH;
24392
24875
  exports.Message = Message;
24876
+ exports.MessageAccountKeys = MessageAccountKeys;
24393
24877
  exports.MessageV0 = MessageV0;
24394
24878
  exports.NONCE_ACCOUNT_LENGTH = NONCE_ACCOUNT_LENGTH;
24395
24879
  exports.NonceAccount = NonceAccount;
@@ -24424,6 +24908,7 @@ var solanaWeb3 = (function (exports) {
24424
24908
  exports.TransactionExpiredBlockheightExceededError = TransactionExpiredBlockheightExceededError;
24425
24909
  exports.TransactionExpiredTimeoutError = TransactionExpiredTimeoutError;
24426
24910
  exports.TransactionInstruction = TransactionInstruction;
24911
+ exports.TransactionMessage = TransactionMessage;
24427
24912
  exports.VALIDATOR_INFO_KEY = VALIDATOR_INFO_KEY;
24428
24913
  exports.VERSION_PREFIX_MASK = VERSION_PREFIX_MASK;
24429
24914
  exports.VOTE_PROGRAM_ID = VOTE_PROGRAM_ID;