@hashgraphonline/standards-agent-kit 0.2.132 → 0.2.135
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 +2 -39
- package/dist/cjs/lib/zod-render/config-extractor.d.ts +0 -21
- package/dist/cjs/lib/zod-render/index.d.ts +3 -3
- package/dist/cjs/lib/zod-render/schema-extension.d.ts +1 -9
- package/dist/cjs/standards-agent-kit.cjs +1 -1
- package/dist/cjs/standards-agent-kit.cjs.map +1 -1
- package/dist/cjs/tools/index.d.ts +0 -1
- package/dist/cjs/tools/inscriber/InscribeHashinalTool.d.ts +42 -1
- package/dist/cjs/tools/inscriber/base-inscriber-tools.d.ts +19 -0
- package/dist/es/builders/hcs10/hcs10-builder.d.ts +0 -2
- package/dist/es/builders/inscriber/inscriber-builder.d.ts +2 -39
- package/dist/es/lib/zod-render/config-extractor.d.ts +0 -21
- package/dist/es/lib/zod-render/index.d.ts +3 -3
- package/dist/es/lib/zod-render/schema-extension.d.ts +1 -9
- package/dist/es/standards-agent-kit.es.js +47 -6228
- package/dist/es/standards-agent-kit.es.js.map +1 -1
- package/dist/es/standards-agent-kit.es10.js +91 -0
- package/dist/es/standards-agent-kit.es10.js.map +1 -0
- package/dist/es/standards-agent-kit.es11.js +40 -0
- package/dist/es/standards-agent-kit.es11.js.map +1 -0
- package/dist/es/standards-agent-kit.es12.js +40 -0
- package/dist/es/standards-agent-kit.es12.js.map +1 -0
- package/dist/es/standards-agent-kit.es13.js +50 -0
- package/dist/es/standards-agent-kit.es13.js.map +1 -0
- package/dist/es/standards-agent-kit.es14.js +62 -0
- package/dist/es/standards-agent-kit.es14.js.map +1 -0
- package/dist/es/standards-agent-kit.es15.js +72 -0
- package/dist/es/standards-agent-kit.es15.js.map +1 -0
- package/dist/es/standards-agent-kit.es16.js +35 -0
- package/dist/es/standards-agent-kit.es16.js.map +1 -0
- package/dist/es/standards-agent-kit.es17.js +35 -0
- package/dist/es/standards-agent-kit.es17.js.map +1 -0
- package/dist/es/standards-agent-kit.es18.js +45 -0
- package/dist/es/standards-agent-kit.es18.js.map +1 -0
- package/dist/es/standards-agent-kit.es19.js +21 -0
- package/dist/es/standards-agent-kit.es19.js.map +1 -0
- package/dist/es/standards-agent-kit.es2.js +25 -0
- package/dist/es/standards-agent-kit.es2.js.map +1 -0
- package/dist/es/standards-agent-kit.es20.js +143 -0
- package/dist/es/standards-agent-kit.es20.js.map +1 -0
- package/dist/es/standards-agent-kit.es21.js +32 -0
- package/dist/es/standards-agent-kit.es21.js.map +1 -0
- package/dist/es/standards-agent-kit.es22.js +46 -0
- package/dist/es/standards-agent-kit.es22.js.map +1 -0
- package/dist/es/standards-agent-kit.es23.js +48 -0
- package/dist/es/standards-agent-kit.es23.js.map +1 -0
- package/dist/es/standards-agent-kit.es24.js +51 -0
- package/dist/es/standards-agent-kit.es24.js.map +1 -0
- package/dist/es/standards-agent-kit.es25.js +45 -0
- package/dist/es/standards-agent-kit.es25.js.map +1 -0
- package/dist/es/standards-agent-kit.es26.js +48 -0
- package/dist/es/standards-agent-kit.es26.js.map +1 -0
- package/dist/es/standards-agent-kit.es27.js +45 -0
- package/dist/es/standards-agent-kit.es27.js.map +1 -0
- package/dist/es/standards-agent-kit.es28.js +32 -0
- package/dist/es/standards-agent-kit.es28.js.map +1 -0
- package/dist/es/standards-agent-kit.es29.js +35 -0
- package/dist/es/standards-agent-kit.es29.js.map +1 -0
- package/dist/es/standards-agent-kit.es3.js +1568 -0
- package/dist/es/standards-agent-kit.es3.js.map +1 -0
- package/dist/es/standards-agent-kit.es30.js +48 -0
- package/dist/es/standards-agent-kit.es30.js.map +1 -0
- package/dist/es/standards-agent-kit.es31.js +46 -0
- package/dist/es/standards-agent-kit.es31.js.map +1 -0
- package/dist/es/standards-agent-kit.es32.js +48 -0
- package/dist/es/standards-agent-kit.es32.js.map +1 -0
- package/dist/es/standards-agent-kit.es33.js +98 -0
- package/dist/es/standards-agent-kit.es33.js.map +1 -0
- package/dist/es/standards-agent-kit.es34.js +241 -0
- package/dist/es/standards-agent-kit.es34.js.map +1 -0
- package/dist/es/standards-agent-kit.es35.js +223 -0
- package/dist/es/standards-agent-kit.es35.js.map +1 -0
- package/dist/es/standards-agent-kit.es36.js +187 -0
- package/dist/es/standards-agent-kit.es36.js.map +1 -0
- package/dist/es/standards-agent-kit.es37.js +636 -0
- package/dist/es/standards-agent-kit.es37.js.map +1 -0
- package/dist/es/standards-agent-kit.es38.js +46 -0
- package/dist/es/standards-agent-kit.es38.js.map +1 -0
- package/dist/es/standards-agent-kit.es39.js +249 -0
- package/dist/es/standards-agent-kit.es39.js.map +1 -0
- package/dist/es/standards-agent-kit.es4.js +95 -0
- package/dist/es/standards-agent-kit.es4.js.map +1 -0
- package/dist/es/standards-agent-kit.es40.js +141 -0
- package/dist/es/standards-agent-kit.es40.js.map +1 -0
- package/dist/es/standards-agent-kit.es41.js +33 -0
- package/dist/es/standards-agent-kit.es41.js.map +1 -0
- package/dist/es/standards-agent-kit.es42.js +427 -0
- package/dist/es/standards-agent-kit.es42.js.map +1 -0
- package/dist/es/standards-agent-kit.es43.js +189 -0
- package/dist/es/standards-agent-kit.es43.js.map +1 -0
- package/dist/es/standards-agent-kit.es44.js +7 -0
- package/dist/es/standards-agent-kit.es44.js.map +1 -0
- package/dist/es/standards-agent-kit.es45.js +28 -0
- package/dist/es/standards-agent-kit.es45.js.map +1 -0
- package/dist/es/standards-agent-kit.es46.js +7 -0
- package/dist/es/standards-agent-kit.es46.js.map +1 -0
- package/dist/es/standards-agent-kit.es47.js +57 -0
- package/dist/es/standards-agent-kit.es47.js.map +1 -0
- 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.es5.js +113 -0
- package/dist/es/standards-agent-kit.es5.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 +56 -0
- package/dist/es/standards-agent-kit.es6.js.map +1 -0
- package/dist/es/standards-agent-kit.es7.js +332 -0
- package/dist/es/standards-agent-kit.es7.js.map +1 -0
- package/dist/es/standards-agent-kit.es8.js +32 -0
- package/dist/es/standards-agent-kit.es8.js.map +1 -0
- package/dist/es/standards-agent-kit.es9.js +244 -0
- package/dist/es/standards-agent-kit.es9.js.map +1 -0
- package/dist/es/tools/index.d.ts +0 -1
- package/dist/es/tools/inscriber/InscribeHashinalTool.d.ts +42 -1
- package/dist/es/tools/inscriber/base-inscriber-tools.d.ts +19 -0
- package/dist/umd/builders/hcs10/hcs10-builder.d.ts +0 -2
- package/dist/umd/builders/inscriber/inscriber-builder.d.ts +2 -39
- package/dist/umd/lib/zod-render/config-extractor.d.ts +0 -21
- package/dist/umd/lib/zod-render/index.d.ts +3 -3
- package/dist/umd/lib/zod-render/schema-extension.d.ts +1 -9
- 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/index.d.ts +0 -1
- package/dist/umd/tools/inscriber/InscribeHashinalTool.d.ts +42 -1
- package/dist/umd/tools/inscriber/base-inscriber-tools.d.ts +19 -0
- package/package.json +33 -29
- package/src/builders/hcs10/hcs10-builder.ts +0 -4
- package/src/builders/inscriber/inscriber-builder.ts +2 -45
- package/src/lib/zod-render/config-extractor.ts +0 -92
- package/src/lib/zod-render/index.ts +1 -7
- package/src/lib/zod-render/schema-extension.ts +1 -69
- package/src/tools/index.ts +1 -2
- package/src/tools/inscriber/InscribeFromBufferTool.ts +2 -2
- package/src/tools/inscriber/InscribeFromUrlTool.ts +2 -2
- package/src/tools/inscriber/InscribeHashinalTool.ts +129 -20
- package/src/tools/inscriber/base-inscriber-tools.ts +26 -0
- package/src/types/inscription-response.ts +2 -2
- package/dist/cjs/lib/zod-render/__tests__/withRender.test.d.ts +0 -1
- package/dist/cjs/tools/hedera/HederaCreateNftTool.d.ts +0 -72
- package/dist/cjs/tools/hedera/index.d.ts +0 -1
- package/dist/es/lib/zod-render/__tests__/withRender.test.d.ts +0 -1
- package/dist/es/tools/hedera/HederaCreateNftTool.d.ts +0 -72
- package/dist/es/tools/hedera/index.d.ts +0 -1
- package/dist/umd/lib/zod-render/__tests__/withRender.test.d.ts +0 -1
- package/dist/umd/tools/hedera/HederaCreateNftTool.d.ts +0 -72
- package/dist/umd/tools/hedera/index.d.ts +0 -1
- package/src/lib/zod-render/__tests__/withRender.test.ts +0 -205
- package/src/tools/hedera/HederaCreateNftTool.ts +0 -294
- package/src/tools/hedera/index.ts +0 -1
|
@@ -1,205 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import {
|
|
3
|
-
extendZodSchema,
|
|
4
|
-
hasRenderConfig,
|
|
5
|
-
getRenderConfig,
|
|
6
|
-
renderConfigs,
|
|
7
|
-
installZodRenderExtensions,
|
|
8
|
-
createProgressiveSchema,
|
|
9
|
-
extractProgressiveInfo,
|
|
10
|
-
enhanceRenderConfig
|
|
11
|
-
} from '../schema-extension';
|
|
12
|
-
import { EnhancedRenderConfig } from '../types';
|
|
13
|
-
|
|
14
|
-
describe('withRender Schema Extensions', () => {
|
|
15
|
-
beforeEach(() => {
|
|
16
|
-
|
|
17
|
-
installZodRenderExtensions();
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
describe('Basic withRender functionality', () => {
|
|
21
|
-
it('should extend a schema with render configuration', () => {
|
|
22
|
-
const schema = z.string();
|
|
23
|
-
const extendedSchema = extendZodSchema(schema);
|
|
24
|
-
|
|
25
|
-
expect(typeof extendedSchema.withRender).toBe('function');
|
|
26
|
-
expect(typeof extendedSchema.withProgressive).toBe('function');
|
|
27
|
-
expect(typeof extendedSchema.withBlock).toBe('function');
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
it('should store render configuration in schema', () => {
|
|
31
|
-
const config: EnhancedRenderConfig = {
|
|
32
|
-
fieldType: 'text',
|
|
33
|
-
ui: { label: 'Test Field', priority: 'essential' },
|
|
34
|
-
progressive: { priority: 'essential' }
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
const schema = extendZodSchema(z.string()).withRender(config);
|
|
38
|
-
|
|
39
|
-
expect(hasRenderConfig(schema)).toBe(true);
|
|
40
|
-
expect(getRenderConfig(schema)).toEqual(config);
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
it('should support progressive disclosure configuration', () => {
|
|
44
|
-
const schema = extendZodSchema(z.string()).withProgressive('essential', 'Basic Info');
|
|
45
|
-
|
|
46
|
-
const progressiveInfo = extractProgressiveInfo(schema);
|
|
47
|
-
expect(progressiveInfo.priority).toBe('essential');
|
|
48
|
-
expect(progressiveInfo.group).toBe('Basic Info');
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
it('should support block configuration', () => {
|
|
52
|
-
const schema = extendZodSchema(z.string()).withBlock('account-input');
|
|
53
|
-
|
|
54
|
-
const config = getRenderConfig(schema);
|
|
55
|
-
expect(config?.block?.id).toBe('account-input');
|
|
56
|
-
expect(config?.block?.type).toBe('field');
|
|
57
|
-
expect(config?.block?.reusable).toBe(true);
|
|
58
|
-
});
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
describe('Progressive disclosure helpers', () => {
|
|
62
|
-
it('should create essential field configurations', () => {
|
|
63
|
-
const config = renderConfigs.essential.text('Name', 'Enter your name');
|
|
64
|
-
|
|
65
|
-
expect(config.fieldType).toBe('text');
|
|
66
|
-
expect(config.ui?.label).toBe('Name');
|
|
67
|
-
expect(config.ui?.placeholder).toBe('Enter your name');
|
|
68
|
-
expect(config.ui?.priority).toBe('essential');
|
|
69
|
-
expect(config.progressive?.priority).toBe('essential');
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
it('should create advanced field configurations', () => {
|
|
73
|
-
const config = renderConfigs.advanced.number('Batch Size', 1, 100);
|
|
74
|
-
|
|
75
|
-
expect(config.fieldType).toBe('number');
|
|
76
|
-
expect(config.ui?.label).toBe('Batch Size');
|
|
77
|
-
expect(config.ui?.priority).toBe('advanced');
|
|
78
|
-
expect(config.progressive?.priority).toBe('advanced');
|
|
79
|
-
expect(config.constraints?.min).toBe(1);
|
|
80
|
-
expect(config.constraints?.max).toBe(100);
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
it('should create expert field configurations', () => {
|
|
84
|
-
const config = renderConfigs.expert.textarea('Debug Info', 5);
|
|
85
|
-
|
|
86
|
-
expect(config.fieldType).toBe('textarea');
|
|
87
|
-
expect(config.ui?.label).toBe('Debug Info');
|
|
88
|
-
expect(config.ui?.priority).toBe('expert');
|
|
89
|
-
expect(config.progressive?.priority).toBe('expert');
|
|
90
|
-
expect(config.props?.rows).toBe(5);
|
|
91
|
-
});
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
describe('Global prototype extension', () => {
|
|
95
|
-
it('should add withRender to all Zod schemas', () => {
|
|
96
|
-
const stringSchema = z.string();
|
|
97
|
-
const numberSchema = z.number();
|
|
98
|
-
const objectSchema = z.object({ name: z.string() });
|
|
99
|
-
|
|
100
|
-
expect(typeof (stringSchema as any).withRender).toBe('function');
|
|
101
|
-
expect(typeof (numberSchema as any).withProgressive).toBe('function');
|
|
102
|
-
expect(typeof (objectSchema as any).withBlock).toBe('function');
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
it('should work with chained configurations', () => {
|
|
106
|
-
const schema = (z.string() as any)
|
|
107
|
-
.withProgressive('essential', 'Basic Info')
|
|
108
|
-
.withRender({ ui: { helpText: 'This is required' } });
|
|
109
|
-
|
|
110
|
-
const config = getRenderConfig(schema);
|
|
111
|
-
expect(config?.progressive?.priority).toBe('essential');
|
|
112
|
-
expect(config?.progressive?.group).toBe('Basic Info');
|
|
113
|
-
expect(config?.ui?.helpText).toBe('This is required');
|
|
114
|
-
});
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
describe('Progressive schema creation', () => {
|
|
118
|
-
it('should create schemas with grouped fields', () => {
|
|
119
|
-
const baseSchema = z.object({
|
|
120
|
-
name: z.string(),
|
|
121
|
-
symbol: z.string(),
|
|
122
|
-
batchSize: z.number().optional(),
|
|
123
|
-
adminKey: z.string().optional()
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
const groups = {
|
|
127
|
-
'Basic Info': { priority: 'essential' as const, fields: ['name', 'symbol'] },
|
|
128
|
-
'Advanced': { priority: 'advanced' as const, fields: ['batchSize', 'adminKey'] }
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
const progressiveSchema = createProgressiveSchema(baseSchema, groups);
|
|
132
|
-
|
|
133
|
-
expect(hasRenderConfig(progressiveSchema)).toBe(true);
|
|
134
|
-
});
|
|
135
|
-
});
|
|
136
|
-
|
|
137
|
-
describe('Legacy compatibility', () => {
|
|
138
|
-
it('should enhance legacy render configs', () => {
|
|
139
|
-
const legacyConfig = {
|
|
140
|
-
fieldType: 'text' as const,
|
|
141
|
-
ui: { label: 'Test', priority: 'advanced' as const }
|
|
142
|
-
};
|
|
143
|
-
|
|
144
|
-
const enhanced = enhanceRenderConfig(legacyConfig);
|
|
145
|
-
|
|
146
|
-
expect(enhanced.progressive?.priority).toBe('advanced');
|
|
147
|
-
expect(enhanced.ui?.label).toBe('Test');
|
|
148
|
-
});
|
|
149
|
-
|
|
150
|
-
it('should handle configs without priority', () => {
|
|
151
|
-
const legacyConfig = {
|
|
152
|
-
fieldType: 'text' as const,
|
|
153
|
-
ui: { label: 'Test' }
|
|
154
|
-
};
|
|
155
|
-
|
|
156
|
-
const enhanced = enhanceRenderConfig(legacyConfig);
|
|
157
|
-
|
|
158
|
-
expect(enhanced.progressive?.priority).toBe('common');
|
|
159
|
-
});
|
|
160
|
-
});
|
|
161
|
-
|
|
162
|
-
describe('Real-world usage patterns', () => {
|
|
163
|
-
it('should support individual field progressive disclosure', () => {
|
|
164
|
-
|
|
165
|
-
const tokenIdField = (z.string() as any).withProgressive('essential', 'Basic Info');
|
|
166
|
-
const batchSizeField = (z.number().optional() as any).withProgressive('advanced', 'Performance');
|
|
167
|
-
const timeoutField = (z.number().optional() as any).withProgressive('expert', 'Technical');
|
|
168
|
-
|
|
169
|
-
const tokenIdInfo = extractProgressiveInfo(tokenIdField);
|
|
170
|
-
expect(tokenIdInfo.priority).toBe('essential');
|
|
171
|
-
expect(tokenIdInfo.group).toBe('Basic Info');
|
|
172
|
-
|
|
173
|
-
const batchSizeInfo = extractProgressiveInfo(batchSizeField);
|
|
174
|
-
expect(batchSizeInfo.priority).toBe('advanced');
|
|
175
|
-
expect(batchSizeInfo.group).toBe('Performance');
|
|
176
|
-
|
|
177
|
-
const timeoutInfo = extractProgressiveInfo(timeoutField);
|
|
178
|
-
expect(timeoutInfo.priority).toBe('expert');
|
|
179
|
-
expect(timeoutInfo.group).toBe('Technical');
|
|
180
|
-
});
|
|
181
|
-
|
|
182
|
-
it('should support complex NFT schema configuration', () => {
|
|
183
|
-
const nftSchema = z.object({
|
|
184
|
-
tokenId: z.string(),
|
|
185
|
-
name: z.string(),
|
|
186
|
-
description: z.string().optional(),
|
|
187
|
-
batchSize: z.number().optional(),
|
|
188
|
-
timeoutMs: z.number().optional()
|
|
189
|
-
});
|
|
190
|
-
|
|
191
|
-
const enhancedSchema = (nftSchema as any).withRender({
|
|
192
|
-
fieldType: 'object',
|
|
193
|
-
progressive: {
|
|
194
|
-
priority: 'common',
|
|
195
|
-
group: 'NFT Creation'
|
|
196
|
-
}
|
|
197
|
-
});
|
|
198
|
-
|
|
199
|
-
expect(hasRenderConfig(enhancedSchema)).toBe(true);
|
|
200
|
-
const config = getRenderConfig(enhancedSchema);
|
|
201
|
-
expect(config?.progressive?.priority).toBe('common');
|
|
202
|
-
expect(config?.progressive?.group).toBe('NFT Creation');
|
|
203
|
-
});
|
|
204
|
-
});
|
|
205
|
-
});
|
|
@@ -1,294 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { BaseHederaTransactionTool, BaseServiceBuilder } from 'hedera-agent-kit';
|
|
3
|
-
import { extendZodSchema, renderConfigs } from '../../lib/zod-render/schema-extension';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Zod schema for a fixed fee input object with render configuration
|
|
7
|
-
*/
|
|
8
|
-
const FixedFeeInputSchema = extendZodSchema(z.object({
|
|
9
|
-
type: z.enum(['FIXED', 'FIXED_FEE']),
|
|
10
|
-
feeCollectorAccountId: z.string().optional().describe('Fee collector account ID (defaults to treasury if not provided)'),
|
|
11
|
-
denominatingTokenId: z.string().optional().describe('Denominating token ID for the fee (if not HBAR)'),
|
|
12
|
-
amount: z.union([z.number(), z.string()]).describe('Fee amount (smallest unit for tokens, or tinybars for HBAR)'),
|
|
13
|
-
})).withRender({
|
|
14
|
-
fieldType: 'object',
|
|
15
|
-
ui: {
|
|
16
|
-
label: 'Fixed Fee',
|
|
17
|
-
group: 'Custom Fees',
|
|
18
|
-
className: 'border rounded-lg p-4'
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Zod schema for a fractional fee input object with render configuration
|
|
24
|
-
*/
|
|
25
|
-
const FractionalFeeInputSchema = extendZodSchema(z.object({
|
|
26
|
-
type: z.enum(['FRACTIONAL', 'FRACTIONAL_FEE']),
|
|
27
|
-
feeCollectorAccountId: z.string().optional().describe('Fee collector account ID (defaults to treasury if not provided)'),
|
|
28
|
-
numerator: z.number().int().describe('Numerator of the fractional fee'),
|
|
29
|
-
denominator: z.number().int().positive().describe('Denominator of the fractional fee'),
|
|
30
|
-
minAmount: z.union([z.number(), z.string()]).optional().describe('Minimum fractional fee amount'),
|
|
31
|
-
maxAmount: z.union([z.number(), z.string()]).optional().describe('Maximum fractional fee amount (0 for no max)'),
|
|
32
|
-
assessmentMethodInclusive: z.boolean().optional().describe('Fee is assessed on net amount (false) or gross (true)'),
|
|
33
|
-
})).withRender({
|
|
34
|
-
fieldType: 'object',
|
|
35
|
-
ui: {
|
|
36
|
-
label: 'Fractional Fee',
|
|
37
|
-
group: 'Custom Fees',
|
|
38
|
-
className: 'border rounded-lg p-4'
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Zod schema for a royalty fee input object with render configuration
|
|
44
|
-
*/
|
|
45
|
-
const RoyaltyFeeInputSchema = extendZodSchema(z.object({
|
|
46
|
-
type: z.enum(['ROYALTY', 'ROYALTY_FEE']),
|
|
47
|
-
feeCollectorAccountId: z.string().optional().describe('Fee collector account ID (defaults to treasury if not provided)'),
|
|
48
|
-
numerator: z.number().int().describe('Numerator of the royalty fee'),
|
|
49
|
-
denominator: z.number().int().positive().describe('Denominator of the royalty fee'),
|
|
50
|
-
fallbackFee: extendZodSchema(z.object({
|
|
51
|
-
feeCollectorAccountId: z.string().optional(),
|
|
52
|
-
denominatingTokenId: z.string().optional(),
|
|
53
|
-
amount: z.union([z.number(), z.string()])
|
|
54
|
-
})).optional().describe('Fallback fixed fee if royalty is not applicable'),
|
|
55
|
-
})).withRender({
|
|
56
|
-
fieldType: 'object',
|
|
57
|
-
ui: {
|
|
58
|
-
label: 'Royalty Fee',
|
|
59
|
-
group: 'Custom Fees',
|
|
60
|
-
className: 'border rounded-lg p-4'
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Discriminated union of custom fee input types - simplified for compatibility
|
|
66
|
-
*/
|
|
67
|
-
const CustomFeeInputUnionSchema = z.union([
|
|
68
|
-
FixedFeeInputSchema,
|
|
69
|
-
FractionalFeeInputSchema,
|
|
70
|
-
RoyaltyFeeInputSchema,
|
|
71
|
-
]);
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Enhanced NFT creation schema with render configurations
|
|
75
|
-
*/
|
|
76
|
-
export const HederaCreateNftSchema = extendZodSchema(z.object({
|
|
77
|
-
tokenName: extendZodSchema(z.string().describe('The publicly visible name of the NFT collection'))
|
|
78
|
-
.withRender(renderConfigs.text('Token Name', 'Enter a unique name for your NFT collection')),
|
|
79
|
-
|
|
80
|
-
tokenSymbol: extendZodSchema(z.string().optional().describe('The publicly visible symbol of the NFT collection'))
|
|
81
|
-
.withRender(renderConfigs.text('Token Symbol', 'e.g., MYNFT, ART, GAME')),
|
|
82
|
-
|
|
83
|
-
treasuryAccountId: extendZodSchema(z.string().optional().describe('Treasury account ID (e.g., "0.0.xxxx")'))
|
|
84
|
-
.withRender(renderConfigs.text('Treasury Account', '0.0.xxxx format')),
|
|
85
|
-
|
|
86
|
-
adminKey: extendZodSchema(z.string().optional().describe('Admin key for token administration'))
|
|
87
|
-
.withRender({
|
|
88
|
-
fieldType: 'textarea',
|
|
89
|
-
ui: {
|
|
90
|
-
label: 'Admin Key (Optional)',
|
|
91
|
-
helpText: 'Serialized key for administrative operations',
|
|
92
|
-
group: 'Keys & Security'
|
|
93
|
-
}
|
|
94
|
-
}),
|
|
95
|
-
|
|
96
|
-
kycKey: extendZodSchema(z.string().optional().describe('KYC key for Know Your Customer operations'))
|
|
97
|
-
.withRender({
|
|
98
|
-
fieldType: 'textarea',
|
|
99
|
-
ui: {
|
|
100
|
-
label: 'KYC Key (Optional)',
|
|
101
|
-
helpText: 'Key for KYC verification operations',
|
|
102
|
-
group: 'Keys & Security'
|
|
103
|
-
}
|
|
104
|
-
}),
|
|
105
|
-
|
|
106
|
-
freezeKey: extendZodSchema(z.string().optional().describe('Freeze key for freezing token operations'))
|
|
107
|
-
.withRender({
|
|
108
|
-
fieldType: 'textarea',
|
|
109
|
-
ui: {
|
|
110
|
-
label: 'Freeze Key (Optional)',
|
|
111
|
-
helpText: 'Key for freezing/unfreezing token operations',
|
|
112
|
-
group: 'Keys & Security'
|
|
113
|
-
}
|
|
114
|
-
}),
|
|
115
|
-
|
|
116
|
-
wipeKey: extendZodSchema(z.string().optional().describe('Wipe key for wiping tokens from accounts'))
|
|
117
|
-
.withRender({
|
|
118
|
-
fieldType: 'textarea',
|
|
119
|
-
ui: {
|
|
120
|
-
label: 'Wipe Key (Optional)',
|
|
121
|
-
helpText: 'Key for wiping tokens from accounts',
|
|
122
|
-
group: 'Keys & Security'
|
|
123
|
-
}
|
|
124
|
-
}),
|
|
125
|
-
|
|
126
|
-
supplyKey: extendZodSchema(z.string().optional().describe('Supply key for minting/burning operations'))
|
|
127
|
-
.withRender({
|
|
128
|
-
fieldType: 'textarea',
|
|
129
|
-
ui: {
|
|
130
|
-
label: 'Supply Key (Optional)',
|
|
131
|
-
helpText: 'Key for minting and burning NFTs',
|
|
132
|
-
group: 'Keys & Security'
|
|
133
|
-
}
|
|
134
|
-
}),
|
|
135
|
-
|
|
136
|
-
feeScheduleKey: extendZodSchema(z.string().optional().describe('Fee schedule key for updating custom fees'))
|
|
137
|
-
.withRender({
|
|
138
|
-
fieldType: 'textarea',
|
|
139
|
-
ui: {
|
|
140
|
-
label: 'Fee Schedule Key (Optional)',
|
|
141
|
-
helpText: 'Key for updating custom fee schedules',
|
|
142
|
-
group: 'Keys & Security'
|
|
143
|
-
}
|
|
144
|
-
}),
|
|
145
|
-
|
|
146
|
-
pauseKey: extendZodSchema(z.string().optional().describe('Pause key for pausing token operations'))
|
|
147
|
-
.withRender({
|
|
148
|
-
fieldType: 'textarea',
|
|
149
|
-
ui: {
|
|
150
|
-
label: 'Pause Key (Optional)',
|
|
151
|
-
helpText: 'Key for pausing/unpausing token operations',
|
|
152
|
-
group: 'Keys & Security'
|
|
153
|
-
}
|
|
154
|
-
}),
|
|
155
|
-
|
|
156
|
-
autoRenewAccountId: extendZodSchema(z.string().optional().describe('Auto-renew account ID (e.g., "0.0.xxxx")'))
|
|
157
|
-
.withRender(renderConfigs.text('Auto-Renew Account', '0.0.xxxx format')),
|
|
158
|
-
|
|
159
|
-
autoRenewPeriod: extendZodSchema(z.number().int().positive().optional().describe('Auto-renewal period in seconds'))
|
|
160
|
-
.withRender(renderConfigs.number('Auto-Renew Period (seconds)', 0)),
|
|
161
|
-
|
|
162
|
-
memo: extendZodSchema(z.string().optional().describe('Memo for the NFT collection'))
|
|
163
|
-
.withRender(renderConfigs.textarea('Memo (Optional)', 2)),
|
|
164
|
-
|
|
165
|
-
freezeDefault: extendZodSchema(z.boolean().optional().describe('Default freeze status for accounts'))
|
|
166
|
-
.withRender({
|
|
167
|
-
fieldType: 'checkbox',
|
|
168
|
-
ui: {
|
|
169
|
-
label: 'Freeze by Default',
|
|
170
|
-
helpText: 'New accounts will be frozen by default',
|
|
171
|
-
group: 'Token Settings'
|
|
172
|
-
}
|
|
173
|
-
}),
|
|
174
|
-
|
|
175
|
-
supplyType: extendZodSchema(z.enum(['FINITE', 'INFINITE']).optional().default('FINITE')
|
|
176
|
-
.describe('Supply type: FINITE or INFINITE. NFTs typically use FINITE'))
|
|
177
|
-
.withRender(renderConfigs.select('Supply Type', [
|
|
178
|
-
{ value: 'FINITE', label: 'Finite Supply' },
|
|
179
|
-
{ value: 'INFINITE', label: 'Infinite Supply' }
|
|
180
|
-
])),
|
|
181
|
-
|
|
182
|
-
maxSupply: extendZodSchema(z.union([z.number(), z.string()]).optional()
|
|
183
|
-
.describe('Maximum supply if supplyType is FINITE'))
|
|
184
|
-
.withRender(renderConfigs.number('Maximum Supply', 1, 1000000000)),
|
|
185
|
-
|
|
186
|
-
customFees: extendZodSchema(z.array(CustomFeeInputUnionSchema).optional()
|
|
187
|
-
.describe('Array of custom fee objects for the token'))
|
|
188
|
-
.withRender(renderConfigs.array('Custom Fees (Optional)', 'Fee')),
|
|
189
|
-
})).withRender({
|
|
190
|
-
fieldType: 'object',
|
|
191
|
-
ui: {
|
|
192
|
-
label: 'NFT Collection Configuration',
|
|
193
|
-
description: 'Configure your new NFT collection with all required and optional settings',
|
|
194
|
-
priority: 'essential'
|
|
195
|
-
},
|
|
196
|
-
progressive: {
|
|
197
|
-
priority: 'essential'
|
|
198
|
-
}
|
|
199
|
-
});
|
|
200
|
-
|
|
201
|
-
/**
|
|
202
|
-
* Hedera Create NFT Tool with enhanced render configurations for form generation
|
|
203
|
-
*/
|
|
204
|
-
export class HederaCreateNftTool extends BaseHederaTransactionTool<any> {
|
|
205
|
-
name = 'hedera-create-nft-collection';
|
|
206
|
-
description = 'Creates a new Hedera Non-Fungible Token (NFT) collection with comprehensive form generation support. Includes render configurations for UI components, field grouping, validation hints, and user-friendly form layouts.';
|
|
207
|
-
specificInputSchema = HederaCreateNftSchema as any;
|
|
208
|
-
namespace = 'hedera';
|
|
209
|
-
|
|
210
|
-
/**
|
|
211
|
-
* Returns the service builder for HTS operations
|
|
212
|
-
*/
|
|
213
|
-
protected getServiceBuilder(): BaseServiceBuilder {
|
|
214
|
-
return this.hederaKit.hts();
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
/**
|
|
218
|
-
* Calls the builder method to create the NFT collection
|
|
219
|
-
*/
|
|
220
|
-
protected async callBuilderMethod(
|
|
221
|
-
builder: BaseServiceBuilder,
|
|
222
|
-
specificArgs: z.infer<typeof HederaCreateNftSchema>
|
|
223
|
-
): Promise<void> {
|
|
224
|
-
const htsBuilder = builder as any;
|
|
225
|
-
|
|
226
|
-
if (typeof htsBuilder.createNonFungibleToken === 'function') {
|
|
227
|
-
await htsBuilder.createNonFungibleToken(specificArgs);
|
|
228
|
-
} else {
|
|
229
|
-
throw new Error('HTS Builder does not support NFT creation');
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
/**
|
|
234
|
-
* Provides helpful notes for specific field values
|
|
235
|
-
*/
|
|
236
|
-
protected override getNoteForKey(key: string, schemaDefaultValue: unknown, actualValue: unknown): string | undefined {
|
|
237
|
-
switch (key) {
|
|
238
|
-
case 'supplyType':
|
|
239
|
-
return `NFT collection supply type set to '${actualValue}'. Most NFT collections use FINITE supply.`;
|
|
240
|
-
|
|
241
|
-
case 'maxSupply':
|
|
242
|
-
if (actualValue !== undefined) {
|
|
243
|
-
try {
|
|
244
|
-
const num = BigInt(String(actualValue));
|
|
245
|
-
return `Maximum supply of '${num.toLocaleString()}' NFTs can be minted for this collection.`;
|
|
246
|
-
} catch {
|
|
247
|
-
return `Maximum supply set to '${actualValue}' NFTs for this collection.`;
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
break;
|
|
251
|
-
|
|
252
|
-
case 'customFees':
|
|
253
|
-
if (Array.isArray(actualValue) && actualValue.length > 0) {
|
|
254
|
-
return `${actualValue.length} custom fee(s) configured for this NFT collection.`;
|
|
255
|
-
}
|
|
256
|
-
break;
|
|
257
|
-
|
|
258
|
-
case 'treasuryAccountId':
|
|
259
|
-
if (actualValue) {
|
|
260
|
-
return `Treasury account '${actualValue}' will initially hold all minted NFTs.`;
|
|
261
|
-
}
|
|
262
|
-
break;
|
|
263
|
-
|
|
264
|
-
case 'tokenName':
|
|
265
|
-
if (actualValue) {
|
|
266
|
-
return `NFT collection '${actualValue}' will be created on Hedera network.`;
|
|
267
|
-
}
|
|
268
|
-
break;
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
return undefined;
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
/**
|
|
275
|
-
* Validates the configuration before execution
|
|
276
|
-
*/
|
|
277
|
-
protected async validateInput(args: z.infer<typeof HederaCreateNftSchema>): Promise<void> {
|
|
278
|
-
|
|
279
|
-
if (args.supplyType === 'FINITE' && !args.maxSupply) {
|
|
280
|
-
throw new Error('maxSupply is required when supplyType is FINITE');
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
if (args.customFees && args.customFees.length > 0) {
|
|
284
|
-
for (const fee of args.customFees) {
|
|
285
|
-
if (fee.type === 'FRACTIONAL' && fee.denominator !== undefined && fee.denominator <= 0) {
|
|
286
|
-
throw new Error('Fractional fee denominator must be positive');
|
|
287
|
-
}
|
|
288
|
-
if (fee.type === 'ROYALTY' && fee.denominator !== undefined && fee.denominator <= 0) {
|
|
289
|
-
throw new Error('Royalty fee denominator must be positive');
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { HederaCreateNftTool, HederaCreateNftSchema } from './HederaCreateNftTool';
|