@hashgraphonline/standards-agent-kit 0.2.122 → 0.2.124

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.
Files changed (35) hide show
  1. package/dist/cjs/standards-agent-kit.cjs +1 -1
  2. package/dist/cjs/standards-agent-kit.cjs.map +1 -1
  3. package/dist/cjs/tools/inscriber/InscribeFromBufferTool.d.ts +6 -0
  4. package/dist/cjs/tools/inscriber/InscribeFromFileTool.d.ts +3 -0
  5. package/dist/cjs/tools/inscriber/InscribeFromUrlTool.d.ts +6 -0
  6. package/dist/cjs/tools/inscriber/InscribeHashinalTool.d.ts +6 -0
  7. package/dist/cjs/tools/inscriber/base-inscriber-tools.d.ts +15 -0
  8. package/dist/es/standards-agent-kit.es33.js +44 -0
  9. package/dist/es/standards-agent-kit.es33.js.map +1 -1
  10. package/dist/es/standards-agent-kit.es34.js +34 -6
  11. package/dist/es/standards-agent-kit.es34.js.map +1 -1
  12. package/dist/es/standards-agent-kit.es35.js +65 -14
  13. package/dist/es/standards-agent-kit.es35.js.map +1 -1
  14. package/dist/es/standards-agent-kit.es36.js +42 -6
  15. package/dist/es/standards-agent-kit.es36.js.map +1 -1
  16. package/dist/es/standards-agent-kit.es37.js +38 -6
  17. package/dist/es/standards-agent-kit.es37.js.map +1 -1
  18. package/dist/es/tools/inscriber/InscribeFromBufferTool.d.ts +6 -0
  19. package/dist/es/tools/inscriber/InscribeFromFileTool.d.ts +3 -0
  20. package/dist/es/tools/inscriber/InscribeFromUrlTool.d.ts +6 -0
  21. package/dist/es/tools/inscriber/InscribeHashinalTool.d.ts +6 -0
  22. package/dist/es/tools/inscriber/base-inscriber-tools.d.ts +15 -0
  23. package/dist/umd/standards-agent-kit.umd.js +1 -1
  24. package/dist/umd/standards-agent-kit.umd.js.map +1 -1
  25. package/dist/umd/tools/inscriber/InscribeFromBufferTool.d.ts +6 -0
  26. package/dist/umd/tools/inscriber/InscribeFromFileTool.d.ts +3 -0
  27. package/dist/umd/tools/inscriber/InscribeFromUrlTool.d.ts +6 -0
  28. package/dist/umd/tools/inscriber/InscribeHashinalTool.d.ts +6 -0
  29. package/dist/umd/tools/inscriber/base-inscriber-tools.d.ts +15 -0
  30. package/package.json +3 -2
  31. package/src/tools/inscriber/InscribeFromBufferTool.ts +49 -9
  32. package/src/tools/inscriber/InscribeFromFileTool.ts +88 -15
  33. package/src/tools/inscriber/InscribeFromUrlTool.ts +40 -11
  34. package/src/tools/inscriber/InscribeHashinalTool.ts +43 -6
  35. package/src/tools/inscriber/base-inscriber-tools.ts +87 -0
@@ -16,13 +16,14 @@ const inscribeFromBufferSchema = z.object({
16
16
  timeoutMs: z.number().int().positive().optional().describe(
17
17
  "Timeout in milliseconds for inscription (default: no timeout - waits until completion)"
18
18
  ),
19
- apiKey: z.string().optional().describe("API key for inscription service")
19
+ apiKey: z.string().optional().describe("API key for inscription service"),
20
+ quoteOnly: z.boolean().optional().default(false).describe("If true, returns a cost quote instead of executing the inscription")
20
21
  });
