Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

create stake acccount #17

Open
AC-devon opened this issue Feb 24, 2021 · 9 comments
Open

create stake acccount #17

AC-devon opened this issue Feb 24, 2021 · 9 comments

Comments

@AC-devon
Copy link

hey,
i wonder how to create stakeAccount using this wallet adapter, since the current signTransaction wallet method expect TransactionInstruction type while create stakeAccount is Transaction type, so it already signed

any ideas?

@jstarry
Copy link
Contributor

jstarry commented Feb 25, 2021

I'm pretty sure that signTransaction expects a Transaction, not TransactionInstruction. You can create a Transaction with new Transaction().add(instruction)

@AC-devon
Copy link
Author

AC-devon commented Feb 25, 2021

yea, sorry my bad.
i just notes that StakeProgram.createAccount return Transaction
and SystemProgram.transfer return TransactionInstruction
so I got confused.

anyway...it seems that sign transaction still not working for create stake account:
here's the code:
image

this: const signed = await wallet.signTransaction(transaction);
return error:
Signature verification failed
at Transaction.serialize

@jstarry
Copy link
Contributor

jstarry commented Feb 25, 2021

I believe this is due to a mismatch of @solana/web3.js versions. Try using the web3 version that the adapter is using:

"@solana/web3.js": "^0.70.3",

@AC-devon
Copy link
Author

unfortunately it didnt to the trick =/
here with relative code for 0.70.3ver
image

@Sotatek-HungNgo3
Copy link

Hi, I have the same problem. Any idea to fix this issue?
Thanks a lot

@jstarry
Copy link
Contributor

jstarry commented Jul 10, 2021

Hi, I have the same problem. Any idea to fix this issue?
Thanks a lot

@Sotatek-HungNgo3 which problem are you hitting?

@jstarry
Copy link
Contributor

jstarry commented Jul 10, 2021

The @solana/web3.js dependency for this adapter has been updated so I recommend updating everything to latest

@yangli-io
Copy link

yangli-io commented Jul 11, 2021

The above code was getting a Signature verification failed which probably means there is something wrong signing the message.

On a closer inspection of what the code is doing, it looks like it's trying to created a new Stake account using the wallet account to pay for it. So here we are dealing with two accounts, the new Stake account and our wallet account hence we need to sign with both accounts. But it looks like only the wallet is signing the tx here.

I think adding these lines after line 85 should fix it, I haven't tried but let me know

// After line 85
transaction.feePayer = wallet.publicKey; // Specify Fee payer
transaction.partialSign(newStakeAccount);

@Patelravi8585
Copy link

is code for staking running now ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants