solana-py icon indicating copy to clipboard operation
solana-py copied to clipboard

add stake program functionality

Open mindrunner opened this issue 2 years ago • 9 comments

Replacement for:

https://github.com/michaelhly/solana-py/pull/129

mindrunner avatar Mar 09 '23 15:03 mindrunner

Codecov Report

Attention: Patch coverage is 84.11215% with 17 lines in your changes are missing coverage. Please review.

Project coverage is 89.67%. Comparing base (ff9af68) to head (60a7bae).

:exclamation: Current head 60a7bae differs from pull request most recent head 6b48d94

Please upload reports for the commit 6b48d94 to get more accurate results.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #345      +/-   ##
==========================================
- Coverage   89.69%   89.67%   -0.03%     
==========================================
  Files          27       31       +4     
  Lines        2193     2324     +131     
==========================================
+ Hits         1967     2084     +117     
- Misses        226      240      +14     

codecov[bot] avatar Mar 10 '23 00:03 codecov[bot]

@mindrunner can you fix the linter issues and write a few integration tests that cover the new code?

michaelhly avatar Mar 10 '23 15:03 michaelhly

yeap, already on it. didn't find the time yet

mindrunner avatar Mar 10 '23 17:03 mindrunner

Looking at the tests, it seems like comparing my tx with cli_wire_msg would not work. (And it does not indeed.)

Where does js_wire_msg come from. Was that generated by solana-web3.js?

mindrunner avatar Mar 10 '23 22:03 mindrunner

Looking at the tests, it seems like comparing my tx with cli_wire_msg would not work. (And it does not indeed.)

Where does js_wire_msg come from. Was that generated by solana-web3.js?

Yes

michaelhly avatar Mar 11 '23 00:03 michaelhly

@mindrunner i'm trying to incorporate your code, but am having an issue when trying to use create_account_and_delegate_stake. It seems i need to provide a stake account, even though the function is supposed to create one. Thanks

Morgandri1 avatar May 18 '23 21:05 Morgandri1

Are you refering to stake_pubkey parameter?

Just generate a keypair and pass in the public part and you should be fine! :)

mindrunner avatar May 18 '23 22:05 mindrunner

Does it not require an owner? When you create a token account it has to be attached to an owner, so I would assume this would be the same or a similar system.

Morgandri1 avatar May 19 '23 02:05 Morgandri1

As far as I know, those kind of accounts do not have an ownership of that kind. You provide an authorized keypair instead. This private key will be the one having the stake in custody.

I think the Solana Stackexchange would probably be the better place to ask such questions :)

mindrunner avatar May 19 '23 08:05 mindrunner