mirror of
https://github.com/d0zingcat/solana-agent-kit.git
synced 2026-05-16 15:10:26 +00:00
40 lines
992 B
TypeScript
40 lines
992 B
TypeScript
import { z } from "zod";
|
|
import type { Action } from "../../types";
|
|
import { driftUserAccountInfo } from "../../tools";
|
|
|
|
const driftUserAccountInfoAction: Action = {
|
|
name: "DRIFT_USER_ACCOUNT_INFO",
|
|
similes: ["get drift user account info", "get drift account info"],
|
|
description: "Get information about your drift account",
|
|
examples: [
|
|
[
|
|
{
|
|
input: {},
|
|
explanation: "Get information about your drift account",
|
|
output: {
|
|
status: "success",
|
|
data: {},
|
|
},
|
|
},
|
|
],
|
|
],
|
|
schema: z.object({}),
|
|
handler: async (agent) => {
|
|
try {
|
|
const accountInfo = await driftUserAccountInfo(agent);
|
|
return {
|
|
status: "success",
|
|
data: accountInfo,
|
|
};
|
|
} catch (e) {
|
|
return {
|
|
status: "error",
|
|
// @ts-expect-error - error message is a string
|
|
message: `Failed to get drift account info: ${e.message}`,
|
|
};
|
|
}
|
|
},
|
|
};
|
|
|
|
export default driftUserAccountInfoAction;
|