@hashgraphonline/standards-agent-kit 0.2.137 → 0.2.138
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 +1 -0
- package/dist/cjs/builders/hcs2/hcs2-builder.d.ts +8 -7
- package/dist/cjs/builders/hcs6/hcs6-builder.d.ts +5 -4
- package/dist/cjs/index.d.ts +4 -0
- package/dist/cjs/signing/bytes-registry.d.ts +17 -0
- package/dist/cjs/signing/signer-provider.d.ts +45 -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/InitiateConnectionTool.d.ts +4 -4
- package/dist/cjs/tools/hcs2/CreateRegistryTool.d.ts +2 -2
- package/dist/cjs/tools/hcs2/DeleteEntryTool.d.ts +2 -2
- package/dist/cjs/tools/hcs2/UpdateEntryTool.d.ts +2 -2
- package/dist/cjs/tools/hcs6/RegisterDynamicHashinalTool.d.ts +10 -10
- package/dist/cjs/tools/hcs6/UpdateDynamicHashinalTool.d.ts +8 -8
- package/dist/cjs/tools/inscriber/InscribeFromBufferTool.d.ts +5 -4
- package/dist/cjs/tools/inscriber/InscribeFromFileTool.d.ts +2 -2
- package/dist/cjs/tools/inscriber/InscribeFromUrlTool.d.ts +4 -4
- package/dist/cjs/tools/inscriber/InscribeHashinalTool.d.ts +1 -1
- package/dist/cjs/types/tx-results.d.ts +15 -0
- package/dist/cjs/utils/CodedError.d.ts +4 -0
- package/dist/cjs/validation/hip412-schemas.d.ts +2 -2
- package/dist/es/builders/hcs10/hcs10-builder.d.ts +1 -0
- package/dist/es/builders/hcs2/hcs2-builder.d.ts +8 -7
- package/dist/es/builders/hcs6/hcs6-builder.d.ts +5 -4
- package/dist/es/index.d.ts +4 -0
- package/dist/es/signing/bytes-registry.d.ts +17 -0
- package/dist/es/signing/signer-provider.d.ts +45 -0
- package/dist/es/standards-agent-kit.es.js +46 -42
- package/dist/es/standards-agent-kit.es.js.map +1 -1
- package/dist/es/standards-agent-kit.es10.js +24 -83
- package/dist/es/standards-agent-kit.es10.js.map +1 -1
- package/dist/es/standards-agent-kit.es11.js +224 -20
- package/dist/es/standards-agent-kit.es11.js.map +1 -1
- package/dist/es/standards-agent-kit.es12.js +78 -27
- package/dist/es/standards-agent-kit.es12.js.map +1 -1
- package/dist/es/standards-agent-kit.es13.js +26 -36
- package/dist/es/standards-agent-kit.es13.js.map +1 -1
- package/dist/es/standards-agent-kit.es14.js +17 -39
- package/dist/es/standards-agent-kit.es14.js.map +1 -1
- package/dist/es/standards-agent-kit.es15.js +36 -58
- package/dist/es/standards-agent-kit.es15.js.map +1 -1
- package/dist/es/standards-agent-kit.es16.js +45 -18
- package/dist/es/standards-agent-kit.es16.js.map +1 -1
- package/dist/es/standards-agent-kit.es17.js +53 -16
- package/dist/es/standards-agent-kit.es17.js.map +1 -1
- package/dist/es/standards-agent-kit.es18.js +18 -28
- package/dist/es/standards-agent-kit.es18.js.map +1 -1
- package/dist/es/standards-agent-kit.es19.js +26 -12
- package/dist/es/standards-agent-kit.es19.js.map +1 -1
- package/dist/es/standards-agent-kit.es20.js +38 -136
- package/dist/es/standards-agent-kit.es20.js.map +1 -1
- package/dist/es/standards-agent-kit.es21.js +13 -24
- package/dist/es/standards-agent-kit.es21.js.map +1 -1
- package/dist/es/standards-agent-kit.es22.js +136 -39
- package/dist/es/standards-agent-kit.es22.js.map +1 -1
- package/dist/es/standards-agent-kit.es23.js +25 -41
- package/dist/es/standards-agent-kit.es23.js.map +1 -1
- package/dist/es/standards-agent-kit.es24.js +49 -31
- package/dist/es/standards-agent-kit.es24.js.map +1 -1
- package/dist/es/standards-agent-kit.es25.js +34 -18
- package/dist/es/standards-agent-kit.es25.js.map +1 -1
- package/dist/es/standards-agent-kit.es26.js +35 -19
- package/dist/es/standards-agent-kit.es26.js.map +1 -1
- package/dist/es/standards-agent-kit.es27.js +45 -32
- package/dist/es/standards-agent-kit.es27.js.map +1 -1
- package/dist/es/standards-agent-kit.es28.js +54 -25
- package/dist/es/standards-agent-kit.es28.js.map +1 -1
- package/dist/es/standards-agent-kit.es29.js +35 -23
- package/dist/es/standards-agent-kit.es29.js.map +1 -1
- package/dist/es/standards-agent-kit.es3.js +41 -1549
- package/dist/es/standards-agent-kit.es3.js.map +1 -1
- package/dist/es/standards-agent-kit.es30.js +23 -39
- package/dist/es/standards-agent-kit.es30.js.map +1 -1
- package/dist/es/standards-agent-kit.es31.js +30 -28
- package/dist/es/standards-agent-kit.es31.js.map +1 -1
- package/dist/es/standards-agent-kit.es32.js +45 -32
- package/dist/es/standards-agent-kit.es32.js.map +1 -1
- package/dist/es/standards-agent-kit.es33.js +50 -89
- package/dist/es/standards-agent-kit.es33.js.map +1 -1
- package/dist/es/standards-agent-kit.es34.js +35 -234
- package/dist/es/standards-agent-kit.es34.js.map +1 -1
- package/dist/es/standards-agent-kit.es35.js +87 -213
- package/dist/es/standards-agent-kit.es35.js.map +1 -1
- package/dist/es/standards-agent-kit.es36.js +185 -129
- package/dist/es/standards-agent-kit.es36.js.map +1 -1
- package/dist/es/standards-agent-kit.es37.js +167 -563
- package/dist/es/standards-agent-kit.es37.js.map +1 -1
- package/dist/es/standards-agent-kit.es38.js +236 -30
- package/dist/es/standards-agent-kit.es38.js.map +1 -1
- package/dist/es/standards-agent-kit.es39.js +483 -206
- package/dist/es/standards-agent-kit.es39.js.map +1 -1
- package/dist/es/standards-agent-kit.es4.js +359 -81
- package/dist/es/standards-agent-kit.es4.js.map +1 -1
- package/dist/es/standards-agent-kit.es40.js +39 -135
- package/dist/es/standards-agent-kit.es40.js.map +1 -1
- package/dist/es/standards-agent-kit.es41.js +244 -28
- package/dist/es/standards-agent-kit.es41.js.map +1 -1
- package/dist/es/standards-agent-kit.es42.js +132 -418
- package/dist/es/standards-agent-kit.es42.js.map +1 -1
- package/dist/es/standards-agent-kit.es43.js +28 -184
- package/dist/es/standards-agent-kit.es43.js.map +1 -1
- package/dist/es/standards-agent-kit.es44.js +423 -3
- package/dist/es/standards-agent-kit.es44.js.map +1 -1
- package/dist/es/standards-agent-kit.es45.js +185 -24
- package/dist/es/standards-agent-kit.es45.js.map +1 -1
- package/dist/es/standards-agent-kit.es46.js +3 -3
- package/dist/es/standards-agent-kit.es46.js.map +1 -1
- package/dist/es/standards-agent-kit.es47.js +24 -20
- package/dist/es/standards-agent-kit.es47.js.map +1 -1
- package/dist/es/standards-agent-kit.es48.js +6 -52
- package/dist/es/standards-agent-kit.es48.js.map +1 -1
- package/dist/es/standards-agent-kit.es49.js +4 -3
- package/dist/es/standards-agent-kit.es49.js.map +1 -1
- package/dist/es/standards-agent-kit.es5.js +1747 -73
- package/dist/es/standards-agent-kit.es5.js.map +1 -1
- package/dist/es/standards-agent-kit.es50.js +20 -39
- package/dist/es/standards-agent-kit.es50.js.map +1 -1
- package/dist/es/standards-agent-kit.es51.js +50 -15
- package/dist/es/standards-agent-kit.es51.js.map +1 -1
- package/dist/es/standards-agent-kit.es52.js +3 -74
- package/dist/es/standards-agent-kit.es52.js.map +1 -1
- package/dist/es/standards-agent-kit.es53.js +43 -0
- package/dist/es/standards-agent-kit.es53.js.map +1 -0
- package/dist/es/standards-agent-kit.es54.js +22 -0
- package/dist/es/standards-agent-kit.es54.js.map +1 -0
- package/dist/es/standards-agent-kit.es55.js +77 -0
- package/dist/es/standards-agent-kit.es55.js.map +1 -0
- package/dist/es/standards-agent-kit.es56.js +7 -0
- package/dist/es/standards-agent-kit.es56.js.map +1 -0
- package/dist/es/standards-agent-kit.es6.js +332 -173
- package/dist/es/standards-agent-kit.es6.js.map +1 -1
- package/dist/es/standards-agent-kit.es7.js +142 -293
- package/dist/es/standards-agent-kit.es7.js.map +1 -1
- package/dist/es/standards-agent-kit.es8.js +201 -21
- package/dist/es/standards-agent-kit.es8.js.map +1 -1
- package/dist/es/standards-agent-kit.es9.js +301 -213
- package/dist/es/standards-agent-kit.es9.js.map +1 -1
- package/dist/es/tools/hcs10/InitiateConnectionTool.d.ts +4 -4
- package/dist/es/tools/hcs2/CreateRegistryTool.d.ts +2 -2
- package/dist/es/tools/hcs2/DeleteEntryTool.d.ts +2 -2
- package/dist/es/tools/hcs2/UpdateEntryTool.d.ts +2 -2
- package/dist/es/tools/hcs6/RegisterDynamicHashinalTool.d.ts +10 -10
- package/dist/es/tools/hcs6/UpdateDynamicHashinalTool.d.ts +8 -8
- package/dist/es/tools/inscriber/InscribeFromBufferTool.d.ts +5 -4
- package/dist/es/tools/inscriber/InscribeFromFileTool.d.ts +2 -2
- package/dist/es/tools/inscriber/InscribeFromUrlTool.d.ts +4 -4
- package/dist/es/tools/inscriber/InscribeHashinalTool.d.ts +1 -1
- package/dist/es/types/tx-results.d.ts +15 -0
- package/dist/es/utils/CodedError.d.ts +4 -0
- package/dist/es/validation/hip412-schemas.d.ts +2 -2
- package/dist/umd/builders/hcs10/hcs10-builder.d.ts +1 -0
- package/dist/umd/builders/hcs2/hcs2-builder.d.ts +8 -7
- package/dist/umd/builders/hcs6/hcs6-builder.d.ts +5 -4
- package/dist/umd/index.d.ts +4 -0
- package/dist/umd/signing/bytes-registry.d.ts +17 -0
- package/dist/umd/signing/signer-provider.d.ts +45 -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/InitiateConnectionTool.d.ts +4 -4
- package/dist/umd/tools/hcs2/CreateRegistryTool.d.ts +2 -2
- package/dist/umd/tools/hcs2/DeleteEntryTool.d.ts +2 -2
- package/dist/umd/tools/hcs2/UpdateEntryTool.d.ts +2 -2
- package/dist/umd/tools/hcs6/RegisterDynamicHashinalTool.d.ts +10 -10
- package/dist/umd/tools/hcs6/UpdateDynamicHashinalTool.d.ts +8 -8
- package/dist/umd/tools/inscriber/InscribeFromBufferTool.d.ts +5 -4
- package/dist/umd/tools/inscriber/InscribeFromFileTool.d.ts +2 -2
- package/dist/umd/tools/inscriber/InscribeFromUrlTool.d.ts +4 -4
- package/dist/umd/tools/inscriber/InscribeHashinalTool.d.ts +1 -1
- package/dist/umd/types/tx-results.d.ts +15 -0
- package/dist/umd/utils/CodedError.d.ts +4 -0
- package/dist/umd/validation/hip412-schemas.d.ts +2 -2
- package/package.json +3 -3
- package/src/builders/hcs10/hcs10-builder.ts +239 -10
- package/src/builders/hcs2/hcs2-builder.ts +302 -9
- package/src/builders/hcs6/hcs6-builder.ts +79 -4
- package/src/hcs10/HCS10Client.ts +1 -1
- package/src/index.ts +5 -1
- package/src/lib/zod-render/schema-extension.ts +0 -1
- package/src/signing/bytes-registry.ts +501 -0
- package/src/signing/signer-provider.ts +120 -0
- package/src/tools/hcs2/CreateRegistryTool.ts +30 -5
- package/src/tools/hcs2/DeleteEntryTool.ts +16 -2
- package/src/tools/hcs2/MigrateRegistryTool.ts +16 -2
- package/src/tools/hcs2/QueryRegistryTool.ts +11 -2
- package/src/tools/hcs2/RegisterEntryTool.ts +17 -3
- package/src/tools/hcs2/UpdateEntryTool.ts +16 -2
- package/src/tools/hcs6/CreateDynamicRegistryTool.ts +17 -3
- package/src/tools/hcs6/RegisterDynamicHashinalTool.ts +17 -3
- package/src/tools/hcs6/UpdateDynamicHashinalTool.ts +17 -3
- package/src/tools/inscriber/InscribeFromBufferTool.ts +78 -2
- package/src/tools/inscriber/InscribeHashinalTool.ts +22 -131
- package/src/types/tx-results.ts +18 -0
- package/src/utils/CodedError.ts +8 -0
- package/src/utils/Encryption.ts +0 -2
- package/src/utils/ensure-agent-has-hbar.ts +4 -5
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { BaseHCS2QueryTool } from './base-hcs2-tools';
|
|
3
3
|
import { CallbackManagerForToolRun } from '@langchain/core/callbacks/manager';
|
|
4
|
+
import { isWalletBytesResponse, type RegistryOperationResult } from '../../types/tx-results';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Schema for deleting an entry from HCS-2
|
|
@@ -37,7 +38,7 @@ export class DeleteEntryTool extends BaseHCS2QueryTool<typeof deleteEntrySchema>
|
|
|
37
38
|
_runManager?: CallbackManagerForToolRun
|
|
38
39
|
): Promise<unknown> {
|
|
39
40
|
try {
|
|
40
|
-
const result = await this.hcs2Builder.deleteEntry(
|
|
41
|
+
const result: RegistryOperationResult = await this.hcs2Builder.deleteEntry(
|
|
41
42
|
params.registryTopicId,
|
|
42
43
|
{
|
|
43
44
|
uid: params.uid,
|
|
@@ -45,10 +46,23 @@ export class DeleteEntryTool extends BaseHCS2QueryTool<typeof deleteEntrySchema>
|
|
|
45
46
|
}
|
|
46
47
|
);
|
|
47
48
|
|
|
48
|
-
if (!result.success) {
|
|
49
|
+
if (!('success' in result) || !result.success) {
|
|
49
50
|
throw new Error(result.error || 'Failed to delete entry');
|
|
50
51
|
}
|
|
51
52
|
|
|
53
|
+
if (isWalletBytesResponse(result)) {
|
|
54
|
+
const txBytes = result.transactionBytes;
|
|
55
|
+
return {
|
|
56
|
+
message: 'I prepared an unsigned transaction to delete the HCS-2 registry entry. Please review and approve to submit.',
|
|
57
|
+
transactionBytes: txBytes,
|
|
58
|
+
metadata: {
|
|
59
|
+
transactionBytes: txBytes,
|
|
60
|
+
pendingApproval: true,
|
|
61
|
+
description: `Delete HCS-2 entry (registry ${params.registryTopicId}, uid ${params.uid})`,
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
|
|
52
66
|
return `Successfully deleted entry from HCS-2 registry!\n\nRegistry Topic: ${params.registryTopicId}\nUID: ${params.uid}${params.memo ? `\nMemo: ${params.memo}` : ''}\n\nThe entry has been removed from the registry.`;
|
|
53
67
|
} catch (error) {
|
|
54
68
|
const errorMessage = error instanceof Error ? error.message : 'Failed to delete entry';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { BaseHCS2QueryTool } from './base-hcs2-tools';
|
|
3
3
|
import { CallbackManagerForToolRun } from '@langchain/core/callbacks/manager';
|
|
4
|
+
import { isWalletBytesResponse, type RegistryOperationResult } from '../../types/tx-results';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Schema for migrating an HCS-2 registry
|
|
@@ -42,7 +43,7 @@ export class MigrateRegistryTool extends BaseHCS2QueryTool<typeof migrateRegistr
|
|
|
42
43
|
_runManager?: CallbackManagerForToolRun
|
|
43
44
|
): Promise<unknown> {
|
|
44
45
|
try {
|
|
45
|
-
const result = await this.hcs2Builder.migrateRegistry(
|
|
46
|
+
const result: RegistryOperationResult = await this.hcs2Builder.migrateRegistry(
|
|
46
47
|
params.registryTopicId,
|
|
47
48
|
{
|
|
48
49
|
targetTopicId: params.targetTopicId,
|
|
@@ -51,10 +52,23 @@ export class MigrateRegistryTool extends BaseHCS2QueryTool<typeof migrateRegistr
|
|
|
51
52
|
}
|
|
52
53
|
);
|
|
53
54
|
|
|
54
|
-
if (!result.success) {
|
|
55
|
+
if (!('success' in result) || !result.success) {
|
|
55
56
|
throw new Error(result.error || 'Failed to migrate registry');
|
|
56
57
|
}
|
|
57
58
|
|
|
59
|
+
if (isWalletBytesResponse(result)) {
|
|
60
|
+
const txBytes = result.transactionBytes;
|
|
61
|
+
return {
|
|
62
|
+
message: 'I prepared an unsigned transaction to migrate the HCS-2 registry. Please review and approve to submit.',
|
|
63
|
+
transactionBytes: txBytes,
|
|
64
|
+
metadata: {
|
|
65
|
+
transactionBytes: txBytes,
|
|
66
|
+
pendingApproval: true,
|
|
67
|
+
description: `Migrate HCS-2 registry (from ${params.registryTopicId} to ${params.targetTopicId})`,
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
|
|
58
72
|
return `Successfully migrated HCS-2 registry!\n\nFrom Registry Topic: ${params.registryTopicId}\nTo Target Topic: ${params.targetTopicId}${params.metadata ? `\nMetadata: ${params.metadata}` : ''}${params.memo ? `\nMemo: ${params.memo}` : ''}\n\nThe registry has been migrated to the new topic.`;
|
|
59
73
|
} catch (error) {
|
|
60
74
|
const errorMessage = error instanceof Error ? error.message : 'Failed to migrate registry';
|
|
@@ -34,7 +34,7 @@ const queryRegistrySchema = z.object({
|
|
|
34
34
|
*/
|
|
35
35
|
export class QueryRegistryTool extends BaseHCS2QueryTool<typeof queryRegistrySchema> {
|
|
36
36
|
name = 'queryHCS2Registry';
|
|
37
|
-
description = 'Query entries from an HCS-2 registry'
|
|
37
|
+
description = 'Query entries from an HCS-2 registry (standard HCS-2). Retrieves indexed or latest entries and returns a structured summary.'
|
|
38
38
|
|
|
39
39
|
get specificInputSchema() {
|
|
40
40
|
return queryRegistrySchema;
|
|
@@ -50,9 +50,18 @@ export class QueryRegistryTool extends BaseHCS2QueryTool<typeof queryRegistrySch
|
|
|
50
50
|
skip: params.skip,
|
|
51
51
|
});
|
|
52
52
|
|
|
53
|
+
const typeVal = (registry as unknown as { registryType: unknown }).registryType;
|
|
54
|
+
const isIndexed =
|
|
55
|
+
typeVal === 0 ||
|
|
56
|
+
typeVal === '0' ||
|
|
57
|
+
String(typeVal).toLowerCase() === 'indexed' ||
|
|
58
|
+
String(typeVal).toLowerCase() === 'index' ||
|
|
59
|
+
String(typeVal).toLowerCase() === 'index_topic' ||
|
|
60
|
+
String(typeVal).toLowerCase() === 'indexed_registry';
|
|
61
|
+
|
|
53
62
|
return {
|
|
54
63
|
topicId: registry.topicId,
|
|
55
|
-
registryType:
|
|
64
|
+
registryType: isIndexed ? 'indexed' : 'non-indexed',
|
|
56
65
|
ttl: registry.ttl,
|
|
57
66
|
totalEntries: registry.entries.length,
|
|
58
67
|
entries: registry.entries.map(entry => ({
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { BaseHCS2QueryTool } from './base-hcs2-tools';
|
|
3
3
|
import { CallbackManagerForToolRun } from '@langchain/core/callbacks/manager';
|
|
4
|
+
import { isWalletBytesResponse, type RegistryOperationResult } from '../../types/tx-results';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Schema for registering an entry in HCS-2
|
|
@@ -30,7 +31,7 @@ const registerEntrySchema = z.object({
|
|
|
30
31
|
*/
|
|
31
32
|
export class RegisterEntryTool extends BaseHCS2QueryTool<typeof registerEntrySchema> {
|
|
32
33
|
name = 'registerHCS2Entry';
|
|
33
|
-
description = 'Register
|
|
34
|
+
description = 'Register an entry in an HCS-2 registry (standard HCS-2). Use this to add a target topic to an existing HCS-2 registry.'
|
|
34
35
|
|
|
35
36
|
get specificInputSchema(): typeof registerEntrySchema {
|
|
36
37
|
return registerEntrySchema;
|
|
@@ -41,7 +42,7 @@ export class RegisterEntryTool extends BaseHCS2QueryTool<typeof registerEntrySch
|
|
|
41
42
|
_runManager?: CallbackManagerForToolRun
|
|
42
43
|
): Promise<unknown> {
|
|
43
44
|
try {
|
|
44
|
-
const result = await this.hcs2Builder.registerEntry(
|
|
45
|
+
const result: RegistryOperationResult = await this.hcs2Builder.registerEntry(
|
|
45
46
|
params.registryTopicId,
|
|
46
47
|
{
|
|
47
48
|
targetTopicId: params.targetTopicId,
|
|
@@ -50,10 +51,23 @@ export class RegisterEntryTool extends BaseHCS2QueryTool<typeof registerEntrySch
|
|
|
50
51
|
}
|
|
51
52
|
);
|
|
52
53
|
|
|
53
|
-
if (!result.success) {
|
|
54
|
+
if (!('success' in result) || !result.success) {
|
|
54
55
|
throw new Error(result.error || 'Failed to register entry');
|
|
55
56
|
}
|
|
56
57
|
|
|
58
|
+
if (isWalletBytesResponse(result)) {
|
|
59
|
+
const txBytes = result.transactionBytes;
|
|
60
|
+
return {
|
|
61
|
+
message: 'I prepared an unsigned transaction to register the entry in the HCS-2 registry. Please review and approve to submit.',
|
|
62
|
+
transactionBytes: txBytes,
|
|
63
|
+
metadata: {
|
|
64
|
+
transactionBytes: txBytes,
|
|
65
|
+
pendingApproval: true,
|
|
66
|
+
description: `Register HCS-2 entry (registry ${params.registryTopicId} -> target ${params.targetTopicId})`,
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
|
|
57
71
|
return `Successfully registered entry in HCS-2 registry!\n\nRegistry Topic: ${params.registryTopicId}\nTarget Topic ID: ${params.targetTopicId}${params.metadata ? `\nMetadata: ${params.metadata}` : ''}${params.memo ? `\nMemo: ${params.memo}` : ''}\n\nThe entry has been added to the registry.`;
|
|
58
72
|
} catch (error) {
|
|
59
73
|
const errorMessage = error instanceof Error ? error.message : 'Failed to register entry';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { BaseHCS2QueryTool } from './base-hcs2-tools';
|
|
3
3
|
import { CallbackManagerForToolRun } from '@langchain/core/callbacks/manager';
|
|
4
|
+
import { isWalletBytesResponse, type RegistryOperationResult } from '../../types/tx-results';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Schema for updating an entry in HCS-2
|
|
@@ -45,7 +46,7 @@ export class UpdateEntryTool extends BaseHCS2QueryTool<typeof updateEntrySchema>
|
|
|
45
46
|
_runManager?: CallbackManagerForToolRun
|
|
46
47
|
): Promise<unknown> {
|
|
47
48
|
try {
|
|
48
|
-
const result = await this.hcs2Builder.updateEntry(
|
|
49
|
+
const result: RegistryOperationResult = await this.hcs2Builder.updateEntry(
|
|
49
50
|
params.registryTopicId,
|
|
50
51
|
{
|
|
51
52
|
targetTopicId: params.targetTopicId,
|
|
@@ -55,10 +56,23 @@ export class UpdateEntryTool extends BaseHCS2QueryTool<typeof updateEntrySchema>
|
|
|
55
56
|
}
|
|
56
57
|
);
|
|
57
58
|
|
|
58
|
-
if (!result.success) {
|
|
59
|
+
if (!('success' in result) || !result.success) {
|
|
59
60
|
throw new Error(result.error || 'Failed to update entry');
|
|
60
61
|
}
|
|
61
62
|
|
|
63
|
+
if (isWalletBytesResponse(result)) {
|
|
64
|
+
const txBytes = result.transactionBytes;
|
|
65
|
+
return {
|
|
66
|
+
message: 'I prepared an unsigned transaction to update the HCS-2 registry entry. Please review and approve to submit.',
|
|
67
|
+
transactionBytes: txBytes,
|
|
68
|
+
metadata: {
|
|
69
|
+
transactionBytes: txBytes,
|
|
70
|
+
pendingApproval: true,
|
|
71
|
+
description: `Update HCS-2 entry (registry ${params.registryTopicId}, uid ${params.uid} -> ${params.targetTopicId})`,
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
|
|
62
76
|
return `Successfully updated entry in HCS-2 registry!\n\nRegistry Topic: ${params.registryTopicId}\nUID: ${params.uid}\nNew Target Topic ID: ${params.targetTopicId}${params.metadata ? `\nMetadata: ${params.metadata}` : ''}${params.memo ? `\nMemo: ${params.memo}` : ''}\n\nThe entry has been updated in the registry.`;
|
|
63
77
|
} catch (error) {
|
|
64
78
|
const errorMessage = error instanceof Error ? error.message : 'Failed to update entry';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { BaseHCS6QueryTool } from './base-hcs6-tools';
|
|
3
|
+
import { isWalletBytesResponse } from '../../types/tx-results';
|
|
3
4
|
import { HCS6QueryToolParams } from './hcs6-tool-params';
|
|
4
5
|
import { CallbackManagerForToolRun } from '@langchain/core/callbacks/manager';
|
|
5
6
|
|
|
@@ -44,10 +45,23 @@ export class CreateDynamicRegistryTool extends BaseHCS6QueryTool<typeof CreateDy
|
|
|
44
45
|
submitKey: params.submitKey,
|
|
45
46
|
});
|
|
46
47
|
|
|
47
|
-
if (!result.success) {
|
|
48
|
-
throw new Error(result.error || 'Failed to create dynamic registry');
|
|
48
|
+
if (!('success' in result) || !result.success) {
|
|
49
|
+
throw new Error((result as any).error || 'Failed to create dynamic registry');
|
|
49
50
|
}
|
|
50
51
|
|
|
51
|
-
|
|
52
|
+
if (isWalletBytesResponse(result)) {
|
|
53
|
+
const txBytes = result.transactionBytes;
|
|
54
|
+
return {
|
|
55
|
+
message: 'I prepared an unsigned transaction to create your HCS-6 dynamic registry. Please review and approve to submit.',
|
|
56
|
+
transactionBytes: txBytes,
|
|
57
|
+
metadata: {
|
|
58
|
+
transactionBytes: txBytes,
|
|
59
|
+
pendingApproval: true,
|
|
60
|
+
description: `Create HCS-6 dynamic registry (TTL: ${params.ttl}s)`,
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return `Successfully created HCS-6 dynamic registry!\n\nTopic ID: ${(result as any).topicId}\nTTL: ${params.ttl} seconds\n\nYou can now register dynamic hashinals to this registry using the topic ID.`;
|
|
52
66
|
}
|
|
53
67
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { BaseHCS6QueryTool } from './base-hcs6-tools';
|
|
3
|
+
import { isWalletBytesResponse } from '../../types/tx-results';
|
|
3
4
|
import { HCS6QueryToolParams } from './hcs6-tool-params';
|
|
4
5
|
import { CallbackManagerForToolRun } from '@langchain/core/callbacks/manager';
|
|
5
6
|
|
|
@@ -60,10 +61,23 @@ export class RegisterDynamicHashinalTool extends BaseHCS6QueryTool<typeof Regist
|
|
|
60
61
|
submitKey: params.submitKey,
|
|
61
62
|
});
|
|
62
63
|
|
|
63
|
-
if (!result.success) {
|
|
64
|
-
throw new Error(result.error || 'Failed to register dynamic hashinal');
|
|
64
|
+
if (!('success' in result) || !result.success) {
|
|
65
|
+
throw new Error((result as any).error || 'Failed to register dynamic hashinal');
|
|
65
66
|
}
|
|
66
67
|
|
|
67
|
-
|
|
68
|
+
if (isWalletBytesResponse(result as any)) {
|
|
69
|
+
const txBytes = (result as any).transactionBytes as string;
|
|
70
|
+
return {
|
|
71
|
+
message: 'I prepared an unsigned transaction to register a dynamic hashinal. Please review and approve to submit.',
|
|
72
|
+
transactionBytes: txBytes,
|
|
73
|
+
metadata: {
|
|
74
|
+
transactionBytes: txBytes,
|
|
75
|
+
pendingApproval: true,
|
|
76
|
+
description: `Register dynamic hashinal${params.memo ? ` (Memo: ${params.memo})` : ''}`,
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return `Successfully registered dynamic hashinal!\n\nRegistry Topic ID: ${(result as any).registryTopicId}\nInscription Topic ID: ${(result as any).inscriptionTopicId}${params.memo ? `\nMemo: ${params.memo}` : ''}\n\nThe dynamic hashinal has been created and can be updated using the registry topic ID.`;
|
|
68
82
|
}
|
|
69
83
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { BaseHCS6QueryTool } from './base-hcs6-tools';
|
|
3
|
+
import { isWalletBytesResponse } from '../../types/tx-results';
|
|
3
4
|
import { HCS6QueryToolParams } from './hcs6-tool-params';
|
|
4
5
|
import { CallbackManagerForToolRun } from '@langchain/core/callbacks/manager';
|
|
5
6
|
|
|
@@ -54,10 +55,23 @@ export class UpdateDynamicHashinalTool extends BaseHCS6QueryTool<typeof UpdateDy
|
|
|
54
55
|
submitKey: params.submitKey,
|
|
55
56
|
});
|
|
56
57
|
|
|
57
|
-
if (!result.success) {
|
|
58
|
-
throw new Error(result.error || 'Failed to update dynamic hashinal');
|
|
58
|
+
if (!('success' in result) || !result.success) {
|
|
59
|
+
throw new Error((result as any).error || 'Failed to update dynamic hashinal');
|
|
59
60
|
}
|
|
60
61
|
|
|
61
|
-
|
|
62
|
+
if (isWalletBytesResponse(result as any)) {
|
|
63
|
+
const txBytes = (result as any).transactionBytes as string;
|
|
64
|
+
return {
|
|
65
|
+
message: 'I prepared an unsigned transaction to update a dynamic hashinal. Please review and approve to submit.',
|
|
66
|
+
transactionBytes: txBytes,
|
|
67
|
+
metadata: {
|
|
68
|
+
transactionBytes: txBytes,
|
|
69
|
+
pendingApproval: true,
|
|
70
|
+
description: `Update dynamic hashinal (registry ${params.registryTopicId})${params.memo ? ` (Memo: ${params.memo})` : ''}`,
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return `Successfully updated dynamic hashinal!\n\nRegistry Topic ID: ${params.registryTopicId}\nInscription Topic ID: ${(result as any).inscriptionTopicId}${params.memo ? `\nUpdate Memo: ${params.memo}` : ''}\n\nThe dynamic hashinal has been updated with new content.`;
|
|
62
76
|
}
|
|
63
77
|
}
|
|
@@ -64,19 +64,92 @@ export class InscribeFromBufferTool extends BaseInscriberQueryTool<
|
|
|
64
64
|
return inscribeFromBufferSchema;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
+
protected override async _call(
|
|
68
|
+
args: z.infer<typeof inscribeFromBufferSchema>,
|
|
69
|
+
_runManager?: CallbackManagerForToolRun
|
|
70
|
+
): Promise<string> {
|
|
71
|
+
try {
|
|
72
|
+
const input = typeof args.base64Data === 'string' ? args.base64Data : '';
|
|
73
|
+
const buffer = /^[A-Za-z0-9+/]*={0,2}$/.test(input)
|
|
74
|
+
? Buffer.from(input, 'base64')
|
|
75
|
+
: Buffer.from(input, 'utf8');
|
|
76
|
+
|
|
77
|
+
const fileName = args.fileName;
|
|
78
|
+
const mimeType = args.mimeType;
|
|
79
|
+
|
|
80
|
+
const network = this.inscriberBuilder['hederaKit'].client.network
|
|
81
|
+
.toString()
|
|
82
|
+
.includes('mainnet')
|
|
83
|
+
? 'mainnet'
|
|
84
|
+
: 'testnet';
|
|
85
|
+
|
|
86
|
+
const options: InscriptionOptions = {
|
|
87
|
+
mode: 'file',
|
|
88
|
+
metadata: args.metadata,
|
|
89
|
+
tags: args.tags,
|
|
90
|
+
chunkSize: args.chunkSize,
|
|
91
|
+
waitForConfirmation: args.quoteOnly ? false : args.waitForConfirmation ?? true,
|
|
92
|
+
waitMaxAttempts: 60,
|
|
93
|
+
waitIntervalMs: 5000,
|
|
94
|
+
apiKey: args.apiKey,
|
|
95
|
+
network,
|
|
96
|
+
quoteOnly: args.quoteOnly,
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
const result = await this.inscriberBuilder.inscribe(
|
|
100
|
+
{ type: 'buffer', buffer, fileName, mimeType },
|
|
101
|
+
options
|
|
102
|
+
);
|
|
103
|
+
|
|
104
|
+
const typed = result as InscriptionResponse;
|
|
105
|
+
if (typed.confirmed && !typed.quote) {
|
|
106
|
+
const ids = extractTopicIds(typed.inscription, typed.result);
|
|
107
|
+
const { topicId, cdnUrl } = buildInscriptionLinks(ids, network, '1');
|
|
108
|
+
return JSON.stringify({
|
|
109
|
+
success: true,
|
|
110
|
+
data: `Successfully inscribed and confirmed content on the Hedera network!\n\nTransaction ID: ${
|
|
111
|
+
(typed.result as InscriptionResult)?.transactionId ?? 'unknown'
|
|
112
|
+
}\nTopic ID: ${topicId || 'N/A'}${
|
|
113
|
+
cdnUrl ? `\nView inscription: ${cdnUrl}` : ''
|
|
114
|
+
}\n\nThe inscription is now available.`,
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
return JSON.stringify({
|
|
119
|
+
success: true,
|
|
120
|
+
data: `Successfully submitted inscription to the Hedera network!\n\nTransaction ID: ${
|
|
121
|
+
(typed.result as InscriptionResult)?.transactionId ?? 'unknown'
|
|
122
|
+
}\n\nThe inscription is processing and will be confirmed shortly.`,
|
|
123
|
+
});
|
|
124
|
+
} catch (error) {
|
|
125
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
126
|
+
return JSON.stringify({ success: false, error: `Inscription failed: ${errorMessage}` });
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
67
130
|
protected async executeQuery(
|
|
68
131
|
params: z.infer<typeof inscribeFromBufferSchema>,
|
|
69
132
|
_runManager?: CallbackManagerForToolRun
|
|
70
133
|
): Promise<unknown> {
|
|
71
|
-
this.validateInput(params);
|
|
72
134
|
|
|
73
135
|
const resolvedContent = await resolveContent(
|
|
74
136
|
params.base64Data,
|
|
75
137
|
params.mimeType,
|
|
76
138
|
params.fileName
|
|
77
139
|
);
|
|
140
|
+
console.log('[InscribeFromBufferTool] Resolved content bytes:', resolvedContent.buffer?.length ?? -1);
|
|
78
141
|
|
|
79
|
-
|
|
142
|
+
try {
|
|
143
|
+
this.validateContent(resolvedContent.buffer);
|
|
144
|
+
} catch (validationError) {
|
|
145
|
+
this.logger?.warn(
|
|
146
|
+
`Content validation warning: ${
|
|
147
|
+
validationError instanceof Error
|
|
148
|
+
? validationError.message
|
|
149
|
+
: String(validationError)
|
|
150
|
+
}`
|
|
151
|
+
);
|
|
152
|
+
}
|
|
80
153
|
|
|
81
154
|
const buffer = resolvedContent.buffer;
|
|
82
155
|
const resolvedMimeType = resolvedContent.mimeType || params.mimeType;
|
|
@@ -139,6 +212,7 @@ export class InscribeFromBufferTool extends BaseInscriberQueryTool<
|
|
|
139
212
|
}
|
|
140
213
|
|
|
141
214
|
try {
|
|
215
|
+
console.log('[InscribeFromBufferTool] Calling inscribe with fileName:', resolvedFileName, 'mime:', resolvedMimeType);
|
|
142
216
|
const result = await this.executeInscription(
|
|
143
217
|
buffer,
|
|
144
218
|
resolvedFileName,
|
|
@@ -146,8 +220,10 @@ export class InscribeFromBufferTool extends BaseInscriberQueryTool<
|
|
|
146
220
|
options,
|
|
147
221
|
params.timeoutMs
|
|
148
222
|
);
|
|
223
|
+
console.log('[InscribeFromBufferTool] Inscribe result (confirmed):', Boolean((result as any)?.confirmed));
|
|
149
224
|
return this.formatInscriptionResult(result, options);
|
|
150
225
|
} catch (error) {
|
|
226
|
+
console.warn('[InscribeFromBufferTool] Error during inscription:', error);
|
|
151
227
|
const errorMessage =
|
|
152
228
|
error instanceof Error
|
|
153
229
|
? error.message
|
|
@@ -51,7 +51,9 @@ const HASHLINK_BLOCK_CONFIG = {
|
|
|
51
51
|
* @param network The network type to get configuration for
|
|
52
52
|
* @returns Network-specific block configuration with blockId, hashLink, and template
|
|
53
53
|
*/
|
|
54
|
-
function getHashLinkBlockId(
|
|
54
|
+
function getHashLinkBlockId(
|
|
55
|
+
network: 'mainnet' | 'testnet',
|
|
56
|
+
): { blockId: string; hashLink: string; template: string } {
|
|
55
57
|
const config =
|
|
56
58
|
network === 'mainnet'
|
|
57
59
|
? HASHLINK_BLOCK_CONFIG.mainnet
|
|
@@ -534,143 +536,41 @@ export class InscribeHashinalTool
|
|
|
534
536
|
|
|
535
537
|
if (result.confirmed && !result.quote) {
|
|
536
538
|
const ids = extractTopicIds(result.inscription, result.result);
|
|
537
|
-
const network = options.network || 'testnet';
|
|
539
|
+
const network = (options.network || 'testnet') as 'mainnet' | 'testnet';
|
|
538
540
|
const fileStandard = params.fileStandard || '1';
|
|
539
|
-
const { hrl,
|
|
541
|
+
const { hrl, topicId, cdnUrl } = buildInscriptionLinks(
|
|
540
542
|
ids,
|
|
541
543
|
network,
|
|
542
544
|
fileStandard
|
|
543
545
|
);
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
code: 'MISSING_TOPIC_ID',
|
|
549
|
-
details: 'Inscription completed but topic ID is missing',
|
|
550
|
-
suggestions: [
|
|
551
|
-
'Try the inscription again',
|
|
552
|
-
'Contact support if the issue persists',
|
|
553
|
-
],
|
|
554
|
-
});
|
|
555
|
-
}
|
|
556
|
-
|
|
557
|
-
const inscriptionResponse = createInscriptionSuccess({
|
|
558
|
-
hrl,
|
|
546
|
+
|
|
547
|
+
const txId = (result.result as InscriptionResult)?.transactionId ?? 'unknown';
|
|
548
|
+
return createInscriptionSuccess({
|
|
549
|
+
hrl: hrl || 'hcs://1/unknown',
|
|
559
550
|
topicId: topicId || 'unknown',
|
|
560
|
-
standard:
|
|
561
|
-
cdnUrl
|
|
562
|
-
transactionId:
|
|
551
|
+
standard: fileStandard === '6' ? 'Dynamic' : 'Static',
|
|
552
|
+
cdnUrl,
|
|
553
|
+
transactionId: txId,
|
|
563
554
|
metadata: {
|
|
564
555
|
name: params.name,
|
|
565
556
|
creator: params.creator,
|
|
566
557
|
description: params.description,
|
|
567
558
|
type: params.type,
|
|
568
|
-
attributes: params.attributes,
|
|
559
|
+
attributes: Array.isArray(params.attributes) ? params.attributes : [],
|
|
569
560
|
},
|
|
570
561
|
});
|
|
571
|
-
|
|
572
|
-
this.onEntityCreated?.({
|
|
573
|
-
entityId: topicId || 'unknown',
|
|
574
|
-
entityName: params.name || 'Unnamed Inscription',
|
|
575
|
-
entityType: 'topicId',
|
|
576
|
-
transactionId: (result.result as InscriptionResult)?.transactionId,
|
|
577
|
-
});
|
|
578
|
-
|
|
579
|
-
if (params.withHashLinkBlocks) {
|
|
580
|
-
try {
|
|
581
|
-
const blockData = await this.createHashLinkBlock(
|
|
582
|
-
inscriptionResponse,
|
|
583
|
-
inscriptionData.type === 'buffer'
|
|
584
|
-
? inscriptionData.mimeType
|
|
585
|
-
: undefined
|
|
586
|
-
);
|
|
587
|
-
|
|
588
|
-
inscriptionResponse.hashLinkBlock = blockData;
|
|
589
|
-
} catch (blockError) {
|
|
590
|
-
const logger = new Logger({ module: 'InscribeHashinalTool' });
|
|
591
|
-
logger.error('Failed to create HashLink block', {
|
|
592
|
-
error: blockError,
|
|
593
|
-
});
|
|
594
|
-
}
|
|
595
|
-
}
|
|
596
|
-
|
|
597
|
-
return inscriptionResponse;
|
|
598
562
|
} else if (!result.quote && !result.confirmed) {
|
|
599
|
-
const
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
ids,
|
|
605
|
-
network,
|
|
606
|
-
fileStandard
|
|
607
|
-
);
|
|
608
|
-
const standardType = fileStandard === '6' ? 'Dynamic' : 'Static';
|
|
609
|
-
|
|
610
|
-
if (hrl) {
|
|
611
|
-
const inscriptionResponse = createInscriptionSuccess({
|
|
612
|
-
hrl,
|
|
613
|
-
topicId: topicId || 'unknown',
|
|
614
|
-
standard: standardType as 'Static' | 'Dynamic',
|
|
615
|
-
cdnUrl: cdnUrl || undefined,
|
|
616
|
-
transactionId: (result.result as InscriptionResult)
|
|
617
|
-
?.transactionId,
|
|
618
|
-
metadata: {
|
|
619
|
-
name: params.name,
|
|
620
|
-
creator: params.creator,
|
|
621
|
-
description: params.description,
|
|
622
|
-
type: params.type,
|
|
623
|
-
attributes: params.attributes,
|
|
624
|
-
},
|
|
625
|
-
});
|
|
626
|
-
|
|
627
|
-
this.onEntityCreated?.({
|
|
628
|
-
entityId: topicId || 'unknown',
|
|
629
|
-
entityName: params.name || 'Unnamed Inscription',
|
|
630
|
-
entityType: 'topicId',
|
|
631
|
-
transactionId: (result.result as InscriptionResult)
|
|
632
|
-
?.transactionId,
|
|
633
|
-
});
|
|
634
|
-
|
|
635
|
-
if (params.withHashLinkBlocks) {
|
|
636
|
-
try {
|
|
637
|
-
const blockData = await this.createHashLinkBlock(
|
|
638
|
-
inscriptionResponse,
|
|
639
|
-
inscriptionData.type === 'buffer'
|
|
640
|
-
? inscriptionData.mimeType
|
|
641
|
-
: undefined
|
|
642
|
-
);
|
|
643
|
-
|
|
644
|
-
inscriptionResponse.hashLinkBlock = blockData;
|
|
645
|
-
} catch (blockError) {
|
|
646
|
-
const logger = new Logger({ module: 'InscribeHashinalTool' });
|
|
647
|
-
logger.error('Failed to create HashLink block', {
|
|
648
|
-
error: blockError,
|
|
649
|
-
});
|
|
650
|
-
}
|
|
651
|
-
}
|
|
652
|
-
|
|
653
|
-
return inscriptionResponse;
|
|
654
|
-
}
|
|
655
|
-
}
|
|
656
|
-
|
|
657
|
-
const transactionId =
|
|
658
|
-
(result.result as InscriptionResult)?.transactionId || 'unknown';
|
|
659
|
-
const pending = createInscriptionPending({
|
|
660
|
-
transactionId,
|
|
563
|
+
const txId = (result.result as InscriptionResult)?.transactionId ?? 'unknown';
|
|
564
|
+
return createInscriptionPending({
|
|
565
|
+
transactionId: txId,
|
|
566
|
+
details:
|
|
567
|
+
'Successfully submitted Hashinal inscription. Waiting for network confirmation...'
|
|
661
568
|
});
|
|
662
|
-
return {
|
|
663
|
-
...pending,
|
|
664
|
-
metadata: { transactionId },
|
|
665
|
-
} as unknown as InscriptionResponse;
|
|
666
569
|
} else {
|
|
667
570
|
return createInscriptionError({
|
|
668
|
-
code: '
|
|
669
|
-
details: '
|
|
670
|
-
suggestions: [
|
|
671
|
-
'Check if the inscription was successful manually',
|
|
672
|
-
'Try the inscription again',
|
|
673
|
-
],
|
|
571
|
+
code: 'UNEXPECTED_RESULT',
|
|
572
|
+
details: 'Received an unexpected inscription result state',
|
|
573
|
+
suggestions: ['Try again or verify network status']
|
|
674
574
|
});
|
|
675
575
|
}
|
|
676
576
|
} catch (error) {
|
|
@@ -678,16 +578,7 @@ export class InscribeHashinalTool
|
|
|
678
578
|
error instanceof Error
|
|
679
579
|
? error.message
|
|
680
580
|
: 'Failed to inscribe Hashinal NFT';
|
|
681
|
-
|
|
682
|
-
code: 'INSCRIPTION_FAILED',
|
|
683
|
-
details: `Inscription failed: ${errorMessage}`,
|
|
684
|
-
suggestions: [
|
|
685
|
-
'Check network connectivity',
|
|
686
|
-
'Verify you have sufficient HBAR balance',
|
|
687
|
-
'Ensure content is accessible and valid',
|
|
688
|
-
'Try again in a moment',
|
|
689
|
-
],
|
|
690
|
-
});
|
|
581
|
+
throw new Error(`Inscription failed: ${errorMessage}`);
|
|
691
582
|
}
|
|
692
583
|
}
|
|
693
584
|
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { TopicRegistrationResponse, RegistryOperationResponse, HCS6TopicRegistrationResponse, HCS6RegistryOperationResponse, HCS6CreateHashinalResponse } from '@hashgraphonline/standards-sdk';
|
|
2
|
+
|
|
3
|
+
export interface WalletBytesResponse {
|
|
4
|
+
success: true;
|
|
5
|
+
transactionBytes: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export function isWalletBytesResponse(value: unknown): value is WalletBytesResponse {
|
|
9
|
+
return !!value && typeof (value as any).transactionBytes === 'string';
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export type TopicRegistrationResult = TopicRegistrationResponse | WalletBytesResponse;
|
|
13
|
+
export type RegistryOperationResult = RegistryOperationResponse | WalletBytesResponse;
|
|
14
|
+
export type SubmitMessageResult = { success: true; transactionId?: string } | WalletBytesResponse;
|
|
15
|
+
|
|
16
|
+
export type HCS6TopicRegistrationResult = HCS6TopicRegistrationResponse | WalletBytesResponse;
|
|
17
|
+
export type HCS6RegistryOperationResult = HCS6RegistryOperationResponse | WalletBytesResponse;
|
|
18
|
+
export type HCS6CreateHashinalResult = HCS6CreateHashinalResponse | WalletBytesResponse;
|
package/src/utils/Encryption.ts
CHANGED
|
@@ -6,11 +6,9 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
export function encryptMessage(message: string): string {
|
|
9
|
-
// TODO: Add encryption logic here if useEncryption flag is true.
|
|
10
9
|
return message; // currently returns plaintext.
|
|
11
10
|
}
|
|
12
11
|
|
|
13
12
|
export function decryptMessage(encryptedMessage: string): string {
|
|
14
|
-
// TODO: Add decryption logic here.
|
|
15
13
|
return encryptedMessage;
|
|
16
14
|
}
|