@hashgraphonline/standards-sdk 0.1.144 → 0.1.145

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 (423) hide show
  1. package/dist/cjs/hcs-10/base-client.d.ts.map +1 -1
  2. package/dist/cjs/hcs-10/sdk.d.ts +8 -0
  3. package/dist/cjs/hcs-10/sdk.d.ts.map +1 -1
  4. package/dist/cjs/hcs-11/client.d.ts +2 -2
  5. package/dist/cjs/hcs-11/client.d.ts.map +1 -1
  6. package/dist/cjs/hcs-11/person-builder.d.ts +1 -0
  7. package/dist/cjs/hcs-11/person-builder.d.ts.map +1 -1
  8. package/dist/cjs/hcs-11/types.d.ts +1 -0
  9. package/dist/cjs/hcs-11/types.d.ts.map +1 -1
  10. package/dist/cjs/hcs-12/rendering/resource-manager.d.ts.map +1 -1
  11. package/dist/cjs/hcs-14/issuers/hiero.d.ts.map +1 -1
  12. package/dist/cjs/hcs-15/browser.d.ts +2 -0
  13. package/dist/cjs/hcs-15/browser.d.ts.map +1 -1
  14. package/dist/cjs/hcs-15/sdk.d.ts +7 -1
  15. package/dist/cjs/hcs-15/sdk.d.ts.map +1 -1
  16. package/dist/cjs/hcs-15/tx.d.ts +4 -0
  17. package/dist/cjs/hcs-15/tx.d.ts.map +1 -1
  18. package/dist/cjs/hcs-15/types.d.ts +16 -1
  19. package/dist/cjs/hcs-15/types.d.ts.map +1 -1
  20. package/dist/cjs/hcs-16/browser.d.ts +11 -2
  21. package/dist/cjs/hcs-16/browser.d.ts.map +1 -1
  22. package/dist/cjs/hcs-16/sdk.d.ts +62 -1
  23. package/dist/cjs/hcs-16/sdk.d.ts.map +1 -1
  24. package/dist/cjs/hcs-16/tx.d.ts +21 -3
  25. package/dist/cjs/hcs-16/tx.d.ts.map +1 -1
  26. package/dist/cjs/hcs-17/base-client.d.ts +1 -0
  27. package/dist/cjs/hcs-17/base-client.d.ts.map +1 -1
  28. package/dist/cjs/hcs-17/sdk.d.ts.map +1 -1
  29. package/dist/cjs/hcs-17/tx.d.ts +2 -0
  30. package/dist/cjs/hcs-17/tx.d.ts.map +1 -1
  31. package/dist/cjs/hcs-17/types.d.ts +4 -0
  32. package/dist/cjs/hcs-17/types.d.ts.map +1 -1
  33. package/dist/cjs/index.d.ts.map +1 -1
  34. package/dist/cjs/services/registry-broker/client/base-client.d.ts +14 -1
  35. package/dist/cjs/services/registry-broker/client/base-client.d.ts.map +1 -1
  36. package/dist/cjs/services/registry-broker/client/feedback.d.ts +2 -0
  37. package/dist/cjs/services/registry-broker/client/feedback.d.ts.map +1 -0
  38. package/dist/cjs/services/registry-broker/private-key-signer.d.ts +1 -0
  39. package/dist/cjs/services/registry-broker/private-key-signer.d.ts.map +1 -1
  40. package/dist/cjs/services/registry-broker/schemas.d.ts +998 -577
  41. package/dist/cjs/services/registry-broker/schemas.d.ts.map +1 -1
  42. package/dist/cjs/services/registry-broker/types.d.ts +20 -1
  43. package/dist/cjs/services/registry-broker/types.d.ts.map +1 -1
  44. package/dist/cjs/standards-sdk.cjs +2 -2
  45. package/dist/cjs/standards-sdk.cjs.map +1 -1
  46. package/dist/cjs/utils/crypto-abstraction.d.ts.map +1 -1
  47. package/dist/cjs/utils/crypto-env.d.ts.map +1 -1
  48. package/dist/cjs/utils/dynamic-import.d.ts +5 -1
  49. package/dist/cjs/utils/dynamic-import.d.ts.map +1 -1
  50. package/dist/cjs/utils/hash-adapter.d.ts.map +1 -1
  51. package/dist/es/hcs-10/base-client.d.ts.map +1 -1
  52. package/dist/es/hcs-10/sdk.d.ts +8 -0
  53. package/dist/es/hcs-10/sdk.d.ts.map +1 -1
  54. package/dist/es/hcs-11/client.d.ts +2 -2
  55. package/dist/es/hcs-11/client.d.ts.map +1 -1
  56. package/dist/es/hcs-11/person-builder.d.ts +1 -0
  57. package/dist/es/hcs-11/person-builder.d.ts.map +1 -1
  58. package/dist/es/hcs-11/types.d.ts +1 -0
  59. package/dist/es/hcs-11/types.d.ts.map +1 -1
  60. package/dist/es/hcs-12/rendering/resource-manager.d.ts.map +1 -1
  61. package/dist/es/hcs-14/issuers/hiero.d.ts.map +1 -1
  62. package/dist/es/hcs-15/browser.d.ts +2 -0
  63. package/dist/es/hcs-15/browser.d.ts.map +1 -1
  64. package/dist/es/hcs-15/sdk.d.ts +7 -1
  65. package/dist/es/hcs-15/sdk.d.ts.map +1 -1
  66. package/dist/es/hcs-15/tx.d.ts +4 -0
  67. package/dist/es/hcs-15/tx.d.ts.map +1 -1
  68. package/dist/es/hcs-15/types.d.ts +16 -1
  69. package/dist/es/hcs-15/types.d.ts.map +1 -1
  70. package/dist/es/hcs-16/browser.d.ts +11 -2
  71. package/dist/es/hcs-16/browser.d.ts.map +1 -1
  72. package/dist/es/hcs-16/sdk.d.ts +62 -1
  73. package/dist/es/hcs-16/sdk.d.ts.map +1 -1
  74. package/dist/es/hcs-16/tx.d.ts +21 -3
  75. package/dist/es/hcs-16/tx.d.ts.map +1 -1
  76. package/dist/es/hcs-17/base-client.d.ts +1 -0
  77. package/dist/es/hcs-17/base-client.d.ts.map +1 -1
  78. package/dist/es/hcs-17/sdk.d.ts.map +1 -1
  79. package/dist/es/hcs-17/tx.d.ts +2 -0
  80. package/dist/es/hcs-17/tx.d.ts.map +1 -1
  81. package/dist/es/hcs-17/types.d.ts +4 -0
  82. package/dist/es/hcs-17/types.d.ts.map +1 -1
  83. package/dist/es/index.d.ts.map +1 -1
  84. package/dist/es/services/registry-broker/client/base-client.d.ts +14 -1
  85. package/dist/es/services/registry-broker/client/base-client.d.ts.map +1 -1
  86. package/dist/es/services/registry-broker/client/feedback.d.ts +2 -0
  87. package/dist/es/services/registry-broker/client/feedback.d.ts.map +1 -0
  88. package/dist/es/services/registry-broker/private-key-signer.d.ts +1 -0
  89. package/dist/es/services/registry-broker/private-key-signer.d.ts.map +1 -1
  90. package/dist/es/services/registry-broker/schemas.d.ts +998 -577
  91. package/dist/es/services/registry-broker/schemas.d.ts.map +1 -1
  92. package/dist/es/services/registry-broker/types.d.ts +20 -1
  93. package/dist/es/services/registry-broker/types.d.ts.map +1 -1
  94. package/dist/es/standards-sdk.es.js +141 -135
  95. package/dist/es/standards-sdk.es.js.map +1 -1
  96. package/dist/es/standards-sdk.es10.js +70 -90
  97. package/dist/es/standards-sdk.es10.js.map +1 -1
  98. package/dist/es/standards-sdk.es100.js +229 -26
  99. package/dist/es/standards-sdk.es100.js.map +1 -1
  100. package/dist/es/standards-sdk.es101.js +109 -228
  101. package/dist/es/standards-sdk.es101.js.map +1 -1
  102. package/dist/es/standards-sdk.es102.js +15 -94
  103. package/dist/es/standards-sdk.es102.js.map +1 -1
  104. package/dist/es/standards-sdk.es103.js +80 -30
  105. package/dist/es/standards-sdk.es103.js.map +1 -1
  106. package/dist/es/standards-sdk.es104.js +27 -80
  107. package/dist/es/standards-sdk.es104.js.map +1 -1
  108. package/dist/es/standards-sdk.es105.js +136 -25
  109. package/dist/es/standards-sdk.es105.js.map +1 -1
  110. package/dist/es/standards-sdk.es106.js +27 -140
  111. package/dist/es/standards-sdk.es106.js.map +1 -1
  112. package/dist/es/standards-sdk.es107.js +20 -27
  113. package/dist/es/standards-sdk.es107.js.map +1 -1
  114. package/dist/es/standards-sdk.es108.js +156 -18
  115. package/dist/es/standards-sdk.es108.js.map +1 -1
  116. package/dist/es/standards-sdk.es109.js +198 -148
  117. package/dist/es/standards-sdk.es109.js.map +1 -1
  118. package/dist/es/standards-sdk.es11.js +121 -45
  119. package/dist/es/standards-sdk.es11.js.map +1 -1
  120. package/dist/es/standards-sdk.es110.js +747 -166
  121. package/dist/es/standards-sdk.es110.js.map +1 -1
  122. package/dist/es/standards-sdk.es111.js +9 -786
  123. package/dist/es/standards-sdk.es111.js.map +1 -1
  124. package/dist/es/standards-sdk.es112.js +567 -13
  125. package/dist/es/standards-sdk.es112.js.map +1 -1
  126. package/dist/es/standards-sdk.es113.js +576 -541
  127. package/dist/es/standards-sdk.es113.js.map +1 -1
  128. package/dist/es/standards-sdk.es114.js +12 -601
  129. package/dist/es/standards-sdk.es114.js.map +1 -1
  130. package/dist/es/standards-sdk.es115.js +2 -13
  131. package/dist/es/standards-sdk.es115.js.map +1 -1
  132. package/dist/es/standards-sdk.es116.js +87 -2
  133. package/dist/es/standards-sdk.es116.js.map +1 -1
  134. package/dist/es/standards-sdk.es117.js +37 -80
  135. package/dist/es/standards-sdk.es117.js.map +1 -1
  136. package/dist/es/standards-sdk.es118.js +2 -39
  137. package/dist/es/standards-sdk.es118.js.map +1 -1
  138. package/dist/es/standards-sdk.es119.js +231 -2
  139. package/dist/es/standards-sdk.es119.js.map +1 -1
  140. package/dist/es/standards-sdk.es12.js +60 -159
  141. package/dist/es/standards-sdk.es12.js.map +1 -1
  142. package/dist/es/standards-sdk.es120.js +1110 -193
  143. package/dist/es/standards-sdk.es120.js.map +1 -1
  144. package/dist/es/standards-sdk.es121.js +225 -1059
  145. package/dist/es/standards-sdk.es121.js.map +1 -1
  146. package/dist/es/standards-sdk.es122.js +419 -303
  147. package/dist/es/standards-sdk.es122.js.map +1 -1
  148. package/dist/es/standards-sdk.es123.js +351 -418
  149. package/dist/es/standards-sdk.es123.js.map +1 -1
  150. package/dist/es/standards-sdk.es124.js +872 -347
  151. package/dist/es/standards-sdk.es124.js.map +1 -1
  152. package/dist/es/standards-sdk.es125.js +182 -854
  153. package/dist/es/standards-sdk.es125.js.map +1 -1
  154. package/dist/es/standards-sdk.es126.js +1512 -153
  155. package/dist/es/standards-sdk.es126.js.map +1 -1
  156. package/dist/es/standards-sdk.es127.js +157 -1547
  157. package/dist/es/standards-sdk.es127.js.map +1 -1
  158. package/dist/es/standards-sdk.es128.js +192 -162
  159. package/dist/es/standards-sdk.es128.js.map +1 -1
  160. package/dist/es/standards-sdk.es129.js +61 -164
  161. package/dist/es/standards-sdk.es129.js.map +1 -1
  162. package/dist/es/standards-sdk.es13.js +200 -60
  163. package/dist/es/standards-sdk.es13.js.map +1 -1
  164. package/dist/es/standards-sdk.es130.js +102 -85
  165. package/dist/es/standards-sdk.es130.js.map +1 -1
  166. package/dist/es/standards-sdk.es131.js +222 -96
  167. package/dist/es/standards-sdk.es131.js.map +1 -1
  168. package/dist/es/standards-sdk.es132.js +153 -220
  169. package/dist/es/standards-sdk.es132.js.map +1 -1
  170. package/dist/es/standards-sdk.es133.js +104 -162
  171. package/dist/es/standards-sdk.es133.js.map +1 -1
  172. package/dist/es/standards-sdk.es134.js +296 -92
  173. package/dist/es/standards-sdk.es134.js.map +1 -1
  174. package/dist/es/standards-sdk.es135.js +432 -294
  175. package/dist/es/standards-sdk.es135.js.map +1 -1
  176. package/dist/es/standards-sdk.es136.js +14 -363
  177. package/dist/es/standards-sdk.es136.js.map +1 -1
  178. package/dist/es/standards-sdk.es137.js +79 -15
  179. package/dist/es/standards-sdk.es137.js.map +1 -1
  180. package/dist/es/standards-sdk.es138.js +79 -59
  181. package/dist/es/standards-sdk.es138.js.map +1 -1
  182. package/dist/es/standards-sdk.es139.js +152 -80
  183. package/dist/es/standards-sdk.es139.js.map +1 -1
  184. package/dist/es/standards-sdk.es14.js +149 -178
  185. package/dist/es/standards-sdk.es14.js.map +1 -1
  186. package/dist/es/standards-sdk.es140.js +7 -159
  187. package/dist/es/standards-sdk.es140.js.map +1 -1
  188. package/dist/es/standards-sdk.es141.js +86 -7
  189. package/dist/es/standards-sdk.es141.js.map +1 -1
  190. package/dist/es/standards-sdk.es142.js +44 -65
  191. package/dist/es/standards-sdk.es142.js.map +1 -1
  192. package/dist/es/standards-sdk.es143.js +30 -65
  193. package/dist/es/standards-sdk.es143.js.map +1 -1
  194. package/dist/es/standards-sdk.es144.js +34 -28
  195. package/dist/es/standards-sdk.es144.js.map +1 -1
  196. package/dist/es/standards-sdk.es145.js +28 -138
  197. package/dist/es/standards-sdk.es145.js.map +1 -1
  198. package/dist/es/standards-sdk.es146.js +133 -37
  199. package/dist/es/standards-sdk.es146.js.map +1 -1
  200. package/dist/es/standards-sdk.es147.js +34 -12281
  201. package/dist/es/standards-sdk.es147.js.map +1 -1
  202. package/dist/es/standards-sdk.es148.js +12284 -12
  203. package/dist/es/standards-sdk.es148.js.map +1 -1
  204. package/dist/es/standards-sdk.es149.js +958 -56
  205. package/dist/es/standards-sdk.es149.js.map +1 -1
  206. package/dist/es/standards-sdk.es15.js +152 -151
  207. package/dist/es/standards-sdk.es15.js.map +1 -1
  208. package/dist/es/standards-sdk.es150.js +48 -74
  209. package/dist/es/standards-sdk.es150.js.map +1 -1
  210. package/dist/es/standards-sdk.es151.js +72 -160
  211. package/dist/es/standards-sdk.es151.js.map +1 -1
  212. package/dist/es/standards-sdk.es152.js +13 -318
  213. package/dist/es/standards-sdk.es152.js.map +1 -1
  214. package/dist/es/standards-sdk.es153.js +120 -294
  215. package/dist/es/standards-sdk.es153.js.map +1 -1
  216. package/dist/es/standards-sdk.es154.js +191 -322
  217. package/dist/es/standards-sdk.es154.js.map +1 -1
  218. package/dist/es/standards-sdk.es155.js +294 -279
  219. package/dist/es/standards-sdk.es155.js.map +1 -1
  220. package/dist/es/standards-sdk.es156.js +440 -63
  221. package/dist/es/standards-sdk.es156.js.map +1 -1
  222. package/dist/es/standards-sdk.es157.js +331 -871
  223. package/dist/es/standards-sdk.es157.js.map +1 -1
  224. package/dist/es/standards-sdk.es158.js +68 -231
  225. package/dist/es/standards-sdk.es158.js.map +1 -1
  226. package/dist/es/standards-sdk.es159.js +218 -223
  227. package/dist/es/standards-sdk.es159.js.map +1 -1
  228. package/dist/es/standards-sdk.es16.js +917 -136
  229. package/dist/es/standards-sdk.es16.js.map +1 -1
  230. package/dist/es/standards-sdk.es160.js +247 -0
  231. package/dist/es/standards-sdk.es160.js.map +1 -0
  232. package/dist/es/standards-sdk.es17.js +23 -944
  233. package/dist/es/standards-sdk.es17.js.map +1 -1
  234. package/dist/es/standards-sdk.es18.js +2422 -24
  235. package/dist/es/standards-sdk.es18.js.map +1 -1
  236. package/dist/es/standards-sdk.es19.js +817 -2071
  237. package/dist/es/standards-sdk.es19.js.map +1 -1
  238. package/dist/es/standards-sdk.es2.js +654 -189
  239. package/dist/es/standards-sdk.es2.js.map +1 -1
  240. package/dist/es/standards-sdk.es20.js +205 -1091
  241. package/dist/es/standards-sdk.es20.js.map +1 -1
  242. package/dist/es/standards-sdk.es21.js +858 -221
  243. package/dist/es/standards-sdk.es21.js.map +1 -1
  244. package/dist/es/standards-sdk.es22.js +179 -903
  245. package/dist/es/standards-sdk.es22.js.map +1 -1
  246. package/dist/es/standards-sdk.es23.js +164 -179
  247. package/dist/es/standards-sdk.es23.js.map +1 -1
  248. package/dist/es/standards-sdk.es24.js +62 -118
  249. package/dist/es/standards-sdk.es24.js.map +1 -1
  250. package/dist/es/standards-sdk.es25.js +377 -52
  251. package/dist/es/standards-sdk.es25.js.map +1 -1
  252. package/dist/es/standards-sdk.es26.js +36 -394
  253. package/dist/es/standards-sdk.es26.js.map +1 -1
  254. package/dist/es/standards-sdk.es27.js +901 -50
  255. package/dist/es/standards-sdk.es27.js.map +1 -1
  256. package/dist/es/standards-sdk.es28.js +134 -902
  257. package/dist/es/standards-sdk.es28.js.map +1 -1
  258. package/dist/es/standards-sdk.es29.js +7 -134
  259. package/dist/es/standards-sdk.es29.js.map +1 -1
  260. package/dist/es/standards-sdk.es3.js +63 -680
  261. package/dist/es/standards-sdk.es3.js.map +1 -1
  262. package/dist/es/standards-sdk.es30.js +344 -7
  263. package/dist/es/standards-sdk.es30.js.map +1 -1
  264. package/dist/es/standards-sdk.es31.js +302 -287
  265. package/dist/es/standards-sdk.es31.js.map +1 -1
  266. package/dist/es/standards-sdk.es32.js +94 -322
  267. package/dist/es/standards-sdk.es32.js.map +1 -1
  268. package/dist/es/standards-sdk.es33.js +458 -101
  269. package/dist/es/standards-sdk.es33.js.map +1 -1
  270. package/dist/es/standards-sdk.es34.js +132 -451
  271. package/dist/es/standards-sdk.es34.js.map +1 -1
  272. package/dist/es/standards-sdk.es35.js +216 -130
  273. package/dist/es/standards-sdk.es35.js.map +1 -1
  274. package/dist/es/standards-sdk.es36.js +273 -195
  275. package/dist/es/standards-sdk.es36.js.map +1 -1
  276. package/dist/es/standards-sdk.es37.js +148 -87
  277. package/dist/es/standards-sdk.es37.js.map +1 -1
  278. package/dist/es/standards-sdk.es38.js +183 -320
  279. package/dist/es/standards-sdk.es38.js.map +1 -1
  280. package/dist/es/standards-sdk.es39.js +238 -161
  281. package/dist/es/standards-sdk.es39.js.map +1 -1
  282. package/dist/es/standards-sdk.es4.js +425 -63
  283. package/dist/es/standards-sdk.es4.js.map +1 -1
  284. package/dist/es/standards-sdk.es40.js +136 -254
  285. package/dist/es/standards-sdk.es40.js.map +1 -1
  286. package/dist/es/standards-sdk.es41.js +225 -176
  287. package/dist/es/standards-sdk.es41.js.map +1 -1
  288. package/dist/es/standards-sdk.es42.js +199 -261
  289. package/dist/es/standards-sdk.es42.js.map +1 -1
  290. package/dist/es/standards-sdk.es43.js +237 -199
  291. package/dist/es/standards-sdk.es43.js.map +1 -1
  292. package/dist/es/standards-sdk.es44.js +209 -201
  293. package/dist/es/standards-sdk.es44.js.map +1 -1
  294. package/dist/es/standards-sdk.es45.js +305 -201
  295. package/dist/es/standards-sdk.es45.js.map +1 -1
  296. package/dist/es/standards-sdk.es46.js +371 -261
  297. package/dist/es/standards-sdk.es46.js.map +1 -1
  298. package/dist/es/standards-sdk.es47.js +316 -371
  299. package/dist/es/standards-sdk.es47.js.map +1 -1
  300. package/dist/es/standards-sdk.es48.js +404 -336
  301. package/dist/es/standards-sdk.es48.js.map +1 -1
  302. package/dist/es/standards-sdk.es49.js +83 -449
  303. package/dist/es/standards-sdk.es49.js.map +1 -1
  304. package/dist/es/standards-sdk.es5.js +232 -354
  305. package/dist/es/standards-sdk.es5.js.map +1 -1
  306. package/dist/es/standards-sdk.es50.js +179 -89
  307. package/dist/es/standards-sdk.es50.js.map +1 -1
  308. package/dist/es/standards-sdk.es51.js +231 -165
  309. package/dist/es/standards-sdk.es51.js.map +1 -1
  310. package/dist/es/standards-sdk.es52.js +25 -262
  311. package/dist/es/standards-sdk.es52.js.map +1 -1
  312. package/dist/es/standards-sdk.es53.js +56 -26
  313. package/dist/es/standards-sdk.es53.js.map +1 -1
  314. package/dist/es/standards-sdk.es54.js +12 -57
  315. package/dist/es/standards-sdk.es54.js.map +1 -1
  316. package/dist/es/standards-sdk.es55.js +49 -12
  317. package/dist/es/standards-sdk.es55.js.map +1 -1
  318. package/dist/es/standards-sdk.es56.js +115 -43
  319. package/dist/es/standards-sdk.es56.js.map +1 -1
  320. package/dist/es/standards-sdk.es57.js +42 -115
  321. package/dist/es/standards-sdk.es57.js.map +1 -1
  322. package/dist/es/standards-sdk.es58.js +52 -43
  323. package/dist/es/standards-sdk.es58.js.map +1 -1
  324. package/dist/es/standards-sdk.es59.js +36 -50
  325. package/dist/es/standards-sdk.es59.js.map +1 -1
  326. package/dist/es/standards-sdk.es6.js +125 -246
  327. package/dist/es/standards-sdk.es6.js.map +1 -1
  328. package/dist/es/standards-sdk.es60.js +207 -39
  329. package/dist/es/standards-sdk.es60.js.map +1 -1
  330. package/dist/es/standards-sdk.es61.js +24 -200
  331. package/dist/es/standards-sdk.es61.js.map +1 -1
  332. package/dist/es/standards-sdk.es62.js +87 -25
  333. package/dist/es/standards-sdk.es62.js.map +1 -1
  334. package/dist/es/standards-sdk.es63.js +3 -51
  335. package/dist/es/standards-sdk.es63.js.map +1 -1
  336. package/dist/es/standards-sdk.es64.js +100 -3
  337. package/dist/es/standards-sdk.es64.js.map +1 -1
  338. package/dist/es/standards-sdk.es65.js +61 -62
  339. package/dist/es/standards-sdk.es65.js.map +1 -1
  340. package/dist/es/standards-sdk.es66.js +17 -98
  341. package/dist/es/standards-sdk.es66.js.map +1 -1
  342. package/dist/es/standards-sdk.es67.js +77 -19
  343. package/dist/es/standards-sdk.es67.js.map +1 -1
  344. package/dist/es/standards-sdk.es68.js +458 -77
  345. package/dist/es/standards-sdk.es68.js.map +1 -1
  346. package/dist/es/standards-sdk.es69.js +106 -240
  347. package/dist/es/standards-sdk.es69.js.map +1 -1
  348. package/dist/es/standards-sdk.es7.js +28 -183
  349. package/dist/es/standards-sdk.es7.js.map +1 -1
  350. package/dist/es/standards-sdk.es70.js +170 -286
  351. package/dist/es/standards-sdk.es70.js.map +1 -1
  352. package/dist/es/standards-sdk.es71.js +71 -207
  353. package/dist/es/standards-sdk.es71.js.map +1 -1
  354. package/dist/es/standards-sdk.es72.js +71 -72
  355. package/dist/es/standards-sdk.es72.js.map +1 -1
  356. package/dist/es/standards-sdk.es73.js +143 -71
  357. package/dist/es/standards-sdk.es73.js.map +1 -1
  358. package/dist/es/standards-sdk.es74.js +62 -136
  359. package/dist/es/standards-sdk.es74.js.map +1 -1
  360. package/dist/es/standards-sdk.es75.js +380 -45
  361. package/dist/es/standards-sdk.es75.js.map +1 -1
  362. package/dist/es/standards-sdk.es76.js +222 -130
  363. package/dist/es/standards-sdk.es76.js.map +1 -1
  364. package/dist/es/standards-sdk.es77.js +320 -444
  365. package/dist/es/standards-sdk.es77.js.map +1 -1
  366. package/dist/es/standards-sdk.es78.js +88 -370
  367. package/dist/es/standards-sdk.es78.js.map +1 -1
  368. package/dist/es/standards-sdk.es79.js +125 -89
  369. package/dist/es/standards-sdk.es79.js.map +1 -1
  370. package/dist/es/standards-sdk.es8.js +80 -29
  371. package/dist/es/standards-sdk.es8.js.map +1 -1
  372. package/dist/es/standards-sdk.es80.js +8 -125
  373. package/dist/es/standards-sdk.es80.js.map +1 -1
  374. package/dist/es/standards-sdk.es81.js +45 -6
  375. package/dist/es/standards-sdk.es81.js.map +1 -1
  376. package/dist/es/standards-sdk.es82.js +98 -44
  377. package/dist/es/standards-sdk.es82.js.map +1 -1
  378. package/dist/es/standards-sdk.es83.js +331 -84
  379. package/dist/es/standards-sdk.es83.js.map +1 -1
  380. package/dist/es/standards-sdk.es84.js +93 -160
  381. package/dist/es/standards-sdk.es84.js.map +1 -1
  382. package/dist/es/standards-sdk.es85.js +55 -275
  383. package/dist/es/standards-sdk.es85.js.map +1 -1
  384. package/dist/es/standards-sdk.es86.js +43 -55
  385. package/dist/es/standards-sdk.es86.js.map +1 -1
  386. package/dist/es/standards-sdk.es87.js +145 -22
  387. package/dist/es/standards-sdk.es87.js.map +1 -1
  388. package/dist/es/standards-sdk.es88.js +34 -47
  389. package/dist/es/standards-sdk.es88.js.map +1 -1
  390. package/dist/es/standards-sdk.es89.js +22 -57
  391. package/dist/es/standards-sdk.es89.js.map +1 -1
  392. package/dist/es/standards-sdk.es9.js +104 -80
  393. package/dist/es/standards-sdk.es9.js.map +1 -1
  394. package/dist/es/standards-sdk.es90.js +23 -28
  395. package/dist/es/standards-sdk.es90.js.map +1 -1
  396. package/dist/es/standards-sdk.es91.js +238 -23
  397. package/dist/es/standards-sdk.es91.js.map +1 -1
  398. package/dist/es/standards-sdk.es92.js +265 -152
  399. package/dist/es/standards-sdk.es92.js.map +1 -1
  400. package/dist/es/standards-sdk.es93.js +95 -68
  401. package/dist/es/standards-sdk.es93.js.map +1 -1
  402. package/dist/es/standards-sdk.es94.js +124 -136
  403. package/dist/es/standards-sdk.es94.js.map +1 -1
  404. package/dist/es/standards-sdk.es95.js +42 -138
  405. package/dist/es/standards-sdk.es95.js.map +1 -1
  406. package/dist/es/standards-sdk.es96.js +259 -42
  407. package/dist/es/standards-sdk.es96.js.map +1 -1
  408. package/dist/es/standards-sdk.es97.js +82 -243
  409. package/dist/es/standards-sdk.es97.js.map +1 -1
  410. package/dist/es/standards-sdk.es98.js +48 -47
  411. package/dist/es/standards-sdk.es98.js.map +1 -1
  412. package/dist/es/standards-sdk.es99.js +29 -100
  413. package/dist/es/standards-sdk.es99.js.map +1 -1
  414. package/dist/es/utils/crypto-abstraction.d.ts.map +1 -1
  415. package/dist/es/utils/crypto-env.d.ts.map +1 -1
  416. package/dist/es/utils/dynamic-import.d.ts +5 -1
  417. package/dist/es/utils/dynamic-import.d.ts.map +1 -1
  418. package/dist/es/utils/hash-adapter.d.ts.map +1 -1
  419. package/package.json +8 -7
  420. package/dist/cjs/patches/topic-autorenew-patch.d.ts +0 -2
  421. package/dist/cjs/patches/topic-autorenew-patch.d.ts.map +0 -1
  422. package/dist/es/patches/topic-autorenew-patch.d.ts +0 -2
  423. package/dist/es/patches/topic-autorenew-patch.d.ts.map +0 -1
