Add Solayer staking through blinks

This commit is contained in:
JoshuaSum
2025-01-01 17:41:46 -08:00
parent 42b64f2264
commit 1a34e9a4e5
8 changed files with 3337 additions and 3785 deletions

View File

@@ -10,6 +10,7 @@ import getTokenDataAction from "./getTokenData";
import getTPSAction from "./getTPS";
import fetchPriceAction from "./fetchPrice";
import stakeWithJupAction from "./stakeWithJup";
import stakeWithSolayerAction from "./stakeWithSolayer";
import registerDomainAction from "./registerDomain";
import lendAssetAction from "./lendAsset";
import createGibworkTaskAction from "./createGibworkTask";
@@ -40,6 +41,7 @@ export const ACTIONS = {
"GET_TPS_ACTION" : getTPSAction,
"FETCH_PRICE_ACTION" : fetchPriceAction,
"STAKE_WITH_JUP_ACTION" : stakeWithJupAction,
"STAKE_WITH_SOLAYER_ACTION" : stakeWithSolayerAction,
"REGISTER_DOMAIN_ACTION" : registerDomainAction,
"LEND_ASSET_ACTION" : lendAssetAction,
"CREATE_GIBWORK_TASK_ACTION" : createGibworkTaskAction,

View File

@@ -0,0 +1,60 @@
import { Action } from "../types/action";
import { SolanaAgentKit } from "../agent";
import { z } from "zod";
import { stakeWithSolayer } from "../tools";
const stakeWithSolayerAction: Action = {
name: "STAKE_WITH_SOLAYER",
similes: [
"stake sol",
"solayer sol",
"ssol",
"stake with solayer",
"solayer restaking",
"solayer staking",
"stake with sol",
"liquid staking solayer",
"get solayer sol",
"solayer sol restaking",
"solayer sol staking",
],
description:
"Stake native SOL with Solayer's restaking protocol to receive Solayer SOL (sSOL)",
examples: [
[
{
input: {
amount: 1.0,
},
output: {
status: "success",
signature: "3FgHn9...",
message: "Successfully staked 1.0 SOL for Solayer SOL (sSOL)",
},
explanation: "Stake 1.0 SOL to receive Solayer SOL (sSOL)",
},
],
],
schema: z.object({
amount: z.number().positive().describe("Amount of SOL to stake"),
}),
handler: async (agent: SolanaAgentKit, input: Record<string, any>) => {
try {
const amount = input.amount as number;
const res = await stakeWithSolayer(agent, amount);
return {
status: "success",
res,
message: `Successfully staked ${amount} SOL for Solayer SOL (sSOL)`,
};
} catch (error: any) {
return {
status: "error",
message: `Solayer staking failed: ${error.message}`,
};
}
},
};
export default stakeWithSolayerAction;