@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.d.ts CHANGED
@@ -1562,10 +1562,10 @@ declare module '@solana/web3.js' {
1562
1562
  };
1563
1563
  export type GetAccountKeysArgs =
1564
1564
  | {
1565
- accountKeysFromLookups: AccountKeysFromLookups;
1565
+ accountKeysFromLookups?: AccountKeysFromLookups | null;
1566
1566
  }
1567
1567
  | {
1568
- addressLookupTableAccounts: AddressLookupTableAccount[];
1568
+ addressLookupTableAccounts?: AddressLookupTableAccount[] | null;
1569
1569
  };
1570
1570
  export class MessageV0 {
1571
1571
  header: MessageHeader;
@@ -1889,6 +1889,7 @@ declare module '@solana/web3.js' {
1889
1889
  serialize(): Uint8Array;
1890
1890
  static deserialize(serializedTransaction: Uint8Array): VersionedTransaction;
1891
1891
  sign(signers: Array<Signer>): void;
1892
+ addSignature(publicKey: PublicKey, signature: Uint8Array): void;
1892
1893
  }
1893
1894
 
1894
1895
  export type ClientSubscriptionId = number;
package/lib/index.esm.js CHANGED
@@ -976,13 +976,13 @@ class MessageV0 {
976
976
  getAccountKeys(args) {
977
977
  let accountKeysFromLookups;
978
978
 
979
- if (args && 'accountKeysFromLookups' in args) {
979
+ if (args && 'accountKeysFromLookups' in args && args.accountKeysFromLookups) {
980
980
  if (this.numAccountKeysFromLookups != args.accountKeysFromLookups.writable.length + args.accountKeysFromLookups.readonly.length) {
981
981
  throw new Error('Failed to get account keys because of a mismatch in the number of account keys from lookups');
982
982
  }
983
983
 
984
984
  accountKeysFromLookups = args.accountKeysFromLookups;
985
- } else if (args && 'addressLookupTableAccounts' in args) {
985
+ } else if (args && 'addressLookupTableAccounts' in args && args.addressLookupTableAccounts) {
986
986
  accountKeysFromLookups = this.resolveAddressTableLookups(args.addressLookupTableAccounts);
987
987
  } else if (this.addressTableLookups.length > 0) {
988
988
  throw new Error('Failed to get account keys because address table lookups were not resolved');
@@ -2144,6 +2144,14 @@ class VersionedTransaction {
2144
2144
  }
2145
2145
  }
2146
2146
 
2147
+ addSignature(publicKey, signature) {
2148
+ assert(signature.byteLength === 64, 'Signature must be 64 bytes long');
2149
+ const signerPubkeys = this.message.staticAccountKeys.slice(0, this.message.header.numRequiredSignatures);
2150
+ const signerIndex = signerPubkeys.findIndex(pubkey => pubkey.equals(publicKey));
2151
+ assert(signerIndex >= 0, `Can not add signature; \`${publicKey.toBase58()}\` is not required to sign this transaction`);
2152
+ this.signatures[signerIndex] = signature;
2153
+ }
2154
+
2147
2155
  }
2148
2156
 
2149
2157
  const SYSVAR_CLOCK_PUBKEY = new PublicKey('SysvarC1ock11111111111111111111111111111111');