@solana/web3.js 1.62.1 → 1.63.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.
package/lib/index.cjs.js CHANGED
@@ -1009,13 +1009,13 @@ class MessageV0 {
1009
1009
  getAccountKeys(args) {
1010
1010
  let accountKeysFromLookups;
1011
1011
 
1012
- if (args && 'accountKeysFromLookups' in args) {
1012
+ if (args && 'accountKeysFromLookups' in args && args.accountKeysFromLookups) {
1013
1013
  if (this.numAccountKeysFromLookups != args.accountKeysFromLookups.writable.length + args.accountKeysFromLookups.readonly.length) {
1014
1014
  throw new Error('Failed to get account keys because of a mismatch in the number of account keys from lookups');
1015
1015
  }
1016
1016
 
1017
1017
  accountKeysFromLookups = args.accountKeysFromLookups;
1018
- } else if (args && 'addressLookupTableAccounts' in args) {
1018
+ } else if (args && 'addressLookupTableAccounts' in args && args.addressLookupTableAccounts) {
1019
1019
  accountKeysFromLookups = this.resolveAddressTableLookups(args.addressLookupTableAccounts);
1020
1020
  } else if (this.addressTableLookups.length > 0) {
1021
1021
  throw new Error('Failed to get account keys because address table lookups were not resolved');
@@ -2177,6 +2177,14 @@ class VersionedTransaction {
2177
2177
  }
2178
2178
  }
2179
2179
 
2180
+ addSignature(publicKey, signature) {
2181
+ assert(signature.byteLength === 64, 'Signature must be 64 bytes long');
2182
+ const signerPubkeys = this.message.staticAccountKeys.slice(0, this.message.header.numRequiredSignatures);
2183
+ const signerIndex = signerPubkeys.findIndex(pubkey => pubkey.equals(publicKey));
2184
+ assert(signerIndex >= 0, `Can not add signature; \`${publicKey.toBase58()}\` is not required to sign this transaction`);
2185
+ this.signatures[signerIndex] = signature;
2186
+ }
2187
+
2180
2188
  }
2181
2189
 
2182
2190
  const SYSVAR_CLOCK_PUBKEY = new PublicKey('SysvarC1ock11111111111111111111111111111111');