@hashgraphonline/standards-agent-kit 0.2.154 → 0.2.155

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 (34) 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/es/standards-agent-kit.es24.js +1 -1
  4. package/dist/es/standards-agent-kit.es25.js +1 -1
  5. package/dist/es/standards-agent-kit.es26.js +1 -1
  6. package/dist/es/standards-agent-kit.es27.js +1 -1
  7. package/dist/es/standards-agent-kit.es28.js +1 -1
  8. package/dist/es/standards-agent-kit.es31.js +1 -1
  9. package/dist/es/standards-agent-kit.es32.js +1 -1
  10. package/dist/es/standards-agent-kit.es33.js +1 -1
  11. package/dist/es/standards-agent-kit.es36.js +1 -1
  12. package/dist/es/standards-agent-kit.es37.js +1 -1
  13. package/dist/es/standards-agent-kit.es38.js +3 -3
  14. package/dist/es/standards-agent-kit.es39.js +5 -5
  15. package/dist/es/standards-agent-kit.es50.js +20 -3
  16. package/dist/es/standards-agent-kit.es50.js.map +1 -1
  17. package/dist/es/standards-agent-kit.es51.js +50 -17
  18. package/dist/es/standards-agent-kit.es51.js.map +1 -1
  19. package/dist/es/standards-agent-kit.es52.js +3 -54
  20. package/dist/es/standards-agent-kit.es52.js.map +1 -1
  21. package/dist/es/standards-agent-kit.es53.js +39 -2
  22. package/dist/es/standards-agent-kit.es53.js.map +1 -1
  23. package/dist/es/standards-agent-kit.es54.js +17 -38
  24. package/dist/es/standards-agent-kit.es54.js.map +1 -1
  25. package/dist/es/standards-agent-kit.es55.js +71 -16
  26. package/dist/es/standards-agent-kit.es55.js.map +1 -1
  27. package/dist/es/standards-agent-kit.es56.js +3 -73
  28. package/dist/es/standards-agent-kit.es56.js.map +1 -1
  29. package/dist/es/standards-agent-kit.es8.js +55 -21
  30. package/dist/es/standards-agent-kit.es8.js.map +1 -1
  31. package/dist/umd/standards-agent-kit.umd.js +1 -1
  32. package/dist/umd/standards-agent-kit.umd.js.map +1 -1
  33. package/package.json +1 -1
  34. package/src/builders/inscriber/inscriber-builder.ts +61 -25
@@ -1,7 +1,7 @@
1
1
  import { z } from "zod";
2
2
  import { BaseHCS2QueryTool } from "./standards-agent-kit.es23.js";
3
3
  import { HCS2RegistryType } from "@hashgraphonline/standards-sdk";
