merge and docs

This commit is contained in:
Arihant Bansal
2025-01-04 23:41:47 +05:30
57 changed files with 22860 additions and 554 deletions

View File

@@ -2,7 +2,6 @@ import { Action } from "../types/action";
import { SolanaAgentKit } from "../agent";
import { z } from "zod";
import { PublicKey } from "@solana/web3.js";
import { BN } from "@coral-xyz/anchor";
import { Decimal } from "decimal.js";
import { orcaCreateSingleSidedLiquidityPool } from "../tools";

View File

@@ -0,0 +1,29 @@
import { z } from "zod";
import { SolanaAgentKit } from "..";
import { get_wallet_address } from "../tools";
import { Action } from "../types/action";
const getWalletAddressAction: Action = {
name: "GET_WALLET_ADDRESS",
similes: ["wallet address", "address", "wallet"],
description: "Get wallet address of the agent",
examples: [
[
{
input: {},
output: {
status: "success",
address: "0x1234567890abcdef",
},
explanation: "The agent's wallet address is 0x1234567890abcdef",
},
],
],
schema: z.object({}),
handler: async (agent: SolanaAgentKit) => ({
status: "success",
address: get_wallet_address(agent),
}),
};
export default getWalletAddressAction;

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";
@@ -26,8 +27,10 @@ import raydiumCreateCpmmAction from "./raydiumCreateCpmm";
import raydiumCreateAmmV4Action from "./raydiumCreateAmmV4";
import createOrcaSingleSidedWhirlpoolAction from "./createOrcaSingleSidedWhirlpool";
import launchPumpfunTokenAction from "./launchPumpfunToken";
import getWalletAddressAction from "./getWalletAddress";
export const ACTIONS = {
WALLET_ADDRESS_ACTION: getWalletAddressAction,
DEPLOY_TOKEN_ACTION: deployTokenAction,
BALANCE_ACTION: balanceAction,
TRANSFER_ACTION: transferAction,
@@ -40,6 +43,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;