@hashgraphonline/standards-sdk 0.1.141 → 0.1.143-feat-adapter-registry.canary.fb173dc.54

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 (350) hide show
  1. package/README.md +24 -1
  2. package/dist/cjs/hcs-11/client.d.ts.map +1 -1
  3. package/dist/cjs/hcs-11/types.d.ts +1 -0
  4. package/dist/cjs/hcs-11/types.d.ts.map +1 -1
  5. package/dist/cjs/hcs-12/validation/schemas.d.ts +8 -8
  6. package/dist/cjs/hcs-16/base-client.d.ts.map +1 -1
  7. package/dist/cjs/hcs-17/types.d.ts.map +1 -1
  8. package/dist/cjs/hcs-20/sdk.d.ts.map +1 -1
  9. package/dist/cjs/hcs-20/types.d.ts +9 -8
  10. package/dist/cjs/hcs-20/types.d.ts.map +1 -1
  11. package/dist/cjs/hcs-21/base-client.d.ts +14 -12
  12. package/dist/cjs/hcs-21/base-client.d.ts.map +1 -1
  13. package/dist/cjs/hcs-21/browser.d.ts +17 -7
  14. package/dist/cjs/hcs-21/browser.d.ts.map +1 -1
  15. package/dist/cjs/hcs-21/index.d.ts +1 -0
  16. package/dist/cjs/hcs-21/index.d.ts.map +1 -1
  17. package/dist/cjs/hcs-21/sdk.d.ts +70 -6
  18. package/dist/cjs/hcs-21/sdk.d.ts.map +1 -1
  19. package/dist/cjs/hcs-21/tx.d.ts +6 -2
  20. package/dist/cjs/hcs-21/tx.d.ts.map +1 -1
  21. package/dist/cjs/hcs-21/types.d.ts +751 -66
  22. package/dist/cjs/hcs-21/types.d.ts.map +1 -1
  23. package/dist/cjs/hcs-21/verify.d.ts +6 -0
  24. package/dist/cjs/hcs-21/verify.d.ts.map +1 -0
  25. package/dist/cjs/inscribe/inscriber.d.ts +3 -1
  26. package/dist/cjs/inscribe/inscriber.d.ts.map +1 -1
  27. package/dist/cjs/inscribe/quote-cache.d.ts.map +1 -1
  28. package/dist/cjs/inscribe/types.d.ts +7 -0
  29. package/dist/cjs/inscribe/types.d.ts.map +1 -1
  30. package/dist/cjs/services/registry-broker/client/adapters.d.ts +20 -0
  31. package/dist/cjs/services/registry-broker/client/adapters.d.ts.map +1 -0
  32. package/dist/cjs/services/registry-broker/client/agents.d.ts +16 -0
  33. package/dist/cjs/services/registry-broker/client/agents.d.ts.map +1 -0
  34. package/dist/cjs/services/registry-broker/client/base-client.d.ts +57 -0
  35. package/dist/cjs/services/registry-broker/client/base-client.d.ts.map +1 -0
  36. package/dist/cjs/services/registry-broker/client/chat-history.d.ts +23 -0
  37. package/dist/cjs/services/registry-broker/client/chat-history.d.ts.map +1 -0
  38. package/dist/cjs/services/registry-broker/client/chat.d.ts +33 -0
  39. package/dist/cjs/services/registry-broker/client/chat.d.ts.map +1 -0
  40. package/dist/cjs/services/registry-broker/client/credits.d.ts +40 -0
  41. package/dist/cjs/services/registry-broker/client/credits.d.ts.map +1 -0
  42. package/dist/cjs/services/registry-broker/client/encrypted-chat-manager.d.ts +35 -0
  43. package/dist/cjs/services/registry-broker/client/encrypted-chat-manager.d.ts.map +1 -0
  44. package/dist/cjs/services/registry-broker/client/encryption.d.ts +33 -0
  45. package/dist/cjs/services/registry-broker/client/encryption.d.ts.map +1 -0
  46. package/dist/cjs/services/registry-broker/client/errors.d.ts +19 -0
  47. package/dist/cjs/services/registry-broker/client/errors.d.ts.map +1 -0
  48. package/dist/cjs/services/registry-broker/client/ledger-auth.d.ts +10 -0
  49. package/dist/cjs/services/registry-broker/client/ledger-auth.d.ts.map +1 -0
  50. package/dist/cjs/services/registry-broker/client/search.d.ts +19 -0
  51. package/dist/cjs/services/registry-broker/client/search.d.ts.map +1 -0
  52. package/dist/cjs/services/registry-broker/client/utils.d.ts +21 -0
  53. package/dist/cjs/services/registry-broker/client/utils.d.ts.map +1 -0
  54. package/dist/cjs/services/registry-broker/client.d.ts +2 -204
  55. package/dist/cjs/services/registry-broker/client.d.ts.map +1 -1
  56. package/dist/cjs/services/registry-broker/private-key-signer.d.ts.map +1 -1
  57. package/dist/cjs/services/registry-broker/schemas.d.ts +1473 -177
  58. package/dist/cjs/services/registry-broker/schemas.d.ts.map +1 -1
  59. package/dist/cjs/services/registry-broker/types.d.ts +45 -3
  60. package/dist/cjs/services/registry-broker/types.d.ts.map +1 -1
  61. package/dist/cjs/services/types.d.ts +1 -0
  62. package/dist/cjs/services/types.d.ts.map +1 -1
  63. package/dist/cjs/standards-sdk.cjs +2 -2
  64. package/dist/cjs/standards-sdk.cjs.map +1 -1
  65. package/dist/cjs/utils/dynamic-import.d.ts +1 -0
  66. package/dist/cjs/utils/dynamic-import.d.ts.map +1 -1
  67. package/dist/es/hcs-11/client.d.ts.map +1 -1
  68. package/dist/es/hcs-11/types.d.ts +1 -0
  69. package/dist/es/hcs-11/types.d.ts.map +1 -1
  70. package/dist/es/hcs-12/validation/schemas.d.ts +8 -8
  71. package/dist/es/hcs-16/base-client.d.ts.map +1 -1
  72. package/dist/es/hcs-17/types.d.ts.map +1 -1
  73. package/dist/es/hcs-20/sdk.d.ts.map +1 -1
  74. package/dist/es/hcs-20/types.d.ts +9 -8
  75. package/dist/es/hcs-20/types.d.ts.map +1 -1
  76. package/dist/es/hcs-21/base-client.d.ts +14 -12
  77. package/dist/es/hcs-21/base-client.d.ts.map +1 -1
  78. package/dist/es/hcs-21/browser.d.ts +17 -7
  79. package/dist/es/hcs-21/browser.d.ts.map +1 -1
  80. package/dist/es/hcs-21/index.d.ts +1 -0
  81. package/dist/es/hcs-21/index.d.ts.map +1 -1
  82. package/dist/es/hcs-21/sdk.d.ts +70 -6
  83. package/dist/es/hcs-21/sdk.d.ts.map +1 -1
  84. package/dist/es/hcs-21/tx.d.ts +6 -2
  85. package/dist/es/hcs-21/tx.d.ts.map +1 -1
  86. package/dist/es/hcs-21/types.d.ts +751 -66
  87. package/dist/es/hcs-21/types.d.ts.map +1 -1
  88. package/dist/es/hcs-21/verify.d.ts +6 -0
  89. package/dist/es/hcs-21/verify.d.ts.map +1 -0
  90. package/dist/es/inscribe/inscriber.d.ts +3 -1
  91. package/dist/es/inscribe/inscriber.d.ts.map +1 -1
  92. package/dist/es/inscribe/quote-cache.d.ts.map +1 -1
  93. package/dist/es/inscribe/types.d.ts +7 -0
  94. package/dist/es/inscribe/types.d.ts.map +1 -1
  95. package/dist/es/services/registry-broker/client/adapters.d.ts +20 -0
  96. package/dist/es/services/registry-broker/client/adapters.d.ts.map +1 -0
  97. package/dist/es/services/registry-broker/client/agents.d.ts +16 -0
  98. package/dist/es/services/registry-broker/client/agents.d.ts.map +1 -0
  99. package/dist/es/services/registry-broker/client/base-client.d.ts +57 -0
  100. package/dist/es/services/registry-broker/client/base-client.d.ts.map +1 -0
  101. package/dist/es/services/registry-broker/client/chat-history.d.ts +23 -0
  102. package/dist/es/services/registry-broker/client/chat-history.d.ts.map +1 -0
  103. package/dist/es/services/registry-broker/client/chat.d.ts +33 -0
  104. package/dist/es/services/registry-broker/client/chat.d.ts.map +1 -0
  105. package/dist/es/services/registry-broker/client/credits.d.ts +40 -0
  106. package/dist/es/services/registry-broker/client/credits.d.ts.map +1 -0
  107. package/dist/es/services/registry-broker/client/encrypted-chat-manager.d.ts +35 -0
  108. package/dist/es/services/registry-broker/client/encrypted-chat-manager.d.ts.map +1 -0
  109. package/dist/es/services/registry-broker/client/encryption.d.ts +33 -0
  110. package/dist/es/services/registry-broker/client/encryption.d.ts.map +1 -0
  111. package/dist/es/services/registry-broker/client/errors.d.ts +19 -0
  112. package/dist/es/services/registry-broker/client/errors.d.ts.map +1 -0
  113. package/dist/es/services/registry-broker/client/ledger-auth.d.ts +10 -0
  114. package/dist/es/services/registry-broker/client/ledger-auth.d.ts.map +1 -0
  115. package/dist/es/services/registry-broker/client/search.d.ts +19 -0
  116. package/dist/es/services/registry-broker/client/search.d.ts.map +1 -0
  117. package/dist/es/services/registry-broker/client/utils.d.ts +21 -0
  118. package/dist/es/services/registry-broker/client/utils.d.ts.map +1 -0
  119. package/dist/es/services/registry-broker/client.d.ts +2 -204
  120. package/dist/es/services/registry-broker/client.d.ts.map +1 -1
  121. package/dist/es/services/registry-broker/private-key-signer.d.ts.map +1 -1
  122. package/dist/es/services/registry-broker/schemas.d.ts +1473 -177
  123. package/dist/es/services/registry-broker/schemas.d.ts.map +1 -1
  124. package/dist/es/services/registry-broker/types.d.ts +45 -3
  125. package/dist/es/services/registry-broker/types.d.ts.map +1 -1
  126. package/dist/es/services/types.d.ts +1 -0
  127. package/dist/es/services/types.d.ts.map +1 -1
  128. package/dist/es/standards-sdk.es.js +73 -51
  129. package/dist/es/standards-sdk.es.js.map +1 -1
  130. package/dist/es/standards-sdk.es10.js +2 -2
  131. package/dist/es/standards-sdk.es100.js +26 -229
  132. package/dist/es/standards-sdk.es100.js.map +1 -1
  133. package/dist/es/standards-sdk.es101.js +228 -109
  134. package/dist/es/standards-sdk.es101.js.map +1 -1
  135. package/dist/es/standards-sdk.es102.js +94 -15
  136. package/dist/es/standards-sdk.es102.js.map +1 -1
  137. package/dist/es/standards-sdk.es103.js +30 -80
  138. package/dist/es/standards-sdk.es103.js.map +1 -1
  139. package/dist/es/standards-sdk.es104.js +80 -27
  140. package/dist/es/standards-sdk.es104.js.map +1 -1
  141. package/dist/es/standards-sdk.es105.js +25 -136
  142. package/dist/es/standards-sdk.es105.js.map +1 -1
  143. package/dist/es/standards-sdk.es106.js +140 -27
  144. package/dist/es/standards-sdk.es106.js.map +1 -1
  145. package/dist/es/standards-sdk.es107.js +27 -20
  146. package/dist/es/standards-sdk.es107.js.map +1 -1
  147. package/dist/es/standards-sdk.es108.js +18 -156
  148. package/dist/es/standards-sdk.es108.js.map +1 -1
  149. package/dist/es/standards-sdk.es109.js +148 -196
  150. package/dist/es/standards-sdk.es109.js.map +1 -1
  151. package/dist/es/standards-sdk.es110.js +167 -747
  152. package/dist/es/standards-sdk.es110.js.map +1 -1
  153. package/dist/es/standards-sdk.es111.js +786 -9
  154. package/dist/es/standards-sdk.es111.js.map +1 -1
  155. package/dist/es/standards-sdk.es112.js +13 -567
  156. package/dist/es/standards-sdk.es112.js.map +1 -1
  157. package/dist/es/standards-sdk.es113.js +541 -576
  158. package/dist/es/standards-sdk.es113.js.map +1 -1
  159. package/dist/es/standards-sdk.es114.js +601 -12
  160. package/dist/es/standards-sdk.es114.js.map +1 -1
  161. package/dist/es/standards-sdk.es115.js +13 -2
  162. package/dist/es/standards-sdk.es115.js.map +1 -1
  163. package/dist/es/standards-sdk.es116.js +2 -83
  164. package/dist/es/standards-sdk.es116.js.map +1 -1
  165. package/dist/es/standards-sdk.es117.js +80 -36
  166. package/dist/es/standards-sdk.es117.js.map +1 -1
  167. package/dist/es/standards-sdk.es118.js +39 -2
  168. package/dist/es/standards-sdk.es118.js.map +1 -1
  169. package/dist/es/standards-sdk.es119.js +2 -223
  170. package/dist/es/standards-sdk.es119.js.map +1 -1
  171. package/dist/es/standards-sdk.es12.js +1 -1
  172. package/dist/es/standards-sdk.es120.js +193 -1110
  173. package/dist/es/standards-sdk.es120.js.map +1 -1
  174. package/dist/es/standards-sdk.es121.js +1059 -225
  175. package/dist/es/standards-sdk.es121.js.map +1 -1
  176. package/dist/es/standards-sdk.es122.js +303 -419
  177. package/dist/es/standards-sdk.es122.js.map +1 -1
  178. package/dist/es/standards-sdk.es123.js +418 -351
  179. package/dist/es/standards-sdk.es123.js.map +1 -1
  180. package/dist/es/standards-sdk.es124.js +348 -754
  181. package/dist/es/standards-sdk.es124.js.map +1 -1
  182. package/dist/es/standards-sdk.es125.js +854 -178
  183. package/dist/es/standards-sdk.es125.js.map +1 -1
  184. package/dist/es/standards-sdk.es126.js +153 -1512
  185. package/dist/es/standards-sdk.es126.js.map +1 -1
  186. package/dist/es/standards-sdk.es127.js +1373 -1977
  187. package/dist/es/standards-sdk.es127.js.map +1 -1
  188. package/dist/es/standards-sdk.es128.js +176 -51
  189. package/dist/es/standards-sdk.es128.js.map +1 -1
  190. package/dist/es/standards-sdk.es129.js +196 -76
  191. package/dist/es/standards-sdk.es129.js.map +1 -1
  192. package/dist/es/standards-sdk.es13.js +1 -1
  193. package/dist/es/standards-sdk.es130.js +98 -153
  194. package/dist/es/standards-sdk.es130.js.map +1 -1
  195. package/dist/es/standards-sdk.es131.js +122 -8
  196. package/dist/es/standards-sdk.es131.js.map +1 -1
  197. package/dist/es/standards-sdk.es132.js +234 -73
  198. package/dist/es/standards-sdk.es132.js.map +1 -1
  199. package/dist/es/standards-sdk.es133.js +171 -56
  200. package/dist/es/standards-sdk.es133.js.map +1 -1
  201. package/dist/es/standards-sdk.es134.js +123 -29
  202. package/dist/es/standards-sdk.es134.js.map +1 -1
  203. package/dist/es/standards-sdk.es135.js +313 -125
  204. package/dist/es/standards-sdk.es135.js.map +1 -1
  205. package/dist/es/standards-sdk.es136.js +358 -34
  206. package/dist/es/standards-sdk.es136.js.map +1 -1
  207. package/dist/es/standards-sdk.es137.js +17 -732
  208. package/dist/es/standards-sdk.es137.js.map +1 -1
  209. package/dist/es/standards-sdk.es138.js +65 -12264
  210. package/dist/es/standards-sdk.es138.js.map +1 -1
  211. package/dist/es/standards-sdk.es139.js +86 -16
  212. package/dist/es/standards-sdk.es139.js.map +1 -1
  213. package/dist/es/standards-sdk.es14.js +1 -1
  214. package/dist/es/standards-sdk.es140.js +152 -49
  215. package/dist/es/standards-sdk.es140.js.map +1 -1
  216. package/dist/es/standards-sdk.es141.js +7 -64
  217. package/dist/es/standards-sdk.es141.js.map +1 -1
  218. package/dist/es/standards-sdk.es142.js +71 -157
  219. package/dist/es/standards-sdk.es142.js.map +1 -1
  220. package/dist/es/standards-sdk.es143.js +49 -306
  221. package/dist/es/standards-sdk.es143.js.map +1 -1
  222. package/dist/es/standards-sdk.es144.js +28 -346
  223. package/dist/es/standards-sdk.es144.js.map +1 -1
  224. package/dist/es/standards-sdk.es145.js +112 -427
  225. package/dist/es/standards-sdk.es145.js.map +1 -1
  226. package/dist/es/standards-sdk.es146.js +40 -329
  227. package/dist/es/standards-sdk.es146.js.map +1 -1
  228. package/dist/es/standards-sdk.es147.js +12277 -66
  229. package/dist/es/standards-sdk.es147.js.map +1 -1
  230. package/dist/es/standards-sdk.es148.js +20 -0
  231. package/dist/es/standards-sdk.es148.js.map +1 -0
  232. package/dist/es/standards-sdk.es149.js +59 -0
  233. package/dist/es/standards-sdk.es149.js.map +1 -0
  234. package/dist/es/standards-sdk.es15.js +1 -1
  235. package/dist/es/standards-sdk.es150.js +85 -0
  236. package/dist/es/standards-sdk.es150.js.map +1 -0
  237. package/dist/es/standards-sdk.es151.js +175 -0
  238. package/dist/es/standards-sdk.es151.js.map +1 -0
  239. package/dist/es/standards-sdk.es152.js +325 -0
  240. package/dist/es/standards-sdk.es152.js.map +1 -0
  241. package/dist/es/standards-sdk.es153.js +349 -0
  242. package/dist/es/standards-sdk.es153.js.map +1 -0
  243. package/dist/es/standards-sdk.es154.js +456 -0
  244. package/dist/es/standards-sdk.es154.js.map +1 -0
  245. package/dist/es/standards-sdk.es155.js +334 -0
  246. package/dist/es/standards-sdk.es155.js.map +1 -0
  247. package/dist/es/standards-sdk.es156.js +79 -0
  248. package/dist/es/standards-sdk.es156.js.map +1 -0
  249. package/dist/es/standards-sdk.es157.js +874 -0
  250. package/dist/es/standards-sdk.es157.js.map +1 -0
  251. package/dist/es/standards-sdk.es158.js +242 -0
  252. package/dist/es/standards-sdk.es158.js.map +1 -0
  253. package/dist/es/standards-sdk.es159.js +247 -0
  254. package/dist/es/standards-sdk.es159.js.map +1 -0
  255. package/dist/es/standards-sdk.es16.js +1 -1
  256. package/dist/es/standards-sdk.es17.js +13 -11
  257. package/dist/es/standards-sdk.es17.js.map +1 -1
  258. package/dist/es/standards-sdk.es19.js +20 -17
  259. package/dist/es/standards-sdk.es19.js.map +1 -1
  260. package/dist/es/standards-sdk.es20.js +17 -14
  261. package/dist/es/standards-sdk.es20.js.map +1 -1
  262. package/dist/es/standards-sdk.es21.js +1 -1
  263. package/dist/es/standards-sdk.es22.js +1 -1
  264. package/dist/es/standards-sdk.es23.js +1 -1
  265. package/dist/es/standards-sdk.es24.js +1 -1
  266. package/dist/es/standards-sdk.es25.js +1 -1
  267. package/dist/es/standards-sdk.es26.js +1 -1
  268. package/dist/es/standards-sdk.es27.js +1 -1
  269. package/dist/es/standards-sdk.es28.js +24 -19
  270. package/dist/es/standards-sdk.es28.js.map +1 -1
  271. package/dist/es/standards-sdk.es29.js.map +1 -1
  272. package/dist/es/standards-sdk.es3.js +2 -2
  273. package/dist/es/standards-sdk.es31.js +2 -2
  274. package/dist/es/standards-sdk.es32.js +4 -4
  275. package/dist/es/standards-sdk.es33.js +1 -1
  276. package/dist/es/standards-sdk.es36.js +16 -13
  277. package/dist/es/standards-sdk.es36.js.map +1 -1
  278. package/dist/es/standards-sdk.es37.js +4 -4
  279. package/dist/es/standards-sdk.es38.js +2 -2
  280. package/dist/es/standards-sdk.es39.js +2 -2
  281. package/dist/es/standards-sdk.es40.js +1 -1
  282. package/dist/es/standards-sdk.es41.js +1 -1
  283. package/dist/es/standards-sdk.es42.js +2 -2
  284. package/dist/es/standards-sdk.es47.js +1 -1
  285. package/dist/es/standards-sdk.es5.js +2 -2
  286. package/dist/es/standards-sdk.es52.js +1 -1
  287. package/dist/es/standards-sdk.es54.js +1 -1
  288. package/dist/es/standards-sdk.es57.js +2 -2
  289. package/dist/es/standards-sdk.es59.js +1 -1
  290. package/dist/es/standards-sdk.es6.js +2 -2
  291. package/dist/es/standards-sdk.es60.js +1 -1
  292. package/dist/es/standards-sdk.es61.js +15 -12
  293. package/dist/es/standards-sdk.es61.js.map +1 -1
  294. package/dist/es/standards-sdk.es63.js +1 -1
  295. package/dist/es/standards-sdk.es65.js +2 -2
  296. package/dist/es/standards-sdk.es66.js +3 -3
  297. package/dist/es/standards-sdk.es69.js +2 -2
  298. package/dist/es/standards-sdk.es7.js +2 -2
  299. package/dist/es/standards-sdk.es70.js +3 -3
  300. package/dist/es/standards-sdk.es71.js +2 -2
  301. package/dist/es/standards-sdk.es72.js +1 -1
  302. package/dist/es/standards-sdk.es73.js.map +1 -1
  303. package/dist/es/standards-sdk.es75.js +2 -2
  304. package/dist/es/standards-sdk.es77.js +5 -3
  305. package/dist/es/standards-sdk.es77.js.map +1 -1
  306. package/dist/es/standards-sdk.es78.js +12 -11
  307. package/dist/es/standards-sdk.es78.js.map +1 -1
  308. package/dist/es/standards-sdk.es79.js +1 -1
  309. package/dist/es/standards-sdk.es8.js +1 -1
  310. package/dist/es/standards-sdk.es80.js +113 -29
  311. package/dist/es/standards-sdk.es80.js.map +1 -1
  312. package/dist/es/standards-sdk.es82.js +23 -4
  313. package/dist/es/standards-sdk.es82.js.map +1 -1
  314. package/dist/es/standards-sdk.es83.js +39 -14
  315. package/dist/es/standards-sdk.es83.js.map +1 -1
  316. package/dist/es/standards-sdk.es84.js +198 -17
  317. package/dist/es/standards-sdk.es84.js.map +1 -1
  318. package/dist/es/standards-sdk.es85.js +256 -9
  319. package/dist/es/standards-sdk.es85.js.map +1 -1
  320. package/dist/es/standards-sdk.es86.js +55 -21
  321. package/dist/es/standards-sdk.es86.js.map +1 -1
  322. package/dist/es/standards-sdk.es87.js +22 -75
  323. package/dist/es/standards-sdk.es87.js.map +1 -1
  324. package/dist/es/standards-sdk.es88.js +45 -30
  325. package/dist/es/standards-sdk.es88.js.map +1 -1
  326. package/dist/es/standards-sdk.es89.js +57 -22
  327. package/dist/es/standards-sdk.es89.js.map +1 -1
  328. package/dist/es/standards-sdk.es90.js +28 -23
  329. package/dist/es/standards-sdk.es90.js.map +1 -1
  330. package/dist/es/standards-sdk.es91.js +23 -167
  331. package/dist/es/standards-sdk.es91.js.map +1 -1
  332. package/dist/es/standards-sdk.es92.js +158 -119
  333. package/dist/es/standards-sdk.es92.js.map +1 -1
  334. package/dist/es/standards-sdk.es93.js +68 -95
  335. package/dist/es/standards-sdk.es93.js.map +1 -1
  336. package/dist/es/standards-sdk.es94.js +136 -119
  337. package/dist/es/standards-sdk.es94.js.map +1 -1
  338. package/dist/es/standards-sdk.es95.js +139 -39
  339. package/dist/es/standards-sdk.es95.js.map +1 -1
  340. package/dist/es/standards-sdk.es96.js +42 -257
  341. package/dist/es/standards-sdk.es96.js.map +1 -1
  342. package/dist/es/standards-sdk.es97.js +243 -80
  343. package/dist/es/standards-sdk.es97.js.map +1 -1
  344. package/dist/es/standards-sdk.es98.js +47 -48
  345. package/dist/es/standards-sdk.es98.js.map +1 -1
  346. package/dist/es/standards-sdk.es99.js +100 -28
  347. package/dist/es/standards-sdk.es99.js.map +1 -1
  348. package/dist/es/utils/dynamic-import.d.ts +1 -0
  349. package/dist/es/utils/dynamic-import.d.ts.map +1 -1
  350. package/package.json +6 -10
