@hashgraphonline/standards-agent-kit 0.2.155 → 0.2.157

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 (44) hide show
  1. package/dist/cjs/builders/inscriber/inscriber-builder.d.ts +1 -1
  2. package/dist/cjs/standards-agent-kit.cjs +1 -1
  3. package/dist/cjs/standards-agent-kit.cjs.map +1 -1
  4. package/dist/es/builders/inscriber/inscriber-builder.d.ts +1 -1
  5. package/dist/es/standards-agent-kit.es24.js +1 -1
  6. package/dist/es/standards-agent-kit.es25.js +1 -1
  7. package/dist/es/standards-agent-kit.es26.js +1 -1
  8. package/dist/es/standards-agent-kit.es27.js +1 -1
  9. package/dist/es/standards-agent-kit.es28.js +1 -1
  10. package/dist/es/standards-agent-kit.es31.js +1 -1
  11. package/dist/es/standards-agent-kit.es32.js +1 -1
  12. package/dist/es/standards-agent-kit.es33.js +1 -1
  13. package/dist/es/standards-agent-kit.es36.js +1 -1
  14. package/dist/es/standards-agent-kit.es37.js +1 -1
  15. package/dist/es/standards-agent-kit.es38.js +3 -3
  16. package/dist/es/standards-agent-kit.es39.js +5 -5
  17. package/dist/es/standards-agent-kit.es48.js +3 -7
  18. package/dist/es/standards-agent-kit.es48.js.map +1 -1
  19. package/dist/es/standards-agent-kit.es49.js +7 -3
  20. package/dist/es/standards-agent-kit.es49.js.map +1 -1
  21. package/dist/es/standards-agent-kit.es50.js +3 -20
  22. package/dist/es/standards-agent-kit.es50.js.map +1 -1
  23. package/dist/es/standards-agent-kit.es51.js +17 -50
  24. package/dist/es/standards-agent-kit.es51.js.map +1 -1
  25. package/dist/es/standards-agent-kit.es52.js +54 -3
  26. package/dist/es/standards-agent-kit.es52.js.map +1 -1
  27. package/dist/es/standards-agent-kit.es53.js +2 -39
  28. package/dist/es/standards-agent-kit.es53.js.map +1 -1
  29. package/dist/es/standards-agent-kit.es54.js +38 -17
  30. package/dist/es/standards-agent-kit.es54.js.map +1 -1
  31. package/dist/es/standards-agent-kit.es55.js +16 -71
  32. package/dist/es/standards-agent-kit.es55.js.map +1 -1
  33. package/dist/es/standards-agent-kit.es56.js +73 -3
  34. package/dist/es/standards-agent-kit.es56.js.map +1 -1
  35. package/dist/es/standards-agent-kit.es6.js +1 -1
  36. package/dist/es/standards-agent-kit.es7.js +1 -1
  37. package/dist/es/standards-agent-kit.es8.js +49 -63
  38. package/dist/es/standards-agent-kit.es8.js.map +1 -1
  39. package/dist/es/standards-agent-kit.es9.js +1 -1
  40. package/dist/umd/builders/inscriber/inscriber-builder.d.ts +1 -1
  41. package/dist/umd/standards-agent-kit.umd.js +220 -1
  42. package/dist/umd/standards-agent-kit.umd.js.map +1 -1
  43. package/package.json +1 -1
  44. package/src/builders/inscriber/inscriber-builder.ts +56 -68
