UNPKG

@hashgraphonline/hedera-agent-kit

Version:

Build LLM-powered applications that interact with the Hedera Network. Create conversational agents that can understand user requests in natural language and execute Hedera transactions, or build backend systems that leverage AI for on-chain operations.

41 lines (35 loc) 1.19 kB
import { z } from 'zod'; import { DeleteFileParams } from '../../../types'; import { BaseHederaTransactionTool, BaseHederaTransactionToolParams, } from '../common/base-hedera-transaction-tool'; import { BaseServiceBuilder } from '../../../builders/base-service-builder'; import { FileBuilder } from '../../../builders/file/file-builder'; const DeleteFileZodSchemaCore = z.object({ fileId: z .string() .describe('The ID of the file to delete (e.g., "0.0.xxxx").'), }); export class HederaDeleteFileTool extends BaseHederaTransactionTool< typeof DeleteFileZodSchemaCore > { name = 'hedera-file-delete'; description = 'Deletes a file from the Hedera File Service.'; specificInputSchema = DeleteFileZodSchemaCore; namespace = 'file'; constructor(params: BaseHederaTransactionToolParams) { super(params); } protected getServiceBuilder(): BaseServiceBuilder { return this.hederaKit.fs(); } protected async callBuilderMethod( builder: BaseServiceBuilder, specificArgs: z.infer<typeof DeleteFileZodSchemaCore> ): Promise<void> { await (builder as FileBuilder).deleteFile( specificArgs as unknown as DeleteFileParams ); } }