@hashgraphonline/standards-sdk 0.0.83 → 0.0.85

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.
Files changed (239) hide show
  1. package/dist/es/hcs-10/base-client.d.ts.map +1 -1
  2. package/dist/es/hcs-10/connections-manager.d.ts +203 -0
  3. package/dist/es/hcs-10/connections-manager.d.ts.map +1 -0
  4. package/dist/es/hcs-10/index.d.ts +1 -0
  5. package/dist/es/hcs-10/index.d.ts.map +1 -1
  6. package/dist/es/standards-sdk.es.js +13 -11
  7. package/dist/es/standards-sdk.es.js.map +1 -1
  8. package/dist/es/standards-sdk.es10.js +778 -115
  9. package/dist/es/standards-sdk.es10.js.map +1 -1
  10. package/dist/es/standards-sdk.es100.js +127 -138
  11. package/dist/es/standards-sdk.es100.js.map +1 -1
  12. package/dist/es/standards-sdk.es101.js +90 -22
  13. package/dist/es/standards-sdk.es101.js.map +1 -1
  14. package/dist/es/standards-sdk.es102.js +78 -787
  15. package/dist/es/standards-sdk.es102.js.map +1 -1
  16. package/dist/es/standards-sdk.es103.js +31 -3
  17. package/dist/es/standards-sdk.es103.js.map +1 -1
  18. package/dist/es/standards-sdk.es104.js +5 -142
  19. package/dist/es/standards-sdk.es104.js.map +1 -1
  20. package/dist/es/standards-sdk.es105.js +145 -160
  21. package/dist/es/standards-sdk.es105.js.map +1 -1
  22. package/dist/es/standards-sdk.es106.js +22 -33
  23. package/dist/es/standards-sdk.es106.js.map +1 -1
  24. package/dist/es/standards-sdk.es107.js +790 -30
  25. package/dist/es/standards-sdk.es107.js.map +1 -1
  26. package/dist/es/standards-sdk.es108.js +174 -9
  27. package/dist/es/standards-sdk.es108.js.map +1 -1
  28. package/dist/es/standards-sdk.es109.js +139 -30
  29. package/dist/es/standards-sdk.es109.js.map +1 -1
  30. package/dist/es/standards-sdk.es11.js +103 -58
  31. package/dist/es/standards-sdk.es11.js.map +1 -1
  32. package/dist/es/standards-sdk.es110.js +16 -414
  33. package/dist/es/standards-sdk.es110.js.map +1 -1
  34. package/dist/es/standards-sdk.es111.js +27 -2
  35. package/dist/es/standards-sdk.es111.js.map +1 -1
  36. package/dist/es/standards-sdk.es112.js +24 -118
  37. package/dist/es/standards-sdk.es112.js.map +1 -1
  38. package/dist/es/standards-sdk.es113.js +36 -19
  39. package/dist/es/standards-sdk.es113.js.map +1 -1
  40. package/dist/es/standards-sdk.es114.js +3 -26
  41. package/dist/es/standards-sdk.es114.js.map +1 -1
  42. package/dist/es/standards-sdk.es115.js +418 -25
  43. package/dist/es/standards-sdk.es115.js.map +1 -1
  44. package/dist/es/standards-sdk.es116.js +2 -38
  45. package/dist/es/standards-sdk.es116.js.map +1 -1
  46. package/dist/es/standards-sdk.es117.js +123 -0
  47. package/dist/es/standards-sdk.es117.js.map +1 -0
  48. package/dist/es/standards-sdk.es12.js +82 -628
  49. package/dist/es/standards-sdk.es12.js.map +1 -1
  50. package/dist/es/standards-sdk.es13.js +650 -85
  51. package/dist/es/standards-sdk.es13.js.map +1 -1
  52. package/dist/es/standards-sdk.es14.js +84 -58
  53. package/dist/es/standards-sdk.es14.js.map +1 -1
  54. package/dist/es/standards-sdk.es15.js +57 -20
  55. package/dist/es/standards-sdk.es15.js.map +1 -1
  56. package/dist/es/standards-sdk.es16.js +18 -156
  57. package/dist/es/standards-sdk.es16.js.map +1 -1
  58. package/dist/es/standards-sdk.es17.js +138 -385
  59. package/dist/es/standards-sdk.es17.js.map +1 -1
  60. package/dist/es/standards-sdk.es18.js +385 -315
  61. package/dist/es/standards-sdk.es18.js.map +1 -1
  62. package/dist/es/standards-sdk.es19.js +310 -128
  63. package/dist/es/standards-sdk.es19.js.map +1 -1
  64. package/dist/es/standards-sdk.es2.js +1 -12
  65. package/dist/es/standards-sdk.es2.js.map +1 -1
  66. package/dist/es/standards-sdk.es20.js +155 -7
  67. package/dist/es/standards-sdk.es20.js.map +1 -1
  68. package/dist/es/standards-sdk.es21.js +7 -1767
  69. package/dist/es/standards-sdk.es21.js.map +1 -1
  70. package/dist/es/standards-sdk.es22.js +1767 -36
  71. package/dist/es/standards-sdk.es22.js.map +1 -1
  72. package/dist/es/standards-sdk.es23.js +36 -48
  73. package/dist/es/standards-sdk.es23.js.map +1 -1
  74. package/dist/es/standards-sdk.es24.js +21 -7163
  75. package/dist/es/standards-sdk.es24.js.map +1 -1
  76. package/dist/es/standards-sdk.es25.js +7190 -3
  77. package/dist/es/standards-sdk.es25.js.map +1 -1
  78. package/dist/es/standards-sdk.es26.js +3 -2
  79. package/dist/es/standards-sdk.es26.js.map +1 -1
  80. package/dist/es/standards-sdk.es27.js +2 -4167
  81. package/dist/es/standards-sdk.es27.js.map +1 -1
  82. package/dist/es/standards-sdk.es28.js +10 -10
  83. package/dist/es/standards-sdk.es29.js +4167 -5
  84. package/dist/es/standards-sdk.es29.js.map +1 -1
  85. package/dist/es/standards-sdk.es3.js +1 -1
  86. package/dist/es/standards-sdk.es30.js +5 -101
  87. package/dist/es/standards-sdk.es30.js.map +1 -1
  88. package/dist/es/standards-sdk.es31.js +364 -2
  89. package/dist/es/standards-sdk.es31.js.map +1 -1
  90. package/dist/es/standards-sdk.es32.js +5 -15
  91. package/dist/es/standards-sdk.es32.js.map +1 -1
  92. package/dist/es/standards-sdk.es33.js +167 -397
  93. package/dist/es/standards-sdk.es33.js.map +1 -1
  94. package/dist/es/standards-sdk.es34.js +68 -351
  95. package/dist/es/standards-sdk.es34.js.map +1 -1
  96. package/dist/es/standards-sdk.es35.js +113 -5
  97. package/dist/es/standards-sdk.es35.js.map +1 -1
  98. package/dist/es/standards-sdk.es36.js +43 -170
  99. package/dist/es/standards-sdk.es36.js.map +1 -1
  100. package/dist/es/standards-sdk.es37.js +9 -80
  101. package/dist/es/standards-sdk.es37.js.map +1 -1
  102. package/dist/es/standards-sdk.es38.js +87 -104
  103. package/dist/es/standards-sdk.es38.js.map +1 -1
  104. package/dist/es/standards-sdk.es39.js +3 -51
  105. package/dist/es/standards-sdk.es39.js.map +1 -1
  106. package/dist/es/standards-sdk.es4.js +1 -1
  107. package/dist/es/standards-sdk.es40.js +2 -10
  108. package/dist/es/standards-sdk.es40.js.map +1 -1
  109. package/dist/es/standards-sdk.es41.js +102 -86
  110. package/dist/es/standards-sdk.es41.js.map +1 -1
  111. package/dist/es/standards-sdk.es42.js +73 -3
  112. package/dist/es/standards-sdk.es42.js.map +1 -1
  113. package/dist/es/standards-sdk.es43.js +6 -2
  114. package/dist/es/standards-sdk.es43.js.map +1 -1
  115. package/dist/es/standards-sdk.es44.js +4 -112
  116. package/dist/es/standards-sdk.es44.js.map +1 -1
  117. package/dist/es/standards-sdk.es45.js +216 -69
  118. package/dist/es/standards-sdk.es45.js.map +1 -1
  119. package/dist/es/standards-sdk.es46.js +58 -6
  120. package/dist/es/standards-sdk.es46.js.map +1 -1
  121. package/dist/es/standards-sdk.es47.js +69 -5
  122. package/dist/es/standards-sdk.es47.js.map +1 -1
  123. package/dist/es/standards-sdk.es48.js +3 -221
  124. package/dist/es/standards-sdk.es48.js.map +1 -1
  125. package/dist/es/standards-sdk.es49.js +158 -52
  126. package/dist/es/standards-sdk.es49.js.map +1 -1
  127. package/dist/es/standards-sdk.es5.js +6 -8
  128. package/dist/es/standards-sdk.es5.js.map +1 -1
  129. package/dist/es/standards-sdk.es50.js +32 -69
  130. package/dist/es/standards-sdk.es50.js.map +1 -1
  131. package/dist/es/standards-sdk.es51.js +63 -2282
  132. package/dist/es/standards-sdk.es51.js.map +1 -1
  133. package/dist/es/standards-sdk.es52.js +47 -161
  134. package/dist/es/standards-sdk.es52.js.map +1 -1
  135. package/dist/es/standards-sdk.es53.js +8 -7134
  136. package/dist/es/standards-sdk.es53.js.map +1 -1
  137. package/dist/es/standards-sdk.es54.js +65 -3
  138. package/dist/es/standards-sdk.es54.js.map +1 -1
  139. package/dist/es/standards-sdk.es55.js +6 -32
  140. package/dist/es/standards-sdk.es55.js.map +1 -1
  141. package/dist/es/standards-sdk.es56.js +13 -61
  142. package/dist/es/standards-sdk.es56.js.map +1 -1
  143. package/dist/es/standards-sdk.es57.js +7 -50
  144. package/dist/es/standards-sdk.es57.js.map +1 -1
  145. package/dist/es/standards-sdk.es58.js +45 -10
  146. package/dist/es/standards-sdk.es58.js.map +1 -1
  147. package/dist/es/standards-sdk.es59.js +2 -65
  148. package/dist/es/standards-sdk.es59.js.map +1 -1
  149. package/dist/es/standards-sdk.es60.js +135 -5
  150. package/dist/es/standards-sdk.es60.js.map +1 -1
  151. package/dist/es/standards-sdk.es61.js +170 -13
  152. package/dist/es/standards-sdk.es61.js.map +1 -1
  153. package/dist/es/standards-sdk.es62.js +101 -7
  154. package/dist/es/standards-sdk.es62.js.map +1 -1
  155. package/dist/es/standards-sdk.es63.js +2 -45
  156. package/dist/es/standards-sdk.es63.js.map +1 -1
  157. package/dist/es/standards-sdk.es64.js +16 -2
  158. package/dist/es/standards-sdk.es64.js.map +1 -1
  159. package/dist/es/standards-sdk.es65.js +404 -131
  160. package/dist/es/standards-sdk.es65.js.map +1 -1
  161. package/dist/es/standards-sdk.es66.js +12 -171
  162. package/dist/es/standards-sdk.es66.js.map +1 -1
  163. package/dist/es/standards-sdk.es67.js +13 -13
  164. package/dist/es/standards-sdk.es67.js.map +1 -1
  165. package/dist/es/standards-sdk.es68.js +32 -13
  166. package/dist/es/standards-sdk.es68.js.map +1 -1
  167. package/dist/es/standards-sdk.es69.js +15 -2
  168. package/dist/es/standards-sdk.es69.js.map +1 -1
  169. package/dist/es/standards-sdk.es7.js +8 -8
  170. package/dist/es/standards-sdk.es70.js +3 -31
  171. package/dist/es/standards-sdk.es70.js.map +1 -1
  172. package/dist/es/standards-sdk.es71.js +3 -14
  173. package/dist/es/standards-sdk.es71.js.map +1 -1
  174. package/dist/es/standards-sdk.es72.js +15 -3
  175. package/dist/es/standards-sdk.es72.js.map +1 -1
  176. package/dist/es/standards-sdk.es73.js +4 -3
  177. package/dist/es/standards-sdk.es73.js.map +1 -1
  178. package/dist/es/standards-sdk.es74.js +39 -16
  179. package/dist/es/standards-sdk.es74.js.map +1 -1
  180. package/dist/es/standards-sdk.es75.js +40 -5
  181. package/dist/es/standards-sdk.es75.js.map +1 -1
  182. package/dist/es/standards-sdk.es76.js +35 -37
  183. package/dist/es/standards-sdk.es76.js.map +1 -1
  184. package/dist/es/standards-sdk.es77.js +72 -34
  185. package/dist/es/standards-sdk.es77.js.map +1 -1
  186. package/dist/es/standards-sdk.es78.js +2281 -36
  187. package/dist/es/standards-sdk.es78.js.map +1 -1
  188. package/dist/es/standards-sdk.es79.js +2 -78
  189. package/dist/es/standards-sdk.es79.js.map +1 -1
  190. package/dist/es/standards-sdk.es8.js +8 -8
  191. package/dist/es/standards-sdk.es80.js +7136 -3
  192. package/dist/es/standards-sdk.es80.js.map +1 -1
  193. package/dist/es/standards-sdk.es81.js +3 -2
  194. package/dist/es/standards-sdk.es81.js.map +1 -1
  195. package/dist/es/standards-sdk.es82.js +2 -2
  196. package/dist/es/standards-sdk.es82.js.map +1 -1
  197. package/dist/es/standards-sdk.es83.js +2 -195
  198. package/dist/es/standards-sdk.es83.js.map +1 -1
  199. package/dist/es/standards-sdk.es84.js +31 -435
  200. package/dist/es/standards-sdk.es84.js.map +1 -1
  201. package/dist/es/standards-sdk.es85.js +31 -23
  202. package/dist/es/standards-sdk.es85.js.map +1 -1
  203. package/dist/es/standards-sdk.es86.js +9 -139
  204. package/dist/es/standards-sdk.es86.js.map +1 -1
  205. package/dist/es/standards-sdk.es87.js +32 -16
  206. package/dist/es/standards-sdk.es87.js.map +1 -1
  207. package/dist/es/standards-sdk.es88.js +189 -23
  208. package/dist/es/standards-sdk.es88.js.map +1 -1
  209. package/dist/es/standards-sdk.es89.js +433 -24
  210. package/dist/es/standards-sdk.es89.js.map +1 -1
  211. package/dist/es/standards-sdk.es9.js +2 -2
  212. package/dist/es/standards-sdk.es90.js +16 -12
  213. package/dist/es/standards-sdk.es90.js.map +1 -1
  214. package/dist/es/standards-sdk.es91.js +126 -31
  215. package/dist/es/standards-sdk.es91.js.map +1 -1
  216. package/dist/es/standards-sdk.es92.js +9 -9
  217. package/dist/es/standards-sdk.es92.js.map +1 -1
  218. package/dist/es/standards-sdk.es93.js +22 -54
  219. package/dist/es/standards-sdk.es93.js.map +1 -1
  220. package/dist/es/standards-sdk.es94.js +20 -1280
  221. package/dist/es/standards-sdk.es94.js.map +1 -1
  222. package/dist/es/standards-sdk.es95.js +17 -144
  223. package/dist/es/standards-sdk.es95.js.map +1 -1
  224. package/dist/es/standards-sdk.es96.js +39 -86
  225. package/dist/es/standards-sdk.es96.js.map +1 -1
  226. package/dist/es/standards-sdk.es97.js +13 -79
  227. package/dist/es/standards-sdk.es97.js.map +1 -1
  228. package/dist/es/standards-sdk.es98.js +57 -28
  229. package/dist/es/standards-sdk.es98.js.map +1 -1
  230. package/dist/es/standards-sdk.es99.js +1288 -5
  231. package/dist/es/standards-sdk.es99.js.map +1 -1
  232. package/dist/umd/hcs-10/base-client.d.ts.map +1 -1
  233. package/dist/umd/hcs-10/connections-manager.d.ts +203 -0
  234. package/dist/umd/hcs-10/connections-manager.d.ts.map +1 -0
  235. package/dist/umd/hcs-10/index.d.ts +1 -0
  236. package/dist/umd/hcs-10/index.d.ts.map +1 -1
  237. package/dist/umd/standards-sdk.umd.js +9 -9
  238. package/dist/umd/standards-sdk.umd.js.map +1 -1
  239. package/package.json +10 -4
