@hashgraphonline/standards-agent-kit 0.2.136 → 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/README.md +3 -4
- 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/builders/inscriber/inscriber-builder.d.ts +32 -1
- 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 +3 -3
- package/dist/cjs/types/inscription-response.d.ts +8 -0
- package/dist/cjs/types/tx-results.d.ts +15 -0
- package/dist/cjs/utils/CodedError.d.ts +4 -0
- package/dist/cjs/utils/inscription-utils.d.ts +21 -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/builders/inscriber/inscriber-builder.d.ts +32 -1
- 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 -1545
- 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 -228
- package/dist/es/standards-agent-kit.es34.js.map +1 -1
- package/dist/es/standards-agent-kit.es35.js +87 -212
- package/dist/es/standards-agent-kit.es35.js.map +1 -1
- package/dist/es/standards-agent-kit.es36.js +188 -128
- package/dist/es/standards-agent-kit.es36.js.map +1 -1
- package/dist/es/standards-agent-kit.es37.js +167 -561
- package/dist/es/standards-agent-kit.es37.js.map +1 -1
- package/dist/es/standards-agent-kit.es38.js +236 -31
- 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 +21 -50
- package/dist/es/standards-agent-kit.es47.js.map +1 -1
- package/dist/es/standards-agent-kit.es48.js +8 -3
- package/dist/es/standards-agent-kit.es48.js.map +1 -1
- package/dist/es/standards-agent-kit.es49.js +3 -39
- 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 +18 -16
- package/dist/es/standards-agent-kit.es50.js.map +1 -1
- package/dist/es/standards-agent-kit.es51.js +49 -49
- package/dist/es/standards-agent-kit.es51.js.map +1 -1
- package/dist/es/standards-agent-kit.es52.js +6 -0
- package/dist/es/standards-agent-kit.es52.js.map +1 -0
- 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 +347 -32
- 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 +3 -3
- package/dist/es/types/inscription-response.d.ts +8 -0
- package/dist/es/types/tx-results.d.ts +15 -0
- package/dist/es/utils/CodedError.d.ts +4 -0
- package/dist/es/utils/inscription-utils.d.ts +21 -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/builders/inscriber/inscriber-builder.d.ts +32 -1
- 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 +3 -3
- package/dist/umd/types/inscription-response.d.ts +8 -0
- package/dist/umd/types/tx-results.d.ts +15 -0
- package/dist/umd/utils/CodedError.d.ts +4 -0
- package/dist/umd/utils/inscription-utils.d.ts +21 -0
- package/dist/umd/validation/hip412-schemas.d.ts +2 -2
- package/package.json +10 -5
- package/src/builders/hcs10/hcs10-builder.ts +239 -6
- package/src/builders/hcs2/hcs2-builder.ts +302 -9
- package/src/builders/hcs6/hcs6-builder.ts +79 -4
- package/src/builders/inscriber/inscriber-builder.ts +235 -2
- 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 +126 -21
- package/src/tools/inscriber/InscribeFromFileTool.ts +10 -13
- package/src/tools/inscriber/InscribeFromUrlTool.ts +15 -11
- package/src/tools/inscriber/InscribeHashinalTool.ts +40 -168
- package/src/tools/inscriber/RetrieveInscriptionTool.ts +15 -16
- package/src/types/inscription-response.ts +27 -0
- 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
- package/src/utils/inscription-utils.ts +53 -0
|
@@ -1,249 +1,526 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { BaseInscriberQueryTool } from "./standards-agent-kit.es35.js";
|
|
3
|
+
import { Logger, ContentResolverRegistry } from "@hashgraphonline/standards-sdk";
|
|
4
|
+
import { validateHIP412Metadata } from "./standards-agent-kit.es53.js";
|
|
5
|
+
import { contentRefSchema } from "./standards-agent-kit.es52.js";
|
|
6
|
+
import { generateDefaultMetadata } from "./standards-agent-kit.es54.js";
|
|
7
|
+
import { extendZodSchema, renderConfigs } from "./standards-agent-kit.es44.js";
|
|
8
|
+
import { createInscriptionError, createInscriptionQuote, createInscriptionSuccess, createInscriptionPending } from "./standards-agent-kit.es55.js";
|
|
9
|
+
import { extractTopicIds, buildInscriptionLinks } from "./standards-agent-kit.es50.js";
|
|
10
|
+
const HASHLINK_BLOCK_CONFIG = {
|
|
11
|
+
testnet: {
|
|
12
|
+
blockId: "0.0.6617393",
|
|
13
|
+
hashLink: "hcs://12/0.0.6617393",
|
|
14
|
+
template: "0.0.6617393"
|
|
15
|
+
},
|
|
16
|
+
mainnet: {
|
|
17
|
+
blockId: "0.0.TBD",
|
|
18
|
+
hashLink: "hcs://12/0.0.TBD",
|
|
19
|
+
template: "0.0.TBD"
|
|
19
20
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
if (!this.connectionsManager) {
|
|
26
|
-
this.logger.debug("Initializing ConnectionsManager");
|
|
27
|
-
this.connectionsManager = new ConnectionsManager({
|
|
28
|
-
baseClient,
|
|
29
|
-
logLevel: "error"
|
|
30
|
-
});
|
|
31
|
-
} else {
|
|
32
|
-
this.logger.debug("ConnectionsManager already initialized");
|
|
33
|
-
}
|
|
34
|
-
return this.connectionsManager;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Gets the ConnectionsManager instance
|
|
38
|
-
* @returns The ConnectionsManager instance, or null if not initialized
|
|
39
|
-
*/
|
|
40
|
-
getConnectionsManager() {
|
|
41
|
-
return this.connectionsManager;
|
|
21
|
+
};
|
|
22
|
+
function getHashLinkBlockId(network) {
|
|
23
|
+
const config = network === "mainnet" ? HASHLINK_BLOCK_CONFIG.mainnet : HASHLINK_BLOCK_CONFIG.testnet;
|
|
24
|
+
if (!config || config.blockId === "0.0.TBD") {
|
|
25
|
+
return HASHLINK_BLOCK_CONFIG.testnet;
|
|
42
26
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
this
|
|
52
|
-
|
|
27
|
+
return config;
|
|
28
|
+
}
|
|
29
|
+
const inscribeHashinalSchema = extendZodSchema(
|
|
30
|
+
z.object({
|
|
31
|
+
url: z.string().optional().describe(
|
|
32
|
+
"The URL of the content to inscribe as Hashinal NFT (use this OR contentRef)"
|
|
33
|
+
),
|
|
34
|
+
contentRef: contentRefSchema.optional().describe(
|
|
35
|
+
'Content reference ID in format "content-ref:[id]" for already stored content (use this OR url)'
|
|
36
|
+
),
|
|
37
|
+
base64Data: z.string().optional().describe(
|
|
38
|
+
"Base64 encoded content data (use this if neither url nor contentRef provided)"
|
|
39
|
+
),
|
|
40
|
+
fileName: z.string().optional().describe(
|
|
41
|
+
"File name for the content (required when using base64Data or contentRef)"
|
|
42
|
+
),
|
|
43
|
+
mimeType: z.string().optional().describe('MIME type of the content (e.g., "image/png", "image/jpeg")'),
|
|
44
|
+
name: z.string().optional().describe(
|
|
45
|
+
'Display name for the NFT (e.g., "Sunset Landscape #42", "Digital Abstract Art")'
|
|
46
|
+
),
|
|
47
|
+
creator: z.string().optional().describe(
|
|
48
|
+
'Creator account ID, artist name, or brand (e.g., "0.0.123456", "ArtistName", "StudioBrand")'
|
|
49
|
+
),
|
|
50
|
+
description: z.string().optional().describe(
|
|
51
|
+
"Meaningful description of the artwork, story, or concept behind this NFT"
|
|
52
|
+
),
|
|
53
|
+
type: z.string().optional().describe(
|
|
54
|
+
'Category or genre of the NFT (e.g., "Digital Art", "Photography", "Collectible Card")'
|
|
55
|
+
),
|
|
56
|
+
attributes: extendZodSchema(
|
|
57
|
+
z.array(
|
|
58
|
+
z.object({
|
|
59
|
+
trait_type: z.string(),
|
|
60
|
+
value: z.union([z.string(), z.number()])
|
|
61
|
+
})
|
|
62
|
+
)
|
|
63
|
+
).withRender(renderConfigs.array("NFT Attributes", "Attribute")).optional().describe(
|
|
64
|
+
'Collectible traits and characteristics (e.g., "Rarity": "Epic", "Color": "Blue", "Style": "Abstract")'
|
|
65
|
+
),
|
|
66
|
+
properties: z.record(z.unknown()).optional().describe("Additional properties"),
|
|
67
|
+
jsonFileURL: z.string().url().optional().describe("URL to JSON metadata file"),
|
|
68
|
+
fileStandard: z.enum(["1", "6"]).optional().default("1").describe(
|
|
69
|
+
"HCS file standard: 1 for static Hashinals (HCS-5), 6 for dynamic Hashinals (HCS-6)"
|
|
70
|
+
),
|
|
71
|
+
tags: z.array(z.string()).optional().describe("Tags to categorize the NFT"),
|
|
72
|
+
chunkSize: z.number().int().positive().optional().describe("Chunk size for large files"),
|
|
73
|
+
waitForConfirmation: z.boolean().optional().describe("Whether to wait for inscription confirmation"),
|
|
74
|
+
timeoutMs: z.number().int().positive().optional().describe(
|
|
75
|
+
"Timeout in milliseconds for inscription (default: no timeout - waits until completion)"
|
|
76
|
+
),
|
|
77
|
+
quoteOnly: z.boolean().optional().default(false).describe(
|
|
78
|
+
"If true, returns a cost quote instead of executing the inscription"
|
|
79
|
+
),
|
|
80
|
+
withHashLinkBlocks: z.boolean().optional().default(true).describe(
|
|
81
|
+
"If true, creates interactive HashLink blocks for the inscribed content and returns block data alongside the inscription response"
|
|
82
|
+
),
|
|
83
|
+
renderForm: z.boolean().optional().default(true).describe(
|
|
84
|
+
"Whether to show a form to collect metadata. Set to false only if user provided complete metadata including name, description, creator, and attributes."
|
|
85
|
+
)
|
|
86
|
+
})
|
|
87
|
+
).withRender({
|
|
88
|
+
fieldType: "object",
|
|
89
|
+
ui: {
|
|
90
|
+
label: "Inscribe Hashinal NFT",
|
|
91
|
+
description: "Create a Hashinal inscription for NFT minting"
|
|
53
92
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
93
|
+
});
|
|
94
|
+
class InscribeHashinalTool extends BaseInscriberQueryTool {
|
|
95
|
+
constructor() {
|
|
96
|
+
super(...arguments);
|
|
97
|
+
this.name = "inscribeHashinal";
|
|
98
|
+
this.description = "Tool for inscribing Hashinal NFTs. CRITICAL: When user provides content (url/contentRef/base64Data), call with ONLY the content parameters - DO NOT auto-generate name, description, creator, or attributes. A form will be automatically shown to collect metadata from the user. Only include metadata parameters if the user explicitly provided them in their message.";
|
|
59
99
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
this.logger.error(
|
|
68
|
-
"ConnectionsManager not initialized. Call initializeConnectionsManager before adding connections."
|
|
69
|
-
);
|
|
70
|
-
throw new Error(
|
|
71
|
-
"ConnectionsManager not initialized. Call initializeConnectionsManager before adding connections."
|
|
72
|
-
);
|
|
73
|
-
}
|
|
74
|
-
const sdkConnection = {
|
|
75
|
-
connectionTopicId: connection.connectionTopicId,
|
|
76
|
-
targetAccountId: connection.targetAccountId,
|
|
77
|
-
targetAgentName: connection.targetAgentName,
|
|
78
|
-
targetInboundTopicId: connection.targetInboundTopicId,
|
|
79
|
-
status: this.convertConnectionStatus(connection.status || "established"),
|
|
80
|
-
isPending: connection.isPending || false,
|
|
81
|
-
needsConfirmation: connection.needsConfirmation || false,
|
|
82
|
-
created: connection.created || /* @__PURE__ */ new Date(),
|
|
83
|
-
lastActivity: connection.lastActivity,
|
|
84
|
-
profileInfo: connection.profileInfo,
|
|
85
|
-
connectionRequestId: connection.connectionRequestId,
|
|
86
|
-
processed: true
|
|
100
|
+
getEntityResolutionPreferences() {
|
|
101
|
+
return {
|
|
102
|
+
name: "literal",
|
|
103
|
+
description: "literal",
|
|
104
|
+
creator: "literal",
|
|
105
|
+
attributes: "literal",
|
|
106
|
+
properties: "literal"
|
|
87
107
|
};
|
|
88
|
-
this.connectionsManager.updateOrAddConnection(sdkConnection);
|
|
89
|
-
this.initializeTimestampIfNeeded(connection.connectionTopicId);
|
|
90
108
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
*/
|
|
95
|
-
updateOrAddConnection(connection) {
|
|
96
|
-
this.addActiveConnection(connection);
|
|
109
|
+
get specificInputSchema() {
|
|
110
|
+
const baseSchema = inscribeHashinalSchema._def?.schema || inscribeHashinalSchema;
|
|
111
|
+
return baseSchema;
|
|
97
112
|
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
113
|
+
get schema() {
|
|
114
|
+
if (!this._schemaWithRenderConfig) {
|
|
115
|
+
const baseSchema = this.specificInputSchema;
|
|
116
|
+
const schemaWithRender = baseSchema;
|
|
117
|
+
if (!schemaWithRender._renderConfig) {
|
|
118
|
+
schemaWithRender._renderConfig = {
|
|
119
|
+
fieldType: "object",
|
|
120
|
+
ui: {
|
|
121
|
+
label: "Inscribe Hashinal NFT",
|
|
122
|
+
description: "Create a Hashinal inscription for NFT minting"
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
this._schemaWithRenderConfig = baseSchema;
|
|
107
127
|
}
|
|
108
|
-
return this.
|
|
128
|
+
return this._schemaWithRenderConfig;
|
|
109
129
|
}
|
|
110
130
|
/**
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
* - A target account ID string
|
|
114
|
-
* - A connection topic ID string
|
|
131
|
+
* Implementation of FormValidatable interface
|
|
132
|
+
* Determines if a form should be generated for the given input
|
|
115
133
|
*/
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
134
|
+
shouldGenerateForm(input) {
|
|
135
|
+
const logger = new Logger({ module: "InscribeHashinalTool" });
|
|
136
|
+
const inputObj = input;
|
|
137
|
+
logger.info("InscribeHashinalTool: Checking if form should be generated", {
|
|
138
|
+
inputKeys: Object.keys(inputObj || {}),
|
|
139
|
+
hasContent: !!(inputObj.url || inputObj.contentRef || inputObj.base64Data),
|
|
140
|
+
renderFormProvided: "renderForm" in inputObj,
|
|
141
|
+
renderFormValue: inputObj.renderForm
|
|
142
|
+
});
|
|
143
|
+
const hasContentSource = !!(inputObj.url || inputObj.contentRef || inputObj.base64Data);
|
|
144
|
+
if (!hasContentSource) {
|
|
145
|
+
logger.info("InscribeHashinalTool: No content source provided");
|
|
146
|
+
return false;
|
|
124
147
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
148
|
+
if ("renderForm" in inputObj && inputObj.renderForm === false) {
|
|
149
|
+
logger.info(
|
|
150
|
+
"InscribeHashinalTool: renderForm=false, skipping form generation"
|
|
151
|
+
);
|
|
152
|
+
return false;
|
|
128
153
|
}
|
|
129
|
-
const
|
|
130
|
-
|
|
131
|
-
|
|
154
|
+
const isNonEmptyString = (v) => {
|
|
155
|
+
if (typeof v !== "string") {
|
|
156
|
+
return false;
|
|
157
|
+
}
|
|
158
|
+
if (v.trim().length === 0) {
|
|
159
|
+
return false;
|
|
160
|
+
}
|
|
161
|
+
return true;
|
|
162
|
+
};
|
|
163
|
+
const hasRequiredMetadata = isNonEmptyString(inputObj.name) && isNonEmptyString(inputObj.description) && isNonEmptyString(inputObj.creator);
|
|
164
|
+
if (hasRequiredMetadata) {
|
|
165
|
+
logger.info(
|
|
166
|
+
"InscribeHashinalTool: Required metadata present, skipping form generation"
|
|
167
|
+
);
|
|
168
|
+
return false;
|
|
132
169
|
}
|
|
133
|
-
|
|
170
|
+
logger.info(
|
|
171
|
+
"InscribeHashinalTool: Content provided, showing form for metadata collection"
|
|
172
|
+
);
|
|
173
|
+
return true;
|
|
134
174
|
}
|
|
135
175
|
/**
|
|
136
|
-
*
|
|
137
|
-
* Returns
|
|
176
|
+
* Implementation of FormValidatable interface
|
|
177
|
+
* Returns the focused schema for form generation
|
|
138
178
|
*/
|
|
139
|
-
|
|
140
|
-
|
|
179
|
+
getFormSchema() {
|
|
180
|
+
const focusedSchema = extendZodSchema(
|
|
181
|
+
z.object({
|
|
182
|
+
name: z.string().min(1, "Name is required").describe(
|
|
183
|
+
'Display name for the NFT (e.g., "Sunset Landscape #42", "Digital Abstract Art")'
|
|
184
|
+
),
|
|
185
|
+
description: z.string().min(1, "Description is required").describe(
|
|
186
|
+
"Meaningful description of the artwork, story, or concept behind this NFT"
|
|
187
|
+
),
|
|
188
|
+
creator: z.string().min(1, "Creator is required").describe(
|
|
189
|
+
'Creator account ID, artist name, or brand (e.g., "0.0.123456", "ArtistName", "StudioBrand")'
|
|
190
|
+
),
|
|
191
|
+
attributes: extendZodSchema(
|
|
192
|
+
z.array(
|
|
193
|
+
z.object({
|
|
194
|
+
trait_type: z.string().describe('Trait name (e.g., "Rarity", "Color", "Style")'),
|
|
195
|
+
value: z.union([z.string(), z.number()]).describe('Trait value (e.g., "Epic", "Blue", 85)')
|
|
196
|
+
})
|
|
197
|
+
)
|
|
198
|
+
).withRender(renderConfigs.array("NFT Attributes", "Attribute")).optional().describe("Collectible traits and characteristics."),
|
|
199
|
+
type: z.string().optional().describe(
|
|
200
|
+
'Category or genre of the NFT (e.g., "Digital Art", "Photography", "Collectible Card)'
|
|
201
|
+
)
|
|
202
|
+
})
|
|
203
|
+
).withRender({
|
|
204
|
+
fieldType: "object",
|
|
205
|
+
ui: {
|
|
206
|
+
label: "Complete NFT Metadata",
|
|
207
|
+
description: "Provide meaningful metadata to create a valuable NFT"
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
return focusedSchema;
|
|
141
211
|
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
212
|
+
async executeQuery(params, _runManager) {
|
|
213
|
+
if (!params.url && !params.contentRef && !params.base64Data) {
|
|
214
|
+
return createInscriptionError({
|
|
215
|
+
code: "MISSING_CONTENT",
|
|
216
|
+
details: "No content source provided",
|
|
217
|
+
suggestions: [
|
|
218
|
+
"Provide a URL to content you want to inscribe",
|
|
219
|
+
"Upload a file and use the content reference",
|
|
220
|
+
"Provide base64-encoded content data"
|
|
221
|
+
]
|
|
222
|
+
});
|
|
150
223
|
}
|
|
151
|
-
const
|
|
152
|
-
|
|
153
|
-
|
|
224
|
+
const operatorAccount = this.inscriberBuilder["hederaKit"]?.client?.operatorAccountId?.toString() || "0.0.unknown";
|
|
225
|
+
const rawMetadata = {
|
|
226
|
+
...generateDefaultMetadata({
|
|
227
|
+
name: params.name,
|
|
228
|
+
creator: params.creator,
|
|
229
|
+
description: params.description,
|
|
230
|
+
type: params.type,
|
|
231
|
+
fileName: params.fileName,
|
|
232
|
+
mimeType: params.mimeType,
|
|
233
|
+
operatorAccount
|
|
234
|
+
}),
|
|
235
|
+
attributes: Array.isArray(params.attributes) ? params.attributes : [],
|
|
236
|
+
properties: params.properties || {}
|
|
237
|
+
};
|
|
238
|
+
let validatedMetadata;
|
|
239
|
+
try {
|
|
240
|
+
validatedMetadata = validateHIP412Metadata(rawMetadata);
|
|
241
|
+
} catch (error) {
|
|
242
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
243
|
+
return createInscriptionError({
|
|
244
|
+
code: "METADATA_VALIDATION_FAILED",
|
|
245
|
+
details: `Metadata validation error: ${errorMessage}`,
|
|
246
|
+
suggestions: [
|
|
247
|
+
"Ensure all required metadata fields are provided",
|
|
248
|
+
"Check that attribute values are valid",
|
|
249
|
+
"Verify metadata follows HIP-412 standard"
|
|
250
|
+
]
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
const options = {
|
|
254
|
+
mode: "hashinal",
|
|
255
|
+
metadata: validatedMetadata,
|
|
256
|
+
jsonFileURL: params.jsonFileURL,
|
|
257
|
+
fileStandard: params.fileStandard,
|
|
258
|
+
tags: params.tags,
|
|
259
|
+
chunkSize: params.chunkSize,
|
|
260
|
+
waitForConfirmation: params.quoteOnly ? false : params.waitForConfirmation ?? true,
|
|
261
|
+
waitMaxAttempts: 60,
|
|
262
|
+
waitIntervalMs: 5e3,
|
|
263
|
+
network: this.inscriberBuilder["hederaKit"].client.network.toString().includes("mainnet") ? "mainnet" : "testnet",
|
|
264
|
+
quoteOnly: params.quoteOnly
|
|
265
|
+
};
|
|
266
|
+
let inscriptionData;
|
|
267
|
+
if (params.url) {
|
|
268
|
+
inscriptionData = { type: "url", url: params.url };
|
|
269
|
+
} else if (params.contentRef || params.base64Data) {
|
|
270
|
+
const inputData = params.contentRef || params.base64Data || "";
|
|
271
|
+
const { buffer, mimeType, fileName } = await this.resolveContent(
|
|
272
|
+
inputData,
|
|
273
|
+
params.mimeType,
|
|
274
|
+
params.fileName
|
|
275
|
+
);
|
|
276
|
+
inscriptionData = {
|
|
277
|
+
type: "buffer",
|
|
278
|
+
buffer,
|
|
279
|
+
fileName: fileName || params.fileName || "hashinal-content",
|
|
280
|
+
mimeType: mimeType || params.mimeType
|
|
281
|
+
};
|
|
282
|
+
} else {
|
|
283
|
+
throw new Error("No valid input data provided for inscription");
|
|
284
|
+
}
|
|
285
|
+
if (params.quoteOnly) {
|
|
286
|
+
try {
|
|
287
|
+
const quote = await this.generateInscriptionQuote(
|
|
288
|
+
inscriptionData,
|
|
289
|
+
options
|
|
290
|
+
);
|
|
291
|
+
return createInscriptionQuote({
|
|
292
|
+
totalCostHbar: quote.totalCostHbar,
|
|
293
|
+
validUntil: quote.validUntil,
|
|
294
|
+
breakdown: quote.breakdown,
|
|
295
|
+
content: {
|
|
296
|
+
name: params.name,
|
|
297
|
+
creator: params.creator,
|
|
298
|
+
type: params.type
|
|
299
|
+
}
|
|
300
|
+
});
|
|
301
|
+
} catch (error) {
|
|
302
|
+
const errorMessage = error instanceof Error ? error.message : "Failed to generate inscription quote";
|
|
303
|
+
return createInscriptionError({
|
|
304
|
+
code: "QUOTE_GENERATION_FAILED",
|
|
305
|
+
details: `Quote generation failed: ${errorMessage}`,
|
|
306
|
+
suggestions: [
|
|
307
|
+
"Check network connectivity",
|
|
308
|
+
"Verify content is accessible",
|
|
309
|
+
"Try again in a moment"
|
|
310
|
+
]
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
try {
|
|
315
|
+
let result;
|
|
316
|
+
if (params.timeoutMs) {
|
|
317
|
+
const timeoutPromise = new Promise((_, reject) => {
|
|
318
|
+
setTimeout(
|
|
319
|
+
() => reject(
|
|
320
|
+
new Error(`Inscription timed out after ${params.timeoutMs}ms`)
|
|
321
|
+
),
|
|
322
|
+
params.timeoutMs
|
|
323
|
+
);
|
|
324
|
+
});
|
|
325
|
+
result = await Promise.race([
|
|
326
|
+
this.inscriberBuilder.inscribeAuto ? this.inscriberBuilder.inscribeAuto(inscriptionData, options) : this.inscriberBuilder.inscribe(inscriptionData, options),
|
|
327
|
+
timeoutPromise
|
|
328
|
+
]);
|
|
329
|
+
} else {
|
|
330
|
+
result = this.inscriberBuilder.inscribeAuto ? await this.inscriberBuilder.inscribeAuto(inscriptionData, options) : await this.inscriberBuilder.inscribe(inscriptionData, options);
|
|
331
|
+
}
|
|
332
|
+
if (result.confirmed && !result.quote) {
|
|
333
|
+
const ids = extractTopicIds(result.inscription, result.result);
|
|
334
|
+
const network = options.network || "testnet";
|
|
335
|
+
const fileStandard = params.fileStandard || "1";
|
|
336
|
+
const { hrl, topicId, cdnUrl } = buildInscriptionLinks(
|
|
337
|
+
ids,
|
|
338
|
+
network,
|
|
339
|
+
fileStandard
|
|
340
|
+
);
|
|
341
|
+
const txId = result.result?.transactionId ?? "unknown";
|
|
342
|
+
return createInscriptionSuccess({
|
|
343
|
+
hrl: hrl || "hcs://1/unknown",
|
|
344
|
+
topicId: topicId || "unknown",
|
|
345
|
+
standard: fileStandard === "6" ? "Dynamic" : "Static",
|
|
346
|
+
cdnUrl,
|
|
347
|
+
transactionId: txId,
|
|
348
|
+
metadata: {
|
|
349
|
+
name: params.name,
|
|
350
|
+
creator: params.creator,
|
|
351
|
+
description: params.description,
|
|
352
|
+
type: params.type,
|
|
353
|
+
attributes: Array.isArray(params.attributes) ? params.attributes : []
|
|
354
|
+
}
|
|
355
|
+
});
|
|
356
|
+
} else if (!result.quote && !result.confirmed) {
|
|
357
|
+
const txId = result.result?.transactionId ?? "unknown";
|
|
358
|
+
return createInscriptionPending({
|
|
359
|
+
transactionId: txId,
|
|
360
|
+
details: "Successfully submitted Hashinal inscription. Waiting for network confirmation..."
|
|
361
|
+
});
|
|
362
|
+
} else {
|
|
363
|
+
return createInscriptionError({
|
|
364
|
+
code: "UNEXPECTED_RESULT",
|
|
365
|
+
details: "Received an unexpected inscription result state",
|
|
366
|
+
suggestions: ["Try again or verify network status"]
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
} catch (error) {
|
|
370
|
+
const errorMessage = error instanceof Error ? error.message : "Failed to inscribe Hashinal NFT";
|
|
371
|
+
throw new Error(`Inscription failed: ${errorMessage}`);
|
|
154
372
|
}
|
|
155
373
|
}
|
|
156
374
|
/**
|
|
157
|
-
*
|
|
158
|
-
*
|
|
375
|
+
* Creates HashLink block configuration for Hashinal inscriptions.
|
|
376
|
+
* Automatically detects network and selects appropriate block ID configuration.
|
|
377
|
+
* Uses testnet block as fallback for unknown networks or undeployed mainnet blocks.
|
|
378
|
+
*
|
|
379
|
+
* @param response The inscription response containing metadata and network information
|
|
380
|
+
* @param _mimeType Optional MIME type (currently unused, preserved for compatibility)
|
|
381
|
+
* @returns HCS12BlockResult with network-specific block configuration
|
|
382
|
+
*
|
|
383
|
+
* @example
|
|
384
|
+
* ```typescript
|
|
385
|
+
* // Testnet usage (automatic detection from client)
|
|
386
|
+
* const testnetClient = Client.forTestnet();
|
|
387
|
+
* const tool = new InscribeHashinalTool(testnetClient);
|
|
388
|
+
* const block = await tool.createHashLinkBlock(inscriptionResponse);
|
|
389
|
+
* console.log(block.blockId); // '0.0.6617393'
|
|
390
|
+
* console.log(block.hashLink); // 'hcs://12/0.0.6617393'
|
|
391
|
+
*
|
|
392
|
+
* // Mainnet usage (automatic detection from client)
|
|
393
|
+
* const mainnetClient = Client.forMainnet();
|
|
394
|
+
* const tool = new InscribeHashinalTool(mainnetClient);
|
|
395
|
+
* const block = await tool.createHashLinkBlock(inscriptionResponse);
|
|
396
|
+
* console.log(block.blockId); // Network-specific mainnet block ID
|
|
397
|
+
*
|
|
398
|
+
* // HashLink Block Response Structure:
|
|
399
|
+
* {
|
|
400
|
+
* blockId: string; // Hedera account ID format (e.g., '0.0.6617393')
|
|
401
|
+
* hashLink: string; // HCS-12 URL format: 'hcs://12/{blockId}'
|
|
402
|
+
* template: string; // Block template reference matching blockId
|
|
403
|
+
* attributes: { // Metadata for client-side processing
|
|
404
|
+
* name: string; // Content display name
|
|
405
|
+
* creator: string; // Creator account ID
|
|
406
|
+
* topicId: string; // HCS topic containing the inscription
|
|
407
|
+
* hrl: string; // Hedera Resource Locator
|
|
408
|
+
* network: string; // Network type: 'testnet' | 'mainnet'
|
|
409
|
+
* }
|
|
410
|
+
* }
|
|
411
|
+
*
|
|
412
|
+
* // Render function usage in HashLink blocks:
|
|
413
|
+
* // The block's JavaScript render function receives this structure
|
|
414
|
+
* // and can access network-specific resources through attributes.network
|
|
415
|
+
* ```
|
|
159
416
|
*/
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
417
|
+
async createHashLinkBlock(response, _mimeType) {
|
|
418
|
+
const clientNetwork = this.inscriberBuilder["hederaKit"].client.network.toString().includes("mainnet") ? "mainnet" : "testnet";
|
|
419
|
+
const cdnNetwork = response.inscription.cdnUrl?.includes("mainnet") ? "mainnet" : "testnet";
|
|
420
|
+
if (clientNetwork !== cdnNetwork) {
|
|
421
|
+
const logger = new Logger({ module: "InscribeHashinalTool" });
|
|
422
|
+
logger.warn(
|
|
423
|
+
`Network mismatch detected: client=${clientNetwork}, cdn=${cdnNetwork}. Using client network.`
|
|
424
|
+
);
|
|
163
425
|
}
|
|
426
|
+
const network = clientNetwork;
|
|
427
|
+
const config = getHashLinkBlockId(network);
|
|
428
|
+
return {
|
|
429
|
+
blockId: config.blockId,
|
|
430
|
+
hashLink: config.hashLink,
|
|
431
|
+
template: config.template,
|
|
432
|
+
attributes: {
|
|
433
|
+
name: response.metadata.name || "Untitled Content",
|
|
434
|
+
creator: response.metadata.creator || "",
|
|
435
|
+
topicId: response.inscription.topicId,
|
|
436
|
+
hrl: response.inscription.hrl,
|
|
437
|
+
network
|
|
438
|
+
}
|
|
439
|
+
};
|
|
164
440
|
}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
441
|
+
async resolveContent(input, providedMimeType, providedFileName) {
|
|
442
|
+
const trimmedInput = input.trim();
|
|
443
|
+
const resolver = this.getContentResolver() || ContentResolverRegistry.getResolver();
|
|
444
|
+
if (!resolver) {
|
|
445
|
+
return this.handleDirectContent(
|
|
446
|
+
trimmedInput,
|
|
447
|
+
providedMimeType,
|
|
448
|
+
providedFileName
|
|
449
|
+
);
|
|
450
|
+
}
|
|
451
|
+
const referenceId = resolver.extractReferenceId(trimmedInput);
|
|
452
|
+
if (referenceId) {
|
|
453
|
+
try {
|
|
454
|
+
const resolution = await resolver.resolveReference(referenceId);
|
|
455
|
+
return {
|
|
456
|
+
buffer: resolution.content,
|
|
457
|
+
mimeType: resolution.metadata?.mimeType || providedMimeType,
|
|
458
|
+
fileName: resolution.metadata?.fileName || providedFileName,
|
|
459
|
+
wasReference: true
|
|
460
|
+
};
|
|
461
|
+
} catch (error) {
|
|
462
|
+
const errorMsg = error instanceof Error ? error.message : "Unknown error resolving reference";
|
|
463
|
+
throw new Error(`Reference resolution failed: ${errorMsg}`);
|
|
464
|
+
}
|
|
178
465
|
}
|
|
466
|
+
return this.handleDirectContent(
|
|
467
|
+
trimmedInput,
|
|
468
|
+
providedMimeType,
|
|
469
|
+
providedFileName
|
|
470
|
+
);
|
|
179
471
|
}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
472
|
+
handleDirectContent(input, providedMimeType, providedFileName) {
|
|
473
|
+
const isValidBase64 = /^[A-Za-z0-9+/]*={0,2}$/.test(input);
|
|
474
|
+
if (isValidBase64) {
|
|
475
|
+
try {
|
|
476
|
+
const buffer2 = Buffer.from(input, "base64");
|
|
477
|
+
return {
|
|
478
|
+
buffer: buffer2,
|
|
479
|
+
mimeType: providedMimeType,
|
|
480
|
+
fileName: providedFileName,
|
|
481
|
+
wasReference: false
|
|
482
|
+
};
|
|
483
|
+
} catch (error) {
|
|
484
|
+
throw new Error(
|
|
485
|
+
"Failed to decode base64 data. Please ensure the data is properly encoded."
|
|
486
|
+
);
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
const buffer = Buffer.from(input, "utf8");
|
|
184
490
|
return {
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
status: this.convertToStateStatus(conn.status),
|
|
190
|
-
created: conn.created,
|
|
191
|
-
lastActivity: conn.lastActivity,
|
|
192
|
-
isPending: conn.isPending,
|
|
193
|
-
needsConfirmation: conn.needsConfirmation,
|
|
194
|
-
profileInfo: conn.profileInfo,
|
|
195
|
-
connectionRequestId: conn.connectionRequestId
|
|
491
|
+
buffer,
|
|
492
|
+
mimeType: providedMimeType || "text/plain",
|
|
493
|
+
fileName: providedFileName,
|
|
494
|
+
wasReference: false
|
|
196
495
|
};
|
|
197
496
|
}
|
|
198
497
|
/**
|
|
199
|
-
*
|
|
498
|
+
* Implementation of FormValidatable interface
|
|
499
|
+
* Returns essential fields that should always be shown in forms
|
|
200
500
|
*/
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
case "pending":
|
|
204
|
-
return "pending";
|
|
205
|
-
case "established":
|
|
206
|
-
return "established";
|
|
207
|
-
case "needs_confirmation":
|
|
208
|
-
return "needs confirmation";
|
|
209
|
-
case "closed":
|
|
210
|
-
return "established";
|
|
211
|
-
// Mapping closed to established for compatibility
|
|
212
|
-
default:
|
|
213
|
-
return "unknown";
|
|
214
|
-
}
|
|
501
|
+
getEssentialFields() {
|
|
502
|
+
return ["name", "description", "creator", "attributes"];
|
|
215
503
|
}
|
|
216
504
|
/**
|
|
217
|
-
*
|
|
218
|
-
*
|
|
219
|
-
* @param options - Environment file persistence options
|
|
505
|
+
* Implementation of FormValidatable interface
|
|
506
|
+
* Determines if a field value should be considered empty for this tool
|
|
220
507
|
*/
|
|
221
|
-
|
|
222
|
-
if (
|
|
223
|
-
|
|
224
|
-
`Unsupported persistence type: ${options.type}. Only 'env-file' is supported.`
|
|
225
|
-
);
|
|
508
|
+
isFieldEmpty(fieldName, value) {
|
|
509
|
+
if (value === void 0 || value === null || value === "") {
|
|
510
|
+
return true;
|
|
226
511
|
}
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
if (!agent.accountId || !agent.inboundTopicId || !agent.outboundTopicId) {
|
|
230
|
-
throw new Error("Agent data incomplete, cannot persist to environment");
|
|
512
|
+
if (Array.isArray(value) && value.length === 0) {
|
|
513
|
+
return true;
|
|
231
514
|
}
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
};
|
|
237
|
-
if (agent.privateKey) {
|
|
238
|
-
updates[`${prefix}_PRIVATE_KEY`] = agent.privateKey;
|
|
239
|
-
}
|
|
240
|
-
if (agent.profileTopicId) {
|
|
241
|
-
updates[`${prefix}_PROFILE_TOPIC_ID`] = agent.profileTopicId;
|
|
515
|
+
if (fieldName === "attributes" && Array.isArray(value)) {
|
|
516
|
+
return value.every(
|
|
517
|
+
(attr) => !attr || typeof attr === "object" && (!attr.trait_type || !attr.value)
|
|
518
|
+
);
|
|
242
519
|
}
|
|
243
|
-
|
|
520
|
+
return false;
|
|
244
521
|
}
|
|
245
522
|
}
|
|
246
523
|
export {
|
|
247
|
-
|
|
524
|
+
InscribeHashinalTool
|
|
248
525
|
};
|
|
249
526
|
//# sourceMappingURL=standards-agent-kit.es39.js.map
|