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

@@ -2,7 +2,6 @@ import { Action } from "../types/action";
import { SolanaAgentKit } from "../agent";
import { z } from "zod";
import { PublicKey } from "@solana/web3.js";
import { TldParser } from "@onsol/tldparser";
import { getMainAllDomainsDomain } from "../tools";
const getMainAllDomainsDomainAction: Action = {
@@ -13,52 +12,56 @@ const getMainAllDomainsDomainAction: Action = {
"get default domain",
"get main address name",
"get primary name",
"get main domain name"
"get main domain name",
],
description: "Get the main domain associated with a wallet address",
examples: [
[
{
input: {
address: "7nxQB..."
address: "7nxQB...",
},
output: {
status: "success",
domain: "solana.sol",
message: "Successfully retrieved main domain"
message: "Successfully retrieved main domain",
},
explanation: "Get the main domain name for a given wallet address"
}
]
explanation: "Get the main domain name for a given wallet address",
},
],
],
schema: z.object({
address: z.string()
address: z
.string()
.min(1)
.describe("The wallet address to get the main domain for")
.describe("The wallet address to get the main domain for"),
}),
handler: async (agent: SolanaAgentKit, input: Record<string, any>) => {
try {
const mainDomain = await getMainAllDomainsDomain(agent, new PublicKey(input.address));
const mainDomain = await getMainAllDomainsDomain(
agent,
new PublicKey(input.address),
);
if (!mainDomain) {
return {
status: "error",
message: "No main domain found for this address"
message: "No main domain found for this address",
};
}
return {
status: "success",
domain: mainDomain,
message: "Successfully retrieved main domain"
message: "Successfully retrieved main domain",
};
} catch (error: any) {
return {
status: "error",
message: `Failed to get main domain: ${error.message}`
message: `Failed to get main domain: ${error.message}`,
};
}
}
},
};
export default getMainAllDomainsDomainAction;
export default getMainAllDomainsDomainAction;