@hashgraphonline/standards-sdk 0.1.143-feat-solana-register.canary.1c6f446.78 → 0.1.144-feat-solana-register.canary.d5edcec.80

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 (340) hide show
  1. package/dist/cjs/hcs-10/sdk.d.ts.map +1 -1
  2. package/dist/cjs/hcs-14/issuers/hiero.d.ts.map +1 -1
  3. package/dist/cjs/index.d.ts.map +1 -1
  4. package/dist/cjs/services/registry-broker/schemas.d.ts +153 -153
  5. package/dist/cjs/standards-sdk.cjs +2 -2
  6. package/dist/cjs/standards-sdk.cjs.map +1 -1
  7. package/dist/cjs/utils/dynamic-import.d.ts +5 -1
  8. package/dist/cjs/utils/dynamic-import.d.ts.map +1 -1
  9. package/dist/es/hcs-10/sdk.d.ts.map +1 -1
  10. package/dist/es/hcs-14/issuers/hiero.d.ts.map +1 -1
  11. package/dist/es/index.d.ts.map +1 -1
  12. package/dist/es/services/registry-broker/schemas.d.ts +153 -153
  13. package/dist/es/standards-sdk.es.js +134 -135
  14. package/dist/es/standards-sdk.es.js.map +1 -1
  15. package/dist/es/standards-sdk.es10.js +70 -90
  16. package/dist/es/standards-sdk.es10.js.map +1 -1
  17. package/dist/es/standards-sdk.es100.js +229 -27
  18. package/dist/es/standards-sdk.es100.js.map +1 -1
  19. package/dist/es/standards-sdk.es101.js +109 -228
  20. package/dist/es/standards-sdk.es101.js.map +1 -1
  21. package/dist/es/standards-sdk.es102.js +15 -94
  22. package/dist/es/standards-sdk.es102.js.map +1 -1
  23. package/dist/es/standards-sdk.es103.js +80 -30
  24. package/dist/es/standards-sdk.es103.js.map +1 -1
  25. package/dist/es/standards-sdk.es104.js +27 -80
  26. package/dist/es/standards-sdk.es104.js.map +1 -1
  27. package/dist/es/standards-sdk.es105.js +136 -25
  28. package/dist/es/standards-sdk.es105.js.map +1 -1
  29. package/dist/es/standards-sdk.es106.js +27 -140
  30. package/dist/es/standards-sdk.es106.js.map +1 -1
  31. package/dist/es/standards-sdk.es107.js +20 -27
  32. package/dist/es/standards-sdk.es107.js.map +1 -1
  33. package/dist/es/standards-sdk.es108.js +156 -18
  34. package/dist/es/standards-sdk.es108.js.map +1 -1
  35. package/dist/es/standards-sdk.es109.js +198 -148
  36. package/dist/es/standards-sdk.es109.js.map +1 -1
  37. package/dist/es/standards-sdk.es11.js +121 -45
  38. package/dist/es/standards-sdk.es11.js.map +1 -1
  39. package/dist/es/standards-sdk.es110.js +747 -167
  40. package/dist/es/standards-sdk.es110.js.map +1 -1
  41. package/dist/es/standards-sdk.es111.js +9 -786
  42. package/dist/es/standards-sdk.es111.js.map +1 -1
  43. package/dist/es/standards-sdk.es112.js +567 -13
  44. package/dist/es/standards-sdk.es112.js.map +1 -1
  45. package/dist/es/standards-sdk.es113.js +576 -541
  46. package/dist/es/standards-sdk.es113.js.map +1 -1
  47. package/dist/es/standards-sdk.es114.js +12 -601
  48. package/dist/es/standards-sdk.es114.js.map +1 -1
  49. package/dist/es/standards-sdk.es115.js +2 -13
  50. package/dist/es/standards-sdk.es115.js.map +1 -1
  51. package/dist/es/standards-sdk.es116.js +87 -2
  52. package/dist/es/standards-sdk.es116.js.map +1 -1
  53. package/dist/es/standards-sdk.es117.js +37 -84
  54. package/dist/es/standards-sdk.es117.js.map +1 -1
  55. package/dist/es/standards-sdk.es118.js +2 -40
  56. package/dist/es/standards-sdk.es118.js.map +1 -1
  57. package/dist/es/standards-sdk.es119.js +231 -2
  58. package/dist/es/standards-sdk.es119.js.map +1 -1
  59. package/dist/es/standards-sdk.es12.js +60 -159
  60. package/dist/es/standards-sdk.es12.js.map +1 -1
  61. package/dist/es/standards-sdk.es120.js +1110 -201
  62. package/dist/es/standards-sdk.es120.js.map +1 -1
  63. package/dist/es/standards-sdk.es121.js +225 -1059
  64. package/dist/es/standards-sdk.es121.js.map +1 -1
  65. package/dist/es/standards-sdk.es122.js +419 -303
  66. package/dist/es/standards-sdk.es122.js.map +1 -1
  67. package/dist/es/standards-sdk.es123.js +351 -418
  68. package/dist/es/standards-sdk.es123.js.map +1 -1
  69. package/dist/es/standards-sdk.es124.js +872 -347
  70. package/dist/es/standards-sdk.es124.js.map +1 -1
  71. package/dist/es/standards-sdk.es125.js +182 -854
  72. package/dist/es/standards-sdk.es125.js.map +1 -1
  73. package/dist/es/standards-sdk.es126.js +1512 -153
  74. package/dist/es/standards-sdk.es126.js.map +1 -1
  75. package/dist/es/standards-sdk.es127.js +157 -1547
  76. package/dist/es/standards-sdk.es127.js.map +1 -1
  77. package/dist/es/standards-sdk.es128.js +192 -162
  78. package/dist/es/standards-sdk.es128.js.map +1 -1
  79. package/dist/es/standards-sdk.es129.js +61 -164
  80. package/dist/es/standards-sdk.es129.js.map +1 -1
  81. package/dist/es/standards-sdk.es13.js +200 -60
  82. package/dist/es/standards-sdk.es13.js.map +1 -1
  83. package/dist/es/standards-sdk.es130.js +102 -85
  84. package/dist/es/standards-sdk.es130.js.map +1 -1
  85. package/dist/es/standards-sdk.es131.js +222 -96
  86. package/dist/es/standards-sdk.es131.js.map +1 -1
  87. package/dist/es/standards-sdk.es132.js +153 -220
  88. package/dist/es/standards-sdk.es132.js.map +1 -1
  89. package/dist/es/standards-sdk.es133.js +104 -162
  90. package/dist/es/standards-sdk.es133.js.map +1 -1
  91. package/dist/es/standards-sdk.es134.js +296 -92
  92. package/dist/es/standards-sdk.es134.js.map +1 -1
  93. package/dist/es/standards-sdk.es135.js +432 -294
  94. package/dist/es/standards-sdk.es135.js.map +1 -1
  95. package/dist/es/standards-sdk.es136.js +14 -461
  96. package/dist/es/standards-sdk.es136.js.map +1 -1
  97. package/dist/es/standards-sdk.es137.js +79 -15
  98. package/dist/es/standards-sdk.es137.js.map +1 -1
  99. package/dist/es/standards-sdk.es138.js +77 -71
  100. package/dist/es/standards-sdk.es138.js.map +1 -1
  101. package/dist/es/standards-sdk.es139.js +152 -80
  102. package/dist/es/standards-sdk.es139.js.map +1 -1
  103. package/dist/es/standards-sdk.es14.js +149 -178
  104. package/dist/es/standards-sdk.es14.js.map +1 -1
  105. package/dist/es/standards-sdk.es140.js +7 -159
  106. package/dist/es/standards-sdk.es140.js.map +1 -1
  107. package/dist/es/standards-sdk.es141.js +86 -7
  108. package/dist/es/standards-sdk.es141.js.map +1 -1
  109. package/dist/es/standards-sdk.es142.js +44 -65
  110. package/dist/es/standards-sdk.es142.js.map +1 -1
  111. package/dist/es/standards-sdk.es143.js +30 -65
  112. package/dist/es/standards-sdk.es143.js.map +1 -1
  113. package/dist/es/standards-sdk.es144.js +34 -30
  114. package/dist/es/standards-sdk.es144.js.map +1 -1
  115. package/dist/es/standards-sdk.es145.js +28 -34
  116. package/dist/es/standards-sdk.es145.js.map +1 -1
  117. package/dist/es/standards-sdk.es146.js +138 -28
  118. package/dist/es/standards-sdk.es146.js.map +1 -1
  119. package/dist/es/standards-sdk.es147.js +37 -133
  120. package/dist/es/standards-sdk.es147.js.map +1 -1
  121. package/dist/es/standards-sdk.es148.js +12280 -33
  122. package/dist/es/standards-sdk.es148.js.map +1 -1
  123. package/dist/es/standards-sdk.es149.js +1 -1
  124. package/dist/es/standards-sdk.es15.js +152 -151
  125. package/dist/es/standards-sdk.es15.js.map +1 -1
  126. package/dist/es/standards-sdk.es150.js +12 -12284
  127. package/dist/es/standards-sdk.es150.js.map +1 -1
  128. package/dist/es/standards-sdk.es151.js +54 -15
  129. package/dist/es/standards-sdk.es151.js.map +1 -1
  130. package/dist/es/standards-sdk.es152.js +72 -160
  131. package/dist/es/standards-sdk.es152.js.map +1 -1
  132. package/dist/es/standards-sdk.es153.js +139 -289
  133. package/dist/es/standards-sdk.es153.js.map +1 -1
  134. package/dist/es/standards-sdk.es154.js +274 -298
  135. package/dist/es/standards-sdk.es154.js.map +1 -1
  136. package/dist/es/standards-sdk.es155.js +262 -369
  137. package/dist/es/standards-sdk.es155.js.map +1 -1
  138. package/dist/es/standards-sdk.es156.js +316 -194
  139. package/dist/es/standards-sdk.es156.js.map +1 -1
  140. package/dist/es/standards-sdk.es157.js +319 -64
  141. package/dist/es/standards-sdk.es157.js.map +1 -1
  142. package/dist/es/standards-sdk.es158.js +69 -49
  143. package/dist/es/standards-sdk.es158.js.map +1 -1
  144. package/dist/es/standards-sdk.es159.js +222 -65
  145. package/dist/es/standards-sdk.es159.js.map +1 -1
  146. package/dist/es/standards-sdk.es16.js +917 -136
  147. package/dist/es/standards-sdk.es16.js.map +1 -1
  148. package/dist/es/standards-sdk.es160.js +223 -218
  149. package/dist/es/standards-sdk.es160.js.map +1 -1
  150. package/dist/es/standards-sdk.es17.js +23 -948
  151. package/dist/es/standards-sdk.es17.js.map +1 -1
  152. package/dist/es/standards-sdk.es18.js +2422 -24
  153. package/dist/es/standards-sdk.es18.js.map +1 -1
  154. package/dist/es/standards-sdk.es19.js +818 -2092
  155. package/dist/es/standards-sdk.es19.js.map +1 -1
  156. package/dist/es/standards-sdk.es2.js +654 -189
  157. package/dist/es/standards-sdk.es2.js.map +1 -1
  158. package/dist/es/standards-sdk.es20.js +205 -1092
  159. package/dist/es/standards-sdk.es20.js.map +1 -1
  160. package/dist/es/standards-sdk.es21.js +858 -221
  161. package/dist/es/standards-sdk.es21.js.map +1 -1
  162. package/dist/es/standards-sdk.es22.js +179 -903
  163. package/dist/es/standards-sdk.es22.js.map +1 -1
  164. package/dist/es/standards-sdk.es23.js +164 -179
  165. package/dist/es/standards-sdk.es23.js.map +1 -1
  166. package/dist/es/standards-sdk.es24.js +62 -118
  167. package/dist/es/standards-sdk.es24.js.map +1 -1
  168. package/dist/es/standards-sdk.es25.js +377 -57
  169. package/dist/es/standards-sdk.es25.js.map +1 -1
  170. package/dist/es/standards-sdk.es26.js +36 -394
  171. package/dist/es/standards-sdk.es26.js.map +1 -1
  172. package/dist/es/standards-sdk.es27.js +901 -50
  173. package/dist/es/standards-sdk.es27.js.map +1 -1
  174. package/dist/es/standards-sdk.es28.js +134 -922
  175. package/dist/es/standards-sdk.es28.js.map +1 -1
  176. package/dist/es/standards-sdk.es29.js +7 -134
  177. package/dist/es/standards-sdk.es29.js.map +1 -1
  178. package/dist/es/standards-sdk.es3.js +63 -680
  179. package/dist/es/standards-sdk.es3.js.map +1 -1
  180. package/dist/es/standards-sdk.es30.js +344 -7
  181. package/dist/es/standards-sdk.es30.js.map +1 -1
  182. package/dist/es/standards-sdk.es31.js +302 -287
  183. package/dist/es/standards-sdk.es31.js.map +1 -1
  184. package/dist/es/standards-sdk.es32.js +94 -322
  185. package/dist/es/standards-sdk.es32.js.map +1 -1
  186. package/dist/es/standards-sdk.es33.js +458 -101
  187. package/dist/es/standards-sdk.es33.js.map +1 -1
  188. package/dist/es/standards-sdk.es34.js +132 -451
  189. package/dist/es/standards-sdk.es34.js.map +1 -1
  190. package/dist/es/standards-sdk.es35.js +216 -130
  191. package/dist/es/standards-sdk.es35.js.map +1 -1
  192. package/dist/es/standards-sdk.es36.js +273 -196
  193. package/dist/es/standards-sdk.es36.js.map +1 -1
  194. package/dist/es/standards-sdk.es37.js +148 -87
  195. package/dist/es/standards-sdk.es37.js.map +1 -1
  196. package/dist/es/standards-sdk.es38.js +183 -320
  197. package/dist/es/standards-sdk.es38.js.map +1 -1
  198. package/dist/es/standards-sdk.es39.js +238 -161
  199. package/dist/es/standards-sdk.es39.js.map +1 -1
  200. package/dist/es/standards-sdk.es4.js +425 -63
  201. package/dist/es/standards-sdk.es4.js.map +1 -1
  202. package/dist/es/standards-sdk.es40.js +136 -254
  203. package/dist/es/standards-sdk.es40.js.map +1 -1
  204. package/dist/es/standards-sdk.es41.js +225 -176
  205. package/dist/es/standards-sdk.es41.js.map +1 -1
  206. package/dist/es/standards-sdk.es42.js +199 -261
  207. package/dist/es/standards-sdk.es42.js.map +1 -1
  208. package/dist/es/standards-sdk.es43.js +237 -199
  209. package/dist/es/standards-sdk.es43.js.map +1 -1
  210. package/dist/es/standards-sdk.es44.js +209 -201
  211. package/dist/es/standards-sdk.es44.js.map +1 -1
  212. package/dist/es/standards-sdk.es45.js +305 -201
  213. package/dist/es/standards-sdk.es45.js.map +1 -1
  214. package/dist/es/standards-sdk.es46.js +371 -261
  215. package/dist/es/standards-sdk.es46.js.map +1 -1
  216. package/dist/es/standards-sdk.es47.js +316 -372
  217. package/dist/es/standards-sdk.es47.js.map +1 -1
  218. package/dist/es/standards-sdk.es48.js +404 -336
  219. package/dist/es/standards-sdk.es48.js.map +1 -1
  220. package/dist/es/standards-sdk.es49.js +83 -449
  221. package/dist/es/standards-sdk.es49.js.map +1 -1
  222. package/dist/es/standards-sdk.es5.js +232 -354
  223. package/dist/es/standards-sdk.es5.js.map +1 -1
  224. package/dist/es/standards-sdk.es50.js +179 -89
  225. package/dist/es/standards-sdk.es50.js.map +1 -1
  226. package/dist/es/standards-sdk.es51.js +231 -165
  227. package/dist/es/standards-sdk.es51.js.map +1 -1
  228. package/dist/es/standards-sdk.es52.js +25 -262
  229. package/dist/es/standards-sdk.es52.js.map +1 -1
  230. package/dist/es/standards-sdk.es53.js +56 -26
  231. package/dist/es/standards-sdk.es53.js.map +1 -1
  232. package/dist/es/standards-sdk.es54.js +12 -57
  233. package/dist/es/standards-sdk.es54.js.map +1 -1
  234. package/dist/es/standards-sdk.es55.js +49 -12
  235. package/dist/es/standards-sdk.es55.js.map +1 -1
  236. package/dist/es/standards-sdk.es56.js +115 -43
  237. package/dist/es/standards-sdk.es56.js.map +1 -1
  238. package/dist/es/standards-sdk.es57.js +42 -115
  239. package/dist/es/standards-sdk.es57.js.map +1 -1
  240. package/dist/es/standards-sdk.es58.js +52 -43
  241. package/dist/es/standards-sdk.es58.js.map +1 -1
  242. package/dist/es/standards-sdk.es59.js +36 -50
  243. package/dist/es/standards-sdk.es59.js.map +1 -1
  244. package/dist/es/standards-sdk.es6.js +125 -246
  245. package/dist/es/standards-sdk.es6.js.map +1 -1
  246. package/dist/es/standards-sdk.es60.js +207 -39
  247. package/dist/es/standards-sdk.es60.js.map +1 -1
  248. package/dist/es/standards-sdk.es61.js +24 -201
  249. package/dist/es/standards-sdk.es61.js.map +1 -1
  250. package/dist/es/standards-sdk.es62.js +87 -25
  251. package/dist/es/standards-sdk.es62.js.map +1 -1
  252. package/dist/es/standards-sdk.es63.js +3 -51
  253. package/dist/es/standards-sdk.es63.js.map +1 -1
  254. package/dist/es/standards-sdk.es64.js +100 -3
  255. package/dist/es/standards-sdk.es64.js.map +1 -1
  256. package/dist/es/standards-sdk.es65.js +61 -62
  257. package/dist/es/standards-sdk.es65.js.map +1 -1
  258. package/dist/es/standards-sdk.es66.js +17 -98
  259. package/dist/es/standards-sdk.es66.js.map +1 -1
  260. package/dist/es/standards-sdk.es67.js +77 -19
  261. package/dist/es/standards-sdk.es67.js.map +1 -1
  262. package/dist/es/standards-sdk.es68.js +458 -77
  263. package/dist/es/standards-sdk.es68.js.map +1 -1
  264. package/dist/es/standards-sdk.es69.js +106 -240
  265. package/dist/es/standards-sdk.es69.js.map +1 -1
  266. package/dist/es/standards-sdk.es7.js +28 -183
  267. package/dist/es/standards-sdk.es7.js.map +1 -1
  268. package/dist/es/standards-sdk.es70.js +170 -286
  269. package/dist/es/standards-sdk.es70.js.map +1 -1
  270. package/dist/es/standards-sdk.es71.js +71 -207
  271. package/dist/es/standards-sdk.es71.js.map +1 -1
  272. package/dist/es/standards-sdk.es72.js +71 -72
  273. package/dist/es/standards-sdk.es72.js.map +1 -1
  274. package/dist/es/standards-sdk.es73.js +143 -71
  275. package/dist/es/standards-sdk.es73.js.map +1 -1
  276. package/dist/es/standards-sdk.es74.js +62 -136
  277. package/dist/es/standards-sdk.es74.js.map +1 -1
  278. package/dist/es/standards-sdk.es75.js +380 -45
  279. package/dist/es/standards-sdk.es75.js.map +1 -1
  280. package/dist/es/standards-sdk.es76.js +222 -130
  281. package/dist/es/standards-sdk.es76.js.map +1 -1
  282. package/dist/es/standards-sdk.es77.js +320 -444
  283. package/dist/es/standards-sdk.es77.js.map +1 -1
  284. package/dist/es/standards-sdk.es78.js +88 -371
  285. package/dist/es/standards-sdk.es78.js.map +1 -1
  286. package/dist/es/standards-sdk.es79.js +125 -89
  287. package/dist/es/standards-sdk.es79.js.map +1 -1
  288. package/dist/es/standards-sdk.es8.js +80 -29
  289. package/dist/es/standards-sdk.es8.js.map +1 -1
  290. package/dist/es/standards-sdk.es80.js +8 -125
  291. package/dist/es/standards-sdk.es80.js.map +1 -1
  292. package/dist/es/standards-sdk.es81.js +45 -6
  293. package/dist/es/standards-sdk.es81.js.map +1 -1
  294. package/dist/es/standards-sdk.es82.js +98 -44
  295. package/dist/es/standards-sdk.es82.js.map +1 -1
  296. package/dist/es/standards-sdk.es83.js +331 -84
  297. package/dist/es/standards-sdk.es83.js.map +1 -1
  298. package/dist/es/standards-sdk.es84.js +93 -160
  299. package/dist/es/standards-sdk.es84.js.map +1 -1
  300. package/dist/es/standards-sdk.es85.js +55 -275
  301. package/dist/es/standards-sdk.es85.js.map +1 -1
  302. package/dist/es/standards-sdk.es86.js +43 -55
  303. package/dist/es/standards-sdk.es86.js.map +1 -1
  304. package/dist/es/standards-sdk.es87.js +145 -44
  305. package/dist/es/standards-sdk.es87.js.map +1 -1
  306. package/dist/es/standards-sdk.es88.js +30 -113
  307. package/dist/es/standards-sdk.es88.js.map +1 -1
  308. package/dist/es/standards-sdk.es89.js +22 -59
  309. package/dist/es/standards-sdk.es89.js.map +1 -1
  310. package/dist/es/standards-sdk.es9.js +104 -80
  311. package/dist/es/standards-sdk.es9.js.map +1 -1
  312. package/dist/es/standards-sdk.es90.js +23 -28
  313. package/dist/es/standards-sdk.es90.js.map +1 -1
  314. package/dist/es/standards-sdk.es91.js +238 -23
  315. package/dist/es/standards-sdk.es91.js.map +1 -1
  316. package/dist/es/standards-sdk.es92.js +267 -225
  317. package/dist/es/standards-sdk.es92.js.map +1 -1
  318. package/dist/es/standards-sdk.es93.js +95 -220
  319. package/dist/es/standards-sdk.es93.js.map +1 -1
  320. package/dist/es/standards-sdk.es94.js +124 -136
  321. package/dist/es/standards-sdk.es94.js.map +1 -1
  322. package/dist/es/standards-sdk.es95.js +42 -138
  323. package/dist/es/standards-sdk.es95.js.map +1 -1
  324. package/dist/es/standards-sdk.es96.js +259 -43
  325. package/dist/es/standards-sdk.es96.js.map +1 -1
  326. package/dist/es/standards-sdk.es97.js +82 -245
  327. package/dist/es/standards-sdk.es97.js.map +1 -1
  328. package/dist/es/standards-sdk.es98.js +49 -50
  329. package/dist/es/standards-sdk.es98.js.map +1 -1
  330. package/dist/es/standards-sdk.es99.js +29 -100
  331. package/dist/es/standards-sdk.es99.js.map +1 -1
  332. package/dist/es/utils/dynamic-import.d.ts +5 -1
  333. package/dist/es/utils/dynamic-import.d.ts.map +1 -1
  334. package/package.json +4 -4
  335. package/dist/cjs/patches/topic-autorenew-patch.d.ts +0 -2
  336. package/dist/cjs/patches/topic-autorenew-patch.d.ts.map +0 -1
  337. package/dist/es/patches/topic-autorenew-patch.d.ts +0 -2
  338. package/dist/es/patches/topic-autorenew-patch.d.ts.map +0 -1
  339. package/dist/es/standards-sdk.es161.js +0 -247
  340. package/dist/es/standards-sdk.es161.js.map +0 -1