@@ -1,176 +1,957 @@
1
- import { Logger } from "./standards-sdk.es106.js";
2
- class RedisCache {
3
- constructor(config = {}) {
4
- const {
5
- host = "localhost",
6
- port = 6379,
7
- password,
8
- db = 0,
9
- keyPrefix = "",
10
- tls = false,
11
- connectTimeout = 5e3,
12
- retryStrategy,
13
- logLevel = "info"
14
- } = config;
15
- this.prefix = keyPrefix;
1
+ import { Logger } from "./standards-sdk.es105.js";
2
+ import { Registration } from "./standards-sdk.es20.js";
3
+ import { HCS11Client } from "./standards-sdk.es27.js";
4
+ import { PublicKey } from "@hashgraph/sdk";
5
+ import { HederaMirrorNode } from "./standards-sdk.es126.js";
6
+ import "./standards-sdk.es127.js";
7
+ import "./standards-sdk.es128.js";
8
+ import "./standards-sdk.es129.js";
9
+ import "./standards-sdk.es130.js";
10
+ import "./standards-sdk.es131.js";
11
+ import "./standards-sdk.es132.js";
12
+ import "./standards-sdk.es133.js";
13
+ import "./standards-sdk.es134.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.es138.js";
20
+ import { buildHcs10SubmitConnectionRequestTx, buildHcs10OutboundConnectionRequestRecordTx, buildHcs10OutboundConnectionCreatedRecordTx } from "./standards-sdk.es22.js";
21
+ import { HRLResolver } from "./standards-sdk.es109.js";
22
+ var Hcs10MemoType = /* @__PURE__ */ ((Hcs10MemoType2) => {
23
+ Hcs10MemoType2["INBOUND"] = "inbound";
24
+ Hcs10MemoType2["OUTBOUND"] = "outbound";
25
+ Hcs10MemoType2["CONNECTION"] = "connection";
26
+ Hcs10MemoType2["REGISTRY"] = "registry";
27
+ return Hcs10MemoType2;
28
+ })(Hcs10MemoType || {});
29
+ class HCS10BaseClient extends Registration {
30
+ constructor(config) {
31
+ super();
32
+ this.network = config.network;
16
33
  this.logger = Logger.getInstance({
17
- level: logLevel,
18
- module: "RedisCache"
34
+ level: config.logLevel || "info",
35
+ module: "HCS10-BaseClient",
36
+ prettyPrint: config.prettyPrint,
37
+ silent: config.silent
19
38
  });
20
- this.client = createRedisClient(
39
+ this.mirrorNode = new HederaMirrorNode(
40
+ config.network,
21
41
  this.logger,
22
- {
23
- host,
24
- port,
25
- password,
26
- db,
27
- tls: tls ? {} : void 0,
28
- keyPrefix,
29
- connectTimeout,
30
- retryStrategy: retryStrategy || ((times) => {
31
- const delay = Math.min(times * 50, 2e3);
32
- return delay;
33
- }),
34
- maxRetriesPerRequest: 3
35
- }
42
+ config.mirrorNode
36
43
  );
44
+ this.feeAmount = config.feeAmount || 1e-3;
45
+ }
46
+ /**
47
+ * Updates the mirror node configuration.
48
+ * @param config The new mirror node configuration.
49
+ */
50
+ configureMirrorNode(config) {
51
+ this.mirrorNode.configureMirrorNode(config);
52
+ this.logger.info("Mirror node configuration updated");
53
+ }
54
+ extractTopicFromOperatorId(operatorId) {
55
+ if (!operatorId) {
56
+ return "";
57
+ }
58
+ const parts = operatorId.split("@");
59
+ if (parts.length > 0) {
60
+ return parts[0];
61
+ }
62
+ return "";
37
63
  }
38
- getKey(key) {
39
- return `${this.prefix}${key}`;
64
+ extractAccountFromOperatorId(operatorId) {
65
+ if (!operatorId) {
66
+ return "";
67
+ }
68
+ const parts = operatorId.split("@");
69
+ if (parts.length > 1) {
70
+ return parts[1];
71
+ }
72
+ return "";
40
73
  }
41
- async get(key) {
74
+ /**
75
+ * Get a stream of messages from a connection topic
76
+ * @param topicId The connection topic ID to get messages from
77
+ * @param options Optional filtering options for messages
78
+ * @returns A stream of filtered messages valid for connection topics
79
+ */
80
+ async getMessageStream(topicId, options) {
42
81
  try {
43
- const value = await this.client.get(this.getKey(key));
44
- return value || void 0;
82
+ const messages = await this.mirrorNode.getTopicMessages(topicId, options);
83
+ const validOps = ["message", "close_connection", "transaction"];
84
+ const filteredMessages = messages.filter((msg) => {
85
+ if (msg.p !== "hcs-10" || !validOps.includes(msg.op)) {
86
+ return false;
87
+ }
88
+ if (msg.op === "message" || msg.op === "close_connection") {
89
+ if (!msg.operator_id) {
90
+ return false;
91
+ }
92
+ if (!this.isValidOperatorId(msg.operator_id)) {
93
+ return false;
94
+ }
95
+ if (msg.op === "message" && !msg.data) {
96
+ return false;
97
+ }
98
+ }
99
+ if (msg.op === "transaction") {
100
+ if (!msg.operator_id || !msg.schedule_id) {
101
+ return false;
102
+ }
103
+ if (!this.isValidOperatorId(msg.operator_id)) {
104
+ return false;
105
+ }
106
+ }
107
+ return true;
108
+ });
109
+ return {
110
+ messages: filteredMessages
111
+ };
45
112
  } catch (error) {
46
- this.logger.error("Redis get error:", error);
47
- throw error;
113
+ if (this.logger) {
114
+ this.logger.error(`Error fetching messages: ${error.message}`);
115
+ }
116
+ return { messages: [] };
117
+ }
118
+ }
119
+ /**
120
+ * Public method to retrieve topic information using the internal mirror node client.
121
+ *
122
+ * @param topicId The ID of the topic to query.
123
+ * @returns Topic information or null if not found or an error occurs.
124
+ */
125
+ async getPublicTopicInfo(topicId) {
126
+ try {
127
+ return await this.mirrorNode.getTopicInfo(topicId);
128
+ } catch (error) {
129
+ this.logger.error(
130
+ `Error getting public topic info for ${topicId}:`,
131
+ error
132
+ );
133
+ return null;
48
134
  }
49
135
  }
50
- async set(key, value, ttlSeconds) {
136
+ /**
137
+ * Checks if a user can submit to a topic and determines if a fee is required
138
+ * @param topicId The topic ID to check
139
+ * @param userAccountId The account ID of the user attempting to submit
140
+ * @returns Object with canSubmit, requiresFee, and optional reason
141
+ */
142
+ async canSubmitToTopic(topicId, userAccountId) {
51
143
  try {
52
- const fullKey = this.getKey(key);
53
- if (ttlSeconds) {
54
- await this.client.setex(fullKey, ttlSeconds, value);
55
- } else {
56
- await this.client.set(fullKey, value);
144
+ const topicInfo = await this.mirrorNode.getTopicInfo(topicId);
145
+ if (!topicInfo) {
146
+ return {
147
+ canSubmit: false,
148
+ requiresFee: false,
149
+ reason: "Topic does not exist"
150
+ };
151
+ }
152
+ if (!topicInfo.submit_key?.key) {
153
+ return { canSubmit: true, requiresFee: false };
154
+ }
155
+ try {
156
+ const userPublicKey = await this.mirrorNode.getPublicKey(userAccountId);
157
+ if (topicInfo.submit_key._type === "ProtobufEncoded") {
158
+ const keyBytes = Buffer.from(topicInfo.submit_key.key, "hex");
159
+ const hasAccess = await this.mirrorNode.checkKeyListAccess(
160
+ keyBytes,
161
+ userPublicKey
162
+ );
163
+ if (hasAccess) {
164
+ return { canSubmit: true, requiresFee: false };
165
+ }
166
+ } else {
167
+ const topicSubmitKey = PublicKey.fromString(topicInfo.submit_key.key);
168
+ if (userPublicKey.toString() === topicSubmitKey.toString()) {
169
+ return { canSubmit: true, requiresFee: false };
170
+ }
171
+ }
172
+ } catch (error) {
173
+ this.logger.error(
174
+ `Key validation error: ${error instanceof Error ? error.message : String(error)}`
175
+ );
57
176
  }
177
+ if (topicInfo.fee_schedule_key?.key && topicInfo.custom_fees?.fixed_fees?.length > 0) {
178
+ return {
179
+ canSubmit: true,
180
+ requiresFee: true,
181
+ reason: "Requires fee payment via HIP-991"
182
+ };
183
+ }
184
+ return {
185
+ canSubmit: false,
186
+ requiresFee: false,
187
+ reason: "User does not have submit permission for this topic"
188
+ };
58
189
  } catch (error) {
59
- this.logger.error("Redis set error:", error);
60
- throw error;
190
+ const errorMessage = error instanceof Error ? error.message : String(error);
191
+ this.logger.error(`Topic submission validation error: ${errorMessage}`);
192
+ return {
193
+ canSubmit: false,
194
+ requiresFee: false,
195
+ reason: `Error: ${errorMessage}`
196
+ };
61
197
  }
62
198
  }
63
- async delete(key) {
199
+ /**
200
+ * Get all messages from a topic
201
+ * @param topicId The topic ID to get messages from
202
+ * @param options Optional filtering options for messages
203
+ * @returns All messages from the topic
204
+ */
205
+ async getMessages(topicId, options) {
64
206
  try {
65
- await this.client.del(this.getKey(key));
207
+ const messages = await this.mirrorNode.getTopicMessages(topicId, options);
208
+ const validatedMessages = messages.filter((msg) => {
209
+ if (msg.p !== "hcs-10") {
210
+ return false;
211
+ }
212
+ if (msg.op === "message") {
213
+ if (!msg.data) {
214
+ return false;
215
+ }
216
+ if (msg.operator_id) {
217
+ if (!this.isValidOperatorId(msg.operator_id)) {
218
+ return false;
219
+ }
220
+ }
221
+ }
222
+ return true;
223
+ });
224
+ return {
225
+ messages: validatedMessages
226
+ };
66
227
  } catch (error) {
67
- this.logger.error("Redis delete error:", error);
68
- throw error;
228
+ if (this.logger) {
229
+ this.logger.error(`Error fetching messages: ${error.message}`);
230
+ }
231
+ return { messages: [] };
69
232
  }
70
233
  }
71
- async clear() {
234
+ /**
235
+ * Requests an account from the mirror node
236
+ * @param account The account ID to request
237
+ * @returns The account response
238
+ */
239
+ async requestAccount(account) {
72
240
  try {
73
- const keys = await this.client.keys(`${this.prefix}*`);
74
- if (keys.length > 0) {
75
- await this.client.del(...keys);
241
+ if (!account) {
242
+ throw new Error("Account ID is required");
76
243
  }
77
- } catch (error) {
78
- this.logger.error("Redis clear error:", error);
244
+ return await this.mirrorNode.requestAccount(account);
245
+ } catch (e) {
246
+ this.logger.error("Failed to fetch account", e);
247
+ throw e;
248
+ }
249
+ }
250
+ /**
251
+ * Retrieves the memo for an account
252
+ * @param accountId The account ID to retrieve the memo for
253
+ * @returns The memo
254
+ */
255
+ async getAccountMemo(accountId) {
256
+ return await this.mirrorNode.getAccountMemo(accountId);
257
+ }
258
+ /**
259
+ * Retrieves the profile for an account
260
+ * @param accountId The account ID to retrieve the profile for
261
+ * @param disableCache Whether to disable caching of the result
262
+ * @param retryOptions Optional retry configuration
263
+ * @returns The profile
264
+ */
265
+ async retrieveProfile(accountId, disableCache, retryOptions) {
266
+ const maxRetries = retryOptions?.maxRetries ?? 0;
267
+ const retryDelay = retryOptions?.retryDelay ?? 3e3;
268
+ let retryCount = 0;
269
+ while (retryCount <= maxRetries) {
270
+ this.logger.debug(
271
+ `Retrieving profile for account: ${accountId}${retryCount > 0 ? ` (attempt ${retryCount + 1}/${maxRetries + 1})` : ""}`
272
+ );
273
+ const cacheKey = `${accountId}-${this.network}`;
274
+ if (!disableCache && retryCount === 0) {
275
+ const cachedProfileResponse = HCS10Cache.getInstance().get(cacheKey);
276
+ if (cachedProfileResponse) {
277
+ this.logger.debug(`Cache hit for profile: ${accountId}`);
278
+ return cachedProfileResponse;
279
+ }
280
+ }
281
+ try {
282
+ const hcs11Client = new HCS11Client({
283
+ network: this.network,
284
+ auth: {
285
+ operatorId: "0.0.0"
286
+ },
287
+ logLevel: this.logger.getLevel()
288
+ });
289
+ const profileResult = await hcs11Client.fetchProfileByAccountId(
290
+ accountId,
291
+ this.network
292
+ );
293
+ if (!profileResult?.success) {
294
+ if (retryCount < maxRetries) {
295
+ this.logger.info(
296
+ `Profile not found for account ${accountId}, retrying in ${retryDelay}ms... (${profileResult?.error})`
297
+ );
298
+ retryCount++;
299
+ await new Promise((resolve) => setTimeout(resolve, retryDelay));
300
+ continue;
301
+ }
302
+ this.logger.error(
303
+ `Failed to retrieve profile for account ID: ${accountId}`,
304
+ profileResult?.error
305
+ );
306
+ return {
307
+ profile: null,
308
+ success: false,
309
+ error: profileResult?.error || `Failed to retrieve profile for account ID: ${accountId}`
310
+ };
311
+ }
312
+ const profile = profileResult?.profile;
313
+ let topicInfo = null;
314
+ const inboundTopic = profileResult?.topicInfo?.inboundTopic || profile?.inboundTopicId || "";
315
+ const outboundTopic = profileResult?.topicInfo?.outboundTopic || profile?.outboundTopicId || "";
316
+ const profileTopicId = profileResult?.topicInfo?.profileTopicId || "";
317
+ if (inboundTopic && outboundTopic) {
318
+ topicInfo = {
319
+ inboundTopic,
320
+ outboundTopic,
321
+ profileTopicId
322
+ };
323
+ }
324
+ const responseToCache = {
325
+ profile,
326
+ topicInfo,
327
+ success: true
328
+ };
329
+ HCS10Cache.getInstance().set(cacheKey, responseToCache);
330
+ return responseToCache;
331
+ } catch (e) {
332
+ if (retryCount < maxRetries) {
333
+ this.logger.info(
334
+ `Error retrieving profile for account ${accountId}, retrying in ${retryDelay}ms... (${e.message})`
335
+ );
336
+ retryCount++;
337
+ await new Promise((resolve) => setTimeout(resolve, retryDelay));
338
+ continue;
339
+ }
340
+ const error = e;
341
+ const logMessage = `Failed to retrieve profile: ${error.message}`;
342
+ this.logger.error(logMessage);
343
+ return {
344
+ profile: null,
345
+ success: false,
346
+ error: logMessage
347
+ };
348
+ }
349
+ }
350
+ return {
351
+ profile: null,
352
+ success: false,
353
+ error: "Unexpected error in profile retrieval"
354
+ };
355
+ }
356
+ /**
357
+ * @deprecated Use retrieveCommunicationTopics instead
358
+ * @param accountId The account ID to retrieve the outbound connect topic for
359
+ * @returns {TopicInfo} Topic Info from target profile.
360
+ */
361
+ async retrieveOutboundConnectTopic(accountId) {
362
+ return await this.retrieveCommunicationTopics(accountId, true);
363
+ }
364
+ /**
365
+ * Retrieves the communication topics for an account
366
+ * @param accountId The account ID to retrieve the communication topics for
367
+ * @param disableCache Whether to disable caching of the result
368
+ * @param retryOptions Optional retry configuration
369
+ * @returns {TopicInfo} Topic Info from target profile.
370
+ */
371
+ async retrieveCommunicationTopics(accountId, disableCache, retryOptions) {
372
+ try {
373
+ const profileResponse = await this.retrieveProfile(
374
+ accountId,
375
+ disableCache,
376
+ retryOptions
377
+ );
378
+ if (!profileResponse?.success) {
379
+ throw new Error(profileResponse.error || "Failed to retrieve profile");
380
+ }
381
+ const profile = profileResponse.profile;
382
+ if (!profile) {
383
+ throw new Error(
384
+ `Profile is null or undefined for account ${accountId}`
385
+ );
386
+ }
387
+ if (!profile.inboundTopicId || !profile.outboundTopicId) {
388
+ throw new Error(
389
+ `Invalid HCS-11 profile for HCS-10 agent: missing inboundTopicId or outboundTopicId`
390
+ );
391
+ }
392
+ if (!profileResponse.topicInfo) {
393
+ throw new Error(
394
+ `TopicInfo is missing in the profile for account ${accountId}`
395
+ );
396
+ }
397
+ return profileResponse.topicInfo;
398
+ } catch (e) {
399
+ const error = e;
400
+ const logMessage = `Failed to retrieve topic info: ${error.message}`;
401
+ this.logger.error(logMessage);
79
402
  throw error;
80
403
  }
81
404
  }
82
- async disconnect() {
83
- await this.client.quit();
405
+ /**
406
+ * Retrieves outbound messages for an agent
407
+ * @param agentAccountId The account ID of the agent
408
+ * @param options Optional filtering options for messages
409
+ * @returns The outbound messages
410
+ */
411
+ async retrieveOutboundMessages(agentAccountId, options) {
412
+ try {
413
+ const topicInfo = await this.retrieveCommunicationTopics(agentAccountId);
414
+ if (!topicInfo) {
415
+ this.logger.warn(
416
+ `No outbound connect topic found for agentAccountId: ${agentAccountId}`
417
+ );
418
+ return [];
419
+ }
420
+ const response = await this.getMessages(topicInfo.outboundTopic, options);
421
+ return response.messages.filter(
422
+ (msg) => msg.p === "hcs-10" && (msg.op === "connection_request" || msg.op === "connection_created" || msg.op === "message")
423
+ );
424
+ } catch (e) {
425
+ const error = e;
426
+ const logMessage = `Failed to retrieve outbound messages: ${error.message}`;
427
+ this.logger.error(logMessage);
428
+ return [];
429
+ }
430
+ }
431
+ /**
432
+ * Checks if a connection has been created for an agent
433
+ * @param agentAccountId The account ID of the agent
434
+ * @param connectionId The ID of the connection
435
+ * @returns True if the connection has been created, false otherwise
436
+ */
437
+ async hasConnectionCreated(agentAccountId, connectionId) {
438
+ try {
439
+ const outBoundTopic = await this.retrieveCommunicationTopics(agentAccountId);
440
+ const messages = await this.retrieveOutboundMessages(
441
+ outBoundTopic.outboundTopic
442
+ );
443
+ return messages.some(
444
+ (msg) => msg.op === "connection_created" && msg.connection_id === connectionId
445
+ );
446
+ } catch (e) {
447
+ const error = e;
448
+ const logMessage = `Failed to check connection created: ${error.message}`;
449
+ this.logger.error(logMessage);
450
+ return false;
451
+ }
84
452
  }
85
- setLogLevel(level) {
86
- this.logger.setLogLevel(level);
453
+ /**
454
+ * Gets message content, resolving any HRL references if needed
455
+ * @param data The data string that may contain an HRL reference
456
+ * @param forceRaw Whether to force returning raw binary data
457
+ * @returns The resolved content
458
+ */
459
+ async getMessageContent(data, forceRaw = false) {
460
+ if (!data.match(/^hcs:\/\/(\d+)\/([0-9]+\.[0-9]+\.[0-9]+)$/)) {
461
+ return data;
462
+ }
463
+ try {
464
+ const resolver = new HRLResolver(this.logger.getLevel());
465
+ if (!resolver.isValidHRL(data)) {
466
+ return data;
467
+ }
468
+ const result = await resolver.resolveHRL(data, {
469
+ network: this.network,
470
+ returnRaw: forceRaw
471
+ });
472
+ return result.content;
473
+ } catch (e) {
474
+ const error = e;
475
+ const logMessage = `Error resolving HRL reference: ${error.message}`;
476
+ this.logger.error(logMessage);
477
+ throw new Error(logMessage);
478
+ }
87
479
  }
88
- }
89
- function createRedisClient(logger, options, logConnectEvents) {
90
- const Redis = getRedisConstructor();
91
- if (!Redis) {
92
- logger.warn(
93
- "ioredis is not installed; RedisCache will use an in-memory cache instead"
480
+ /**
481
+ * Gets message content with its content type, resolving any HRL references if needed
482
+ * @param data The data string that may contain an HRL reference
483
+ * @param forceRaw Whether to force returning raw binary data
484
+ * @returns The resolved content along with content type information
485
+ */
486
+ async getMessageContentWithType(data, forceRaw = false) {
487
+ if (!data.match(/^hcs:\/\/(\d+)\/([0-9]+\.[0-9]+\.[0-9]+)$/)) {
488
+ return {
489
+ content: data,
490
+ contentType: "text/plain",
491
+ isBinary: false
492
+ };
493
+ }
494
+ try {
495
+ const resolver = new HRLResolver(this.logger.getLevel());
496
+ return await resolver.getContentWithType(data, {
497
+ network: this.network,
498
+ returnRaw: forceRaw
499
+ });
500
+ } catch (e) {
501
+ const error = e;
502
+ const logMessage = `Error resolving HRL reference with type: ${error.message}`;
503
+ this.logger.error(logMessage);
504
+ throw new Error(logMessage);
505
+ }
506
+ }
507
+ /**
508
+ * Submits a connection request to an inbound topic
509
+ * @param inboundTopicId The ID of the inbound topic
510
+ * @param memo An optional memo for the message
511
+ * @returns The transaction receipt
512
+ */
513
+ async submitConnectionRequest(inboundTopicId, memo) {
514
+ const accountResponse = this.getAccountAndSigner();
515
+ if (!accountResponse?.accountId) {
516
+ throw new Error("Operator account ID is not set");
517
+ }
518
+ const operatorId = await this.getOperatorId();
519
+ const accountId = accountResponse.accountId;
520
+ const submissionCheck = await this.canSubmitToTopic(
521
+ inboundTopicId,
522
+ accountId
94
523
  );
95
- return createInMemoryRedisClient();
96
- }
97
- const client = new Redis({
98
- host: options.host,
99
- port: options.port,
100
- password: options.password,
101
- db: options.db,
102
- tls: options.tls,
103
- keyPrefix: options.keyPrefix,
104
- connectTimeout: options.connectTimeout,
105
- retryStrategy: options.retryStrategy,
106
- maxRetriesPerRequest: options.maxRetriesPerRequest
107
- });
108
- {
109
- client.on("error", (error) => {
110
- logger.error("Redis connection error:", error);
524
+ if (!submissionCheck?.canSubmit) {
525
+ throw new Error(`Cannot submit to topic: ${submissionCheck.reason}`);
526
+ }
527
+ const inboundAccountOwner = await this.retrieveInboundAccountId(inboundTopicId);
528
+ if (!inboundAccountOwner) {
529
+ throw new Error("Failed to retrieve topic info account ID");
530
+ }
531
+ const requiresFee = submissionCheck.requiresFee;
532
+ const connectionRequestTx = buildHcs10SubmitConnectionRequestTx({
533
+ inboundTopicId,
534
+ operatorId,
535
+ memo
536
+ });
537
+ const response = await this.submitPayload(
538
+ connectionRequestTx,
539
+ void 0,
540
+ void 0,
541
+ requiresFee
542
+ );
543
+ this.logger.info(
544
+ `Submitted connection request to topic ID: ${inboundTopicId}`
545
+ );
546
+ const outboundTopic = await this.retrieveCommunicationTopics(accountId);
547
+ if (!outboundTopic) {
548
+ throw new Error("Failed to retrieve outbound topic");
549
+ }
550
+ const responseSequenceNumber = response.topicSequenceNumber?.toNumber();
551
+ if (!responseSequenceNumber) {
552
+ throw new Error("Failed to get response sequence number");
553
+ }
554
+ const requestorOperatorId = `${inboundTopicId}@${inboundAccountOwner}`;
555
+ const outboundRecordTx = buildHcs10OutboundConnectionRequestRecordTx({
556
+ outboundTopicId: outboundTopic.outboundTopic,
557
+ operatorId: requestorOperatorId,
558
+ connectionRequestId: responseSequenceNumber,
559
+ memo
111
560
  });
112
- client.on("connect", () => {
113
- logger.debug("Redis connected");
561
+ await this.submitPayload(outboundRecordTx);
562
+ return response;
563
+ }
564
+ /**
565
+ * Records an outbound connection confirmation
566
+ * @param outboundTopicId The ID of the outbound topic
567
+ * @param connectionRequestId The ID of the connection request
568
+ * @param confirmedRequestId The ID of the confirmed request
569
+ * @param connectionTopicId The ID of the connection topic
570
+ * @param operatorId The operator ID of the original message sender.
571
+ * @param memo An optional memo for the message
572
+ */
573
+ async recordOutboundConnectionConfirmation({
574
+ outboundTopicId,
575
+ requestorOutboundTopicId,
576
+ connectionRequestId,
577
+ confirmedRequestId,
578
+ connectionTopicId,
579
+ operatorId,
580
+ memo
581
+ }) {
582
+ const transaction = buildHcs10OutboundConnectionCreatedRecordTx({
583
+ outboundTopicId,
584
+ requestorOutboundTopicId,
585
+ connectionTopicId,
586
+ confirmedRequestId,
587
+ connectionRequestId,
588
+ operatorId,
589
+ memo
114
590
  });
591
+ return await this.submitPayload(transaction);
115
592
  }
116
- return client;
117
- }
118
- function getRedisConstructor() {
119
- if (typeof require !== "function") {
120
- return null;
593
+ /**
594
+ * Waits for confirmation of a connection request
595
+ * @param inboundTopicId Inbound topic ID
596
+ * @param connectionRequestId Connection request ID
597
+ * @param maxAttempts Maximum number of attempts
598
+ * @param delayMs Delay between attempts in milliseconds
599
+ * @returns Connection confirmation details
600
+ */
601
+ async waitForConnectionConfirmation(inboundTopicId, connectionRequestId, maxAttempts = 60, delayMs = 2e3, recordConfirmation = true) {
602
+ this.logger.info(
603
+ `Waiting for connection confirmation on inbound topic ${inboundTopicId} for request ID ${connectionRequestId}`
604
+ );
605
+ for (let attempt = 0; attempt < maxAttempts; attempt++) {
606
+ this.logger.info(
607
+ `Attempt ${attempt + 1}/${maxAttempts} to find connection confirmation`
608
+ );
609
+ const messages = await this.mirrorNode.getTopicMessages(inboundTopicId, {
610
+ order: "desc",
611
+ limit: 100
612
+ });
613
+ const connectionCreatedMessages = messages.filter(
614
+ (m) => m.op === "connection_created"
615
+ );
616
+ this.logger.info(
617
+ `Found ${connectionCreatedMessages.length} connection_created messages`
618
+ );
619
+ if (connectionCreatedMessages.length > 0) {
620
+ for (const message of connectionCreatedMessages) {
621
+ if (Number(message.connection_id) === Number(connectionRequestId)) {
622
+ const confirmationResult = {
623
+ connectionTopicId: message.connection_topic_id,
624
+ sequence_number: Number(message.sequence_number),
625
+ confirmedBy: message.operator_id,
626
+ memo: message.m
627
+ };
628
+ const confirmedByAccountId = this.extractAccountFromOperatorId(
629
+ confirmationResult.confirmedBy
630
+ );
631
+ const account = this.getAccountAndSigner();
632
+ const confirmedByConnectionTopics = await this.retrieveCommunicationTopics(confirmedByAccountId);
633
+ const agentConnectionTopics = await this.retrieveCommunicationTopics(account.accountId);
634
+ this.logger.info(
635
+ "Connection confirmation found",
636
+ confirmationResult
637
+ );
638
+ if (recordConfirmation) {
639
+ await this.recordOutboundConnectionConfirmation({
640
+ requestorOutboundTopicId: confirmedByConnectionTopics.outboundTopic,
641
+ outboundTopicId: agentConnectionTopics.outboundTopic,
642
+ connectionRequestId,
643
+ confirmedRequestId: confirmationResult.sequence_number,
644
+ connectionTopicId: confirmationResult.connectionTopicId,
645
+ operatorId: confirmationResult.confirmedBy,
646
+ memo: confirmationResult.memo || "Connection confirmed"
647
+ });
648
+ }
649
+ return confirmationResult;
650
+ }
651
+ }
652
+ }
653
+ if (attempt < maxAttempts - 1) {
654
+ this.logger.info(
655
+ `No matching confirmation found, waiting ${delayMs}ms before retrying...`
656
+ );
657
+ await new Promise((resolve) => setTimeout(resolve, delayMs));
658
+ }
659
+ }
660
+ throw new Error(
661
+ `Connection confirmation not found after ${maxAttempts} attempts for request ID ${connectionRequestId}`
662
+ );
663
+ }
664
+ /**
665
+ * Retrieves the operator ID for the current agent
666
+ * @param disableCache Whether to disable caching of the result
667
+ * @returns The operator ID
668
+ */
669
+ async getOperatorId(disableCache) {
670
+ if (this.operatorId && !disableCache) {
671
+ return this.operatorId;
672
+ }
673
+ const accountResponse = this.getAccountAndSigner();
674
+ if (!accountResponse?.accountId) {
675
+ throw new Error("Operator ID not found");
676
+ }
677
+ const profile = await this.retrieveProfile(accountResponse.accountId);
678
+ if (!profile?.success) {
679
+ throw new Error("Failed to retrieve profile");
680
+ }
681
+ if (!profile?.topicInfo?.inboundTopic) {
682
+ throw new Error("Failed to retrieve inbound topic");
683
+ }
684
+ const operatorId = `${profile.topicInfo?.inboundTopic}@${accountResponse.accountId}`;
685
+ this.operatorId = operatorId;
686
+ return operatorId;
121
687
  }
122
- try {
123
- const loaded = require("ioredis");
124
- if (typeof loaded === "function") {
125
- return loaded;
688
+ /**
689
+ * Retrieves the account ID of the owner of an inbound topic
690
+ * @param inboundTopicId The ID of the inbound topic
691
+ * @returns The account ID of the owner of the inbound topic
692
+ */
693
+ async retrieveInboundAccountId(inboundTopicId) {
694
+ const topicInfo = await this.mirrorNode.getTopicInfo(inboundTopicId);
695
+ if (!topicInfo?.memo) {
696
+ throw new Error("Failed to retrieve topic info");
126
697
  }
127
- if (typeof loaded.default === "function") {
128
- return loaded.default;
698
+ const topicInfoMemo = topicInfo.memo.toString();
699
+ const topicInfoParts = topicInfoMemo.split(":");
700
+ const inboundAccountOwner = topicInfoParts?.[4];
701
+ if (!inboundAccountOwner) {
702
+ throw new Error("Failed to retrieve topic info account ID");
129
703
  }
130
- } catch {
131
- return null;
704
+ return inboundAccountOwner;
132
705
  }
133
- return null;
134
- }
135
- function createInMemoryRedisClient() {
136
- const store = /* @__PURE__ */ new Map();
137
- return {
138
- async get(key) {
139
- return store.get(key) ?? null;
140
- },
141
- async set(key, value) {
142
- store.set(key, value);
143
- return "OK";
144
- },
145
- async setex(key, _seconds, value) {
146
- store.set(key, value);
147
- return "OK";
148
- },
149
- async del(...keys) {
150
- let deleted = 0;
151
- for (const key of keys) {
152
- if (store.delete(key)) {
153
- deleted += 1;
706
+ clearCache() {
707
+ HCS10Cache.getInstance().clear();
708
+ }
709
+ /**
710
+ * Generates a standard HCS-10 memo string.
711
+ * @param type The type of topic memo ('inbound', 'outbound', 'connection').
712
+ * @param options Configuration options for the memo.
713
+ * @returns The formatted memo string.
714
+ * @protected
715
+ */
716
+ _generateHcs10Memo(type, options) {
717
+ const ttl = options.ttl ?? 60;
718
+ switch (type) {
719
+ case "inbound":
720
+ if (!options.accountId) {
721
+ throw new Error("accountId is required for inbound memo");
154
722
  }
723
+ return `hcs-10:0:${ttl}:0:${options.accountId}`;
724
+ case "outbound":
725
+ return `hcs-10:0:${ttl}:1`;
726
+ case "connection":
727
+ if (!options.inboundTopicId || options.connectionId === void 0) {
728
+ throw new Error(
729
+ "inboundTopicId and connectionId are required for connection memo"
730
+ );
731
+ }
732
+ return `hcs-10:1:${ttl}:2:${options.inboundTopicId}:${options.connectionId}`;
733
+ default:
734
+ throw new Error(`Invalid HCS-10 memo type: ${type}`);
735
+ }
736
+ }
737
+ /**
738
+ * Reads a topic's memo and determines its HCS-10 type
739
+ * @param topicId The topic ID to check
740
+ * @returns The HCS-10 memo type or null if not an HCS-10 topic
741
+ */
742
+ async getTopicMemoType(topicId) {
743
+ try {
744
+ const topicInfo = await this.mirrorNode.getTopicInfo(topicId);
745
+ if (!topicInfo?.memo) {
746
+ this.logger.debug(`No memo found for topic ${topicId}`);
747
+ return null;
748
+ }
749
+ const memo = topicInfo.memo.toString();
750
+ if (!memo.startsWith("hcs-10:")) {
751
+ this.logger.debug(`Topic ${topicId} is not an HCS-10 topic`);
752
+ return null;
753
+ }
754
+ const parts = memo.split(":");
755
+ if (parts.length < 4) {
756
+ this.logger.warn(
757
+ `Invalid HCS-10 memo format for topic ${topicId}: ${memo}`
758
+ );
759
+ return null;
155
760
  }
156
- return deleted;
157
- },
158
- async keys(pattern) {
159
- if (pattern.endsWith("*")) {
160
- const prefix = pattern.slice(0, -1);
161
- return Array.from(store.keys()).filter((key) => key.startsWith(prefix));
162
- }
163
- return store.has(pattern) ? [pattern] : [];
164
- },
165
- async quit() {
166
- store.clear();
167
- },
168
- on() {
169
- return;
170
- }
171
- };
761
+ const typeEnum = parts[3];
762
+ switch (typeEnum) {
763
+ case "0":
764
+ return "inbound";
765
+ case "1":
766
+ return "outbound";
767
+ case "2":
768
+ return "connection";
769
+ case "3":
770
+ return "registry";
771
+ default:
772
+ this.logger.warn(
773
+ `Unknown HCS-10 type enum: ${typeEnum} for topic ${topicId}`
774
+ );
775
+ return null;
776
+ }
777
+ } catch (error) {
778
+ this.logger.error(`Error getting topic memo type for ${topicId}:`, error);
779
+ return null;
780
+ }
781
+ }
782
+ async checkRegistrationStatus(transactionId, network, baseUrl) {
783
+ try {
784
+ const response = await fetch(`${baseUrl}/api/request-confirm`, {
785
+ method: "POST",
786
+ headers: {
787
+ "Content-Type": "application/json",
788
+ "X-Network": network
789
+ },
790
+ body: JSON.stringify({ transaction_id: transactionId })
791
+ });
792
+ if (!response.ok) {
793
+ throw new Error(
794
+ `Failed to confirm registration: ${response.statusText}`
795
+ );
796
+ }
797
+ return await response.json();
798
+ } catch (e) {
799
+ const error = e;
800
+ const logMessage = `Error checking registration status: ${error.message}`;
801
+ this.logger.error(logMessage);
802
+ throw error;
803
+ }
804
+ }
805
+ /**
806
+ * Validates if an operator_id follows the correct format (agentTopicId@accountId)
807
+ * @param operatorId The operator ID to validate
808
+ * @returns True if the format is valid, false otherwise
809
+ */
810
+ isValidOperatorId(operatorId) {
811
+ if (!operatorId) {
812
+ return false;
813
+ }
814
+ const parts = operatorId.split("@");
815
+ if (parts.length !== 2) {
816
+ return false;
817
+ }
818
+ const agentTopicId = parts[0];
819
+ const accountId = parts[1];
820
+ if (!agentTopicId) {
821
+ return false;
822
+ }
823
+ if (!accountId) {
824
+ return false;
825
+ }
826
+ const hederaIdPattern = /^[0-9]+\.[0-9]+\.[0-9]+$/;
827
+ if (!hederaIdPattern.test(accountId)) {
828
+ return false;
829
+ }
830
+ if (!hederaIdPattern.test(agentTopicId)) {
831
+ return false;
832
+ }
833
+ return true;
834
+ }
835
+ /**
836
+ * Retrieves all transaction requests from a topic
837
+ * @param topicId The topic ID to retrieve transactions from
838
+ * @param options Optional filtering and retrieval options
839
+ * @returns Array of transaction requests sorted by timestamp (newest first)
840
+ */
841
+ async getTransactionRequests(topicId, options) {
842
+ this.logger.debug(`Retrieving transaction requests from topic ${topicId}`);
843
+ const { messages } = await this.getMessageStream(topicId, {
844
+ limit: options?.limit,
845
+ sequenceNumber: options?.sequenceNumber,
846
+ order: options?.order || "desc"
847
+ });
848
+ const transactOperations = messages.filter((m) => m.op === "transaction" && m.schedule_id).map((m) => ({
849
+ operator_id: m.operator_id || "",
850
+ schedule_id: m.schedule_id || "",
851
+ data: m.data || "",
852
+ memo: m.m,
853
+ sequence_number: Number(m.sequence_number)
854
+ })).sort((a, b) => {
855
+ if (a.sequence_number && b.sequence_number) {
856
+ return b.sequence_number - a.sequence_number;
857
+ }
858
+ return 0;
859
+ });
860
+ const result = options?.limit ? transactOperations.slice(0, options.limit) : transactOperations;
861
+ return result;
862
+ }
863
+ /**
864
+ * Gets the HCS-10 transaction memo for analytics based on the operation type
865
+ * @param payload The operation payload
866
+ * @returns The transaction memo in format hcs-10:op:{operation_enum}:{topic_type_enum}
867
+ */
868
+ getHcs10TransactionMemo(payload) {
869
+ if (typeof payload !== "object" || !("op" in payload)) {
870
+ return null;
871
+ }
872
+ const typedPayload = payload;
873
+ const operation = typedPayload.op;
874
+ let operationEnum;
875
+ let topicTypeEnum;
876
+ switch (operation) {
877
+ case "register":
878
+ operationEnum = "0";
879
+ topicTypeEnum = "0";
880
+ break;
881
+ case "delete":
882
+ operationEnum = "1";
883
+ topicTypeEnum = "0";
884
+ break;
885
+ case "migrate":
886
+ operationEnum = "2";
887
+ topicTypeEnum = "0";
888
+ break;
889
+ case "connection_request":
890
+ operationEnum = "3";
891
+ topicTypeEnum = typedPayload.outbound_topic_id ? "2" : "1";
892
+ break;
893
+ case "connection_created":
894
+ operationEnum = "4";
895
+ topicTypeEnum = typedPayload.outbound_topic_id ? "2" : "1";
896
+ break;
897
+ case "connection_closed":
898
+ operationEnum = "5";
899
+ topicTypeEnum = typedPayload.outbound_topic_id ? "2" : "3";
900
+ break;
901
+ case "message":
902
+ operationEnum = "6";
903
+ topicTypeEnum = "3";
904
+ break;
905
+ case "close_connection":
906
+ operationEnum = "5";
907
+ topicTypeEnum = "3";
908
+ break;
909
+ case "transaction":
910
+ operationEnum = "6";
911
+ topicTypeEnum = "3";
912
+ break;
913
+ default:
914
+ operationEnum = "6";
915
+ topicTypeEnum = "3";
916
+ }
917
+ return `hcs-10:op:${operationEnum}:${topicTypeEnum}`;
918
+ }
919
+ }
920
+ class HCS10Cache {
921
+ constructor() {
922
+ this.CACHE_TTL = 36e5;
923
+ this.cache = /* @__PURE__ */ new Map();
924
+ this.cacheExpiry = /* @__PURE__ */ new Map();
925
+ }
926
+ static getInstance() {
927
+ if (!HCS10Cache.instance) {
928
+ HCS10Cache.instance = new HCS10Cache();
929
+ }
930
+ return HCS10Cache.instance;
931
+ }
932
+ set(key, value) {
933
+ this.cache.set(key, value);
934
+ this.cacheExpiry.set(key, Date.now() + this.CACHE_TTL);
935
+ }
936
+ get(key) {
937
+ const expiry = this.cacheExpiry.get(key);
938
+ if (expiry && expiry > Date.now()) {
939
+ return this.cache.get(key);
940
+ }
941
+ if (expiry) {
942
+ this.cache.delete(key);
943
+ this.cacheExpiry.delete(key);
944
+ }
945
+ return void 0;
946
+ }
947
+ clear() {
948
+ this.cache.clear();
949
+ this.cacheExpiry.clear();
950
+ }
172
951
  }
173
952
  export {
174
- RedisCache
953
+ HCS10BaseClient,
954
+ HCS10Cache,
955
+ Hcs10MemoType
175
956
  };
176
957
  //# sourceMappingURL=standards-sdk.es16.js.map