Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
2nd argument to addSignature should be signature, not private key, and private key should not be passed to constructor: https://github.com/solana-labs/solana-web3.js/blob/0252b8a/packages/library-legacy/src/transaction/versioned.ts#L111
These are all viable ways to sign a Versioned Transaction:
let tx = new VersionedTransaction(message, [wallet.payer.secretKey]);
tx.sign([wallet.payer]);
tx.addSignature(wallet.publicKey, wallet.payer.secretKeysignature);
These are all viable ways to sign a Versioned Transaction:
let tx = new VersionedTransaction(message, [wallet.payer.secretKey]);
tx.sign([wallet.payer]);
tx.addSignature(wallet.publicKey, wallet.payer.secretKey);
These are all viable ways to sign a Versioned Transaction:
let tx = new VersionedTransaction(message);
tx.sign([wallet.payer]);
tx.addSignature(wallet.publicKey, signature);
These are all viable ways to sign a Versioned Transaction:
let tx = new VersionedTransaction(message, [wallet.payer.secretKey]);
tx.sign([wallet.payer]);
tx.addSignature(wallet.publicKey, wallet.payer.secretKey);