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

feat: Add Solana liquid staking support #1461

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

FWangZil
Copy link
Contributor

Add the ability of liquid staking to the current elizaos solana plugin.

  • It can build the desired staking requests for end-users, eliminating the complexity of front-end development and the need for users to switch between multiple platforms to compare APYs and select staking protocols.
  • Currently supports five protocols: "jito", "blaze", "jpool", "marinade", "marginfi", and is capable of expanding to support more protocols.

Relates to:

Issue #1434

Risks

  • There are no risks. An independent new Solana feature module has been introduced without modifying the code of other parts.

Background

  • There are some distinctive liquid staking solutions on Solana. However, users or developers need to provide a specific APP for users to conduct staking.
  • Liquid Staking Action aims to enable users to interact with the Agent through natural language. The Eliza Agent will build transactions for users. The front-end only needs to integrate a Solana wallet to support multiple staking protocols, eliminating the need to code and integrate the specific logic of different staking protocols.

What does this PR do?

  • When the user specifies a liquid staking protocol, build the corresponding transaction (base58 encoded) for the user.
  • When the user does not specify a specific protocol, based on the APY and TVL data of multiple protocols provided by the StakeProtocolProvider, use the designated LLM to optimize the staking protocol for the user and then build the corresponding transaction.
  • The StakeProtocolProvider uses the Solana LST data provider open-sourced by stafiprotocol to provide data support. You can choose to use the default Stafi API or deploy it yourself.

What kind of change is this?

Features (non-breaking change which adds functionality)

Documentation changes needed?

  • No

Testing

Where should a reviewer start?

  • packages/plugin-solana/src/actions/liquidStake.ts

Detailed testing steps

  1. Enable @elizaos/plugin-solana in the character.
  2. Interact with the Agent, for example: “My address is HqvTPqS2FaB2fQ7mxqZHQHz6H28o1u2Z9fRH5No8JN2W and I want to stake 0.01 SOL”.
  3. Obtain the response (the constructed staking transaction).

Copy link

@dcb9 dcb9 left a comment

Choose a reason for hiding this comment

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

Code style

packages/plugin-solana/package.json Outdated Show resolved Hide resolved
packages/plugin-solana/src/actions/liquidStake.ts Outdated Show resolved Hide resolved
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

Successfully merging this pull request may close these issues.

2 participants