@@ -1,207 +1,883 @@
1
- import { InscriptionSDK } from "./standards-sdk.es138.js";
2
- class QuoteCache {
3
- constructor() {
4
- this.cache = /* @__PURE__ */ new Map();
5
- this.maxSize = 100;
6
- this.defaultTtlMs = 5 * 60 * 1e3;
1
+ import { InscriptionSDK } from "./standards-sdk.es147.js";
2
+ import { Logger } from "./standards-sdk.es106.js";
3
+ import { ProgressReporter } from "./standards-sdk.es109.js";
4
+ import { TransactionParser } from "./standards-sdk.es111.js";
5
+ import { isBrowser } from "./standards-sdk.es119.js";
6
+ import { fileTypeFromBuffer } from "file-type";
7
+ import { validateQuoteParameters, getCachedQuote, getOrCreateSDK, cacheQuote } from "./standards-sdk.es126.js";
8
+ import { HederaMirrorNode } from "./standards-sdk.es127.js";
9
+ import BigNumber from "bignumber.js";
10
+ import { sleep } from "./standards-sdk.es116.js";
11
+ let nodeModules = {};
12
+ const normalizeTransactionId = (txId) => {
13
+ if (!txId.includes("@")) {
14
+ return txId;
7
15
  }
8
- // 5 minutes
9
- /**
10
- * Generate cache key from input parameters
11
- */
12
- generateKey(key) {
13
- return `${key.inputHash}-${key.clientConfigHash}-${key.optionsHash}`;
16
+ const txParts = txId?.split("@");
17
+ return `${txParts[0]}-${txParts[1].replace(".", "-")}`;
18
+ };
19
+ async function loadNodeModules() {
20
+ if (isBrowser || nodeModules.readFileSync) {
21
+ return;
14
22
  }
15
- /**
16
- * Hash object to string for cache key
17
- */
18
- hashObject(obj) {
19
- return Buffer.from(JSON.stringify(obj)).toString("base64").slice(0, 16);
23
+ try {
24
+ const globalObj = typeof global !== "undefined" ? global : globalThis;
25
+ const req = globalObj.process?.mainModule?.require || globalObj.require;
26
+ if (typeof req === "function") {
27
+ const fs = req("fs");
28
+ const path = req("path");
29
+ nodeModules.readFileSync = fs.readFileSync;
30
+ nodeModules.basename = path.basename;
31
+ nodeModules.extname = path.extname;
32
+ } else {
33
+ throw new Error("require function not available");
34
+ }
35
+ } catch (error) {
36
+ console.warn(
37
+ "Node.js modules not available, file path operations will be disabled"
38
+ );
20
39
  }
21
- /**
22
- * Create cache key from parameters
23
- */
24
- createCacheKey(input, clientConfig, options) {
25
- return {
26
- inputHash: this.hashObject(input),
27
- clientConfigHash: this.hashObject({
28
- accountId: clientConfig.accountId,
29
- network: clientConfig.network
30
- }),
31
- optionsHash: this.hashObject({
32
- mode: options.mode,
33
- apiKey: options.apiKey ? "present" : "absent",
34
- network: options.network,
35
- metadata: options.metadata
36
- })
37
- };
40
+ }
41
+ const COST_LOOKUP_ATTEMPTS = 3;
42
+ const COST_LOOKUP_DELAY_MS = 1e3;
43
+ const TINYBAR_DIVISOR = 1e8;
44
+ const COST_LOGGER_MODULE = "InscriberCost";
45
+ async function convertFileToBase64(filePath) {
46
+ if (isBrowser) {
47
+ throw new Error(
48
+ "File path operations are not supported in browser environment. Use buffer input type instead."
49
+ );
38
50
  }
39
- /**
40
- * Get cached quote if available and not expired
41
- */
42
- get(key) {
43
- const cacheKey = this.generateKey(key);
44
- const entry = this.cache.get(cacheKey);
45
- if (!entry) {
46
- return null;
47
- }
48
- const now = Date.now();
49
- if (now - entry.timestamp > entry.ttlMs) {
50
- this.cache.delete(cacheKey);
51
- return null;
52
- }
53
- this.cache.delete(cacheKey);
54
- this.cache.set(cacheKey, entry);
55
- return entry.quote;
51
+ await loadNodeModules();
52
+ if (!nodeModules.readFileSync || !nodeModules.basename || !nodeModules.extname) {
53
+ throw new Error(
54
+ "Node.js file system modules are not available. Cannot read file from path."
55
+ );
56
56
  }
57
- /**
58
- * Store quote in cache
59
- */
60
- set(key, quote, ttlMs = this.defaultTtlMs) {
61
- const cacheKey = this.generateKey(key);
62
- if (this.cache.size >= this.maxSize) {
63
- const firstKey = this.cache.keys().next().value;
64
- if (firstKey) {
65
- this.cache.delete(firstKey);
57
+ try {
58
+ const buffer = nodeModules.readFileSync(filePath);
59
+ const base64 = buffer.toString("base64");
60
+ const fileName = nodeModules.basename(filePath);
61
+ let mimeType = "application/octet-stream";
62
+ try {
63
+ const fileTypeResult = await fileTypeFromBuffer(buffer);
64
+ if (fileTypeResult) {
65
+ mimeType = fileTypeResult.mime;
66
66
  }
67
+ } catch (error) {
68
+ const ext = nodeModules.extname(filePath).toLowerCase();
69
+ const mimeMap = {
70
+ ".txt": "text/plain",
71
+ ".json": "application/json",
72
+ ".html": "text/html",
73
+ ".css": "text/css",
74
+ ".js": "application/javascript",
75
+ ".png": "image/png",
76
+ ".jpg": "image/jpeg",
77
+ ".jpeg": "image/jpeg",
78
+ ".gif": "image/gif",
79
+ ".svg": "image/svg+xml",
80
+ ".pdf": "application/pdf"
81
+ };
82
+ mimeType = mimeMap[ext] || "application/octet-stream";
67
83
  }
68
- this.cache.set(cacheKey, {
69
- quote,
70
- timestamp: Date.now(),
71
- ttlMs
72
- });
73
- }
74
- /**
75
- * Clear all cached entries
76
- */
77
- clear() {
78
- this.cache.clear();
84
+ return { base64, fileName, mimeType };
85
+ } catch (error) {
86
+ throw new Error(
87
+ `Failed to read file ${filePath}: ${error.message}`
88
+ );
79
89
  }
80
90
  }
81
- class SDKCache {
82
- constructor() {
83
- this.cache = /* @__PURE__ */ new Map();
84
- this.maxSize = 10;
85
- this.defaultTtlMs = 30 * 60 * 1e3;
86
- }
87
- // 30 minutes
88
- /**
89
- * Generate config key for SDK instance
90
- */
91
- generateConfigKey(config) {
92
- return Buffer.from(JSON.stringify(config)).toString("base64");
93
- }
94
- /**
95
- * Get cached SDK instance
96
- */
97
- get(config) {
98
- const configKey = this.generateConfigKey(config);
99
- const entry = this.cache.get(configKey);
100
- if (!entry) {
101
- return null;
102
- }
103
- const now = Date.now();
104
- if (now - entry.timestamp > this.defaultTtlMs) {
105
- this.cache.delete(configKey);
106
- return null;
107
- }
108
- return entry.sdk;
109
- }
110
- /**
111
- * Store SDK instance in cache
112
- */
113
- set(config, sdk) {
114
- const configKey = this.generateConfigKey(config);
115
- if (this.cache.size >= this.maxSize) {
116
- const firstKey = this.cache.keys().next().value;
117
- if (firstKey) {
118
- this.cache.delete(firstKey);
91
+ function normalizeClientConfig(cfg) {
92
+ return {
93
+ accountId: cfg.accountId,
94
+ privateKey: typeof cfg.privateKey === "string" ? cfg.privateKey : cfg.privateKey.toString(),
95
+ network: cfg.network
96
+ };
97
+ }
98
+ async function inscribe(input, clientConfig, options, existingSDK) {
99
+ const logger = Logger.getInstance({
100
+ module: "Inscriber",
101
+ ...options.logging
102
+ });
103
+ logger.info("Starting inscription process", {
104
+ type: input.type,
105
+ mode: options.mode || "file",
106
+ quoteOnly: options.quoteOnly || false,
107
+ ...input.type === "url" ? { url: input.url } : {},
108
+ ...input.type === "file" ? { path: input.path } : {},
109
+ ...input.type === "buffer" ? { fileName: input.fileName, bufferSize: input.buffer.byteLength } : {}
110
+ });
111
+ try {
112
+ if (options.quoteOnly) {
113
+ logger.debug("Quote-only mode requested, generating quote");
114
+ return await generateQuote(input, clientConfig, options, existingSDK);
115
+ }
116
+ if (options.mode === "hashinal" && options.metadata) {
117
+ validateHashinalMetadata(options.metadata, logger);
118
+ }
119
+ let sdk;
120
+ if (existingSDK) {
121
+ logger.debug("Using existing InscriptionSDK instance");
122
+ sdk = existingSDK;
123
+ } else if (options.apiKey) {
124
+ logger.debug("Initializing InscriptionSDK with API key");
125
+ sdk = new InscriptionSDK({
126
+ apiKey: options.apiKey,
127
+ network: clientConfig.network || "mainnet",
128
+ connectionMode: "auto"
129
+ });
130
+ } else {
131
+ logger.debug("Initializing InscriptionSDK with server auth");
132
+ const normalized = normalizeClientConfig(clientConfig);
133
+ sdk = await InscriptionSDK.createWithAuth({
134
+ type: "server",
135
+ accountId: normalized.accountId,
136
+ privateKey: normalized.privateKey,
137
+ network: normalized.network || "mainnet",
138
+ connectionMode: "auto"
139
+ });
140
+ }
141
+ const baseRequest = {
142
+ holderId: clientConfig.accountId,
143
+ metadata: options.metadata || {},
144
+ tags: options.tags || [],
145
+ mode: options.mode || "file",
146
+ fileStandard: options.fileStandard,
147
+ chunkSize: options.chunkSize
148
+ };
149
+ let request;
150
+ switch (input.type) {
151
+ case "url":
152
+ request = {
153
+ ...baseRequest,
154
+ file: {
155
+ type: "url",
156
+ url: input.url
157
+ }
158
+ };
159
+ break;
160
+ case "file": {
161
+ const fileData = await convertFileToBase64(input.path);
162
+ request = {
163
+ ...baseRequest,
164
+ file: {
165
+ type: "base64",
166
+ base64: fileData.base64,
167
+ fileName: fileData.fileName,
168
+ mimeType: fileData.mimeType
169
+ }
170
+ };
171
+ break;
119
172
  }
173
+ case "buffer":
174
+ request = {
175
+ ...baseRequest,
176
+ file: {
177
+ type: "base64",
178
+ base64: Buffer.from(
179
+ input.buffer instanceof ArrayBuffer ? new Uint8Array(input.buffer) : input.buffer
180
+ ).toString("base64"),
181
+ fileName: input.fileName,
182
+ mimeType: input.mimeType
183
+ }
184
+ };
185
+ break;
120
186
  }
121
- this.cache.set(configKey, {
122
- sdk,
123
- timestamp: Date.now(),
124
- config: configKey
187
+ if (options.mode === "hashinal") {
188
+ request.metadataObject = options.metadata;
189
+ request.creator = options.metadata?.creator || clientConfig.accountId;
190
+ request.description = options.metadata?.description;
191
+ if (options.jsonFileURL) {
192
+ request.jsonFileURL = options.jsonFileURL;
193
+ }
194
+ }
195
+ logger.debug("Preparing to inscribe content", {
196
+ type: input.type,
197
+ mode: options.mode || "file",
198
+ holderId: clientConfig.accountId
125
199
  });
126
- }
127
- /**
128
- * Clear all cached SDK instances
129
- */
130
- clear() {
131
- this.cache.clear();
200
+ const normalizedCfg = normalizeClientConfig(clientConfig);
201
+ const result = await sdk.inscribeAndExecute(request, normalizedCfg);
202
+ const rawJobId = result.jobId || result.tx_id || result.transactionId || "";
203
+ const rawTxId = result.transactionId || rawJobId || "";
204
+ const normalizedJobId = normalizeTransactionId(rawJobId);
205
+ const normalizedTxId = normalizeTransactionId(rawTxId);
206
+ const waitId = normalizeTransactionId(
207
+ normalizedJobId || normalizedTxId || rawJobId || result.jobId || ""
208
+ );
209
+ logger.info("Starting to inscribe.", {
210
+ type: input.type,
211
+ mode: options.mode || "file",
212
+ transactionId: result.jobId
213
+ });
214
+ if (options.waitForConfirmation) {
215
+ logger.debug("Waiting for inscription confirmation", {
216
+ transactionId: waitId,
217
+ maxAttempts: options.waitMaxAttempts,
218
+ intervalMs: options.waitIntervalMs
219
+ });
220
+ const inscription = await waitForInscriptionConfirmation(
221
+ sdk,
222
+ waitId,
223
+ options.waitMaxAttempts,
224
+ options.waitIntervalMs,
225
+ options.progressCallback
226
+ );
227
+ logger.info("Inscription confirmation received", {
228
+ transactionId: result.jobId
229
+ });
230
+ return {
231
+ confirmed: true,
232
+ result: {
233
+ ...result,
234
+ jobId: waitId,
235
+ transactionId: normalizedTxId
236
+ },
237
+ inscription,
238
+ sdk,
239
+ costSummary: await resolveInscriptionCost(
240
+ normalizedTxId,
241
+ clientConfig.network || "mainnet",
242
+ options.logging?.level
243
+ )
244
+ };
245
+ }
246
+ return {
247
+ confirmed: false,
248
+ result: {
249
+ ...result,
250
+ jobId: waitId,
251
+ transactionId: normalizedTxId
252
+ },
253
+ sdk,
254
+ costSummary: await resolveInscriptionCost(
255
+ normalizedTxId,
256
+ clientConfig.network || "mainnet",
257
+ options.logging?.level
258
+ )
259
+ };
260
+ } catch (error) {
261
+ logger.error("Error during inscription process", error);
262
+ throw error;
132
263
  }
133
264
  }
134
- const quoteCache = new QuoteCache();
135
- const sdkCache = new SDKCache();
136
- async function getOrCreateSDK(clientConfig, options, existingSDK) {
137
- if (existingSDK) {
138
- return existingSDK;
139
- }
140
- const cacheConfig = {
141
- apiKey: options.apiKey,
142
- accountId: clientConfig.accountId,
143
- network: clientConfig.network || "mainnet",
144
- authType: options.apiKey ? "api" : "server"
145
- };
146
- const cachedSDK = sdkCache.get(cacheConfig);
147
- if (cachedSDK) {
148
- return cachedSDK;
265
+ async function resolveInscriptionCost(transactionId, network, level) {
266
+ const logger = Logger.getInstance({
267
+ module: COST_LOGGER_MODULE,
268
+ level: level ?? "info"
269
+ });
270
+ const mirrorNode = new HederaMirrorNode(network, logger);
271
+ const normalizedId = normalizeTransactionId(transactionId);
272
+ const payerAccountId = normalizedId.split("-")[0];
273
+ for (let attempt = 0; attempt < COST_LOOKUP_ATTEMPTS; attempt++) {
274
+ try {
275
+ const txn = await mirrorNode.getTransaction(normalizedId);
276
+ if (!txn) {
277
+ if (attempt < COST_LOOKUP_ATTEMPTS - 1) {
278
+ await sleep(COST_LOOKUP_DELAY_MS);
279
+ }
280
+ continue;
281
+ }
282
+ const payerTransfer = txn.transfers?.find(
283
+ (transfer) => transfer.account === payerAccountId && typeof transfer.amount === "number" && transfer.amount < 0
284
+ );
285
+ let payerTinybars = null;
286
+ if (payerTransfer) {
287
+ payerTinybars = Math.abs(payerTransfer.amount);
288
+ } else if (txn.transfers && txn.transfers.length > 0) {
289
+ const negativeSum = txn.transfers.filter((t) => typeof t.amount === "number" && t.amount < 0).reduce((sum, t) => sum + Math.abs(t.amount), 0);
290
+ payerTinybars = negativeSum > 0 ? negativeSum : null;
291
+ } else if (typeof txn.charged_tx_fee === "number") {
292
+ payerTinybars = txn.charged_tx_fee;
293
+ }
294
+ if (!payerTinybars || payerTinybars <= 0) {
295
+ if (attempt < COST_LOOKUP_ATTEMPTS - 1) {
296
+ await sleep(COST_LOOKUP_DELAY_MS);
297
+ }
298
+ continue;
299
+ }
300
+ const totalCostHbar = new BigNumber(payerTinybars).dividedBy(TINYBAR_DIVISOR).toFixed();
301
+ return {
302
+ totalCostHbar,
303
+ breakdown: {
304
+ transfers: [
305
+ {
306
+ to: "Hedera network (payer)",
307
+ amount: totalCostHbar,
308
+ description: `Transaction fee debited from ${payerAccountId}`
309
+ }
310
+ ]
311
+ }
312
+ };
313
+ } catch (error) {
314
+ logger.warn("Unable to resolve inscription cost", {
315
+ transactionId: normalizedId,
316
+ attempt: attempt + 1,
317
+ error: error instanceof Error ? error.message : String(error)
318
+ });
319
+ if (attempt < COST_LOOKUP_ATTEMPTS - 1) {
320
+ await sleep(COST_LOOKUP_DELAY_MS);
321
+ }
322
+ }
149
323
  }
150
- let sdk;
151
- if (options.apiKey) {
152
- sdk = new InscriptionSDK({
153
- apiKey: options.apiKey,
154
- network: clientConfig.network || "mainnet"
155
- });
156
- } else {
157
- sdk = await InscriptionSDK.createWithAuth({
158
- type: "server",
159
- accountId: clientConfig.accountId,
160
- privateKey: typeof clientConfig.privateKey === "string" ? clientConfig.privateKey : clientConfig.privateKey.toString(),
161
- network: clientConfig.network || "mainnet"
324
+ return void 0;
325
+ }
326
+ async function inscribeWithSigner(input, signer, options, existingSDK) {
327
+ const logger = Logger.getInstance({
328
+ module: "Inscriber",
329
+ ...options.logging
330
+ });
331
+ logger.info("Starting inscription process with signer", {
332
+ type: input.type,
333
+ mode: options.mode || "file",
334
+ quoteOnly: options.quoteOnly || false,
335
+ ...input.type === "url" ? { url: input.url } : {},
336
+ ...input.type === "file" ? { path: input.path } : {},
337
+ ...input.type === "buffer" ? { fileName: input.fileName, bufferSize: input.buffer.byteLength } : {}
338
+ });
339
+ try {
340
+ if (options.quoteOnly) {
341
+ logger.debug("Quote-only mode requested with signer, generating quote");
342
+ const clientConfig = {
343
+ accountId: signer.getAccountId().toString(),
344
+ privateKey: "",
345
+ network: options.network || "mainnet"
346
+ };
347
+ return await generateQuote(input, clientConfig, options, existingSDK);
348
+ }
349
+ if (options.mode === "hashinal" && options.metadata) {
350
+ validateHashinalMetadata(options.metadata, logger);
351
+ }
352
+ const accountId = signer.getAccountId().toString();
353
+ logger.debug("Using account ID from signer", { accountId });
354
+ let sdk;
355
+ if (existingSDK) {
356
+ logger.debug("Using existing InscriptionSDK instance");
357
+ sdk = existingSDK;
358
+ } else if (options.apiKey) {
359
+ logger.debug("Initializing InscriptionSDK with API key");
360
+ sdk = new InscriptionSDK({
361
+ apiKey: options.apiKey,
362
+ network: options.network || "mainnet",
363
+ connectionMode: "websocket"
364
+ });
365
+ } else {
366
+ logger.debug("Initializing InscriptionSDK with client auth (websocket)");
367
+ sdk = await InscriptionSDK.createWithAuth({
368
+ type: "client",
369
+ accountId,
370
+ signer,
371
+ network: options.network || "mainnet",
372
+ connectionMode: "websocket"
373
+ });
374
+ }
375
+ const baseRequest = {
376
+ holderId: accountId,
377
+ metadata: options.metadata || {},
378
+ tags: options.tags || [],
379
+ mode: options.mode || "file",
380
+ fileStandard: options.fileStandard,
381
+ chunkSize: options.chunkSize
382
+ };
383
+ let request;
384
+ switch (input.type) {
385
+ case "url":
386
+ request = {
387
+ ...baseRequest,
388
+ file: {
389
+ type: "url",
390
+ url: input.url
391
+ }
392
+ };
393
+ break;
394
+ case "file": {
395
+ const fileData = await convertFileToBase64(input.path);
396
+ request = {
397
+ ...baseRequest,
398
+ file: {
399
+ type: "base64",
400
+ base64: fileData.base64,
401
+ fileName: fileData.fileName,
402
+ mimeType: fileData.mimeType
403
+ }
404
+ };
405
+ break;
406
+ }
407
+ case "buffer":
408
+ request = {
409
+ ...baseRequest,
410
+ file: {
411
+ type: "base64",
412
+ base64: Buffer.from(
413
+ input.buffer instanceof ArrayBuffer ? new Uint8Array(input.buffer) : input.buffer
414
+ ).toString("base64"),
415
+ fileName: input.fileName,
416
+ mimeType: input.mimeType
417
+ }
418
+ };
419
+ break;
420
+ }
421
+ if (options.mode === "hashinal") {
422
+ request.metadataObject = options.metadata;
423
+ request.creator = options.metadata?.creator || accountId;
424
+ request.description = options.metadata?.description;
425
+ if (options.jsonFileURL) {
426
+ request.jsonFileURL = options.jsonFileURL;
427
+ }
428
+ }
429
+ logger.debug("Starting inscription via startInscription (websocket)", {
430
+ type: input.type,
431
+ mode: options.mode || "file",
432
+ holderId: accountId,
433
+ usesStartInscription: true
434
+ });
435
+ const startResult = await sdk.startInscription({
436
+ ...request,
437
+ holderId: accountId,
438
+ network: options.network || "mainnet"
162
439
  });
440
+ logger.info("about to start inscription", {
441
+ type: input.type,
442
+ mode: options.mode || "file",
443
+ jobId: startResult.id || startResult.tx_id,
444
+ ...startResult
445
+ });
446
+ if (typeof startResult?.transactionBytes === "string") {
447
+ logger.debug("Executing inscription transaction with signer from bytes");
448
+ await sdk.executeTransactionWithSigner(
449
+ startResult.transactionBytes,
450
+ signer
451
+ );
452
+ } else if (startResult?.transactionBytes?.type === "Buffer") {
453
+ logger.debug("Executing inscription transaction with signer from buffer");
454
+ await sdk.executeTransactionWithSigner(
455
+ Buffer.from(startResult.transactionBytes.data).toString("base64"),
456
+ signer
457
+ );
458
+ }
459
+ const trackingId = normalizeTransactionId(
460
+ startResult.tx_id || startResult.id || ""
461
+ );
462
+ const waitId = normalizeTransactionId(
463
+ trackingId || startResult.id || startResult.tx_id || ""
464
+ );
465
+ if (options.waitForConfirmation) {
466
+ logger.debug("Waiting for inscription confirmation (websocket)", {
467
+ jobId: startResult.id || startResult.tx_id,
468
+ maxAttempts: options.waitMaxAttempts,
469
+ intervalMs: options.waitIntervalMs
470
+ });
471
+ const inscription = await waitForInscriptionConfirmation(
472
+ sdk,
473
+ waitId,
474
+ options.waitMaxAttempts,
475
+ options.waitIntervalMs,
476
+ options.progressCallback
477
+ );
478
+ logger.info("Inscription confirmation received", {
479
+ jobId: waitId
480
+ });
481
+ return {
482
+ confirmed: true,
483
+ result: {
484
+ jobId: waitId,
485
+ transactionId: waitId,
486
+ topic_id: startResult.topic_id,
487
+ status: startResult.status,
488
+ completed: startResult.completed
489
+ },
490
+ inscription,
491
+ sdk,
492
+ costSummary: await resolveInscriptionCost(
493
+ waitId,
494
+ options.network || "mainnet",
495
+ options.logging?.level
496
+ )
497
+ };
498
+ }
499
+ return {
500
+ confirmed: false,
501
+ result: {
502
+ jobId: waitId,
503
+ transactionId: waitId,
504
+ topic_id: startResult.topic_id,
505
+ status: startResult.status,
506
+ completed: startResult.completed
507
+ },
508
+ sdk,
509
+ costSummary: await resolveInscriptionCost(
510
+ waitId,
511
+ options.network || "mainnet",
512
+ options.logging?.level
513
+ )
514
+ };
515
+ } catch (error) {
516
+ logger.error("Error during inscription process", error);
517
+ throw error;
163
518
  }
164
- sdkCache.set(cacheConfig, sdk);
165
- return sdk;
166
- }
167
- function getCachedQuote(input, clientConfig, options) {
168
- const cacheKey = quoteCache.createCacheKey(input, clientConfig, options);
169
- return quoteCache.get(cacheKey);
170
519
  }
171
- function cacheQuote(input, clientConfig, options, quote) {
172
- const cacheKey = quoteCache.createCacheKey(input, clientConfig, options);
173
- const quoteTtlMs = 10 * 60 * 1e3;
174
- quoteCache.set(cacheKey, quote, quoteTtlMs);
175
- }
176
- function validateQuoteParameters(input, clientConfig, options) {
177
- if (!input || typeof input !== "object" || !("type" in input)) {
178
- throw new Error("Invalid inscription input: type is required");
179
- }
180
- if (!clientConfig || !clientConfig.accountId) {
181
- throw new Error("Invalid client config: accountId is required");
520
+ async function retrieveInscription(transactionId, options) {
521
+ const logger = Logger.getInstance({
522
+ module: "Inscriber",
523
+ ...options?.logging || {}
524
+ });
525
+ const formattedTransactionId = transactionId.includes("@") ? `${transactionId.split("@")[0]}-${transactionId.split("@")[1].replace(/\./g, "-")}` : transactionId;
526
+ logger.info("Retrieving inscription", {
527
+ originalTransactionId: transactionId,
528
+ formattedTransactionId
529
+ });
530
+ try {
531
+ let sdk;
532
+ if (options?.apiKey) {
533
+ logger.debug("Initializing InscriptionSDK with API key");
534
+ sdk = new InscriptionSDK({
535
+ apiKey: options.apiKey,
536
+ network: options.network || "mainnet"
537
+ });
538
+ } else if (options?.accountId && options?.privateKey) {
539
+ logger.debug("Initializing InscriptionSDK with server auth");
540
+ sdk = await InscriptionSDK.createWithAuth({
541
+ type: "server",
542
+ accountId: options.accountId,
543
+ privateKey: options.privateKey,
544
+ network: options.network || "mainnet"
545
+ });
546
+ } else {
547
+ const error = new Error(
548
+ "Either API key or account ID and private key are required for retrieving inscriptions"
549
+ );
550
+ logger.error("Missing authentication credentials", {
551
+ hasApiKey: Boolean(options?.apiKey),
552
+ hasAccountId: Boolean(options?.accountId),
553
+ hasPrivateKey: Boolean(options?.privateKey)
554
+ });
555
+ throw error;
556
+ }
557
+ logger.debug("Initialized SDK for inscription retrieval", {
558
+ formattedTransactionId,
559
+ network: options.network || "mainnet"
560
+ });
561
+ const result = await sdk.retrieveInscription(formattedTransactionId);
562
+ logger.info("Successfully retrieved inscription", {
563
+ formattedTransactionId
564
+ });
565
+ return result;
566
+ } catch (error) {
567
+ logger.error("Error retrieving inscription", {
568
+ formattedTransactionId,
569
+ error
570
+ });
571
+ throw error;
182
572
  }
183
- if (!options) {
184
- throw new Error("Options are required");
573
+ }
574
+ function validateHashinalMetadata(metadata, logger) {
575
+ const requiredFields = ["name", "creator", "description", "type"];
576
+ const missingFields = requiredFields.filter((field) => !metadata[field]);
577
+ if (missingFields.length > 0) {
578
+ const error = new Error(
579
+ `Missing required Hashinal metadata fields: ${missingFields.join(", ")}`
580
+ );
581
+ logger.error("Hashinal metadata validation failed", { missingFields });
582
+ throw error;
185
583
  }
186
- if (options.mode === "hashinal") {
187
- if (!options.metadata) {
188
- throw new Error("Hashinal mode requires metadata");
584
+ logger.debug("Hashinal metadata validation passed", {
585
+ name: metadata.name,
586
+ creator: metadata.creator,
587
+ description: metadata.description,
588
+ type: metadata.type,
589
+ hasAttributes: !!metadata.attributes,
590
+ hasProperties: !!metadata.properties
591
+ });
592
+ }
593
+ async function generateQuote(input, clientConfig, options, existingSDK) {
594
+ const logger = Logger.getInstance({
595
+ module: "Inscriber",
596
+ ...options.logging
597
+ });
598
+ logger.info("Generating inscription quote", {
599
+ type: input.type,
600
+ mode: options.mode || "file",
601
+ ...input.type === "url" ? { url: input.url } : {},
602
+ ...input.type === "file" ? { path: input.path } : {},
603
+ ...input.type === "buffer" ? { fileName: input.fileName, bufferSize: input.buffer.byteLength } : {}
604
+ });
605
+ try {
606
+ validateQuoteParameters(input, clientConfig, options);
607
+ const cachedQuote = getCachedQuote(input, clientConfig, options);
608
+ if (cachedQuote) {
609
+ logger.debug("Returning cached quote");
610
+ return {
611
+ confirmed: false,
612
+ quote: true,
613
+ result: cachedQuote
614
+ };
615
+ }
616
+ if (options.mode === "hashinal" && options.metadata) {
617
+ validateHashinalMetadata(options.metadata, logger);
618
+ }
619
+ const sdk = await getOrCreateSDK(clientConfig, options, existingSDK);
620
+ const baseRequest = {
621
+ holderId: clientConfig.accountId,
622
+ metadata: options.metadata || {},
623
+ tags: options.tags || [],
624
+ mode: options.mode || "file",
625
+ fileStandard: options.fileStandard,
626
+ chunkSize: options.chunkSize
627
+ };
628
+ let request;
629
+ switch (input.type) {
630
+ case "url":
631
+ request = {
632
+ ...baseRequest,
633
+ file: {
634
+ type: "url",
635
+ url: input.url
636
+ }
637
+ };
638
+ break;
639
+ case "file": {
640
+ const fileData = await convertFileToBase64(input.path);
641
+ request = {
642
+ ...baseRequest,
643
+ file: {
644
+ type: "base64",
645
+ base64: fileData.base64,
646
+ fileName: fileData.fileName,
647
+ mimeType: fileData.mimeType
648
+ }
649
+ };
650
+ break;
651
+ }
652
+ case "buffer":
653
+ request = {
654
+ ...baseRequest,
655
+ file: {
656
+ type: "base64",
657
+ base64: Buffer.from(
658
+ input.buffer instanceof ArrayBuffer ? new Uint8Array(input.buffer) : input.buffer
659
+ ).toString("base64"),
660
+ fileName: input.fileName,
661
+ mimeType: input.mimeType
662
+ }
663
+ };
664
+ break;
665
+ }
666
+ if (options.mode === "hashinal") {
667
+ request.metadataObject = options.metadata;
668
+ request.creator = options.metadata?.creator || clientConfig.accountId;
669
+ request.description = options.metadata?.description;
670
+ if (options.jsonFileURL) {
671
+ request.jsonFileURL = options.jsonFileURL;
672
+ }
189
673
  }
190
- const requiredFields = ["name", "creator", "description", "type"];
191
- const missingFields = requiredFields.filter(
192
- (field) => !options.metadata || !options.metadata[field]
674
+ logger.debug("Calling inscription SDK startInscription for quote", {
675
+ type: input.type,
676
+ mode: options.mode || "file",
677
+ holderId: clientConfig.accountId
678
+ });
679
+ const inscriptionResponse = await sdk.startInscription(request);
680
+ logger.debug("Received inscription response for quote parsing", {
681
+ hasTransactionBytes: !!inscriptionResponse.transactionBytes,
682
+ bytesLength: inscriptionResponse.transactionBytes?.length || 0,
683
+ transactionBytesType: typeof inscriptionResponse.transactionBytes,
684
+ totalCost: inscriptionResponse.totalCost
685
+ });
686
+ const quote = await parseTransactionForQuote(
687
+ inscriptionResponse,
688
+ logger
193
689
  );
194
- if (missingFields.length > 0) {
195
- throw new Error(
196
- `Missing required Hashinal metadata fields: ${missingFields.join(", ")}`
690
+ cacheQuote(input, clientConfig, options, quote);
691
+ logger.info("Successfully generated inscription quote", {
692
+ totalCostHbar: quote.totalCostHbar
693
+ });
694
+ return {
695
+ confirmed: false,
696
+ quote: true,
697
+ result: quote
698
+ };
699
+ } catch (error) {
700
+ logger.error("Error generating inscription quote", error);
701
+ throw error;
702
+ }
703
+ }
704
+ async function parseTransactionForQuote(inscriptionResponse, logger) {
705
+ try {
706
+ let totalCostHbar = "0.001";
707
+ if (inscriptionResponse.totalCost && typeof inscriptionResponse.totalCost === "number") {
708
+ const hbarAmount = inscriptionResponse.totalCost / 1e8;
709
+ totalCostHbar = hbarAmount.toString();
710
+ logger.debug("Using totalCost from inscription response", {
711
+ totalCostTinybars: inscriptionResponse.totalCost,
712
+ totalCostHbar
713
+ });
714
+ } else if (inscriptionResponse.transactionBytes) {
715
+ logger.debug("Parsing transaction bytes for cost information");
716
+ try {
717
+ let transactionBytesString;
718
+ if (typeof inscriptionResponse.transactionBytes === "string") {
719
+ transactionBytesString = inscriptionResponse.transactionBytes;
720
+ } else if (inscriptionResponse.transactionBytes && typeof inscriptionResponse.transactionBytes === "object" && "data" in inscriptionResponse.transactionBytes) {
721
+ const buffer = Buffer.from(inscriptionResponse.transactionBytes.data);
722
+ transactionBytesString = buffer.toString("base64");
723
+ } else {
724
+ throw new Error("Invalid transactionBytes format");
725
+ }
726
+ logger.debug("About to parse transaction bytes", {
727
+ bytesLength: transactionBytesString.length,
728
+ bytesPreview: transactionBytesString.slice(0, 100)
729
+ });
730
+ const parsedTransaction = await TransactionParser.parseTransactionBytes(
731
+ transactionBytesString,
732
+ { includeRaw: false }
733
+ );
734
+ logger.debug("Parsed transaction for quote", {
735
+ type: parsedTransaction.type,
736
+ hasTransfers: !!parsedTransaction.transfers,
737
+ transferCount: parsedTransaction.transfers?.length || 0,
738
+ transfers: parsedTransaction.transfers
739
+ });
740
+ let totalTransferAmount = 0;
741
+ if (parsedTransaction.transfers && parsedTransaction.transfers.length > 0) {
742
+ for (const transfer of parsedTransaction.transfers) {
743
+ const transferAmount = typeof transfer.amount === "string" ? parseFloat(transfer.amount) : transfer.amount;
744
+ if (transferAmount < 0) {
745
+ const amountHbar = Math.abs(transferAmount);
746
+ totalTransferAmount += amountHbar;
747
+ logger.debug("Found HBAR transfer", {
748
+ from: transfer.accountId,
749
+ to: "service",
750
+ amount: amountHbar
751
+ });
752
+ }
753
+ }
754
+ }
755
+ if (totalTransferAmount > 0) {
756
+ totalCostHbar = totalTransferAmount.toString();
757
+ logger.debug("Using parsed transaction transfer amount", {
758
+ totalTransferAmount,
759
+ totalCostHbar
760
+ });
761
+ }
762
+ } catch (parseError) {
763
+ logger.warn(
764
+ "Could not parse transaction bytes, using totalCost fallback",
765
+ {
766
+ error: parseError,
767
+ errorMessage: parseError instanceof Error ? parseError.message : String(parseError)
768
+ }
769
+ );
770
+ }
771
+ }
772
+ const transfers = [
773
+ {
774
+ to: "Inscription Service",
775
+ amount: totalCostHbar,
776
+ description: `Inscription fee (${totalCostHbar} HBAR)`
777
+ }
778
+ ];
779
+ const validUntil = new Date(Date.now() + 15 * 60 * 1e3).toISOString();
780
+ const quote = {
781
+ totalCostHbar,
782
+ validUntil,
783
+ breakdown: {
784
+ transfers
785
+ }
786
+ };
787
+ logger.debug("Successfully parsed transaction for quote", {
788
+ totalCostHbar: quote.totalCostHbar,
789
+ transferCount: transfers.length,
790
+ hasTransactionBytes: !!inscriptionResponse.transactionBytes,
791
+ hasTotalCost: !!inscriptionResponse.totalCost
792
+ });
793
+ return quote;
794
+ } catch (error) {
795
+ logger.error("Error parsing transaction for quote", error);
796
+ throw error;
797
+ }
798
+ }
799
+ async function waitForInscriptionConfirmation(sdk, transactionId, maxAttempts = 30, intervalMs = 4e3, progressCallback) {
800
+ const logger = Logger.getInstance({ module: "Inscriber" });
801
+ const normalizedId = normalizeTransactionId(transactionId);
802
+ const progressReporter = new ProgressReporter({
803
+ module: "Inscriber",
804
+ logger,
805
+ callback: progressCallback
806
+ });
807
+ try {
808
+ logger.debug("Waiting for inscription confirmation", {
809
+ transactionId: normalizedId,
810
+ maxAttempts,
811
+ intervalMs
812
+ });
813
+ progressReporter.preparing("Preparing for inscription confirmation", 5, {
814
+ transactionId: normalizedId,
815
+ maxAttempts,
816
+ intervalMs
817
+ });
818
+ try {
819
+ const waitMethod = sdk.waitForInscription.bind(sdk);
820
+ const wrappedCallback = (data) => {
821
+ const stageRaw = data.stage || "confirming";
822
+ const allowedStages = [
823
+ "preparing",
824
+ "submitting",
825
+ "confirming",
826
+ "verifying",
827
+ "completed",
828
+ "failed"
829
+ ];
830
+ const stage = allowedStages.includes(stageRaw) ? stageRaw : "confirming";
831
+ const message = data.message || "Processing inscription";
832
+ const percent = data.progressPercent || 50;
833
+ progressReporter.report({
834
+ stage,
835
+ message,
836
+ progressPercent: percent,
837
+ details: data.details
838
+ });
839
+ };
840
+ return await waitMethod(
841
+ normalizedId,
842
+ maxAttempts,
843
+ intervalMs,
844
+ true,
845
+ wrappedCallback
846
+ );
847
+ } catch (e) {
848
+ logger.debug("Falling back to standard waitForInscription method", {
849
+ error: e
850
+ });
851
+ progressReporter.verifying("Verifying inscription status", 50, {
852
+ error: e
853
+ });
854
+ return await sdk.waitForInscription(
855
+ normalizedId,
856
+ maxAttempts,
857
+ intervalMs,
858
+ true
197
859
  );
198
860
  }
861
+ } catch (error) {
862
+ logger.error("Error waiting for inscription confirmation", {
863
+ transactionId,
864
+ maxAttempts,
865
+ intervalMs,
866
+ error
867
+ });
868
+ progressReporter.failed("Inscription confirmation failed", {
869
+ transactionId,
870
+ error
871
+ });
872
+ throw error;
199
873
  }
200
874
  }
201
875
  export {
202
- cacheQuote,
203
- getCachedQuote,
204
- getOrCreateSDK,
205
- validateQuoteParameters
876
+ generateQuote,
877
+ inscribe,
878
+ inscribeWithSigner,
879
+ normalizeTransactionId,
880
+ retrieveInscription,
881
+ waitForInscriptionConfirmation
206
882
  };
207
883
  //# sourceMappingURL=standards-sdk.es125.js.map