@hashgraphonline/standards-agent-kit 0.2.134 → 0.2.136
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/interfaces/FormValidatable.d.ts +4 -13
- package/dist/cjs/standards-agent-kit.cjs +1 -1
- package/dist/cjs/standards-agent-kit.cjs.map +1 -1
- package/dist/cjs/tools/inscriber/InscribeHashinalTool.d.ts +1 -8
- package/dist/cjs/tools/inscriber/base-inscriber-tools.d.ts +19 -0
- package/dist/es/interfaces/FormValidatable.d.ts +4 -13
- package/dist/es/standards-agent-kit.es33.js +12 -0
- package/dist/es/standards-agent-kit.es33.js.map +1 -1
- package/dist/es/standards-agent-kit.es34.js +2 -2
- package/dist/es/standards-agent-kit.es34.js.map +1 -1
- package/dist/es/standards-agent-kit.es36.js +2 -2
- package/dist/es/standards-agent-kit.es36.js.map +1 -1
- package/dist/es/standards-agent-kit.es37.js +25 -26
- package/dist/es/standards-agent-kit.es37.js.map +1 -1
- package/dist/es/standards-agent-kit.es44.js +1 -1
- package/dist/es/standards-agent-kit.es44.js.map +1 -1
- package/dist/es/standards-agent-kit.es51.js +2 -2
- package/dist/es/standards-agent-kit.es51.js.map +1 -1
- package/dist/es/tools/inscriber/InscribeHashinalTool.d.ts +1 -8
- package/dist/es/tools/inscriber/base-inscriber-tools.d.ts +19 -0
- package/dist/umd/interfaces/FormValidatable.d.ts +4 -13
- package/dist/umd/standards-agent-kit.umd.js +1 -1
- package/dist/umd/standards-agent-kit.umd.js.map +1 -1
- package/dist/umd/tools/inscriber/InscribeHashinalTool.d.ts +1 -8
- package/dist/umd/tools/inscriber/base-inscriber-tools.d.ts +19 -0
- package/package.json +2 -2
- package/src/interfaces/FormValidatable.ts +9 -12
- package/src/tools/inscriber/InscribeFromBufferTool.ts +2 -2
- package/src/tools/inscriber/InscribeFromUrlTool.ts +2 -2
- package/src/tools/inscriber/InscribeHashinalTool.ts +43 -50
- package/src/tools/inscriber/base-inscriber-tools.ts +26 -0
- package/src/types/inscription-response.ts +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standards-agent-kit.es37.js","sources":["../../src/tools/inscriber/InscribeHashinalTool.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { z } from 'zod';\nimport { BaseInscriberQueryTool } from './base-inscriber-tools';\nimport {\n InscriptionOptions,\n InscriptionInput,\n ContentResolverRegistry,\n Logger,\n} from '@hashgraphonline/standards-sdk';\nimport { CallbackManagerForToolRun } from '@langchain/core/callbacks/manager';\nimport { validateHIP412Metadata } from '../../validation/hip412-schemas';\nimport { contentRefSchema } from '../../validation/content-ref-schemas';\nimport { generateDefaultMetadata } from '../../utils/metadata-defaults';\nimport {\n extendZodSchema,\n renderConfigs,\n} from '../../lib/zod-render/schema-extension';\nimport type { EnhancedRenderConfig } from '../../lib/zod-render/types';\nimport {\n createInscriptionSuccess,\n createInscriptionQuote,\n createInscriptionError,\n InscriptionResponse,\n} from '../../types/inscription-response';\nimport { FormValidatable } from '../../interfaces/FormValidatable';\n\n/**\n * Network-specific Hashinal block configuration for HashLink blocks\n */\nconst HASHLINK_BLOCK_CONFIG = {\n testnet: {\n blockId: '0.0.6617393',\n hashLink: 'hcs://12/0.0.6617393',\n template: '0.0.6617393',\n },\n mainnet: {\n blockId: '0.0.TBD',\n hashLink: 'hcs://12/0.0.TBD',\n template: '0.0.TBD',\n },\n} as const;\n\n/**\n * Gets the appropriate HashLink block configuration for the specified network.\n * Provides graceful fallback to testnet for unknown networks or undeployed mainnet blocks.\n *\n * @param network The network type to get configuration for\n * @returns Network-specific block configuration with blockId, hashLink, and template\n */\nfunction getHashLinkBlockId(network: 'mainnet' | 'testnet') {\n const config = HASHLINK_BLOCK_CONFIG[network];\n if (!config || config.blockId === '0.0.TBD') {\n return HASHLINK_BLOCK_CONFIG.testnet;\n }\n return config;\n}\n\n/**\n * Result of HCS-12 block lookup\n */\ninterface HCS12BlockResult {\n blockId: string;\n hashLink: string;\n template: string;\n attributes: Record<string, unknown>;\n}\n\n/**\n * Schema for inscribing Hashinal NFT\n */\nconst inscribeHashinalSchema = extendZodSchema(\n z.object({\n url: z\n .string()\n .optional()\n .describe(\n 'The URL of the content to inscribe as Hashinal NFT (use this OR contentRef)'\n ),\n contentRef: contentRefSchema\n .optional()\n .describe(\n 'Content reference ID in format \"content-ref:[id]\" for already stored content (use this OR url)'\n ),\n base64Data: z\n .string()\n .optional()\n .describe(\n 'Base64 encoded content data (use this if neither url nor contentRef provided)'\n ),\n fileName: z\n .string()\n .optional()\n .describe(\n 'File name for the content (required when using base64Data or contentRef)'\n ),\n mimeType: z\n .string()\n .optional()\n .describe('MIME type of the content (e.g., \"image/png\", \"image/jpeg\")'),\n name: z\n .string()\n .optional()\n .describe(\n 'Display name for the NFT (e.g., \"Sunset Landscape #42\", \"Digital Abstract Art\")'\n ),\n creator: z\n .string()\n .optional()\n .describe(\n 'Creator account ID, artist name, or brand (e.g., \"0.0.123456\", \"ArtistName\", \"StudioBrand\")'\n ),\n description: z\n .string()\n .optional()\n .describe(\n 'Meaningful description of the artwork, story, or concept behind this NFT'\n ),\n type: z\n .string()\n .optional()\n .describe(\n 'Category or genre of the NFT (e.g., \"Digital Art\", \"Photography\", \"Collectible Card\")'\n ),\n attributes: extendZodSchema(\n z.array(\n z.object({\n trait_type: z.string(),\n value: z.union([z.string(), z.number()]),\n })\n )\n )\n .withRender(renderConfigs.array('NFT Attributes', 'Attribute'))\n .optional()\n .describe(\n 'Collectible traits and characteristics (e.g., \"Rarity\": \"Epic\", \"Color\": \"Blue\", \"Style\": \"Abstract\")'\n ),\n properties: z\n .record(z.unknown())\n .optional()\n .describe('Additional properties'),\n jsonFileURL: z\n .string()\n .url()\n .optional()\n .describe('URL to JSON metadata file'),\n fileStandard: z\n .enum(['1', '6'])\n .optional()\n .default('1')\n .describe(\n 'HCS file standard: 1 for static Hashinals (HCS-5), 6 for dynamic Hashinals (HCS-6)'\n ),\n tags: z.array(z.string()).optional().describe('Tags to categorize the NFT'),\n chunkSize: z\n .number()\n .int()\n .positive()\n .optional()\n .describe('Chunk size for large files'),\n waitForConfirmation: z\n .boolean()\n .optional()\n .describe('Whether to wait for inscription confirmation'),\n timeoutMs: z\n .number()\n .int()\n .positive()\n .optional()\n .describe(\n 'Timeout in milliseconds for inscription (default: no timeout - waits until completion)'\n ),\n quoteOnly: z\n .boolean()\n .optional()\n .default(false)\n .describe(\n 'If true, returns a cost quote instead of executing the inscription'\n ),\n withHashLinkBlocks: z\n .boolean()\n .optional()\n .default(true)\n .describe(\n 'If true, creates interactive HashLink blocks for the inscribed content and returns block data alongside the inscription response'\n ),\n renderForm: z\n .boolean()\n .optional()\n .default(true)\n .describe(\n 'Whether to show a form to collect metadata. Set to false only if user provided complete metadata including name, description, creator, and attributes.'\n ),\n })\n).withRender({\n fieldType: 'object',\n ui: {\n label: 'Inscribe Hashinal NFT',\n description: 'Create a Hashinal inscription for NFT minting',\n },\n});\n\n/**\n * Tool for inscribing Hashinal NFTs\n */\nexport class InscribeHashinalTool\n extends BaseInscriberQueryTool\n implements FormValidatable\n{\n name = 'inscribeHashinal';\n description =\n 'Tool for inscribing Hashinal NFTs. CRITICAL: When user provides content (url/contentRef/base64Data), call with ONLY the content parameters - DO NOT auto-generate name, description, creator, or attributes. A form will be automatically shown to collect metadata from the user. Only include metadata parameters if the user explicitly provided them in their message.';\n\n get specificInputSchema(): z.ZodObject<z.ZodRawShape> {\n const baseSchema =\n (inscribeHashinalSchema as z.ZodType & { _def?: { schema?: z.ZodType } })\n ._def?.schema || inscribeHashinalSchema;\n return baseSchema as z.ZodObject<z.ZodRawShape>;\n }\n\n private _schemaWithRenderConfig?: z.ZodObject<z.ZodRawShape>;\n\n override get schema(): z.ZodObject<z.ZodRawShape> {\n if (!this._schemaWithRenderConfig) {\n const baseSchema = this.specificInputSchema;\n const schemaWithRender = baseSchema as z.ZodObject<z.ZodRawShape> & {\n _renderConfig?: {\n fieldType: string;\n ui: { label: string; description: string };\n };\n };\n\n if (!schemaWithRender._renderConfig) {\n schemaWithRender._renderConfig = {\n fieldType: 'object',\n ui: {\n label: 'Inscribe Hashinal NFT',\n description: 'Create a Hashinal inscription for NFT minting',\n },\n };\n }\n this._schemaWithRenderConfig = baseSchema;\n }\n return this._schemaWithRenderConfig;\n }\n\n /**\n * Implementation of FormValidatable interface\n * Determines if a form should be generated for the given input\n */\n shouldGenerateForm(input: unknown): boolean {\n const logger = new Logger({ module: 'InscribeHashinalTool' });\n const inputObj = input as Record<string, unknown>;\n\n logger.info('InscribeHashinalTool: Checking if form should be generated', {\n inputKeys: Object.keys(inputObj || {}),\n hasContent: !!(\n inputObj.url ||\n inputObj.contentRef ||\n inputObj.base64Data\n ),\n renderFormProvided: 'renderForm' in inputObj,\n renderFormValue: inputObj.renderForm,\n });\n\n const hasContentSource = !!(\n inputObj.url ||\n inputObj.contentRef ||\n inputObj.base64Data\n );\n\n if (!hasContentSource) {\n logger.info('InscribeHashinalTool: No content source provided');\n return false;\n }\n\n if ('renderForm' in inputObj && inputObj.renderForm === false) {\n logger.info(\n 'InscribeHashinalTool: renderForm=false, skipping form generation'\n );\n return false;\n }\n\n const isNonEmptyString = (v: unknown): v is string => {\n if (typeof v !== 'string') {\n return false;\n }\n if (v.trim().length === 0) {\n return false;\n }\n return true;\n };\n\n const hasRequiredMetadata =\n isNonEmptyString(inputObj.name) &&\n isNonEmptyString(inputObj.description) &&\n isNonEmptyString(inputObj.creator);\n\n if (hasRequiredMetadata) {\n logger.info(\n 'InscribeHashinalTool: Required metadata present, skipping form generation'\n );\n return false;\n }\n\n logger.info(\n 'InscribeHashinalTool: Content provided, showing form for metadata collection'\n );\n return true;\n }\n\n /**\n * Implementation of FormValidatable interface\n * Returns the focused schema for form generation\n */\n getFormSchema(): z.ZodObject<z.ZodRawShape> {\n const focusedSchema = extendZodSchema(\n z.object({\n name: z\n .string()\n .min(1, 'Name is required')\n .describe(\n 'Display name for the NFT (e.g., \"Sunset Landscape #42\", \"Digital Abstract Art\")'\n ),\n\n description: z\n .string()\n .min(1, 'Description is required')\n .describe(\n 'Meaningful description of the artwork, story, or concept behind this NFT'\n ),\n\n creator: z\n .string()\n .min(1, 'Creator is required')\n .describe(\n 'Creator account ID, artist name, or brand (e.g., \"0.0.123456\", \"ArtistName\", \"StudioBrand\")'\n ),\n\n attributes: extendZodSchema(\n z.array(\n z.object({\n trait_type: z\n .string()\n .describe('Trait name (e.g., \"Rarity\", \"Color\", \"Style\")'),\n value: z\n .union([z.string(), z.number()])\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n .describe('Trait value (e.g., \"Epic\", \"Blue\", 85)'),\n })\n )\n )\n .withRender(\n renderConfigs.array(\n 'NFT Attributes',\n 'Attribute'\n ) as EnhancedRenderConfig\n )\n .optional()\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n .describe('Collectible traits and characteristics.'),\n\n type: z\n .string()\n .optional()\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n .describe(\n 'Category or genre of the NFT (e.g., \"Digital Art\", \"Photography\", \"Collectible Card)'\n ),\n })\n ).withRender({\n fieldType: 'object',\n ui: {\n label: 'Complete NFT Metadata',\n description: 'Provide meaningful metadata to create a valuable NFT',\n },\n });\n\n return focusedSchema as unknown as z.ZodObject<z.ZodRawShape>;\n }\n\n /**\n * Implementation of FormValidatable interface\n * Validates metadata quality and provides detailed feedback\n */\n validateMetadataQuality(input: unknown): {\n needsForm: boolean;\n reason: string;\n } {\n const inputObj = input as Record<string, unknown>;\n const hasRequiredMetadata = !!(\n inputObj.name &&\n inputObj.description &&\n inputObj.creator\n );\n\n if (!hasRequiredMetadata) {\n return {\n needsForm: true,\n reason:\n 'Missing essential metadata (name, description, creator) for NFT creation',\n };\n }\n\n return {\n needsForm: false,\n reason: 'All required metadata fields present',\n };\n }\n\n protected async executeQuery(\n params: z.infer<typeof inscribeHashinalSchema>,\n _runManager?: CallbackManagerForToolRun\n ): Promise<InscriptionResponse> {\n if (!params.url && !params.contentRef && !params.base64Data) {\n return createInscriptionError({\n code: 'MISSING_CONTENT',\n details: 'No content source provided',\n suggestions: [\n 'Provide a URL to content you want to inscribe',\n 'Upload a file and use the content reference',\n 'Provide base64-encoded content data',\n ],\n });\n }\n\n const operatorAccount =\n this.inscriberBuilder[\n 'hederaKit'\n ]?.client?.operatorAccountId?.toString() || '0.0.unknown';\n\n const rawMetadata = {\n ...generateDefaultMetadata({\n name: params.name,\n creator: params.creator,\n description: params.description,\n type: params.type,\n fileName: params.fileName,\n mimeType: params.mimeType,\n operatorAccount,\n }),\n attributes: Array.isArray(params.attributes) ? params.attributes : [],\n properties:\n (params.properties as Record<string, unknown> | undefined) || {},\n };\n\n let validatedMetadata;\n try {\n validatedMetadata = validateHIP412Metadata(rawMetadata);\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : String(error);\n return createInscriptionError({\n code: 'METADATA_VALIDATION_FAILED',\n details: `Metadata validation error: ${errorMessage}`,\n suggestions: [\n 'Ensure all required metadata fields are provided',\n 'Check that attribute values are valid',\n 'Verify metadata follows HIP-412 standard',\n ],\n });\n }\n\n const options: InscriptionOptions = {\n mode: 'hashinal',\n metadata: validatedMetadata,\n jsonFileURL: params.jsonFileURL,\n fileStandard: params.fileStandard,\n tags: params.tags,\n chunkSize: params.chunkSize,\n waitForConfirmation: params.quoteOnly\n ? false\n : params.waitForConfirmation ?? true,\n waitMaxAttempts: 30,\n waitIntervalMs: 5000,\n network: this.inscriberBuilder['hederaKit'].client.network\n .toString()\n .includes('mainnet')\n ? 'mainnet'\n : 'testnet',\n quoteOnly: params.quoteOnly,\n };\n\n let inscriptionData: InscriptionInput;\n\n if (params.url) {\n inscriptionData = { type: 'url', url: params.url };\n } else if (params.contentRef || params.base64Data) {\n const inputData = params.contentRef || params.base64Data || '';\n const { buffer, mimeType, fileName } = await this.resolveContent(\n inputData,\n params.mimeType,\n params.fileName\n );\n\n inscriptionData = {\n type: 'buffer' as const,\n buffer,\n fileName: fileName || params.fileName || 'hashinal-content',\n mimeType: mimeType || params.mimeType,\n };\n } else {\n throw new Error('No valid input data provided for inscription');\n }\n\n if (params.quoteOnly) {\n try {\n const quote = await this.generateInscriptionQuote(\n inscriptionData,\n options\n );\n\n return createInscriptionQuote({\n totalCostHbar: quote.totalCostHbar,\n validUntil: quote.validUntil,\n breakdown: quote.breakdown,\n content: {\n name: params.name,\n creator: params.creator,\n type: params.type,\n },\n });\n } catch (error) {\n const errorMessage =\n error instanceof Error\n ? error.message\n : 'Failed to generate inscription quote';\n return createInscriptionError({\n code: 'QUOTE_GENERATION_FAILED',\n details: `Quote generation failed: ${errorMessage}`,\n suggestions: [\n 'Check network connectivity',\n 'Verify content is accessible',\n 'Try again in a moment',\n ],\n });\n }\n }\n\n try {\n let result: Awaited<ReturnType<typeof this.inscriberBuilder.inscribe>>;\n\n if (params.timeoutMs) {\n const timeoutPromise = new Promise<never>((_, reject) => {\n setTimeout(\n () =>\n reject(\n new Error(`Inscription timed out after ${params.timeoutMs}ms`)\n ),\n params.timeoutMs\n );\n });\n\n result = await Promise.race([\n this.inscriberBuilder.inscribe(inscriptionData, options),\n timeoutPromise,\n ]);\n } else {\n result = await this.inscriberBuilder.inscribe(inscriptionData, options);\n }\n\n if (result.confirmed && !result.quote) {\n const imageTopicId = (\n result.inscription as { topic_id?: string; jsonTopicId?: string }\n )?.topic_id;\n const jsonTopicId = (\n result.inscription as { topic_id?: string; jsonTopicId?: string }\n )?.jsonTopicId;\n const network = options.network || 'testnet';\n\n const cdnUrl = jsonTopicId\n ? `https://kiloscribe.com/api/inscription-cdn/${jsonTopicId}?network=${network}`\n : null;\n\n const fileStandard = params.fileStandard || '1';\n const hrl = jsonTopicId ? `hcs://${fileStandard}/${jsonTopicId}` : null;\n const standardType = fileStandard === '6' ? 'Dynamic' : 'Static';\n\n if (!hrl) {\n return createInscriptionError({\n code: 'MISSING_TOPIC_ID',\n details: 'Inscription completed but topic ID is missing',\n suggestions: [\n 'Try the inscription again',\n 'Contact support if the issue persists',\n ],\n });\n }\n\n const inscriptionResponse = createInscriptionSuccess({\n hrl,\n topicId: jsonTopicId || imageTopicId || 'unknown',\n standard: standardType as 'Static' | 'Dynamic',\n cdnUrl: cdnUrl || undefined,\n transactionId: (result.result as { transactionId?: string })\n ?.transactionId,\n metadata: {\n name: params.name,\n creator: params.creator,\n description: params.description,\n type: params.type,\n attributes: params.attributes,\n },\n });\n\n if (params.withHashLinkBlocks) {\n try {\n const blockData = await this.createHashLinkBlock(\n inscriptionResponse,\n inscriptionData.type === 'buffer'\n ? inscriptionData.mimeType\n : undefined\n );\n\n inscriptionResponse.hashLinkBlock = blockData;\n } catch (blockError) {\n // Log error but don't fail the inscription\n const logger = new Logger({ module: 'InscribeHashinalTool' });\n logger.error('Failed to create HashLink block', {\n error: blockError,\n });\n }\n }\n\n return inscriptionResponse;\n } else if (!result.quote && !result.confirmed) {\n const imageTopicId = (\n result.inscription as { topic_id?: string; jsonTopicId?: string }\n )?.topic_id;\n const jsonTopicId = (\n result.inscription as { topic_id?: string; jsonTopicId?: string }\n )?.jsonTopicId;\n\n if (jsonTopicId || imageTopicId) {\n const network = options.network || 'testnet';\n const cdnUrl = jsonTopicId\n ? `https://kiloscribe.com/api/inscription-cdn/${jsonTopicId}?network=${network}`\n : null;\n\n const fileStandard = params.fileStandard || '1';\n const hrl = jsonTopicId\n ? `hcs://${fileStandard}/${jsonTopicId}`\n : null;\n const standardType = fileStandard === '6' ? 'Dynamic' : 'Static';\n\n if (hrl) {\n const inscriptionResponse = createInscriptionSuccess({\n hrl,\n topicId: jsonTopicId || imageTopicId || 'unknown',\n standard: standardType as 'Static' | 'Dynamic',\n cdnUrl: cdnUrl || undefined,\n transactionId: (result.result as { transactionId?: string })\n ?.transactionId,\n metadata: {\n name: params.name,\n creator: params.creator,\n description: params.description,\n type: params.type,\n attributes: params.attributes,\n },\n });\n\n if (params.withHashLinkBlocks) {\n try {\n const blockData = await this.createHashLinkBlock(\n inscriptionResponse,\n inscriptionData.type === 'buffer'\n ? inscriptionData.mimeType\n : undefined\n );\n\n inscriptionResponse.hashLinkBlock = blockData;\n } catch (blockError) {\n // Log error but don't fail the inscription\n const logger = new Logger({ module: 'InscribeHashinalTool' });\n logger.error('Failed to create HashLink block', {\n error: blockError,\n });\n }\n }\n\n return inscriptionResponse;\n }\n }\n\n const transactionId =\n (result.result as { transactionId?: string })?.transactionId ||\n 'unknown';\n return createInscriptionError({\n code: 'INSCRIPTION_PENDING',\n details: `Inscription submitted but not yet confirmed. Transaction ID: ${transactionId}`,\n suggestions: [\n 'Wait a few moments for confirmation',\n 'Check the transaction status on a Hedera explorer',\n \"Try the inscription again if it doesn't confirm within 5 minutes\",\n ],\n });\n } else {\n return createInscriptionError({\n code: 'UNKNOWN_STATE',\n details: 'Inscription completed but result state is unclear',\n suggestions: [\n 'Check if the inscription was successful manually',\n 'Try the inscription again',\n ],\n });\n }\n } catch (error) {\n const errorMessage =\n error instanceof Error\n ? error.message\n : 'Failed to inscribe Hashinal NFT';\n return createInscriptionError({\n code: 'INSCRIPTION_FAILED',\n details: `Inscription failed: ${errorMessage}`,\n suggestions: [\n 'Check network connectivity',\n 'Verify you have sufficient HBAR balance',\n 'Ensure content is accessible and valid',\n 'Try again in a moment',\n ],\n });\n }\n }\n\n /**\n * Creates HashLink block configuration for Hashinal inscriptions.\n * Automatically detects network and selects appropriate block ID configuration.\n * Uses testnet block as fallback for unknown networks or undeployed mainnet blocks.\n *\n * @param response The inscription response containing metadata and network information\n * @param _mimeType Optional MIME type (currently unused, preserved for compatibility)\n * @returns HCS12BlockResult with network-specific block configuration\n *\n * @example\n * ```typescript\n * // Testnet usage (automatic detection from client)\n * const testnetClient = Client.forTestnet();\n * const tool = new InscribeHashinalTool(testnetClient);\n * const block = await tool.createHashLinkBlock(inscriptionResponse);\n * console.log(block.blockId); // '0.0.6617393'\n * console.log(block.hashLink); // 'hcs://12/0.0.6617393'\n *\n * // Mainnet usage (automatic detection from client)\n * const mainnetClient = Client.forMainnet();\n * const tool = new InscribeHashinalTool(mainnetClient);\n * const block = await tool.createHashLinkBlock(inscriptionResponse);\n * console.log(block.blockId); // Network-specific mainnet block ID\n *\n * // HashLink Block Response Structure:\n * {\n * blockId: string; // Hedera account ID format (e.g., '0.0.6617393')\n * hashLink: string; // HCS-12 URL format: 'hcs://12/{blockId}'\n * template: string; // Block template reference matching blockId\n * attributes: { // Metadata for client-side processing\n * name: string; // Content display name\n * creator: string; // Creator account ID\n * topicId: string; // HCS topic containing the inscription\n * hrl: string; // Hedera Resource Locator\n * network: string; // Network type: 'testnet' | 'mainnet'\n * }\n * }\n *\n * // Render function usage in HashLink blocks:\n * // The block's JavaScript render function receives this structure\n * // and can access network-specific resources through attributes.network\n * ```\n */\n private async createHashLinkBlock(\n response: ReturnType<typeof createInscriptionSuccess>,\n _mimeType?: string\n ): Promise<HCS12BlockResult> {\n const clientNetwork = this.inscriberBuilder['hederaKit'].client.network\n .toString()\n .includes('mainnet')\n ? 'mainnet'\n : 'testnet';\n\n const cdnNetwork = response.inscription.cdnUrl?.includes('mainnet')\n ? 'mainnet'\n : 'testnet';\n\n if (clientNetwork !== cdnNetwork) {\n const logger = new Logger({ module: 'InscribeHashinalTool' });\n logger.warn(\n `Network mismatch detected: client=${clientNetwork}, cdn=${cdnNetwork}. Using client network.`\n );\n }\n\n const network = clientNetwork;\n const config = getHashLinkBlockId(network);\n\n return {\n blockId: config.blockId,\n hashLink: config.hashLink,\n template: config.template,\n attributes: {\n name: response.metadata.name || 'Untitled Content',\n creator: response.metadata.creator || '',\n topicId: response.inscription.topicId,\n hrl: response.inscription.hrl,\n network: network,\n },\n };\n }\n\n private async resolveContent(\n input: string,\n providedMimeType?: string,\n providedFileName?: string\n ): Promise<{\n buffer: Buffer;\n mimeType?: string;\n fileName?: string;\n wasReference?: boolean;\n }> {\n const trimmedInput = input.trim();\n\n const resolver =\n this.getContentResolver() || ContentResolverRegistry.getResolver();\n\n if (!resolver) {\n return this.handleDirectContent(\n trimmedInput,\n providedMimeType,\n providedFileName\n );\n }\n\n const referenceId = resolver.extractReferenceId(trimmedInput);\n\n if (referenceId) {\n try {\n const resolution = await resolver.resolveReference(referenceId);\n\n return {\n buffer: resolution.content,\n mimeType: resolution.metadata?.mimeType || providedMimeType,\n fileName: resolution.metadata?.fileName || providedFileName,\n wasReference: true,\n };\n } catch (error) {\n const errorMsg =\n error instanceof Error\n ? error.message\n : 'Unknown error resolving reference';\n throw new Error(`Reference resolution failed: ${errorMsg}`);\n }\n }\n\n return this.handleDirectContent(\n trimmedInput,\n providedMimeType,\n providedFileName\n );\n }\n\n private handleDirectContent(\n input: string,\n providedMimeType?: string,\n providedFileName?: string\n ): {\n buffer: Buffer;\n mimeType?: string;\n fileName?: string;\n wasReference?: boolean;\n } {\n const isValidBase64 = /^[A-Za-z0-9+/]*={0,2}$/.test(input);\n\n if (isValidBase64) {\n try {\n const buffer = Buffer.from(input, 'base64');\n return {\n buffer,\n mimeType: providedMimeType,\n fileName: providedFileName,\n wasReference: false,\n };\n } catch (error) {\n throw new Error(\n 'Failed to decode base64 data. Please ensure the data is properly encoded.'\n );\n }\n }\n\n const buffer = Buffer.from(input, 'utf8');\n return {\n buffer,\n mimeType: providedMimeType || 'text/plain',\n fileName: providedFileName,\n wasReference: false,\n };\n }\n\n /**\n * Implementation of FormValidatable interface\n * Returns essential fields that should always be shown in forms\n */\n getEssentialFields(): string[] {\n return ['name', 'description', 'creator', 'attributes'];\n }\n\n /**\n * Implementation of FormValidatable interface\n * Determines if a field value should be considered empty for this tool\n */\n isFieldEmpty(fieldName: string, value: unknown): boolean {\n if (value === undefined || value === null || value === '') {\n return true;\n }\n\n if (Array.isArray(value) && value.length === 0) {\n return true;\n }\n\n if (fieldName === 'attributes' && Array.isArray(value)) {\n return value.every(\n (attr) =>\n !attr ||\n (typeof attr === 'object' && (!attr.trait_type || !attr.value))\n );\n }\n\n return false;\n }\n}\n"],"names":["buffer"],"mappings":";;;;;;;;AA6BA,MAAM,wBAAwB;AAAA,EAC5B,SAAS;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U;AAAA,MACV,cAAc;AAAA,IAAA;AAAA,EAElB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,qBAA+B;AAC7B,WAAO,CAAC,QAAQ,eAAe,WAAW,YAAY;AAAA,EACxD;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,aAAa,WAAmB,OAAyB;AACvD,QAAI,UAAU,UAAa,UAAU,QAAQ,UAAU,IAAI;AACzD,aAAO;AAAA,IACT;AAEA,QAAI,MAAM,QAAQ,KAAK,KAAK,MAAM,WAAW,GAAG;AAC9C,aAAO;AAAA,IACT;AAEA,QAAI,cAAc,gBAAgB,MAAM,QAAQ,KAAK,GAAG;AACtD,aAAO,MAAM;AAAA,QACX,CAAC,SACC,CAAC,QACA,OAAO,SAAS,aAAa,CAAC,KAAK,cAAc,CAAC,KAAK;AAAA,MAAA;AAAA,IAE9D;AAEA,WAAO;AAAA,EACT;AACF;"}
|
|
1
|
+
{"version":3,"file":"standards-agent-kit.es37.js","sources":["../../src/tools/inscriber/InscribeHashinalTool.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { z } from 'zod';\nimport { BaseInscriberQueryTool } from './base-inscriber-tools';\nimport {\n InscriptionOptions,\n InscriptionInput,\n ContentResolverRegistry,\n Logger,\n} from '@hashgraphonline/standards-sdk';\nimport { CallbackManagerForToolRun } from '@langchain/core/callbacks/manager';\nimport { validateHIP412Metadata } from '../../validation/hip412-schemas';\nimport { contentRefSchema } from '../../validation/content-ref-schemas';\nimport { generateDefaultMetadata } from '../../utils/metadata-defaults';\nimport {\n extendZodSchema,\n renderConfigs,\n} from '../../lib/zod-render/schema-extension';\nimport {\n createInscriptionSuccess,\n createInscriptionQuote,\n createInscriptionError,\n InscriptionResponse,\n} from '../../types/inscription-response';\nimport { FormValidatable } from '../../interfaces/FormValidatable';\n\n/**\n * Network-specific Hashinal block configuration for HashLink blocks\n */\nconst HASHLINK_BLOCK_CONFIG = {\n testnet: {\n blockId: '0.0.6617393',\n hashLink: 'hcs://12/0.0.6617393',\n template: '0.0.6617393',\n },\n mainnet: {\n blockId: '0.0.TBD',\n hashLink: 'hcs://12/0.0.TBD',\n template: '0.0.TBD',\n },\n};\n\n/**\n * Gets the appropriate HashLink block configuration for the specified network.\n * Provides graceful fallback to testnet for unknown networks or undeployed mainnet blocks.\n *\n * @param network The network type to get configuration for\n * @returns Network-specific block configuration with blockId, hashLink, and template\n */\n// @ts-ignore - keep untyped to satisfy mixed parser while using runtime narrowing\nfunction getHashLinkBlockId(network) {\n const config =\n network === 'mainnet'\n ? HASHLINK_BLOCK_CONFIG.mainnet\n : HASHLINK_BLOCK_CONFIG.testnet;\n if (!config || config.blockId === '0.0.TBD') {\n return HASHLINK_BLOCK_CONFIG.testnet;\n }\n return config;\n}\n\n// Note: Using inline return type annotations to avoid parser issues with interface declarations\n\n/**\n * Schema for inscribing Hashinal NFT\n */\nconst inscribeHashinalSchema = extendZodSchema(\n z.object({\n url: z\n .string()\n .optional()\n .describe(\n 'The URL of the content to inscribe as Hashinal NFT (use this OR contentRef)'\n ),\n contentRef: contentRefSchema\n .optional()\n .describe(\n 'Content reference ID in format \"content-ref:[id]\" for already stored content (use this OR url)'\n ),\n base64Data: z\n .string()\n .optional()\n .describe(\n 'Base64 encoded content data (use this if neither url nor contentRef provided)'\n ),\n fileName: z\n .string()\n .optional()\n .describe(\n 'File name for the content (required when using base64Data or contentRef)'\n ),\n mimeType: z\n .string()\n .optional()\n .describe('MIME type of the content (e.g., \"image/png\", \"image/jpeg\")'),\n name: z\n .string()\n .optional()\n .describe(\n 'Display name for the NFT (e.g., \"Sunset Landscape #42\", \"Digital Abstract Art\")'\n ),\n creator: z\n .string()\n .optional()\n .describe(\n 'Creator account ID, artist name, or brand (e.g., \"0.0.123456\", \"ArtistName\", \"StudioBrand\")'\n ),\n description: z\n .string()\n .optional()\n .describe(\n 'Meaningful description of the artwork, story, or concept behind this NFT'\n ),\n type: z\n .string()\n .optional()\n .describe(\n 'Category or genre of the NFT (e.g., \"Digital Art\", \"Photography\", \"Collectible Card\")'\n ),\n attributes: extendZodSchema(\n z.array(\n z.object({\n trait_type: z.string(),\n value: z.union([z.string(), z.number()]),\n })\n )\n )\n .withRender(renderConfigs.array('NFT Attributes', 'Attribute'))\n .optional()\n .describe(\n 'Collectible traits and characteristics (e.g., \"Rarity\": \"Epic\", \"Color\": \"Blue\", \"Style\": \"Abstract\")'\n ),\n properties: z\n .record(z.unknown())\n .optional()\n .describe('Additional properties'),\n jsonFileURL: z\n .string()\n .url()\n .optional()\n .describe('URL to JSON metadata file'),\n fileStandard: z\n .enum(['1', '6'])\n .optional()\n .default('1')\n .describe(\n 'HCS file standard: 1 for static Hashinals (HCS-5), 6 for dynamic Hashinals (HCS-6)'\n ),\n tags: z.array(z.string()).optional().describe('Tags to categorize the NFT'),\n chunkSize: z\n .number()\n .int()\n .positive()\n .optional()\n .describe('Chunk size for large files'),\n waitForConfirmation: z\n .boolean()\n .optional()\n .describe('Whether to wait for inscription confirmation'),\n timeoutMs: z\n .number()\n .int()\n .positive()\n .optional()\n .describe(\n 'Timeout in milliseconds for inscription (default: no timeout - waits until completion)'\n ),\n quoteOnly: z\n .boolean()\n .optional()\n .default(false)\n .describe(\n 'If true, returns a cost quote instead of executing the inscription'\n ),\n withHashLinkBlocks: z\n .boolean()\n .optional()\n .default(true)\n .describe(\n 'If true, creates interactive HashLink blocks for the inscribed content and returns block data alongside the inscription response'\n ),\n renderForm: z\n .boolean()\n .optional()\n .default(true)\n .describe(\n 'Whether to show a form to collect metadata. Set to false only if user provided complete metadata including name, description, creator, and attributes.'\n ),\n })\n).withRender({\n fieldType: 'object',\n ui: {\n label: 'Inscribe Hashinal NFT',\n description: 'Create a Hashinal inscription for NFT minting',\n },\n});\n\n/**\n * Tool for inscribing Hashinal NFTs\n */\nexport class InscribeHashinalTool\n extends BaseInscriberQueryTool\n implements FormValidatable\n{\n name = 'inscribeHashinal';\n description =\n 'Tool for inscribing Hashinal NFTs. CRITICAL: When user provides content (url/contentRef/base64Data), call with ONLY the content parameters - DO NOT auto-generate name, description, creator, or attributes. A form will be automatically shown to collect metadata from the user. Only include metadata parameters if the user explicitly provided them in their message.';\n\n // Declare entity resolution preferences to preserve user-specified literal fields\n getEntityResolutionPreferences(): Record<string, string> {\n return {\n name: 'literal',\n description: 'literal',\n creator: 'literal',\n attributes: 'literal',\n properties: 'literal',\n };\n }\n\n get specificInputSchema(): z.ZodObject<z.ZodRawShape> {\n const baseSchema =\n (inscribeHashinalSchema as z.ZodType & { _def?: { schema?: z.ZodType } })\n ._def?.schema || inscribeHashinalSchema;\n return baseSchema as z.ZodObject<z.ZodRawShape>;\n }\n\n private _schemaWithRenderConfig?: z.ZodObject<z.ZodRawShape>;\n\n override get schema(): z.ZodObject<z.ZodRawShape> {\n if (!this._schemaWithRenderConfig) {\n const baseSchema = this.specificInputSchema;\n const schemaWithRender = baseSchema as z.ZodObject<z.ZodRawShape> & {\n _renderConfig?: {\n fieldType: string;\n ui: { label: string; description: string };\n };\n };\n\n if (!schemaWithRender._renderConfig) {\n schemaWithRender._renderConfig = {\n fieldType: 'object',\n ui: {\n label: 'Inscribe Hashinal NFT',\n description: 'Create a Hashinal inscription for NFT minting',\n },\n };\n }\n this._schemaWithRenderConfig = baseSchema;\n }\n return this._schemaWithRenderConfig;\n }\n\n /**\n * Implementation of FormValidatable interface\n * Determines if a form should be generated for the given input\n */\n shouldGenerateForm(input: unknown): boolean {\n const logger = new Logger({ module: 'InscribeHashinalTool' });\n const inputObj = input as Record<string, unknown>;\n\n logger.info('InscribeHashinalTool: Checking if form should be generated', {\n inputKeys: Object.keys(inputObj || {}),\n hasContent: !!(\n inputObj.url ||\n inputObj.contentRef ||\n inputObj.base64Data\n ),\n renderFormProvided: 'renderForm' in inputObj,\n renderFormValue: inputObj.renderForm,\n });\n\n const hasContentSource = !!(\n inputObj.url ||\n inputObj.contentRef ||\n inputObj.base64Data\n );\n\n if (!hasContentSource) {\n logger.info('InscribeHashinalTool: No content source provided');\n return false;\n }\n\n if ('renderForm' in inputObj && inputObj.renderForm === false) {\n logger.info(\n 'InscribeHashinalTool: renderForm=false, skipping form generation'\n );\n return false;\n }\n\n const isNonEmptyString = (v: unknown): v is string => {\n if (typeof v !== 'string') {\n return false;\n }\n if (v.trim().length === 0) {\n return false;\n }\n return true;\n };\n\n const hasRequiredMetadata =\n isNonEmptyString(inputObj.name) &&\n isNonEmptyString(inputObj.description) &&\n isNonEmptyString(inputObj.creator);\n\n if (hasRequiredMetadata) {\n logger.info(\n 'InscribeHashinalTool: Required metadata present, skipping form generation'\n );\n return false;\n }\n\n logger.info(\n 'InscribeHashinalTool: Content provided, showing form for metadata collection'\n );\n return true;\n }\n\n /**\n * Implementation of FormValidatable interface\n * Returns the focused schema for form generation\n */\n getFormSchema(): z.ZodObject<z.ZodRawShape> {\n const focusedSchema = extendZodSchema(\n z.object({\n name: z\n .string()\n .min(1, 'Name is required')\n .describe(\n 'Display name for the NFT (e.g., \"Sunset Landscape #42\", \"Digital Abstract Art\")'\n ),\n\n description: z\n .string()\n .min(1, 'Description is required')\n .describe(\n 'Meaningful description of the artwork, story, or concept behind this NFT'\n ),\n\n creator: z\n .string()\n .min(1, 'Creator is required')\n .describe(\n 'Creator account ID, artist name, or brand (e.g., \"0.0.123456\", \"ArtistName\", \"StudioBrand\")'\n ),\n\n attributes: extendZodSchema(\n z.array(\n z.object({\n trait_type: z\n .string()\n .describe('Trait name (e.g., \"Rarity\", \"Color\", \"Style\")'),\n value: z\n .union([z.string(), z.number()])\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n .describe('Trait value (e.g., \"Epic\", \"Blue\", 85)'),\n })\n )\n )\n .withRender(renderConfigs.array('NFT Attributes', 'Attribute'))\n .optional()\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n .describe('Collectible traits and characteristics.'),\n\n type: z\n .string()\n .optional()\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n .describe(\n 'Category or genre of the NFT (e.g., \"Digital Art\", \"Photography\", \"Collectible Card)'\n ),\n })\n ).withRender({\n fieldType: 'object',\n ui: {\n label: 'Complete NFT Metadata',\n description: 'Provide meaningful metadata to create a valuable NFT',\n },\n });\n\n return focusedSchema as unknown as z.ZodObject<z.ZodRawShape>;\n }\n\n protected async executeQuery(\n params: z.infer<typeof inscribeHashinalSchema>,\n _runManager?: CallbackManagerForToolRun\n ): Promise<InscriptionResponse> {\n if (!params.url && !params.contentRef && !params.base64Data) {\n return createInscriptionError({\n code: 'MISSING_CONTENT',\n details: 'No content source provided',\n suggestions: [\n 'Provide a URL to content you want to inscribe',\n 'Upload a file and use the content reference',\n 'Provide base64-encoded content data',\n ],\n });\n }\n\n const operatorAccount =\n this.inscriberBuilder[\n 'hederaKit'\n ]?.client?.operatorAccountId?.toString() || '0.0.unknown';\n\n const rawMetadata = {\n ...generateDefaultMetadata({\n name: params.name,\n creator: params.creator,\n description: params.description,\n type: params.type,\n fileName: params.fileName,\n mimeType: params.mimeType,\n operatorAccount,\n }),\n attributes: Array.isArray(params.attributes) ? params.attributes : [],\n properties:\n (params.properties as Record<string, unknown> | undefined) || {},\n };\n\n let validatedMetadata;\n try {\n validatedMetadata = validateHIP412Metadata(rawMetadata);\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : String(error);\n return createInscriptionError({\n code: 'METADATA_VALIDATION_FAILED',\n details: `Metadata validation error: ${errorMessage}`,\n suggestions: [\n 'Ensure all required metadata fields are provided',\n 'Check that attribute values are valid',\n 'Verify metadata follows HIP-412 standard',\n ],\n });\n }\n\n const options: InscriptionOptions = {\n mode: 'hashinal',\n metadata: validatedMetadata,\n jsonFileURL: params.jsonFileURL,\n fileStandard: params.fileStandard,\n tags: params.tags,\n chunkSize: params.chunkSize,\n waitForConfirmation: params.quoteOnly\n ? false\n : params.waitForConfirmation ?? true,\n waitMaxAttempts: 60,\n waitIntervalMs: 5000,\n network: this.inscriberBuilder['hederaKit'].client.network\n .toString()\n .includes('mainnet')\n ? 'mainnet'\n : 'testnet',\n quoteOnly: params.quoteOnly,\n };\n\n let inscriptionData: InscriptionInput;\n\n if (params.url) {\n inscriptionData = { type: 'url', url: params.url };\n } else if (params.contentRef || params.base64Data) {\n const inputData = params.contentRef || params.base64Data || '';\n const { buffer, mimeType, fileName } = await this.resolveContent(\n inputData,\n params.mimeType,\n params.fileName\n );\n\n inscriptionData = {\n type: 'buffer' as const,\n buffer,\n fileName: fileName || params.fileName || 'hashinal-content',\n mimeType: mimeType || params.mimeType,\n };\n } else {\n throw new Error('No valid input data provided for inscription');\n }\n\n if (params.quoteOnly) {\n try {\n const quote = await this.generateInscriptionQuote(\n inscriptionData,\n options\n );\n\n return createInscriptionQuote({\n totalCostHbar: quote.totalCostHbar,\n validUntil: quote.validUntil,\n breakdown: quote.breakdown,\n content: {\n name: params.name,\n creator: params.creator,\n type: params.type,\n },\n });\n } catch (error) {\n const errorMessage =\n error instanceof Error\n ? error.message\n : 'Failed to generate inscription quote';\n return createInscriptionError({\n code: 'QUOTE_GENERATION_FAILED',\n details: `Quote generation failed: ${errorMessage}`,\n suggestions: [\n 'Check network connectivity',\n 'Verify content is accessible',\n 'Try again in a moment',\n ],\n });\n }\n }\n\n try {\n let result: Awaited<ReturnType<typeof this.inscriberBuilder.inscribe>>;\n\n if (params.timeoutMs) {\n const timeoutPromise = new Promise<never>((_, reject) => {\n setTimeout(\n () =>\n reject(\n new Error(`Inscription timed out after ${params.timeoutMs}ms`)\n ),\n params.timeoutMs\n );\n });\n\n result = await Promise.race([\n this.inscriberBuilder.inscribe(inscriptionData, options),\n timeoutPromise,\n ]);\n } else {\n result = await this.inscriberBuilder.inscribe(inscriptionData, options);\n }\n\n if (result.confirmed && !result.quote) {\n const imageTopicId = (\n result.inscription as { topic_id?: string; jsonTopicId?: string }\n )?.topic_id;\n const jsonTopicId = (\n result.inscription as { topic_id?: string; jsonTopicId?: string }\n )?.jsonTopicId;\n const network = options.network || 'testnet';\n\n const cdnUrl = jsonTopicId\n ? `https://kiloscribe.com/api/inscription-cdn/${jsonTopicId}?network=${network}`\n : null;\n\n const fileStandard = params.fileStandard || '1';\n const hrl = jsonTopicId ? `hcs://${fileStandard}/${jsonTopicId}` : null;\n const standardType = fileStandard === '6' ? 'Dynamic' : 'Static';\n\n if (!hrl) {\n return createInscriptionError({\n code: 'MISSING_TOPIC_ID',\n details: 'Inscription completed but topic ID is missing',\n suggestions: [\n 'Try the inscription again',\n 'Contact support if the issue persists',\n ],\n });\n }\n\n const inscriptionResponse = createInscriptionSuccess({\n hrl,\n topicId: jsonTopicId || imageTopicId || 'unknown',\n standard: standardType as 'Static' | 'Dynamic',\n cdnUrl: cdnUrl || undefined,\n transactionId: (result.result as { transactionId?: string })\n ?.transactionId,\n metadata: {\n name: params.name,\n creator: params.creator,\n description: params.description,\n type: params.type,\n attributes: params.attributes,\n },\n });\n\n this.onEntityCreated?.({\n entityId: jsonTopicId || imageTopicId || 'unknown',\n entityName: params.name || 'Unnamed Inscription',\n entityType: 'topicId',\n transactionId: (result.result as { transactionId?: string })\n ?.transactionId,\n });\n\n if (params.withHashLinkBlocks) {\n try {\n const blockData = await this.createHashLinkBlock(\n inscriptionResponse,\n inscriptionData.type === 'buffer'\n ? inscriptionData.mimeType\n : undefined\n );\n\n inscriptionResponse.hashLinkBlock = blockData;\n } catch (blockError) {\n // Log error but don't fail the inscription\n const logger = new Logger({ module: 'InscribeHashinalTool' });\n logger.error('Failed to create HashLink block', {\n error: blockError,\n });\n }\n }\n\n return inscriptionResponse;\n } else if (!result.quote && !result.confirmed) {\n const imageTopicId = (\n result.inscription as { topic_id?: string; jsonTopicId?: string }\n )?.topic_id;\n const jsonTopicId = (\n result.inscription as { topic_id?: string; jsonTopicId?: string }\n )?.jsonTopicId;\n\n if (jsonTopicId || imageTopicId) {\n const network = options.network || 'testnet';\n const cdnUrl = jsonTopicId\n ? `https://kiloscribe.com/api/inscription-cdn/${jsonTopicId}?network=${network}`\n : null;\n\n const fileStandard = params.fileStandard || '1';\n const hrl = jsonTopicId\n ? `hcs://${fileStandard}/${jsonTopicId}`\n : null;\n const standardType = fileStandard === '6' ? 'Dynamic' : 'Static';\n\n if (hrl) {\n const inscriptionResponse = createInscriptionSuccess({\n hrl,\n topicId: jsonTopicId || imageTopicId || 'unknown',\n standard: standardType as 'Static' | 'Dynamic',\n cdnUrl: cdnUrl || undefined,\n transactionId: (result.result as { transactionId?: string })\n ?.transactionId,\n metadata: {\n name: params.name,\n creator: params.creator,\n description: params.description,\n type: params.type,\n attributes: params.attributes,\n },\n });\n\n this.onEntityCreated?.({\n entityId: jsonTopicId || imageTopicId || 'unknown',\n entityName: params.name || 'Unnamed Inscription',\n entityType: 'topicId',\n transactionId: (result.result as { transactionId?: string })\n ?.transactionId,\n });\n\n if (params.withHashLinkBlocks) {\n try {\n const blockData = await this.createHashLinkBlock(\n inscriptionResponse,\n inscriptionData.type === 'buffer'\n ? inscriptionData.mimeType\n : undefined\n );\n\n inscriptionResponse.hashLinkBlock = blockData;\n } catch (blockError) {\n // Log error but don't fail the inscription\n const logger = new Logger({ module: 'InscribeHashinalTool' });\n logger.error('Failed to create HashLink block', {\n error: blockError,\n });\n }\n }\n\n return inscriptionResponse;\n }\n }\n\n const transactionId =\n (result.result as { transactionId?: string })?.transactionId ||\n 'unknown';\n return createInscriptionError({\n code: 'INSCRIPTION_PENDING',\n details: `Inscription submitted but not yet confirmed. Transaction ID: ${transactionId}`,\n suggestions: [\n 'Wait a few moments for confirmation',\n 'Check the transaction status on a Hedera explorer',\n \"Try the inscription again if it doesn't confirm within 5 minutes\",\n ],\n });\n } else {\n return createInscriptionError({\n code: 'UNKNOWN_STATE',\n details: 'Inscription completed but result state is unclear',\n suggestions: [\n 'Check if the inscription was successful manually',\n 'Try the inscription again',\n ],\n });\n }\n } catch (error) {\n const errorMessage =\n error instanceof Error\n ? error.message\n : 'Failed to inscribe Hashinal NFT';\n return createInscriptionError({\n code: 'INSCRIPTION_FAILED',\n details: `Inscription failed: ${errorMessage}`,\n suggestions: [\n 'Check network connectivity',\n 'Verify you have sufficient HBAR balance',\n 'Ensure content is accessible and valid',\n 'Try again in a moment',\n ],\n });\n }\n }\n\n /**\n * Creates HashLink block configuration for Hashinal inscriptions.\n * Automatically detects network and selects appropriate block ID configuration.\n * Uses testnet block as fallback for unknown networks or undeployed mainnet blocks.\n *\n * @param response The inscription response containing metadata and network information\n * @param _mimeType Optional MIME type (currently unused, preserved for compatibility)\n * @returns HCS12BlockResult with network-specific block configuration\n *\n * @example\n * ```typescript\n * // Testnet usage (automatic detection from client)\n * const testnetClient = Client.forTestnet();\n * const tool = new InscribeHashinalTool(testnetClient);\n * const block = await tool.createHashLinkBlock(inscriptionResponse);\n * console.log(block.blockId); // '0.0.6617393'\n * console.log(block.hashLink); // 'hcs://12/0.0.6617393'\n *\n * // Mainnet usage (automatic detection from client)\n * const mainnetClient = Client.forMainnet();\n * const tool = new InscribeHashinalTool(mainnetClient);\n * const block = await tool.createHashLinkBlock(inscriptionResponse);\n * console.log(block.blockId); // Network-specific mainnet block ID\n *\n * // HashLink Block Response Structure:\n * {\n * blockId: string; // Hedera account ID format (e.g., '0.0.6617393')\n * hashLink: string; // HCS-12 URL format: 'hcs://12/{blockId}'\n * template: string; // Block template reference matching blockId\n * attributes: { // Metadata for client-side processing\n * name: string; // Content display name\n * creator: string; // Creator account ID\n * topicId: string; // HCS topic containing the inscription\n * hrl: string; // Hedera Resource Locator\n * network: string; // Network type: 'testnet' | 'mainnet'\n * }\n * }\n *\n * // Render function usage in HashLink blocks:\n * // The block's JavaScript render function receives this structure\n * // and can access network-specific resources through attributes.network\n * ```\n */\n private async createHashLinkBlock(\n response: ReturnType<typeof createInscriptionSuccess>,\n _mimeType?: string\n ): Promise<{\n blockId: string;\n hashLink: string;\n template: string;\n attributes: Record<string, unknown>;\n }> {\n const clientNetwork = this.inscriberBuilder['hederaKit'].client.network\n .toString()\n .includes('mainnet')\n ? 'mainnet'\n : 'testnet';\n\n const cdnNetwork = response.inscription.cdnUrl?.includes('mainnet')\n ? 'mainnet'\n : 'testnet';\n\n if (clientNetwork !== cdnNetwork) {\n const logger = new Logger({ module: 'InscribeHashinalTool' });\n logger.warn(\n `Network mismatch detected: client=${clientNetwork}, cdn=${cdnNetwork}. Using client network.`\n );\n }\n\n const network = clientNetwork;\n const config = getHashLinkBlockId(network);\n\n return {\n blockId: config.blockId,\n hashLink: config.hashLink,\n template: config.template,\n attributes: {\n name: response.metadata.name || 'Untitled Content',\n creator: response.metadata.creator || '',\n topicId: response.inscription.topicId,\n hrl: response.inscription.hrl,\n network: network,\n },\n };\n }\n\n private async resolveContent(\n input: string,\n providedMimeType?: string,\n providedFileName?: string\n ): Promise<{\n buffer: Buffer;\n mimeType?: string;\n fileName?: string;\n wasReference?: boolean;\n }> {\n const trimmedInput = input.trim();\n\n const resolver =\n this.getContentResolver() || ContentResolverRegistry.getResolver();\n\n if (!resolver) {\n return this.handleDirectContent(\n trimmedInput,\n providedMimeType,\n providedFileName\n );\n }\n\n const referenceId = resolver.extractReferenceId(trimmedInput);\n\n if (referenceId) {\n try {\n const resolution = await resolver.resolveReference(referenceId);\n\n return {\n buffer: resolution.content,\n mimeType: resolution.metadata?.mimeType || providedMimeType,\n fileName: resolution.metadata?.fileName || providedFileName,\n wasReference: true,\n };\n } catch (error) {\n const errorMsg =\n error instanceof Error\n ? error.message\n : 'Unknown error resolving reference';\n throw new Error(`Reference resolution failed: ${errorMsg}`);\n }\n }\n\n return this.handleDirectContent(\n trimmedInput,\n providedMimeType,\n providedFileName\n );\n }\n\n private handleDirectContent(\n input: string,\n providedMimeType?: string,\n providedFileName?: string\n ): {\n buffer: Buffer;\n mimeType?: string;\n fileName?: string;\n wasReference?: boolean;\n } {\n const isValidBase64 = /^[A-Za-z0-9+/]*={0,2}$/.test(input);\n\n if (isValidBase64) {\n try {\n const buffer = Buffer.from(input, 'base64');\n return {\n buffer,\n mimeType: providedMimeType,\n fileName: providedFileName,\n wasReference: false,\n };\n } catch (error) {\n throw new Error(\n 'Failed to decode base64 data. Please ensure the data is properly encoded.'\n );\n }\n }\n\n const buffer = Buffer.from(input, 'utf8');\n return {\n buffer,\n mimeType: providedMimeType || 'text/plain',\n fileName: providedFileName,\n wasReference: false,\n };\n }\n\n /**\n * Implementation of FormValidatable interface\n * Returns essential fields that should always be shown in forms\n */\n getEssentialFields(): string[] {\n return ['name', 'description', 'creator', 'attributes'];\n }\n\n /**\n * Implementation of FormValidatable interface\n * Determines if a field value should be considered empty for this tool\n */\n isFieldEmpty(fieldName: string, value: unknown): boolean {\n if (value === undefined || value === null || value === '') {\n return true;\n }\n\n if (Array.isArray(value) && value.length === 0) {\n return true;\n }\n\n if (fieldName === 'attributes' && Array.isArray(value)) {\n return value.every(\n (attr) =>\n !attr ||\n (typeof attr === 'object' && (!attr.trait_type || !attr.value))\n );\n }\n\n return false;\n }\n}\n"],"names":["buffer"],"mappings":";;;;;;;;AA4BA,MAAM,wBAAwB;AAAA,EAC5B,SAAS;AAAA,IACP,SAAS;AAAA,IACT,UAAU;AAAA,IACV,UAAU;AAAA,EAAA;AAAA,EAEZ,SAAS;AAAA,IACP,SAAS;AAAA,IACT,UAAU;AAAA,IACV,UAAU;AAAA,EAAA;AAEd;AAUA,SAAS,mBAAmB,SAAS;AACnC,QAAM,SACJ,YAAY,YACR,sBAAsB,UACtB,sBAAsB;AAC5B,MAAI,CAAC,UAAU,OAAO,YAAY,WAAW;AAC3C,WAAO,sBAAsB;AAAA,EAC/B;AACA,SAAO;AACT;AAOA,MAAM,yBAAyB;AAAA,EAC7B,EAAE,OAAO;AAAA,IACP,KAAK,EACF,SACA,WACA;AAAA,MACC;AAAA,IAAA;AAAA,IAEJ,YAAY,iBACT,SAAA,EACA;AAAA,MACC;AAAA,IAAA;AAAA,IAEJ,YAAY,EACT,SACA,WACA;AAAA,MACC;AAAA,IAAA;AAAA,IAEJ,UAAU,EACP,SACA,WACA;AAAA,MACC;AAAA,IAAA;AAAA,IAEJ,UAAU,EACP,OAAA,EACA,SAAA,EACA,SAAS,4DAA4D;AAAA,IACx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AA,IAE9D;AAEA,WAAO;AAAA,EACT;AACF;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
function isFormValidatable(tool) {
|
|
2
|
-
return tool !== null && typeof tool === "object" && "shouldGenerateForm" in tool && "getFormSchema" in tool && typeof tool.shouldGenerateForm === "function" && typeof tool.getFormSchema === "function";
|
|
2
|
+
return tool !== null && typeof tool === "object" && "shouldGenerateForm" in tool && "getFormSchema" in tool && "getEssentialFields" in tool && "isFieldEmpty" in tool && typeof tool.shouldGenerateForm === "function" && typeof tool.getFormSchema === "function" && typeof tool.getEssentialFields === "function" && typeof tool.isFieldEmpty === "function";
|
|
3
3
|
}
|
|
4
4
|
export {
|
|
5
5
|
isFormValidatable
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standards-agent-kit.es44.js","sources":["../../src/interfaces/FormValidatable.ts"],"sourcesContent":["import { z } from 'zod';\n\n/**\n * Interface for tools that can provide custom form validation logic\n */\nexport interface FormValidatable {\n /**\n * Determines if a form should be generated for the given input\n * @param input The input data to validate\n * @returns true if a form should be generated, false if the tool can execute\n */\n shouldGenerateForm(input: unknown): boolean;\n\n /**\n * Returns the schema to use for form generation\n * This allows tools to provide a focused schema for forms\n * @returns The schema to use for generating forms\n */\n getFormSchema(): z.ZodSchema;\n\n /**\n *
|
|
1
|
+
{"version":3,"file":"standards-agent-kit.es44.js","sources":["../../src/interfaces/FormValidatable.ts"],"sourcesContent":["import { z } from 'zod';\n\n/**\n * Interface for tools that can provide custom form validation logic\n */\nexport interface FormValidatable {\n /**\n * Determines if a form should be generated for the given input\n * @param input The input data to validate\n * @returns true if a form should be generated, false if the tool can execute\n */\n shouldGenerateForm(input: unknown): boolean;\n\n /**\n * Returns the schema to use for form generation\n * This allows tools to provide a focused schema for forms\n * @returns The schema to use for generating forms\n */\n getFormSchema(): z.ZodSchema;\n\n /**\n * Defines which fields are essential for this tool\n * Essential fields are always shown in forms even if marked as optional\n * @returns Array of field names that are essential for user experience\n */\n getEssentialFields(): string[];\n\n /**\n * Determines if a field value should be considered empty\n * Allows tools to define custom empty logic for their specific data types\n * @param fieldName The name of the field\n * @param value The value to check\n * @returns true if the field should be considered empty\n */\n isFieldEmpty(fieldName: string, value: unknown): boolean;\n}\n\n/**\n * Type guard to check if a tool implements FormValidatable\n */\nexport function isFormValidatable(tool: unknown): tool is FormValidatable {\n return (\n tool !== null &&\n typeof tool === 'object' &&\n 'shouldGenerateForm' in tool &&\n 'getFormSchema' in tool &&\n 'getEssentialFields' in tool &&\n 'isFieldEmpty' in tool &&\n typeof (tool as FormValidatable).shouldGenerateForm === 'function' &&\n typeof (tool as FormValidatable).getFormSchema === 'function' &&\n typeof (tool as FormValidatable).getEssentialFields === 'function' &&\n typeof (tool as FormValidatable).isFieldEmpty === 'function'\n );\n}"],"names":[],"mappings":"AAwCO,SAAS,kBAAkB,MAAwC;AACxE,SACE,SAAS,QACT,OAAO,SAAS,YAChB,wBAAwB,QACxB,mBAAmB,QACnB,wBAAwB,QACxB,kBAAkB,QAClB,OAAQ,KAAyB,uBAAuB,cACxD,OAAQ,KAAyB,kBAAkB,cACnD,OAAQ,KAAyB,uBAAuB,cACxD,OAAQ,KAAyB,iBAAiB;AAEtD;"}
|
|
@@ -14,8 +14,8 @@ function createInscriptionSuccess(params) {
|
|
|
14
14
|
},
|
|
15
15
|
metadata,
|
|
16
16
|
nextSteps: {
|
|
17
|
-
primary: "
|
|
18
|
-
context:
|
|
17
|
+
primary: "CRITICAL: When minting NFTs, use ONLY the mintingMetadata value as a single string in the metadata array. Do NOT create JSON objects.",
|
|
18
|
+
context: 'The metadata parameter for minting should be exactly: ["' + hrl + '"] - just the HRL string in an array, nothing else.',
|
|
19
19
|
mintingMetadata: hrl
|
|
20
20
|
}
|
|
21
21
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standards-agent-kit.es51.js","sources":["../../src/types/inscription-response.ts"],"sourcesContent":["/**\n * Structured response interface for inscription tools\n * Provides a consistent, user-friendly format for inscription results\n */\n\nexport interface InscriptionSuccessResponse {\n success: true;\n type: 'inscription';\n title: string;\n message: string;\n inscription: {\n /** The HRL (Hashinal Reference Link) for minting - e.g., \"hcs://1/0.0.123456\" */\n hrl: string;\n /** Topic ID where the inscription was stored */\n topicId: string;\n /** Type of Hashinal - Static (HCS-5) or Dynamic (HCS-6) */\n standard: 'Static' | 'Dynamic';\n /** CDN URL for direct access to the inscribed content */\n cdnUrl?: string;\n /** Transaction ID of the inscription */\n transactionId?: string;\n };\n metadata: {\n /** Name/title of the inscribed content */\n name?: string;\n /** Creator of the content */\n creator?: string;\n /** Description of the content */\n description?: string;\n /** Content type (image, text, etc.) */\n type?: string;\n /** Additional attributes */\n attributes?: Array<{ trait_type: string; value: string | number }>;\n };\n nextSteps: {\n /** Primary action the user should take next */\n primary: string;\n /** Additional context or options */\n context?: string;\n /** Specific metadata value to use for minting */\n mintingMetadata: string;\n };\n /** HashLink block data (only present when withHashLinkBlocks=true) */\n hashLinkBlock?: {\n /** Block topic ID on HCS */\n blockId: string;\n /** HashLink reference to the block */\n hashLink: string;\n /** Template topic ID */\n template: string;\n /** Block attributes for rendering */\n attributes: BlockAttributes;\n };\n}\n\nexport interface InscriptionQuoteResponse {\n success: true;\n type: 'quote';\n title: string;\n message: string;\n quote: {\n /** Total cost in HBAR */\n totalCostHbar: string;\n /** When the quote expires */\n validUntil: string;\n /** Cost breakdown details */\n breakdown?: CostBreakdown;\n };\n content: {\n /** Name of the content to be inscribed */\n name?: string;\n /** Creator of the content */\n creator?: string;\n /** Type of content */\n type?: string;\n };\n}\n\nexport interface InscriptionErrorResponse {\n success: false;\n type: 'error';\n title: string;\n message: string;\n error: {\n /** Error code for programmatic handling */\n code: string;\n /** Detailed error message */\n details: string;\n /** Suggestions for fixing the error */\n suggestions?: string[];\n };\n}\n\nexport type InscriptionResponse =\n | InscriptionSuccessResponse\n | InscriptionQuoteResponse\n | InscriptionErrorResponse;\n\n/**\n * Helper function to create a successful inscription response\n */\nexport function createInscriptionSuccess(params: {\n hrl: string;\n topicId: string;\n standard: 'Static' | 'Dynamic';\n cdnUrl?: string;\n transactionId?: string;\n metadata: {\n name?: string;\n creator?: string;\n description?: string;\n type?: string;\n attributes?: Array<{ trait_type: string; value: string | number }>;\n };\n}): InscriptionSuccessResponse {\n const { hrl, topicId, standard, cdnUrl, transactionId, metadata } = params;\n\n return {\n success: true,\n type: 'inscription',\n title: `${standard} Hashinal Inscription Complete`,\n message: `Successfully inscribed \"${\n metadata.name || 'your content'\n }\" as a ${standard} Hashinal. The content is now ready for NFT minting.`,\n inscription: {\n hrl,\n topicId,\n standard,\n cdnUrl,\n transactionId,\n },\n metadata,\n nextSteps: {\n primary: '
|
|
1
|
+
{"version":3,"file":"standards-agent-kit.es51.js","sources":["../../src/types/inscription-response.ts"],"sourcesContent":["/**\n * Structured response interface for inscription tools\n * Provides a consistent, user-friendly format for inscription results\n */\n\nexport interface InscriptionSuccessResponse {\n success: true;\n type: 'inscription';\n title: string;\n message: string;\n inscription: {\n /** The HRL (Hashinal Reference Link) for minting - e.g., \"hcs://1/0.0.123456\" */\n hrl: string;\n /** Topic ID where the inscription was stored */\n topicId: string;\n /** Type of Hashinal - Static (HCS-5) or Dynamic (HCS-6) */\n standard: 'Static' | 'Dynamic';\n /** CDN URL for direct access to the inscribed content */\n cdnUrl?: string;\n /** Transaction ID of the inscription */\n transactionId?: string;\n };\n metadata: {\n /** Name/title of the inscribed content */\n name?: string;\n /** Creator of the content */\n creator?: string;\n /** Description of the content */\n description?: string;\n /** Content type (image, text, etc.) */\n type?: string;\n /** Additional attributes */\n attributes?: Array<{ trait_type: string; value: string | number }>;\n };\n nextSteps: {\n /** Primary action the user should take next */\n primary: string;\n /** Additional context or options */\n context?: string;\n /** Specific metadata value to use for minting */\n mintingMetadata: string;\n };\n /** HashLink block data (only present when withHashLinkBlocks=true) */\n hashLinkBlock?: {\n /** Block topic ID on HCS */\n blockId: string;\n /** HashLink reference to the block */\n hashLink: string;\n /** Template topic ID */\n template: string;\n /** Block attributes for rendering */\n attributes: BlockAttributes;\n };\n}\n\nexport interface InscriptionQuoteResponse {\n success: true;\n type: 'quote';\n title: string;\n message: string;\n quote: {\n /** Total cost in HBAR */\n totalCostHbar: string;\n /** When the quote expires */\n validUntil: string;\n /** Cost breakdown details */\n breakdown?: CostBreakdown;\n };\n content: {\n /** Name of the content to be inscribed */\n name?: string;\n /** Creator of the content */\n creator?: string;\n /** Type of content */\n type?: string;\n };\n}\n\nexport interface InscriptionErrorResponse {\n success: false;\n type: 'error';\n title: string;\n message: string;\n error: {\n /** Error code for programmatic handling */\n code: string;\n /** Detailed error message */\n details: string;\n /** Suggestions for fixing the error */\n suggestions?: string[];\n };\n}\n\nexport type InscriptionResponse =\n | InscriptionSuccessResponse\n | InscriptionQuoteResponse\n | InscriptionErrorResponse;\n\n/**\n * Helper function to create a successful inscription response\n */\nexport function createInscriptionSuccess(params: {\n hrl: string;\n topicId: string;\n standard: 'Static' | 'Dynamic';\n cdnUrl?: string;\n transactionId?: string;\n metadata: {\n name?: string;\n creator?: string;\n description?: string;\n type?: string;\n attributes?: Array<{ trait_type: string; value: string | number }>;\n };\n}): InscriptionSuccessResponse {\n const { hrl, topicId, standard, cdnUrl, transactionId, metadata } = params;\n\n return {\n success: true,\n type: 'inscription',\n title: `${standard} Hashinal Inscription Complete`,\n message: `Successfully inscribed \"${\n metadata.name || 'your content'\n }\" as a ${standard} Hashinal. The content is now ready for NFT minting.`,\n inscription: {\n hrl,\n topicId,\n standard,\n cdnUrl,\n transactionId,\n },\n metadata,\n nextSteps: {\n primary: 'CRITICAL: When minting NFTs, use ONLY the mintingMetadata value as a single string in the metadata array. Do NOT create JSON objects.',\n context:\n 'The metadata parameter for minting should be exactly: [\"' + hrl + '\"] - just the HRL string in an array, nothing else.',\n mintingMetadata: hrl,\n },\n };\n}\n\n/**\n * Block attributes for HashLink rendering\n */\ninterface BlockAttributes {\n /** Display name */\n name?: string;\n /** Description text */\n description?: string;\n /** Image URL */\n image?: string;\n /** Content type */\n contentType?: string;\n /** Size in bytes */\n size?: number;\n /** Custom metadata */\n metadata?: Record<string, string | number | boolean>;\n}\n\n/**\n * Transfer details in cost breakdown\n */\ninterface TransferDetails {\n to: string;\n amount: string;\n description: string;\n}\n\n/**\n * Cost breakdown details for inscription quote\n */\ninterface CostBreakdown {\n transfers: TransferDetails[];\n baseFee?: number;\n sizeFee?: number;\n networkFee?: number;\n serviceFee?: number;\n totalFee?: number;\n currency?: string;\n}\n\n/**\n * Helper function to create a quote response\n */\nexport function createInscriptionQuote(params: {\n totalCostHbar: string;\n validUntil: string;\n breakdown?: CostBreakdown;\n content: {\n name?: string;\n creator?: string;\n type?: string;\n };\n}): InscriptionQuoteResponse {\n const { totalCostHbar, validUntil, breakdown, content } = params;\n\n return {\n success: true,\n type: 'quote',\n title: 'Inscription Cost Quote',\n message: `Estimated cost to inscribe \"${\n content.name || 'your content'\n }\" is ${totalCostHbar} HBAR.`,\n quote: {\n totalCostHbar,\n validUntil,\n breakdown,\n },\n content,\n };\n}\n\n/**\n * Helper function to create an error response\n */\nexport function createInscriptionError(params: {\n code: string;\n details: string;\n suggestions?: string[];\n}): InscriptionErrorResponse {\n const { code, details, suggestions } = params;\n\n return {\n success: false,\n type: 'error',\n title: 'Inscription Failed',\n message: `Unable to complete inscription: ${details}`,\n error: {\n code,\n details,\n suggestions,\n },\n };\n}\n"],"names":[],"mappings":"AAqGO,SAAS,yBAAyB,QAaV;AAC7B,QAAM,EAAE,KAAK,SAAS,UAAU,QAAQ,eAAe,aAAa;AAEpE,SAAO;AAAA,IACL,SAAS;AAAA,IACT,MAAM;AAAA,IACN,OAAO,GAAG,QAAQ;AAAA,IAClB,SAAS,2BACP,SAAS,QAAQ,cACnB,UAAU,QAAQ;AAAA,IAClB,aAAa;AAAA,MACX;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IAAA;AAAA,IAEF;AAAA,IACA,WAAW;AAAA,MACT,SAAS;AAAA,MACT,SACE,6DAA6D,MAAM;AAAA,MACrE,iBAAiB;AAAA,IAAA;AAAA,EACnB;AAEJ;AA6CO,SAAS,uBAAuB,QASV;AAC3B,QAAM,EAAE,eAAe,YAAY,WAAW,YAAY;AAE1D,SAAO;AAAA,IACL,SAAS;AAAA,IACT,MAAM;AAAA,IACN,OAAO;AAAA,IACP,SAAS,+BACP,QAAQ,QAAQ,cAClB,QAAQ,aAAa;AAAA,IACrB,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,IAAA;AAAA,IAEF;AAAA,EAAA;AAEJ;AAKO,SAAS,uBAAuB,QAIV;AAC3B,QAAM,EAAE,MAAM,SAAS,YAAA,IAAgB;AAEvC,SAAO;AAAA,IACL,SAAS;AAAA,IACT,MAAM;AAAA,IACN,OAAO;AAAA,IACP,SAAS,mCAAmC,OAAO;AAAA,IACnD,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,IAAA;AAAA,EACF;AAEJ;"}
|
|
@@ -37,6 +37,7 @@ declare const inscribeHashinalSchema: import('../..').ZodSchemaWithRender<{
|
|
|
37
37
|
export declare class InscribeHashinalTool extends BaseInscriberQueryTool implements FormValidatable {
|
|
38
38
|
name: string;
|
|
39
39
|
description: string;
|
|
40
|
+
getEntityResolutionPreferences(): Record<string, string>;
|
|
40
41
|
get specificInputSchema(): z.ZodObject<z.ZodRawShape>;
|
|
41
42
|
private _schemaWithRenderConfig?;
|
|
42
43
|
get schema(): z.ZodObject<z.ZodRawShape>;
|
|
@@ -50,14 +51,6 @@ export declare class InscribeHashinalTool extends BaseInscriberQueryTool impleme
|
|
|
50
51
|
* Returns the focused schema for form generation
|
|
51
52
|
*/
|
|
52
53
|
getFormSchema(): z.ZodObject<z.ZodRawShape>;
|
|
53
|
-
/**
|
|
54
|
-
* Implementation of FormValidatable interface
|
|
55
|
-
* Validates metadata quality and provides detailed feedback
|
|
56
|
-
*/
|
|
57
|
-
validateMetadataQuality(input: unknown): {
|
|
58
|
-
needsForm: boolean;
|
|
59
|
-
reason: string;
|
|
60
|
-
};
|
|
61
54
|
protected executeQuery(params: z.infer<typeof inscribeHashinalSchema>, _runManager?: CallbackManagerForToolRun): Promise<InscriptionResponse>;
|
|
62
55
|
/**
|
|
63
56
|
* Creates HashLink block configuration for Hashinal inscriptions.
|
|
@@ -4,12 +4,22 @@ import { InscriberTransactionToolParams, InscriberQueryToolParams } from './insc
|
|
|
4
4
|
import { ContentResolverInterface } from '../../types/content-resolver';
|
|
5
5
|
import { InscriptionInput, InscriptionOptions, QuoteResult } from '@hashgraphonline/standards-sdk';
|
|
6
6
|
import { z } from 'zod';
|
|
7
|
+
/**
|
|
8
|
+
* Event emitted when an entity is created during inscription
|
|
9
|
+
*/
|
|
10
|
+
export interface EntityCreationEvent {
|
|
11
|
+
entityId: string;
|
|
12
|
+
entityName: string;
|
|
13
|
+
entityType: string;
|
|
14
|
+
transactionId?: string;
|
|
15
|
+
}
|
|
7
16
|
/**
|
|
8
17
|
* Base class for Inscriber transaction tools
|
|
9
18
|
*/
|
|
10
19
|
export declare abstract class BaseInscriberTransactionTool<T extends z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny> = z.ZodObject<z.ZodRawShape>> extends BaseHederaTransactionTool<T> {
|
|
11
20
|
protected inscriberBuilder: InscriberBuilder;
|
|
12
21
|
protected contentResolver: ContentResolverInterface | null;
|
|
22
|
+
protected onEntityCreated?: (event: EntityCreationEvent) => void;
|
|
13
23
|
namespace: "inscriber";
|
|
14
24
|
constructor(params: InscriberTransactionToolParams);
|
|
15
25
|
/**
|
|
@@ -20,6 +30,10 @@ export declare abstract class BaseInscriberTransactionTool<T extends z.ZodObject
|
|
|
20
30
|
* Get content resolver with fallback to registry
|
|
21
31
|
*/
|
|
22
32
|
protected getContentResolver(): ContentResolverInterface | null;
|
|
33
|
+
/**
|
|
34
|
+
* Set entity creation handler for automatic entity storage
|
|
35
|
+
*/
|
|
36
|
+
setEntityCreationHandler(handler: (event: EntityCreationEvent) => void): void;
|
|
23
37
|
/**
|
|
24
38
|
* Generate a quote for an inscription without executing it
|
|
25
39
|
* @param input - The inscription input data
|
|
@@ -34,6 +48,7 @@ export declare abstract class BaseInscriberTransactionTool<T extends z.ZodObject
|
|
|
34
48
|
export declare abstract class BaseInscriberQueryTool<T extends z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny> = z.ZodObject<z.ZodRawShape>> extends BaseHederaQueryTool<T> {
|
|
35
49
|
protected inscriberBuilder: InscriberBuilder;
|
|
36
50
|
protected contentResolver: ContentResolverInterface | null;
|
|
51
|
+
protected onEntityCreated?: (event: EntityCreationEvent) => void;
|
|
37
52
|
namespace: "inscriber";
|
|
38
53
|
constructor(params: InscriberQueryToolParams);
|
|
39
54
|
/**
|
|
@@ -44,6 +59,10 @@ export declare abstract class BaseInscriberQueryTool<T extends z.ZodObject<z.Zod
|
|
|
44
59
|
* Get content resolver with fallback to registry
|
|
45
60
|
*/
|
|
46
61
|
protected getContentResolver(): ContentResolverInterface | null;
|
|
62
|
+
/**
|
|
63
|
+
* Set entity creation handler for automatic entity storage
|
|
64
|
+
*/
|
|
65
|
+
setEntityCreationHandler(handler: (event: EntityCreationEvent) => void): void;
|
|
47
66
|
/**
|
|
48
67
|
* Generate a quote for an inscription without executing it
|
|
49
68
|
* @param input - The inscription input data
|
|
@@ -16,28 +16,19 @@ export interface FormValidatable {
|
|
|
16
16
|
*/
|
|
17
17
|
getFormSchema(): z.ZodSchema;
|
|
18
18
|
/**
|
|
19
|
-
*
|
|
20
|
-
* @param input The input data to analyze
|
|
21
|
-
* @returns Object indicating if form is needed and the reason
|
|
22
|
-
*/
|
|
23
|
-
validateMetadataQuality?(input: unknown): {
|
|
24
|
-
needsForm: boolean;
|
|
25
|
-
reason: string;
|
|
26
|
-
};
|
|
27
|
-
/**
|
|
28
|
-
* Optional method to define which fields are essential for this tool
|
|
19
|
+
* Defines which fields are essential for this tool
|
|
29
20
|
* Essential fields are always shown in forms even if marked as optional
|
|
30
21
|
* @returns Array of field names that are essential for user experience
|
|
31
22
|
*/
|
|
32
|
-
getEssentialFields
|
|
23
|
+
getEssentialFields(): string[];
|
|
33
24
|
/**
|
|
34
|
-
*
|
|
25
|
+
* Determines if a field value should be considered empty
|
|
35
26
|
* Allows tools to define custom empty logic for their specific data types
|
|
36
27
|
* @param fieldName The name of the field
|
|
37
28
|
* @param value The value to check
|
|
38
29
|
* @returns true if the field should be considered empty
|
|
39
30
|
*/
|
|
40
|
-
isFieldEmpty
|
|
31
|
+
isFieldEmpty(fieldName: string, value: unknown): boolean;
|
|
41
32
|
}
|
|
42
33
|
/**
|
|
43
34
|
* Type guard to check if a tool implements FormValidatable
|