4
- import { isWalletBytesResponse } from "./standards-agent-kit.es50.js";
4
+ import { isWalletBytesResponse } from "./standards-agent-kit.es56.js";
5
5
  const createRegistrySchema = z.object({
6
6
  registryType: z.nativeEnum(HCS2RegistryType).optional().describe("Registry type: 0 for indexed, 1 for non-indexed (default: 0)"),
7
7
  ttl: z.number().int().positive().optional().describe("Time to live in seconds (default: 86400)"),
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod";
2
2
  import { BaseHCS2QueryTool } from "./standards-agent-kit.es23.js";
3
- import { isWalletBytesResponse } from "./standards-agent-kit.es50.js";
3
+ import { isWalletBytesResponse } from "./standards-agent-kit.es56.js";
4
4
  const registerEntrySchema = z.object({
5
5
  registryTopicId: z.string().regex(/^\d+\.\d+\.\d+$/).describe("The HCS-2 registry topic ID (e.g., 0.0.123456)"),
6
6
  targetTopicId: z.string().regex(/^\d+\.\d+\.\d+$/).describe("The target topic ID to register (e.g., 0.0.123456)"),
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod";
2
2
  import { BaseHCS2QueryTool } from "./standards-agent-kit.es23.js";
3
- import { isWalletBytesResponse } from "./standards-agent-kit.es50.js";
3
+ import { isWalletBytesResponse } from "./standards-agent-kit.es56.js";
4
4
  const updateEntrySchema = z.object({
5
5
  registryTopicId: z.string().regex(/^\d+\.\d+\.\d+$/).describe("The HCS-2 registry topic ID (must be indexed)"),
6
6
  targetTopicId: z.string().regex(/^\d+\.\d+\.\d+$/).describe("The new topic ID to point to"),
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod";
2
2
  import { BaseHCS2QueryTool } from "./standards-agent-kit.es23.js";
3
- import { isWalletBytesResponse } from "./standards-agent-kit.es50.js";
3
+ import { isWalletBytesResponse } from "./standards-agent-kit.es56.js";
4
4
  const deleteEntrySchema = z.object({
5
5
  registryTopicId: z.string().regex(/^\d+\.\d+\.\d+$/).describe("The HCS-2 registry topic ID (must be indexed)"),
6
6
  uid: z.string().describe("The unique ID of the entry to delete"),
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod";
2
2
  import { BaseHCS2QueryTool } from "./standards-agent-kit.es23.js";
3
- import { isWalletBytesResponse } from "./standards-agent-kit.es50.js";
3
+ import { isWalletBytesResponse } from "./standards-agent-kit.es56.js";
4
4
  const migrateRegistrySchema = z.object({
5
5
  registryTopicId: z.string().regex(/^\d+\.\d+\.\d+$/).describe("The current HCS-2 registry topic ID"),
6
6
  targetTopicId: z.string().regex(/^\d+\.\d+\.\d+$/).describe("The new topic ID to migrate to"),
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod";
2
2
  import { BaseHCS6QueryTool } from "./standards-agent-kit.es30.js";
3
- import { isWalletBytesResponse } from "./standards-agent-kit.es50.js";
3
+ import { isWalletBytesResponse } from "./standards-agent-kit.es56.js";
4
4
  const CreateDynamicRegistrySchema = z.object({
5
5
  ttl: z.number().min(3600).default(86400).describe("Time-to-live in seconds (minimum 3600 seconds/1 hour)"),
6
6
  submitKey: z.union([z.boolean(), z.string()]).optional().describe("Submit key for the registry topic. Can be boolean (use operator key) or a public key string")
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod";
2
2
  import { BaseHCS6QueryTool } from "./standards-agent-kit.es30.js";
3
- import { isWalletBytesResponse } from "./standards-agent-kit.es50.js";
3
+ import { isWalletBytesResponse } from "./standards-agent-kit.es56.js";
4
4
  const RegisterDynamicHashinalSchema = z.object({
5
5
  metadata: z.record(z.unknown()).describe("Metadata object for the hashinal (e.g., name, description, attributes)"),
6
6
  data: z.object({
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod";
2
2
  import { BaseHCS6QueryTool } from "./standards-agent-kit.es30.js";
3
- import { isWalletBytesResponse } from "./standards-agent-kit.es50.js";
3
+ import { isWalletBytesResponse } from "./standards-agent-kit.es56.js";
4
4
  const UpdateDynamicHashinalSchema = z.object({
5
5
  registryTopicId: z.string().describe("The registry topic ID that tracks this dynamic hashinal"),
6
6
  metadata: z.record(z.unknown()).describe("Updated metadata object for the hashinal"),
@@ -1,7 +1,7 @@
1
1
  import { z } from "zod";
2
2
  import { BaseInscriberQueryTool } from "./standards-agent-kit.es35.js";
3
3
  import { Logger } from "@hashgraphonline/standards-sdk";
4
- import { extractTopicIds, buildInscriptionLinks } from "./standards-agent-kit.es51.js";
4
+ import { extractTopicIds, buildInscriptionLinks } from "./standards-agent-kit.es50.js";
5
5
  const logger = new Logger({ module: "InscribeFromUrlTool" });
6
6
  const inscribeFromUrlSchema = z.object({
7
7
  url: z.string().url().describe(
@@ -2,7 +2,7 @@ import { z } from "zod";
2
2
  import { BaseInscriberQueryTool } from "./standards-agent-kit.es35.js";
3
3
  import * as fs from "fs/promises";
4
4
  import * as path from "path";
5
- import { extractTopicIds, buildInscriptionLinks } from "./standards-agent-kit.es51.js";
5
+ import { extractTopicIds, buildInscriptionLinks } from "./standards-agent-kit.es50.js";
6
6
  const inscribeFromFileSchema = z.object({
7
7
  filePath: z.string().min(1, "File path cannot be empty").describe(
8
8
  "The file path of the content to inscribe. Must point to a valid, non-empty file."
@@ -1,9 +1,9 @@
1
1
  import { z } from "zod";
2
2
  import { BaseInscriberQueryTool } from "./standards-agent-kit.es35.js";
3
- import { resolveContent } from "./standards-agent-kit.es52.js";
4
- import { contentRefSchema } from "./standards-agent-kit.es53.js";
3
+ import { resolveContent } from "./standards-agent-kit.es51.js";
4
+ import { contentRefSchema } from "./standards-agent-kit.es52.js";
5
5
  import { loadConfig } from "./standards-agent-kit.es2.js";
6
- import { extractTopicIds, buildInscriptionLinks } from "./standards-agent-kit.es51.js";
6
+ import { extractTopicIds, buildInscriptionLinks } from "./standards-agent-kit.es50.js";
7
7
  const inscribeFromBufferSchema = z.object({
8
8
  base64Data: z.union([z.string(), contentRefSchema]).describe(
9
9
  "Content to inscribe as base64 data, plain text, or content reference"
@@ -1,12 +1,12 @@
1
1
  import { z } from "zod";
2
2
  import { BaseInscriberQueryTool } from "./standards-agent-kit.es35.js";
3
3
  import { Logger, ContentResolverRegistry } from "@hashgraphonline/standards-sdk";
4
- import { validateHIP412Metadata } from "./standards-agent-kit.es54.js";
5
- import { contentRefSchema } from "./standards-agent-kit.es53.js";
6
- import { generateDefaultMetadata } from "./standards-agent-kit.es55.js";
4
+ import { validateHIP412Metadata } from "./standards-agent-kit.es53.js";
5
+ import { contentRefSchema } from "./standards-agent-kit.es52.js";
6
+ import { generateDefaultMetadata } from "./standards-agent-kit.es54.js";
7
7
  import { extendZodSchema, renderConfigs } from "./standards-agent-kit.es44.js";
8
- import { createInscriptionError, createInscriptionQuote, createInscriptionSuccess, createInscriptionPending } from "./standards-agent-kit.es56.js";
9
- import { extractTopicIds, buildInscriptionLinks } from "./standards-agent-kit.es51.js";
8
+ import { createInscriptionError, createInscriptionQuote, createInscriptionSuccess, createInscriptionPending } from "./standards-agent-kit.es55.js";
9
+ import { extractTopicIds, buildInscriptionLinks } from "./standards-agent-kit.es50.js";
10
10
  const HASHLINK_BLOCK_CONFIG = {
11
11
  testnet: {
12
12
  blockId: "0.0.6617393",
@@ -1,7 +1,24 @@
1
- function isWalletBytesResponse(value) {
2
- return !!value && typeof value.transactionBytes === "string";
1
+ function getStringProp(obj, key) {
2
+ if (!obj || typeof obj !== "object") return void 0;
3
+ const val = obj[key];
4
+ return typeof val === "string" && val.trim() ? val : void 0;
5
+ }
6
+ function extractTopicIds(inscription, result) {
7
+ const jsonTopicId = inscription.jsonTopicId || getStringProp(inscription, "json_topic_id");
8
+ const imageTopicId = getStringProp(inscription, "topic_id") || getStringProp(inscription, "topicId") || getStringProp(result, "topicId") || getStringProp(result, "topic_id");
9
+ return {
10
+ jsonTopicId,
11
+ topicId: imageTopicId
12
+ };
13
+ }
14
+ function buildInscriptionLinks(ids, network, fileStandard = "1") {
15
+ const chosen = ids.jsonTopicId || ids.topicId;
16
+ const hrl = chosen ? `hcs://${fileStandard}/${chosen}` : void 0;
17
+ const cdnUrl = ids.jsonTopicId ? `https://kiloscribe.com/api/inscription-cdn/${ids.jsonTopicId}?network=${network}` : void 0;
18
+ return { hrl, cdnUrl, topicId: chosen };
3
19
  }
4
20
  export {
5
- isWalletBytesResponse
21
+ buildInscriptionLinks,
22
+ extractTopicIds
6
23
  };
7
24
  //# sourceMappingURL=standards-agent-kit.es50.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"standards-agent-kit.es50.js","sources":["../../src/types/tx-results.ts"],"sourcesContent":["import type { TopicRegistrationResponse, RegistryOperationResponse, HCS6TopicRegistrationResponse, HCS6RegistryOperationResponse, HCS6CreateHashinalResponse } from '@hashgraphonline/standards-sdk';\n\nexport interface WalletBytesResponse {\n success: true;\n transactionBytes: string;\n}\n\nexport function isWalletBytesResponse(value: unknown): value is WalletBytesResponse {\n return !!value && typeof (value as any).transactionBytes === 'string';\n}\n\nexport type TopicRegistrationResult = TopicRegistrationResponse | WalletBytesResponse;\nexport type RegistryOperationResult = RegistryOperationResponse | WalletBytesResponse;\nexport type SubmitMessageResult = { success: true; transactionId?: string } | WalletBytesResponse;\n\nexport type HCS6TopicRegistrationResult = HCS6TopicRegistrationResponse | WalletBytesResponse;\nexport type HCS6RegistryOperationResult = HCS6RegistryOperationResponse | WalletBytesResponse;\nexport type HCS6CreateHashinalResult = HCS6CreateHashinalResponse | WalletBytesResponse;\n"],"names":[],"mappings":"AAOO,SAAS,sBAAsB,OAA8C;AAClF,SAAO,CAAC,CAAC,SAAS,OAAQ,MAAc,qBAAqB;AAC/D;"}
1
+ {"version":3,"file":"standards-agent-kit.es50.js","sources":["../../src/utils/inscription-utils.ts"],"sourcesContent":["import { RetrievedInscriptionResult } from '@kiloscribe/inscription-sdk';\n\nexport type NetworkType = 'mainnet' | 'testnet';\n\nexport interface TopicIds {\n jsonTopicId?: string;\n topicId?: string;\n}\n\nfunction getStringProp(obj: unknown, key: string): string | undefined {\n if (!obj || typeof obj !== 'object') return undefined;\n const val = (obj as Record<string, unknown>)[key];\n return typeof val === 'string' && val.trim() ? val : undefined;\n}\n\n/**\n * Extract topic ids from an inscription and/or result object without using any.\n * - Prefers jsonTopicId when present (for CDN linking)\n * - Collects topic_id/topicId from either inscription or result\n */\nexport function extractTopicIds(\n inscription: RetrievedInscriptionResult,\n result?: unknown\n): TopicIds {\n const jsonTopicId =\n inscription.jsonTopicId || getStringProp(inscription, 'json_topic_id');\n\n const imageTopicId =\n getStringProp(inscription, 'topic_id') ||\n getStringProp(inscription, 'topicId') ||\n getStringProp(result, 'topicId') ||\n getStringProp(result, 'topic_id');\n\n return {\n jsonTopicId: jsonTopicId,\n topicId: imageTopicId,\n };\n}\n\n/**\n * Build HRL/CDN URLs from extracted topic ids.\n * - HRL prefers jsonTopicId, falls back to topicId\n * - CDN URL only provided when jsonTopicId is present\n */\nexport function buildInscriptionLinks(\n ids: TopicIds,\n network: NetworkType,\n fileStandard: string = '1'\n): { hrl?: string; cdnUrl?: string; topicId?: string } {\n const chosen = ids.jsonTopicId || ids.topicId;\n const hrl = chosen ? `hcs://${fileStandard}/${chosen}` : undefined;\n const cdnUrl = ids.jsonTopicId\n ? `https://kiloscribe.com/api/inscription-cdn/${ids.jsonTopicId}?network=${network}`\n : undefined;\n return { hrl, cdnUrl, topicId: chosen };\n}\n"],"names":[],"mappings":"AASA,SAAS,cAAc,KAAc,KAAiC;AACpE,MAAI,CAAC,OAAO,OAAO,QAAQ,SAAU,QAAO;AAC5C,QAAM,MAAO,IAAgC,GAAG;AAChD,SAAO,OAAO,QAAQ,YAAY,IAAI,KAAA,IAAS,MAAM;AACvD;AAOO,SAAS,gBACd,aACA,QACU;AACV,QAAM,cACJ,YAAY,eAAe,cAAc,aAAa,eAAe;AAEvE,QAAM,eACJ,cAAc,aAAa,UAAU,KACrC,cAAc,aAAa,SAAS,KACpC,cAAc,QAAQ,SAAS,KAC/B,cAAc,QAAQ,UAAU;AAElC,SAAO;AAAA,IACL;AAAA,IACA,SAAS;AAAA,EAAA;AAEb;AAOO,SAAS,sBACd,KACA,SACA,eAAuB,KAC8B;AACrD,QAAM,SAAS,IAAI,eAAe,IAAI;AACtC,QAAM,MAAM,SAAS,SAAS,YAAY,IAAI,MAAM,KAAK;AACzD,QAAM,SAAS,IAAI,cACf,8CAA8C,IAAI,WAAW,YAAY,OAAO,KAChF;AACJ,SAAO,EAAE,KAAK,QAAQ,SAAS,OAAA;AACjC;"}
@@ -1,24 +1,57 @@
1
- function getStringProp(obj, key) {
2
- if (!obj || typeof obj !== "object") return void 0;
3
- const val = obj[key];
4
- return typeof val === "string" && val.trim() ? val : void 0;
1
+ import { ContentResolverRegistry } from "@hashgraphonline/standards-sdk";
2
+ async function resolveContent(input, providedMimeType, providedFileName) {
3
+ const trimmedInput = input.trim();
4
+ const resolver = ContentResolverRegistry.getResolver();
5
+ if (!resolver) {
6
+ return handleDirectContent(
7
+ trimmedInput,
8
+ providedMimeType,
9
+ providedFileName
10
+ );
11
+ }
12
+ const referenceId = resolver.extractReferenceId(trimmedInput);
13
+ if (referenceId) {
14
+ try {
15
+ const resolution = await resolver.resolveReference(referenceId);
16
+ return {
17
+ buffer: resolution.content,
18
+ mimeType: resolution.metadata?.mimeType || providedMimeType,
19
+ fileName: resolution.metadata?.fileName || providedFileName,
20
+ wasReference: true
21
+ };
22
+ } catch (error) {
23
+ const errorMsg = error instanceof Error ? error.message : "Unknown error resolving reference";
24
+ throw new Error(`Reference resolution failed: ${errorMsg}`);
25
+ }
26
+ }
27
+ return handleDirectContent(trimmedInput, providedMimeType, providedFileName);
5
28
  }
6
- function extractTopicIds(inscription, result) {
7
- const jsonTopicId = inscription.jsonTopicId || getStringProp(inscription, "json_topic_id");
8
- const imageTopicId = getStringProp(inscription, "topic_id") || getStringProp(inscription, "topicId") || getStringProp(result, "topicId") || getStringProp(result, "topic_id");
29
+ function handleDirectContent(input, providedMimeType, providedFileName) {
30
+ const isValidBase64 = /^[A-Za-z0-9+/]*={0,2}$/.test(input);
31
+ if (isValidBase64) {
32
+ try {
33
+ const buffer2 = Buffer.from(input, "base64");
34
+ return {
35
+ buffer: buffer2,
36
+ mimeType: providedMimeType,
37
+ fileName: providedFileName,
38
+ wasReference: false
39
+ };
40
+ } catch (error) {
41
+ throw new Error(
42
+ "Failed to decode base64 data. Please ensure the data is properly encoded."
43
+ );
44
+ }
45
+ }
46
+ const buffer = Buffer.from(input, "utf8");
9
47
  return {
10
- jsonTopicId,
11
- topicId: imageTopicId
48
+ buffer,
49
+ mimeType: providedMimeType || "text/plain",
50
+ fileName: providedFileName,
51
+ wasReference: false
12
52
  };
13
53
  }
14
- function buildInscriptionLinks(ids, network, fileStandard = "1") {
15
- const chosen = ids.jsonTopicId || ids.topicId;
16
- const hrl = chosen ? `hcs://${fileStandard}/${chosen}` : void 0;
17
- const cdnUrl = ids.jsonTopicId ? `https://kiloscribe.com/api/inscription-cdn/${ids.jsonTopicId}?network=${network}` : void 0;
18
- return { hrl, cdnUrl, topicId: chosen };
19
- }
20
54
  export {
21
- buildInscriptionLinks,
22
- extractTopicIds
55
+ resolveContent
23
56
  };
24
57
  //# sourceMappingURL=standards-agent-kit.es51.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"standards-agent-kit.es51.js","sources":["../../src/utils/inscription-utils.ts"],"sourcesContent":["import { RetrievedInscriptionResult } from '@kiloscribe/inscription-sdk';\n\nexport type NetworkType = 'mainnet' | 'testnet';\n\nexport interface TopicIds {\n jsonTopicId?: string;\n topicId?: string;\n}\n\nfunction getStringProp(obj: unknown, key: string): string | undefined {\n if (!obj || typeof obj !== 'object') return undefined;\n const val = (obj as Record<string, unknown>)[key];\n return typeof val === 'string' && val.trim() ? val : undefined;\n}\n\n/**\n * Extract topic ids from an inscription and/or result object without using any.\n * - Prefers jsonTopicId when present (for CDN linking)\n * - Collects topic_id/topicId from either inscription or result\n */\nexport function extractTopicIds(\n inscription: RetrievedInscriptionResult,\n result?: unknown\n): TopicIds {\n const jsonTopicId =\n inscription.jsonTopicId || getStringProp(inscription, 'json_topic_id');\n\n const imageTopicId =\n getStringProp(inscription, 'topic_id') ||\n getStringProp(inscription, 'topicId') ||\n getStringProp(result, 'topicId') ||\n getStringProp(result, 'topic_id');\n\n return {\n jsonTopicId: jsonTopicId,\n topicId: imageTopicId,\n };\n}\n\n/**\n * Build HRL/CDN URLs from extracted topic ids.\n * - HRL prefers jsonTopicId, falls back to topicId\n * - CDN URL only provided when jsonTopicId is present\n */\nexport function buildInscriptionLinks(\n ids: TopicIds,\n network: NetworkType,\n fileStandard: string = '1'\n): { hrl?: string; cdnUrl?: string; topicId?: string } {\n const chosen = ids.jsonTopicId || ids.topicId;\n const hrl = chosen ? `hcs://${fileStandard}/${chosen}` : undefined;\n const cdnUrl = ids.jsonTopicId\n ? `https://kiloscribe.com/api/inscription-cdn/${ids.jsonTopicId}?network=${network}`\n : undefined;\n return { hrl, cdnUrl, topicId: chosen };\n}\n"],"names":[],"mappings":"AASA,SAAS,cAAc,KAAc,KAAiC;AACpE,MAAI,CAAC,OAAO,OAAO,QAAQ,SAAU,QAAO;AAC5C,QAAM,MAAO,IAAgC,GAAG;AAChD,SAAO,OAAO,QAAQ,YAAY,IAAI,KAAA,IAAS,MAAM;AACvD;AAOO,SAAS,gBACd,aACA,QACU;AACV,QAAM,cACJ,YAAY,eAAe,cAAc,aAAa,eAAe;AAEvE,QAAM,eACJ,cAAc,aAAa,UAAU,KACrC,cAAc,aAAa,SAAS,KACpC,cAAc,QAAQ,SAAS,KAC/B,cAAc,QAAQ,UAAU;AAElC,SAAO;AAAA,IACL;AAAA,IACA,SAAS;AAAA,EAAA;AAEb;AAOO,SAAS,sBACd,KACA,SACA,eAAuB,KAC8B;AACrD,QAAM,SAAS,IAAI,eAAe,IAAI;AACtC,QAAM,MAAM,SAAS,SAAS,YAAY,IAAI,MAAM,KAAK;AACzD,QAAM,SAAS,IAAI,cACf,8CAA8C,IAAI,WAAW,YAAY,OAAO,KAChF;AACJ,SAAO,EAAE,KAAK,QAAQ,SAAS,OAAA;AACjC;"}
1
+ {"version":3,"file":"standards-agent-kit.es51.js","sources":["../../src/utils/content-resolver.ts"],"sourcesContent":["import { ContentResolverRegistry } from '@hashgraphonline/standards-sdk';\n\nexport interface ContentResolutionResult {\n buffer: Buffer;\n mimeType?: string;\n fileName?: string;\n wasReference?: boolean;\n}\n\n/**\n * Resolves content from various input formats (content-ref, base64, plain text)\n */\nexport async function resolveContent(\n input: string,\n providedMimeType?: string,\n providedFileName?: string\n): Promise<ContentResolutionResult> {\n const trimmedInput = input.trim();\n\n const resolver = ContentResolverRegistry.getResolver();\n\n if (!resolver) {\n return 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 handleDirectContent(trimmedInput, providedMimeType, providedFileName);\n}\n\n/**\n * Handles direct content (base64 or plain text)\n */\nfunction handleDirectContent(\n input: string,\n providedMimeType?: string,\n providedFileName?: string\n): ContentResolutionResult {\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"],"names":["buffer"],"mappings":";AAYA,eAAsB,eACpB,OACA,kBACA,kBACkC;AAClC,QAAM,eAAe,MAAM,KAAA;AAE3B,QAAM,WAAW,wBAAwB,YAAA;AAEzC,MAAI,CAAC,UAAU;AACb,WAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,IAAA;AAAA,EAEJ;AAEA,QAAM,cAAc,SAAS,mBAAmB,YAAY;AAE5D,MAAI,aAAa;AACf,QAAI;AACF,YAAM,aAAa,MAAM,SAAS,iBAAiB,WAAW;AAE9D,aAAO;AAAA,QACL,QAAQ,WAAW;AAAA,QACnB,UAAU,WAAW,UAAU,YAAY;AAAA,QAC3C,UAAU,WAAW,UAAU,YAAY;AAAA,QAC3C,cAAc;AAAA,MAAA;AAAA,IAElB,SAAS,OAAO;AACd,YAAM,WACJ,iBAAiB,QACb,MAAM,UACN;AACN,YAAM,IAAI,MAAM,gCAAgC,QAAQ,EAAE;AAAA,IAC5D;AAAA,EACF;AAEA,SAAO,oBAAoB,cAAc,kBAAkB,gBAAgB;AAC7E;AAKA,SAAS,oBACP,OACA,kBACA,kBACyB;AACzB,QAAM,gBAAgB,yBAAyB,KAAK,KAAK;AAEzD,MAAI,eAAe;AACjB,QAAI;AACF,YAAMA,UAAS,OAAO,KAAK,OAAO,QAAQ;AAC1C,aAAO;AAAA,QACL,QAAAA;AAAAA,QACA,UAAU;AAAA,QACV,UAAU;AAAA,QACV,cAAc;AAAA,MAAA;AAAA,IAElB,SAAS,OAAO;AACd,YAAM,IAAI;AAAA,QACR;AAAA,MAAA;AAAA,IAEJ;AAAA,EACF;AAEA,QAAM,SAAS,OAAO,KAAK,OAAO,MAAM;AACxC,SAAO;AAAA,IACL;AAAA,IACA,UAAU,oBAAoB;AAAA,IAC9B,UAAU;AAAA,IACV,cAAc;AAAA,EAAA;AAElB;"}
@@ -1,57 +1,6 @@
1
- import { ContentResolverRegistry } from "@hashgraphonline/standards-sdk";
2
- async function resolveContent(input, providedMimeType, providedFileName) {
3
- const trimmedInput = input.trim();
4
- const resolver = ContentResolverRegistry.getResolver();
5
- if (!resolver) {
6
- return handleDirectContent(
7
- trimmedInput,
8
- providedMimeType,
9
- providedFileName
10
- );
11
- }
12
- const referenceId = resolver.extractReferenceId(trimmedInput);
13
- if (referenceId) {
14
- try {
15
- const resolution = await resolver.resolveReference(referenceId);
16
- return {
17
- buffer: resolution.content,
18
- mimeType: resolution.metadata?.mimeType || providedMimeType,
19
- fileName: resolution.metadata?.fileName || providedFileName,
20
- wasReference: true
21
- };
22
- } catch (error) {
23
- const errorMsg = error instanceof Error ? error.message : "Unknown error resolving reference";
24
- throw new Error(`Reference resolution failed: ${errorMsg}`);
25
- }
26
- }
27
- return handleDirectContent(trimmedInput, providedMimeType, providedFileName);
28
- }
29
- function handleDirectContent(input, providedMimeType, providedFileName) {
30
- const isValidBase64 = /^[A-Za-z0-9+/]*={0,2}$/.test(input);
31
- if (isValidBase64) {
32
- try {
33
- const buffer2 = Buffer.from(input, "base64");
34
- return {
35
- buffer: buffer2,
36
- mimeType: providedMimeType,
37
- fileName: providedFileName,
38
- wasReference: false
39
- };
40
- } catch (error) {
41
- throw new Error(
42
- "Failed to decode base64 data. Please ensure the data is properly encoded."
43
- );
44
- }
45
- }
46
- const buffer = Buffer.from(input, "utf8");
47
- return {
48
- buffer,
49
- mimeType: providedMimeType || "text/plain",
50
- fileName: providedFileName,
51
- wasReference: false
52
- };
53
- }
1
+ import { z } from "zod";
2
+ const contentRefSchema = z.string().regex(/^content-ref:[a-zA-Z0-9_-]+$/, 'Content reference must be in format "content-ref:[alphanumeric-id]"').describe('Content reference in format "content-ref:[id]"');
54
3
  export {
55
- resolveContent
4
+ contentRefSchema
56
5
  };
57
6
  //# sourceMappingURL=standards-agent-kit.es52.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"standards-agent-kit.es52.js","sources":["../../src/utils/content-resolver.ts"],"sourcesContent":["import { ContentResolverRegistry } from '@hashgraphonline/standards-sdk';\n\nexport interface ContentResolutionResult {\n buffer: Buffer;\n mimeType?: string;\n fileName?: string;\n wasReference?: boolean;\n}\n\n/**\n * Resolves content from various input formats (content-ref, base64, plain text)\n */\nexport async function resolveContent(\n input: string,\n providedMimeType?: string,\n providedFileName?: string\n): Promise<ContentResolutionResult> {\n const trimmedInput = input.trim();\n\n const resolver = ContentResolverRegistry.getResolver();\n\n if (!resolver) {\n return 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 handleDirectContent(trimmedInput, providedMimeType, providedFileName);\n}\n\n/**\n * Handles direct content (base64 or plain text)\n */\nfunction handleDirectContent(\n input: string,\n providedMimeType?: string,\n providedFileName?: string\n): ContentResolutionResult {\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"],"names":["buffer"],"mappings":";AAYA,eAAsB,eACpB,OACA,kBACA,kBACkC;AAClC,QAAM,eAAe,MAAM,KAAA;AAE3B,QAAM,WAAW,wBAAwB,YAAA;AAEzC,MAAI,CAAC,UAAU;AACb,WAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,IAAA;AAAA,EAEJ;AAEA,QAAM,cAAc,SAAS,mBAAmB,YAAY;AAE5D,MAAI,aAAa;AACf,QAAI;AACF,YAAM,aAAa,MAAM,SAAS,iBAAiB,WAAW;AAE9D,aAAO;AAAA,QACL,QAAQ,WAAW;AAAA,QACnB,UAAU,WAAW,UAAU,YAAY;AAAA,QAC3C,UAAU,WAAW,UAAU,YAAY;AAAA,QAC3C,cAAc;AAAA,MAAA;AAAA,IAElB,SAAS,OAAO;AACd,YAAM,WACJ,iBAAiB,QACb,MAAM,UACN;AACN,YAAM,IAAI,MAAM,gCAAgC,QAAQ,EAAE;AAAA,IAC5D;AAAA,EACF;AAEA,SAAO,oBAAoB,cAAc,kBAAkB,gBAAgB;AAC7E;AAKA,SAAS,oBACP,OACA,kBACA,kBACyB;AACzB,QAAM,gBAAgB,yBAAyB,KAAK,KAAK;AAEzD,MAAI,eAAe;AACjB,QAAI;AACF,YAAMA,UAAS,OAAO,KAAK,OAAO,QAAQ;AAC1C,aAAO;AAAA,QACL,QAAAA;AAAAA,QACA,UAAU;AAAA,QACV,UAAU;AAAA,QACV,cAAc;AAAA,MAAA;AAAA,IAElB,SAAS,OAAO;AACd,YAAM,IAAI;AAAA,QACR;AAAA,MAAA;AAAA,IAEJ;AAAA,EACF;AAEA,QAAM,SAAS,OAAO,KAAK,OAAO,MAAM;AACxC,SAAO;AAAA,IACL;AAAA,IACA,UAAU,oBAAoB;AAAA,IAC9B,UAAU;AAAA,IACV,cAAc;AAAA,EAAA;AAElB;"}
1
+ {"version":3,"file":"standards-agent-kit.es52.js","sources":["../../src/validation/content-ref-schemas.ts"],"sourcesContent":["import { z } from 'zod';\n\n/**\n * Validates content reference format\n */\nexport const contentRefSchema = z\n .string()\n .regex(/^content-ref:[a-zA-Z0-9_-]+$/, 'Content reference must be in format \"content-ref:[alphanumeric-id]\"')\n .describe('Content reference in format \"content-ref:[id]\"');\n\n/**\n * Validates content reference or returns error for dumber models\n */\nexport function validateContentRef(input: string): string {\n try {\n return contentRefSchema.parse(input);\n } catch (error) {\n throw new Error(`Invalid content reference format. Expected \"content-ref:[alphanumeric-id]\" but got \"${input}\"`);\n }\n}"],"names":[],"mappings":";AAKO,MAAM,mBAAmB,EAC7B,SACA,MAAM,gCAAgC,qEAAqE,EAC3G,SAAS,gDAAgD;"}
@@ -1,6 +1,43 @@
1
1
  import { z } from "zod";
2
- const contentRefSchema = z.string().regex(/^content-ref:[a-zA-Z0-9_-]+$/, 'Content reference must be in format "content-ref:[alphanumeric-id]"').describe('Content reference in format "content-ref:[id]"');
2
+ const hip412FileSchema = z.object({
3
+ uri: z.string().describe("URI of the file"),
4
+ checksum: z.string().optional().describe("SHA-256 checksum of the file"),
5
+ is_default_file: z.boolean().optional().describe("Whether this is the default file"),
6
+ type: z.string().describe("MIME type of the file")
7
+ });
8
+ const hip412AttributeSchema = z.object({
9
+ trait_type: z.string().describe("The trait type"),
10
+ value: z.union([z.string(), z.number()]).describe("The trait value"),
11
+ display_type: z.string().optional().describe("Display type for the attribute")
12
+ });
13
+ const hip412MetadataSchema = z.object({
14
+ name: z.string().describe("Token name (required by HIP-412)"),
15
+ description: z.string().describe("Human readable description (required by HIP-412)"),
16
+ image: z.string().describe("Preview image URI (required by HIP-412)"),
17
+ type: z.string().describe("MIME type (required by HIP-412)"),
18
+ creator: z.string().optional().describe("Creator name or comma-separated names"),
19
+ creatorDID: z.string().optional().describe("Decentralized identifier for creator"),
20
+ checksum: z.string().optional().describe("SHA-256 checksum of the image"),
21
+ format: z.string().optional().default("HIP412@2.0.0").describe("Metadata format version"),
22
+ files: z.array(hip412FileSchema).optional().describe("Array of files for multi-file NFTs"),
23
+ attributes: z.array(hip412AttributeSchema).optional().describe("NFT attributes/traits"),
24
+ properties: z.record(z.unknown()).optional().describe("Additional properties")
25
+ });
26
+ function validateHIP412Metadata(metadata) {
27
+ try {
28
+ return hip412MetadataSchema.parse(metadata);
29
+ } catch (error) {
30
+ if (error instanceof z.ZodError) {
31
+ const issues = error.errors.map((err) => `${err.path.join(".")}: ${err.message}`).join("; ");
32
+ throw new Error(`HIP-412 metadata validation failed: ${issues}`);
33
+ }
34
+ throw error;
35
+ }
36
+ }
3
37
  export {
4
- contentRefSchema
38
+ hip412AttributeSchema,
39
+ hip412FileSchema,
40
+ hip412MetadataSchema,
41
+ validateHIP412Metadata
5
42
  };
6
43
  //# sourceMappingURL=standards-agent-kit.es53.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"standards-agent-kit.es53.js","sources":["../../src/validation/content-ref-schemas.ts"],"sourcesContent":["import { z } from 'zod';\n\n/**\n * Validates content reference format\n */\nexport const contentRefSchema = z\n .string()\n .regex(/^content-ref:[a-zA-Z0-9_-]+$/, 'Content reference must be in format \"content-ref:[alphanumeric-id]\"')\n .describe('Content reference in format \"content-ref:[id]\"');\n\n/**\n * Validates content reference or returns error for dumber models\n */\nexport function validateContentRef(input: string): string {\n try {\n return contentRefSchema.parse(input);\n } catch (error) {\n throw new Error(`Invalid content reference format. Expected \"content-ref:[alphanumeric-id]\" but got \"${input}\"`);\n }\n}"],"names":[],"mappings":";AAKO,MAAM,mBAAmB,EAC7B,SACA,MAAM,gCAAgC,qEAAqE,EAC3G,SAAS,gDAAgD;"}
1
+ {"version":3,"file":"standards-agent-kit.es53.js","sources":["../../src/validation/hip412-schemas.ts"],"sourcesContent":["import { z } from 'zod';\n\n/**\n * HIP-412 file schema for multi-file NFTs\n */\nexport const hip412FileSchema = z.object({\n uri: z.string().describe('URI of the file'),\n checksum: z.string().optional().describe('SHA-256 checksum of the file'),\n is_default_file: z.boolean().optional().describe('Whether this is the default file'),\n type: z.string().describe('MIME type of the file'),\n});\n\n/**\n * HIP-412 attribute schema for NFT traits\n */\nexport const hip412AttributeSchema = z.object({\n trait_type: z.string().describe('The trait type'),\n value: z.union([z.string(), z.number()]).describe('The trait value'),\n display_type: z.string().optional().describe('Display type for the attribute'),\n});\n\n/**\n * HIP-412 compliant metadata schema for Hedera NFTs\n */\nexport const hip412MetadataSchema = z.object({\n name: z.string().describe('Token name (required by HIP-412)'),\n description: z.string().describe('Human readable description (required by HIP-412)'),\n image: z.string().describe('Preview image URI (required by HIP-412)'),\n type: z.string().describe('MIME type (required by HIP-412)'),\n creator: z.string().optional().describe('Creator name or comma-separated names'),\n creatorDID: z.string().optional().describe('Decentralized identifier for creator'),\n checksum: z.string().optional().describe('SHA-256 checksum of the image'),\n format: z.string().optional().default('HIP412@2.0.0').describe('Metadata format version'),\n files: z.array(hip412FileSchema).optional().describe('Array of files for multi-file NFTs'),\n attributes: z.array(hip412AttributeSchema).optional().describe('NFT attributes/traits'),\n properties: z.record(z.unknown()).optional().describe('Additional properties'),\n});\n\n/**\n * Validates metadata against HIP-412 standard\n */\nexport function validateHIP412Metadata(metadata: unknown): z.infer<typeof hip412MetadataSchema> {\n try {\n return hip412MetadataSchema.parse(metadata);\n } catch (error) {\n if (error instanceof z.ZodError) {\n const issues = error.errors.map(err => `${err.path.join('.')}: ${err.message}`).join('; ');\n throw new Error(`HIP-412 metadata validation failed: ${issues}`);\n }\n throw error;\n }\n}"],"names":[],"mappings":";AAKO,MAAM,mBAAmB,EAAE,OAAO;AAAA,EACvC,KAAK,EAAE,SAAS,SAAS,iBAAiB;AAAA,EAC1C,UAAU,EAAE,OAAA,EAAS,SAAA,EAAW,SAAS,8BAA8B;AAAA,EACvE,iBAAiB,EAAE,QAAA,EAAU,SAAA,EAAW,SAAS,kCAAkC;AAAA,EACnF,MAAM,EAAE,OAAA,EAAS,SAAS,uBAAuB;AACnD,CAAC;AAKM,MAAM,wBAAwB,EAAE,OAAO;AAAA,EAC5C,YAAY,EAAE,SAAS,SAAS,gBAAgB;AAAA,EAChD,OAAO,EAAE,MAAM,CAAC,EAAE,OAAA,GAAU,EAAE,OAAA,CAAQ,CAAC,EAAE,SAAS,iBAAiB;AAAA,EACnE,cAAc,EAAE,OAAA,EAAS,SAAA,EAAW,SAAS,gCAAgC;AAC/E,CAAC;AAKM,MAAM,uBAAuB,EAAE,OAAO;AAAA,EAC3C,MAAM,EAAE,SAAS,SAAS,kCAAkC;AAAA,EAC5D,aAAa,EAAE,SAAS,SAAS,kDAAkD;AAAA,EACnF,OAAO,EAAE,SAAS,SAAS,yCAAyC;AAAA,EACpE,MAAM,EAAE,SAAS,SAAS,iCAAiC;AAAA,EAC3D,SAAS,EAAE,OAAA,EAAS,SAAA,EAAW,SAAS,uCAAuC;AAAA,EAC/E,YAAY,EAAE,OAAA,EAAS,SAAA,EAAW,SAAS,sCAAsC;AAAA,EACjF,UAAU,EAAE,OAAA,EAAS,SAAA,EAAW,SAAS,+BAA+B;AAAA,EACxE,QAAQ,EAAE,OAAA,EAAS,SAAA,EAAW,QAAQ,cAAc,EAAE,SAAS,yBAAyB;AAAA,EACxF,OAAO,EAAE,MAAM,gBAAgB,EAAE,SAAA,EAAW,SAAS,oCAAoC;AAAA,EACzF,YAAY,EAAE,MAAM,qBAAqB,EAAE,SAAA,EAAW,SAAS,uBAAuB;AAAA,EACtF,YAAY,EAAE,OAAO,EAAE,QAAA,CAAS,EAAE,WAAW,SAAS,uBAAuB;AAC/E,CAAC;AAKM,SAAS,uBAAuB,UAAyD;AAC9F,MAAI;AACF,WAAO,qBAAqB,MAAM,QAAQ;AAAA,EAC5C,SAAS,OAAO;AACd,QAAI,iBAAiB,EAAE,UAAU;AAC/B,YAAM,SAAS,MAAM,OAAO,IAAI,CAAA,QAAO,GAAG,IAAI,KAAK,KAAK,GAAG,CAAC,KAAK,IAAI,OAAO,EAAE,EAAE,KAAK,IAAI;AACzF,YAAM,IAAI,MAAM,uCAAuC,MAAM,EAAE;AAAA,IACjE;AACA,UAAM;AAAA,EACR;AACF;"}
@@ -1,43 +1,22 @@
1
- import { z } from "zod";
2
- const hip412FileSchema = z.object({
3
- uri: z.string().describe("URI of the file"),
4
- checksum: z.string().optional().describe("SHA-256 checksum of the file"),
5
- is_default_file: z.boolean().optional().describe("Whether this is the default file"),
6
- type: z.string().describe("MIME type of the file")
7
- });
8
- const hip412AttributeSchema = z.object({
9
- trait_type: z.string().describe("The trait type"),
10
- value: z.union([z.string(), z.number()]).describe("The trait value"),
11
- display_type: z.string().optional().describe("Display type for the attribute")
12
- });
13
- const hip412MetadataSchema = z.object({
14
- name: z.string().describe("Token name (required by HIP-412)"),
15
- description: z.string().describe("Human readable description (required by HIP-412)"),
16
- image: z.string().describe("Preview image URI (required by HIP-412)"),
17
- type: z.string().describe("MIME type (required by HIP-412)"),
18
- creator: z.string().optional().describe("Creator name or comma-separated names"),
19
- creatorDID: z.string().optional().describe("Decentralized identifier for creator"),
20
- checksum: z.string().optional().describe("SHA-256 checksum of the image"),
21
- format: z.string().optional().default("HIP412@2.0.0").describe("Metadata format version"),
22
- files: z.array(hip412FileSchema).optional().describe("Array of files for multi-file NFTs"),
23
- attributes: z.array(hip412AttributeSchema).optional().describe("NFT attributes/traits"),
24
- properties: z.record(z.unknown()).optional().describe("Additional properties")
25
- });
26
- function validateHIP412Metadata(metadata) {
27
- try {
28
- return hip412MetadataSchema.parse(metadata);
29
- } catch (error) {
30
- if (error instanceof z.ZodError) {
31
- const issues = error.errors.map((err) => `${err.path.join(".")}: ${err.message}`).join("; ");
32
- throw new Error(`HIP-412 metadata validation failed: ${issues}`);
33
- }
34
- throw error;
1
+ function generateDefaultMetadata(params) {
2
+ const defaultName = params.fileName?.replace(/\.[^/.]+$/, "") || "Hashinal NFT";
3
+ let defaultType = "media";
4
+ if (params.mimeType?.startsWith("image/")) {
5
+ defaultType = "image";
6
+ } else if (params.mimeType?.startsWith("video/")) {
7
+ defaultType = "video";
8
+ } else if (params.mimeType?.startsWith("audio/")) {
9
+ defaultType = "audio";
35
10
  }
11
+ return {
12
+ name: params.name || defaultName,
13
+ creator: params.creator || params.operatorAccount,
14
+ description: params.description || `${defaultType.charAt(0).toUpperCase() + defaultType.slice(1)} NFT inscribed as Hashinal`,
15
+ type: params.type || defaultType,
16
+ image: ""
17
+ };
36
18
  }
37
19
  export {
38
- hip412AttributeSchema,
39
- hip412FileSchema,
40
- hip412MetadataSchema,
41
- validateHIP412Metadata
20
+ generateDefaultMetadata
42
21
  };
43
22
  //# sourceMappingURL=standards-agent-kit.es54.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"standards-agent-kit.es54.js","sources":["../../src/validation/hip412-schemas.ts"],"sourcesContent":["import { z } from 'zod';\n\n/**\n * HIP-412 file schema for multi-file NFTs\n */\nexport const hip412FileSchema = z.object({\n uri: z.string().describe('URI of the file'),\n checksum: z.string().optional().describe('SHA-256 checksum of the file'),\n is_default_file: z.boolean().optional().describe('Whether this is the default file'),\n type: z.string().describe('MIME type of the file'),\n});\n\n/**\n * HIP-412 attribute schema for NFT traits\n */\nexport const hip412AttributeSchema = z.object({\n trait_type: z.string().describe('The trait type'),\n value: z.union([z.string(), z.number()]).describe('The trait value'),\n display_type: z.string().optional().describe('Display type for the attribute'),\n});\n\n/**\n * HIP-412 compliant metadata schema for Hedera NFTs\n */\nexport const hip412MetadataSchema = z.object({\n name: z.string().describe('Token name (required by HIP-412)'),\n description: z.string().describe('Human readable description (required by HIP-412)'),\n image: z.string().describe('Preview image URI (required by HIP-412)'),\n type: z.string().describe('MIME type (required by HIP-412)'),\n creator: z.string().optional().describe('Creator name or comma-separated names'),\n creatorDID: z.string().optional().describe('Decentralized identifier for creator'),\n checksum: z.string().optional().describe('SHA-256 checksum of the image'),\n format: z.string().optional().default('HIP412@2.0.0').describe('Metadata format version'),\n files: z.array(hip412FileSchema).optional().describe('Array of files for multi-file NFTs'),\n attributes: z.array(hip412AttributeSchema).optional().describe('NFT attributes/traits'),\n properties: z.record(z.unknown()).optional().describe('Additional properties'),\n});\n\n/**\n * Validates metadata against HIP-412 standard\n */\nexport function validateHIP412Metadata(metadata: unknown): z.infer<typeof hip412MetadataSchema> {\n try {\n return hip412MetadataSchema.parse(metadata);\n } catch (error) {\n if (error instanceof z.ZodError) {\n const issues = error.errors.map(err => `${err.path.join('.')}: ${err.message}`).join('; ');\n throw new Error(`HIP-412 metadata validation failed: ${issues}`);\n }\n throw error;\n }\n}"],"names":[],"mappings":";AAKO,MAAM,mBAAmB,EAAE,OAAO;AAAA,EACvC,KAAK,EAAE,SAAS,SAAS,iBAAiB;AAAA,EAC1C,UAAU,EAAE,OAAA,EAAS,SAAA,EAAW,SAAS,8BAA8B;AAAA,EACvE,iBAAiB,EAAE,QAAA,EAAU,SAAA,EAAW,SAAS,kCAAkC;AAAA,EACnF,MAAM,EAAE,OAAA,EAAS,SAAS,uBAAuB;AACnD,CAAC;AAKM,MAAM,wBAAwB,EAAE,OAAO;AAAA,EAC5C,YAAY,EAAE,SAAS,SAAS,gBAAgB;AAAA,EAChD,OAAO,EAAE,MAAM,CAAC,EAAE,OAAA,GAAU,EAAE,OAAA,CAAQ,CAAC,EAAE,SAAS,iBAAiB;AAAA,EACnE,cAAc,EAAE,OAAA,EAAS,SAAA,EAAW,SAAS,gCAAgC;AAC/E,CAAC;AAKM,MAAM,uBAAuB,EAAE,OAAO;AAAA,EAC3C,MAAM,EAAE,SAAS,SAAS,kCAAkC;AAAA,EAC5D,aAAa,EAAE,SAAS,SAAS,kDAAkD;AAAA,EACnF,OAAO,EAAE,SAAS,SAAS,yCAAyC;AAAA,EACpE,MAAM,EAAE,SAAS,SAAS,iCAAiC;AAAA,EAC3D,SAAS,EAAE,OAAA,EAAS,SAAA,EAAW,SAAS,uCAAuC;AAAA,EAC/E,YAAY,EAAE,OAAA,EAAS,SAAA,EAAW,SAAS,sCAAsC;AAAA,EACjF,UAAU,EAAE,OAAA,EAAS,SAAA,EAAW,SAAS,+BAA+B;AAAA,EACxE,QAAQ,EAAE,OAAA,EAAS,SAAA,EAAW,QAAQ,cAAc,EAAE,SAAS,yBAAyB;AAAA,EACxF,OAAO,EAAE,MAAM,gBAAgB,EAAE,SAAA,EAAW,SAAS,oCAAoC;AAAA,EACzF,YAAY,EAAE,MAAM,qBAAqB,EAAE,SAAA,EAAW,SAAS,uBAAuB;AAAA,EACtF,YAAY,EAAE,OAAO,EAAE,QAAA,CAAS,EAAE,WAAW,SAAS,uBAAuB;AAC/E,CAAC;AAKM,SAAS,uBAAuB,UAAyD;AAC9F,MAAI;AACF,WAAO,qBAAqB,MAAM,QAAQ;AAAA,EAC5C,SAAS,OAAO;AACd,QAAI,iBAAiB,EAAE,UAAU;AAC/B,YAAM,SAAS,MAAM,OAAO,IAAI,CAAA,QAAO,GAAG,IAAI,KAAK,KAAK,GAAG,CAAC,KAAK,IAAI,OAAO,EAAE,EAAE,KAAK,IAAI;AACzF,YAAM,IAAI,MAAM,uCAAuC,MAAM,EAAE;AAAA,IACjE;AACA,UAAM;AAAA,EACR;AACF;"}
1
+ {"version":3,"file":"standards-agent-kit.es54.js","sources":["../../src/utils/metadata-defaults.ts"],"sourcesContent":["/**\n * Generates default metadata for NFT inscription\n */\nexport function generateDefaultMetadata(params: {\n name?: string;\n creator?: string;\n description?: string;\n type?: string;\n fileName?: string;\n mimeType?: string;\n operatorAccount: string;\n}): {\n name: string;\n creator: string;\n description: string;\n type: string;\n image: string;\n} {\n const defaultName = params.fileName?.replace(/\\.[^/.]+$/, '') || 'Hashinal NFT';\n let defaultType = 'media';\n if (params.mimeType?.startsWith('image/')) {\n defaultType = 'image';\n } else if (params.mimeType?.startsWith('video/')) {\n defaultType = 'video';\n } else if (params.mimeType?.startsWith('audio/')) {\n defaultType = 'audio';\n }\n\n return {\n name: params.name || defaultName,\n creator: params.creator || params.operatorAccount,\n description: params.description || `${defaultType.charAt(0).toUpperCase() + defaultType.slice(1)} NFT inscribed as Hashinal`,\n type: params.type || defaultType,\n image: '',\n };\n}"],"names":[],"mappings":"AAGO,SAAS,wBAAwB,QActC;AACA,QAAM,cAAc,OAAO,UAAU,QAAQ,aAAa,EAAE,KAAK;AACjE,MAAI,cAAc;AAClB,MAAI,OAAO,UAAU,WAAW,QAAQ,GAAG;AACzC,kBAAc;AAAA,EAChB,WAAW,OAAO,UAAU,WAAW,QAAQ,GAAG;AAChD,kBAAc;AAAA,EAChB,WAAW,OAAO,UAAU,WAAW,QAAQ,GAAG;AAChD,kBAAc;AAAA,EAChB;AAEA,SAAO;AAAA,IACL,MAAM,OAAO,QAAQ;AAAA,IACrB,SAAS,OAAO,WAAW,OAAO;AAAA,IAClC,aAAa,OAAO,eAAe,GAAG,YAAY,OAAO,CAAC,EAAE,YAAA,IAAgB,YAAY,MAAM,CAAC,CAAC;AAAA,IAChG,MAAM,OAAO,QAAQ;AAAA,IACrB,OAAO;AAAA,EAAA;AAEX;"}
@@ -1,22 +1,77 @@
1
- function generateDefaultMetadata(params) {
2
- const defaultName = params.fileName?.replace(/\.[^/.]+$/, "") || "Hashinal NFT";
3
- let defaultType = "media";
4
- if (params.mimeType?.startsWith("image/")) {
5
- defaultType = "image";
6
- } else if (params.mimeType?.startsWith("video/")) {
7
- defaultType = "video";
8
- } else if (params.mimeType?.startsWith("audio/")) {
9
- defaultType = "audio";
10
- }
1
+ function createInscriptionSuccess(params) {
2
+ const { hrl, topicId, standard, cdnUrl, transactionId, metadata } = params;
11
3
  return {
12
- name: params.name || defaultName,
13
- creator: params.creator || params.operatorAccount,
14
- description: params.description || `${defaultType.charAt(0).toUpperCase() + defaultType.slice(1)} NFT inscribed as Hashinal`,
15
- type: params.type || defaultType,
16
- image: ""
4
+ success: true,
5
+ type: "inscription",
6
+ title: `${standard} Hashinal Inscription Complete`,
7
+ message: `Successfully inscribed "${metadata.name || "your content"}" as a ${standard} Hashinal. The content is now ready for NFT minting.`,
8
+ inscription: {
9
+ hrl,
10
+ topicId,
11
+ standard,
12
+ cdnUrl,
13
+ transactionId
14
+ },
15
+ metadata,
16
+ nextSteps: {
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
+ mintingMetadata: hrl
20
+ }
21
+ };
22
+ }
23
+ function createInscriptionQuote(params) {
24
+ const { totalCostHbar, validUntil, breakdown, content } = params;
25
+ return {
26
+ success: true,
27
+ type: "quote",
28
+ title: "Inscription Cost Quote",
29
+ message: `Estimated cost to inscribe "${content.name || "your content"}" is ${totalCostHbar} HBAR.`,
30
+ quote: {
31
+ totalCostHbar,
32
+ validUntil,
33
+ breakdown
34
+ },
35
+ content
36
+ };
37
+ }
38
+ function createInscriptionError(params) {
39
+ const { code, details, suggestions } = params;
40
+ return {
41
+ success: false,
42
+ type: "error",
43
+ title: "Inscription Failed",
44
+ message: `Unable to complete inscription: ${details}`,
45
+ error: {
46
+ code,
47
+ details,
48
+ suggestions
49
+ }
50
+ };
51
+ }
52
+ function createInscriptionPending(params) {
53
+ const { transactionId, details, suggestions } = params;
54
+ const d = details || `Inscription submitted but not yet confirmed. Transaction ID: ${transactionId}`;
55
+ return {
56
+ success: false,
57
+ type: "error",
58
+ title: "Inscription Submitted (Pending)",
59
+ message: d,
60
+ error: {
61
+ code: "INSCRIPTION_PENDING",
62
+ details: d,
63
+ suggestions: suggestions || [
64
+ "Wait a few moments for confirmation",
65
+ "Check the transaction status on a Hedera explorer",
66
+ "Try the inscription again if it doesn't confirm within 5 minutes"
67
+ ]
68
+ }
17
69
  };
18
70
  }
19
71
  export {
20
- generateDefaultMetadata
72
+ createInscriptionError,
73
+ createInscriptionPending,
74
+ createInscriptionQuote,
75
+ createInscriptionSuccess
21
76
  };
22
77
  //# sourceMappingURL=standards-agent-kit.es55.js.map