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

Add Solana Signing Support, Examples #33

Merged
merged 11 commits into from
Sep 20, 2024
Merged

Conversation

ProfMoo
Copy link
Contributor

@ProfMoo ProfMoo commented Sep 18, 2024

What changed? Why?

This PR adds an abstraction around the SDK's signing support in order to support signing staking operations for ETH and SOL using the same interface. This PR relies heavily on Golang's stdlib crypto/rand.

Alongside these changes, I included numerous Solana stake examples to provide full examples of how to stake SOL.

Our current Solana staking endpoint can take significant periods of time to get data from the underlying Solana nodes, so I've added the ability to modify the timeout on the client.

@cb-heimdall
Copy link

cb-heimdall commented Sep 18, 2024

✅ Heimdall Review Status

Requirement Status More Info
Reviews 1/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 0
Sum 1

return base58EncodedSignedTx, nil
}

func broadcastSolTransaction(ctx context.Context, signedTx string) (string, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really think we should not be duplicating the sign/broadcast for every variation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. Let me see if we can incorporate this into the SDK to help standardize this functionality.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This example was actually doing numerous thing besides just build-staking-operation. I've split them up into 3 examples.

@ProfMoo ProfMoo changed the title Add Solana Staking Examples Add Solana Signing Support, Examples Sep 19, 2024
Copy link
Contributor

@deangalvin-cb deangalvin-cb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great overall! I think a few unit tests & this is complete!

@ProfMoo
Copy link
Contributor Author

ProfMoo commented Sep 20, 2024

@deangalvin-cb I've added a couple unit test suites for the Signable implementations and updated the existing StakingOperation suite.

Copy link
Contributor

@deangalvin-cb deangalvin-cb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love this pattern!

@ProfMoo ProfMoo merged commit b41b1dc into master Sep 20, 2024
5 checks passed
@ProfMoo ProfMoo deleted the solana-staking-example branch September 20, 2024 14:34
@drohit-cb
Copy link
Contributor

@ProfMoo Love this. Thanks! Would be nice to follow up on the NodeJS SDK as well and have the same pattern both places.

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

Successfully merging this pull request may close these issues.

4 participants