import { generateKeyPair } from '@solana/keys';
import { partiallySignTransaction } from '@solana/transactions';
const partiallySignedTransaction = await partiallySignTransaction([myPrivateKey], tx);
signTransaction if you want to assert that the transaction has all of its required signatures after signing.
Given an array of
CryptoKeyobjects which are private keys pertaining to addresses that are required to sign a transaction, this method will return a new signed transaction of type Transaction.Though the resulting transaction might have every signature it needs to land on the network, this function will not assert that it does. A partially signed transaction cannot be landed on the network, but can be serialized and deserialized.