@@ -1,88 +1,653 @@
1
- var ProfileType = /* @__PURE__ */ ((ProfileType2) => {
2
- ProfileType2[ProfileType2["PERSONAL"] = 0] = "PERSONAL";
3
- ProfileType2[ProfileType2["AI_AGENT"] = 1] = "AI_AGENT";
4
- return ProfileType2;
5
- })(ProfileType || {});
6
- var AIAgentType = /* @__PURE__ */ ((AIAgentType2) => {
7
- AIAgentType2[AIAgentType2["MANUAL"] = 0] = "MANUAL";
8
- AIAgentType2[AIAgentType2["AUTONOMOUS"] = 1] = "AUTONOMOUS";
9
- return AIAgentType2;
10
- })(AIAgentType || {});
11
- var EndpointType = /* @__PURE__ */ ((EndpointType2) => {
12
- EndpointType2[EndpointType2["REST"] = 0] = "REST";
13
- EndpointType2[EndpointType2["WEBSOCKET"] = 1] = "WEBSOCKET";
14
- EndpointType2[EndpointType2["GRPC"] = 2] = "GRPC";
15
- return EndpointType2;
16
- })(EndpointType || {});
17
- var AIAgentCapability = /* @__PURE__ */ ((AIAgentCapability2) => {
18
- AIAgentCapability2[AIAgentCapability2["TEXT_GENERATION"] = 0] = "TEXT_GENERATION";
19
- AIAgentCapability2[AIAgentCapability2["IMAGE_GENERATION"] = 1] = "IMAGE_GENERATION";
20
- AIAgentCapability2[AIAgentCapability2["AUDIO_GENERATION"] = 2] = "AUDIO_GENERATION";
21
- AIAgentCapability2[AIAgentCapability2["VIDEO_GENERATION"] = 3] = "VIDEO_GENERATION";
22
- AIAgentCapability2[AIAgentCapability2["CODE_GENERATION"] = 4] = "CODE_GENERATION";
23
- AIAgentCapability2[AIAgentCapability2["LANGUAGE_TRANSLATION"] = 5] = "LANGUAGE_TRANSLATION";
24
- AIAgentCapability2[AIAgentCapability2["SUMMARIZATION_EXTRACTION"] = 6] = "SUMMARIZATION_EXTRACTION";
25
- AIAgentCapability2[AIAgentCapability2["KNOWLEDGE_RETRIEVAL"] = 7] = "KNOWLEDGE_RETRIEVAL";
26
- AIAgentCapability2[AIAgentCapability2["DATA_INTEGRATION"] = 8] = "DATA_INTEGRATION";
27
- AIAgentCapability2[AIAgentCapability2["MARKET_INTELLIGENCE"] = 9] = "MARKET_INTELLIGENCE";
28
- AIAgentCapability2[AIAgentCapability2["TRANSACTION_ANALYTICS"] = 10] = "TRANSACTION_ANALYTICS";
29
- AIAgentCapability2[AIAgentCapability2["SMART_CONTRACT_AUDIT"] = 11] = "SMART_CONTRACT_AUDIT";
30
- AIAgentCapability2[AIAgentCapability2["GOVERNANCE_FACILITATION"] = 12] = "GOVERNANCE_FACILITATION";
31
- AIAgentCapability2[AIAgentCapability2["SECURITY_MONITORING"] = 13] = "SECURITY_MONITORING";
32
- AIAgentCapability2[AIAgentCapability2["COMPLIANCE_ANALYSIS"] = 14] = "COMPLIANCE_ANALYSIS";
33
- AIAgentCapability2[AIAgentCapability2["FRAUD_DETECTION"] = 15] = "FRAUD_DETECTION";
34
- AIAgentCapability2[AIAgentCapability2["MULTI_AGENT_COORDINATION"] = 16] = "MULTI_AGENT_COORDINATION";
35
- AIAgentCapability2[AIAgentCapability2["API_INTEGRATION"] = 17] = "API_INTEGRATION";
36
- AIAgentCapability2[AIAgentCapability2["WORKFLOW_AUTOMATION"] = 18] = "WORKFLOW_AUTOMATION";
37
- return AIAgentCapability2;
38
- })(AIAgentCapability || {});
39
- var InboundTopicType = /* @__PURE__ */ ((InboundTopicType2) => {
40
- InboundTopicType2["PUBLIC"] = "PUBLIC";
41
- InboundTopicType2["CONTROLLED"] = "CONTROLLED";
42
- InboundTopicType2["FEE_BASED"] = "FEE_BASED";
43
- return InboundTopicType2;
44
- })(InboundTopicType || {});
45
- const SUPPORTED_SOCIAL_PLATFORMS = [
46
- "twitter",
47
- "github",
48
- "discord",
49
- "telegram",
50
- "linkedin",
51
- "youtube",
52
- "website",
53
- "x"
54
- ];
55
- const capabilityNameToCapabilityMap = {
56
- text_generation: 0,
57
- image_generation: 1,
58
- audio_generation: 2,
59
- video_generation: 3,
60
- code_generation: 4,
61
- language_translation: 5,
62
- summarization: 6,
63
- extraction: 6,
64
- knowledge_retrieval: 7,
65
- data_integration: 8,
66
- data_visualization: 8,
67
- market_intelligence: 9,
68
- transaction_analytics: 10,
69
- smart_contract_audit: 11,
70
- governance: 12,
71
- security_monitoring: 13,
72
- compliance_analysis: 14,
73
- fraud_detection: 15,
74
- multi_agent: 16,
75
- api_integration: 17,
76
- workflow_automation: 18
77
- /* WORKFLOW_AUTOMATION */
78
- };
1
+ import Buffer from "./standards-sdk.es22.js";
2
+ import { Client, PrivateKey, Status, AccountUpdateTransaction } from "@hashgraph/sdk";
3
+ import { inscribeWithSigner, inscribe } from "./standards-sdk.es18.js";
4
+ import { Logger } from "./standards-sdk.es15.js";
5
+ import { m as mimeTypesExports } from "./standards-sdk.es26.js";
6
+ import z from "./standards-sdk.es29.js";
7
+ import { ProgressReporter } from "./standards-sdk.es17.js";
8
+ import { HederaMirrorNode } from "./standards-sdk.es19.js";
9
+ import { AIAgentCapability, AIAgentType, ProfileType, capabilityNameToCapabilityMap } from "./standards-sdk.es14.js";
10
+ const SocialLinkSchema = z.object({
11
+ platform: z.string().min(1),
12
+ handle: z.string().min(1)
13
+ });
14
+ const AIAgentDetailsSchema = z.object({
15
+ type: z.nativeEnum(AIAgentType),
16
+ capabilities: z.array(z.nativeEnum(AIAgentCapability)).min(1),
17
+ model: z.string().min(1),
18
+ creator: z.string().optional()
19
+ });
20
+ const BaseProfileSchema = z.object({
21
+ version: z.string().min(1),
22
+ type: z.nativeEnum(ProfileType),
23
+ display_name: z.string().min(1),
24
+ alias: z.string().optional(),
25
+ bio: z.string().optional(),
26
+ socials: z.array(SocialLinkSchema).optional(),
27
+ profileImage: z.string().optional(),
28
+ properties: z.record(z.any()).optional(),
29
+ inboundTopicId: z.string().optional(),
30
+ outboundTopicId: z.string().optional()
31
+ });
32
+ const PersonalProfileSchema = BaseProfileSchema.extend({
33
+ type: z.literal(ProfileType.PERSONAL),
34
+ language: z.string().optional(),
35
+ timezone: z.string().optional()
36
+ });
37
+ const AIAgentProfileSchema = BaseProfileSchema.extend({
38
+ type: z.literal(ProfileType.AI_AGENT),
39
+ aiAgent: AIAgentDetailsSchema
40
+ });
41
+ const HCS11ProfileSchema = z.union([
42
+ PersonalProfileSchema,
43
+ AIAgentProfileSchema
44
+ ]);
45
+ class HCS11Client {
46
+ constructor(config) {
47
+ this.client = config.network === "mainnet" ? Client.forMainnet() : Client.forTestnet();
48
+ this.auth = config.auth;
49
+ this.network = config.network;
50
+ this.mirrorNode = new HederaMirrorNode(
51
+ this.network,
52
+ this.logger
53
+ );
54
+ if (this.auth.privateKey) {
55
+ const privateKey = PrivateKey.fromString(this.auth.privateKey);
56
+ this.client.setOperator(this.auth.operatorId, privateKey);
57
+ }
58
+ this.logger = Logger.getInstance({
59
+ level: config.logLevel || "info",
60
+ module: "HCS-11"
61
+ });
62
+ }
63
+ getClient() {
64
+ return this.client;
65
+ }
66
+ getOperatorId() {
67
+ return this.auth.operatorId;
68
+ }
69
+ createPersonalProfile(displayName, options) {
70
+ return {
71
+ version: "1.0",
72
+ type: ProfileType.PERSONAL,
73
+ display_name: displayName,
74
+ alias: options?.alias,
75
+ bio: options?.bio,
76
+ socials: options?.socials,
77
+ profileImage: options?.profileImage,
78
+ properties: options?.properties,
79
+ inboundTopicId: options?.inboundTopicId,
80
+ outboundTopicId: options?.outboundTopicId
81
+ };
82
+ }
83
+ createAIAgentProfile(displayName, agentType, capabilities, model, options) {
84
+ const validation = this.validateProfile({
85
+ version: "1.0",
86
+ type: ProfileType.AI_AGENT,
87
+ display_name: displayName,
88
+ alias: options?.alias,
89
+ bio: options?.bio,
90
+ socials: options?.socials,
91
+ profileImage: options?.profileImage,
92
+ properties: options?.properties,
93
+ inboundTopicId: options?.inboundTopicId,
94
+ outboundTopicId: options?.outboundTopicId,
95
+ aiAgent: {
96
+ type: agentType,
97
+ capabilities,
98
+ model,
99
+ creator: options?.creator
100
+ }
101
+ });
102
+ if (!validation.valid) {
103
+ throw new Error(
104
+ `Invalid AI Agent Profile: ${validation.errors.join(", ")}`
105
+ );
106
+ }
107
+ return {
108
+ version: "1.0",
109
+ type: ProfileType.AI_AGENT,
110
+ display_name: displayName,
111
+ alias: options?.alias,
112
+ bio: options?.bio,
113
+ socials: options?.socials,
114
+ profileImage: options?.profileImage,
115
+ properties: options?.properties,
116
+ inboundTopicId: options?.inboundTopicId,
117
+ outboundTopicId: options?.outboundTopicId,
118
+ aiAgent: {
119
+ type: agentType,
120
+ capabilities,
121
+ model,
122
+ creator: options?.creator
123
+ }
124
+ };
125
+ }
126
+ validateProfile(profile) {
127
+ const result = HCS11ProfileSchema.safeParse(profile);
128
+ if (result.success) {
129
+ return { valid: true, errors: [] };
130
+ }
131
+ const formattedErrors = result.error.errors.map((err) => {
132
+ const path = err.path.join(".");
133
+ let message = err.message;
134
+ if (err.code === "invalid_type") {
135
+ message = `Expected ${err.expected}, got ${err.received}`;
136
+ } else if (err.code === "invalid_enum_value") {
137
+ const validOptions = err.options?.join(", ");
138
+ message = `Invalid value. Valid options are: ${validOptions}`;
139
+ } else if (err.code === "too_small" && err.type === "string") {
140
+ message = "Cannot be empty";
141
+ }
142
+ return `${path}: ${message}`;
143
+ });
144
+ return { valid: false, errors: formattedErrors };
145
+ }
146
+ profileToJSONString(profile) {
147
+ return JSON.stringify(profile);
148
+ }
149
+ parseProfileFromString(profileStr) {
150
+ try {
151
+ const parsedProfile = JSON.parse(profileStr);
152
+ const validation = this.validateProfile(parsedProfile);
153
+ if (!validation.valid) {
154
+ this.logger.error("Invalid profile format:", validation.errors);
155
+ return null;
156
+ }
157
+ return parsedProfile;
158
+ } catch (error) {
159
+ this.logger.error("Error parsing profile:");
160
+ return null;
161
+ }
162
+ }
163
+ setProfileForAccountMemo(topicId, topicStandard = 1) {
164
+ return `hcs-11:hcs://${topicStandard}/${topicId}`;
165
+ }
166
+ async executeTransaction(transaction) {
167
+ try {
168
+ if (this.auth.privateKey) {
169
+ const signedTx = await transaction.signWithOperator(this.client);
170
+ const response2 = await signedTx.execute(this.client);
171
+ const receipt2 = await response2.getReceipt(this.client);
172
+ if (receipt2.status.toString() !== Status.Success.toString()) {
173
+ return {
174
+ success: false,
175
+ error: `Transaction failed: ${receipt2.status.toString()}`
176
+ };
177
+ }
178
+ return {
179
+ success: true,
180
+ result: receipt2
181
+ };
182
+ }
183
+ if (!this.auth.signer) {
184
+ throw new Error("No valid authentication method provided");
185
+ }
186
+ const signer = this.auth.signer;
187
+ const frozenTransaction = await transaction.freezeWithSigner(signer);
188
+ const response = await frozenTransaction.executeWithSigner(signer);
189
+ const receipt = await response.getReceiptWithSigner(signer);
190
+ if (receipt.status.toString() !== Status.Success.toString()) {
191
+ return {
192
+ success: false,
193
+ error: `Transaction failed: ${receipt.status.toString()}: ${Status.Success.toString()}`
194
+ };
195
+ }
196
+ return {
197
+ success: true,
198
+ result: receipt
199
+ };
200
+ } catch (error) {
201
+ return {
202
+ success: false,
203
+ error: error instanceof Error ? error.message : "Unknown error during transaction execution"
204
+ };
205
+ }
206
+ }
207
+ async inscribeImage(buffer, fileName, options) {
208
+ try {
209
+ const progressCallback = options?.progressCallback;
210
+ const progressReporter = new ProgressReporter({
211
+ module: "HCS11-Image",
212
+ logger: this.logger,
213
+ callback: progressCallback
214
+ });
215
+ progressReporter.preparing("Preparing to inscribe image", 0);
216
+ const mimeType = mimeTypesExports.lookup(fileName) || "application/octet-stream";
217
+ const waitForConfirmation = options?.waitForConfirmation ?? true;
218
+ let inscriptionResponse;
219
+ if (this.auth.signer) {
220
+ if ("accountId" in this.auth.signer) {
221
+ progressReporter.preparing("Using signer for inscription", 10);
222
+ inscriptionResponse = await inscribeWithSigner(
223
+ {
224
+ type: "buffer",
225
+ buffer,
226
+ fileName,
227
+ mimeType
228
+ },
229
+ this.auth.signer,
230
+ {
231
+ network: this.network,
232
+ waitForConfirmation,
233
+ waitMaxAttempts: 150,
234
+ waitIntervalMs: 4e3,
235
+ logging: {
236
+ level: "debug"
237
+ },
238
+ progressCallback: (data) => {
239
+ const adjustedPercent = 10 + (data.progressPercent || 0) * 0.8;
240
+ progressReporter.report({
241
+ stage: data.stage,
242
+ message: data.message,
243
+ progressPercent: adjustedPercent,
244
+ details: data.details
245
+ });
246
+ }
247
+ }
248
+ );
249
+ } else {
250
+ progressReporter.failed(
251
+ "Signer must be a DAppSigner for inscription"
252
+ );
253
+ throw new Error("Signer must be a DAppSigner for inscription");
254
+ }
255
+ } else {
256
+ if (!this.auth.privateKey) {
257
+ progressReporter.failed("Private key is required for inscription");
258
+ this.logger.error("Private key is required for inscription");
259
+ throw new Error("Private key is required for inscription");
260
+ }
261
+ progressReporter.preparing("Using private key for inscription", 10);
262
+ inscriptionResponse = await inscribe(
263
+ {
264
+ type: "buffer",
265
+ buffer,
266
+ fileName,
267
+ mimeType
268
+ },
269
+ {
270
+ accountId: this.auth.operatorId,
271
+ privateKey: this.auth.privateKey,
272
+ network: this.network
273
+ },
274
+ {
275
+ waitForConfirmation,
276
+ waitMaxAttempts: 150,
277
+ waitIntervalMs: 2e3,
278
+ logging: {
279
+ level: "debug"
280
+ },
281
+ progressCallback: (data) => {
282
+ const adjustedPercent = 10 + (data.progressPercent || 0) * 0.8;
283
+ progressReporter.report({
284
+ stage: data.stage,
285
+ message: data.message,
286
+ progressPercent: adjustedPercent,
287
+ details: data.details
288
+ });
289
+ }
290
+ }
291
+ );
292
+ }
293
+ if (inscriptionResponse.confirmed) {
294
+ progressReporter.completed("Image inscription completed", {
295
+ topic_id: inscriptionResponse.inscription.topic_id
296
+ });
297
+ return {
298
+ imageTopicId: inscriptionResponse.inscription.topic_id || "",
299
+ transactionId: inscriptionResponse.result.jobId,
300
+ success: true
301
+ };
302
+ } else {
303
+ progressReporter.verifying("Waiting for inscription confirmation", 50, {
304
+ jobId: inscriptionResponse.result.jobId
305
+ });
306
+ return {
307
+ imageTopicId: "",
308
+ transactionId: inscriptionResponse.result.jobId,
309
+ success: false,
310
+ error: "Inscription not confirmed"
311
+ };
312
+ }
313
+ } catch (error) {
314
+ this.logger.error("Error inscribing image:", error);
315
+ return {
316
+ imageTopicId: "",
317
+ transactionId: "",
318
+ success: false,
319
+ error: error.message || "Error inscribing image"
320
+ };
321
+ }
322
+ }
323
+ async inscribeProfile(profile, options) {
324
+ this.logger.info("Inscribing HCS-11 profile");
325
+ const progressCallback = options?.progressCallback;
326
+ const progressReporter = new ProgressReporter({
327
+ module: "HCS11-Profile",
328
+ logger: this.logger,
329
+ callback: progressCallback
330
+ });
331
+ progressReporter.preparing("Validating profile data", 5);
332
+ const validation = this.validateProfile(profile);
333
+ if (!validation.valid) {
334
+ progressReporter.failed(
335
+ `Invalid profile: ${validation.errors.join(", ")}`
336
+ );
337
+ return {
338
+ profileTopicId: "",
339
+ transactionId: "",
340
+ success: false,
341
+ error: `Invalid profile: ${validation.errors.join(", ")}`
342
+ };
343
+ }
344
+ progressReporter.preparing("Formatting profile for inscription", 15);
345
+ const profileJson = this.profileToJSONString(profile);
346
+ const fileName = `profile-${profile.display_name.toLowerCase().replace(/\s+/g, "-")}.json`;
347
+ try {
348
+ const contentBuffer = Buffer.from(profileJson, "utf-8");
349
+ const contentType = "application/json";
350
+ progressReporter.preparing("Preparing profile for inscription", 20);
351
+ const input = {
352
+ type: "buffer",
353
+ buffer: contentBuffer,
354
+ fileName,
355
+ mimeType: contentType
356
+ };
357
+ const inscriptionOptions = {
358
+ waitForConfirmation: true,
359
+ mode: "file",
360
+ network: this.network,
361
+ waitMaxAttempts: 100,
362
+ waitIntervalMs: 2e3,
363
+ progressCallback: (data) => {
364
+ const adjustedPercent = 20 + Number(data?.progressPercent || 0) * 0.75;
365
+ progressReporter?.report({
366
+ stage: data.stage,
367
+ message: data.message,
368
+ progressPercent: adjustedPercent,
369
+ details: data.details
370
+ });
371
+ }
372
+ };
373
+ progressReporter.submitting("Submitting profile to Hedera network", 30);
374
+ const inscriptionResponse = this.auth.privateKey ? await inscribe(
375
+ input,
376
+ {
377
+ accountId: this.auth.operatorId,
378
+ privateKey: this.auth.privateKey,
379
+ network: this.network
380
+ },
381
+ inscriptionOptions
382
+ ) : await inscribeWithSigner(
383
+ input,
384
+ this.auth.signer,
385
+ inscriptionOptions
386
+ );
387
+ if (!inscriptionResponse.confirmed || !inscriptionResponse.inscription.topic_id) {
388
+ progressReporter.failed("Failed to inscribe profile content");
389
+ return {
390
+ profileTopicId: "",
391
+ transactionId: "",
392
+ success: false,
393
+ error: "Failed to inscribe profile content"
394
+ };
395
+ }
396
+ const topicId = inscriptionResponse.inscription.topic_id;
397
+ progressReporter.completed("Profile inscription completed", {
398
+ topicId,
399
+ transactionId: inscriptionResponse.result.transactionId
400
+ });
401
+ return {
402
+ profileTopicId: topicId,
403
+ transactionId: inscriptionResponse.result.transactionId,
404
+ success: true
405
+ };
406
+ } catch (error) {
407
+ progressReporter.failed(
408
+ `Error inscribing profile: ${error.message || "Unknown error"}`
409
+ );
410
+ return {
411
+ profileTopicId: "",
412
+ transactionId: "",
413
+ success: false,
414
+ error: error.message || "Unknown error during inscription"
415
+ };
416
+ }
417
+ }
418
+ async updateAccountMemoWithProfile(accountId, profileTopicId) {
419
+ try {
420
+ this.logger.info(
421
+ `Updating account memo for ${accountId} with profile ${profileTopicId}`
422
+ );
423
+ const memo = this.setProfileForAccountMemo(profileTopicId);
424
+ const transaction = new AccountUpdateTransaction().setAccountMemo(memo).setAccountId(accountId);
425
+ return this.executeTransaction(transaction);
426
+ } catch (error) {
427
+ this.logger.error(
428
+ `Error updating account memo: ${error instanceof Error ? error.message : "Unknown error"}`
429
+ );
430
+ return {
431
+ success: false,
432
+ error: error instanceof Error ? error.message : "Unknown error updating account memo"
433
+ };
434
+ }
435
+ }
436
+ /**
437
+ * Creates and inscribes a profile.
438
+ *
439
+ * @param profile - The profile to create and inscribe.
440
+ * @param updateAccountMemo - Whether to update the account memo with the profile.
441
+ * @param options - Optional configuration options.
442
+ * @returns A promise that resolves to the inscription result.
443
+ */
444
+ async createAndInscribeProfile(profile, updateAccountMemo = true, options) {
445
+ const progressCallback = options?.progressCallback;
446
+ const progressReporter = new ProgressReporter({
447
+ module: "HCS11-ProfileCreation",
448
+ logger: this.logger,
449
+ callback: progressCallback
450
+ });
451
+ progressReporter.preparing("Starting profile creation process", 0);
452
+ const inscriptionProgress = progressReporter.createSubProgress({
453
+ minPercent: 0,
454
+ maxPercent: 80,
455
+ logPrefix: "Inscription"
456
+ });
457
+ const inscriptionResult = await this.inscribeProfile(profile, {
458
+ ...options,
459
+ progressCallback: (data) => {
460
+ inscriptionProgress.report({
461
+ stage: data.stage,
462
+ message: data.message,
463
+ progressPercent: data.progressPercent,
464
+ details: data.details
465
+ });
466
+ }
467
+ });
468
+ if (!inscriptionResult?.success) {
469
+ progressReporter.failed("Profile inscription failed", {
470
+ error: inscriptionResult?.error
471
+ });
472
+ return inscriptionResult;
473
+ }
474
+ progressReporter.confirming("Profile inscribed, updating account memo", 85);
475
+ if (updateAccountMemo) {
476
+ const memoResult = await this.updateAccountMemoWithProfile(
477
+ this.auth.operatorId,
478
+ inscriptionResult.profileTopicId
479
+ );
480
+ if (!memoResult.success) {
481
+ progressReporter.failed("Failed to update account memo", {
482
+ error: memoResult?.error
483
+ });
484
+ return {
485
+ ...inscriptionResult,
486
+ success: false,
487
+ error: memoResult?.error
488
+ };
489
+ }
490
+ }
491
+ progressReporter.completed("Profile creation completed successfully", {
492
+ profileTopicId: inscriptionResult.profileTopicId,
493
+ transactionId: inscriptionResult.transactionId
494
+ });
495
+ return inscriptionResult;
496
+ }
497
+ /**
498
+ * Gets the capabilities from the capability names.
499
+ *
500
+ * @param capabilityNames - The capability names to get the capabilities for.
501
+ * @returns The capabilities.
502
+ */
503
+ async getCapabilitiesFromTags(capabilityNames) {
504
+ const capabilities = [];
505
+ if (capabilityNames.length === 0) {
506
+ return [AIAgentCapability.TEXT_GENERATION];
507
+ }
508
+ for (const capabilityName of capabilityNames) {
509
+ const capability = capabilityNameToCapabilityMap[capabilityName.toLowerCase()];
510
+ if (capability !== void 0 && !capabilities.includes(capability)) {
511
+ capabilities.push(capability);
512
+ }
513
+ }
514
+ if (capabilities.length === 0) {
515
+ capabilities.push(AIAgentCapability.TEXT_GENERATION);
516
+ }
517
+ return capabilities;
518
+ }
519
+ /**
520
+ * Gets the agent type from the metadata.
521
+ *
522
+ * @param metadata - The metadata of the agent.
523
+ * @returns The agent type.
524
+ */
525
+ getAgentTypeFromMetadata(metadata) {
526
+ if (metadata.type === "autonomous") {
527
+ return AIAgentType.AUTONOMOUS;
528
+ } else {
529
+ return AIAgentType.MANUAL;
530
+ }
531
+ }
532
+ /**
533
+ * Fetches a profile from the account memo.
534
+ *
535
+ * @param accountId - The account ID of the agent to fetch the profile for.
536
+ * @param network - The network to use for the fetch.
537
+ * @returns A promise that resolves to the profile.
538
+ */
539
+ async fetchProfileByAccountId(accountId, network) {
540
+ try {
541
+ this.logger.info(
542
+ `Fetching profile for account ${accountId.toString()} on ${this.network}`
543
+ );
544
+ const memo = await this.mirrorNode.getAccountMemo(accountId.toString());
545
+ this.logger.info(`Got account memo: ${memo}`);
546
+ if (!memo?.startsWith("hcs-11:")) {
547
+ return {
548
+ success: false,
549
+ error: `Account ${accountId.toString()} does not have a valid HCS-11 memo`
550
+ };
551
+ }
552
+ this.logger.info(`Found HCS-11 memo: ${memo}`);
553
+ const protocolReference = memo.substring(7);
554
+ if (protocolReference?.startsWith("hcs://")) {
555
+ const hcsFormat = protocolReference.match(/hcs:\/\/(\d+)\/(.+)/);
556
+ if (!hcsFormat) {
557
+ return {
558
+ success: false,
559
+ error: `Invalid HCS protocol reference format: ${protocolReference}`
560
+ };
561
+ }
562
+ const [_, protocolId, profileTopicId] = hcsFormat;
563
+ const networkParam = network || this.network || "mainnet";
564
+ this.logger.info(
565
+ `Retrieving profile from Kiloscribe CDN: ${profileTopicId}`
566
+ );
567
+ const cdnUrl = `https://kiloscribe.com/api/inscription-cdn/${profileTopicId}?network=${networkParam}`;
568
+ try {
569
+ const response = await fetch(cdnUrl);
570
+ if (!response.ok) {
571
+ return {
572
+ success: false,
573
+ error: `Failed to fetch profile from Kiloscribe CDN: ${response.statusText}`
574
+ };
575
+ }
576
+ const profileData = await response.json();
577
+ if (!profileData) {
578
+ return {
579
+ success: false,
580
+ error: `No profile data found for topic ${profileTopicId}`
581
+ };
582
+ }
583
+ return {
584
+ success: true,
585
+ profile: profileData,
586
+ topicInfo: {
587
+ inboundTopic: profileData.inboundTopicId,
588
+ outboundTopic: profileData.outboundTopicId,
589
+ profileTopicId
590
+ }
591
+ };
592
+ } catch (cdnError) {
593
+ this.logger.error(
594
+ `Error retrieving from Kiloscribe CDN: ${cdnError.message}`
595
+ );
596
+ return {
597
+ success: false,
598
+ error: `Error retrieving from Kiloscribe CDN: ${cdnError.message}`
599
+ };
600
+ }
601
+ } else if (protocolReference.startsWith("ipfs://")) {
602
+ this.logger.warn("IPFS protocol references are not fully supported");
603
+ const response = await fetch(
604
+ `https://ipfs.io/ipfs/${protocolReference.replace("ipfs://", "")}`
605
+ );
606
+ const profileData = await response.json();
607
+ return {
608
+ success: true,
609
+ profile: profileData,
610
+ topicInfo: {
611
+ inboundTopic: profileData.inboundTopicId,
612
+ outboundTopic: profileData.outboundTopicId,
613
+ profileTopicId: profileData.profileTopicId
614
+ }
615
+ };
616
+ } else if (protocolReference.startsWith("ar://")) {
617
+ const arTxId = protocolReference.replace("ar://", "");
618
+ const response = await fetch(`https://arweave.net/${arTxId}`);
619
+ if (!response.ok) {
620
+ return {
621
+ success: false,
622
+ error: `Failed to fetch profile from Arweave ${arTxId}: ${response.statusText}`
623
+ };
624
+ }
625
+ const profileData = await response.json();
626
+ return {
627
+ success: true,
628
+ profile: profileData,
629
+ topicInfo: {
630
+ inboundTopic: profileData.inboundTopicId,
631
+ outboundTopic: profileData.outboundTopicId,
632
+ profileTopicId: profileData.profileTopicId
633
+ }
634
+ };
635
+ } else {
636
+ return {
637
+ success: false,
638
+ error: `Invalid protocol reference format: ${protocolReference}`
639
+ };
640
+ }
641
+ } catch (error) {
642
+ this.logger.error(`Error fetching profile: ${error.message}`);
643
+ return {
644
+ success: false,
645
+ error: `Error fetching profile: ${error.message}`
646
+ };
647
+ }
648
+ }
649
+ }
79
650
  export {
80
- AIAgentCapability,
81
- AIAgentType,
82
- EndpointType,
83
- InboundTopicType,
84
- ProfileType,
85
- SUPPORTED_SOCIAL_PLATFORMS,
86
- capabilityNameToCapabilityMap
651
+ HCS11Client
87
652
  };
88
653
  //# sourceMappingURL=standards-sdk.es13.js.map