Pass the krypair of backend wallet as a Signer for the transaction
umaid56 opened this issue · 0 comments
umaid56 commented
I want to sign the transaction using both a keypair as a backend wallet and the Phantom wallet. I am using the Solana wallet adapter package. How can I do this with the Solana wallet adapter and the backend keypair? I was using this but it can't work as it give me error
Error:
transaction.serialize is not a function at StandardWalletAdapter.sendTransaction (adapter.ts:347:1)
const backend = Keypair.fromSecretKey( base58.decode(keypair ) );
const ExecuteInstructions = await constructExecuteSaleTxByBuyer(wallet?.adapter,publicKey,sellerPubKey,mintAddress,1)
ExecuteInstructions.recentBlockhash = (
await connection.getLatestBlockhash()
).blockhash;
ExecuteInstructions.feePayer = publicKey
ExecuteInstructions.sign(backend);
const serializedTx = ExecuteInstructions.serialize({ requireAllSignatures: false });
const ExecuteSignature = await sendTransaction(serializedTx, connection);
await connection.confirmTransaction(ExecuteSignature);
console.log("\n\n\n\nExecution Done",ExecuteSignature)
```