@hashgraphonline/standards-agent-kit 0.2.131 → 0.2.134
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/builders/hcs10/hcs10-builder.d.ts +0 -2
- package/dist/cjs/builders/inscriber/inscriber-builder.d.ts +4 -10
- package/dist/cjs/index.d.ts +2 -0
- package/dist/cjs/interfaces/FormValidatable.d.ts +45 -0
- package/dist/cjs/interfaces/index.d.ts +1 -0
- package/dist/cjs/lib/index.d.ts +1 -0
- package/dist/cjs/lib/zod-render/config-extractor.d.ts +50 -0
- package/dist/cjs/lib/zod-render/index.d.ts +6 -0
- package/dist/cjs/lib/zod-render/schema-extension.d.ts +94 -0
- package/dist/cjs/lib/zod-render/types.d.ts +286 -0
- package/dist/cjs/standards-agent-kit.cjs +1 -1
- package/dist/cjs/standards-agent-kit.cjs.map +1 -1
- package/dist/cjs/tools/hcs10/natural-language-mapper.d.ts +6 -1
- package/dist/cjs/tools/hcs2/CreateRegistryTool.d.ts +1 -16
- package/dist/cjs/tools/hcs2/DeleteEntryTool.d.ts +1 -13
- package/dist/cjs/tools/hcs2/RegisterEntryTool.d.ts +1 -16
- package/dist/cjs/tools/hcs2/UpdateEntryTool.d.ts +1 -19
- package/dist/cjs/tools/hcs6/CreateDynamicRegistryTool.d.ts +1 -10
- package/dist/cjs/tools/inscriber/InscribeHashinalTool.d.ts +82 -132
- package/dist/cjs/tools/inscriber/RetrieveInscriptionTool.d.ts +20 -1
- package/dist/cjs/types/inscription-response.d.ts +172 -0
- package/dist/cjs/validation/hip412-schemas.d.ts +1 -1
- package/dist/es/builders/hcs10/hcs10-builder.d.ts +0 -2
- package/dist/es/builders/inscriber/inscriber-builder.d.ts +4 -10
- package/dist/es/index.d.ts +2 -0
- package/dist/es/interfaces/FormValidatable.d.ts +45 -0
- package/dist/es/interfaces/index.d.ts +1 -0
- package/dist/es/lib/index.d.ts +1 -0
- package/dist/es/lib/zod-render/config-extractor.d.ts +50 -0
- package/dist/es/lib/zod-render/index.d.ts +6 -0
- package/dist/es/lib/zod-render/schema-extension.d.ts +94 -0
- package/dist/es/lib/zod-render/types.d.ts +286 -0
- package/dist/es/standards-agent-kit.es.js +24 -1
- package/dist/es/standards-agent-kit.es.js.map +1 -1
- package/dist/es/standards-agent-kit.es10.js +3 -1
- package/dist/es/standards-agent-kit.es10.js.map +1 -1
- package/dist/es/standards-agent-kit.es14.js +3 -1
- package/dist/es/standards-agent-kit.es14.js.map +1 -1
- package/dist/es/standards-agent-kit.es20.js +3 -20
- package/dist/es/standards-agent-kit.es20.js.map +1 -1
- package/dist/es/standards-agent-kit.es22.js.map +1 -1
- package/dist/es/standards-agent-kit.es23.js.map +1 -1
- package/dist/es/standards-agent-kit.es24.js.map +1 -1
- package/dist/es/standards-agent-kit.es25.js.map +1 -1
- package/dist/es/standards-agent-kit.es29.js.map +1 -1
- package/dist/es/standards-agent-kit.es3.js +0 -4
- package/dist/es/standards-agent-kit.es3.js.map +1 -1
- package/dist/es/standards-agent-kit.es30.js.map +1 -1
- package/dist/es/standards-agent-kit.es31.js.map +1 -1
- package/dist/es/standards-agent-kit.es32.js.map +1 -1
- package/dist/es/standards-agent-kit.es33.js +0 -4
- package/dist/es/standards-agent-kit.es33.js.map +1 -1
- package/dist/es/standards-agent-kit.es34.js +13 -17
- package/dist/es/standards-agent-kit.es34.js.map +1 -1
- package/dist/es/standards-agent-kit.es35.js +2 -8
- package/dist/es/standards-agent-kit.es35.js.map +1 -1
- package/dist/es/standards-agent-kit.es36.js +2 -2
- package/dist/es/standards-agent-kit.es37.js +451 -92
- package/dist/es/standards-agent-kit.es37.js.map +1 -1
- package/dist/es/standards-agent-kit.es38.js +12 -11
- package/dist/es/standards-agent-kit.es38.js.map +1 -1
- package/dist/es/standards-agent-kit.es39.js +1 -1
- package/dist/es/standards-agent-kit.es39.js.map +1 -1
- package/dist/es/standards-agent-kit.es40.js +7 -7
- package/dist/es/standards-agent-kit.es40.js.map +1 -1
- package/dist/es/standards-agent-kit.es41.js.map +1 -1
- package/dist/es/standards-agent-kit.es42.js +423 -24
- package/dist/es/standards-agent-kit.es42.js.map +1 -1
- package/dist/es/standards-agent-kit.es43.js +185 -3
- package/dist/es/standards-agent-kit.es43.js.map +1 -1
- package/dist/es/standards-agent-kit.es44.js +3 -53
- package/dist/es/standards-agent-kit.es44.js.map +1 -1
- package/dist/es/standards-agent-kit.es45.js +25 -3
- package/dist/es/standards-agent-kit.es45.js.map +1 -1
- package/dist/es/standards-agent-kit.es46.js +3 -39
- package/dist/es/standards-agent-kit.es46.js.map +1 -1
- package/dist/es/standards-agent-kit.es47.js +51 -9
- package/dist/es/standards-agent-kit.es47.js.map +1 -1
- package/dist/es/standards-agent-kit.es48.js +6 -0
- package/dist/es/standards-agent-kit.es48.js.map +1 -0
- package/dist/es/standards-agent-kit.es49.js +43 -0
- package/dist/es/standards-agent-kit.es49.js.map +1 -0
- package/dist/es/standards-agent-kit.es50.js +22 -0
- package/dist/es/standards-agent-kit.es50.js.map +1 -0
- package/dist/es/standards-agent-kit.es51.js +57 -0
- package/dist/es/standards-agent-kit.es51.js.map +1 -0
- package/dist/es/standards-agent-kit.es6.js +1 -1
- package/dist/es/standards-agent-kit.es6.js.map +1 -1
- package/dist/es/standards-agent-kit.es7.js +1 -1
- package/dist/es/standards-agent-kit.es7.js.map +1 -1
- package/dist/es/standards-agent-kit.es9.js +6 -2
- package/dist/es/standards-agent-kit.es9.js.map +1 -1
- package/dist/es/tools/hcs10/natural-language-mapper.d.ts +6 -1
- package/dist/es/tools/hcs2/CreateRegistryTool.d.ts +1 -16
- package/dist/es/tools/hcs2/DeleteEntryTool.d.ts +1 -13
- package/dist/es/tools/hcs2/RegisterEntryTool.d.ts +1 -16
- package/dist/es/tools/hcs2/UpdateEntryTool.d.ts +1 -19
- package/dist/es/tools/hcs6/CreateDynamicRegistryTool.d.ts +1 -10
- package/dist/es/tools/inscriber/InscribeHashinalTool.d.ts +82 -132
- package/dist/es/tools/inscriber/RetrieveInscriptionTool.d.ts +20 -1
- package/dist/es/types/inscription-response.d.ts +172 -0
- package/dist/es/validation/hip412-schemas.d.ts +1 -1
- package/dist/umd/builders/hcs10/hcs10-builder.d.ts +0 -2
- package/dist/umd/builders/inscriber/inscriber-builder.d.ts +4 -10
- package/dist/umd/index.d.ts +2 -0
- package/dist/umd/interfaces/FormValidatable.d.ts +45 -0
- package/dist/umd/interfaces/index.d.ts +1 -0
- package/dist/umd/lib/index.d.ts +1 -0
- package/dist/umd/lib/zod-render/config-extractor.d.ts +50 -0
- package/dist/umd/lib/zod-render/index.d.ts +6 -0
- package/dist/umd/lib/zod-render/schema-extension.d.ts +94 -0
- package/dist/umd/lib/zod-render/types.d.ts +286 -0
- package/dist/umd/standards-agent-kit.umd.js +1 -1
- package/dist/umd/standards-agent-kit.umd.js.map +1 -1
- package/dist/umd/tools/hcs10/natural-language-mapper.d.ts +6 -1
- package/dist/umd/tools/hcs2/CreateRegistryTool.d.ts +1 -16
- package/dist/umd/tools/hcs2/DeleteEntryTool.d.ts +1 -13
- package/dist/umd/tools/hcs2/RegisterEntryTool.d.ts +1 -16
- package/dist/umd/tools/hcs2/UpdateEntryTool.d.ts +1 -19
- package/dist/umd/tools/hcs6/CreateDynamicRegistryTool.d.ts +1 -10
- package/dist/umd/tools/inscriber/InscribeHashinalTool.d.ts +82 -132
- package/dist/umd/tools/inscriber/RetrieveInscriptionTool.d.ts +20 -1
- package/dist/umd/types/inscription-response.d.ts +172 -0
- package/dist/umd/validation/hip412-schemas.d.ts +1 -1
- package/package.json +5 -4
- package/src/builders/hcs10/hcs10-builder.ts +0 -4
- package/src/builders/inscriber/inscriber-builder.ts +5 -12
- package/src/hcs10/HCS10Client.ts +2 -5
- package/src/hcs10/types.ts +1 -15
- package/src/index.ts +2 -0
- package/src/init/init.ts +7 -10
- package/src/interfaces/FormValidatable.ts +57 -0
- package/src/interfaces/index.ts +1 -0
- package/src/lib/index.ts +1 -0
- package/src/lib/zod-render/config-extractor.ts +351 -0
- package/src/lib/zod-render/index.ts +36 -0
- package/src/lib/zod-render/schema-extension.ts +544 -0
- package/src/lib/zod-render/types.ts +333 -0
- package/src/plugins/PluginInterface.ts +1 -2
- package/src/plugins/PluginRegistry.ts +1 -1
- package/src/plugins/hedera/HbarPricePlugin.ts +1 -1
- package/src/plugins/weather/index.ts +15 -4
- package/src/state/open-convai-state.ts +1 -11
- package/src/tools/hcs10/FindRegistrationsTool.ts +1 -1
- package/src/tools/hcs10/RegisterAgentTool.ts +3 -3
- package/src/tools/hcs10/SendMessageToConnectionTool.ts +4 -1
- package/src/tools/hcs10/natural-language-mapper.ts +35 -53
- package/src/tools/hcs2/CreateRegistryTool.ts +1 -1
- package/src/tools/hcs2/DeleteEntryTool.ts +1 -1
- package/src/tools/hcs2/RegisterEntryTool.ts +1 -1
- package/src/tools/hcs2/UpdateEntryTool.ts +1 -1
- package/src/tools/hcs6/CreateDynamicRegistryTool.ts +2 -2
- package/src/tools/hcs6/QueryDynamicRegistryTool.ts +1 -1
- package/src/tools/hcs6/RegisterDynamicHashinalTool.ts +1 -1
- package/src/tools/hcs6/UpdateDynamicHashinalTool.ts +2 -2
- package/src/tools/inscriber/InscribeFromFileTool.ts +2 -11
- package/src/tools/inscriber/InscribeFromUrlTool.ts +15 -19
- package/src/tools/inscriber/InscribeHashinalTool.ts +681 -153
- package/src/tools/inscriber/RetrieveInscriptionTool.ts +34 -12
- package/src/tools/inscriber/base-inscriber-tools.ts +2 -24
- package/src/types/content-resolver.ts +3 -3
- package/src/types/inscription-response.ts +234 -0
- package/src/utils/Encryption.ts +1 -1
- package/src/utils/HederaClient.ts +1 -2
- package/src/utils/metadata-defaults.ts +15 -4
- package/src/utils/state-tools.ts +1 -2
- package/src/validation/content-ref-schemas.ts +2 -2
- package/src/validation/hip412-schemas.ts +1 -1
|
@@ -15,6 +15,26 @@ const retrieveInscriptionSchema = z.object({
|
|
|
15
15
|
.describe('API key for inscription service'),
|
|
16
16
|
});
|
|
17
17
|
|
|
18
|
+
/**
|
|
19
|
+
* Type definition for inscription retrieval result
|
|
20
|
+
*/
|
|
21
|
+
interface InscriptionRetrievalResult {
|
|
22
|
+
inscriptionId?: string;
|
|
23
|
+
transactionId: string;
|
|
24
|
+
topicId?: string;
|
|
25
|
+
status?: string;
|
|
26
|
+
holderId?: string;
|
|
27
|
+
metadata?: unknown;
|
|
28
|
+
tags?: unknown;
|
|
29
|
+
mode?: string;
|
|
30
|
+
chunks?: unknown;
|
|
31
|
+
createdAt?: string;
|
|
32
|
+
completedAt?: string;
|
|
33
|
+
fileUrl?: string;
|
|
34
|
+
mimeType?: string;
|
|
35
|
+
fileSize?: number;
|
|
36
|
+
}
|
|
37
|
+
|
|
18
38
|
|
|
19
39
|
/**
|
|
20
40
|
* Tool for retrieving inscriptions
|
|
@@ -30,7 +50,7 @@ export class RetrieveInscriptionTool extends BaseInscriberQueryTool<typeof retri
|
|
|
30
50
|
protected async executeQuery(
|
|
31
51
|
params: z.infer<typeof retrieveInscriptionSchema>,
|
|
32
52
|
_runManager?: CallbackManagerForToolRun
|
|
33
|
-
): Promise<
|
|
53
|
+
): Promise<InscriptionRetrievalResult> {
|
|
34
54
|
const result = await this.inscriberBuilder.retrieveInscription(
|
|
35
55
|
params.transactionId,
|
|
36
56
|
{
|
|
@@ -39,21 +59,23 @@ export class RetrieveInscriptionTool extends BaseInscriberQueryTool<typeof retri
|
|
|
39
59
|
}
|
|
40
60
|
);
|
|
41
61
|
|
|
62
|
+
const typedResult = result as unknown as Record<string, unknown>;
|
|
63
|
+
|
|
42
64
|
return {
|
|
43
|
-
inscriptionId:
|
|
44
|
-
transactionId: result.transactionId,
|
|
45
|
-
topicId:
|
|
46
|
-
status: result.status,
|
|
47
|
-
holderId:
|
|
65
|
+
inscriptionId: typedResult.inscriptionId as string | undefined,
|
|
66
|
+
transactionId: result.transactionId || 'unknown',
|
|
67
|
+
topicId: typedResult.topic_id as string | undefined,
|
|
68
|
+
status: result.status || 'unknown',
|
|
69
|
+
holderId: typedResult.holderId as string | undefined,
|
|
48
70
|
metadata: result.metadata,
|
|
49
|
-
tags:
|
|
71
|
+
tags: typedResult.tags,
|
|
50
72
|
mode: result.mode,
|
|
51
|
-
chunks:
|
|
52
|
-
createdAt:
|
|
53
|
-
completedAt: (
|
|
73
|
+
chunks: typedResult.chunks,
|
|
74
|
+
createdAt: typedResult.createdAt as string | undefined,
|
|
75
|
+
completedAt: (typedResult.completed || typedResult.completedAt) as string | undefined,
|
|
54
76
|
fileUrl: result.fileUrl,
|
|
55
|
-
mimeType:
|
|
56
|
-
fileSize:
|
|
77
|
+
mimeType: typedResult.mimeType as string | undefined,
|
|
78
|
+
fileSize: typedResult.fileSize as number | undefined,
|
|
57
79
|
};
|
|
58
80
|
}
|
|
59
81
|
}
|
|
@@ -60,22 +60,11 @@ export abstract class BaseInscriberTransactionTool<
|
|
|
60
60
|
input: InscriptionInput,
|
|
61
61
|
options: InscriptionOptions
|
|
62
62
|
): Promise<QuoteResult> {
|
|
63
|
-
const operatorId = this.inscriberBuilder['hederaKit'].signer.getAccountId().toString();
|
|
64
|
-
const operatorPrivateKey = this.inscriberBuilder['hederaKit'].signer?.getOperatorPrivateKey()
|
|
65
|
-
? this.inscriberBuilder['hederaKit'].signer.getOperatorPrivateKey().toStringRaw()
|
|
66
|
-
: '';
|
|
67
|
-
|
|
68
63
|
const network = this.inscriberBuilder['hederaKit'].client.network;
|
|
69
64
|
const networkType = network.toString().includes('mainnet')
|
|
70
65
|
? 'mainnet'
|
|
71
66
|
: 'testnet';
|
|
72
67
|
|
|
73
|
-
const clientConfig = {
|
|
74
|
-
accountId: operatorId,
|
|
75
|
-
privateKey: operatorPrivateKey,
|
|
76
|
-
network: networkType as 'mainnet' | 'testnet',
|
|
77
|
-
};
|
|
78
|
-
|
|
79
68
|
const quoteOptions = {
|
|
80
69
|
...options,
|
|
81
70
|
quoteOnly: true,
|
|
@@ -83,7 +72,7 @@ export abstract class BaseInscriberTransactionTool<
|
|
|
83
72
|
};
|
|
84
73
|
|
|
85
74
|
const result = await this.inscriberBuilder.inscribe(input, quoteOptions);
|
|
86
|
-
|
|
75
|
+
|
|
87
76
|
if (!result.quote || result.confirmed) {
|
|
88
77
|
throw new Error('Failed to generate quote - unexpected response type');
|
|
89
78
|
}
|
|
@@ -136,22 +125,11 @@ export abstract class BaseInscriberQueryTool<
|
|
|
136
125
|
input: InscriptionInput,
|
|
137
126
|
options: InscriptionOptions
|
|
138
127
|
): Promise<QuoteResult> {
|
|
139
|
-
const operatorId = this.inscriberBuilder['hederaKit'].signer.getAccountId().toString();
|
|
140
|
-
const operatorPrivateKey = this.inscriberBuilder['hederaKit'].signer?.getOperatorPrivateKey()
|
|
141
|
-
? this.inscriberBuilder['hederaKit'].signer.getOperatorPrivateKey().toStringRaw()
|
|
142
|
-
: '';
|
|
143
|
-
|
|
144
128
|
const network = this.inscriberBuilder['hederaKit'].client.network;
|
|
145
129
|
const networkType = network.toString().includes('mainnet')
|
|
146
130
|
? 'mainnet'
|
|
147
131
|
: 'testnet';
|
|
148
132
|
|
|
149
|
-
const clientConfig = {
|
|
150
|
-
accountId: operatorId,
|
|
151
|
-
privateKey: operatorPrivateKey,
|
|
152
|
-
network: networkType as 'mainnet' | 'testnet',
|
|
153
|
-
};
|
|
154
|
-
|
|
155
133
|
const quoteOptions = {
|
|
156
134
|
...options,
|
|
157
135
|
quoteOnly: true,
|
|
@@ -159,7 +137,7 @@ export abstract class BaseInscriberQueryTool<
|
|
|
159
137
|
};
|
|
160
138
|
|
|
161
139
|
const result = await this.inscriberBuilder.inscribe(input, quoteOptions);
|
|
162
|
-
|
|
140
|
+
|
|
163
141
|
if (!result.quote || result.confirmed) {
|
|
164
142
|
throw new Error('Failed to generate quote - unexpected response type');
|
|
165
143
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Content Resolver Types
|
|
3
|
-
*
|
|
3
|
+
*
|
|
4
4
|
* Re-export types from standards-sdk for content resolution.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
export type {
|
|
7
|
+
export type {
|
|
8
8
|
ContentResolverInterface,
|
|
9
9
|
ReferenceResolutionResult,
|
|
10
|
-
ContentStoreInterface
|
|
10
|
+
ContentStoreInterface
|
|
11
11
|
} from '@hashgraphonline/standards-sdk';
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Structured response interface for inscription tools
|
|
3
|
+
* Provides a consistent, user-friendly format for inscription results
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export interface InscriptionSuccessResponse {
|
|
7
|
+
success: true;
|
|
8
|
+
type: 'inscription';
|
|
9
|
+
title: string;
|
|
10
|
+
message: string;
|
|
11
|
+
inscription: {
|
|
12
|
+
/** The HRL (Hashinal Reference Link) for minting - e.g., "hcs://1/0.0.123456" */
|
|
13
|
+
hrl: string;
|
|
14
|
+
/** Topic ID where the inscription was stored */
|
|
15
|
+
topicId: string;
|
|
16
|
+
/** Type of Hashinal - Static (HCS-5) or Dynamic (HCS-6) */
|
|
17
|
+
standard: 'Static' | 'Dynamic';
|
|
18
|
+
/** CDN URL for direct access to the inscribed content */
|
|
19
|
+
cdnUrl?: string;
|
|
20
|
+
/** Transaction ID of the inscription */
|
|
21
|
+
transactionId?: string;
|
|
22
|
+
};
|
|
23
|
+
metadata: {
|
|
24
|
+
/** Name/title of the inscribed content */
|
|
25
|
+
name?: string;
|
|
26
|
+
/** Creator of the content */
|
|
27
|
+
creator?: string;
|
|
28
|
+
/** Description of the content */
|
|
29
|
+
description?: string;
|
|
30
|
+
/** Content type (image, text, etc.) */
|
|
31
|
+
type?: string;
|
|
32
|
+
/** Additional attributes */
|
|
33
|
+
attributes?: Array<{ trait_type: string; value: string | number }>;
|
|
34
|
+
};
|
|
35
|
+
nextSteps: {
|
|
36
|
+
/** Primary action the user should take next */
|
|
37
|
+
primary: string;
|
|
38
|
+
/** Additional context or options */
|
|
39
|
+
context?: string;
|
|
40
|
+
/** Specific metadata value to use for minting */
|
|
41
|
+
mintingMetadata: string;
|
|
42
|
+
};
|
|
43
|
+
/** HashLink block data (only present when withHashLinkBlocks=true) */
|
|
44
|
+
hashLinkBlock?: {
|
|
45
|
+
/** Block topic ID on HCS */
|
|
46
|
+
blockId: string;
|
|
47
|
+
/** HashLink reference to the block */
|
|
48
|
+
hashLink: string;
|
|
49
|
+
/** Template topic ID */
|
|
50
|
+
template: string;
|
|
51
|
+
/** Block attributes for rendering */
|
|
52
|
+
attributes: BlockAttributes;
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export interface InscriptionQuoteResponse {
|
|
57
|
+
success: true;
|
|
58
|
+
type: 'quote';
|
|
59
|
+
title: string;
|
|
60
|
+
message: string;
|
|
61
|
+
quote: {
|
|
62
|
+
/** Total cost in HBAR */
|
|
63
|
+
totalCostHbar: string;
|
|
64
|
+
/** When the quote expires */
|
|
65
|
+
validUntil: string;
|
|
66
|
+
/** Cost breakdown details */
|
|
67
|
+
breakdown?: CostBreakdown;
|
|
68
|
+
};
|
|
69
|
+
content: {
|
|
70
|
+
/** Name of the content to be inscribed */
|
|
71
|
+
name?: string;
|
|
72
|
+
/** Creator of the content */
|
|
73
|
+
creator?: string;
|
|
74
|
+
/** Type of content */
|
|
75
|
+
type?: string;
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export interface InscriptionErrorResponse {
|
|
80
|
+
success: false;
|
|
81
|
+
type: 'error';
|
|
82
|
+
title: string;
|
|
83
|
+
message: string;
|
|
84
|
+
error: {
|
|
85
|
+
/** Error code for programmatic handling */
|
|
86
|
+
code: string;
|
|
87
|
+
/** Detailed error message */
|
|
88
|
+
details: string;
|
|
89
|
+
/** Suggestions for fixing the error */
|
|
90
|
+
suggestions?: string[];
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export type InscriptionResponse =
|
|
95
|
+
| InscriptionSuccessResponse
|
|
96
|
+
| InscriptionQuoteResponse
|
|
97
|
+
| InscriptionErrorResponse;
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Helper function to create a successful inscription response
|
|
101
|
+
*/
|
|
102
|
+
export function createInscriptionSuccess(params: {
|
|
103
|
+
hrl: string;
|
|
104
|
+
topicId: string;
|
|
105
|
+
standard: 'Static' | 'Dynamic';
|
|
106
|
+
cdnUrl?: string;
|
|
107
|
+
transactionId?: string;
|
|
108
|
+
metadata: {
|
|
109
|
+
name?: string;
|
|
110
|
+
creator?: string;
|
|
111
|
+
description?: string;
|
|
112
|
+
type?: string;
|
|
113
|
+
attributes?: Array<{ trait_type: string; value: string | number }>;
|
|
114
|
+
};
|
|
115
|
+
}): InscriptionSuccessResponse {
|
|
116
|
+
const { hrl, topicId, standard, cdnUrl, transactionId, metadata } = params;
|
|
117
|
+
|
|
118
|
+
return {
|
|
119
|
+
success: true,
|
|
120
|
+
type: 'inscription',
|
|
121
|
+
title: `${standard} Hashinal Inscription Complete`,
|
|
122
|
+
message: `Successfully inscribed "${
|
|
123
|
+
metadata.name || 'your content'
|
|
124
|
+
}" as a ${standard} Hashinal. The content is now ready for NFT minting.`,
|
|
125
|
+
inscription: {
|
|
126
|
+
hrl,
|
|
127
|
+
topicId,
|
|
128
|
+
standard,
|
|
129
|
+
cdnUrl,
|
|
130
|
+
transactionId,
|
|
131
|
+
},
|
|
132
|
+
metadata,
|
|
133
|
+
nextSteps: {
|
|
134
|
+
primary: 'Use the HRL below as metadata when minting your NFT',
|
|
135
|
+
context:
|
|
136
|
+
'The HRL (Hedera Resource Locator) is the standardized way to reference your inscribed content in NFT metadata.',
|
|
137
|
+
mintingMetadata: hrl,
|
|
138
|
+
},
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Block attributes for HashLink rendering
|
|
144
|
+
*/
|
|
145
|
+
interface BlockAttributes {
|
|
146
|
+
/** Display name */
|
|
147
|
+
name?: string;
|
|
148
|
+
/** Description text */
|
|
149
|
+
description?: string;
|
|
150
|
+
/** Image URL */
|
|
151
|
+
image?: string;
|
|
152
|
+
/** Content type */
|
|
153
|
+
contentType?: string;
|
|
154
|
+
/** Size in bytes */
|
|
155
|
+
size?: number;
|
|
156
|
+
/** Custom metadata */
|
|
157
|
+
metadata?: Record<string, string | number | boolean>;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Transfer details in cost breakdown
|
|
162
|
+
*/
|
|
163
|
+
interface TransferDetails {
|
|
164
|
+
to: string;
|
|
165
|
+
amount: string;
|
|
166
|
+
description: string;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Cost breakdown details for inscription quote
|
|
171
|
+
*/
|
|
172
|
+
interface CostBreakdown {
|
|
173
|
+
transfers: TransferDetails[];
|
|
174
|
+
baseFee?: number;
|
|
175
|
+
sizeFee?: number;
|
|
176
|
+
networkFee?: number;
|
|
177
|
+
serviceFee?: number;
|
|
178
|
+
totalFee?: number;
|
|
179
|
+
currency?: string;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Helper function to create a quote response
|
|
184
|
+
*/
|
|
185
|
+
export function createInscriptionQuote(params: {
|
|
186
|
+
totalCostHbar: string;
|
|
187
|
+
validUntil: string;
|
|
188
|
+
breakdown?: CostBreakdown;
|
|
189
|
+
content: {
|
|
190
|
+
name?: string;
|
|
191
|
+
creator?: string;
|
|
192
|
+
type?: string;
|
|
193
|
+
};
|
|
194
|
+
}): InscriptionQuoteResponse {
|
|
195
|
+
const { totalCostHbar, validUntil, breakdown, content } = params;
|
|
196
|
+
|
|
197
|
+
return {
|
|
198
|
+
success: true,
|
|
199
|
+
type: 'quote',
|
|
200
|
+
title: 'Inscription Cost Quote',
|
|
201
|
+
message: `Estimated cost to inscribe "${
|
|
202
|
+
content.name || 'your content'
|
|
203
|
+
}" is ${totalCostHbar} HBAR.`,
|
|
204
|
+
quote: {
|
|
205
|
+
totalCostHbar,
|
|
206
|
+
validUntil,
|
|
207
|
+
breakdown,
|
|
208
|
+
},
|
|
209
|
+
content,
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* Helper function to create an error response
|
|
215
|
+
*/
|
|
216
|
+
export function createInscriptionError(params: {
|
|
217
|
+
code: string;
|
|
218
|
+
details: string;
|
|
219
|
+
suggestions?: string[];
|
|
220
|
+
}): InscriptionErrorResponse {
|
|
221
|
+
const { code, details, suggestions } = params;
|
|
222
|
+
|
|
223
|
+
return {
|
|
224
|
+
success: false,
|
|
225
|
+
type: 'error',
|
|
226
|
+
title: 'Inscription Failed',
|
|
227
|
+
message: `Unable to complete inscription: ${details}`,
|
|
228
|
+
error: {
|
|
229
|
+
code,
|
|
230
|
+
details,
|
|
231
|
+
suggestions,
|
|
232
|
+
},
|
|
233
|
+
};
|
|
234
|
+
}
|
package/src/utils/Encryption.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
2
|
import { Client, AccountId, PrivateKey, TopicMessage, TopicMessageQuery } from '@hashgraph/sdk';
|
|
3
3
|
import * as dotenv from 'dotenv';
|
|
4
4
|
import { HCS10Message } from '../hcs10/types';
|
|
5
5
|
|
|
6
|
-
// Load environment variables from .env file
|
|
7
6
|
dotenv.config();
|
|
8
7
|
|
|
9
8
|
/**
|
|
@@ -9,11 +9,22 @@ export function generateDefaultMetadata(params: {
|
|
|
9
9
|
fileName?: string;
|
|
10
10
|
mimeType?: string;
|
|
11
11
|
operatorAccount: string;
|
|
12
|
-
}) {
|
|
12
|
+
}): {
|
|
13
|
+
name: string;
|
|
14
|
+
creator: string;
|
|
15
|
+
description: string;
|
|
16
|
+
type: string;
|
|
17
|
+
image: string;
|
|
18
|
+
} {
|
|
13
19
|
const defaultName = params.fileName?.replace(/\.[^/.]+$/, '') || 'Hashinal NFT';
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
20
|
+
let defaultType = 'media';
|
|
21
|
+
if (params.mimeType?.startsWith('image/')) {
|
|
22
|
+
defaultType = 'image';
|
|
23
|
+
} else if (params.mimeType?.startsWith('video/')) {
|
|
24
|
+
defaultType = 'video';
|
|
25
|
+
} else if (params.mimeType?.startsWith('audio/')) {
|
|
26
|
+
defaultType = 'audio';
|
|
27
|
+
}
|
|
17
28
|
|
|
18
29
|
return {
|
|
19
30
|
name: params.name || defaultName,
|
package/src/utils/state-tools.ts
CHANGED
|
@@ -125,8 +125,7 @@ export async function createAgent(
|
|
|
125
125
|
client,
|
|
126
126
|
};
|
|
127
127
|
} catch (error) {
|
|
128
|
-
|
|
129
|
-
logger.error(`Error creating ${agentName} agent:`, error);
|
|
128
|
+
logger.error(`Error creating ${agentName} agent:`, error, { baseClient });
|
|
130
129
|
return null;
|
|
131
130
|
}
|
|
132
131
|
}
|
|
@@ -5,7 +5,7 @@ import { z } from 'zod';
|
|
|
5
5
|
*/
|
|
6
6
|
export const contentRefSchema = z
|
|
7
7
|
.string()
|
|
8
|
-
.regex(/^content-ref:[a-
|
|
8
|
+
.regex(/^content-ref:[a-zA-Z0-9_-]+$/, 'Content reference must be in format "content-ref:[alphanumeric-id]"')
|
|
9
9
|
.describe('Content reference in format "content-ref:[id]"');
|
|
10
10
|
|
|
11
11
|
/**
|
|
@@ -15,6 +15,6 @@ export function validateContentRef(input: string): string {
|
|
|
15
15
|
try {
|
|
16
16
|
return contentRefSchema.parse(input);
|
|
17
17
|
} catch (error) {
|
|
18
|
-
throw new Error(`Invalid content reference format. Expected "content-ref:[
|
|
18
|
+
throw new Error(`Invalid content reference format. Expected "content-ref:[alphanumeric-id]" but got "${input}"`);
|
|
19
19
|
}
|
|
20
20
|
}
|
|
@@ -39,7 +39,7 @@ export const hip412MetadataSchema = z.object({
|
|
|
39
39
|
/**
|
|
40
40
|
* Validates metadata against HIP-412 standard
|
|
41
41
|
*/
|
|
42
|
-
export function validateHIP412Metadata(metadata:
|
|
42
|
+
export function validateHIP412Metadata(metadata: unknown): z.infer<typeof hip412MetadataSchema> {
|
|
43
43
|
try {
|
|
44
44
|
return hip412MetadataSchema.parse(metadata);
|
|
45
45
|
} catch (error) {
|