21
22
  class InscribeFromBufferTool extends BaseInscriberQueryTool {
22
23
  constructor() {
23
24
  super(...arguments);
24
25
  this.name = "inscribeFromBuffer";
25
- this.description = 'Inscribe content that you have already retrieved or displayed. When user says "inscribe it" after you showed search results or other content, use THIS tool. The base64Data field accepts PLAIN TEXT (not just base64) and content reference IDs in format "content-ref:[id]". Pass the EXACT content from your previous response or MCP tool output. DO NOT generate new content or create repetitive text. Content references are automatically resolved to the original content for inscription.';
26
+ this.description = 'Inscribe content that you have already retrieved or displayed. When user says "inscribe it" after you showed search results or other content, use THIS tool. The base64Data field accepts PLAIN TEXT (not just base64) and content reference IDs in format "content-ref:[id]". Pass the EXACT content from your previous response or MCP tool output. DO NOT generate new content or create repetitive text. Content references are automatically resolved to the original content for inscription. Set quoteOnly=true to get cost estimates without executing the inscription.';
26
27
  this.config = loadConfig();
27
28
  }
28
29
  get specificInputSchema() {
@@ -44,12 +45,44 @@ class InscribeFromBufferTool extends BaseInscriberQueryTool {
44
45
  metadata: params.metadata,
45
46
  tags: params.tags,
46
47
  chunkSize: params.chunkSize,
47
- waitForConfirmation: params.waitForConfirmation ?? true,
48
+ waitForConfirmation: params.quoteOnly ? false : params.waitForConfirmation ?? true,
48
49
  waitMaxAttempts: 10,
49
50
  waitIntervalMs: 3e3,
50
51
  apiKey: params.apiKey,
51
- network: this.inscriberBuilder["hederaKit"].client.network.toString().includes("mainnet") ? "mainnet" : "testnet"
52
+ network: this.inscriberBuilder["hederaKit"].client.network.toString().includes("mainnet") ? "mainnet" : "testnet",
53
+ quoteOnly: params.quoteOnly
52
54
  };
55
+ if (params.quoteOnly) {
56
+ try {
57
+ const quote = await this.generateInscriptionQuote(
58
+ {
59
+ type: "buffer",
60
+ buffer,
61
+ fileName: resolvedFileName,
62
+ mimeType: resolvedMimeType
63
+ },
64
+ options
65
+ );
66
+ return {
67
+ success: true,
68
+ quote: {
69
+ totalCostHbar: quote.totalCostHbar,
70
+ validUntil: quote.validUntil,
71
+ breakdown: quote.breakdown
72
+ },
73
+ contentInfo: {
74
+ fileName: resolvedFileName,
75
+ mimeType: resolvedMimeType,
76
+ sizeBytes: buffer.length
77
+ },
78
+ message: `Quote generated for buffer content: ${resolvedFileName} (${(buffer.length / 1024).toFixed(2)} KB)
79
+ Total cost: ${quote.totalCostHbar} HBAR`
80
+ };
81
+ } catch (error) {
82
+ const errorMessage = error instanceof Error ? error.message : "Failed to generate inscription quote";
83
+ throw new Error(`Quote generation failed: ${errorMessage}`);
84
+ }
85
+ }
53
86
  const timeoutMs = params.timeoutMs || (options.waitForConfirmation ? 6e4 : void 0);
54
87
  try {
55
88
  const result = await this.executeInscription(
@@ -131,7 +164,7 @@ class InscribeFromBufferTool extends BaseInscriberQueryTool {
131
164
  return this.inscriberBuilder.inscribe(inscriptionData, options);
132
165
  }
133
166
  formatInscriptionResult(result, options) {
134
- if (result.confirmed) {
167
+ if (result.confirmed && !result.quote) {
135
168
  const topicId = result.inscription?.topic_id || result.result.topicId;
136
169
  const network = options.network || "testnet";
137
170
  const cdnUrl = topicId ? `https://kiloscribe.com/api/inscription-cdn/${topicId}?network=${network}` : null;
@@ -143,11 +176,14 @@ View inscription: ${cdnUrl}` : ""}
143
176
 
144
177
  The inscription is now available.`;
145
178
  }
146
- return `Successfully submitted inscription to the Hedera network!
179
+ if (!result.quote && !result.confirmed) {
180
+ return `Successfully submitted inscription to the Hedera network!
147
181
 
148
182
  Transaction ID: ${result.result.transactionId}
149
183
 
150
184
  The inscription is processing and will be confirmed shortly.`;
185
+ }
186
+ return "Inscription operation completed.";
151
187
  }
152
188
  async resolveContent(input, providedMimeType, providedFileName) {
153
189
  const trimmedInput = input.trim();
@@ -1 +1 @@
1
- {"version":3,"file":"standards-agent-kit.es36.js","sources":["../../src/tools/inscriber/InscribeFromBufferTool.ts"],"sourcesContent":["import { z } from 'zod';\nimport { BaseInscriberQueryTool } from './base-inscriber-tools';\nimport { InscriptionOptions, ContentResolverRegistry } from '@hashgraphonline/standards-sdk';\nimport { CallbackManagerForToolRun } from '@langchain/core/callbacks/manager';\nimport { loadConfig } from '../../config/ContentReferenceConfig';\n\nconst inscribeFromBufferSchema = z.object({\n base64Data: z\n .string()\n .min(1, 'Data cannot be empty')\n .describe(\n 'The content to inscribe. Accept BOTH plain text AND base64. Also accepts content reference IDs in format \"content-ref:[id]\". When user says \"inscribe it\" or \"inscribe the content\", use the EXACT content from your previous message or from MCP tool results. DO NOT generate new content. DO NOT create repetitive text. Pass the actual search results or other retrieved content EXACTLY as you received it.'\n ),\n fileName: z\n .string()\n .min(1, 'File name cannot be empty')\n .describe('Name for the inscribed content. Required for all inscriptions.'),\n mimeType: z.string().optional().describe('MIME type of the content'),\n mode: z\n .enum(['file', 'hashinal'])\n .optional()\n .describe('Inscription mode: file or hashinal NFT'),\n metadata: z\n .record(z.unknown())\n .optional()\n .describe('Metadata to attach to the inscription'),\n tags: z\n .array(z.string())\n .optional()\n .describe('Tags to categorize the inscription'),\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 apiKey: z.string().optional().describe('API key for inscription service'),\n});\n\nexport class InscribeFromBufferTool extends BaseInscriberQueryTool<\n typeof inscribeFromBufferSchema\n> {\n name = 'inscribeFromBuffer';\n description =\n 'Inscribe content that you have already retrieved or displayed. When user says \"inscribe it\" after you showed search results or other content, use THIS tool. The base64Data field accepts PLAIN TEXT (not just base64) and content reference IDs in format \"content-ref:[id]\". Pass the EXACT content from your previous response or MCP tool output. DO NOT generate new content or create repetitive text. Content references are automatically resolved to the original content for inscription.';\n\n private config = loadConfig();\n\n get specificInputSchema() {\n return inscribeFromBufferSchema;\n }\n\n protected async executeQuery(\n params: z.infer<typeof inscribeFromBufferSchema>,\n _runManager?: CallbackManagerForToolRun\n ): Promise<unknown> {\n this.validateInput(params);\n\n const resolvedContent = await this.resolveContent(\n params.base64Data,\n params.mimeType,\n params.fileName\n );\n\n this.validateContent(resolvedContent.buffer);\n\n const buffer = resolvedContent.buffer;\n const resolvedMimeType = resolvedContent.mimeType || params.mimeType;\n const resolvedFileName = resolvedContent.fileName || params.fileName;\n\n const options: InscriptionOptions = {\n mode: params.mode,\n metadata: params.metadata,\n tags: params.tags,\n chunkSize: params.chunkSize,\n waitForConfirmation: params.waitForConfirmation ?? true,\n waitMaxAttempts: 10,\n waitIntervalMs: 3000,\n apiKey: params.apiKey,\n network: this.inscriberBuilder['hederaKit'].client.network\n .toString()\n .includes('mainnet')\n ? 'mainnet'\n : 'testnet',\n };\n\n const timeoutMs =\n params.timeoutMs || (options.waitForConfirmation ? 60000 : undefined);\n\n try {\n const result = await this.executeInscription(\n buffer,\n resolvedFileName,\n resolvedMimeType,\n options,\n timeoutMs\n );\n return this.formatInscriptionResult(result, options);\n } catch (error) {\n const errorMessage =\n error instanceof Error\n ? error.message\n : 'Failed to inscribe from buffer';\n throw new Error(`Inscription failed: ${errorMessage}`);\n }\n }\n\n private validateInput(\n params: z.infer<typeof inscribeFromBufferSchema>\n ): void {\n if (!params.base64Data || params.base64Data.trim() === '') {\n throw new Error(\n 'No data provided. Cannot inscribe empty content. Please provide valid content, plain text, base64 encoded data, or a content reference ID.'\n );\n }\n\n if (!params.fileName || params.fileName.trim() === '') {\n throw new Error(\n 'No fileName provided. A valid fileName is required for inscription.'\n );\n }\n }\n\n private validateContent(buffer: Buffer): void {\n if (buffer.length === 0) {\n throw new Error(\n 'Buffer is empty after conversion. The provided data appears to be invalid or empty.'\n );\n }\n\n if (buffer.length > this.config.maxInscriptionSize) {\n const maxSizeKB = Math.round(this.config.maxInscriptionSize / 1024);\n const bufferSizeKB = Math.round(buffer.length / 1024);\n throw new Error(\n `Content is too large for inscription (${bufferSizeKB}KB, max ${maxSizeKB}KB). Please summarize or extract key information before inscribing.`\n );\n }\n\n if (buffer.length < this.config.minContentSize) {\n throw new Error(\n `Buffer content is too small (${buffer.length} bytes). This may indicate empty or invalid content. Please verify the source data contains actual content.`\n );\n }\n\n if (\n buffer.toString('utf8', 0, Math.min(buffer.length, 100)).trim() === ''\n ) {\n throw new Error(\n 'Buffer contains only whitespace or empty content. Cannot inscribe meaningless data.'\n );\n }\n\n const contentStr = buffer.toString('utf8');\n const emptyHtmlPattern = /<a\\s+href=[\"'][^\"']+[\"']\\s*>\\s*<\\/a>/i;\n const hasOnlyEmptyLinks =\n emptyHtmlPattern.test(contentStr) &&\n contentStr.replace(/<[^>]+>/g, '').trim().length < 50;\n\n if (hasOnlyEmptyLinks) {\n throw new Error(\n 'Buffer contains empty HTML with only links and no actual content. When inscribing content from external sources, use the actual article text you retrieved, not empty HTML with links.'\n );\n }\n }\n\n private async executeInscription(\n buffer: Buffer,\n fileName: string,\n mimeType: string | undefined,\n options: InscriptionOptions,\n timeoutMs?: number\n ): Promise<Awaited<ReturnType<typeof this.inscriberBuilder.inscribe>>> {\n const inscriptionData = {\n type: 'buffer' as const,\n buffer,\n fileName,\n mimeType,\n };\n\n if (timeoutMs) {\n const timeoutPromise = new Promise<never>((_, reject) => {\n setTimeout(\n () => reject(new Error(`Inscription timed out after ${timeoutMs}ms`)),\n timeoutMs\n );\n });\n\n return Promise.race([\n this.inscriberBuilder.inscribe(inscriptionData, options),\n timeoutPromise,\n ]);\n }\n\n return this.inscriberBuilder.inscribe(inscriptionData, options);\n }\n\n private formatInscriptionResult(\n result: Awaited<ReturnType<typeof this.inscriberBuilder.inscribe>>,\n options: InscriptionOptions\n ): string {\n if (result.confirmed) {\n const topicId = result.inscription?.topic_id || result.result.topicId;\n const network = options.network || 'testnet';\n const cdnUrl = topicId\n ? `https://kiloscribe.com/api/inscription-cdn/${topicId}?network=${network}`\n : null;\n return `Successfully inscribed and confirmed content on the Hedera network!\\n\\nTransaction ID: ${\n result.result.transactionId\n }\\nTopic ID: ${topicId || 'N/A'}${\n cdnUrl ? `\\nView inscription: ${cdnUrl}` : ''\n }\\n\\nThe inscription is now available.`;\n }\n\n return `Successfully submitted inscription to the Hedera network!\\n\\nTransaction ID: ${result.result.transactionId}\\n\\nThe inscription is processing and will be confirmed shortly.`;\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 // Try to get resolver from either injected dependency or registry\n const resolver = this.getContentResolver() || ContentResolverRegistry.getResolver();\n \n if (!resolver) {\n // No resolver available, handle content directly\n return this.handleDirectContent(trimmedInput, providedMimeType, providedFileName);\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 // No reference found, handle as direct content\n return this.handleDirectContent(trimmedInput, providedMimeType, providedFileName);\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"],"names":["buffer"],"mappings":";;;;AAMA,MAAM,2BAA2B,EAAE,OAAO;AAAA,EACxC,YAAY,EACT,OAAA,EACA,IAAI,GAAG,sBAAsB,EAC7B;AAAA,IACC;AAAA,EAAA;AAAA,EAEJ,UAAU,EACP,SACA,IAAI,GAAG,2BAA2B,EAClC,SAAS,gEAAgE;AAAA,EAC5E,UAAU,EAAE,OAAA,EAAS,SAAA,EAAW,SAAS,0BAA0B;AAAA,EACnE,MAAM,EACH,KAAK,CAAC,QAAQ,UAAU,CAAC,EACzB,SAAA,EACA,SAAS,wCAAwC;AAAA,EACpD,UAAU,EACP,OAAO,EAAE,QAAA,CAAS,EAClB,SAAA,EACA,SAAS,uCAAuC;AAAA,EACnD,MAAM,EACH,MAAM,EAAE,OAAA,CAAQ,EAChB,SAAA,EACA,SAAS,oCAAoC;AAAA,EAChD,WAAW,EACR,OAAA,EACA,IAAA,EACA,SAAA,EACA,SAAA,EACA,SAAS,4BAA4B;AAAA,EACxC,qBAAqB,EAClB,QAAA,EACA,SAAA,E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W,UAAU,YAAY;AAAA,UAC3C,UAAU,WAAW,UAAU,YAAY;AAAA,UAC3C,cAAc;AAAA,QAAA;AAAA,MAElB,SAAS,OAAO;AACd,cAAM,WACJ,iBAAiB,QACb,MAAM,UACN;AACN,cAAM,IAAI,MAAM,gCAAgC,QAAQ,EAAE;AAAA,MAC5D;AAAA,IACF;AAGA,WAAO,KAAK,oBAAoB,cAAc,kBAAkB,gBAAgB;AAAA,EAClF;AAAA,EAEQ,oBACN,OACA,kBACA,kBAMA;AACA,UAAM,gBAAgB,yBAAyB,KAAK,KAAK;AAEzD,QAAI,eAAe;AACjB,UAAI;AACF,cAAMA,UAAS,OAAO,KAAK,OAAO,QAAQ;AAC1C,eAAO;AAAA,UACL,QAAAA;AAAAA,UACA,UAAU;AAAA,UACV,UAAU;AAAA,UACV,cAAc;AAAA,QAAA;AAAA,MAElB,SAAS,OAAO;AACd,cAAM,IAAI;AAAA,UACR;AAAA,QAAA;AAAA,MAEJ;AAAA,IACF;AAEA,UAAM,SAAS,OAAO,KAAK,OAAO,MAAM;AACxC,WAAO;AAAA,MACL;AAAA,MACA,UAAU,oBAAoB;AAAA,MAC9B,UAAU;AAAA,MACV,cAAc;AAAA,IAAA;AAAA,EAElB;AACF;"}
1
+ {"version":3,"file":"standards-agent-kit.es36.js","sources":["../../src/tools/inscriber/InscribeFromBufferTool.ts"],"sourcesContent":["import { z } from 'zod';\nimport { BaseInscriberQueryTool } from './base-inscriber-tools';\nimport { InscriptionOptions, ContentResolverRegistry } from '@hashgraphonline/standards-sdk';\nimport { CallbackManagerForToolRun } from '@langchain/core/callbacks/manager';\nimport { loadConfig } from '../../config/ContentReferenceConfig';\n\nconst inscribeFromBufferSchema = z.object({\n base64Data: z\n .string()\n .min(1, 'Data cannot be empty')\n .describe(\n 'The content to inscribe. Accept BOTH plain text AND base64. Also accepts content reference IDs in format \"content-ref:[id]\". When user says \"inscribe it\" or \"inscribe the content\", use the EXACT content from your previous message or from MCP tool results. DO NOT generate new content. DO NOT create repetitive text. Pass the actual search results or other retrieved content EXACTLY as you received it.'\n ),\n fileName: z\n .string()\n .min(1, 'File name cannot be empty')\n .describe('Name for the inscribed content. Required for all inscriptions.'),\n mimeType: z.string().optional().describe('MIME type of the content'),\n mode: z\n .enum(['file', 'hashinal'])\n .optional()\n .describe('Inscription mode: file or hashinal NFT'),\n metadata: z\n .record(z.unknown())\n .optional()\n .describe('Metadata to attach to the inscription'),\n tags: z\n .array(z.string())\n .optional()\n .describe('Tags to categorize the inscription'),\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 apiKey: z.string().optional().describe('API key for inscription service'),\n quoteOnly: z\n .boolean()\n .optional()\n .default(false)\n .describe('If true, returns a cost quote instead of executing the inscription'),\n});\n\nexport class InscribeFromBufferTool extends BaseInscriberQueryTool<\n typeof inscribeFromBufferSchema\n> {\n name = 'inscribeFromBuffer';\n description =\n 'Inscribe content that you have already retrieved or displayed. When user says \"inscribe it\" after you showed search results or other content, use THIS tool. The base64Data field accepts PLAIN TEXT (not just base64) and content reference IDs in format \"content-ref:[id]\". Pass the EXACT content from your previous response or MCP tool output. DO NOT generate new content or create repetitive text. Content references are automatically resolved to the original content for inscription. Set quoteOnly=true to get cost estimates without executing the inscription.';\n\n private config = loadConfig();\n\n get specificInputSchema() {\n return inscribeFromBufferSchema;\n }\n\n protected async executeQuery(\n params: z.infer<typeof inscribeFromBufferSchema>,\n _runManager?: CallbackManagerForToolRun\n ): Promise<unknown> {\n this.validateInput(params);\n\n const resolvedContent = await this.resolveContent(\n params.base64Data,\n params.mimeType,\n params.fileName\n );\n\n this.validateContent(resolvedContent.buffer);\n\n const buffer = resolvedContent.buffer;\n const resolvedMimeType = resolvedContent.mimeType || params.mimeType;\n const resolvedFileName = resolvedContent.fileName || params.fileName;\n\n const options: InscriptionOptions = {\n mode: params.mode,\n metadata: params.metadata,\n tags: params.tags,\n chunkSize: params.chunkSize,\n waitForConfirmation: params.quoteOnly ? false : (params.waitForConfirmation ?? true),\n waitMaxAttempts: 10,\n waitIntervalMs: 3000,\n apiKey: params.apiKey,\n network: this.inscriberBuilder['hederaKit'].client.network\n .toString()\n .includes('mainnet')\n ? 'mainnet'\n : 'testnet',\n quoteOnly: params.quoteOnly,\n };\n\n if (params.quoteOnly) {\n try {\n const quote = await this.generateInscriptionQuote(\n {\n type: 'buffer',\n buffer,\n fileName: resolvedFileName,\n mimeType: resolvedMimeType,\n },\n options\n );\n \n return {\n success: true,\n quote: {\n totalCostHbar: quote.totalCostHbar,\n validUntil: quote.validUntil,\n breakdown: quote.breakdown,\n },\n contentInfo: {\n fileName: resolvedFileName,\n mimeType: resolvedMimeType,\n sizeBytes: buffer.length,\n },\n message: `Quote generated for buffer content: ${resolvedFileName} (${(buffer.length / 1024).toFixed(2)} KB)\\nTotal cost: ${quote.totalCostHbar} HBAR`,\n };\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : 'Failed to generate inscription quote';\n throw new Error(`Quote generation failed: ${errorMessage}`);\n }\n }\n\n const timeoutMs =\n params.timeoutMs || (options.waitForConfirmation ? 60000 : undefined);\n\n try {\n const result = await this.executeInscription(\n buffer,\n resolvedFileName,\n resolvedMimeType,\n options,\n timeoutMs\n );\n return this.formatInscriptionResult(result, options);\n } catch (error) {\n const errorMessage =\n error instanceof Error\n ? error.message\n : 'Failed to inscribe from buffer';\n throw new Error(`Inscription failed: ${errorMessage}`);\n }\n }\n\n private validateInput(\n params: z.infer<typeof inscribeFromBufferSchema>\n ): void {\n if (!params.base64Data || params.base64Data.trim() === '') {\n throw new Error(\n 'No data provided. Cannot inscribe empty content. Please provide valid content, plain text, base64 encoded data, or a content reference ID.'\n );\n }\n\n if (!params.fileName || params.fileName.trim() === '') {\n throw new Error(\n 'No fileName provided. A valid fileName is required for inscription.'\n );\n }\n }\n\n private validateContent(buffer: Buffer): void {\n if (buffer.length === 0) {\n throw new Error(\n 'Buffer is empty after conversion. The provided data appears to be invalid or empty.'\n );\n }\n\n if (buffer.length > this.config.maxInscriptionSize) {\n const maxSizeKB = Math.round(this.config.maxInscriptionSize / 1024);\n const bufferSizeKB = Math.round(buffer.length / 1024);\n throw new Error(\n `Content is too large for inscription (${bufferSizeKB}KB, max ${maxSizeKB}KB). Please summarize or extract key information before inscribing.`\n );\n }\n\n if (buffer.length < this.config.minContentSize) {\n throw new Error(\n `Buffer content is too small (${buffer.length} bytes). This may indicate empty or invalid content. Please verify the source data contains actual content.`\n );\n }\n\n if (\n buffer.toString('utf8', 0, Math.min(buffer.length, 100)).trim() === ''\n ) {\n throw new Error(\n 'Buffer contains only whitespace or empty content. Cannot inscribe meaningless data.'\n );\n }\n\n const contentStr = buffer.toString('utf8');\n const emptyHtmlPattern = /<a\\s+href=[\"'][^\"']+[\"']\\s*>\\s*<\\/a>/i;\n const hasOnlyEmptyLinks =\n emptyHtmlPattern.test(contentStr) &&\n contentStr.replace(/<[^>]+>/g, '').trim().length < 50;\n\n if (hasOnlyEmptyLinks) {\n throw new Error(\n 'Buffer contains empty HTML with only links and no actual content. When inscribing content from external sources, use the actual article text you retrieved, not empty HTML with links.'\n );\n }\n }\n\n private async executeInscription(\n buffer: Buffer,\n fileName: string,\n mimeType: string | undefined,\n options: InscriptionOptions,\n timeoutMs?: number\n ): Promise<Awaited<ReturnType<typeof this.inscriberBuilder.inscribe>>> {\n const inscriptionData = {\n type: 'buffer' as const,\n buffer,\n fileName,\n mimeType,\n };\n\n if (timeoutMs) {\n const timeoutPromise = new Promise<never>((_, reject) => {\n setTimeout(\n () => reject(new Error(`Inscription timed out after ${timeoutMs}ms`)),\n timeoutMs\n );\n });\n\n return Promise.race([\n this.inscriberBuilder.inscribe(inscriptionData, options),\n timeoutPromise,\n ]);\n }\n\n return this.inscriberBuilder.inscribe(inscriptionData, options);\n }\n\n private formatInscriptionResult(\n result: Awaited<ReturnType<typeof this.inscriberBuilder.inscribe>>,\n options: InscriptionOptions\n ): string {\n if (result.confirmed && !result.quote) {\n const topicId = result.inscription?.topic_id || (result.result as any).topicId;\n const network = options.network || 'testnet';\n const cdnUrl = topicId\n ? `https://kiloscribe.com/api/inscription-cdn/${topicId}?network=${network}`\n : null;\n return `Successfully inscribed and confirmed content on the Hedera network!\\n\\nTransaction ID: ${\n (result.result as any).transactionId\n }\\nTopic ID: ${topicId || 'N/A'}${\n cdnUrl ? `\\nView inscription: ${cdnUrl}` : ''\n }\\n\\nThe inscription is now available.`;\n }\n\n if (!result.quote && !result.confirmed) {\n return `Successfully submitted inscription to the Hedera network!\\n\\nTransaction ID: ${(result.result as any).transactionId}\\n\\nThe inscription is processing and will be confirmed shortly.`;\n }\n\n return 'Inscription operation completed.';\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 = this.getContentResolver() || ContentResolverRegistry.getResolver();\n \n if (!resolver) {\n return this.handleDirectContent(trimmedInput, providedMimeType, providedFileName);\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(trimmedInput, providedMimeType, providedFileName);\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"],"names":["buffer"],"mappings":";;;;AAMA,MAAM,2BAA2B,EAAE,OAAO;AAAA,EACxC,YAAY,EACT,OAAA,EACA,IAAI,GAAG,sBAAsB,EAC7B;AAAA,IACC;AAAA,EAAA;AAAA,EAEJ,UAAU,EACP,SACA,IAAI,GAAG,2BAA2B,EAClC,SAAS,gEAAgE;AAAA,EAC5E,UAAU,EAAE,OAAA,EAAS,SAAA,EAAW,SAAS,0BAA0B;AAAA,EACnE,MAAM,EACH,KAAK,CAAC,QAAQ,UAAU,CAAC,EACzB,SAAA,EACA,SAAS,wCAAwC;AAAA,EACpD,UAAU,EACP,OAAO,EAAE,QAAA,CAAS,EAClB,SAAA,EACA,SAAS,uCAAuC;AAAA,EACnD,MAAM,EACH,MAAM,EAAE,OAAA,CAAQ,EAChB,SAAA,EACA,SAAS,oCAAoC;AAAA,EAChD,WAAW,EACR,OAAA,EACA,IAAA,EACA,SAAA,EACA,SAAA,EACA,SAAS,4BAA4B;AAAA,EACxC,qBAAqB,EAClB,QAAA,EACA,SAAA,EACA,SAAS,8CAA8C;AAAA,EAC1D,WAAW,EACR,SACA,MACA,SAAA,EACA,SAAA,EACA;AAAA,IACC;AAAA,EAAA;AAAA,EAEJ,QAAQ,EAAE,OAAA,EAAS,SAAA,EAAW,SAAS,iCAAiC;AAAA,EACxE,WAAW,EACR,UACA,SAAA,EACA,QAAQ,KAAK,EACb,SAAS,oEAAoE;AAClF,CAAC;AAEM,MAAM,+BAA+B,uBAE1C;AAA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AAM;AACxC,WAAO;AAAA,MACL;AAAA,MACA,UAAU,oBAAoB;AAAA,MAC9B,UAAU;AAAA,MACV,cAAc;AAAA,IAAA;AAAA,EAElB;AACF;"}
@@ -18,13 +18,14 @@ const inscribeHashinalSchema = z.object({
18
18
  chunkSize: z.number().int().positive().optional().describe("Chunk size for large files"),
19
19
  waitForConfirmation: z.boolean().optional().describe("Whether to wait for inscription confirmation"),
20
20
  timeoutMs: z.number().int().positive().optional().describe("Timeout in milliseconds for inscription (default: no timeout - waits until completion)"),
21
- apiKey: z.string().optional().describe("API key for inscription service")
21
+ apiKey: z.string().optional().describe("API key for inscription service"),
22
+ quoteOnly: z.boolean().optional().default(false).describe("If true, returns a cost quote instead of executing the inscription")
22
23
  });
23
24
  class InscribeHashinalTool extends BaseInscriberQueryTool {
24
25
  constructor() {
25
26
  super(...arguments);
26
27
  this.name = "inscribeHashinal";
27
- this.description = "Inscribe content as a Hashinal NFT on the Hedera network";
28
+ this.description = "Inscribe content as a Hashinal NFT on the Hedera network. Set quoteOnly=true to get cost estimates without executing the inscription.";
28
29
  }
29
30
  get specificInputSchema() {
30
31
  return inscribeHashinalSchema;
@@ -44,12 +45,41 @@ class InscribeHashinalTool extends BaseInscriberQueryTool {
44
45
  jsonFileURL: params.jsonFileURL,
45
46
  tags: params.tags,
46
47
  chunkSize: params.chunkSize,
47
- waitForConfirmation: params.waitForConfirmation ?? true,
48
+ waitForConfirmation: params.quoteOnly ? false : params.waitForConfirmation ?? true,
48
49
  waitMaxAttempts: 10,
49
50
  waitIntervalMs: 3e3,
50
51
  apiKey: params.apiKey,
51
- network: this.inscriberBuilder["hederaKit"].client.network.toString().includes("mainnet") ? "mainnet" : "testnet"
52
+ network: this.inscriberBuilder["hederaKit"].client.network.toString().includes("mainnet") ? "mainnet" : "testnet",
53
+ quoteOnly: params.quoteOnly
52
54
  };
55
+ if (params.quoteOnly) {
56
+ try {
57
+ const quote = await this.generateInscriptionQuote(
58
+ { type: "url", url: params.url },
59
+ options
60
+ );
61
+ return {
62
+ success: true,
63
+ quote: {
64
+ totalCostHbar: quote.totalCostHbar,
65
+ validUntil: quote.validUntil,
66
+ breakdown: quote.breakdown
67
+ },
68
+ contentInfo: {
69
+ url: params.url,
70
+ name: params.name,
71
+ creator: params.creator,
72
+ type: params.type
73
+ },
74
+ message: `Quote generated for Hashinal NFT: ${params.name}
75
+ Creator: ${params.creator}
76
+ Total cost: ${quote.totalCostHbar} HBAR`
77
+ };
78
+ } catch (error) {
79
+ const errorMessage = error instanceof Error ? error.message : "Failed to generate inscription quote";
80
+ throw new Error(`Quote generation failed: ${errorMessage}`);
81
+ }
82
+ }
53
83
  try {
54
84
  let result;
55
85
  if (params.timeoutMs) {
@@ -72,7 +102,7 @@ class InscribeHashinalTool extends BaseInscriberQueryTool {
72
102
  options
73
103
  );
74
104
  }
75
- if (result.confirmed) {
105
+ if (result.confirmed && !result.quote) {
76
106
  const topicId = result.inscription?.topic_id || result.result.topicId;
77
107
  const network = options.network || "testnet";
78
108
  const cdnUrl = topicId ? `https://kiloscribe.com/api/inscription-cdn/${topicId}?network=${network}` : null;
@@ -83,12 +113,14 @@ Topic ID: ${topicId || "N/A"}${cdnUrl ? `
83
113
  View inscription: ${cdnUrl}` : ""}
84
114
 
85
115
  The Hashinal NFT is now available.`;
86
- } else {
116
+ } else if (!result.quote && !result.confirmed) {
87
117
  return `Successfully submitted Hashinal NFT inscription to the Hedera network!
88
118
 
89
119
  Transaction ID: ${result.result.transactionId}
90
120
 
91
121
  The inscription is processing and will be confirmed shortly.`;
122
+ } else {
123
+ return "Inscription operation completed.";
92
124
  }
93
125
  } catch (error) {
94
126
  const errorMessage = error instanceof Error ? error.message : "Failed to inscribe Hashinal NFT";
@@ -1 +1 @@
1
- {"version":3,"file":"standards-agent-kit.es37.js","sources":["../../src/tools/inscriber/InscribeHashinalTool.ts"],"sourcesContent":["import { z } from 'zod';\nimport { BaseInscriberQueryTool } from './base-inscriber-tools';\nimport { InscriptionOptions } from '@hashgraphonline/standards-sdk';\nimport { CallbackManagerForToolRun } from '@langchain/core/callbacks/manager';\n\n/**\n * Schema for inscribing Hashinal NFT\n */\nconst inscribeHashinalSchema = z.object({\n url: z.string().url().describe('The URL of the content to inscribe as Hashinal NFT'),\n name: z.string().describe('Name of the Hashinal NFT'),\n creator: z.string().describe('Creator account ID or name'),\n description: z.string().describe('Description of the Hashinal NFT'),\n type: z.string().describe('Type of NFT (e.g., \"image\", \"video\", \"audio\")'),\n attributes: z\n .array(\n z.object({\n trait_type: z.string(),\n value: z.union([z.string(), z.number()]),\n })\n )\n .optional()\n .describe('NFT attributes'),\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 tags: z\n .array(z.string())\n .optional()\n .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('Timeout in milliseconds for inscription (default: no timeout - waits until completion)'),\n apiKey: z\n .string()\n .optional()\n .describe('API key for inscription service'),\n});\n\n\n/**\n * Tool for inscribing Hashinal NFTs\n */\nexport class InscribeHashinalTool extends BaseInscriberQueryTool<typeof inscribeHashinalSchema> {\n name = 'inscribeHashinal';\n description = 'Inscribe content as a Hashinal NFT on the Hedera network';\n\n get specificInputSchema() {\n return inscribeHashinalSchema;\n }\n\n protected async executeQuery(\n params: z.infer<typeof inscribeHashinalSchema>,\n _runManager?: CallbackManagerForToolRun\n ): Promise<unknown> {\n const metadata = {\n name: params.name,\n creator: params.creator,\n description: params.description,\n type: params.type,\n attributes: params.attributes,\n properties: params.properties,\n };\n\n const options: InscriptionOptions = {\n mode: 'hashinal',\n metadata,\n jsonFileURL: params.jsonFileURL,\n tags: params.tags,\n chunkSize: params.chunkSize,\n waitForConfirmation: params.waitForConfirmation ?? true,\n waitMaxAttempts: 10,\n waitIntervalMs: 3000,\n apiKey: params.apiKey,\n network: this.inscriberBuilder['hederaKit'].client.network.toString().includes('mainnet') ? 'mainnet' : 'testnet',\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 () => reject(new Error(`Inscription timed out after ${params.timeoutMs}ms`)),\n params.timeoutMs\n );\n });\n\n result = await Promise.race([\n this.inscriberBuilder.inscribe(\n { type: 'url', url: params.url },\n options\n ),\n timeoutPromise\n ]);\n } else {\n result = await this.inscriberBuilder.inscribe(\n { type: 'url', url: params.url },\n options\n );\n }\n\n if (result.confirmed) {\n const topicId = result.inscription?.topic_id || result.result.topicId;\n const network = options.network || 'testnet';\n const cdnUrl = topicId ? `https://kiloscribe.com/api/inscription-cdn/${topicId}?network=${network}` : null;\n return `Successfully inscribed and confirmed Hashinal NFT on the Hedera network!\\n\\nTransaction ID: ${result.result.transactionId}\\nTopic ID: ${topicId || 'N/A'}${cdnUrl ? `\\nView inscription: ${cdnUrl}` : ''}\\n\\nThe Hashinal NFT is now available.`;\n } else {\n return `Successfully submitted Hashinal NFT inscription to the Hedera network!\\n\\nTransaction ID: ${result.result.transactionId}\\n\\nThe inscription is processing and will be confirmed shortly.`;\n }\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : 'Failed to inscribe Hashinal NFT';\n throw new Error(`Inscription failed: ${errorMessage}`);\n }\n }\n}"],"names":[],"mappings":";;AAQA,MAAM,yBAAyB,EAAE,OAAO;AAAA,EACtC,KAAK,EAAE,OAAA,EAAS,IAAA,EAAM,SAAS,oDAAoD;AAAA,EACnF,MAAM,EAAE,SAAS,SAAS,0BAA0B;AAAA,EACpD,SAAS,EAAE,SAAS,SAAS,4BAA4B;AAAA,EACzD,aAAa,EAAE,SAAS,SAAS,iCAAiC;AAAA,EAClE,MAAM,EAAE,SAAS,SAAS,+C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
+ {"version":3,"file":"standards-agent-kit.es37.js","sources":["../../src/tools/inscriber/InscribeHashinalTool.ts"],"sourcesContent":["import { z } from 'zod';\nimport { BaseInscriberQueryTool } from './base-inscriber-tools';\nimport { InscriptionOptions } from '@hashgraphonline/standards-sdk';\nimport { CallbackManagerForToolRun } from '@langchain/core/callbacks/manager';\n\n/**\n * Schema for inscribing Hashinal NFT\n */\nconst inscribeHashinalSchema = z.object({\n url: z.string().url().describe('The URL of the content to inscribe as Hashinal NFT'),\n name: z.string().describe('Name of the Hashinal NFT'),\n creator: z.string().describe('Creator account ID or name'),\n description: z.string().describe('Description of the Hashinal NFT'),\n type: z.string().describe('Type of NFT (e.g., \"image\", \"video\", \"audio\")'),\n attributes: z\n .array(\n z.object({\n trait_type: z.string(),\n value: z.union([z.string(), z.number()]),\n })\n )\n .optional()\n .describe('NFT attributes'),\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 tags: z\n .array(z.string())\n .optional()\n .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('Timeout in milliseconds for inscription (default: no timeout - waits until completion)'),\n apiKey: z\n .string()\n .optional()\n .describe('API key for inscription service'),\n quoteOnly: z\n .boolean()\n .optional()\n .default(false)\n .describe('If true, returns a cost quote instead of executing the inscription'),\n});\n\n\n/**\n * Tool for inscribing Hashinal NFTs\n */\nexport class InscribeHashinalTool extends BaseInscriberQueryTool<typeof inscribeHashinalSchema> {\n name = 'inscribeHashinal';\n description = 'Inscribe content as a Hashinal NFT on the Hedera network. Set quoteOnly=true to get cost estimates without executing the inscription.';\n\n get specificInputSchema() {\n return inscribeHashinalSchema;\n }\n\n protected async executeQuery(\n params: z.infer<typeof inscribeHashinalSchema>,\n _runManager?: CallbackManagerForToolRun\n ): Promise<unknown> {\n const metadata = {\n name: params.name,\n creator: params.creator,\n description: params.description,\n type: params.type,\n attributes: params.attributes,\n properties: params.properties,\n };\n\n const options: InscriptionOptions = {\n mode: 'hashinal',\n metadata,\n jsonFileURL: params.jsonFileURL,\n tags: params.tags,\n chunkSize: params.chunkSize,\n waitForConfirmation: params.quoteOnly ? false : (params.waitForConfirmation ?? true),\n waitMaxAttempts: 10,\n waitIntervalMs: 3000,\n apiKey: params.apiKey,\n network: this.inscriberBuilder['hederaKit'].client.network.toString().includes('mainnet') ? 'mainnet' : 'testnet',\n quoteOnly: params.quoteOnly,\n };\n\n if (params.quoteOnly) {\n try {\n const quote = await this.generateInscriptionQuote(\n { type: 'url', url: params.url },\n options\n );\n \n return {\n success: true,\n quote: {\n totalCostHbar: quote.totalCostHbar,\n validUntil: quote.validUntil,\n breakdown: quote.breakdown,\n },\n contentInfo: {\n url: params.url,\n name: params.name,\n creator: params.creator,\n type: params.type,\n },\n message: `Quote generated for Hashinal NFT: ${params.name}\\nCreator: ${params.creator}\\nTotal cost: ${quote.totalCostHbar} HBAR`,\n };\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : 'Failed to generate inscription quote';\n throw new Error(`Quote generation failed: ${errorMessage}`);\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 () => reject(new Error(`Inscription timed out after ${params.timeoutMs}ms`)),\n params.timeoutMs\n );\n });\n\n result = await Promise.race([\n this.inscriberBuilder.inscribe(\n { type: 'url', url: params.url },\n options\n ),\n timeoutPromise\n ]);\n } else {\n result = await this.inscriberBuilder.inscribe(\n { type: 'url', url: params.url },\n options\n );\n }\n\n if (result.confirmed && !result.quote) {\n const topicId = result.inscription?.topic_id || (result.result as any).topicId;\n const network = options.network || 'testnet';\n const cdnUrl = topicId ? `https://kiloscribe.com/api/inscription-cdn/${topicId}?network=${network}` : null;\n return `Successfully inscribed and confirmed Hashinal NFT on the Hedera network!\\n\\nTransaction ID: ${(result.result as any).transactionId}\\nTopic ID: ${topicId || 'N/A'}${cdnUrl ? `\\nView inscription: ${cdnUrl}` : ''}\\n\\nThe Hashinal NFT is now available.`;\n } else if (!result.quote && !result.confirmed) {\n return `Successfully submitted Hashinal NFT inscription to the Hedera network!\\n\\nTransaction ID: ${(result.result as any).transactionId}\\n\\nThe inscription is processing and will be confirmed shortly.`;\n } else {\n return 'Inscription operation completed.';\n }\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : 'Failed to inscribe Hashinal NFT';\n throw new Error(`Inscription failed: ${errorMessage}`);\n }\n }\n}"],"names":[],"mappings":";;AAQA,MAAM,yBAAyB,EAAE,OAAO;AAAA,EACtC,KAAK,EAAE,OAAA,EAAS,IAAA,EAAM,SAAS,oDAAoD;AAAA,EACnF,MAAM,EAAE,SAAS,SAAS,0BAA0B;AAAA,EACpD,SAAS,EAAE,SAAS,SAAS,4BAA4B;AAAA,EACzD,aAAa,EAAE,SAAS,SAAS,iCAAiC;AAAA,EAClE,MAAM,EAAE,SAAS,SAAS,+CAA+C;AAAA,EACzE,YAAY,EACT;AAAA,IACC,EAAE,OAAO;AAAA,MACP,YAAY,EAAE,OAAA;AAAA,MACd,OAAO,EAAE,MAAM,CAAC,EAAE,UAAU,EAAE,QAAQ,CAAC;AAAA,IAAA,CACxC;AAAA,EAAA,EAEF,SAAA,EACA,SAAS,gBAAgB;AAAA,EAC5B,YAAY,EACT,OAAO,EAAE,QAAA,CAAS,EAClB,SAAA,EACA,SAAS,uBAAuB;AAAA,EACnC,aAAa,EACV,SACA,MACA,SAAA,EACA,SAAS,2BAA2B;AAAA,EACvC,MAAM,EACH,MAAM,EAAE,OAAA,CAAQ,EAChB,SAAA,EACA,SAAS,4BAA4B;AAAA,EACxC,WAAW,EACR,OAAA,EACA,IAAA,EACA,SAAA,EACA,SA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SAAS;AAAA,oBAAuB,MAAM,KAAK,EAAE;AAAA;AAAA;AAAA,MAC3N,WAAW,CAAC,OAAO,SAAS,CAAC,OAAO,WAAW;AAC7C,eAAO;AAAA;AAAA,kBAA8F,OAAO,OAAe,aAAa;AAAA;AAAA;AAAA,MAC1I,OAAO;AACL,eAAO;AAAA,MACT;AAAA,IACF,SAAS,OAAO;AACd,YAAM,eAAe,iBAAiB,QAAQ,MAAM,UAAU;AAC9D,YAAM,IAAI,MAAM,uBAAuB,YAAY,EAAE;AAAA,IACvD;AAAA,EACF;AACF;"}
@@ -12,7 +12,9 @@ declare const inscribeFromBufferSchema: z.ZodObject<{
12
12
  waitForConfirmation: z.ZodOptional<z.ZodBoolean>;
13
13
  timeoutMs: z.ZodOptional<z.ZodNumber>;
14
14
  apiKey: z.ZodOptional<z.ZodString>;
15
+ quoteOnly: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
15
16
  }, "strip", z.ZodTypeAny, {
17
+ quoteOnly: boolean;
16
18
  fileName: string;
17
19
  base64Data: string;
18
20
  tags?: string[] | undefined;
@@ -34,6 +36,7 @@ declare const inscribeFromBufferSchema: z.ZodObject<{
34
36
  waitForConfirmation?: boolean | undefined;
35
37
  timeoutMs?: number | undefined;
36
38
  apiKey?: string | undefined;
39
+ quoteOnly?: boolean | undefined;
37
40
  }>;
38
41
  export declare class InscribeFromBufferTool extends BaseInscriberQueryTool<typeof inscribeFromBufferSchema> {
39
42
  name: string;
@@ -50,7 +53,9 @@ export declare class InscribeFromBufferTool extends BaseInscriberQueryTool<typeo
50
53
  waitForConfirmation: z.ZodOptional<z.ZodBoolean>;
51
54
  timeoutMs: z.ZodOptional<z.ZodNumber>;
52
55
  apiKey: z.ZodOptional<z.ZodString>;
56
+ quoteOnly: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
53
57
  }, "strip", z.ZodTypeAny, {
58
+ quoteOnly: boolean;
54
59
  fileName: string;
55
60
  base64Data: string;
56
61
  tags?: string[] | undefined;
@@ -72,6 +77,7 @@ export declare class InscribeFromBufferTool extends BaseInscriberQueryTool<typeo
72
77
  waitForConfirmation?: boolean | undefined;
73
78
  timeoutMs?: number | undefined;
74
79
  apiKey?: string | undefined;
80
+ quoteOnly?: boolean | undefined;
75
81
  }>;
76
82
  protected executeQuery(params: z.infer<typeof inscribeFromBufferSchema>, _runManager?: CallbackManagerForToolRun): Promise<unknown>;
77
83
  private validateInput;
@@ -13,7 +13,9 @@ declare const inscribeFromFileSchema: z.ZodObject<{
13
13
  waitForConfirmation: z.ZodOptional<z.ZodBoolean>;
14
14
  timeoutMs: z.ZodOptional<z.ZodNumber>;
15
15
  apiKey: z.ZodOptional<z.ZodString>;
16
+ quoteOnly: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
16
17
  }, "strip", z.ZodTypeAny, {
18
+ quoteOnly: boolean;
17
19
  filePath: string;
18
20
  tags?: string[] | undefined;
19
21
  metadata?: Record<string, unknown> | undefined;
@@ -31,6 +33,7 @@ declare const inscribeFromFileSchema: z.ZodObject<{
31
33
  waitForConfirmation?: boolean | undefined;
32
34
  timeoutMs?: number | undefined;
33
35
  apiKey?: string | undefined;
36
+ quoteOnly?: boolean | undefined;
34
37
  }>;
35
38
  /**
36
39
  * Tool for inscribing content from file
@@ -13,8 +13,10 @@ declare const inscribeFromUrlSchema: z.ZodObject<{
13
13
  waitForConfirmation: z.ZodOptional<z.ZodBoolean>;
14
14
  timeoutMs: z.ZodOptional<z.ZodNumber>;
15
15
  apiKey: z.ZodOptional<z.ZodString>;
16
+ quoteOnly: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
16
17
  }, "strip", z.ZodTypeAny, {
17
18
  url: string;
19
+ quoteOnly: boolean;
18
20
  tags?: string[] | undefined;
19
21
  metadata?: Record<string, unknown> | undefined;
20
22
  mode?: "file" | "hashinal" | undefined;
@@ -31,6 +33,7 @@ declare const inscribeFromUrlSchema: z.ZodObject<{
31
33
  waitForConfirmation?: boolean | undefined;
32
34
  timeoutMs?: number | undefined;
33
35
  apiKey?: string | undefined;
36
+ quoteOnly?: boolean | undefined;
34
37
  }>;
35
38
  /**
36
39
  * Tool for inscribing content from URL
@@ -47,8 +50,10 @@ export declare class InscribeFromUrlTool extends BaseInscriberQueryTool<typeof i
47
50
  waitForConfirmation: z.ZodOptional<z.ZodBoolean>;
48
51
  timeoutMs: z.ZodOptional<z.ZodNumber>;
49
52
  apiKey: z.ZodOptional<z.ZodString>;
53
+ quoteOnly: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
50
54
  }, "strip", z.ZodTypeAny, {
51
55
  url: string;
56
+ quoteOnly: boolean;
52
57
  tags?: string[] | undefined;
53
58
  metadata?: Record<string, unknown> | undefined;
54
59
  mode?: "file" | "hashinal" | undefined;
@@ -65,6 +70,7 @@ export declare class InscribeFromUrlTool extends BaseInscriberQueryTool<typeof i
65
70
  waitForConfirmation?: boolean | undefined;
66
71
  timeoutMs?: number | undefined;
67
72
  apiKey?: string | undefined;
73
+ quoteOnly?: boolean | undefined;
68
74
  }>;
69
75
  protected executeQuery(params: z.infer<typeof inscribeFromUrlSchema>, _runManager?: CallbackManagerForToolRun): Promise<unknown>;
70
76
  }
@@ -27,12 +27,14 @@ declare const inscribeHashinalSchema: z.ZodObject<{
27
27
  waitForConfirmation: z.ZodOptional<z.ZodBoolean>;
28
28
  timeoutMs: z.ZodOptional<z.ZodNumber>;
29
29
  apiKey: z.ZodOptional<z.ZodString>;
30
+ quoteOnly: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
30
31
  }, "strip", z.ZodTypeAny, {
31
32
  url: string;
32
33
  type: string;
33
34
  name: string;
34
35
  description: string;
35
36
  creator: string;
37
+ quoteOnly: boolean;
36
38
  tags?: string[] | undefined;
37
39
  properties?: Record<string, unknown> | undefined;
38
40
  chunkSize?: number | undefined;
@@ -56,6 +58,7 @@ declare const inscribeHashinalSchema: z.ZodObject<{
56
58
  waitForConfirmation?: boolean | undefined;
57
59
  timeoutMs?: number | undefined;
58
60
  apiKey?: string | undefined;
61
+ quoteOnly?: boolean | undefined;
59
62
  attributes?: {
60
63
  value: string | number;
61
64
  trait_type: string;
@@ -91,12 +94,14 @@ export declare class InscribeHashinalTool extends BaseInscriberQueryTool<typeof
91
94
  waitForConfirmation: z.ZodOptional<z.ZodBoolean>;
92
95
  timeoutMs: z.ZodOptional<z.ZodNumber>;
93
96
  apiKey: z.ZodOptional<z.ZodString>;
97
+ quoteOnly: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
94
98
  }, "strip", z.ZodTypeAny, {
95
99
  url: string;
96
100
  type: string;
97
101
  name: string;
98
102
  description: string;
99
103
  creator: string;
104
+ quoteOnly: boolean;
100
105
  tags?: string[] | undefined;
101
106
  properties?: Record<string, unknown> | undefined;
102
107
  chunkSize?: number | undefined;
@@ -120,6 +125,7 @@ export declare class InscribeHashinalTool extends BaseInscriberQueryTool<typeof
120
125
  waitForConfirmation?: boolean | undefined;
121
126
  timeoutMs?: number | undefined;
122
127
  apiKey?: string | undefined;
128
+ quoteOnly?: boolean | undefined;
123
129
  attributes?: {
124
130
  value: string | number;
125
131
  trait_type: string;
@@ -2,6 +2,7 @@ import { BaseHederaTransactionTool, BaseHederaQueryTool, BaseServiceBuilder } fr
2
2
  import { InscriberBuilder } from '../../builders/inscriber/inscriber-builder';
3
3
  import { InscriberTransactionToolParams, InscriberQueryToolParams } from './inscriber-tool-params';
4
4
  import { ContentResolverInterface } from '../../types/content-resolver';
5
+ import { InscriptionInput, InscriptionOptions, QuoteResult } from '@hashgraphonline/standards-sdk';
5
6
  import { z } from 'zod';
6
7
  /**
7
8
  * Base class for Inscriber transaction tools
@@ -19,6 +20,13 @@ export declare abstract class BaseInscriberTransactionTool<T extends z.ZodObject
19
20
  * Get content resolver with fallback to registry
20
21
  */
21
22
  protected getContentResolver(): ContentResolverInterface | null;
23
+ /**
24
+ * Generate a quote for an inscription without executing it
25
+ * @param input - The inscription input data
26
+ * @param options - Inscription options
27
+ * @returns Promise containing the quote result
28
+ */
29
+ protected generateInscriptionQuote(input: InscriptionInput, options: InscriptionOptions): Promise<QuoteResult>;
22
30
  }
23
31
  /**
24
32
  * Base class for Inscriber query tools
@@ -36,4 +44,11 @@ export declare abstract class BaseInscriberQueryTool<T extends z.ZodObject<z.Zod
36
44
  * Get content resolver with fallback to registry
37
45
  */
38
46
  protected getContentResolver(): ContentResolverInterface | null;
47
+ /**
48
+ * Generate a quote for an inscription without executing it
49
+ * @param input - The inscription input data
50
+ * @param options - Inscription options
51
+ * @returns Promise containing the quote result
52
+ */
53
+ protected generateInscriptionQuote(input: InscriptionInput, options: InscriptionOptions): Promise<QuoteResult>;
39
54
  }