helius-labs / helius-sdk

149 stars 42 forks source link

[BUG] Transaction fails during signing verification using sendSmartTransaction when using a different feePayer account #96

Closed hassanshafique closed 5 months ago

hassanshafique commented 5 months ago

Example code to reproduce this error

const fromWallet = setup wallet here from where you want to send sol from
const feePayer = setup wallet here who will pay the transaction fee
const recipientPublicAddress = public address of the sol receiver
const lamportsToSend = sol in lamport form to send

const instructions = [
    SystemProgram.transfer({
        fromPubkey: fromWallet.publicKey,
        toPubkey: recipientPublicAddress,
        lamports: lamportsToSend,
    })
];
const signers = [feePayer, fromWallet];
const transactionSignature = await helius.rpc.sendSmartTransaction(instructions, signers);

The above code will throw the error during transaction.serialize(), because signer for fromWallet public address missing!

If feePayer is not set and there is only one signer, no error happens and transaction goes smoothly.

Possible solutions:

I have seen the code, the feePayer need to also partially sign the transaction!

0xIchigo commented 5 months ago

gm @hassanshafique! Can you take a look at #100? I've opened up the PR to address the issue you've outlined above

0xIchigo commented 5 months ago

This issue can be considered resolved by #100

hassanshafique commented 5 months ago

gm @hassanshafique! Can you take a look at #100? I've opened up the PR to address the issue you've outlined above

It worked! but there is a different error I am facing, when simulating the transaction to get compute unit. Creating a new issue for that!