mirror of
https://github.com/d0zingcat/solana-agent-kit.git
synced 2026-06-04 15:11:38 +00:00
feat + fix: add action to get user drift account info and fix deposit, borrow, lend and withdraw on drift
This commit is contained in:
39
src/actions/drift/driftUserAccountInfo.ts
Normal file
39
src/actions/drift/driftUserAccountInfo.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
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;
|
||||
Reference in New Issue
Block a user