@hashgraphonline/standards-agent-kit 0.2.143 → 0.2.144
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/standards-agent-kit.es24.js +1 -1
- package/dist/es/standards-agent-kit.es25.js +1 -1
- package/dist/es/standards-agent-kit.es26.js +1 -1
- package/dist/es/standards-agent-kit.es27.js +1 -1
- package/dist/es/standards-agent-kit.es28.js +1 -1
- package/dist/es/standards-agent-kit.es31.js +1 -1
- package/dist/es/standards-agent-kit.es32.js +1 -1
- package/dist/es/standards-agent-kit.es33.js +1 -1
- package/dist/es/standards-agent-kit.es36.js +1 -1
- package/dist/es/standards-agent-kit.es37.js +1 -1
- package/dist/es/standards-agent-kit.es38.js +3 -3
- package/dist/es/standards-agent-kit.es39.js +5 -5
- package/dist/es/standards-agent-kit.es41.js +1 -1
- package/dist/es/standards-agent-kit.es42.js +1 -1
- package/dist/es/standards-agent-kit.es47.js +24 -3
- package/dist/es/standards-agent-kit.es47.js.map +1 -1
- package/dist/es/standards-agent-kit.es48.js +3 -7
- package/dist/es/standards-agent-kit.es48.js.map +1 -1
- package/dist/es/standards-agent-kit.es49.js +6 -23
- package/dist/es/standards-agent-kit.es49.js.map +1 -1
- package/dist/es/standards-agent-kit.es50.js +3 -20
- package/dist/es/standards-agent-kit.es50.js.map +1 -1
- package/dist/es/standards-agent-kit.es51.js +17 -50
- package/dist/es/standards-agent-kit.es51.js.map +1 -1
- package/dist/es/standards-agent-kit.es52.js +54 -3
- package/dist/es/standards-agent-kit.es52.js.map +1 -1
- package/dist/es/standards-agent-kit.es53.js +2 -39
- package/dist/es/standards-agent-kit.es53.js.map +1 -1
- package/dist/es/standards-agent-kit.es54.js +38 -17
- package/dist/es/standards-agent-kit.es54.js.map +1 -1
- package/dist/es/standards-agent-kit.es55.js +16 -71
- package/dist/es/standards-agent-kit.es55.js.map +1 -1
- package/dist/es/standards-agent-kit.es56.js +73 -3
- package/dist/es/standards-agent-kit.es56.js.map +1 -1
- package/dist/es/standards-agent-kit.es6.js +1 -1
- package/dist/es/standards-agent-kit.es7.js +1 -1
- package/dist/es/standards-agent-kit.es9.js +1 -1
- package/package.json +2 -2
|
@@ -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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
4
|
-
import { contentRefSchema } from "./standards-agent-kit.
|
|
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.
|
|
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.
|
|
5
|
-
import { contentRefSchema } from "./standards-agent-kit.
|
|
6
|
-
import { generateDefaultMetadata } from "./standards-agent-kit.
|
|
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.
|
|
9
|
-
import { extractTopicIds, buildInscriptionLinks } from "./standards-agent-kit.
|
|
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",
|
|
@@ -13,7 +13,7 @@ import { RetrieveProfileTool } from "./standards-agent-kit.es20.js";
|
|
|
13
13
|
import { ListUnapprovedConnectionRequestsTool } from "./standards-agent-kit.es21.js";
|
|
14
14
|
import { OpenConvaiState } from "./standards-agent-kit.es41.js";
|
|
15
15
|
import { Logger } from "@hashgraphonline/standards-sdk";
|
|
16
|
-
import { ENV_FILE_PATH } from "./standards-agent-kit.
|
|
16
|
+
import { ENV_FILE_PATH } from "./standards-agent-kit.es47.js";
|
|
17
17
|
const initializeStandardsAgentKit = async (options) => {
|
|
18
18
|
const config = options?.clientConfig || {};
|
|
19
19
|
const operatorId = config.operatorId || process.env.HEDERA_OPERATOR_ID;
|
|
@@ -1,7 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import "@hashgraphonline/standards-sdk";
|
|
2
|
+
import fs from "fs";
|
|
3
|
+
import path__default from "path";
|
|
4
|
+
const ENV_FILE_PATH = path__default.join(process.cwd(), ".env");
|
|
5
|
+
async function updateEnvFile(envFilePath, variables) {
|
|
6
|
+
let envContent = "";
|
|
7
|
+
if (fs.existsSync(envFilePath)) {
|
|
8
|
+
envContent = fs.readFileSync(envFilePath, "utf8");
|
|
9
|
+
}
|
|
10
|
+
const envLines = envContent.split("\n");
|
|
11
|
+
const updatedLines = [...envLines];
|
|
12
|
+
for (const [key, value] of Object.entries(variables)) {
|
|
13
|
+
const lineIndex = updatedLines.findIndex(
|
|
14
|
+
(line) => line.startsWith(`${key}=`)
|
|
15
|
+
);
|
|
16
|
+
if (lineIndex !== -1) {
|
|
17
|
+
updatedLines[lineIndex] = `${key}=${value}`;
|
|
18
|
+
} else {
|
|
19
|
+
updatedLines.push(`${key}=${value}`);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
fs.writeFileSync(envFilePath, updatedLines.join("\n"));
|
|
3
23
|
}
|
|
4
24
|
export {
|
|
5
|
-
|
|
25
|
+
ENV_FILE_PATH,
|
|
26
|
+
updateEnvFile
|
|
6
27
|
};
|
|
7
28
|
//# sourceMappingURL=standards-agent-kit.es47.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standards-agent-kit.es47.js","sources":["../../src/utils/
|
|
1
|
+
{"version":3,"file":"standards-agent-kit.es47.js","sources":["../../src/utils/state-tools.ts"],"sourcesContent":["import {\n HCS10Client,\n AgentBuilder,\n Logger,\n} from '@hashgraphonline/standards-sdk';\nimport fs from 'fs';\nimport path from 'path';\nimport { ensureAgentHasEnoughHbar } from './ensure-agent-has-hbar';\n\nexport const ENV_FILE_PATH = path.join(process.cwd(), '.env');\n\nexport interface AgentData {\n accountId: string;\n operatorId: string;\n inboundTopicId: string;\n outboundTopicId: string;\n client: HCS10Client;\n}\n\nexport interface RegistrationProgressData {\n registered: boolean;\n accountId?: string;\n privateKey?: string;\n publicKey?: string;\n inboundTopicId?: string;\n outboundTopicId?: string;\n}\n\nexport async function getAgentFromEnv(\n logger: Logger,\n baseClient: HCS10Client,\n agentName: string,\n envPrefix: string\n): Promise<AgentData | null> {\n const accountIdEnvVar = `${envPrefix}_ACCOUNT_ID`;\n const privateKeyEnvVar = `${envPrefix}_PRIVATE_KEY`;\n const inboundTopicIdEnvVar = `${envPrefix}_INBOUND_TOPIC_ID`;\n const outboundTopicIdEnvVar = `${envPrefix}_OUTBOUND_TOPIC_ID`;\n\n const accountId = process.env[accountIdEnvVar];\n const privateKey = process.env[privateKeyEnvVar];\n const inboundTopicId = process.env[inboundTopicIdEnvVar];\n const outboundTopicId = process.env[outboundTopicIdEnvVar];\n\n if (!accountId || !privateKey || !inboundTopicId || !outboundTopicId) {\n logger.info(`${agentName} agent not found in environment variables`);\n return null;\n }\n\n logger.info(`${agentName} agent found in environment variables`);\n logger.info(`${agentName} account ID: ${accountId}`);\n logger.info(`${agentName} inbound topic ID: ${inboundTopicId}`);\n logger.info(`${agentName} outbound topic ID: ${outboundTopicId}`);\n\n const client = new HCS10Client({\n network: 'testnet',\n operatorId: accountId,\n operatorPrivateKey: privateKey,\n guardedRegistryBaseUrl: process.env.REGISTRY_URL,\n prettyPrint: true,\n logLevel: 'debug',\n });\n\n await ensureAgentHasEnoughHbar(logger, baseClient, accountId, agentName);\n\n return {\n accountId,\n operatorId: `${inboundTopicId}@${accountId}`,\n inboundTopicId,\n outboundTopicId,\n client,\n };\n}\n\nexport async function createAgent(\n logger: Logger,\n baseClient: HCS10Client,\n agentName: string,\n agentBuilder: AgentBuilder,\n envPrefix: string\n): Promise<AgentData | null> {\n try {\n logger.info(`Creating ${agentName} agent...`);\n\n const result = await baseClient.createAndRegisterAgent(agentBuilder);\n\n if (!result.metadata) {\n logger.error(`${agentName} agent creation failed`);\n return null;\n }\n\n logger.info(`${agentName} agent created successfully`);\n logger.info(`${agentName} account ID: ${result.metadata.accountId}`);\n logger.info(`${agentName} private key: ${result.metadata.privateKey}`);\n logger.info(\n `${agentName} inbound topic ID: ${result.metadata.inboundTopicId}`\n );\n logger.info(\n `${agentName} outbound topic ID: ${result.metadata.outboundTopicId}`\n );\n\n const envVars = {\n [`${envPrefix}_ACCOUNT_ID`]: result.metadata.accountId,\n [`${envPrefix}_PRIVATE_KEY`]: result.metadata.privateKey,\n [`${envPrefix}_INBOUND_TOPIC_ID`]: result.metadata.inboundTopicId,\n [`${envPrefix}_OUTBOUND_TOPIC_ID`]: result.metadata.outboundTopicId,\n };\n\n await updateEnvFile(ENV_FILE_PATH, envVars);\n\n const client = new HCS10Client({\n network: 'testnet',\n operatorId: result.metadata.accountId,\n operatorPrivateKey: result.metadata.privateKey,\n guardedRegistryBaseUrl: process.env.REGISTRY_URL,\n prettyPrint: true,\n logLevel: 'debug',\n });\n\n return {\n accountId: result.metadata.accountId,\n operatorId: `${result.metadata.inboundTopicId}@${result.metadata.accountId}`,\n inboundTopicId: result.metadata.inboundTopicId,\n outboundTopicId: result.metadata.outboundTopicId,\n client,\n };\n } catch (error) {\n logger.error(`Error creating ${agentName} agent:`, error, { baseClient });\n return null;\n }\n}\n\nexport async function updateEnvFile(\n envFilePath: string,\n variables: Record<string, string>\n): Promise<void> {\n let envContent = '';\n\n if (fs.existsSync(envFilePath)) {\n envContent = fs.readFileSync(envFilePath, 'utf8');\n }\n\n const envLines = envContent.split('\\n');\n const updatedLines = [...envLines];\n\n for (const [key, value] of Object.entries(variables)) {\n const lineIndex = updatedLines.findIndex((line) =>\n line.startsWith(`${key}=`)\n );\n\n if (lineIndex !== -1) {\n updatedLines[lineIndex] = `${key}=${value}`;\n } else {\n updatedLines.push(`${key}=${value}`);\n }\n }\n\n fs.writeFileSync(envFilePath, updatedLines.join('\\n'));\n}\n"],"names":["path"],"mappings":";;;AASO,MAAM,gBAAgBA,cAAK,KAAK,QAAQ,IAAA,GAAO,MAAM;AA2H5D,eAAsB,cACpB,aACA,WACe;AACf,MAAI,aAAa;AAEjB,MAAI,GAAG,WAAW,WAAW,GAAG;AAC9B,iBAAa,GAAG,aAAa,aAAa,MAAM;AAAA,EAClD;AAEA,QAAM,WAAW,WAAW,MAAM,IAAI;AACtC,QAAM,eAAe,CAAC,GAAG,QAAQ;AAEjC,aAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,SAAS,GAAG;AACpD,UAAM,YAAY,aAAa;AAAA,MAAU,CAAC,SACxC,KAAK,WAAW,GAAG,GAAG,GAAG;AAAA,IAAA;AAG3B,QAAI,cAAc,IAAI;AACpB,mBAAa,SAAS,IAAI,GAAG,GAAG,IAAI,KAAK;AAAA,IAC3C,OAAO;AACL,mBAAa,KAAK,GAAG,GAAG,IAAI,KAAK,EAAE;AAAA,IACrC;AAAA,EACF;AAEA,KAAG,cAAc,aAAa,aAAa,KAAK,IAAI,CAAC;AACvD;"}
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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
|
-
|
|
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/
|
|
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,28 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
let envContent = "";
|
|
7
|
-
if (fs.existsSync(envFilePath)) {
|
|
8
|
-
envContent = fs.readFileSync(envFilePath, "utf8");
|
|
1
|
+
class CodedError extends Error {
|
|
2
|
+
constructor(code, message) {
|
|
3
|
+
super(message);
|
|
4
|
+
this.code = code;
|
|
5
|
+
Object.setPrototypeOf(this, CodedError.prototype);
|
|
9
6
|
}
|
|
10
|
-
const envLines = envContent.split("\n");
|
|
11
|
-
const updatedLines = [...envLines];
|
|
12
|
-
for (const [key, value] of Object.entries(variables)) {
|
|
13
|
-
const lineIndex = updatedLines.findIndex(
|
|
14
|
-
(line) => line.startsWith(`${key}=`)
|
|
15
|
-
);
|
|
16
|
-
if (lineIndex !== -1) {
|
|
17
|
-
updatedLines[lineIndex] = `${key}=${value}`;
|
|
18
|
-
} else {
|
|
19
|
-
updatedLines.push(`${key}=${value}`);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
fs.writeFileSync(envFilePath, updatedLines.join("\n"));
|
|
23
7
|
}
|
|
24
8
|
export {
|
|
25
|
-
|
|
26
|
-
updateEnvFile
|
|
9
|
+
CodedError
|
|
27
10
|
};
|
|
28
11
|
//# sourceMappingURL=standards-agent-kit.es49.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standards-agent-kit.es49.js","sources":["../../src/utils/
|
|
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
|
|
2
|
-
|
|
3
|
-
const val = obj[key];
|
|
4
|
-
return typeof val === "string" && val.trim() ? val : void 0;
|
|
5
|
-
}
|
|
6
|
-
function extractTopicIds(inscription, result) {
|
|
7
|
-
const jsonTopicId = getStringProp(inscription, "jsonTopicId");
|
|
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
|
-
|
|
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/
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
const
|
|
4
|
-
|
|
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
|
|
30
|
-
const
|
|
31
|
-
|
|
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 = getStringProp(inscription, "jsonTopicId");
|
|
8
|
+
const imageTopicId = getStringProp(inscription, "topic_id") || getStringProp(inscription, "topicId") || getStringProp(result, "topicId") || getStringProp(result, "topic_id");
|
|
47
9
|
return {
|
|
48
|
-
|
|
49
|
-
|
|
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
|
-
|
|
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/
|
|
1
|
+
{"version":3,"file":"standards-agent-kit.es51.js","sources":["../../src/utils/inscription-utils.ts"],"sourcesContent":["export 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: unknown,\n result?: unknown\n): TopicIds {\n const jsonTopicId = getStringProp(inscription, 'jsonTopicId');\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":"AAOA,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,cAAc,cAAc,aAAa,aAAa;AAE5D,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 {
|
|
2
|
-
|
|
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
|
-
|
|
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/
|
|
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
|
|
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
|
-
|
|
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/
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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
|
-
|
|
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/
|
|
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,77 +1,22 @@
|
|
|
1
|
-
function
|
|
2
|
-
const
|
|
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
|
+
}
|
|
3
11
|
return {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
-
}
|
|
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: ""
|
|
69
17
|
};
|
|
70
18
|
}
|
|
71
19
|
export {
|
|
72
|
-
|
|
73
|
-
createInscriptionPending,
|
|
74
|
-
createInscriptionQuote,
|
|
75
|
-
createInscriptionSuccess
|
|
20
|
+
generateDefaultMetadata
|
|
76
21
|
};
|
|
77
22
|
//# sourceMappingURL=standards-agent-kit.es55.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standards-agent-kit.es55.js","sources":["../../src/
|
|
1
|
+
{"version":3,"file":"standards-agent-kit.es55.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,7 +1,77 @@
|
|
|
1
|
-
function
|
|
2
|
-
|
|
1
|
+
function createInscriptionSuccess(params) {
|
|
2
|
+
const { hrl, topicId, standard, cdnUrl, transactionId, metadata } = params;
|
|
3
|
+
return {
|
|
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
|
+
}
|
|
69
|
+
};
|
|
3
70
|
}
|
|
4
71
|
export {
|
|
5
|
-
|
|
72
|
+
createInscriptionError,
|
|
73
|
+
createInscriptionPending,
|
|
74
|
+
createInscriptionQuote,
|
|
75
|
+
createInscriptionSuccess
|
|
6
76
|
};
|
|
7
77
|
//# sourceMappingURL=standards-agent-kit.es56.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standards-agent-kit.es56.js","sources":["../../src/types/
|
|
1
|
+
{"version":3,"file":"standards-agent-kit.es56.js","sources":["../../src/types/inscription-response.ts"],"sourcesContent":["/**\n * Structured response interface for inscription tools\n * Provides a consistent, user-friendly format for inscription results\n */\n\nexport interface InscriptionSuccessResponse {\n success: true;\n type: 'inscription';\n title: string;\n message: string;\n inscription: {\n /** The HRL (Hashinal Reference Link) for minting - e.g., \"hcs://1/0.0.123456\" */\n hrl: string;\n /** Topic ID where the inscription was stored */\n topicId: string;\n /** Type of Hashinal - Static (HCS-5) or Dynamic (HCS-6) */\n standard: 'Static' | 'Dynamic';\n /** CDN URL for direct access to the inscribed content */\n cdnUrl?: string;\n /** Transaction ID of the inscription */\n transactionId?: string;\n };\n metadata: {\n /** Name/title of the inscribed content */\n name?: string;\n /** Creator of the content */\n creator?: string;\n /** Description of the content */\n description?: string;\n /** Content type (image, text, etc.) */\n type?: string;\n /** Additional attributes */\n attributes?: Array<{ trait_type: string; value: string | number }>;\n };\n nextSteps: {\n /** Primary action the user should take next */\n primary: string;\n /** Additional context or options */\n context?: string;\n /** Specific metadata value to use for minting */\n mintingMetadata: string;\n };\n /** HashLink block data (only present when withHashLinkBlocks=true) */\n hashLinkBlock?: {\n /** Block topic ID on HCS */\n blockId: string;\n /** HashLink reference to the block */\n hashLink: string;\n /** Template topic ID */\n template: string;\n /** Block attributes for rendering */\n attributes: BlockAttributes;\n };\n}\n\nexport interface InscriptionQuoteResponse {\n success: true;\n type: 'quote';\n title: string;\n message: string;\n quote: {\n /** Total cost in HBAR */\n totalCostHbar: string;\n /** When the quote expires */\n validUntil: string;\n /** Cost breakdown details */\n breakdown?: CostBreakdown;\n };\n content: {\n /** Name of the content to be inscribed */\n name?: string;\n /** Creator of the content */\n creator?: string;\n /** Type of content */\n type?: string;\n };\n}\n\nexport interface InscriptionErrorResponse {\n success: false;\n type: 'error';\n title: string;\n message: string;\n error: {\n /** Error code for programmatic handling */\n code: string;\n /** Detailed error message */\n details: string;\n /** Suggestions for fixing the error */\n suggestions?: string[];\n };\n}\n\nexport type InscriptionResponse =\n | InscriptionSuccessResponse\n | InscriptionQuoteResponse\n | InscriptionErrorResponse;\n\n/**\n * Helper function to create a successful inscription response\n */\nexport function createInscriptionSuccess(params: {\n hrl: string;\n topicId: string;\n standard: 'Static' | 'Dynamic';\n cdnUrl?: string;\n transactionId?: string;\n metadata: {\n name?: string;\n creator?: string;\n description?: string;\n type?: string;\n attributes?: Array<{ trait_type: string; value: string | number }>;\n };\n}): InscriptionSuccessResponse {\n const { hrl, topicId, standard, cdnUrl, transactionId, metadata } = params;\n\n return {\n success: true,\n type: 'inscription',\n title: `${standard} Hashinal Inscription Complete`,\n message: `Successfully inscribed \"${\n metadata.name || 'your content'\n }\" as a ${standard} Hashinal. The content is now ready for NFT minting.`,\n inscription: {\n hrl,\n topicId,\n standard,\n cdnUrl,\n transactionId,\n },\n metadata,\n nextSteps: {\n primary: 'CRITICAL: When minting NFTs, use ONLY the mintingMetadata value as a single string in the metadata array. Do NOT create JSON objects.',\n context:\n 'The metadata parameter for minting should be exactly: [\"' + hrl + '\"] - just the HRL string in an array, nothing else.',\n mintingMetadata: hrl,\n },\n };\n}\n\n/**\n * Block attributes for HashLink rendering\n */\ninterface BlockAttributes {\n /** Display name */\n name?: string;\n /** Description text */\n description?: string;\n /** Image URL */\n image?: string;\n /** Content type */\n contentType?: string;\n /** Size in bytes */\n size?: number;\n /** Custom metadata */\n metadata?: Record<string, string | number | boolean>;\n}\n\n/**\n * Transfer details in cost breakdown\n */\ninterface TransferDetails {\n to: string;\n amount: string;\n description: string;\n}\n\n/**\n * Cost breakdown details for inscription quote\n */\ninterface CostBreakdown {\n transfers: TransferDetails[];\n baseFee?: number;\n sizeFee?: number;\n networkFee?: number;\n serviceFee?: number;\n totalFee?: number;\n currency?: string;\n}\n\n/**\n * Helper function to create a quote response\n */\nexport function createInscriptionQuote(params: {\n totalCostHbar: string;\n validUntil: string;\n breakdown?: CostBreakdown;\n content: {\n name?: string;\n creator?: string;\n type?: string;\n };\n}): InscriptionQuoteResponse {\n const { totalCostHbar, validUntil, breakdown, content } = params;\n\n return {\n success: true,\n type: 'quote',\n title: 'Inscription Cost Quote',\n message: `Estimated cost to inscribe \"${\n content.name || 'your content'\n }\" is ${totalCostHbar} HBAR.`,\n quote: {\n totalCostHbar,\n validUntil,\n breakdown,\n },\n content,\n };\n}\n\n/**\n * Helper function to create an error response\n */\nexport function createInscriptionError(params: {\n code: string;\n details: string;\n suggestions?: string[];\n}): InscriptionErrorResponse {\n const { code, details, suggestions } = params;\n\n return {\n success: false,\n type: 'error',\n title: 'Inscription Failed',\n message: `Unable to complete inscription: ${details}`,\n error: {\n code,\n details,\n suggestions,\n },\n };\n}\n\n/**\n * Helper for pending inscription state (submitted but not yet confirmed)\n */\nexport function createInscriptionPending(params: {\n transactionId: string;\n details?: string;\n suggestions?: string[];\n}): InscriptionErrorResponse {\n const { transactionId, details, suggestions } = params;\n const d = details || `Inscription submitted but not yet confirmed. Transaction ID: ${transactionId}`;\n return {\n success: false,\n type: 'error',\n title: 'Inscription Submitted (Pending)',\n message: d,\n error: {\n code: 'INSCRIPTION_PENDING',\n details: d,\n suggestions: suggestions || [\n 'Wait a few moments for confirmation',\n 'Check the transaction status on a Hedera explorer',\n \"Try the inscription again if it doesn't confirm within 5 minutes\",\n ],\n },\n };\n}\n"],"names":[],"mappings":"AAqGO,SAAS,yBAAyB,QAaV;AAC7B,QAAM,EAAE,KAAK,SAAS,UAAU,QAAQ,eAAe,aAAa;AAEpE,SAAO;AAAA,IACL,SAAS;AAAA,IACT,MAAM;AAAA,IACN,OAAO,GAAG,QAAQ;AAAA,IAClB,SAAS,2BACP,SAAS,QAAQ,cACnB,UAAU,QAAQ;AAAA,IAClB,aAAa;AAAA,MACX;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IAAA;AAAA,IAEF;AAAA,IACA,WAAW;AAAA,MACT,SAAS;AAAA,MACT,SACE,6DAA6D,MAAM;AAAA,MACrE,iBAAiB;AAAA,IAAA;AAAA,EACnB;AAEJ;AA6CO,SAAS,uBAAuB,QASV;AAC3B,QAAM,EAAE,eAAe,YAAY,WAAW,YAAY;AAE1D,SAAO;AAAA,IACL,SAAS;AAAA,IACT,MAAM;AAAA,IACN,OAAO;AAAA,IACP,SAAS,+BACP,QAAQ,QAAQ,cAClB,QAAQ,aAAa;AAAA,IACrB,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,IAAA;AAAA,IAEF;AAAA,EAAA;AAEJ;AAKO,SAAS,uBAAuB,QAIV;AAC3B,QAAM,EAAE,MAAM,SAAS,YAAA,IAAgB;AAEvC,SAAO;AAAA,IACL,SAAS;AAAA,IACT,MAAM;AAAA,IACN,OAAO;AAAA,IACP,SAAS,mCAAmC,OAAO;AAAA,IACnD,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,IAAA;AAAA,EACF;AAEJ;AAKO,SAAS,yBAAyB,QAIZ;AAC3B,QAAM,EAAE,eAAe,SAAS,YAAA,IAAgB;AAChD,QAAM,IAAI,WAAW,gEAAgE,aAAa;AAClG,SAAO;AAAA,IACL,SAAS;AAAA,IACT,MAAM;AAAA,IACN,OAAO;AAAA,IACP,SAAS;AAAA,IACT,OAAO;AAAA,MACL,MAAM;AAAA,MACN,SAAS;AAAA,MACT,aAAa,eAAe;AAAA,QAC1B;AAAA,QACA;AAAA,QACA;AAAA,MAAA;AAAA,IACF;AAAA,EACF;AAEJ;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BaseServiceBuilder } from "hedera-agent-kit";
|
|
2
2
|
import { HederaMirrorNode, HCS2Client } from "@hashgraphonline/standards-sdk";
|
|
3
3
|
import { SignerProviderRegistry } from "./standards-agent-kit.es3.js";
|
|
4
|
-
import { CodedError } from "./standards-agent-kit.
|
|
4
|
+
import { CodedError } from "./standards-agent-kit.es49.js";
|
|
5
5
|
class HCS2Builder extends BaseServiceBuilder {
|
|
6
6
|
constructor(hederaKit) {
|
|
7
7
|
super(hederaKit);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BaseServiceBuilder } from "hedera-agent-kit";
|
|
2
2
|
import { HCS6Client, HederaMirrorNode } from "@hashgraphonline/standards-sdk";
|
|
3
3
|
import { SignerProviderRegistry } from "./standards-agent-kit.es3.js";
|
|
4
|
-
import { CodedError } from "./standards-agent-kit.
|
|
4
|
+
import { CodedError } from "./standards-agent-kit.es49.js";
|
|
5
5
|
class HCS6Builder extends BaseServiceBuilder {
|
|
6
6
|
constructor(hederaKit) {
|
|
7
7
|
super(hederaKit);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { HCS10Client as HCS10Client$1, Logger, AgentBuilder, AIAgentCapability, InboundTopicType } from "@hashgraphonline/standards-sdk";
|
|
2
|
-
import { encryptMessage } from "./standards-agent-kit.
|
|
2
|
+
import { encryptMessage } from "./standards-agent-kit.es48.js";
|
|
3
3
|
class HCS10Client {
|
|
4
4
|
constructor(operatorId, operatorPrivateKey, network, options) {
|
|
5
5
|
this.standardClient = new HCS10Client$1({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hashgraphonline/standards-agent-kit",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.144",
|
|
4
4
|
"description": "A modular SDK for building on-chain autonomous agents using Hashgraph Online Standards, including HCS-10 for agent discovery and communication.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/cjs/standards-agent-kit.cjs",
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
},
|
|
91
91
|
"dependencies": {
|
|
92
92
|
"@hashgraph/sdk": "^2.72.0",
|
|
93
|
-
"@hashgraphonline/standards-sdk": "^0.1.
|
|
93
|
+
"@hashgraphonline/standards-sdk": "^0.1.108",
|
|
94
94
|
"@kiloscribe/inscription-sdk": "^1.0.60",
|
|
95
95
|
"@langchain/community": "^0.3.5",
|
|
96
96
|
"@langchain/core": "^0.3.71",
|