@@ -1,1157 +1,270 @@
1
- import { KeyList, TopicCreateTransaction, AccountId, Transaction, TopicMessageSubmitTransaction, Hbar } from "@hashgraph/sdk";
2
- import { Logger } from "./standards-sdk.es106.js";
3
- import "axios";
4
- import "@hashgraph/proto";
5
- import { ProgressReporter } from "./standards-sdk.es109.js";
6
- import "./standards-sdk.es128.js";
7
- import "./standards-sdk.es129.js";
8
- import "./standards-sdk.es130.js";
9
- import "./standards-sdk.es131.js";
10
- import "./standards-sdk.es132.js";
11
- import "./standards-sdk.es133.js";
12
- import "./standards-sdk.es134.js";
13
- import "./standards-sdk.es135.js";
14
- import "buffer";
15
- import "crypto";
16
- import "@noble/curves/secp256k1.js";
17
- import "zod";
18
- import "./standards-sdk.es149.js";
19
- import "./standards-sdk.es139.js";
20
- import "ethers";
21
- import "./standards-sdk.es123.js";
22
- import "./standards-sdk.es114.js";
23
- import { getTopicId } from "./standards-sdk.es115.js";
24
- import { InscriptionSDK } from "./standards-sdk.es150.js";
25
- import { HCS10BaseClient, Hcs10MemoType } from "./standards-sdk.es17.js";
26
- import * as mime from "mime-types";
27
- import { AgentBuilder } from "./standards-sdk.es24.js";
28
- import { HCS11Client } from "./standards-sdk.es28.js";
29
- import { inscribeWithSigner } from "./standards-sdk.es125.js";
30
- const isBrowser = typeof window !== "undefined";
31
- class BrowserHCSClient extends HCS10BaseClient {
32
- constructor(config) {
33
- super({
34
- network: config.network,
35
- logLevel: config.logLevel,
36
- prettyPrint: config.prettyPrint,
37
- feeAmount: config.feeAmount,
38
- mirrorNode: config.mirrorNode,
39
- silent: config.silent
40
- });
41
- this.hcs11Client = null;
42
- this.hwc = config.hwc;
43
- if (!config.guardedRegistryBaseUrl) {
44
- this.guardedRegistryBaseUrl = "https://moonscape.tech";
45
- } else {
46
- this.guardedRegistryBaseUrl = config.guardedRegistryBaseUrl;
47
- }
48
- let logLevel;
49
- if (config.logLevel) {
50
- logLevel = config.logLevel;
51
- } else {
52
- logLevel = "info";
53
- }
54
- this.logger = Logger.getInstance({
55
- level: logLevel,
56
- module: "HCS-Browser",
57
- prettyPrint: config.prettyPrint,
58
- silent: config.silent
59
- });
60
- if (isBrowser) {
61
- try {
62
- const { accountId, signer } = this.getAccountAndSigner();
63
- this.hcs11Client = new HCS11Client({
64
- network: config.network,
65
- auth: {
66
- operatorId: accountId,
67
- signer
68
- },
69
- logLevel: config.logLevel,
70
- silent: config.silent
71
- });
72
- } catch (err) {
73
- this.logger.warn(`Failed to initialize HCS11Client: ${err}`);
74
- }
75
- } else {
76
- this.logger.error(
77
- "BrowserHCSClient initialized in server environment - browser-specific features will not be available. Use HCS10Client instead."
78
- );
79
- }
80
- }
81
- async sendMessage(connectionTopicId, data, memo, submitKey, options) {
82
- this.logger.info("Sending message");
83
- const operatorId = await this.getOperatorId();
84
- const payload = {
85
- p: "hcs-10",
86
- op: "message",
87
- operator_id: operatorId,
88
- data,
89
- m: memo
90
- };
91
- const submissionCheck = await this.canSubmitToTopic(
92
- connectionTopicId,
93
- this.hwc.getAccountInfo().accountId
94
- );
95
- const payloadString = JSON.stringify(payload);
96
- const isLargePayload = Buffer.from(payloadString).length > 1e3;
97
- if (isLargePayload) {
98
- this.logger.info(
99
- "Message payload exceeds 1000 bytes, storing via inscription"
100
- );
101
- try {
102
- const contentBuffer = Buffer.from(data);
103
- const fileName = `message-${Date.now()}.json`;
104
- const inscriptionResult = await this.inscribeFile(
105
- contentBuffer,
106
- fileName,
107
- {
108
- progressCallback: options?.progressCallback,
109
- waitMaxAttempts: options?.waitMaxAttempts,
110
- waitIntervalMs: options?.waitIntervalMs
111
- }
112
- );
113
- if (getTopicId(inscriptionResult)) {
114
- payload.data = `hcs://1/${getTopicId(inscriptionResult)}`;
115
- this.logger.info(
116
- `Large message inscribed with topic ID: ${getTopicId(inscriptionResult)}`
117
- );
118
- } else {
119
- throw new Error("Failed to inscribe large message content");
120
- }
121
- } catch (error) {
122
- this.logger.error("Error inscribing large message:", error);
123
- throw new Error(
124
- `Failed to handle large message: ${error instanceof Error ? error.message : "Unknown error"}`
125
- );
126
- }
127
- }
128
- return await this.submitPayload(
129
- connectionTopicId,
130
- payload,
131
- submitKey,
132
- submissionCheck.requiresFee
133
- );
134
- }
135
- async getPublicKey(accountId) {
136
- return await this.mirrorNode.getPublicKey(accountId);
137
- }
138
- async handleConnectionRequest(inboundTopicId, requestingAccountId, connectionId, connectionMemo = "Connection accepted. Looking forward to collaborating!", ttl = 60) {
139
- this.logger.info("Handling connection request");
140
- const userAccountId = this.hwc.getAccountInfo().accountId;
141
- if (!userAccountId) {
142
- throw new Error("Failed to retrieve user account ID");
143
- }
144
- const requesterKey = await this.mirrorNode.getPublicKey(requestingAccountId);
145
- const accountKey = await this.mirrorNode.getPublicKey(userAccountId);
146
- if (!accountKey) {
147
- throw new Error("Failed to retrieve public key");
148
- }
149
- const thresholdKey = new KeyList([accountKey, requesterKey], 1);
150
- const memo = this._generateHcs10Memo(Hcs10MemoType.CONNECTION, {
151
- ttl,
152
- inboundTopicId,
153
- connectionId
154
- });
155
- const transaction = new TopicCreateTransaction().setTopicMemo(memo).setAutoRenewAccountId(AccountId.fromString(userAccountId)).setAdminKey(thresholdKey).setSubmitKey(thresholdKey);
156
- this.logger.debug("Executing topic creation transaction");
157
- const txResponse = await this.hwc.executeTransactionWithErrorHandling(
158
- transaction,
159
- false
160
- );
161
- if (txResponse?.error) {
162
- this.logger.error(txResponse.error);
163
- throw new Error(txResponse.error);
164
- }
165
- const resultReceipt = txResponse?.result;
166
- if (!resultReceipt?.topicId) {
167
- this.logger.error("Failed to create topic: topicId is null");
168
- throw new Error("Failed to create topic: topicId is null");
169
- }
170
- const connectionTopicId = resultReceipt.topicId.toString();
171
- const operatorId = `${inboundTopicId}@${userAccountId}`;
172
- const confirmedConnectionSequenceNumber = await this.confirmConnection(
173
- inboundTopicId,
174
- connectionTopicId,
175
- requestingAccountId,
176
- connectionId,
177
- operatorId,
178
- connectionMemo
179
- );
180
- const accountTopics = await this.retrieveCommunicationTopics(userAccountId);
181
- const requestingAccountTopics = await this.retrieveCommunicationTopics(requestingAccountId);
182
- const requestingAccountOperatorId = `${requestingAccountTopics.inboundTopic}@${requestingAccountId}`;
183
- await this.recordOutboundConnectionConfirmation({
184
- outboundTopicId: accountTopics.outboundTopic,
185
- requestorOutboundTopicId: requestingAccountTopics.outboundTopic,
186
- connectionRequestId: connectionId,
187
- confirmedRequestId: confirmedConnectionSequenceNumber,
188
- connectionTopicId,
189
- operatorId: requestingAccountOperatorId,
190
- memo: `Connection established with ${requestingAccountId}`
191
- });
192
- return {
193
- connectionTopicId,
194
- confirmedConnectionSequenceNumber,
195
- operatorId
196
- };
197
- }
198
- async confirmConnection(inboundTopicId, connectionTopicId, connectedAccountId, connectionId, operatorId, memo) {
199
- this.logger.info("Confirming connection");
200
- const payload = {
201
- p: "hcs-10",
202
- op: "connection_created",
203
- connection_topic_id: connectionTopicId,
204
- connected_account_id: connectedAccountId,
205
- operator_id: operatorId,
206
- connection_id: connectionId,
207
- m: memo
208
- };
209
- const transactionResponse = await this.submitPayload(
210
- inboundTopicId,
211
- payload
212
- );
213
- if (!transactionResponse?.topicSequenceNumber) {
214
- this.logger.error(
215
- "Failed to confirm connection: sequence number is null"
216
- );
217
- throw new Error("Failed to confirm connection: sequence number is null");
218
- }
219
- return transactionResponse.topicSequenceNumber.toNumber();
220
- }
221
- async create(builder, options) {
222
- const progressCallback = options?.progressCallback;
223
- const progressReporter = new ProgressReporter({
224
- module: "ProfileCreate",
225
- logger: this.logger,
226
- callback: progressCallback
227
- });
1
+ import { HCS11Client } from "./standards-sdk.es27.js";
2
+ import { sleep } from "./standards-sdk.es115.js";
3
+ class Registration {
4
+ /**
5
+ * Checks the status of a registration request.
6
+ *
7
+ * @param transactionId - The transaction ID of the registration.
8
+ * @param network - The network to use for the registration.
9
+ * @param baseUrl - The base URL of the guarded registry.
10
+ * @param logger - The logger to use for logging.
11
+ * @returns A promise that resolves to the registration status response.
12
+ */
13
+ async checkRegistrationStatus(transactionId, network, baseUrl, logger) {
228
14
  try {
229
- const isAgentBuilder = builder instanceof AgentBuilder;
230
- let state;
231
- if (options?.existingState) {
232
- state = options.existingState;
233
- } else {
234
- state = {
235
- currentStage: "init",
236
- completedPercentage: 0,
237
- createdResources: []
238
- };
239
- }
240
- if (isAgentBuilder) {
241
- this.logger.info("Creating Agent Profile and HCS-10 Topics");
242
- const agentConfig = builder.build();
243
- state.agentMetadata = agentConfig.metadata;
244
- } else {
245
- this.logger.info("Creating Person HCS-11 Profile");
246
- }
247
- progressReporter.preparing(
248
- `Starting ${isAgentBuilder ? "agent" : "person"} resource creation`,
249
- 0,
250
- {
251
- state
252
- }
253
- );
254
- const {
255
- inboundTopicId,
256
- outboundTopicId,
257
- state: updatedState
258
- } = await this.createCommunicationTopics(options, progressReporter);
259
- state = updatedState;
260
- builder.setInboundTopicId(inboundTopicId);
261
- builder.setOutboundTopicId(outboundTopicId);
262
- let pfpTopicId;
263
- let hasPfpBuffer;
264
- let pfpFileName;
265
- if (isAgentBuilder) {
266
- const agentProfile = builder.build();
267
- pfpTopicId = agentProfile.existingPfpTopicId || state.pfpTopicId;
268
- hasPfpBuffer = agentProfile.pfpBuffer;
269
- pfpFileName = agentProfile.pfpFileName || "pfp.png";
270
- } else {
271
- const personProfile = builder.build();
272
- pfpTopicId = state.pfpTopicId;
273
- hasPfpBuffer = personProfile.pfpBuffer;
274
- pfpFileName = personProfile.pfpFileName;
275
- }
276
- if (!pfpTopicId && hasPfpBuffer && pfpFileName) {
277
- pfpTopicId = await this.handleProfilePictureCreation(
278
- hasPfpBuffer,
279
- pfpFileName,
280
- state,
281
- progressReporter
282
- );
283
- } else if (pfpTopicId) {
284
- progressReporter.preparing(
285
- `Using existing profile picture: ${pfpTopicId}`,
286
- 50,
287
- { state }
288
- );
289
- state.pfpTopicId = pfpTopicId;
290
- }
291
- await this.createAndInscribeProfile(
292
- isAgentBuilder,
293
- builder,
294
- pfpTopicId,
295
- state,
296
- inboundTopicId,
297
- outboundTopicId,
298
- options,
299
- progressReporter
300
- );
301
- state.currentStage = "complete";
302
- state.completedPercentage = 100;
303
- progressReporter.completed(
304
- `${isAgentBuilder ? "Agent" : "Person"} profile created successfully`,
305
- {
306
- profileTopicId: state.profileTopicId,
307
- inboundTopicId,
308
- outboundTopicId,
309
- pfpTopicId,
310
- state
15
+ const response = await fetch(`${baseUrl}/api/request-confirm`, {
16
+ method: "POST",
17
+ headers: {
18
+ "Content-Type": "application/json",
19
+ "X-Network": network
20
+ },
21
+ body: JSON.stringify({ transaction_id: transactionId })
22
+ });
23
+ if (!response.ok) {
24
+ const error = `Failed to confirm registration: ${response.statusText}`;
25
+ if (logger) {
26
+ logger.error(error);
311
27
  }
312
- );
313
- let outTopicId = "";
314
- if (state.outboundTopicId) {
315
- outTopicId = state.outboundTopicId;
316
- }
317
- let inTopicId = "";
318
- if (state.inboundTopicId) {
319
- inTopicId = state.inboundTopicId;
320
- }
321
- let profilePicTopicId = "";
322
- if (state.pfpTopicId) {
323
- profilePicTopicId = state.pfpTopicId;
28
+ throw new Error(error);
324
29
  }
325
- let profTopicId = "";
326
- if (state.profileTopicId) {
327
- profTopicId = state.profileTopicId;
328
- }
329
- return {
330
- outboundTopicId: outTopicId,
331
- inboundTopicId: inTopicId,
332
- pfpTopicId: profilePicTopicId,
333
- profileTopicId: profTopicId,
334
- success: true,
335
- state
336
- };
30
+ return await response.json();
337
31
  } catch (error) {
338
- progressReporter.failed("Error during profile creation", {
339
- error: error.message
340
- });
341
- return {
342
- outboundTopicId: "",
343
- inboundTopicId: "",
344
- pfpTopicId: "",
345
- profileTopicId: "",
346
- success: false,
347
- error: error.message,
348
- state: {
349
- currentStage: "init",
350
- completedPercentage: 0,
351
- error: error.message
352
- }
353
- };
354
- }
355
- }
356
- async handleProfilePictureCreation(pfpBuffer, pfpFileName, state, progressReporter) {
357
- state.currentStage = "pfp";
358
- progressReporter.preparing("Creating profile picture", 30, {
359
- state
360
- });
361
- const pfpProgress = progressReporter.createSubProgress({
362
- minPercent: 30,
363
- maxPercent: 50,
364
- logPrefix: "PFP"
365
- });
366
- const pfpResult = await this.inscribePfp(pfpBuffer, pfpFileName, {
367
- progressCallback: (data) => pfpProgress.report({
368
- ...data,
369
- progressPercent: data.progressPercent ?? 0,
370
- details: { ...data.details, state }
371
- })
372
- });
373
- if (!pfpResult.success) {
374
- let errorMessage = "Failed to inscribe profile picture";
375
- if (pfpResult.error) {
376
- errorMessage = pfpResult.error;
32
+ if (logger) {
33
+ logger.error(`Error checking registration status: ${error.message}`);
377
34
  }
378
- throw new Error(errorMessage);
379
- }
380
- const pfpTopicId = pfpResult.pfpTopicId;
381
- state.pfpTopicId = pfpTopicId;
382
- if (state.createdResources) {
383
- state.createdResources.push(`pfp:${state.pfpTopicId}`);
35
+ throw error;
384
36
  }
385
- progressReporter.preparing("Profile picture created", 50, { state });
386
- return pfpTopicId;
387
37
  }
388
- async createAndInscribeProfile(isAgentBuilder, builder, pfpTopicId, state, inboundTopicId, outboundTopicId, options, progressReporter) {
389
- if (!this.hcs11Client) {
390
- if (progressReporter) {
391
- progressReporter.failed("HCS11Client is not available");
392
- }
393
- throw new Error("HCS11Client is not available");
394
- }
395
- this.logger.info("Creating and inscribing profile");
396
- if (!state.profileTopicId) {
397
- if (progressReporter) {
398
- progressReporter.preparing(
399
- `Storing HCS-11 ${isAgentBuilder ? "agent" : "person"} profile`,
400
- 80
401
- );
402
- }
403
- const profileProgress = progressReporter?.createSubProgress({
404
- minPercent: 80,
405
- maxPercent: 95,
406
- logPrefix: "StoreProfile"
407
- });
408
- let hcs11Profile;
409
- if (isAgentBuilder) {
410
- const agentProfile = builder.build();
411
- const socialLinks = agentProfile.metadata?.socials ? Object.entries(agentProfile.metadata.socials).map(
412
- ([platform, handle]) => ({
413
- platform,
414
- handle
415
- })
416
- ) : [];
417
- hcs11Profile = this.hcs11Client.createAIAgentProfile(
418
- agentProfile.name,
419
- agentProfile.metadata?.type === "manual" ? 0 : 1,
420
- agentProfile.capabilities || [],
421
- agentProfile.metadata?.model || "unknown",
422
- {
423
- alias: agentProfile.name.toLowerCase().replace(/\s+/g, "_"),
424
- bio: agentProfile.bio,
425
- profileImage: pfpTopicId ? `hcs://1/${pfpTopicId}` : void 0,
426
- socials: socialLinks,
427
- properties: agentProfile.metadata?.properties || {},
428
- inboundTopicId,
429
- outboundTopicId,
430
- creator: agentProfile.metadata?.creator
431
- }
432
- );
433
- } else {
434
- const personProfile = builder.build();
435
- const { pfpBuffer, pfpFileName, ...cleanProfile } = personProfile;
436
- hcs11Profile = this.hcs11Client.createPersonalProfile(
437
- personProfile.display_name,
438
- {
439
- alias: personProfile.alias,
440
- bio: personProfile.bio,
441
- socials: personProfile.socials,
442
- profileImage: pfpTopicId ? `hcs://1/${pfpTopicId}` : personProfile.profileImage,
443
- properties: personProfile.properties,
444
- inboundTopicId,
445
- outboundTopicId
446
- }
38
+ /**
39
+ * Waits for a registration to be confirmed.
40
+ *
41
+ * @param transactionId - The transaction ID of the registration.
42
+ * @param network - The network to use for the registration.
43
+ * @param baseUrl - The base URL of the guarded registry.
44
+ * @param maxAttempts - The maximum number of attempts to check the registration status.
45
+ * @param delayMs - The delay in milliseconds between attempts.
46
+ * @param logger - The logger to use for logging.
47
+ * @returns A promise that resolves to true if the registration is confirmed, false otherwise.
48
+ */
49
+ async waitForRegistrationConfirmation(transactionId, network, baseUrl, maxAttempts = 60, delayMs = 2e3, logger) {
50
+ let attempts = 0;
51
+ while (attempts < maxAttempts) {
52
+ if (logger) {
53
+ logger.info(
54
+ `Checking registration status. Attempt ${attempts + 1}/${maxAttempts}`
447
55
  );
448
56
  }
449
- const profileResult = await this.hcs11Client.createAndInscribeProfile(
450
- hcs11Profile,
451
- options?.updateAccountMemo ?? true,
452
- {
453
- progressCallback: (data) => profileProgress?.report({
454
- ...data,
455
- progressPercent: data.progressPercent ?? 0
456
- })
457
- }
57
+ const status = await this.checkRegistrationStatus(
58
+ transactionId,
59
+ network,
60
+ baseUrl,
61
+ logger
458
62
  );
459
- if (!profileResult.success) {
460
- if (progressReporter) {
461
- progressReporter.failed(
462
- `Failed to inscribe ${isAgentBuilder ? "agent" : "person"} profile`,
463
- {
464
- error: profileResult.error
465
- }
466
- );
467
- }
468
- let errorMessage = `Failed to inscribe ${isAgentBuilder ? "agent" : "person"} profile`;
469
- if (profileResult.error) {
470
- errorMessage = profileResult.error;
63
+ if (status.status === "success") {
64
+ if (logger) {
65
+ logger.info("Registration confirmed successfully");
471
66
  }
472
- throw new Error(errorMessage);
67
+ return true;
473
68
  }
474
- state.profileTopicId = profileResult.profileTopicId;
475
- if (state.createdResources) {
476
- state.createdResources.push(`profile:${profileResult.profileTopicId}`);
69
+ if (status.status === "failed") {
70
+ if (logger) {
71
+ logger.error("Registration confirmation failed");
72
+ }
73
+ throw new Error("Registration confirmation failed");
477
74
  }
478
- if (progressReporter) {
479
- progressReporter.preparing("HCS-11 Profile stored", 95, { state });
75
+ if (logger) {
76
+ logger.info(
77
+ `Registration still pending. Waiting ${delayMs}ms before next attempt`
78
+ );
480
79
  }
481
- } else if (progressReporter) {
482
- progressReporter.preparing(
483
- `Using existing ${isAgentBuilder ? "agent" : "person"} profile`,
484
- 95,
485
- {
486
- state
487
- }
488
- );
80
+ await new Promise((resolve) => setTimeout(resolve, delayMs));
81
+ attempts++;
489
82
  }
490
- }
491
- initializeRegistrationState(inboundTopicId, existingState) {
492
- const state = existingState || {
493
- inboundTopicId,
494
- currentStage: "registration",
495
- completedPercentage: 0,
496
- createdResources: []
497
- };
498
- if (state.currentStage !== "registration" && state.currentStage !== "complete") {
499
- state.currentStage = "registration";
500
- }
501
- return state;
502
- }
503
- updateStateForCompletedRegistration(state, inboundTopicId) {
504
- state.currentStage = "complete";
505
- state.completedPercentage = 100;
506
- if (state.createdResources) {
507
- state.createdResources.push(`registration:${inboundTopicId}`);
83
+ if (logger) {
84
+ logger.warn(`Registration not confirmed after ${maxAttempts} attempts`);
508
85
  }
86
+ return false;
509
87
  }
510
- async registerAgentWithGuardedRegistry(accountId, network = this.network, options) {
88
+ /**
89
+ * Executes a registration request for an agent.
90
+ *
91
+ * @param accountId - The account ID of the agent to register.
92
+ * @param network - The network to use for the registration.
93
+ * @param baseUrl - The base URL of the guarded registry.
94
+ * @param logger - The logger to use for logging.
95
+ * @returns A promise that resolves to the registration result.
96
+ */
97
+ async executeRegistration(accountId, network = "mainnet", baseUrl = "https://moonscape.tech", logger) {
511
98
  try {
512
- this.logger.info("Registering agent with guarded registry");
513
- let inboundTopicId;
514
- if (options?.existingState?.inboundTopicId) {
515
- this.logger.info("Using inboundTopicId from existing state");
516
- inboundTopicId = options.existingState.inboundTopicId;
517
- } else {
518
- const profileResponse = await this.retrieveProfile(accountId, false, {
519
- maxRetries: 5,
520
- retryDelay: 3e3
521
- });
522
- if (!profileResponse.success || !profileResponse.profile || !profileResponse.topicInfo) {
523
- const errorMessage = profileResponse.error || `Failed to retrieve profile for account ${accountId}. Make sure the agent profile is created and memo is updated before registration.`;
524
- this.logger.error(errorMessage);
525
- return {
526
- error: errorMessage,
527
- success: false,
528
- state: {
529
- currentStage: "registration",
530
- completedPercentage: 0,
531
- error: errorMessage
532
- }
533
- };
534
- }
535
- inboundTopicId = profileResponse.topicInfo.inboundTopic;
536
- }
537
- const state = this.initializeRegistrationState(
538
- inboundTopicId,
539
- options?.existingState
540
- );
541
- const progressReporter = new ProgressReporter({
542
- module: "AgentRegistration",
543
- logger: this.logger,
544
- callback: options?.progressCallback
545
- });
546
- progressReporter.preparing("Preparing agent registration", 10, {
547
- inboundTopicId,
548
- accountId
549
- });
550
- const registrationResult = await this.executeRegistration(
551
- accountId,
552
- network,
553
- this.guardedRegistryBaseUrl,
554
- this.logger
555
- );
556
- if (!registrationResult.success) {
557
- return {
558
- ...registrationResult,
559
- state
560
- };
99
+ if (logger) {
100
+ logger.info("Registering agent with guarded registry");
561
101
  }
562
- progressReporter.submitting("Submitting registration to registry", 30, {
563
- transactionId: registrationResult.transactionId
564
- });
565
- if (registrationResult.transaction) {
566
- const transaction = Transaction.fromBytes(
567
- Buffer.from(registrationResult.transaction, "base64")
102
+ try {
103
+ const hcs11Client = new HCS11Client({
104
+ network,
105
+ auth: { operatorId: "0.0.0" }
106
+ });
107
+ logger?.info(
108
+ `Fetching profile by account ID ${accountId} on ${network}`
568
109
  );
569
- this.logger.info(`Processing registration transaction`);
570
- const txResult = await this.hwc.executeTransactionWithErrorHandling(
571
- transaction,
572
- true
110
+ await sleep(5e3);
111
+ const profileResult = await hcs11Client.fetchProfileByAccountId(
112
+ accountId,
113
+ network
573
114
  );
574
- if (txResult.error) {
115
+ logger?.info("Profile fetched", profileResult);
116
+ if (profileResult?.error) {
117
+ logger?.error("Error fetching profile", profileResult.error);
575
118
  return {
576
- ...registrationResult,
577
- error: txResult.error,
578
- success: false,
579
- state
119
+ error: profileResult.error,
120
+ success: false
580
121
  };
581
122
  }
582
- this.logger.info(`Successfully processed registration transaction`);
583
- }
584
- progressReporter.confirming("Confirming registration transaction", 60, {
585
- accountId,
586
- inboundTopicId,
587
- transactionId: registrationResult.transactionId
588
- });
589
- const maxAttempts = options?.maxAttempts ?? 60;
590
- const delayMs = options?.delayMs ?? 2e3;
591
- const confirmed = await this.waitForRegistrationConfirmation(
592
- registrationResult.transactionId,
593
- network,
594
- this.guardedRegistryBaseUrl,
595
- maxAttempts,
596
- delayMs,
597
- this.logger
598
- );
599
- this.updateStateForCompletedRegistration(state, inboundTopicId);
600
- progressReporter.completed("Agent registration complete", {
601
- transactionId: registrationResult.transactionId,
602
- inboundTopicId,
603
- state,
604
- confirmed
605
- });
606
- return {
607
- ...registrationResult,
608
- confirmed,
609
- state
610
- };
611
- } catch (error) {
612
- this.logger.error(`Registration error: ${error.message}`);
613
- return {
614
- error: `Error during registration: ${error.message}`,
615
- success: false,
616
- state: {
617
- currentStage: "registration",
618
- completedPercentage: 0,
619
- error: error.message
620
- }
621
- };
622
- }
623
- }
624
- async createAndRegisterAgent(builder, options) {
625
- try {
626
- const agentConfig = builder.build();
627
- const progressCallback = options?.progressCallback;
628
- const progressReporter = new ProgressReporter({
629
- module: "AgentCreateRegister",
630
- logger: this.logger,
631
- callback: progressCallback
632
- });
633
- let state = options?.existingState || {
634
- currentStage: "init",
635
- completedPercentage: 0,
636
- createdResources: []
637
- };
638
- state.agentMetadata = agentConfig.metadata;
639
- progressReporter.preparing("Starting agent creation process", 0, {
640
- state
641
- });
642
- if (state.currentStage !== "complete" || !state.inboundTopicId || !state.outboundTopicId || !state.profileTopicId) {
643
- const createResult = await this.create(builder, {
644
- progressCallback: (progress) => {
645
- const adjustedPercent = (progress.progressPercent || 0) * 0.3;
646
- progressReporter.report({
647
- ...progress,
648
- progressPercent: adjustedPercent,
649
- details: {
650
- ...progress.details,
651
- state: progress.details?.state || state
652
- }
653
- });
654
- },
655
- existingState: state,
656
- updateAccountMemo: true
657
- });
658
- if (!("state" in createResult)) {
659
- throw new Error("Create method did not return expected agent state.");
660
- }
661
- if (!createResult.success) {
662
- throw new Error(
663
- createResult.error || "Failed to create agent resources"
664
- );
665
- }
666
- state = createResult.state;
667
- state.agentMetadata = agentConfig.metadata;
668
- this.logger.info("Waiting for account memo update to propagate...");
669
- await new Promise((resolve) => setTimeout(resolve, 5e3));
670
- }
671
- progressReporter.preparing(
672
- `Agent creation status: ${state.currentStage}, ${state.completedPercentage}%`,
673
- 30,
674
- { state }
675
- );
676
- const { accountId } = this.getAccountAndSigner();
677
- if (state.currentStage !== "complete" || !state.createdResources?.includes(
678
- `registration:${state.inboundTopicId}`
679
- )) {
680
- if (options?.baseUrl) {
681
- this.guardedRegistryBaseUrl = options.baseUrl;
682
- }
683
- const registrationResult = await this.registerAgentWithGuardedRegistry(
684
- accountId,
685
- agentConfig.network,
686
- {
687
- progressCallback: (progress) => {
688
- const adjustedPercent = 30 + (progress.progressPercent || 0) * 0.7;
689
- progressReporter.report({
690
- ...progress,
691
- progressPercent: adjustedPercent,
692
- details: {
693
- ...progress.details,
694
- state: progress.details?.state || state
695
- }
696
- });
697
- },
698
- maxAttempts: options?.maxAttempts,
699
- delayMs: options?.delayMs,
700
- existingState: state
123
+ if (!profileResult?.success || !profileResult?.profile) {
124
+ if (logger) {
125
+ logger.error("Profile not found for agent registration");
701
126
  }
702
- );
703
- if (!registrationResult.success) {
704
- throw new Error(
705
- registrationResult.error || "Failed to register agent with registry"
706
- );
707
- }
708
- state = registrationResult.state;
709
- }
710
- progressReporter.completed("Agent creation and registration complete", {
711
- state
712
- });
713
- return {
714
- success: true,
715
- state,
716
- metadata: {
717
- accountId,
718
- operatorId: `${state.inboundTopicId}@${accountId}`,
719
- inboundTopicId: state.inboundTopicId,
720
- outboundTopicId: state.outboundTopicId,
721
- profileTopicId: state.profileTopicId,
722
- pfpTopicId: state.pfpTopicId,
723
- privateKey: null,
724
- ...state.agentMetadata
127
+ return {
128
+ error: "Profile not found for the provided account ID",
129
+ success: false
130
+ };
725
131
  }
726
- };
727
- } catch (error) {
728
- this.logger.error(
729
- `Failed to create and register agent: ${error.message}`
730
- );
731
- return {
732
- success: false,
733
- error: `Failed to create and register agent: ${error.message}`,
734
- state: options?.existingState || {
735
- currentStage: "init",
736
- completedPercentage: 0,
737
- error: error.message
132
+ if (!profileResult.profile.inboundTopicId) {
133
+ if (logger) {
134
+ logger.error("Missing inbound topic ID in profile");
135
+ }
136
+ return {
137
+ error: "Profile is missing required inbound topic ID",
138
+ success: false
139
+ };
738
140
  }
739
- };
740
- }
741
- }
742
- async storeHCS11Profile(agentName, agentBio, inboundTopicId, outboundTopicId, capabilities = [], metadata = {}, pfpBuffer, pfpFileName, existingPfpTopicId, options) {
743
- try {
744
- const progressCallback = options?.progressCallback;
745
- const progressReporter = new ProgressReporter({
746
- module: "StoreHCS11Profile",
747
- logger: this.logger,
748
- callback: progressCallback
749
- });
750
- progressReporter.preparing("Preparing agent profile data", 0);
751
- let pfpTopicId = existingPfpTopicId;
752
- if (!pfpTopicId && pfpBuffer && pfpFileName) {
753
- const pfpProgress = progressReporter.createSubProgress({
754
- minPercent: 0,
755
- maxPercent: 60,
756
- logPrefix: "PFP"
757
- });
758
- const pfpResult = await this.inscribePfp(pfpBuffer, pfpFileName, {
759
- progressCallback: (data) => {
760
- pfpProgress.report({
761
- stage: data.stage,
762
- message: data.message,
763
- progressPercent: data.progressPercent || 0,
764
- details: data.details
765
- });
141
+ if (!profileResult.profile.outboundTopicId) {
142
+ if (logger) {
143
+ logger.error("Missing outbound topic ID in profile");
766
144
  }
767
- });
768
- if (!pfpResult.success) {
769
- progressReporter.failed(
770
- "Failed to inscribe profile picture, continuing without PFP"
145
+ return {
146
+ error: "Profile is missing required outbound topic ID",
147
+ success: false
148
+ };
149
+ }
150
+ if (logger) {
151
+ logger.info(
152
+ `Profile validation successful. Inbound topic: ${profileResult.profile.inboundTopicId}, Outbound topic: ${profileResult.profile.outboundTopicId}`
771
153
  );
772
- } else {
773
- pfpTopicId = pfpResult.pfpTopicId;
774
154
  }
775
- } else if (existingPfpTopicId) {
776
- progressReporter.preparing(
777
- `Using existing profile picture: ${existingPfpTopicId}`,
778
- 30
779
- );
780
- } else {
781
- progressReporter.preparing("No profile picture provided", 30);
782
- }
783
- if (!this.hcs11Client) {
784
- progressReporter.failed(
785
- "HCS11Client is not available in this environment"
786
- );
155
+ } catch (profileError) {
156
+ if (logger) {
157
+ logger.error(`Error validating profile: ${profileError.message}`);
158
+ }
787
159
  return {
788
- profileTopicId: "",
789
- success: false,
790
- error: "HCS11Client is not available in this environment",
791
- transactionId: ""
160
+ error: `Error validating profile: ${profileError.message}`,
161
+ success: false
792
162
  };
793
163
  }
794
- const agentType = this.hcs11Client.getAgentTypeFromMetadata({
795
- type: metadata.type || "autonomous"
164
+ const response = await fetch(`${baseUrl}/api/request-register`, {
165
+ method: "POST",
166
+ headers: {
167
+ "Content-Type": "application/json",
168
+ Accept: "*/*",
169
+ "Accept-Language": "en;q=0.5",
170
+ Origin: baseUrl,
171
+ Referer: `${baseUrl}/`,
172
+ "X-Network": network
173
+ },
174
+ body: JSON.stringify({
175
+ accountId
176
+ })
796
177
  });
797
- progressReporter.preparing("Building agent profile", 65);
798
- const formattedSocials = metadata.socials ? Object.entries(metadata.socials).filter(([_, handle]) => handle).map(([platform, handle]) => ({
799
- platform,
800
- handle
801
- })) : void 0;
802
- const profile = this.hcs11Client.createAIAgentProfile(
803
- agentName,
804
- agentType,
805
- capabilities,
806
- metadata.model || "unknown",
807
- {
808
- alias: agentName.toLowerCase().replace(/\s+/g, "_"),
809
- bio: agentBio,
810
- profileImage: pfpTopicId ? `hcs://1/${pfpTopicId}` : void 0,
811
- socials: formattedSocials,
812
- properties: {
813
- version: metadata.version || "1.0.0",
814
- creator: metadata.creator || "Unknown",
815
- supported_languages: metadata.supported_languages || ["en"],
816
- permissions: metadata.permissions || [],
817
- model_details: metadata.model_details,
818
- training: metadata.training,
819
- capabilities_description: metadata.capabilities_description,
820
- ...metadata
821
- },
822
- inboundTopicId,
823
- outboundTopicId,
824
- creator: metadata.creator
825
- }
826
- );
827
- const profileProgress = progressReporter.createSubProgress({
828
- minPercent: 65,
829
- maxPercent: 100,
830
- logPrefix: "Profile"
831
- });
832
- const profileResult = await this.hcs11Client.createAndInscribeProfile(
833
- profile,
834
- options?.updateAccountMemo ?? true,
835
- {
836
- progressCallback: (profileData) => {
837
- profileProgress.report({
838
- stage: profileData.stage,
839
- message: profileData.message,
840
- progressPercent: profileData.progressPercent || 0,
841
- details: profileData.details
842
- });
843
- }
178
+ const data = await response.json();
179
+ if (!response.ok) {
180
+ if (data.details?.length > 0) {
181
+ return {
182
+ validationErrors: data.details,
183
+ error: data.error || "Validation failed",
184
+ success: false
185
+ };
844
186
  }
845
- );
846
- if (!profileResult.success) {
847
- progressReporter.failed("Failed to inscribe profile");
848
187
  return {
849
- profileTopicId: "",
850
- success: false,
851
- error: profileResult.error || "Failed to inscribe profile",
852
- transactionId: profileResult.transactionId || ""
188
+ error: data.error || "Failed to register agent",
189
+ success: false
853
190
  };
854
191
  }
855
- progressReporter.completed("Profile stored successfully", {
856
- profileTopicId: profileResult.profileTopicId
857
- });
192
+ if (logger) {
193
+ logger.info(
194
+ `Created new registration request. Transaction ID: ${data.transaction_id}`
195
+ );
196
+ }
858
197
  return {
859
- profileTopicId: profileResult.profileTopicId,
860
- pfpTopicId,
861
- success: true,
862
- transactionId: profileResult.transactionId || ""
198
+ transactionId: data.transaction_id,
199
+ transaction: data.transaction,
200
+ success: true
863
201
  };
864
202
  } catch (error) {
865
- this.logger.error(`Error storing HCS11 profile: ${error.message}`);
866
- return {
867
- profileTopicId: "",
868
- success: false,
869
- error: error.message,
870
- transactionId: ""
871
- };
872
- }
873
- }
874
- async createTopic(memo, adminKey, submitKey) {
875
- this.logger.info("Creating topic");
876
- const { accountId, signer } = this.getAccountAndSigner();
877
- const transaction = new TopicCreateTransaction().setTopicMemo(memo);
878
- const publicKey = await this.mirrorNode.getPublicKey(accountId);
879
- if (adminKey && publicKey) {
880
- transaction.setAdminKey(publicKey);
881
- transaction.setAutoRenewAccountId(accountId);
882
- }
883
- if (submitKey && publicKey) {
884
- transaction.setSubmitKey(publicKey);
885
- }
886
- const transactionResponse = await this.hwc.executeTransactionWithErrorHandling(
887
- transaction,
888
- false
889
- );
890
- const error = transactionResponse.error;
891
- if (error) {
892
- this.logger.error(error);
893
- return {
894
- success: false,
895
- error
896
- };
897
- }
898
- const resultReceipt = transactionResponse.result;
899
- if (!resultReceipt?.topicId) {
900
- this.logger.error("Failed to create topic: topicId is null");
901
203
  return {
902
- success: false,
903
- error: "Failed to create topic: topicId is null"
204
+ error: `Error during registration request: ${error.message}`,
205
+ success: false
904
206
  };
905
207
  }
906
- return {
907
- success: true,
908
- topicId: resultReceipt.topicId.toString()
909
- };
910
- }
911
- async submitPayload(topicId, payload, submitKey, requiresFee) {
912
- this.logger.debug(`Submitting payload to topic ${topicId}`);
913
- let message;
914
- if (typeof payload === "string") {
915
- message = payload;
916
- } else {
917
- message = JSON.stringify(payload);
918
- }
919
- const transaction = new TopicMessageSubmitTransaction().setTopicId(topicId).setMessage(message);
920
- const transactionMemo = this.getHcs10TransactionMemo(payload);
921
- if (transactionMemo) {
922
- transaction.setTransactionMemo(transactionMemo);
923
- }
924
- let transactionResponse;
925
- if (requiresFee) {
926
- this.logger.info(
927
- "Topic requires fee payment, setting max transaction fee"
928
- );
929
- transaction.setMaxTransactionFee(new Hbar(this.feeAmount));
930
- }
931
- if (submitKey) {
932
- const { signer } = this.getAccountAndSigner();
933
- transaction.freezeWithSigner(signer);
934
- const signedTransaction = await transaction.sign(submitKey);
935
- transactionResponse = await this.hwc.executeTransactionWithErrorHandling(
936
- signedTransaction,
937
- true
938
- );
939
- } else {
940
- transactionResponse = await this.hwc.executeTransactionWithErrorHandling(
941
- transaction,
942
- false
943
- );
944
- }
945
- if (transactionResponse?.error) {
946
- this.logger.error(
947
- `Failed to submit payload: ${transactionResponse.error}`
948
- );
949
- throw new Error(`Failed to submit payload: ${transactionResponse.error}`);
950
- }
951
- if (!transactionResponse?.result) {
952
- this.logger.error(
953
- "Failed to submit message: receipt is null or undefined"
954
- );
955
- throw new Error("Failed to submit message: receipt is null or undefined");
956
- }
957
- this.logger.debug("Payload submitted successfully via HWC");
958
- return transactionResponse.result;
959
- }
960
- async inscribeFile(buffer, fileName, options) {
961
- const { accountId, signer } = this.getAccountAndSigner();
962
- const mimeType = mime.lookup(fileName) || "application/octet-stream";
963
- const sdk = await InscriptionSDK.createWithAuth({
964
- type: "client",
965
- accountId,
966
- signer,
967
- network: this.network
968
- });
969
- const inscriptionOptions = {
970
- mode: "file",
971
- waitForConfirmation: true,
972
- waitMaxAttempts: options?.waitMaxAttempts || 30,
973
- waitIntervalMs: options?.waitIntervalMs || 4e3,
974
- progressCallback: options?.progressCallback,
975
- logging: {
976
- level: this.logger.getLevel ? this.logger.getLevel() : "info"
977
- }
978
- };
979
- const response = await inscribeWithSigner(
980
- {
981
- type: "buffer",
982
- buffer,
983
- fileName,
984
- mimeType
985
- },
986
- signer,
987
- {
988
- ...inscriptionOptions,
989
- network: this.network
990
- },
991
- sdk
992
- );
993
- if (!response.confirmed || !response.inscription) {
994
- throw new Error("Inscription was not confirmed");
995
- }
996
- return response.inscription;
997
- }
998
- getAccountAndSigner() {
999
- const accountInfo = this?.hwc?.getAccountInfo();
1000
- const accountId = accountInfo?.accountId?.toString();
1001
- const signer = this?.hwc?.dAppConnector?.signers?.find((s) => {
1002
- return s.getAccountId().toString() === accountId;
1003
- });
1004
- if (!signer) {
1005
- this.logger.error("Failed to find signer", {
1006
- accountId,
1007
- signers: this?.hwc?.dAppConnector?.signers,
1008
- accountInfo
1009
- });
1010
- throw new Error("Failed to find signer");
1011
- }
1012
- return { accountId, signer };
1013
208
  }
1014
209
  /**
1015
- * Inscribes a profile picture (PFP) on HCS-11.
210
+ * Finds registrations based on the provided options.
1016
211
  *
1017
- * @param buffer - The buffer containing the PFP image.
1018
- * @param fileName - The name of the file containing the PFP image.
1019
- * @param options - Optional configuration options.
1020
- * @returns A promise that resolves to the topic ID of the inscribed PFP.
212
+ * @param options - The options for searching registrations.
213
+ * @param baseUrl - The base URL of the guarded registry.
214
+ * @returns A promise that resolves to the registration search result.
1021
215
  */
1022
- async inscribePfp(buffer, fileName, options) {
216
+ async findRegistrations(options = {}, baseUrl = "https://moonscape.tech") {
1023
217
  try {
1024
- const progressCallback = options?.progressCallback;
1025
- const progressReporter = new ProgressReporter({
1026
- module: "PFP-Inscription",
1027
- logger: this.logger,
1028
- callback: progressCallback
1029
- });
1030
- if (!this.hcs11Client) {
1031
- progressReporter.failed(
1032
- "HCS11Client is not available in this environment"
1033
- );
218
+ const queryParams = new URLSearchParams();
219
+ options.tags?.forEach((tag) => queryParams.append("tags", tag.toString()));
220
+ if (options.accountId) {
221
+ queryParams.append("accountId", options.accountId);
222
+ }
223
+ if (options.network) {
224
+ queryParams.append("network", options.network);
225
+ }
226
+ const response = await fetch(
227
+ `${baseUrl}/api/registrations?${queryParams}`,
228
+ {
229
+ headers: {
230
+ Accept: "*/*",
231
+ "Accept-Language": "en;q=0.5",
232
+ Origin: baseUrl,
233
+ Referer: `${baseUrl}/`
234
+ }
235
+ }
236
+ );
237
+ if (!response.ok) {
238
+ const error = await response.text();
1034
239
  return {
1035
- pfpTopicId: "",
1036
- success: false,
1037
- error: "HCS11Client is not available in this environment",
1038
- transactionId: ""
240
+ registrations: [],
241
+ error: error || "Failed to fetch registrations",
242
+ success: false
1039
243
  };
1040
244
  }
1041
- progressReporter.preparing("Preparing to inscribe profile picture", 10);
1042
- this.logger.info("Inscribing profile picture using HCS-11 client");
1043
- const wrappedProgressCallback = (data) => {
1044
- progressReporter.report({
1045
- stage: data.stage || "confirming",
1046
- message: data.message || "Processing PFP inscription",
1047
- progressPercent: data.progressPercent || 50,
1048
- details: data.details
1049
- });
1050
- };
1051
- const imageResult = await this.hcs11Client.inscribeImage(
1052
- buffer,
1053
- fileName,
1054
- { progressCallback: wrappedProgressCallback }
1055
- );
1056
- if (!imageResult.success) {
1057
- let errorMessage = "Failed to inscribe profile picture";
1058
- if (imageResult.error) {
1059
- errorMessage = imageResult.error;
1060
- }
1061
- let txId = "";
1062
- if (imageResult.transactionId) {
1063
- txId = imageResult.transactionId;
1064
- }
245
+ const data = await response.json();
246
+ if (data.error) {
1065
247
  return {
1066
- pfpTopicId: "",
1067
- success: false,
1068
- error: errorMessage,
1069
- transactionId: txId
248
+ registrations: [],
249
+ error: data.error,
250
+ success: false
1070
251
  };
1071
252
  }
1072
- progressReporter.completed("Successfully inscribed profile picture", {
1073
- pfpTopicId: imageResult.imageTopicId
1074
- });
1075
- this.logger.info(
1076
- `Successfully inscribed profile picture with topic ID: ${imageResult.imageTopicId}`
1077
- );
1078
253
  return {
1079
- pfpTopicId: imageResult.imageTopicId,
1080
- success: true,
1081
- transactionId: imageResult.transactionId || ""
254
+ registrations: data.registrations || [],
255
+ success: true
1082
256
  };
1083
- } catch (error) {
1084
- this.logger.error(`Error inscribing profile picture: ${error.message}`);
257
+ } catch (e) {
258
+ const error = e;
1085
259
  return {
1086
- pfpTopicId: "",
1087
- success: false,
1088
- error: error.message,
1089
- transactionId: ""
260
+ registrations: [],
261
+ error: `Error fetching registrations: ${error.message}`,
262
+ success: false
1090
263
  };
1091
264
  }
1092
265
  }
1093
- async createCommunicationTopics(options, progressReporter) {
1094
- let state = options?.existingState || {
1095
- currentStage: "init",
1096
- completedPercentage: 0,
1097
- createdResources: []
1098
- };
1099
- if (progressReporter) {
1100
- progressReporter.preparing("Starting communication topic creation", 0, {
1101
- state
1102
- });
1103
- }
1104
- const { accountId } = this.getAccountAndSigner();
1105
- if (!state.outboundTopicId) {
1106
- state.currentStage = "topics";
1107
- if (progressReporter) {
1108
- progressReporter.preparing("Creating outbound topic", 5, {
1109
- state
1110
- });
1111
- }
1112
- const outboundMemo = this._generateHcs10Memo(Hcs10MemoType.OUTBOUND, {
1113
- ttl: options?.ttl,
1114
- accountId
1115
- });
1116
- const outboundResult = await this.createTopic(outboundMemo, true, true);
1117
- if (!outboundResult.success || !outboundResult.topicId) {
1118
- throw new Error(
1119
- outboundResult.error || "Failed to create outbound topic"
1120
- );
1121
- }
1122
- state.outboundTopicId = outboundResult.topicId;
1123
- if (state.createdResources)
1124
- state.createdResources.push(`outbound:${state.outboundTopicId}`);
1125
- }
1126
- if (!state.inboundTopicId) {
1127
- state.currentStage = "topics";
1128
- if (progressReporter) {
1129
- progressReporter.preparing("Creating inbound topic", 10, {
1130
- state
1131
- });
1132
- }
1133
- const inboundMemo = this._generateHcs10Memo(Hcs10MemoType.INBOUND, {
1134
- ttl: options?.ttl,
1135
- accountId
1136
- });
1137
- const inboundResult = await this.createTopic(inboundMemo, true, false);
1138
- if (!inboundResult.success || !inboundResult.topicId) {
1139
- throw new Error(
1140
- inboundResult.error || "Failed to create inbound topic"
1141
- );
1142
- }
1143
- state.inboundTopicId = inboundResult.topicId;
1144
- if (state.createdResources)
1145
- state.createdResources.push(`inbound:${state.inboundTopicId}`);
1146
- }
1147
- return {
1148
- inboundTopicId: state.inboundTopicId,
1149
- outboundTopicId: state.outboundTopicId,
1150
- state
1151
- };
1152
- }
1153
266
  }
1154
267
  export {
1155
- BrowserHCSClient
268
+ Registration
1156
269
  };
1157
270
  //# sourceMappingURL=standards-sdk.es20.js.map