@@ -55,7 +55,7 @@ export declare class InscriberBuilder extends BaseServiceBuilder {
55
55
  static setPreferWalletOnly(flag: boolean): void;
56
56
  getSigner(): Promise<DAppSigner | null>;
57
57
  /**
58
- * Get or create Inscription SDK - temporarily returns null since we don't have the actual SDK
58
+ * Get or create Inscription SDK
59
59
  */
60
60
  protected getInscriptionSDK(_options: InscriptionOptions): Promise<InscriptionSDK | null>;
61
61
  /**
@@ -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.es56.js";
4
+ import { isWalletBytesResponse } from "./standards-agent-kit.es50.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.es56.js";
3
+ import { isWalletBytesResponse } from "./standards-agent-kit.es50.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.es56.js";
3
+ import { isWalletBytesResponse } from "./standards-agent-kit.es50.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.es56.js";
3
+ import { isWalletBytesResponse } from "./standards-agent-kit.es50.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.es56.js";
3
+ import { isWalletBytesResponse } from "./standards-agent-kit.es50.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.es56.js";
3
+ import { isWalletBytesResponse } from "./standards-agent-kit.es50.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.es56.js";
3
+ import { isWalletBytesResponse } from "./standards-agent-kit.es50.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.es56.js";
3
+ import { isWalletBytesResponse } from "./standards-agent-kit.es50.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.es50.js";
4
+ import { extractTopicIds, buildInscriptionLinks } from "./standards-agent-kit.es51.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.es50.js";
5
+ import { extractTopicIds, buildInscriptionLinks } from "./standards-agent-kit.es51.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.es51.js";
4
- import { contentRefSchema } from "./standards-agent-kit.es52.js";
3
+ import { resolveContent } from "./standards-agent-kit.es52.js";
4
+ import { contentRefSchema } from "./standards-agent-kit.es53.js";
5
5
  import { loadConfig } from "./standards-agent-kit.es2.js";
6
- import { extractTopicIds, buildInscriptionLinks } from "./standards-agent-kit.es50.js";
6
+ import { extractTopicIds, buildInscriptionLinks } from "./standards-agent-kit.es51.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.es53.js";
5
- import { contentRefSchema } from "./standards-agent-kit.es52.js";
6
- import { generateDefaultMetadata } from "./standards-agent-kit.es54.js";
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";
7
7
  import { extendZodSchema, renderConfigs } from "./standards-agent-kit.es44.js";
8
- import { createInscriptionError, createInscriptionQuote, createInscriptionSuccess, createInscriptionPending } from "./standards-agent-kit.es55.js";
9
- import { extractTopicIds, buildInscriptionLinks } from "./standards-agent-kit.es50.js";
8
+ import { createInscriptionError, createInscriptionQuote, createInscriptionSuccess, createInscriptionPending } from "./standards-agent-kit.es56.js";
9
+ import { extractTopicIds, buildInscriptionLinks } from "./standards-agent-kit.es51.js";
10
10
  const HASHLINK_BLOCK_CONFIG = {
11
11
  testnet: {
12
12
  blockId: "0.0.6617393",
@@ -1,11 +1,7 @@
1
- class CodedError extends Error {
2
- constructor(code, message) {
3
- super(message);
4
- this.code = code;
5
- Object.setPrototypeOf(this, CodedError.prototype);
6
- }
1
+ function encryptMessage(message) {
2
+ return message;
7
3
  }
8
4
  export {
9
- CodedError
5
+ encryptMessage
10
6
  };
11
7
  //# sourceMappingURL=standards-agent-kit.es48.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"standards-agent-kit.es48.js","sources":["../../src/utils/CodedError.ts"],"sourcesContent":["export class CodedError extends Error {\n code: string;\n constructor(code: string, message: string) {\n super(message);\n this.code = code;\n Object.setPrototypeOf(this, CodedError.prototype);\n }\n}\n"],"names":[],"mappings":"AAAO,MAAM,mBAAmB,MAAM;AAAA,EAEpC,YAAY,MAAc,SAAiB;AACzC,UAAM,OAAO;AACb,SAAK,OAAO;AACZ,WAAO,eAAe,MAAM,WAAW,SAAS;AAAA,EAClD;AACF;"}
1
+ {"version":3,"file":"standards-agent-kit.es48.js","sources":["../../src/utils/Encryption.ts"],"sourcesContent":["\n/**\n * Placeholder for encryption functionality.\n * Currently, encryption is disabled. The useEncryption flag is false by default.\n * TODO: Implement actual encryption/decryption logic.\n */\n\nexport function encryptMessage(message: string): string {\n return message; // currently returns plaintext.\n}\n\nexport function decryptMessage(encryptedMessage: string): string {\n return encryptedMessage;\n}\n"],"names":[],"mappings":"AAOO,SAAS,eAAe,SAAyB;AACpD,SAAO;AACX;"}
@@ -1,7 +1,11 @@
1
- function encryptMessage(message) {
2
- return message;
1
+ class CodedError extends Error {
2
+ constructor(code, message) {
3
+ super(message);
4
+ this.code = code;
5
+ Object.setPrototypeOf(this, CodedError.prototype);
6
+ }
3
7
  }
4
8
  export {
5
- encryptMessage
9
+ CodedError
6
10
  };
7
11
  //# sourceMappingURL=standards-agent-kit.es49.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"standards-agent-kit.es49.js","sources":["../../src/utils/Encryption.ts"],"sourcesContent":["\n/**\n * Placeholder for encryption functionality.\n * Currently, encryption is disabled. The useEncryption flag is false by default.\n * TODO: Implement actual encryption/decryption logic.\n */\n\nexport function encryptMessage(message: string): string {\n return message; // currently returns plaintext.\n}\n\nexport function decryptMessage(encryptedMessage: string): string {\n return encryptedMessage;\n}\n"],"names":[],"mappings":"AAOO,SAAS,eAAe,SAAyB;AACpD,SAAO;AACX;"}
1
+ {"version":3,"file":"standards-agent-kit.es49.js","sources":["../../src/utils/CodedError.ts"],"sourcesContent":["export class CodedError extends Error {\n code: string;\n constructor(code: string, message: string) {\n super(message);\n this.code = code;\n Object.setPrototypeOf(this, CodedError.prototype);\n }\n}\n"],"names":[],"mappings":"AAAO,MAAM,mBAAmB,MAAM;AAAA,EAEpC,YAAY,MAAc,SAAiB;AACzC,UAAM,OAAO;AACb,SAAK,OAAO;AACZ,WAAO,eAAe,MAAM,WAAW,SAAS;AAAA,EAClD;AACF;"}
@@ -1,24 +1,7 @@
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 };
1
+ function isWalletBytesResponse(value) {
2
+ return !!value && typeof value.transactionBytes === "string";
19
3
  }
20
4
  export {
21
- buildInscriptionLinks,
22
- extractTopicIds
5
+ isWalletBytesResponse
23
6
  };
24
7
  //# sourceMappingURL=standards-agent-kit.es50.js.map
@@ -1 +1 @@
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
+ {"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,57 +1,24 @@
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);
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;
28
5
  }
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");
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");
47
9
  return {
48
- buffer,
49
- mimeType: providedMimeType || "text/plain",
50
- fileName: providedFileName,
51
- wasReference: false
10
+ jsonTopicId,
11
+ topicId: imageTopicId
52
12
  };
53
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 };
19
+ }
54
20
  export {
55
- resolveContent
21
+ buildInscriptionLinks,
22
+ extractTopicIds
56
23
  };
57
24
  //# sourceMappingURL=standards-agent-kit.es51.js.map
@@ -1 +1 @@
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
+ {"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,6 +1,57 @@
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]"');
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
+ }
3
54
  export {
4
- contentRefSchema
55
+ resolveContent
5
56
  };
6
57
  //# sourceMappingURL=standards-agent-kit.es52.js.map
@@ -1 +1 @@
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
+ {"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,43 +1,6 @@
1
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;
35
- }
36
- }
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]"');
37
3
  export {
38
- hip412AttributeSchema,
39
- hip412FileSchema,
40
- hip412MetadataSchema,
41
- validateHIP412Metadata
4
+ contentRefSchema
42
5
  };
43
6
  //# sourceMappingURL=standards-agent-kit.es53.js.map
@@ -1 +1 @@
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
+ {"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,22 +1,43 @@
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";
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;
10
35
  }
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
- };
18
36
  }
19
37
  export {
20
- generateDefaultMetadata
38
+ hip412AttributeSchema,
39
+ hip412FileSchema,
40
+ hip412MetadataSchema,
41
+ validateHIP412Metadata
21
42
  };
22
43
  //# sourceMappingURL=standards-agent-kit.es54.js.map
@@ -1 +1 @@
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
+ {"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;"}