@hashgraphonline/standards-sdk 0.1.144 → 0.1.146-chore-jsr-improvements.canary.74bacb9.89

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