Fix formatting issues and removing unusued libaries

This commit is contained in:
Fahri Bilici
2024-12-30 22:31:15 +01:00
parent 3b4fddd65a
commit c00515f3d2
35 changed files with 574 additions and 662 deletions

View File

@@ -1,5 +1,4 @@
import { PublicKey } from "@solana/web3.js";
import { Action, ActionExample } from "../types/action";
import { Action } from "../types/action";
import { SolanaAgentKit } from "../agent";
import { z } from "zod";
import { deploy_token } from "../tools";
@@ -13,7 +12,8 @@ const deployTokenAction: Action = {
"create new token",
"mint token",
],
description: "Deploy a new SPL token on the Solana blockchain with specified parameters",
description:
"Deploy a new SPL token on the Solana blockchain with specified parameters",
examples: [
[
{
@@ -22,38 +22,38 @@ const deployTokenAction: Action = {
uri: "https://example.com/token.json",
symbol: "MTK",
decimals: 9,
initialSupply: 1000000
initialSupply: 1000000,
},
output: {
mint: "7nE9GvcwsqzYxmJLSrYmSB1V1YoJWVK1KWzAcWAzjXkN",
status: "success",
message: "Token deployed successfully"
message: "Token deployed successfully",
},
explanation: "Deploy a token with initial supply and metadata"
}
explanation: "Deploy a token with initial supply and metadata",
},
],
[
{
input: {
name: "Basic Token",
uri: "https://example.com/basic.json",
symbol: "BASIC"
symbol: "BASIC",
},
output: {
mint: "8nE9GvcwsqzYxmJLSrYmSB1V1YoJWVK1KWzAcWAzjXkM",
status: "success",
message: "Token deployed successfully"
message: "Token deployed successfully",
},
explanation: "Deploy a basic token with minimal parameters"
}
]
explanation: "Deploy a basic token with minimal parameters",
},
],
],
schema: z.object({
name: z.string().min(1, "Name is required"),
uri: z.string().url("URI must be a valid URL"),
symbol: z.string().min(1, "Symbol is required"),
decimals: z.number().optional(),
initialSupply: z.number().optional()
initialSupply: z.number().optional(),
}),
handler: async (agent: SolanaAgentKit, input: Record<string, any>) => {
try {
@@ -63,21 +63,21 @@ const deployTokenAction: Action = {
input.uri,
input.symbol,
input.decimals,
input.initialSupply
input.initialSupply,
);
return {
mint: result.mint.toString(),
status: "success",
message: "Token deployed successfully"
message: "Token deployed successfully",
};
} catch (error: any) {
return {
status: "error",
message: `Token deployment failed: ${error.message}`
message: `Token deployment failed: ${error.message}`,
};
}
}
}
},
};
export default deployTokenAction;
export default deployTokenAction;