@ecency/sdk 2.4.21 → 2.4.22

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 (516) hide show
  1. package/dist/browser/{chunk-JORE46WK.js → chunk-2EYZMIWD.js} +2 -2
  2. package/dist/browser/{chunk-JORE46WK.js.map → chunk-2EYZMIWD.js.map} +1 -1
  3. package/dist/browser/{chunk-N3JLKXGY.js → chunk-2MIOCMJB.js} +2 -2
  4. package/dist/browser/{chunk-N3JLKXGY.js.map → chunk-2MIOCMJB.js.map} +1 -1
  5. package/dist/browser/{chunk-EU3FL3RJ.js → chunk-2PMKAOIU.js} +2 -2
  6. package/dist/browser/{chunk-EU3FL3RJ.js.map → chunk-2PMKAOIU.js.map} +1 -1
  7. package/dist/browser/{chunk-HESIUSO3.js → chunk-3DS7HIZ6.js} +2 -2
  8. package/dist/browser/{chunk-HESIUSO3.js.map → chunk-3DS7HIZ6.js.map} +1 -1
  9. package/dist/browser/{chunk-RVXGI5TW.js → chunk-4EL7BARO.js} +2 -2
  10. package/dist/browser/{chunk-RVXGI5TW.js.map → chunk-4EL7BARO.js.map} +1 -1
  11. package/dist/browser/{chunk-6DDGZBMD.js → chunk-4JZTDTIL.js} +2 -2
  12. package/dist/browser/{chunk-6DDGZBMD.js.map → chunk-4JZTDTIL.js.map} +1 -1
  13. package/dist/browser/{chunk-7B5LNIZJ.js → chunk-4NADA62G.js} +2 -2
  14. package/dist/browser/{chunk-7B5LNIZJ.js.map → chunk-4NADA62G.js.map} +1 -1
  15. package/dist/browser/{chunk-SQZKXKLW.js → chunk-57A4DG2S.js} +2 -2
  16. package/dist/browser/{chunk-SQZKXKLW.js.map → chunk-57A4DG2S.js.map} +1 -1
  17. package/dist/browser/{chunk-GQGDHPRQ.js → chunk-5BITQZND.js} +2 -2
  18. package/dist/browser/{chunk-GQGDHPRQ.js.map → chunk-5BITQZND.js.map} +1 -1
  19. package/dist/browser/{chunk-RJNZILJR.js → chunk-62ME2K4P.js} +2 -2
  20. package/dist/browser/{chunk-RJNZILJR.js.map → chunk-62ME2K4P.js.map} +1 -1
  21. package/dist/browser/{chunk-FVLWW7QJ.js → chunk-6ARQ76GD.js} +2 -2
  22. package/dist/browser/{chunk-FVLWW7QJ.js.map → chunk-6ARQ76GD.js.map} +1 -1
  23. package/dist/browser/{chunk-Q6EALMA3.js → chunk-7334637K.js} +2 -2
  24. package/dist/browser/{chunk-Q6EALMA3.js.map → chunk-7334637K.js.map} +1 -1
  25. package/dist/browser/{chunk-XTYTT3BK.js → chunk-7JPEXH7J.js} +2 -2
  26. package/dist/browser/{chunk-XTYTT3BK.js.map → chunk-7JPEXH7J.js.map} +1 -1
  27. package/dist/browser/{chunk-VWPIV7DW.js → chunk-7OD25PBQ.js} +2 -2
  28. package/dist/browser/{chunk-VWPIV7DW.js.map → chunk-7OD25PBQ.js.map} +1 -1
  29. package/dist/browser/{chunk-H6FI5RUB.js → chunk-7Q3WCU66.js} +2 -2
  30. package/dist/browser/{chunk-H6FI5RUB.js.map → chunk-7Q3WCU66.js.map} +1 -1
  31. package/dist/browser/{chunk-BUHCN53D.js → chunk-7THEMMDR.js} +2 -2
  32. package/dist/browser/{chunk-BUHCN53D.js.map → chunk-7THEMMDR.js.map} +1 -1
  33. package/dist/browser/{chunk-UBIHDHZY.js → chunk-A4RVVIA6.js} +2 -2
  34. package/dist/browser/{chunk-UBIHDHZY.js.map → chunk-A4RVVIA6.js.map} +1 -1
  35. package/dist/browser/{chunk-2TIZBQHI.js → chunk-AOY46Q5S.js} +2 -2
  36. package/dist/browser/{chunk-2TIZBQHI.js.map → chunk-AOY46Q5S.js.map} +1 -1
  37. package/dist/browser/{chunk-EJCGBTQE.js → chunk-AW5VCJIZ.js} +2 -2
  38. package/dist/browser/{chunk-EJCGBTQE.js.map → chunk-AW5VCJIZ.js.map} +1 -1
  39. package/dist/browser/{chunk-2JN4EIJE.js → chunk-C5PSLR7Z.js} +2 -2
  40. package/dist/browser/{chunk-2JN4EIJE.js.map → chunk-C5PSLR7Z.js.map} +1 -1
  41. package/dist/browser/{chunk-TOQBNISU.js → chunk-CNDSORAV.js} +2 -2
  42. package/dist/browser/{chunk-TOQBNISU.js.map → chunk-CNDSORAV.js.map} +1 -1
  43. package/dist/browser/{chunk-MPLLD6WX.js → chunk-CQTLGJKX.js} +2 -2
  44. package/dist/browser/{chunk-MPLLD6WX.js.map → chunk-CQTLGJKX.js.map} +1 -1
  45. package/dist/browser/{chunk-24GIDC32.js → chunk-F3U2P5JK.js} +2 -2
  46. package/dist/browser/{chunk-24GIDC32.js.map → chunk-F3U2P5JK.js.map} +1 -1
  47. package/dist/browser/{chunk-ADAK5AIP.js → chunk-FFTSEIYV.js} +2 -2
  48. package/dist/browser/{chunk-ADAK5AIP.js.map → chunk-FFTSEIYV.js.map} +1 -1
  49. package/dist/browser/{chunk-SHZTS2C3.js → chunk-FH2NXTZ6.js} +2 -2
  50. package/dist/browser/{chunk-SHZTS2C3.js.map → chunk-FH2NXTZ6.js.map} +1 -1
  51. package/dist/browser/{chunk-KDR4M45T.js → chunk-FU2GC2LE.js} +2 -2
  52. package/dist/browser/{chunk-KDR4M45T.js.map → chunk-FU2GC2LE.js.map} +1 -1
  53. package/dist/browser/chunk-FZ4CS2GG.js +2 -0
  54. package/dist/browser/{chunk-PHNYLTEH.js.map → chunk-FZ4CS2GG.js.map} +1 -1
  55. package/dist/browser/{chunk-PGMEWW46.js → chunk-GB3HQFYD.js} +2 -2
  56. package/dist/browser/{chunk-PGMEWW46.js.map → chunk-GB3HQFYD.js.map} +1 -1
  57. package/dist/browser/{chunk-J3RZOR3T.js → chunk-GFXGKAUS.js} +2 -2
  58. package/dist/browser/{chunk-J3RZOR3T.js.map → chunk-GFXGKAUS.js.map} +1 -1
  59. package/dist/browser/{chunk-44EOXEIC.js → chunk-GNVQHSS3.js} +2 -2
  60. package/dist/browser/{chunk-44EOXEIC.js.map → chunk-GNVQHSS3.js.map} +1 -1
  61. package/dist/browser/{chunk-LL4YZLL2.js → chunk-HO6CZGVL.js} +2 -2
  62. package/dist/browser/{chunk-LL4YZLL2.js.map → chunk-HO6CZGVL.js.map} +1 -1
  63. package/dist/browser/{chunk-LHABXX5K.js → chunk-IF3OTURI.js} +2 -2
  64. package/dist/browser/{chunk-LHABXX5K.js.map → chunk-IF3OTURI.js.map} +1 -1
  65. package/dist/browser/{chunk-YN34NTWC.js → chunk-ILKK5VBZ.js} +2 -2
  66. package/dist/browser/{chunk-YN34NTWC.js.map → chunk-ILKK5VBZ.js.map} +1 -1
  67. package/dist/browser/chunk-IMCYKBDV.js +2 -0
  68. package/dist/browser/chunk-IMCYKBDV.js.map +1 -0
  69. package/dist/browser/chunk-J2HM6MWA.js +2 -0
  70. package/dist/browser/{chunk-K2DAN37J.js.map → chunk-J2HM6MWA.js.map} +1 -1
  71. package/dist/browser/{chunk-6KVHZTYP.js → chunk-LNFPNBAR.js} +2 -2
  72. package/dist/browser/{chunk-6KVHZTYP.js.map → chunk-LNFPNBAR.js.map} +1 -1
  73. package/dist/browser/{chunk-QXRJ3Q4Y.js → chunk-MBDFLDIN.js} +2 -2
  74. package/dist/browser/{chunk-QXRJ3Q4Y.js.map → chunk-MBDFLDIN.js.map} +1 -1
  75. package/dist/browser/{chunk-M3OC7IZG.js → chunk-MR5OYU27.js} +2 -2
  76. package/dist/browser/{chunk-M3OC7IZG.js.map → chunk-MR5OYU27.js.map} +1 -1
  77. package/dist/browser/{chunk-YK7FPU3F.js → chunk-NFO2YHLK.js} +2 -2
  78. package/dist/browser/{chunk-YK7FPU3F.js.map → chunk-NFO2YHLK.js.map} +1 -1
  79. package/dist/browser/{chunk-2MLEAT6V.js → chunk-NHKKPEA7.js} +2 -2
  80. package/dist/browser/{chunk-2MLEAT6V.js.map → chunk-NHKKPEA7.js.map} +1 -1
  81. package/dist/browser/{chunk-6YZ7OSX2.js → chunk-OA7EP5SN.js} +2 -2
  82. package/dist/browser/{chunk-6YZ7OSX2.js.map → chunk-OA7EP5SN.js.map} +1 -1
  83. package/dist/browser/{chunk-7BGXFJVA.js → chunk-OMF5YUFB.js} +2 -2
  84. package/dist/browser/{chunk-7BGXFJVA.js.map → chunk-OMF5YUFB.js.map} +1 -1
  85. package/dist/browser/{chunk-37N2QITX.js → chunk-ONRD3CRU.js} +2 -2
  86. package/dist/browser/{chunk-37N2QITX.js.map → chunk-ONRD3CRU.js.map} +1 -1
  87. package/dist/browser/{chunk-KJUSI6PP.js → chunk-OUIU7KNA.js} +2 -2
  88. package/dist/browser/{chunk-KJUSI6PP.js.map → chunk-OUIU7KNA.js.map} +1 -1
  89. package/dist/browser/{chunk-DX47GSLU.js → chunk-PTXAORWB.js} +2 -2
  90. package/dist/browser/{chunk-DX47GSLU.js.map → chunk-PTXAORWB.js.map} +1 -1
  91. package/dist/browser/{chunk-J3PY2B6H.js → chunk-Q56WX4Q4.js} +2 -2
  92. package/dist/browser/{chunk-J3PY2B6H.js.map → chunk-Q56WX4Q4.js.map} +1 -1
  93. package/dist/browser/{chunk-EYKUJB3F.js → chunk-QQ7MZFRE.js} +2 -2
  94. package/dist/browser/{chunk-EYKUJB3F.js.map → chunk-QQ7MZFRE.js.map} +1 -1
  95. package/dist/browser/{chunk-JDVR32ZT.js → chunk-QXYS66KZ.js} +2 -2
  96. package/dist/browser/{chunk-JDVR32ZT.js.map → chunk-QXYS66KZ.js.map} +1 -1
  97. package/dist/browser/{chunk-DCYSEIIY.js → chunk-RRF5H53D.js} +2 -2
  98. package/dist/browser/{chunk-DCYSEIIY.js.map → chunk-RRF5H53D.js.map} +1 -1
  99. package/dist/browser/{chunk-BLLAF3XJ.js → chunk-SHWRGBMD.js} +2 -2
  100. package/dist/browser/{chunk-BLLAF3XJ.js.map → chunk-SHWRGBMD.js.map} +1 -1
  101. package/dist/browser/{chunk-2HXQJNAQ.js → chunk-SXUNJC2V.js} +2 -2
  102. package/dist/browser/{chunk-2HXQJNAQ.js.map → chunk-SXUNJC2V.js.map} +1 -1
  103. package/dist/browser/{chunk-DLRAARGY.js → chunk-TUFXYNHE.js} +2 -2
  104. package/dist/browser/{chunk-DLRAARGY.js.map → chunk-TUFXYNHE.js.map} +1 -1
  105. package/dist/browser/{chunk-T5Y7X4JU.js → chunk-TUL2MGVZ.js} +2 -2
  106. package/dist/browser/{chunk-T5Y7X4JU.js.map → chunk-TUL2MGVZ.js.map} +1 -1
  107. package/dist/browser/{chunk-NXYHJZ5U.js → chunk-UUNZHPWM.js} +2 -2
  108. package/dist/browser/{chunk-NXYHJZ5U.js.map → chunk-UUNZHPWM.js.map} +1 -1
  109. package/dist/browser/{chunk-BK4LRFXY.js → chunk-VDQYQAHM.js} +2 -2
  110. package/dist/browser/{chunk-BK4LRFXY.js.map → chunk-VDQYQAHM.js.map} +1 -1
  111. package/dist/browser/{chunk-MR4YHEKX.js → chunk-VPRG4WZA.js} +2 -2
  112. package/dist/browser/{chunk-MR4YHEKX.js.map → chunk-VPRG4WZA.js.map} +1 -1
  113. package/dist/browser/{chunk-UXF4JZOD.js → chunk-XEB43J5Q.js} +2 -2
  114. package/dist/browser/chunk-XEB43J5Q.js.map +1 -0
  115. package/dist/browser/{chunk-5XMAKC7Z.js → chunk-XHZFIDDV.js} +2 -2
  116. package/dist/browser/{chunk-5XMAKC7Z.js.map → chunk-XHZFIDDV.js.map} +1 -1
  117. package/dist/browser/{chunk-UM2REEE6.js → chunk-XKIXQLFN.js} +2 -2
  118. package/dist/browser/{chunk-UM2REEE6.js.map → chunk-XKIXQLFN.js.map} +1 -1
  119. package/dist/browser/{chunk-4P3LD6GI.js → chunk-YIBHO7CN.js} +2 -2
  120. package/dist/browser/{chunk-4P3LD6GI.js.map → chunk-YIBHO7CN.js.map} +1 -1
  121. package/dist/browser/{chunk-TUDWKSAB.js → chunk-YMBKK3WL.js} +2 -2
  122. package/dist/browser/{chunk-TUDWKSAB.js.map → chunk-YMBKK3WL.js.map} +1 -1
  123. package/dist/browser/{chunk-U74BMWFM.js → chunk-Z2PD74DL.js} +2 -2
  124. package/dist/browser/{chunk-U74BMWFM.js.map → chunk-Z2PD74DL.js.map} +1 -1
  125. package/dist/browser/{chunk-S22HXPZL.js → chunk-ZKS444CY.js} +2 -2
  126. package/dist/browser/{chunk-S22HXPZL.js.map → chunk-ZKS444CY.js.map} +1 -1
  127. package/dist/browser/{hive-DkEPbBoe.d.ts → hive-BtyYkHAm.d.ts} +14 -1
  128. package/dist/browser/hive-tx/Transaction.js +1 -1
  129. package/dist/browser/hive-tx/index.js +1 -1
  130. package/dist/browser/hive.d.ts +1 -1
  131. package/dist/browser/hive.js +1 -1
  132. package/dist/browser/index.d.ts +2 -2
  133. package/dist/browser/index.js +1 -1
  134. package/dist/browser/modules/accounts/index.js +1 -1
  135. package/dist/browser/modules/accounts/mutations/bookmarks/index.js +1 -1
  136. package/dist/browser/modules/accounts/mutations/bookmarks/use-account-bookmark-add.js +1 -1
  137. package/dist/browser/modules/accounts/mutations/bookmarks/use-account-bookmark-delete.js +1 -1
  138. package/dist/browser/modules/accounts/mutations/favorite-tags/index.js +1 -1
  139. package/dist/browser/modules/accounts/mutations/favorite-tags/requests.js +1 -1
  140. package/dist/browser/modules/accounts/mutations/favorite-tags/use-favorite-tag-add.js +1 -1
  141. package/dist/browser/modules/accounts/mutations/favorite-tags/use-favorite-tag-delete.js +1 -1
  142. package/dist/browser/modules/accounts/mutations/favorites/index.js +1 -1
  143. package/dist/browser/modules/accounts/mutations/favorites/use-account-favorite-add.js +1 -1
  144. package/dist/browser/modules/accounts/mutations/favorites/use-account-favorite-delete.js +1 -1
  145. package/dist/browser/modules/accounts/mutations/index.js +1 -1
  146. package/dist/browser/modules/accounts/mutations/use-account-relations-update.js +1 -1
  147. package/dist/browser/modules/accounts/mutations/use-account-revoke-key.js +1 -1
  148. package/dist/browser/modules/accounts/mutations/use-account-revoke-posting.js +1 -1
  149. package/dist/browser/modules/accounts/mutations/use-account-update-key-auths.js +1 -1
  150. package/dist/browser/modules/accounts/mutations/use-account-update-password.js +1 -1
  151. package/dist/browser/modules/accounts/mutations/use-account-update-recovery.js +1 -1
  152. package/dist/browser/modules/accounts/mutations/use-account-update.js +1 -1
  153. package/dist/browser/modules/accounts/mutations/use-claim-account.js +1 -1
  154. package/dist/browser/modules/accounts/mutations/use-create-account.js +1 -1
  155. package/dist/browser/modules/accounts/mutations/use-follow.js +1 -1
  156. package/dist/browser/modules/accounts/mutations/use-grant-posting-permission.js +1 -1
  157. package/dist/browser/modules/accounts/mutations/use-unfollow.js +1 -1
  158. package/dist/browser/modules/accounts/queries/check-favorite-query-options.js +1 -1
  159. package/dist/browser/modules/accounts/queries/check-username-wallets-pending-query-options.js +1 -1
  160. package/dist/browser/modules/accounts/queries/get-account-full-query-options.js +1 -1
  161. package/dist/browser/modules/accounts/queries/get-account-pending-recovery-query-options.js +1 -1
  162. package/dist/browser/modules/accounts/queries/get-account-recoveries-query-options.js +1 -1
  163. package/dist/browser/modules/accounts/queries/get-account-reputations-query-options.js +1 -1
  164. package/dist/browser/modules/accounts/queries/get-account-subscriptions-query-options.js +1 -1
  165. package/dist/browser/modules/accounts/queries/get-account-vote-history-infinite-query-options.js +1 -1
  166. package/dist/browser/modules/accounts/queries/get-accounts-query-options.js +1 -1
  167. package/dist/browser/modules/accounts/queries/get-aggregated-balance-query-options.js +1 -1
  168. package/dist/browser/modules/accounts/queries/get-balance-history-query-options.js +1 -1
  169. package/dist/browser/modules/accounts/queries/get-bookmarks-query-options.js +1 -1
  170. package/dist/browser/modules/accounts/queries/get-bots-query-options.js +1 -1
  171. package/dist/browser/modules/accounts/queries/get-favorite-tag-check-query-options.js +1 -1
  172. package/dist/browser/modules/accounts/queries/get-favorite-tags-query-options.js +1 -1
  173. package/dist/browser/modules/accounts/queries/get-favorites-query-options.js +1 -1
  174. package/dist/browser/modules/accounts/queries/get-follow-count-query-options.js +1 -1
  175. package/dist/browser/modules/accounts/queries/get-followers-query-options.js +1 -1
  176. package/dist/browser/modules/accounts/queries/get-following-query-options.js +1 -1
  177. package/dist/browser/modules/accounts/queries/get-friends-infinite-query-options.js +1 -1
  178. package/dist/browser/modules/accounts/queries/get-muted-users-query-options.js +1 -1
  179. package/dist/browser/modules/accounts/queries/get-pro-members-query-options.js +1 -1
  180. package/dist/browser/modules/accounts/queries/get-profiles-query-options.js +1 -1
  181. package/dist/browser/modules/accounts/queries/get-referrals-infinite-query-options.js +1 -1
  182. package/dist/browser/modules/accounts/queries/get-referrals-stats-query-options.js +1 -1
  183. package/dist/browser/modules/accounts/queries/get-relationship-between-accounts-query-options.js +1 -1
  184. package/dist/browser/modules/accounts/queries/get-search-friends-query-options.js +1 -1
  185. package/dist/browser/modules/accounts/queries/get-transactions-infinite-query-options.js +1 -1
  186. package/dist/browser/modules/accounts/queries/index.js +1 -1
  187. package/dist/browser/modules/accounts/queries/lookup-accounts-query-options.js +1 -1
  188. package/dist/browser/modules/accounts/queries/search-accounts-by-username-query-options.js +1 -1
  189. package/dist/browser/modules/accounts/utils/account-power.js +1 -1
  190. package/dist/browser/modules/accounts/utils/index.js +1 -1
  191. package/dist/browser/modules/ai/index.js +1 -1
  192. package/dist/browser/modules/ai/mutations/index.js +1 -1
  193. package/dist/browser/modules/ai/mutations/use-ai-assist.js +1 -1
  194. package/dist/browser/modules/ai/mutations/use-ai-transcribe.js +1 -1
  195. package/dist/browser/modules/ai/mutations/use-generate-image.js +1 -1
  196. package/dist/browser/modules/ai/queries/get-ai-assist-price-query-options.js +1 -1
  197. package/dist/browser/modules/ai/queries/get-ai-generate-price-query-options.js +1 -1
  198. package/dist/browser/modules/ai/queries/get-ai-images-query-options.js +1 -1
  199. package/dist/browser/modules/ai/queries/get-ai-transcribe-price-query-options.js +1 -1
  200. package/dist/browser/modules/ai/queries/index.js +1 -1
  201. package/dist/browser/modules/analytics/index.js +1 -1
  202. package/dist/browser/modules/analytics/mutations/index.js +1 -1
  203. package/dist/browser/modules/analytics/mutations/use-record-activity.js +1 -1
  204. package/dist/browser/modules/analytics/queries/get-discover-curation-query-options.js +1 -1
  205. package/dist/browser/modules/analytics/queries/get-discover-leaderboard-query-options.js +1 -1
  206. package/dist/browser/modules/analytics/queries/get-page-stats-query-options.js +1 -1
  207. package/dist/browser/modules/analytics/queries/index.js +1 -1
  208. package/dist/browser/modules/auth/index.js +1 -1
  209. package/dist/browser/modules/auth/requests.js +1 -1
  210. package/dist/browser/modules/bad-actors/index.js +1 -1
  211. package/dist/browser/modules/bad-actors/queries/get-bad-actors-query-options.js +1 -1
  212. package/dist/browser/modules/bad-actors/queries/index.js +1 -1
  213. package/dist/browser/modules/bridge/index.js +1 -1
  214. package/dist/browser/modules/bridge/requests.js +1 -1
  215. package/dist/browser/modules/bridge/verify-on-alternate-node.js +1 -1
  216. package/dist/browser/modules/communities/index.js +1 -1
  217. package/dist/browser/modules/communities/mutations/index.js +1 -1
  218. package/dist/browser/modules/communities/mutations/use-mute-post.js +1 -1
  219. package/dist/browser/modules/communities/mutations/use-pin-post.js +1 -1
  220. package/dist/browser/modules/communities/mutations/use-register-community-rewards.js +1 -1
  221. package/dist/browser/modules/communities/mutations/use-set-community-role.js +1 -1
  222. package/dist/browser/modules/communities/mutations/use-subscribe-community.js +1 -1
  223. package/dist/browser/modules/communities/mutations/use-unsubscribe-community.js +1 -1
  224. package/dist/browser/modules/communities/mutations/use-update-community.js +1 -1
  225. package/dist/browser/modules/communities/queries/get-account-notifications-infinite-query-options.js +1 -1
  226. package/dist/browser/modules/communities/queries/get-communities-query-options.js +1 -1
  227. package/dist/browser/modules/communities/queries/get-community-context-query-options.js +1 -1
  228. package/dist/browser/modules/communities/queries/get-community-query-options.js +1 -1
  229. package/dist/browser/modules/communities/queries/get-community-subscribers-query-options.js +1 -1
  230. package/dist/browser/modules/communities/queries/get-rewarded-communities-query-options.js +1 -1
  231. package/dist/browser/modules/communities/queries/index.js +1 -1
  232. package/dist/browser/modules/core/config.js +1 -1
  233. package/dist/browser/modules/core/hive-tx.js +1 -1
  234. package/dist/browser/modules/core/index.js +1 -1
  235. package/dist/browser/modules/core/mutations/broadcast-json.js +1 -1
  236. package/dist/browser/modules/core/mutations/index.js +1 -1
  237. package/dist/browser/modules/core/mutations/use-broadcast-mutation.js +1 -1
  238. package/dist/browser/modules/core/queries/get-chain-properties-query-options.js +1 -1
  239. package/dist/browser/modules/core/queries/get-dynamic-props-query-options.js +1 -1
  240. package/dist/browser/modules/core/queries/get-reward-fund-query-options.js +1 -1
  241. package/dist/browser/modules/core/queries/index.js +1 -1
  242. package/dist/browser/modules/core/queries-manager.js +1 -1
  243. package/dist/browser/modules/curation/dmca.js +1 -1
  244. package/dist/browser/modules/curation/index.js +1 -1
  245. package/dist/browser/modules/curation/mutations/index.js +1 -1
  246. package/dist/browser/modules/curation/mutations/use-curation-recommend.js +1 -1
  247. package/dist/browser/modules/curation/queries/get-curation-application-query-options.js +1 -1
  248. package/dist/browser/modules/curation/queries/get-curation-applications-query-options.js +1 -1
  249. package/dist/browser/modules/curation/queries/get-curation-feed-infinite-query-options.js +1 -1
  250. package/dist/browser/modules/curation/queries/get-curation-post-query-options.js +1 -1
  251. package/dist/browser/modules/curation/queries/get-curation-recommendations-infinite-query-options.js +1 -1
  252. package/dist/browser/modules/curation/queries/get-curation-recommender-query-options.js +1 -1
  253. package/dist/browser/modules/curation/queries/get-curation-roster-admin-query-options.js +1 -1
  254. package/dist/browser/modules/curation/queries/get-curation-roster-query-options.js +1 -1
  255. package/dist/browser/modules/curation/queries/get-curation-status-query-options.js +1 -1
  256. package/dist/browser/modules/curation/queries/index.js +1 -1
  257. package/dist/browser/modules/curation/requests.js +1 -1
  258. package/dist/browser/modules/games/index.js +1 -1
  259. package/dist/browser/modules/games/mutations/game-claim.js +1 -1
  260. package/dist/browser/modules/games/mutations/index.js +1 -1
  261. package/dist/browser/modules/games/queries/game-status-check-query-options.js +1 -1
  262. package/dist/browser/modules/games/queries/index.js +1 -1
  263. package/dist/browser/modules/hive-engine/index.js +1 -1
  264. package/dist/browser/modules/hive-engine/queries/get-all-hive-engine-tokens-query-options.js +1 -1
  265. package/dist/browser/modules/hive-engine/queries/get-hive-engine-balances-with-usd-query-options.js +1 -1
  266. package/dist/browser/modules/hive-engine/queries/get-hive-engine-token-general-info-query-options.js +1 -1
  267. package/dist/browser/modules/hive-engine/queries/get-hive-engine-token-metrics-query-options.js +1 -1
  268. package/dist/browser/modules/hive-engine/queries/get-hive-engine-token-transactions-query-options.js +1 -1
  269. package/dist/browser/modules/hive-engine/queries/get-hive-engine-tokens-balances-query-options.js +1 -1
  270. package/dist/browser/modules/hive-engine/queries/get-hive-engine-tokens-market-query-options.js +1 -1
  271. package/dist/browser/modules/hive-engine/queries/get-hive-engine-tokens-metadata-query-options.js +1 -1
  272. package/dist/browser/modules/hive-engine/queries/get-hive-engine-unclaimed-rewards-query-options.js +1 -1
  273. package/dist/browser/modules/hive-engine/queries/index.js +1 -1
  274. package/dist/browser/modules/hive-engine/requests.js +1 -1
  275. package/dist/browser/modules/integrations/3speak/index.js +1 -1
  276. package/dist/browser/modules/integrations/3speak/queries/get-account-token-query-options.js +1 -1
  277. package/dist/browser/modules/integrations/3speak/queries/get-account-videos-query-options.js +1 -1
  278. package/dist/browser/modules/integrations/3speak/queries/index.js +1 -1
  279. package/dist/browser/modules/integrations/hiveposh/index.js +1 -1
  280. package/dist/browser/modules/integrations/hiveposh/queries/get-hiveposh-links-query-options.js +1 -1
  281. package/dist/browser/modules/integrations/hiveposh/queries/index.js +1 -1
  282. package/dist/browser/modules/integrations/index.js +1 -1
  283. package/dist/browser/modules/integrations/plausible/index.js +1 -1
  284. package/dist/browser/modules/integrations/plausible/queries/get-stats-query-options.js +1 -1
  285. package/dist/browser/modules/integrations/plausible/queries/index.js +1 -1
  286. package/dist/browser/modules/market/index.js +1 -1
  287. package/dist/browser/modules/market/mutations/index.js +1 -1
  288. package/dist/browser/modules/market/mutations/use-limit-order-cancel.js +1 -1
  289. package/dist/browser/modules/market/mutations/use-limit-order-create.js +1 -1
  290. package/dist/browser/modules/market/queries/get-current-median-history-price-query-options.js +1 -1
  291. package/dist/browser/modules/market/queries/get-feed-history-query-options.js +1 -1
  292. package/dist/browser/modules/market/queries/get-hive-hbd-stats-query-options.js +1 -1
  293. package/dist/browser/modules/market/queries/get-market-data-query-options.js +1 -1
  294. package/dist/browser/modules/market/queries/get-market-history-query-options.js +1 -1
  295. package/dist/browser/modules/market/queries/get-market-statistics-query-options.js +1 -1
  296. package/dist/browser/modules/market/queries/get-order-book-query-options.js +1 -1
  297. package/dist/browser/modules/market/queries/get-trade-history-query-options.js +1 -1
  298. package/dist/browser/modules/market/queries/index.js +1 -1
  299. package/dist/browser/modules/market/requests.js +1 -1
  300. package/dist/browser/modules/newsletter/api.js +1 -1
  301. package/dist/browser/modules/newsletter/index.js +1 -1
  302. package/dist/browser/modules/newsletter/mutations/index.js +1 -1
  303. package/dist/browser/modules/newsletter/mutations/use-leave-digest.js +1 -1
  304. package/dist/browser/modules/newsletter/mutations/use-send-newsletter-issue.js +1 -1
  305. package/dist/browser/modules/newsletter/mutations/use-subscribe-digest.js +1 -1
  306. package/dist/browser/modules/newsletter/mutations/use-unsubscribe-all-digests.js +1 -1
  307. package/dist/browser/modules/newsletter/queries/get-digest-subscriptions-query-options.js +1 -1
  308. package/dist/browser/modules/newsletter/queries/get-newsletter-issues-query-options.js +1 -1
  309. package/dist/browser/modules/newsletter/queries/get-newsletter-posts-query-options.js +1 -1
  310. package/dist/browser/modules/newsletter/queries/get-newsletter-sender-query-options.js +1 -1
  311. package/dist/browser/modules/newsletter/queries/index.js +1 -1
  312. package/dist/browser/modules/notifications/index.js +1 -1
  313. package/dist/browser/modules/notifications/mutations/index.js +1 -1
  314. package/dist/browser/modules/notifications/mutations/use-mark-notifications-read.js +1 -1
  315. package/dist/browser/modules/notifications/mutations/use-set-last-read.js +1 -1
  316. package/dist/browser/modules/notifications/queries/get-announcements-query-options.js +1 -1
  317. package/dist/browser/modules/notifications/queries/get-notifications-infinite-query-options.js +1 -1
  318. package/dist/browser/modules/notifications/queries/get-notifications-settings-query-options.js +1 -1
  319. package/dist/browser/modules/notifications/queries/get-notifications-unread-count-query-options.js +1 -1
  320. package/dist/browser/modules/notifications/queries/get-spotlights-query-options.js +1 -1
  321. package/dist/browser/modules/notifications/queries/index.js +1 -1
  322. package/dist/browser/modules/operations/index.js +1 -1
  323. package/dist/browser/modules/operations/mutations/index.js +1 -1
  324. package/dist/browser/modules/operations/mutations/sign-operation-by-key.js +1 -1
  325. package/dist/browser/modules/operations/queries/get-chain-properties-query-options.js +1 -1
  326. package/dist/browser/modules/operations/queries/index.js +1 -1
  327. package/dist/browser/modules/points/index.js +1 -1
  328. package/dist/browser/modules/points/mutations/index.js +1 -1
  329. package/dist/browser/modules/points/mutations/use-claim-points.js +1 -1
  330. package/dist/browser/modules/points/queries/get-points-asset-general-info-query-options.js +1 -1
  331. package/dist/browser/modules/points/queries/get-points-asset-transactions-query-options.js +1 -1
  332. package/dist/browser/modules/points/queries/get-points-query-options.js +1 -1
  333. package/dist/browser/modules/points/queries/index.js +1 -1
  334. package/dist/browser/modules/polls/index.js +1 -1
  335. package/dist/browser/modules/polls/mutations/index.js +1 -1
  336. package/dist/browser/modules/polls/mutations/use-poll-vote.js +1 -1
  337. package/dist/browser/modules/polls/queries/get-poll-query-options.js +1 -1
  338. package/dist/browser/modules/polls/queries/index.js +1 -1
  339. package/dist/browser/modules/posts/cache/discussions-cache-utils.js +1 -1
  340. package/dist/browser/modules/posts/cache/entries-cache-management.js +1 -1
  341. package/dist/browser/modules/posts/cache/index.js +1 -1
  342. package/dist/browser/modules/posts/index.js +1 -1
  343. package/dist/browser/modules/posts/mutations/add-fragment.js +1 -1
  344. package/dist/browser/modules/posts/mutations/edit-fragment.js +1 -1
  345. package/dist/browser/modules/posts/mutations/index.js +1 -1
  346. package/dist/browser/modules/posts/mutations/remove-fragment.js +1 -1
  347. package/dist/browser/modules/posts/mutations/use-add-draft.js +1 -1
  348. package/dist/browser/modules/posts/mutations/use-add-image.js +1 -1
  349. package/dist/browser/modules/posts/mutations/use-add-schedule.js +1 -1
  350. package/dist/browser/modules/posts/mutations/use-comment.js +1 -1
  351. package/dist/browser/modules/posts/mutations/use-cross-post.js +1 -1
  352. package/dist/browser/modules/posts/mutations/use-delete-comment.js +1 -1
  353. package/dist/browser/modules/posts/mutations/use-delete-draft.js +1 -1
  354. package/dist/browser/modules/posts/mutations/use-delete-image.js +1 -1
  355. package/dist/browser/modules/posts/mutations/use-delete-schedule.js +1 -1
  356. package/dist/browser/modules/posts/mutations/use-move-schedule.js +1 -1
  357. package/dist/browser/modules/posts/mutations/use-promote.js +1 -1
  358. package/dist/browser/modules/posts/mutations/use-reblog.js +1 -1
  359. package/dist/browser/modules/posts/mutations/use-update-draft.js +1 -1
  360. package/dist/browser/modules/posts/mutations/use-update-reply.js +1 -1
  361. package/dist/browser/modules/posts/mutations/use-upload-image.js +1 -1
  362. package/dist/browser/modules/posts/mutations/use-vote.js +1 -1
  363. package/dist/browser/modules/posts/queries/get-account-posts-query-options.js +1 -1
  364. package/dist/browser/modules/posts/queries/get-comment-history-query-options.js +1 -1
  365. package/dist/browser/modules/posts/queries/get-content-query-options.js +1 -1
  366. package/dist/browser/modules/posts/queries/get-content-replies-query-options.js +1 -1
  367. package/dist/browser/modules/posts/queries/get-deleted-entry-query-options.js +1 -1
  368. package/dist/browser/modules/posts/queries/get-discussions-query-options.js +1 -1
  369. package/dist/browser/modules/posts/queries/get-drafts-query-options.js +1 -1
  370. package/dist/browser/modules/posts/queries/get-entry-active-votes-query-options.js +1 -1
  371. package/dist/browser/modules/posts/queries/get-fragments-query-options.js +1 -1
  372. package/dist/browser/modules/posts/queries/get-images-query-options.js +1 -1
  373. package/dist/browser/modules/posts/queries/get-normalize-post-query-options.js +1 -1
  374. package/dist/browser/modules/posts/queries/get-post-header-query-options.js +1 -1
  375. package/dist/browser/modules/posts/queries/get-post-query-options.js +1 -1
  376. package/dist/browser/modules/posts/queries/get-post-tips-query-options.js +1 -1
  377. package/dist/browser/modules/posts/queries/get-posts-ranked-query-options.js +1 -1
  378. package/dist/browser/modules/posts/queries/get-promoted-posts-query-options.js +1 -1
  379. package/dist/browser/modules/posts/queries/get-reblogged-by-query-options.js +1 -1
  380. package/dist/browser/modules/posts/queries/get-reblogs-query-options.js +1 -1
  381. package/dist/browser/modules/posts/queries/get-schedules-query-options.js +1 -1
  382. package/dist/browser/modules/posts/queries/get-shorts-feed-query-options.js +1 -1
  383. package/dist/browser/modules/posts/queries/get-trending-tags-query-options.js +1 -1
  384. package/dist/browser/modules/posts/queries/get-trending-tags-with-stats-query-options.js +1 -1
  385. package/dist/browser/modules/posts/queries/get-user-post-vote-query-options.js +1 -1
  386. package/dist/browser/modules/posts/queries/get-waves-by-account-query-options.js +1 -1
  387. package/dist/browser/modules/posts/queries/get-waves-by-host-query-options.js +1 -1
  388. package/dist/browser/modules/posts/queries/get-waves-by-tag-query-options.js +1 -1
  389. package/dist/browser/modules/posts/queries/get-waves-feed-query-options.js +1 -1
  390. package/dist/browser/modules/posts/queries/get-waves-following-query-options.js +1 -1
  391. package/dist/browser/modules/posts/queries/get-waves-trending-authors-query-options.js +1 -1
  392. package/dist/browser/modules/posts/queries/get-waves-trending-tags-query-options.js +1 -1
  393. package/dist/browser/modules/posts/queries/index.js +1 -1
  394. package/dist/browser/modules/posts/utils/filter-dmca-entries.js +1 -1
  395. package/dist/browser/modules/posts/utils/validate-post-creating.js +1 -1
  396. package/dist/browser/modules/posts/utils/waves-helpers.js +1 -1
  397. package/dist/browser/modules/private-api/index.js +1 -1
  398. package/dist/browser/modules/private-api/requests.js +1 -1
  399. package/dist/browser/modules/promotions/index.js +1 -1
  400. package/dist/browser/modules/promotions/mutations/index.js +1 -1
  401. package/dist/browser/modules/promotions/mutations/use-boost-plus.js +1 -1
  402. package/dist/browser/modules/promotions/mutations/use-rc-delegation.js +1 -1
  403. package/dist/browser/modules/promotions/queries/get-boost-plus-account-prices-query-options.js +1 -1
  404. package/dist/browser/modules/promotions/queries/get-boost-plus-prices-query-options.js +1 -1
  405. package/dist/browser/modules/promotions/queries/get-promote-price-query-options.js +1 -1
  406. package/dist/browser/modules/promotions/queries/get-rc-delegation-active-query-options.js +1 -1
  407. package/dist/browser/modules/promotions/queries/get-rc-delegation-prices-query-options.js +1 -1
  408. package/dist/browser/modules/promotions/queries/index.js +1 -1
  409. package/dist/browser/modules/proposals/index.js +1 -1
  410. package/dist/browser/modules/proposals/mutations/index.js +1 -1
  411. package/dist/browser/modules/proposals/mutations/use-proposal-create.js +1 -1
  412. package/dist/browser/modules/proposals/mutations/use-proposal-vote.js +1 -1
  413. package/dist/browser/modules/proposals/queries/get-proposal-query-options.js +1 -1
  414. package/dist/browser/modules/proposals/queries/get-proposal-votes-query-options.js +1 -1
  415. package/dist/browser/modules/proposals/queries/get-proposals-query-options.js +1 -1
  416. package/dist/browser/modules/proposals/queries/get-user-proposal-votes-query-options.js +1 -1
  417. package/dist/browser/modules/proposals/queries/index.js +1 -1
  418. package/dist/browser/modules/quests/index.js +1 -1
  419. package/dist/browser/modules/quests/mutations/buy-streak-freeze.js +1 -1
  420. package/dist/browser/modules/quests/mutations/index.js +1 -1
  421. package/dist/browser/modules/quests/queries/get-quests-query-options.js +1 -1
  422. package/dist/browser/modules/quests/queries/index.js +1 -1
  423. package/dist/browser/modules/resource-credits/index.js +1 -1
  424. package/dist/browser/modules/resource-credits/queries/get-account-rc-query-options.js +1 -1
  425. package/dist/browser/modules/resource-credits/queries/get-rc-resource-params-query-options.js +1 -1
  426. package/dist/browser/modules/resource-credits/queries/get-rc-stats-query-options.js +1 -1
  427. package/dist/browser/modules/resource-credits/queries/index.js +1 -1
  428. package/dist/browser/modules/resource-credits/utils/estimate-rc-precheck.js +1 -1
  429. package/dist/browser/modules/resource-credits/utils/index.js +1 -1
  430. package/dist/browser/modules/search/dmca.js +1 -1
  431. package/dist/browser/modules/search/index.js +1 -1
  432. package/dist/browser/modules/search/parse-json-response.js +1 -1
  433. package/dist/browser/modules/search/queries/get-search-account-query-options.js +1 -1
  434. package/dist/browser/modules/search/queries/get-search-api-infinite-query-options.js +1 -1
  435. package/dist/browser/modules/search/queries/get-search-path-query-options.js +1 -1
  436. package/dist/browser/modules/search/queries/get-search-query-options.js +1 -1
  437. package/dist/browser/modules/search/queries/get-search-topics-query-options.js +1 -1
  438. package/dist/browser/modules/search/queries/get-similar-entries-query-options.js +1 -1
  439. package/dist/browser/modules/search/queries/index.js +1 -1
  440. package/dist/browser/modules/search/requests.js +1 -1
  441. package/dist/browser/modules/support/index.js +1 -1
  442. package/dist/browser/modules/support/mutations/index.js +1 -1
  443. package/dist/browser/modules/support/mutations/update-support-settings.js +1 -1
  444. package/dist/browser/modules/support/queries/get-support-settings-query-options.js +1 -1
  445. package/dist/browser/modules/support/queries/index.js +1 -1
  446. package/dist/browser/modules/wallet/consts/hive-account-operation-groups.js +1 -1
  447. package/dist/browser/modules/wallet/consts/hive-operation-list.js +1 -1
  448. package/dist/browser/modules/wallet/consts/hive-operation-orders.js +1 -1
  449. package/dist/browser/modules/wallet/consts/index.js +1 -1
  450. package/dist/browser/modules/wallet/index.js +1 -1
  451. package/dist/browser/modules/wallet/mutations/index.js +1 -1
  452. package/dist/browser/modules/wallet/mutations/use-claim-engine-rewards.js +1 -1
  453. package/dist/browser/modules/wallet/mutations/use-claim-interest.js +1 -1
  454. package/dist/browser/modules/wallet/mutations/use-claim-rewards.js +1 -1
  455. package/dist/browser/modules/wallet/mutations/use-convert.js +1 -1
  456. package/dist/browser/modules/wallet/mutations/use-delegate-engine-token.js +1 -1
  457. package/dist/browser/modules/wallet/mutations/use-delegate-rc.js +1 -1
  458. package/dist/browser/modules/wallet/mutations/use-delegate-vesting-shares.js +1 -1
  459. package/dist/browser/modules/wallet/mutations/use-engine-market-order.js +1 -1
  460. package/dist/browser/modules/wallet/mutations/use-set-withdraw-vesting-route.js +1 -1
  461. package/dist/browser/modules/wallet/mutations/use-stake-engine-token.js +1 -1
  462. package/dist/browser/modules/wallet/mutations/use-transfer-engine-token.js +1 -1
  463. package/dist/browser/modules/wallet/mutations/use-transfer-from-savings.js +1 -1
  464. package/dist/browser/modules/wallet/mutations/use-transfer-point.js +1 -1
  465. package/dist/browser/modules/wallet/mutations/use-transfer-to-savings.js +1 -1
  466. package/dist/browser/modules/wallet/mutations/use-transfer-to-vesting.js +1 -1
  467. package/dist/browser/modules/wallet/mutations/use-transfer.js +1 -1
  468. package/dist/browser/modules/wallet/mutations/use-undelegate-engine-token.js +1 -1
  469. package/dist/browser/modules/wallet/mutations/use-unstake-engine-token.js +1 -1
  470. package/dist/browser/modules/wallet/mutations/use-wallet-operation.js +1 -1
  471. package/dist/browser/modules/wallet/mutations/use-withdraw-vesting.js +1 -1
  472. package/dist/browser/modules/wallet/queries/get-account-delegations-query-options.js +1 -1
  473. package/dist/browser/modules/wallet/queries/get-account-wallet-asset-info-query-options.js +1 -1
  474. package/dist/browser/modules/wallet/queries/get-collateralized-conversion-requests-query-options.js +1 -1
  475. package/dist/browser/modules/wallet/queries/get-conversion-requests-query-options.js +1 -1
  476. package/dist/browser/modules/wallet/queries/get-hbd-asset-general-info-query-options.js +1 -1
  477. package/dist/browser/modules/wallet/queries/get-hbd-asset-transactions-query-options.js +1 -1
  478. package/dist/browser/modules/wallet/queries/get-hive-asset-general-info-query-options.js +1 -1
  479. package/dist/browser/modules/wallet/queries/get-hive-asset-metric-query-options.js +1 -1
  480. package/dist/browser/modules/wallet/queries/get-hive-asset-transactions-query-options.js +1 -1
  481. package/dist/browser/modules/wallet/queries/get-hive-asset-withdrawal-routes-query-options.js +1 -1
  482. package/dist/browser/modules/wallet/queries/get-hive-power-asset-general-info-query-options.js +1 -1
  483. package/dist/browser/modules/wallet/queries/get-hive-power-asset-transactions-query-options.js +1 -1
  484. package/dist/browser/modules/wallet/queries/get-hive-power-delegates-query-options.js +1 -1
  485. package/dist/browser/modules/wallet/queries/get-hive-power-delegatings-query-options.js +1 -1
  486. package/dist/browser/modules/wallet/queries/get-incoming-rc-query-options.js +1 -1
  487. package/dist/browser/modules/wallet/queries/get-open-orders-query-options.js +1 -1
  488. package/dist/browser/modules/wallet/queries/get-outgoing-rc-delegations-infinite-query-options.js +1 -1
  489. package/dist/browser/modules/wallet/queries/get-portfolio-query-options.js +1 -1
  490. package/dist/browser/modules/wallet/queries/get-received-vesting-shares-query-options.js +1 -1
  491. package/dist/browser/modules/wallet/queries/get-recurrent-transfers-query-options.js +1 -1
  492. package/dist/browser/modules/wallet/queries/get-savings-withdraw-from-query-options.js +1 -1
  493. package/dist/browser/modules/wallet/queries/get-vesting-delegation-expirations-query-options.js +1 -1
  494. package/dist/browser/modules/wallet/queries/get-vesting-delegations-query-options.js +1 -1
  495. package/dist/browser/modules/wallet/queries/get-withdraw-routes-query-options.js +1 -1
  496. package/dist/browser/modules/wallet/queries/index.js +1 -1
  497. package/dist/browser/modules/witnesses/index.js +1 -1
  498. package/dist/browser/modules/witnesses/mutations/index.js +1 -1
  499. package/dist/browser/modules/witnesses/mutations/use-witness-proxy.js +1 -1
  500. package/dist/browser/modules/witnesses/mutations/use-witness-vote.js +1 -1
  501. package/dist/browser/modules/witnesses/queries/get-witnesses-query-options.js +1 -1
  502. package/dist/browser/modules/witnesses/queries/index.js +1 -1
  503. package/dist/node/hive.cjs +2 -2
  504. package/dist/node/hive.cjs.map +1 -1
  505. package/dist/node/hive.mjs +2 -2
  506. package/dist/node/hive.mjs.map +1 -1
  507. package/dist/node/index.cjs +3 -3
  508. package/dist/node/index.cjs.map +1 -1
  509. package/dist/node/index.mjs +3 -3
  510. package/dist/node/index.mjs.map +1 -1
  511. package/package.json +1 -1
  512. package/dist/browser/chunk-E6WHRKBG.js +0 -2
  513. package/dist/browser/chunk-E6WHRKBG.js.map +0 -1
  514. package/dist/browser/chunk-K2DAN37J.js +0 -2
  515. package/dist/browser/chunk-PHNYLTEH.js +0 -2
  516. package/dist/browser/chunk-UXF4JZOD.js.map +0 -1
@@ -1,2 +1,2 @@
1
- import {b as b$1}from'./chunk-CNB64U7U.js';import {b}from'./chunk-K2DAN37J.js';import {a}from'./chunk-HEILHNSR.js';function c(t,o,e){return b(["wallet","claim-engine-rewards"],t,n=>{let s=JSON.stringify(n.tokens.map(d=>({symbol:d})));return [["custom_json",{id:"scot_claim_token",required_auths:[],required_posting_auths:[t],json:s}]]},async()=>{await b$1(o?.adapter,e,[a.accounts.full(t),["ecency-wallets","asset-info",t],["wallet","portfolio","v2",t]]);},o,"posting",{broadcastMode:e})}export{c as a};//# sourceMappingURL=chunk-JORE46WK.js.map
2
- //# sourceMappingURL=chunk-JORE46WK.js.map
1
+ import {b as b$1}from'./chunk-CNB64U7U.js';import {b}from'./chunk-J2HM6MWA.js';import {a}from'./chunk-HEILHNSR.js';function c(t,o,e){return b(["wallet","claim-engine-rewards"],t,n=>{let s=JSON.stringify(n.tokens.map(d=>({symbol:d})));return [["custom_json",{id:"scot_claim_token",required_auths:[],required_posting_auths:[t],json:s}]]},async()=>{await b$1(o?.adapter,e,[a.accounts.full(t),["ecency-wallets","asset-info",t],["wallet","portfolio","v2",t]]);},o,"posting",{broadcastMode:e})}export{c as a};//# sourceMappingURL=chunk-2EYZMIWD.js.map
2
+ //# sourceMappingURL=chunk-2EYZMIWD.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/modules/wallet/mutations/use-claim-engine-rewards.ts"],"names":["useClaimEngineRewards","username","auth","broadcastMode","useBroadcastMutation","payload","json","symbol","invalidateAfterBroadcast","QueryKeys"],"mappings":"mHAUO,SAASA,EAAsBC,CAAAA,CAA8BC,CAAAA,CAClEC,CAAAA,CACA,CACA,OAAOC,CAAAA,CACL,CAAC,QAAA,CAAU,sBAAsB,EACjCH,CAAAA,CACCI,CAAAA,EAAY,CACX,IAAMC,CAAAA,CAAO,KAAK,SAAA,CAAUD,CAAAA,CAAQ,MAAA,CAAO,GAAA,CAAKE,IAAY,CAAE,MAAA,CAAAA,CAAO,CAAA,CAAE,CAAC,CAAA,CACxE,OAAO,CAAC,CAAC,cAAe,CACtB,EAAA,CAAI,mBACJ,cAAA,CAAgB,GAChB,sBAAA,CAAwB,CAACN,CAAS,CAAA,CAClC,KAAAK,CACF,CAAC,CAAc,CACjB,EACA,SAAY,CACV,MAAME,GAAAA,CAAyBN,GAAM,OAAA,CAASC,CAAAA,CAAe,CAC3DM,CAAAA,CAAU,QAAA,CAAS,KAAKR,CAAQ,CAAA,CAChC,CAAC,gBAAA,CAAkB,aAAcA,CAAQ,CAAA,CACzC,CAAC,QAAA,CAAU,WAAA,CAAa,KAAMA,CAAQ,CACxC,CAAC,EACH,EACAC,CAAAA,CACA,SAAA,CACA,CAAE,aAAA,CAAAC,CAAc,CAClB,CACF","file":"chunk-JORE46WK.js","sourcesContent":["import { useBroadcastMutation, invalidateAfterBroadcast } from \"@/modules/core/mutations\";\nimport type { BroadcastMode } from \"@/modules/core/mutations\";\nimport { QueryKeys } from \"@/modules/core\";\nimport type { AuthContextV2 } from \"@/modules/core/types\";\nimport type { Operation } from \"../../../hive-tx\";\n\nexport interface ClaimEngineRewardsPayload {\n tokens: string[];\n}\n\nexport function useClaimEngineRewards(username: string | undefined, auth?: AuthContextV2,\n broadcastMode?: BroadcastMode\n) {\n return useBroadcastMutation<ClaimEngineRewardsPayload>(\n [\"wallet\", \"claim-engine-rewards\"],\n username,\n (payload) => {\n const json = JSON.stringify(payload.tokens.map((symbol) => ({ symbol })));\n return [[\"custom_json\", {\n id: \"scot_claim_token\",\n required_auths: [],\n required_posting_auths: [username!],\n json,\n }] as Operation];\n },\n async () => {\n await invalidateAfterBroadcast(auth?.adapter, broadcastMode, [\n QueryKeys.accounts.full(username),\n [\"ecency-wallets\", \"asset-info\", username],\n [\"wallet\", \"portfolio\", \"v2\", username]\n ]);\n },\n auth,\n 'posting',\n { broadcastMode }\n );\n}\n"]}
1
+ {"version":3,"sources":["../../src/modules/wallet/mutations/use-claim-engine-rewards.ts"],"names":["useClaimEngineRewards","username","auth","broadcastMode","useBroadcastMutation","payload","json","symbol","invalidateAfterBroadcast","QueryKeys"],"mappings":"mHAUO,SAASA,EAAsBC,CAAAA,CAA8BC,CAAAA,CAClEC,CAAAA,CACA,CACA,OAAOC,CAAAA,CACL,CAAC,QAAA,CAAU,sBAAsB,EACjCH,CAAAA,CACCI,CAAAA,EAAY,CACX,IAAMC,CAAAA,CAAO,KAAK,SAAA,CAAUD,CAAAA,CAAQ,MAAA,CAAO,GAAA,CAAKE,IAAY,CAAE,MAAA,CAAAA,CAAO,CAAA,CAAE,CAAC,CAAA,CACxE,OAAO,CAAC,CAAC,cAAe,CACtB,EAAA,CAAI,mBACJ,cAAA,CAAgB,GAChB,sBAAA,CAAwB,CAACN,CAAS,CAAA,CAClC,KAAAK,CACF,CAAC,CAAc,CACjB,EACA,SAAY,CACV,MAAME,GAAAA,CAAyBN,GAAM,OAAA,CAASC,CAAAA,CAAe,CAC3DM,CAAAA,CAAU,QAAA,CAAS,KAAKR,CAAQ,CAAA,CAChC,CAAC,gBAAA,CAAkB,aAAcA,CAAQ,CAAA,CACzC,CAAC,QAAA,CAAU,WAAA,CAAa,KAAMA,CAAQ,CACxC,CAAC,EACH,EACAC,CAAAA,CACA,SAAA,CACA,CAAE,aAAA,CAAAC,CAAc,CAClB,CACF","file":"chunk-2EYZMIWD.js","sourcesContent":["import { useBroadcastMutation, invalidateAfterBroadcast } from \"@/modules/core/mutations\";\nimport type { BroadcastMode } from \"@/modules/core/mutations\";\nimport { QueryKeys } from \"@/modules/core\";\nimport type { AuthContextV2 } from \"@/modules/core/types\";\nimport type { Operation } from \"../../../hive-tx\";\n\nexport interface ClaimEngineRewardsPayload {\n tokens: string[];\n}\n\nexport function useClaimEngineRewards(username: string | undefined, auth?: AuthContextV2,\n broadcastMode?: BroadcastMode\n) {\n return useBroadcastMutation<ClaimEngineRewardsPayload>(\n [\"wallet\", \"claim-engine-rewards\"],\n username,\n (payload) => {\n const json = JSON.stringify(payload.tokens.map((symbol) => ({ symbol })));\n return [[\"custom_json\", {\n id: \"scot_claim_token\",\n required_auths: [],\n required_posting_auths: [username!],\n json,\n }] as Operation];\n },\n async () => {\n await invalidateAfterBroadcast(auth?.adapter, broadcastMode, [\n QueryKeys.accounts.full(username),\n [\"ecency-wallets\", \"asset-info\", username],\n [\"wallet\", \"portfolio\", \"v2\", username]\n ]);\n },\n auth,\n 'posting',\n { broadcastMode }\n );\n}\n"]}
@@ -1,2 +1,2 @@
1
- import {a as a$1}from'./chunk-MU2XP4IF.js';import {b as b$4}from'./chunk-NT4ZVSWI.js';import {c,e,f,b as b$1,a as a$5}from'./chunk-BWMECQQM.js';import {a as a$2}from'./chunk-2JN4EIJE.js';import {b as b$2}from'./chunk-CNB64U7U.js';import {b}from'./chunk-K2DAN37J.js';import {a as a$4}from'./chunk-SEACJS36.js';import {c as c$1}from'./chunk-UXF4JZOD.js';import {b as b$3}from'./chunk-POHYQBLL.js';import {c as c$2}from'./chunk-OMSXAN23.js';import {a}from'./chunk-HEILHNSR.js';import {a as a$3}from'./chunk-CPEOHI6I.js';import {j}from'./chunk-RAWKN3XW.js';import {useQueryClient,useQuery,useMutation,queryOptions}from'@tanstack/react-query';import $ from'hivesigner';function Dt(o,e$1,r){let n=useQueryClient(),{data:t}=useQuery(p(o));return b(["accounts","update"],o,s=>{let a=c(n.getQueryData(p(o).queryKey),t);if(!a)throw new Error("[SDK][Accounts] \u2013 cannot update not existing account");return [["account_update2",{account:o,json_metadata:"",extensions:[],posting_json_metadata:e({existingPostingJsonMetadata:a.posting_json_metadata,profile:s.profile,tokens:s.tokens})}]]},async(s,a$1)=>{n.setQueryData(p(o).queryKey,i=>{if(!i)return i;let u=JSON.parse(JSON.stringify(i));return u.profile=f({existingProfile:b$1(i),profile:a$1.profile,tokens:a$1.tokens}),u}),await b$2(e$1?.adapter,r,[a.accounts.full(o)]);},e$1,void 0,{broadcastMode:r,onMutate:async()=>{if(o)try{await n.fetchQuery({...p(o),staleTime:0});}catch{}}})}function Jt(o,e,r,n,t){return useMutation({mutationKey:["accounts","relation","update",o,e],mutationFn:async s=>{let a=a$1(o,e);await b$3().prefetchQuery(a);let i=b$3().getQueryData(a.queryKey);return await a$2(o,"follow",["follow",{follower:o,following:e,what:[...s==="toggle-ignore"&&!i?.ignores?["ignore"]:[],...s==="toggle-follow"&&!i?.follows?["blog"]:[]]}],r),{...i,ignores:s==="toggle-ignore"?!i?.ignores:i?.ignores,follows:s==="toggle-follow"?!i?.follows:i?.follows}},onError:t,onSuccess(s){n(s),b$3().setQueryData(a.accounts.relations(o,e),s),e&&b$3().invalidateQueries(p(e));}})}function J(o,e){let r=new Map;return o.forEach(([n,t])=>{r.set(n.toString(),t);}),e.forEach(([n,t])=>{r.set(n.toString(),t);}),Array.from(r.entries()).sort(([n],[t])=>n.localeCompare(t)).map(([n,t])=>[n,t])}function F(o,e){let{data:r}=useQuery(p(o));return useMutation({mutationKey:["accounts","keys-update",o],mutationFn:async({keys:n,keepCurrent:t=false,currentKey:s,keysToRevoke:a=[],keysToRevokeByAuthority:i={}})=>{if(n.length===0)throw new Error("[SDK][Update password] \u2013 no new keys provided");if(!r)throw new Error("[SDK][Update password] \u2013 cannot update keys for anon user");let u=c=>{let l=JSON.parse(JSON.stringify(r[c])),R=[...i[c]||[],...i[c]===void 0?a:[]],Q=t?l.key_auths.filter(([h])=>!R.includes(h.toString())):[];return l.key_auths=J(Q,n.map((h,M)=>[h[c].createPublic().toString(),M+1])),l};return c$1([["account_update",{account:o,json_metadata:r.json_metadata,owner:u("owner"),active:u("active"),posting:u("posting"),memo_key:n[0].memo_key.createPublic().toString()}]],s)},...e})}function Xt(o,e){let{data:r}=useQuery(p(o)),{mutateAsync:n}=F(o);return useMutation({mutationKey:["accounts","password-update",o],mutationFn:async({newPassword:t,currentPassword:s,keepCurrent:a})=>{if(!r)throw new Error("[SDK][Update password] \u2013 cannot update password for anon user");let i=a$3.fromLogin(o,s,"owner");return n({currentKey:i,keepCurrent:a,keys:[{owner:a$3.fromLogin(o,t,"owner"),active:a$3.fromLogin(o,t,"active"),posting:a$3.fromLogin(o,t,"posting"),memo_key:a$3.fromLogin(o,t,"memo")}]})},...e})}function ro(o,e,r){let n=useQueryClient(),{data:t}=useQuery(p(o));return useMutation({mutationKey:["accounts","revoke-posting",t?.name],mutationFn:async({accountName:s,type:a,key:i})=>{if(!t)throw new Error("[SDK][Accounts] \u2013\xA0cannot revoke posting for anonymous user");let u=JSON.parse(JSON.stringify(t.posting));u.account_auths=u.account_auths.filter(([l])=>l!==s);let c={account:t.name,posting:u,memo_key:t.memo_key,json_metadata:t.json_metadata};if(a==="key"&&i)return c$1([["account_update",c]],i);if(a==="keychain"){if(!r?.adapter?.broadcastWithKeychain)throw new Error("[SDK][Accounts] \u2013 missing keychain broadcaster");return r.adapter.broadcastWithKeychain(t.name,[["account_update",c]],"active")}else return e.hsCallbackUrl,$.sendOperation(["account_update",c],e.hsCallbackUrl?{callback:e.hsCallbackUrl}:{},()=>{})},onError:e.onError,onSuccess:(s,a,i)=>{e.onSuccess?.(s,a,i),n.setQueryData(p(o).queryKey,u=>({...u,posting:{...u?.posting,account_auths:u?.posting?.account_auths?.filter(([c])=>c!==a.accountName)??[]}}));}})}function po(o,e,r,n){let{data:t}=useQuery(p(o));return useMutation({mutationKey:["accounts","recovery",t?.name],mutationFn:async({accountName:s,type:a,key:i,email:u})=>{if(!t)throw new Error("[SDK][Accounts] \u2013\xA0cannot change recovery for anonymous user");let c={account_to_recover:t.name,new_recovery_account:s,extensions:[]};if(a==="ecency"){if(!e)throw new Error("[SDK][Accounts] \u2013 missing access token");let g=await a$4()(c$2.privateApiHost+"/private-api/recoveries-add",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:e,email:u,publicKeys:[...t.owner.key_auths,...t.active.key_auths,...t.posting.key_auths,t.memo_key]})});if(!g.ok)throw new Error(`[SDK][Accounts] Failed to add recovery: ${g.status}`);return g}else {if(a==="key"&&i)return c$1([["change_recovery_account",c]],i);if(a==="keychain"){if(!n?.adapter?.broadcastWithKeychain)throw new Error("[SDK][Accounts] \u2013 missing keychain broadcaster");return n.adapter.broadcastWithKeychain(t.name,[["change_recovery_account",c]],"owner")}else return r.hsCallbackUrl,$.sendOperation(["change_recovery_account",c],r.hsCallbackUrl?{callback:r.hsCallbackUrl}:{},()=>{})}},onError:r.onError,onSuccess:r.onSuccess})}function _o(o,e){let{data:r}=useQuery(p(o));return useMutation({mutationKey:["accounts","revoke-key",r?.name],mutationFn:async({currentKey:n,revokingKey:t})=>{if(!r)throw new Error("[SDK][Revoke key] \u2013 cannot update keys for anon user");let s=Array.isArray(t)?t:[t],a=b$4(r,s);return c$1([["account_update",a]],n)},...e})}function w(o){return !o.posting_json_metadata&&!o.json_metadata}function tt(o){return o?Object.values(o).some(e=>typeof e=="string"?e.length>0:e!=null):false}function p(o){return queryOptions({queryKey:a.accounts.full(o),queryFn:async({signal:e})=>{if(!o)return null;let[r,n]=await Promise.all([j("condenser_api.get_accounts",[[o]],void 0,void 0,e,c=>Array.isArray(c)),j("bridge.get_profile",{account:o},void 0,void 0,e).catch(c=>{if(e?.aborted)throw c;return null})]);if(!r?.[0])return null;let t=r[0];if(w(t)&&tt(n?.metadata?.profile)){let c=await j("condenser_api.get_accounts",[[o]],void 0,void 0,e,l=>Array.isArray(l)&&(!l[0]||!w(l[0])));if(c[0]&&!w(c[0]))t=c[0];else throw new Error(`[SDK][Accounts] \u2013 inconsistent account row for ${o}: empty json metadata while hivemind profile is populated`)}let s=a$5(t.posting_json_metadata),a=n?.stats,i=a?{account:t.name,follower_count:a.followers??0,following_count:a.following??0}:void 0,u=n?.reputation??0;return {name:t.name,owner:t.owner,active:t.active,posting:t.posting,memo_key:t.memo_key,post_count:t.post_count,created:t.created,posting_json_metadata:t.posting_json_metadata,last_vote_time:t.last_vote_time,last_post:t.last_post,json_metadata:t.json_metadata,reward_hive_balance:t.reward_hive_balance,reward_hbd_balance:t.reward_hbd_balance,reward_vesting_hive:t.reward_vesting_hive,reward_vesting_balance:t.reward_vesting_balance,balance:t.balance,hbd_balance:t.hbd_balance,savings_balance:t.savings_balance,savings_hbd_balance:t.savings_hbd_balance,savings_hbd_last_interest_payment:t.savings_hbd_last_interest_payment,savings_hbd_seconds_last_update:t.savings_hbd_seconds_last_update,savings_hbd_seconds:t.savings_hbd_seconds,next_vesting_withdrawal:t.next_vesting_withdrawal,pending_claimed_accounts:t.pending_claimed_accounts,vesting_shares:t.vesting_shares,delegated_vesting_shares:t.delegated_vesting_shares,received_vesting_shares:t.received_vesting_shares,vesting_withdraw_rate:t.vesting_withdraw_rate,to_withdraw:t.to_withdraw,withdrawn:t.withdrawn,curation_rewards:t.curation_rewards===void 0?void 0:Number(t.curation_rewards),posting_rewards:t.posting_rewards===void 0?void 0:Number(t.posting_rewards),witness_votes:t.witness_votes,proxy:t.proxy,recovery_account:t.recovery_account,proxied_vsf_votes:t.proxied_vsf_votes,voting_manabar:t.voting_manabar,voting_power:t.voting_power,downvote_manabar:t.downvote_manabar,follow_stats:i,reputation:u,profile:s}},enabled:!!o,staleTime:6e4})}export{p as a,Dt as b,Jt as c,J as d,F as e,Xt as f,ro as g,po as h,_o as i};//# sourceMappingURL=chunk-N3JLKXGY.js.map
2
- //# sourceMappingURL=chunk-N3JLKXGY.js.map
1
+ import {a as a$1}from'./chunk-MU2XP4IF.js';import {b as b$4}from'./chunk-NT4ZVSWI.js';import {c,e,f,b as b$1,a as a$5}from'./chunk-BWMECQQM.js';import {a as a$2}from'./chunk-C5PSLR7Z.js';import {b as b$2}from'./chunk-CNB64U7U.js';import {b}from'./chunk-J2HM6MWA.js';import {a as a$4}from'./chunk-SEACJS36.js';import {c as c$1}from'./chunk-XEB43J5Q.js';import {b as b$3}from'./chunk-POHYQBLL.js';import {c as c$2}from'./chunk-OMSXAN23.js';import {a}from'./chunk-HEILHNSR.js';import {a as a$3}from'./chunk-CPEOHI6I.js';import {j}from'./chunk-RAWKN3XW.js';import {useQueryClient,useQuery,useMutation,queryOptions}from'@tanstack/react-query';import $ from'hivesigner';function Dt(o,e$1,r){let n=useQueryClient(),{data:t}=useQuery(p(o));return b(["accounts","update"],o,s=>{let a=c(n.getQueryData(p(o).queryKey),t);if(!a)throw new Error("[SDK][Accounts] \u2013 cannot update not existing account");return [["account_update2",{account:o,json_metadata:"",extensions:[],posting_json_metadata:e({existingPostingJsonMetadata:a.posting_json_metadata,profile:s.profile,tokens:s.tokens})}]]},async(s,a$1)=>{n.setQueryData(p(o).queryKey,i=>{if(!i)return i;let u=JSON.parse(JSON.stringify(i));return u.profile=f({existingProfile:b$1(i),profile:a$1.profile,tokens:a$1.tokens}),u}),await b$2(e$1?.adapter,r,[a.accounts.full(o)]);},e$1,void 0,{broadcastMode:r,onMutate:async()=>{if(o)try{await n.fetchQuery({...p(o),staleTime:0});}catch{}}})}function Jt(o,e,r,n,t){return useMutation({mutationKey:["accounts","relation","update",o,e],mutationFn:async s=>{let a=a$1(o,e);await b$3().prefetchQuery(a);let i=b$3().getQueryData(a.queryKey);return await a$2(o,"follow",["follow",{follower:o,following:e,what:[...s==="toggle-ignore"&&!i?.ignores?["ignore"]:[],...s==="toggle-follow"&&!i?.follows?["blog"]:[]]}],r),{...i,ignores:s==="toggle-ignore"?!i?.ignores:i?.ignores,follows:s==="toggle-follow"?!i?.follows:i?.follows}},onError:t,onSuccess(s){n(s),b$3().setQueryData(a.accounts.relations(o,e),s),e&&b$3().invalidateQueries(p(e));}})}function J(o,e){let r=new Map;return o.forEach(([n,t])=>{r.set(n.toString(),t);}),e.forEach(([n,t])=>{r.set(n.toString(),t);}),Array.from(r.entries()).sort(([n],[t])=>n.localeCompare(t)).map(([n,t])=>[n,t])}function F(o,e){let{data:r}=useQuery(p(o));return useMutation({mutationKey:["accounts","keys-update",o],mutationFn:async({keys:n,keepCurrent:t=false,currentKey:s,keysToRevoke:a=[],keysToRevokeByAuthority:i={}})=>{if(n.length===0)throw new Error("[SDK][Update password] \u2013 no new keys provided");if(!r)throw new Error("[SDK][Update password] \u2013 cannot update keys for anon user");let u=c=>{let l=JSON.parse(JSON.stringify(r[c])),R=[...i[c]||[],...i[c]===void 0?a:[]],Q=t?l.key_auths.filter(([h])=>!R.includes(h.toString())):[];return l.key_auths=J(Q,n.map((h,M)=>[h[c].createPublic().toString(),M+1])),l};return c$1([["account_update",{account:o,json_metadata:r.json_metadata,owner:u("owner"),active:u("active"),posting:u("posting"),memo_key:n[0].memo_key.createPublic().toString()}]],s)},...e})}function Xt(o,e){let{data:r}=useQuery(p(o)),{mutateAsync:n}=F(o);return useMutation({mutationKey:["accounts","password-update",o],mutationFn:async({newPassword:t,currentPassword:s,keepCurrent:a})=>{if(!r)throw new Error("[SDK][Update password] \u2013 cannot update password for anon user");let i=a$3.fromLogin(o,s,"owner");return n({currentKey:i,keepCurrent:a,keys:[{owner:a$3.fromLogin(o,t,"owner"),active:a$3.fromLogin(o,t,"active"),posting:a$3.fromLogin(o,t,"posting"),memo_key:a$3.fromLogin(o,t,"memo")}]})},...e})}function ro(o,e,r){let n=useQueryClient(),{data:t}=useQuery(p(o));return useMutation({mutationKey:["accounts","revoke-posting",t?.name],mutationFn:async({accountName:s,type:a,key:i})=>{if(!t)throw new Error("[SDK][Accounts] \u2013\xA0cannot revoke posting for anonymous user");let u=JSON.parse(JSON.stringify(t.posting));u.account_auths=u.account_auths.filter(([l])=>l!==s);let c={account:t.name,posting:u,memo_key:t.memo_key,json_metadata:t.json_metadata};if(a==="key"&&i)return c$1([["account_update",c]],i);if(a==="keychain"){if(!r?.adapter?.broadcastWithKeychain)throw new Error("[SDK][Accounts] \u2013 missing keychain broadcaster");return r.adapter.broadcastWithKeychain(t.name,[["account_update",c]],"active")}else return e.hsCallbackUrl,$.sendOperation(["account_update",c],e.hsCallbackUrl?{callback:e.hsCallbackUrl}:{},()=>{})},onError:e.onError,onSuccess:(s,a,i)=>{e.onSuccess?.(s,a,i),n.setQueryData(p(o).queryKey,u=>({...u,posting:{...u?.posting,account_auths:u?.posting?.account_auths?.filter(([c])=>c!==a.accountName)??[]}}));}})}function po(o,e,r,n){let{data:t}=useQuery(p(o));return useMutation({mutationKey:["accounts","recovery",t?.name],mutationFn:async({accountName:s,type:a,key:i,email:u})=>{if(!t)throw new Error("[SDK][Accounts] \u2013\xA0cannot change recovery for anonymous user");let c={account_to_recover:t.name,new_recovery_account:s,extensions:[]};if(a==="ecency"){if(!e)throw new Error("[SDK][Accounts] \u2013 missing access token");let g=await a$4()(c$2.privateApiHost+"/private-api/recoveries-add",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:e,email:u,publicKeys:[...t.owner.key_auths,...t.active.key_auths,...t.posting.key_auths,t.memo_key]})});if(!g.ok)throw new Error(`[SDK][Accounts] Failed to add recovery: ${g.status}`);return g}else {if(a==="key"&&i)return c$1([["change_recovery_account",c]],i);if(a==="keychain"){if(!n?.adapter?.broadcastWithKeychain)throw new Error("[SDK][Accounts] \u2013 missing keychain broadcaster");return n.adapter.broadcastWithKeychain(t.name,[["change_recovery_account",c]],"owner")}else return r.hsCallbackUrl,$.sendOperation(["change_recovery_account",c],r.hsCallbackUrl?{callback:r.hsCallbackUrl}:{},()=>{})}},onError:r.onError,onSuccess:r.onSuccess})}function _o(o,e){let{data:r}=useQuery(p(o));return useMutation({mutationKey:["accounts","revoke-key",r?.name],mutationFn:async({currentKey:n,revokingKey:t})=>{if(!r)throw new Error("[SDK][Revoke key] \u2013 cannot update keys for anon user");let s=Array.isArray(t)?t:[t],a=b$4(r,s);return c$1([["account_update",a]],n)},...e})}function w(o){return !o.posting_json_metadata&&!o.json_metadata}function tt(o){return o?Object.values(o).some(e=>typeof e=="string"?e.length>0:e!=null):false}function p(o){return queryOptions({queryKey:a.accounts.full(o),queryFn:async({signal:e})=>{if(!o)return null;let[r,n]=await Promise.all([j("condenser_api.get_accounts",[[o]],void 0,void 0,e,c=>Array.isArray(c)),j("bridge.get_profile",{account:o},void 0,void 0,e).catch(c=>{if(e?.aborted)throw c;return null})]);if(!r?.[0])return null;let t=r[0];if(w(t)&&tt(n?.metadata?.profile)){let c=await j("condenser_api.get_accounts",[[o]],void 0,void 0,e,l=>Array.isArray(l)&&(!l[0]||!w(l[0])));if(c[0]&&!w(c[0]))t=c[0];else throw new Error(`[SDK][Accounts] \u2013 inconsistent account row for ${o}: empty json metadata while hivemind profile is populated`)}let s=a$5(t.posting_json_metadata),a=n?.stats,i=a?{account:t.name,follower_count:a.followers??0,following_count:a.following??0}:void 0,u=n?.reputation??0;return {name:t.name,owner:t.owner,active:t.active,posting:t.posting,memo_key:t.memo_key,post_count:t.post_count,created:t.created,posting_json_metadata:t.posting_json_metadata,last_vote_time:t.last_vote_time,last_post:t.last_post,json_metadata:t.json_metadata,reward_hive_balance:t.reward_hive_balance,reward_hbd_balance:t.reward_hbd_balance,reward_vesting_hive:t.reward_vesting_hive,reward_vesting_balance:t.reward_vesting_balance,balance:t.balance,hbd_balance:t.hbd_balance,savings_balance:t.savings_balance,savings_hbd_balance:t.savings_hbd_balance,savings_hbd_last_interest_payment:t.savings_hbd_last_interest_payment,savings_hbd_seconds_last_update:t.savings_hbd_seconds_last_update,savings_hbd_seconds:t.savings_hbd_seconds,next_vesting_withdrawal:t.next_vesting_withdrawal,pending_claimed_accounts:t.pending_claimed_accounts,vesting_shares:t.vesting_shares,delegated_vesting_shares:t.delegated_vesting_shares,received_vesting_shares:t.received_vesting_shares,vesting_withdraw_rate:t.vesting_withdraw_rate,to_withdraw:t.to_withdraw,withdrawn:t.withdrawn,curation_rewards:t.curation_rewards===void 0?void 0:Number(t.curation_rewards),posting_rewards:t.posting_rewards===void 0?void 0:Number(t.posting_rewards),witness_votes:t.witness_votes,proxy:t.proxy,recovery_account:t.recovery_account,proxied_vsf_votes:t.proxied_vsf_votes,voting_manabar:t.voting_manabar,voting_power:t.voting_power,downvote_manabar:t.downvote_manabar,follow_stats:i,reputation:u,profile:s}},enabled:!!o,staleTime:6e4})}export{p as a,Dt as b,Jt as c,J as d,F as e,Xt as f,ro as g,po as h,_o as i};//# sourceMappingURL=chunk-2MIOCMJB.js.map
2
+ //# sourceMappingURL=chunk-2MIOCMJB.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/modules/accounts/mutations/use-account-update.ts","../../src/modules/accounts/mutations/use-account-relations-update.ts","../../src/modules/accounts/mutations/use-account-update-key-auths.ts","../../src/modules/accounts/mutations/use-account-update-password.ts","../../src/modules/accounts/mutations/use-account-revoke-posting.ts","../../src/modules/accounts/mutations/use-account-update-recovery.ts","../../src/modules/accounts/mutations/use-account-revoke-key.ts","../../src/modules/accounts/queries/get-account-full-query-options.ts"],"names":["useAccountUpdate","username","auth","broadcastMode","queryClient","useQueryClient","data","useQuery","getAccountFullQueryOptions","useBroadcastMutation","payload","account","pickRicherMetadataSnapshot","buildPostingJsonMetadata","_data","variables","obj","buildProfileMetadata","extractAccountProfile","invalidateAfterBroadcast","QueryKeys","useAccountRelationsUpdate","reference","target","onSuccess","onError","useMutation","kind","relationsQuery","getRelationshipBetweenAccountsQueryOptions","getQueryClient","actualRelation","broadcastJson","dedupeAndSortKeyAuths","existing","additions","merged","key","weight","keyA","keyB","useAccountUpdateKeyAuths","options","accountData","keys","keepCurrent","currentKey","keysToRevoke","keysToRevokeByAuthority","prepareAuth","keyName","allKeysToRevoke","existingKeys","values","i","broadcastOperations","useAccountUpdatePassword","updateKeys","newPassword","currentPassword","PrivateKey","useAccountRevokePosting","accountName","type","posting","operationBody","hs","resp","ctx","useAccountUpdateRecovery","code","email","response","getBoundFetch","CONFIG","useAccountRevokeKey","revokingKey","revokingKeys","op","buildRevokeKeysOp","isMetadataStripped","hasProfileValues","profile","value","queryOptions","signal","bridgeProfile","callRPC","rows","e","chainAccount","reread","parseProfileMetadata","stats","follow_stats","reputationValue"],"mappings":"wpBAgEO,SAASA,EAAAA,CACdC,EACAC,GAAAA,CACAC,CAAAA,CACA,CACA,IAAMC,CAAAA,CAAcC,gBAAe,CAE7B,CAAE,KAAAC,CAAK,CAAA,CAAIC,SAASC,CAAAA,CAA2BP,CAAQ,CAAC,CAAA,CAE9D,OAAOQ,EACL,CAAC,UAAA,CAAY,QAAQ,CAAA,CACrBR,CAAAA,CACCS,GAA8B,CAQ7B,IAAMC,EAAUC,CAAAA,C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terBroadcast, QueryKeys } from \"@/modules/core\";\nimport type { BroadcastMode } from \"@/modules/core\";\nimport type { AuthContextV2 } from \"@/modules/core/types\";\nimport { useQuery, useQueryClient } from \"@tanstack/react-query\";\nimport { getAccountFullQueryOptions } from \"../queries\";\nimport { AccountProfile, FullAccount } from \"../types\";\nimport {\n buildPostingJsonMetadata,\n buildProfileMetadata,\n extractAccountProfile,\n pickRicherMetadataSnapshot,\n} from \"../utils/profile-metadata\";\n\ninterface Payload {\n profile: Partial<AccountProfile>;\n tokens: AccountProfile[\"tokens\"];\n}\n\n/**\n * React Query mutation hook for updating account profile metadata.\n *\n * This mutation broadcasts an account_update2 operation to update the user's\n * profile information (name, about, location, avatar, cover image, etc.).\n *\n * @param username - The username to update (required for broadcast)\n * @param auth - Authentication context with platform adapter and fallback configuration\n *\n * @returns React Query mutation result\n *\n * @remarks\n * **Profile Fields:**\n * - name: Display name\n * - about: Bio/description\n * - location: Location\n * - website: Website URL\n * - profile_image: Avatar URL\n * - cover_image: Cover/banner URL\n * - tokens: Social tokens (Twitter, Facebook, etc.)\n * - version: Profile metadata version (auto-set to 2)\n *\n * **Authentication:**\n * - Uses posting authority (account_update2 operation)\n * - Supports all auth methods via platform adapter\n *\n * **Post-Broadcast Actions:**\n * - Optimistically updates account cache with new profile data\n * - Invalidates account cache to refetch from blockchain\n *\n * @example\n * ```typescript\n * const updateProfile = useAccountUpdate(username, {\n * adapter: myAdapter,\n * });\n *\n * // Update profile\n * updateProfile.mutate({\n * profile: {\n * name: \"John Doe\",\n * about: \"Hive enthusiast\",\n * profile_image: \"https://...\",\n * }\n * });\n * ```\n */\nexport function useAccountUpdate(\n username: string | undefined,\n auth?: AuthContextV2,\n broadcastMode?: BroadcastMode\n) {\n const queryClient = useQueryClient();\n\n const { data } = useQuery(getAccountFullQueryOptions(username));\n\n return useBroadcastMutation(\n [\"accounts\", \"update\"],\n username,\n (payload: Partial<Payload>) => {\n // Prefer the freshest cached snapshot. onMutate has just refetched the\n // account from chain, so this usually reflects the current on-chain\n // profile rather than a possibly stale/unloaded render-time value. If\n // the cache instead holds a metadata-poorer row than the render-time\n // snapshot (e.g. a node served a stripped account row), the richer\n // snapshot wins — a partial update must never shrink the profile while\n // any snapshot still knows the full one.\n const account = pickRicherMetadataSnapshot(\n queryClient.getQueryData<FullAccount>(\n getAccountFullQueryOptions(username).queryKey\n ),\n data\n );\n\n if (!account) {\n throw new Error(\"[SDK][Accounts] – cannot update not existing account\");\n }\n\n return [\n [\n \"account_update2\",\n {\n account: username!,\n json_metadata: \"\",\n extensions: [] as [],\n // Read-modify-write the FULL on-chain metadata: deep-merge the\n // profile and preserve any non-`profile` top-level keys, so a\n // partial update never wipes unrelated fields.\n posting_json_metadata: buildPostingJsonMetadata({\n existingPostingJsonMetadata: account.posting_json_metadata,\n profile: payload.profile,\n tokens: payload.tokens,\n }),\n },\n ],\n ];\n },\n async (_data: unknown, variables: Partial<Payload>) => {\n // Optimistic cache update\n queryClient.setQueryData<FullAccount>(\n getAccountFullQueryOptions(username).queryKey,\n (data) => {\n if (!data) {\n return data;\n }\n\n const obj = JSON.parse(JSON.stringify(data)) as FullAccount;\n obj.profile = buildProfileMetadata({\n existingProfile: extractAccountProfile(data),\n profile: variables.profile,\n tokens: variables.tokens,\n });\n\n return obj;\n }\n );\n\n // Invalidate cache to refetch from blockchain\n await invalidateAfterBroadcast(auth?.adapter, broadcastMode, [\n QueryKeys.accounts.full(username)\n ]);\n },\n auth,\n undefined,\n {\n broadcastMode,\n // Before merging, force a fresh on-chain read so a stale or unloaded\n // cached snapshot cannot cause a partial update (e.g. pinning a post,\n // which sets only `pinned`) to overwrite the existing profile with a\n // near-empty object. Best-effort: if the refetch fails, the op builder\n // falls back to the cached snapshot.\n onMutate: async () => {\n if (!username) {\n return;\n }\n try {\n await queryClient.fetchQuery({\n ...getAccountFullQueryOptions(username),\n staleTime: 0,\n });\n } catch {\n // Ignore – fall back to whatever is already cached.\n }\n },\n }\n );\n}\n","import { broadcastJson, getQueryClient, QueryKeys } from \"@/modules/core\";\nimport type { AuthContext } from \"@/modules/core/types\";\nimport { useMutation } from \"@tanstack/react-query\";\nimport { getRelationshipBetweenAccountsQueryOptions, getAccountFullQueryOptions } from \"../queries\";\nimport { AccountRelationship } from \"../types\";\n\ntype Kind = \"toggle-ignore\" | \"toggle-follow\";\n\nexport function useAccountRelationsUpdate(\n reference: string | undefined,\n target: string | undefined,\n auth: AuthContext | undefined,\n onSuccess: (data: Partial<AccountRelationship> | undefined) => void,\n onError: (e: Error) => void\n) {\n return useMutation({\n mutationKey: [\"accounts\", \"relation\", \"update\", reference, target],\n mutationFn: async (kind: Kind) => {\n const relationsQuery = getRelationshipBetweenAccountsQueryOptions(\n reference!,\n target!\n );\n await getQueryClient().prefetchQuery(relationsQuery);\n const actualRelation = getQueryClient().getQueryData(\n relationsQuery.queryKey\n );\n\n await broadcastJson(\n reference,\n \"follow\",\n [\n \"follow\",\n {\n follower: reference,\n following: target,\n what: [\n ...(kind === \"toggle-ignore\" && !actualRelation?.ignores\n ? [\"ignore\"]\n : []),\n ...(kind === \"toggle-follow\" && !actualRelation?.follows\n ? [\"blog\"]\n : []),\n ],\n },\n ],\n auth\n );\n\n return {\n ...actualRelation,\n ignores:\n kind === \"toggle-ignore\"\n ? !actualRelation?.ignores\n : actualRelation?.ignores,\n follows:\n kind === \"toggle-follow\"\n ? !actualRelation?.follows\n : actualRelation?.follows,\n } satisfies Partial<AccountRelationship>;\n },\n onError,\n onSuccess(data) {\n onSuccess(data);\n\n getQueryClient().setQueryData(\n QueryKeys.accounts.relations(reference!, target!),\n data\n );\n\n // Invalidate account query to refetch follow stats (follower_count, following_count)\n // This is needed because profile pages use staleTime: Infinity for performance\n if (target) {\n getQueryClient().invalidateQueries(\n getAccountFullQueryOptions(target)\n );\n }\n },\n });\n}\n","import { PrivateKey } from \"../../../hive-tx\";\nimport type { Authority } from \"../../../hive-tx\";\nimport {\n useMutation,\n useQuery,\n type UseMutationOptions,\n} from \"@tanstack/react-query\";\nimport { getAccountFullQueryOptions } from \"../queries\";\nimport { broadcastOperations } from \"@/modules/core/hive-tx\";\n\nexport interface Keys {\n owner: PrivateKey;\n active: PrivateKey;\n posting: PrivateKey;\n memo_key: PrivateKey;\n}\n\ninterface Payload {\n keepCurrent?: boolean;\n currentKey: PrivateKey;\n keys: Keys[];\n keysToRevoke?: string[]; // Deprecated: will be treated as revoking from all authorities\n keysToRevokeByAuthority?: Partial<Record<keyof Keys, string[]>>; // Authority-specific revocation\n}\n\nexport function dedupeAndSortKeyAuths(\n existing: Authority[\"key_auths\"],\n additions: [string, number][]\n): Authority[\"key_auths\"] {\n const merged = new Map<string, number>();\n\n existing.forEach(([key, weight]) => {\n merged.set(key.toString(), weight);\n });\n\n additions.forEach(([key, weight]) => {\n merged.set(key.toString(), weight);\n });\n\n return Array.from(merged.entries())\n .sort(([keyA], [keyB]) => keyA.localeCompare(keyB))\n .map(([key, weight]) => [key, weight] as [string, number]);\n}\n\ntype UpdateKeyAuthsOptions = Pick<\n UseMutationOptions<unknown, Error, Payload>,\n \"onSuccess\" | \"onError\"\n>;\n\nexport function useAccountUpdateKeyAuths(\n username: string,\n options?: UpdateKeyAuthsOptions\n) {\n const { data: accountData } = useQuery(getAccountFullQueryOptions(username));\n\n return useMutation({\n mutationKey: [\"accounts\", \"keys-update\", username],\n mutationFn: async ({\n keys,\n keepCurrent = false,\n currentKey,\n keysToRevoke = [],\n keysToRevokeByAuthority = {}\n }: Payload) => {\n if (keys.length === 0) {\n throw new Error(\n \"[SDK][Update password] – no new keys provided\"\n );\n }\n\n if (!accountData) {\n throw new Error(\n \"[SDK][Update password] – cannot update keys for anon user\"\n );\n }\n\n const prepareAuth = (keyName: keyof Keys) => {\n const auth: Authority = JSON.parse(JSON.stringify(accountData[keyName]));\n\n // Get keys to revoke for this specific authority\n const keysToRevokeForAuthority = keysToRevokeByAuthority[keyName] || [];\n // Fallback to global keysToRevoke for backwards compatibility\n const allKeysToRevoke = [\n ...keysToRevokeForAuthority,\n ...(keysToRevokeByAuthority[keyName] === undefined ? keysToRevoke : [])\n ];\n\n // Filter out keys to revoke from existing keys (authority-specific)\n const existingKeys = keepCurrent\n ? auth.key_auths.filter(([key]) => !allKeysToRevoke.includes(key.toString()))\n : [];\n\n auth.key_auths = dedupeAndSortKeyAuths(\n existingKeys,\n keys.map(\n (values, i) =>\n [values[keyName].createPublic().toString(), i + 1] as [\n string,\n number,\n ]\n )\n );\n\n return auth;\n };\n\n return broadcastOperations(\n [[\"account_update\", {\n account: username,\n json_metadata: accountData.json_metadata,\n owner: prepareAuth(\"owner\"),\n active: prepareAuth(\"active\"),\n posting: prepareAuth(\"posting\"),\n // Always use new memo key when adding new keys\n memo_key: keys[0].memo_key.createPublic().toString(),\n }]],\n currentKey\n );\n },\n ...options,\n });\n}\n","import { PrivateKey } from \"../../../hive-tx\";\nimport {\n useMutation,\n useQuery,\n type UseMutationOptions,\n} from \"@tanstack/react-query\";\nimport { getAccountFullQueryOptions } from \"../queries\";\nimport { useAccountUpdateKeyAuths } from \"./use-account-update-key-auths\";\n\ninterface Payload {\n newPassword: string;\n currentPassword: string;\n keepCurrent?: boolean;\n}\n\n/**\n * Only native Hive and custom passwords could be updated here\n * Seed based password cannot be updated here, it will be in an account always for now\n */\ntype UpdatePasswordOptions = Pick<\n UseMutationOptions<unknown, Error, Payload>,\n \"onSuccess\" | \"onError\"\n>;\n\nexport function useAccountUpdatePassword(\n username: string,\n options?: UpdatePasswordOptions\n) {\n const { data: accountData } = useQuery(getAccountFullQueryOptions(username));\n\n const { mutateAsync: updateKeys } = useAccountUpdateKeyAuths(username);\n\n return useMutation({\n mutationKey: [\"accounts\", \"password-update\", username],\n mutationFn: async ({\n newPassword,\n currentPassword,\n keepCurrent,\n }: Payload) => {\n if (!accountData) {\n throw new Error(\n \"[SDK][Update password] – cannot update password for anon user\"\n );\n }\n const currentKey = PrivateKey.fromLogin(\n username,\n currentPassword,\n \"owner\"\n );\n\n return updateKeys({\n currentKey,\n keepCurrent,\n keys: [\n {\n owner: PrivateKey.fromLogin(username, newPassword, \"owner\"),\n active: PrivateKey.fromLogin(username, newPassword, \"active\"),\n posting: PrivateKey.fromLogin(username, newPassword, \"posting\"),\n memo_key: PrivateKey.fromLogin(username, newPassword, \"memo\"),\n },\n ],\n });\n },\n ...options,\n });\n}\n","import { PrivateKey } from \"../../../hive-tx\";\nimport {\n useMutation,\n useQuery,\n useQueryClient,\n type UseMutationOptions,\n} from \"@tanstack/react-query\";\nimport { getAccountFullQueryOptions } from \"../queries\";\nimport { FullAccount } from \"../types\";\nimport hs from \"hivesigner\";\nimport type { AuthContextV2 } from \"@/modules/core/types\";\nimport { broadcastOperations } from \"@/modules/core/hive-tx\";\n\ntype SignType = \"key\" | \"keychain\" | \"hivesigner\";\n\ninterface CommonPayload {\n accountName: string;\n type: SignType;\n key?: PrivateKey;\n}\n\ntype RevokePostingOptions = Pick<\n UseMutationOptions<unknown, Error, CommonPayload>,\n \"onSuccess\" | \"onError\"\n> & {\n hsCallbackUrl?: string;\n};\n\nexport function useAccountRevokePosting(\n username: string | undefined,\n options: RevokePostingOptions,\n auth?: AuthContextV2\n) {\n const queryClient = useQueryClient();\n\n const { data } = useQuery(getAccountFullQueryOptions(username));\n\n return useMutation({\n mutationKey: [\"accounts\", \"revoke-posting\", data?.name],\n mutationFn: async ({ accountName, type, key }: CommonPayload) => {\n if (!data) {\n throw new Error(\n \"[SDK][Accounts] – cannot revoke posting for anonymous user\"\n );\n }\n\n const posting = JSON.parse(JSON.stringify(data.posting)) as FullAccount[\"posting\"];\n\n posting.account_auths = posting.account_auths.filter(\n ([account]) => account !== accountName\n );\n\n const operationBody = {\n account: data.name,\n posting,\n memo_key: data.memo_key,\n json_metadata: data.json_metadata,\n };\n\n if (type === \"key\" && key) {\n return broadcastOperations([[\"account_update\", operationBody]], key);\n } else if (type === \"keychain\") {\n if (!auth?.adapter?.broadcastWithKeychain) {\n throw new Error(\"[SDK][Accounts] – missing keychain broadcaster\");\n }\n return auth.adapter.broadcastWithKeychain(\n data.name,\n [[\"account_update\", operationBody]],\n \"active\"\n );\n } else {\n if (!options.hsCallbackUrl && process.env.NODE_ENV === \"development\") {\n console.warn(\"[SDK][Accounts] hsCallbackUrl not provided for HiveSigner revoke-posting; user will not be redirected after signing.\");\n }\n return hs.sendOperation(\n [\"account_update\", operationBody],\n options.hsCallbackUrl ? { callback: options.hsCallbackUrl } : {},\n () => {}\n );\n }\n },\n onError: options.onError,\n onSuccess: (resp, payload, ctx) => {\n (options.onSuccess as\n | ((data: unknown, variables: CommonPayload, context: unknown) => unknown)\n | undefined)?.(resp, payload, ctx);\n queryClient.setQueryData<FullAccount>(\n getAccountFullQueryOptions(username).queryKey,\n (data) =>\n ({\n ...data,\n posting: {\n ...data?.posting,\n account_auths:\n data?.posting?.account_auths?.filter(\n ([account]) => account !== payload.accountName\n ) ?? [],\n },\n }) as FullAccount\n );\n },\n });\n}\n","import { CONFIG, getBoundFetch } from \"@/modules/core\";\nimport { PrivateKey } from \"../../../hive-tx\";\nimport {\n useMutation,\n useQuery,\n type UseMutationOptions,\n} from \"@tanstack/react-query\";\nimport hs from \"hivesigner\";\nimport { getAccountFullQueryOptions } from \"../queries\";\nimport type { AuthContextV2 } from \"@/modules/core/types\";\nimport { broadcastOperations } from \"@/modules/core/hive-tx\";\n\ntype SignType = \"key\" | \"keychain\" | \"hivesigner\" | \"ecency\";\n\ninterface CommonPayload {\n accountName: string;\n type: SignType;\n key?: PrivateKey;\n email?: string;\n}\n\ntype UpdateRecoveryOptions = Pick<\n UseMutationOptions<unknown, Error, CommonPayload>,\n \"onSuccess\" | \"onError\"\n> & {\n hsCallbackUrl?: string;\n};\n\nexport function useAccountUpdateRecovery(\n username: string | undefined,\n code: string | undefined,\n options: UpdateRecoveryOptions,\n auth?: AuthContextV2\n) {\n const { data } = useQuery(getAccountFullQueryOptions(username));\n\n return useMutation({\n mutationKey: [\"accounts\", \"recovery\", data?.name],\n mutationFn: async ({ accountName, type, key, email }: CommonPayload) => {\n if (!data) {\n throw new Error(\n \"[SDK][Accounts] – cannot change recovery for anonymous user\"\n );\n }\n\n const operationBody = {\n account_to_recover: data.name,\n new_recovery_account: accountName,\n extensions: [] as [],\n };\n\n if (type === \"ecency\") {\n if (!code) {\n throw new Error(\"[SDK][Accounts] – missing access token\");\n }\n const fetchApi = getBoundFetch();\n\n const response = await fetchApi(CONFIG.privateApiHost + \"/private-api/recoveries-add\", {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({\n code,\n email,\n publicKeys: [\n ...data.owner.key_auths,\n ...data.active.key_auths,\n ...data.posting.key_auths,\n data.memo_key,\n ],\n }),\n });\n\n // Raw fetch resolves on 4xx/5xx, so guard explicitly — otherwise the\n // caller's onSuccess shows a \"recovery updated\" toast on a failed request.\n // (The missing Content-Type header also made the backend skip JSON parsing.)\n if (!response.ok) {\n throw new Error(`[SDK][Accounts] Failed to add recovery: ${response.status}`);\n }\n\n return response;\n } else if (type === \"key\" && key) {\n return broadcastOperations(\n [[\"change_recovery_account\", operationBody]],\n key\n );\n } else if (type === \"keychain\") {\n if (!auth?.adapter?.broadcastWithKeychain) {\n throw new Error(\"[SDK][Accounts] – missing keychain broadcaster\");\n }\n return auth.adapter.broadcastWithKeychain(data.name, [[\"change_recovery_account\", operationBody]], \"owner\");\n } else {\n if (!options.hsCallbackUrl && process.env.NODE_ENV === \"development\") {\n console.warn(\"[SDK][Accounts] hsCallbackUrl not provided for HiveSigner update-recovery; user will not be redirected after signing.\");\n }\n return hs.sendOperation(\n [\"change_recovery_account\", operationBody],\n options.hsCallbackUrl ? { callback: options.hsCallbackUrl } : {},\n () => {}\n );\n }\n },\n onError: options.onError,\n onSuccess: options.onSuccess,\n });\n}\n","import { PrivateKey, PublicKey } from \"../../../hive-tx\";\nimport {\n useMutation,\n useQuery,\n type UseMutationOptions,\n} from \"@tanstack/react-query\";\nimport { getAccountFullQueryOptions } from \"../queries\";\nimport { buildRevokeKeysOp } from \"./build-revoke-keys-op\";\nimport { broadcastOperations } from \"@/modules/core/hive-tx\";\n\ninterface Payload {\n currentKey: PrivateKey;\n /** Keys to revoke. Accepts a single key or an array. */\n revokingKey: PublicKey | PublicKey[];\n}\n\n/**\n * Revoke one or more keys from an account on the Hive blockchain.\n *\n * When revoking keys that exist only in active/posting authorities,\n * the owner field is omitted from the operation so active-level\n * signing is sufficient.\n */\ntype RevokeKeyOptions = Pick<\n UseMutationOptions<unknown, Error, Payload>,\n \"onSuccess\" | \"onError\"\n>;\n\nexport function useAccountRevokeKey(\n username: string | undefined,\n options?: RevokeKeyOptions\n) {\n const { data: accountData } = useQuery(getAccountFullQueryOptions(username));\n\n return useMutation({\n mutationKey: [\"accounts\", \"revoke-key\", accountData?.name],\n mutationFn: async ({ currentKey, revokingKey }: Payload) => {\n if (!accountData) {\n throw new Error(\n \"[SDK][Revoke key] – cannot update keys for anon user\"\n );\n }\n\n const revokingKeys = Array.isArray(revokingKey) ? revokingKey : [revokingKey];\n const op = buildRevokeKeysOp(accountData, revokingKeys);\n\n return broadcastOperations([[\"account_update\", op]], currentKey);\n },\n ...options,\n });\n}\n","import { QueryKeys } from \"@/modules/core\";\nimport {\n AccountFollowStats,\n FullAccount,\n} from \"../types\";\nimport { parseProfileMetadata } from \"@/modules/accounts\";\nimport { queryOptions } from \"@tanstack/react-query\";\nimport { callRPC } from \"@/modules/core/hive-tx\";\n\n/** The raw `condenser_api.get_accounts` row — every FullAccount field except the three\n * this query derives separately (follow_stats + reputation from bridge, profile parsed). */\ntype RawAccount = Omit<FullAccount, \"follow_stats\" | \"reputation\" | \"profile\">;\n\n/** Minimal shape read from `bridge.get_profile` (hivemind social profile): it carries\n * the reputation score, the follower/following counts and hivemind's parsed\n * (normalized) profile — the latter is used only to cross-validate the chain row. */\ninterface BridgeProfile {\n reputation?: number;\n stats?: { followers?: number; following?: number };\n metadata?: { profile?: Record<string, unknown> };\n}\n\n/** True when the chain row carries no account metadata at all. Legitimate for\n * accounts that never set a profile — but combined with a populated hivemind\n * profile it identifies a node serving stripped account rows. */\nfunction isMetadataStripped(account: RawAccount): boolean {\n return !account.posting_json_metadata && !account.json_metadata;\n}\n\n/** True when a hivemind `metadata.profile` object carries at least one real\n * value. Hivemind emits its fixed profile keys with empty strings for\n * accounts without a profile, so key presence alone proves nothing. */\nfunction hasProfileValues(profile?: Record<string, unknown> | null): boolean {\n if (!profile) return false;\n return Object.values(profile).some((value) =>\n typeof value === \"string\" ? value.length > 0 : value != null\n );\n}\n\nexport function getAccountFullQueryOptions(username: string | undefined) {\n return queryOptions({\n queryKey: QueryKeys.accounts.full(username),\n queryFn: async ({ signal }) => {\n if (!username) {\n return null;\n }\n\n // Fetch the chain account (balances/keys/vesting) and the hivemind profile in\n // parallel — both only need the username. bridge.get_profile carries BOTH the\n // follower/following counts and the reputation score, so it replaces the old\n // second-layer condenser_api.get_follow_count RPC *and* the reputation-api REST\n // call: condenser_api.get_accounts no longer returns a usable reputation (it is 0\n // since the hardfork), and there is no reason to make two extra round-trips for\n // data one profile object already carries.\n const [response, bridgeProfile] = await Promise.all([\n callRPC<RawAccount[]>(\n \"condenser_api.get_accounts\",\n [[username]],\n undefined,\n undefined,\n signal,\n // A correct node always answers get_accounts with an array — a null\n // result in a well-formed envelope is a node fault (observed in the\n // wild), so fail over to the next node instead of misreading it as\n // \"account does not exist\".\n (rows) => Array.isArray(rows)\n ),\n callRPC<BridgeProfile>(\n \"bridge.get_profile\",\n { account: username },\n undefined,\n undefined,\n signal\n ).catch((e): BridgeProfile | null => {\n // A caller cancel (aborted signal) must propagate — only genuine RPC/transport\n // failures degrade to reputation 0 / no follow_stats.\n if (signal?.aborted) throw e;\n return null;\n })\n ]);\n if (!response?.[0]) {\n // The account does not exist (e.g. not yet finalized on-chain during\n // signup). Treat absence as a recoverable null instead of throwing, so\n // consumers (useQuery hooks and fetchQuery callers) surface it as empty\n // data rather than an unhandled rejection / error-boundary crash.\n return null;\n }\n\n let chainAccount = response[0];\n\n // Cross-validate the chain row against the hivemind profile fetched in\n // the same query. Some public nodes serve account rows with BOTH\n // metadata fields stripped to \"\" (observed in the wild) while their own\n // hivemind still returns the real profile — and a merge base built from\n // such a row wipes the user's profile on the next partial\n // account_update2. When the row claims \"no metadata\" but hivemind\n // disagrees, re-read once (failover may pick another node) and otherwise\n // fail the query: an error here is recoverable, a poisoned cache entry\n // is not.\n if (\n isMetadataStripped(chainAccount) &&\n hasProfileValues(bridgeProfile?.metadata?.profile)\n ) {\n // The re-read carries a payload validator: a stripped row is treated\n // as a node fault, so the failover walk moves on to other nodes (and\n // repeat offenders earn a per-API health cooldown) instead of asking\n // the same lying node twice.\n const reread = await callRPC<RawAccount[]>(\n \"condenser_api.get_accounts\",\n [[username]],\n undefined,\n undefined,\n signal,\n (rows) =>\n Array.isArray(rows) &&\n (!rows[0] || !isMetadataStripped(rows[0] as RawAccount))\n );\n if (reread[0] && !isMetadataStripped(reread[0])) {\n chainAccount = reread[0];\n } else {\n throw new Error(\n `[SDK][Accounts] – inconsistent account row for ${username}: empty json metadata while hivemind profile is populated`\n );\n }\n }\n\n const profile = parseProfileMetadata(chainAccount.posting_json_metadata);\n\n // bridge.get_profile.stats → follower/following counts; `reputation` is the\n // computed score (e.g. 78.29). accountReputation() floors an in-range score, so\n // it yields the same value the reputation-api used to return. Both degrade to a\n // safe default if the profile call failed.\n const stats = bridgeProfile?.stats;\n const follow_stats: AccountFollowStats | undefined = stats\n ? {\n account: chainAccount.name,\n follower_count: stats.followers ?? 0,\n following_count: stats.following ?? 0\n }\n : undefined;\n const reputationValue: number = bridgeProfile?.reputation ?? 0;\n\n return {\n name: chainAccount.name,\n owner: chainAccount.owner,\n active: chainAccount.active,\n posting: chainAccount.posting,\n memo_key: chainAccount.memo_key,\n post_count: chainAccount.post_count,\n created: chainAccount.created,\n posting_json_metadata: chainAccount.posting_json_metadata,\n last_vote_time: chainAccount.last_vote_time,\n last_post: chainAccount.last_post,\n json_metadata: chainAccount.json_metadata,\n reward_hive_balance: chainAccount.reward_hive_balance,\n reward_hbd_balance: chainAccount.reward_hbd_balance,\n reward_vesting_hive: chainAccount.reward_vesting_hive,\n reward_vesting_balance: chainAccount.reward_vesting_balance,\n balance: chainAccount.balance,\n hbd_balance: chainAccount.hbd_balance,\n savings_balance: chainAccount.savings_balance,\n savings_hbd_balance: chainAccount.savings_hbd_balance,\n savings_hbd_last_interest_payment:\n chainAccount.savings_hbd_last_interest_payment,\n savings_hbd_seconds_last_update:\n chainAccount.savings_hbd_seconds_last_update,\n savings_hbd_seconds: chainAccount.savings_hbd_seconds,\n next_vesting_withdrawal: chainAccount.next_vesting_withdrawal,\n pending_claimed_accounts: chainAccount.pending_claimed_accounts,\n vesting_shares: chainAccount.vesting_shares,\n delegated_vesting_shares: chainAccount.delegated_vesting_shares,\n received_vesting_shares: chainAccount.received_vesting_shares,\n vesting_withdraw_rate: chainAccount.vesting_withdraw_rate,\n to_withdraw: chainAccount.to_withdraw,\n withdrawn: chainAccount.withdrawn,\n // int64 counters. Condenser serves them unquoted, so normalize here in case a\n // node quotes them, but leave an omitted counter undefined: absent is unknown,\n // and coercing it to 0 would understate every ratio derived from it.\n curation_rewards:\n chainAccount.curation_rewards === undefined\n ? undefined\n : Number(chainAccount.curation_rewards),\n posting_rewards:\n chainAccount.posting_rewards === undefined\n ? undefined\n : Number(chainAccount.posting_rewards),\n witness_votes: chainAccount.witness_votes,\n proxy: chainAccount.proxy,\n recovery_account: chainAccount.recovery_account,\n proxied_vsf_votes: chainAccount.proxied_vsf_votes,\n voting_manabar: chainAccount.voting_manabar,\n voting_power: chainAccount.voting_power,\n downvote_manabar: chainAccount.downvote_manabar,\n follow_stats,\n reputation: reputationValue,\n profile,\n } satisfies FullAccount;\n },\n enabled: !!username,\n staleTime: 60000,\n });\n}\n"]}
1
+ {"version":3,"sources":["../../src/modules/accounts/mutations/use-account-update.ts","../../src/modules/accounts/mutations/use-account-relations-update.ts","../../src/modules/accounts/mutations/use-account-update-key-auths.ts","../../src/modules/accounts/mutations/use-account-update-password.ts","../../src/modules/accounts/mutations/use-account-revoke-posting.ts","../../src/modules/accounts/mutations/use-account-update-recovery.ts","../../src/modules/accounts/mutations/use-account-revoke-key.ts","../../src/modules/accounts/queries/get-account-full-query-options.ts"],"names":["useAccountUpdate","username","auth","broadcastMode","queryClient","useQueryClient","data","useQuery","getAccountFullQueryOptions","useBroadcastMutation","payload","account","pickRicherMetadataSnapshot","buildPostingJsonMetadata","_data","variables","obj","buildProfileMetadata","extractAccountProfile","invalidateAfterBroadcast","QueryKeys","useAccountRelationsUpdate","reference","target","onSuccess","onError","useMutation","kind","relationsQuery","getRelationshipBetweenAccountsQueryOptions","getQueryClient","actualRelation","broadcastJson","dedupeAndSortKeyAuths","existing","additions","merged","key","weight","keyA","keyB","useAccountUpdateKeyAuths","options","accountData","keys","keepCurrent","currentKey","keysToRevoke","keysToRevokeByAuthority","prepareAuth","keyName","allKeysToRevoke","existingKeys","values","i","broadcastOperations","useAccountUpdatePassword","updateKeys","newPassword","currentPassword","PrivateKey","useAccountRevokePosting","accountName","type","posting","operationBody","hs","resp","ctx","useAccountUpdateRecovery","code","email","response","getBoundFetch","CONFIG","useAccountRevokeKey","revokingKey","revokingKeys","op","buildRevokeKeysOp","isMetadataStripped","hasProfileValues","profile","value","queryOptions","signal","bridgeProfile","callRPC","rows","e","chainAccount","reread","parseProfileMetadata","stats","follow_stats","reputationValue"],"mappings":"wpBAgEO,SAASA,EAAAA,CACdC,EACAC,GAAAA,CACAC,CAAAA,CACA,CACA,IAAMC,CAAAA,CAAcC,gBAAe,CAE7B,CAAE,KAAAC,CAAK,CAAA,CAAIC,SAASC,CAAAA,CAA2BP,CAAQ,CAAC,CAAA,CAE9D,OAAOQ,EACL,CAAC,UAAA,CAAY,QAAQ,CAAA,CACrBR,CAAAA,CACCS,GAA8B,CAQ7B,IAAMC,EAAUC,CAAAA,CACdR,CAAAA,CAAY,aACVI,CAAAA,CAA2BP,CAAQ,EAAE,QACvC,CAAA,CACAK,CACF,CAAA,CAE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AA,CAASA,CAAAA,CAAa,OAAA,CACtB,YAAaA,CAAAA,CAAa,WAAA,CAC1B,gBAAiBA,CAAAA,CAAa,eAAA,CAC9B,oBAAqBA,CAAAA,CAAa,mBAAA,CAClC,kCACEA,CAAAA,CAAa,iCAAA,CACf,gCACEA,CAAAA,CAAa,+BAAA,CACf,oBAAqBA,CAAAA,CAAa,mBAAA,CAClC,wBAAyBA,CAAAA,CAAa,uBAAA,CACtC,yBAA0BA,CAAAA,CAAa,wBAAA,CACvC,eAAgBA,CAAAA,CAAa,cAAA,CAC7B,yBAA0BA,CAAAA,CAAa,wBAAA,CACvC,wBAAyBA,CAAAA,CAAa,uBAAA,CACtC,sBAAuBA,CAAAA,CAAa,qBAAA,CACpC,YAAaA,CAAAA,CAAa,WAAA,CAC1B,UAAWA,CAAAA,CAAa,SAAA,CAIxB,iBACEA,CAAAA,CAAa,gBAAA,GAAqB,MAAA,CAC9B,MAAA,CACA,MAAA,CAAOA,CAAAA,CAAa,gBAAgB,CAAA,CAC1C,eAAA,CACEA,EAAa,eAAA,GAAoB,MAAA,CAC7B,OACA,MAAA,CAAOA,CAAAA,CAAa,eAAe,CAAA,CACzC,aAAA,CAAeA,EAAa,aAAA,CAC5B,KAAA,CAAOA,EAAa,KAAA,CACpB,gBAAA,CAAkBA,EAAa,gBAAA,CAC/B,iBAAA,CAAmBA,EAAa,iBAAA,CAChC,cAAA,CAAgBA,EAAa,cAAA,CAC7B,YAAA,CAAcA,EAAa,YAAA,CAC3B,gBAAA,CAAkBA,EAAa,gBAAA,CAC/B,YAAA,CAAAI,EACA,UAAA,CAAYC,CAAAA,CACZ,QAAAb,CACF,CACF,EACA,OAAA,CAAS,CAAC,CAACjF,CAAAA,CACX,SAAA,CAAW,GACb,CAAC,CACH","file":"chunk-2MIOCMJB.js","sourcesContent":["import { useBroadcastMutation, invalidateAfterBroadcast, QueryKeys } from \"@/modules/core\";\nimport type { BroadcastMode } from \"@/modules/core\";\nimport type { AuthContextV2 } from \"@/modules/core/types\";\nimport { useQuery, useQueryClient } from \"@tanstack/react-query\";\nimport { getAccountFullQueryOptions } from \"../queries\";\nimport { AccountProfile, FullAccount } from \"../types\";\nimport {\n buildPostingJsonMetadata,\n buildProfileMetadata,\n extractAccountProfile,\n pickRicherMetadataSnapshot,\n} from \"../utils/profile-metadata\";\n\ninterface Payload {\n profile: Partial<AccountProfile>;\n tokens: AccountProfile[\"tokens\"];\n}\n\n/**\n * React Query mutation hook for updating account profile metadata.\n *\n * This mutation broadcasts an account_update2 operation to update the user's\n * profile information (name, about, location, avatar, cover image, etc.).\n *\n * @param username - The username to update (required for broadcast)\n * @param auth - Authentication context with platform adapter and fallback configuration\n *\n * @returns React Query mutation result\n *\n * @remarks\n * **Profile Fields:**\n * - name: Display name\n * - about: Bio/description\n * - location: Location\n * - website: Website URL\n * - profile_image: Avatar URL\n * - cover_image: Cover/banner URL\n * - tokens: Social tokens (Twitter, Facebook, etc.)\n * - version: Profile metadata version (auto-set to 2)\n *\n * **Authentication:**\n * - Uses posting authority (account_update2 operation)\n * - Supports all auth methods via platform adapter\n *\n * **Post-Broadcast Actions:**\n * - Optimistically updates account cache with new profile data\n * - Invalidates account cache to refetch from blockchain\n *\n * @example\n * ```typescript\n * const updateProfile = useAccountUpdate(username, {\n * adapter: myAdapter,\n * });\n *\n * // Update profile\n * updateProfile.mutate({\n * profile: {\n * name: \"John Doe\",\n * about: \"Hive enthusiast\",\n * profile_image: \"https://...\",\n * }\n * });\n * ```\n */\nexport function useAccountUpdate(\n username: string | undefined,\n auth?: AuthContextV2,\n broadcastMode?: BroadcastMode\n) {\n const queryClient = useQueryClient();\n\n const { data } = useQuery(getAccountFullQueryOptions(username));\n\n return useBroadcastMutation(\n [\"accounts\", \"update\"],\n username,\n (payload: Partial<Payload>) => {\n // Prefer the freshest cached snapshot. onMutate has just refetched the\n // account from chain, so this usually reflects the current on-chain\n // profile rather than a possibly stale/unloaded render-time value. If\n // the cache instead holds a metadata-poorer row than the render-time\n // snapshot (e.g. a node served a stripped account row), the richer\n // snapshot wins — a partial update must never shrink the profile while\n // any snapshot still knows the full one.\n const account = pickRicherMetadataSnapshot(\n queryClient.getQueryData<FullAccount>(\n getAccountFullQueryOptions(username).queryKey\n ),\n data\n );\n\n if (!account) {\n throw new Error(\"[SDK][Accounts] – cannot update not existing account\");\n }\n\n return [\n [\n \"account_update2\",\n {\n account: username!,\n json_metadata: \"\",\n extensions: [] as [],\n // Read-modify-write the FULL on-chain metadata: deep-merge the\n // profile and preserve any non-`profile` top-level keys, so a\n // partial update never wipes unrelated fields.\n posting_json_metadata: buildPostingJsonMetadata({\n existingPostingJsonMetadata: account.posting_json_metadata,\n profile: payload.profile,\n tokens: payload.tokens,\n }),\n },\n ],\n ];\n },\n async (_data: unknown, variables: Partial<Payload>) => {\n // Optimistic cache update\n queryClient.setQueryData<FullAccount>(\n getAccountFullQueryOptions(username).queryKey,\n (data) => {\n if (!data) {\n return data;\n }\n\n const obj = JSON.parse(JSON.stringify(data)) as FullAccount;\n obj.profile = buildProfileMetadata({\n existingProfile: extractAccountProfile(data),\n profile: variables.profile,\n tokens: variables.tokens,\n });\n\n return obj;\n }\n );\n\n // Invalidate cache to refetch from blockchain\n await invalidateAfterBroadcast(auth?.adapter, broadcastMode, [\n QueryKeys.accounts.full(username)\n ]);\n },\n auth,\n undefined,\n {\n broadcastMode,\n // Before merging, force a fresh on-chain read so a stale or unloaded\n // cached snapshot cannot cause a partial update (e.g. pinning a post,\n // which sets only `pinned`) to overwrite the existing profile with a\n // near-empty object. Best-effort: if the refetch fails, the op builder\n // falls back to the cached snapshot.\n onMutate: async () => {\n if (!username) {\n return;\n }\n try {\n await queryClient.fetchQuery({\n ...getAccountFullQueryOptions(username),\n staleTime: 0,\n });\n } catch {\n // Ignore – fall back to whatever is already cached.\n }\n },\n }\n );\n}\n","import { broadcastJson, getQueryClient, QueryKeys } from \"@/modules/core\";\nimport type { AuthContext } from \"@/modules/core/types\";\nimport { useMutation } from \"@tanstack/react-query\";\nimport { getRelationshipBetweenAccountsQueryOptions, getAccountFullQueryOptions } from \"../queries\";\nimport { AccountRelationship } from \"../types\";\n\ntype Kind = \"toggle-ignore\" | \"toggle-follow\";\n\nexport function useAccountRelationsUpdate(\n reference: string | undefined,\n target: string | undefined,\n auth: AuthContext | undefined,\n onSuccess: (data: Partial<AccountRelationship> | undefined) => void,\n onError: (e: Error) => void\n) {\n return useMutation({\n mutationKey: [\"accounts\", \"relation\", \"update\", reference, target],\n mutationFn: async (kind: Kind) => {\n const relationsQuery = getRelationshipBetweenAccountsQueryOptions(\n reference!,\n target!\n );\n await getQueryClient().prefetchQuery(relationsQuery);\n const actualRelation = getQueryClient().getQueryData(\n relationsQuery.queryKey\n );\n\n await broadcastJson(\n reference,\n \"follow\",\n [\n \"follow\",\n {\n follower: reference,\n following: target,\n what: [\n ...(kind === \"toggle-ignore\" && !actualRelation?.ignores\n ? [\"ignore\"]\n : []),\n ...(kind === \"toggle-follow\" && !actualRelation?.follows\n ? [\"blog\"]\n : []),\n ],\n },\n ],\n auth\n );\n\n return {\n ...actualRelation,\n ignores:\n kind === \"toggle-ignore\"\n ? !actualRelation?.ignores\n : actualRelation?.ignores,\n follows:\n kind === \"toggle-follow\"\n ? !actualRelation?.follows\n : actualRelation?.follows,\n } satisfies Partial<AccountRelationship>;\n },\n onError,\n onSuccess(data) {\n onSuccess(data);\n\n getQueryClient().setQueryData(\n QueryKeys.accounts.relations(reference!, target!),\n data\n );\n\n // Invalidate account query to refetch follow stats (follower_count, following_count)\n // This is needed because profile pages use staleTime: Infinity for performance\n if (target) {\n getQueryClient().invalidateQueries(\n getAccountFullQueryOptions(target)\n );\n }\n },\n });\n}\n","import { PrivateKey } from \"../../../hive-tx\";\nimport type { Authority } from \"../../../hive-tx\";\nimport {\n useMutation,\n useQuery,\n type UseMutationOptions,\n} from \"@tanstack/react-query\";\nimport { getAccountFullQueryOptions } from \"../queries\";\nimport { broadcastOperations } from \"@/modules/core/hive-tx\";\n\nexport interface Keys {\n owner: PrivateKey;\n active: PrivateKey;\n posting: PrivateKey;\n memo_key: PrivateKey;\n}\n\ninterface Payload {\n keepCurrent?: boolean;\n currentKey: PrivateKey;\n keys: Keys[];\n keysToRevoke?: string[]; // Deprecated: will be treated as revoking from all authorities\n keysToRevokeByAuthority?: Partial<Record<keyof Keys, string[]>>; // Authority-specific revocation\n}\n\nexport function dedupeAndSortKeyAuths(\n existing: Authority[\"key_auths\"],\n additions: [string, number][]\n): Authority[\"key_auths\"] {\n const merged = new Map<string, number>();\n\n existing.forEach(([key, weight]) => {\n merged.set(key.toString(), weight);\n });\n\n additions.forEach(([key, weight]) => {\n merged.set(key.toString(), weight);\n });\n\n return Array.from(merged.entries())\n .sort(([keyA], [keyB]) => keyA.localeCompare(keyB))\n .map(([key, weight]) => [key, weight] as [string, number]);\n}\n\ntype UpdateKeyAuthsOptions = Pick<\n UseMutationOptions<unknown, Error, Payload>,\n \"onSuccess\" | \"onError\"\n>;\n\nexport function useAccountUpdateKeyAuths(\n username: string,\n options?: UpdateKeyAuthsOptions\n) {\n const { data: accountData } = useQuery(getAccountFullQueryOptions(username));\n\n return useMutation({\n mutationKey: [\"accounts\", \"keys-update\", username],\n mutationFn: async ({\n keys,\n keepCurrent = false,\n currentKey,\n keysToRevoke = [],\n keysToRevokeByAuthority = {}\n }: Payload) => {\n if (keys.length === 0) {\n throw new Error(\n \"[SDK][Update password] – no new keys provided\"\n );\n }\n\n if (!accountData) {\n throw new Error(\n \"[SDK][Update password] – cannot update keys for anon user\"\n );\n }\n\n const prepareAuth = (keyName: keyof Keys) => {\n const auth: Authority = JSON.parse(JSON.stringify(accountData[keyName]));\n\n // Get keys to revoke for this specific authority\n const keysToRevokeForAuthority = keysToRevokeByAuthority[keyName] || [];\n // Fallback to global keysToRevoke for backwards compatibility\n const allKeysToRevoke = [\n ...keysToRevokeForAuthority,\n ...(keysToRevokeByAuthority[keyName] === undefined ? keysToRevoke : [])\n ];\n\n // Filter out keys to revoke from existing keys (authority-specific)\n const existingKeys = keepCurrent\n ? auth.key_auths.filter(([key]) => !allKeysToRevoke.includes(key.toString()))\n : [];\n\n auth.key_auths = dedupeAndSortKeyAuths(\n existingKeys,\n keys.map(\n (values, i) =>\n [values[keyName].createPublic().toString(), i + 1] as [\n string,\n number,\n ]\n )\n );\n\n return auth;\n };\n\n return broadcastOperations(\n [[\"account_update\", {\n account: username,\n json_metadata: accountData.json_metadata,\n owner: prepareAuth(\"owner\"),\n active: prepareAuth(\"active\"),\n posting: prepareAuth(\"posting\"),\n // Always use new memo key when adding new keys\n memo_key: keys[0].memo_key.createPublic().toString(),\n }]],\n currentKey\n );\n },\n ...options,\n });\n}\n","import { PrivateKey } from \"../../../hive-tx\";\nimport {\n useMutation,\n useQuery,\n type UseMutationOptions,\n} from \"@tanstack/react-query\";\nimport { getAccountFullQueryOptions } from \"../queries\";\nimport { useAccountUpdateKeyAuths } from \"./use-account-update-key-auths\";\n\ninterface Payload {\n newPassword: string;\n currentPassword: string;\n keepCurrent?: boolean;\n}\n\n/**\n * Only native Hive and custom passwords could be updated here\n * Seed based password cannot be updated here, it will be in an account always for now\n */\ntype UpdatePasswordOptions = Pick<\n UseMutationOptions<unknown, Error, Payload>,\n \"onSuccess\" | \"onError\"\n>;\n\nexport function useAccountUpdatePassword(\n username: string,\n options?: UpdatePasswordOptions\n) {\n const { data: accountData } = useQuery(getAccountFullQueryOptions(username));\n\n const { mutateAsync: updateKeys } = useAccountUpdateKeyAuths(username);\n\n return useMutation({\n mutationKey: [\"accounts\", \"password-update\", username],\n mutationFn: async ({\n newPassword,\n currentPassword,\n keepCurrent,\n }: Payload) => {\n if (!accountData) {\n throw new Error(\n \"[SDK][Update password] – cannot update password for anon user\"\n );\n }\n const currentKey = PrivateKey.fromLogin(\n username,\n currentPassword,\n \"owner\"\n );\n\n return updateKeys({\n currentKey,\n keepCurrent,\n keys: [\n {\n owner: PrivateKey.fromLogin(username, newPassword, \"owner\"),\n active: PrivateKey.fromLogin(username, newPassword, \"active\"),\n posting: PrivateKey.fromLogin(username, newPassword, \"posting\"),\n memo_key: PrivateKey.fromLogin(username, newPassword, \"memo\"),\n },\n ],\n });\n },\n ...options,\n });\n}\n","import { PrivateKey } from \"../../../hive-tx\";\nimport {\n useMutation,\n useQuery,\n useQueryClient,\n type UseMutationOptions,\n} from \"@tanstack/react-query\";\nimport { getAccountFullQueryOptions } from \"../queries\";\nimport { FullAccount } from \"../types\";\nimport hs from \"hivesigner\";\nimport type { AuthContextV2 } from \"@/modules/core/types\";\nimport { broadcastOperations } from \"@/modules/core/hive-tx\";\n\ntype SignType = \"key\" | \"keychain\" | \"hivesigner\";\n\ninterface CommonPayload {\n accountName: string;\n type: SignType;\n key?: PrivateKey;\n}\n\ntype RevokePostingOptions = Pick<\n UseMutationOptions<unknown, Error, CommonPayload>,\n \"onSuccess\" | \"onError\"\n> & {\n hsCallbackUrl?: string;\n};\n\nexport function useAccountRevokePosting(\n username: string | undefined,\n options: RevokePostingOptions,\n auth?: AuthContextV2\n) {\n const queryClient = useQueryClient();\n\n const { data } = useQuery(getAccountFullQueryOptions(username));\n\n return useMutation({\n mutationKey: [\"accounts\", \"revoke-posting\", data?.name],\n mutationFn: async ({ accountName, type, key }: CommonPayload) => {\n if (!data) {\n throw new Error(\n \"[SDK][Accounts] – cannot revoke posting for anonymous user\"\n );\n }\n\n const posting = JSON.parse(JSON.stringify(data.posting)) as FullAccount[\"posting\"];\n\n posting.account_auths = posting.account_auths.filter(\n ([account]) => account !== accountName\n );\n\n const operationBody = {\n account: data.name,\n posting,\n memo_key: data.memo_key,\n json_metadata: data.json_metadata,\n };\n\n if (type === \"key\" && key) {\n return broadcastOperations([[\"account_update\", operationBody]], key);\n } else if (type === \"keychain\") {\n if (!auth?.adapter?.broadcastWithKeychain) {\n throw new Error(\"[SDK][Accounts] – missing keychain broadcaster\");\n }\n return auth.adapter.broadcastWithKeychain(\n data.name,\n [[\"account_update\", operationBody]],\n \"active\"\n );\n } else {\n if (!options.hsCallbackUrl && process.env.NODE_ENV === \"development\") {\n console.warn(\"[SDK][Accounts] hsCallbackUrl not provided for HiveSigner revoke-posting; user will not be redirected after signing.\");\n }\n return hs.sendOperation(\n [\"account_update\", operationBody],\n options.hsCallbackUrl ? { callback: options.hsCallbackUrl } : {},\n () => {}\n );\n }\n },\n onError: options.onError,\n onSuccess: (resp, payload, ctx) => {\n (options.onSuccess as\n | ((data: unknown, variables: CommonPayload, context: unknown) => unknown)\n | undefined)?.(resp, payload, ctx);\n queryClient.setQueryData<FullAccount>(\n getAccountFullQueryOptions(username).queryKey,\n (data) =>\n ({\n ...data,\n posting: {\n ...data?.posting,\n account_auths:\n data?.posting?.account_auths?.filter(\n ([account]) => account !== payload.accountName\n ) ?? [],\n },\n }) as FullAccount\n );\n },\n });\n}\n","import { CONFIG, getBoundFetch } from \"@/modules/core\";\nimport { PrivateKey } from \"../../../hive-tx\";\nimport {\n useMutation,\n useQuery,\n type UseMutationOptions,\n} from \"@tanstack/react-query\";\nimport hs from \"hivesigner\";\nimport { getAccountFullQueryOptions } from \"../queries\";\nimport type { AuthContextV2 } from \"@/modules/core/types\";\nimport { broadcastOperations } from \"@/modules/core/hive-tx\";\n\ntype SignType = \"key\" | \"keychain\" | \"hivesigner\" | \"ecency\";\n\ninterface CommonPayload {\n accountName: string;\n type: SignType;\n key?: PrivateKey;\n email?: string;\n}\n\ntype UpdateRecoveryOptions = Pick<\n UseMutationOptions<unknown, Error, CommonPayload>,\n \"onSuccess\" | \"onError\"\n> & {\n hsCallbackUrl?: string;\n};\n\nexport function useAccountUpdateRecovery(\n username: string | undefined,\n code: string | undefined,\n options: UpdateRecoveryOptions,\n auth?: AuthContextV2\n) {\n const { data } = useQuery(getAccountFullQueryOptions(username));\n\n return useMutation({\n mutationKey: [\"accounts\", \"recovery\", data?.name],\n mutationFn: async ({ accountName, type, key, email }: CommonPayload) => {\n if (!data) {\n throw new Error(\n \"[SDK][Accounts] – cannot change recovery for anonymous user\"\n );\n }\n\n const operationBody = {\n account_to_recover: data.name,\n new_recovery_account: accountName,\n extensions: [] as [],\n };\n\n if (type === \"ecency\") {\n if (!code) {\n throw new Error(\"[SDK][Accounts] – missing access token\");\n }\n const fetchApi = getBoundFetch();\n\n const response = await fetchApi(CONFIG.privateApiHost + \"/private-api/recoveries-add\", {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({\n code,\n email,\n publicKeys: [\n ...data.owner.key_auths,\n ...data.active.key_auths,\n ...data.posting.key_auths,\n data.memo_key,\n ],\n }),\n });\n\n // Raw fetch resolves on 4xx/5xx, so guard explicitly — otherwise the\n // caller's onSuccess shows a \"recovery updated\" toast on a failed request.\n // (The missing Content-Type header also made the backend skip JSON parsing.)\n if (!response.ok) {\n throw new Error(`[SDK][Accounts] Failed to add recovery: ${response.status}`);\n }\n\n return response;\n } else if (type === \"key\" && key) {\n return broadcastOperations(\n [[\"change_recovery_account\", operationBody]],\n key\n );\n } else if (type === \"keychain\") {\n if (!auth?.adapter?.broadcastWithKeychain) {\n throw new Error(\"[SDK][Accounts] – missing keychain broadcaster\");\n }\n return auth.adapter.broadcastWithKeychain(data.name, [[\"change_recovery_account\", operationBody]], \"owner\");\n } else {\n if (!options.hsCallbackUrl && process.env.NODE_ENV === \"development\") {\n console.warn(\"[SDK][Accounts] hsCallbackUrl not provided for HiveSigner update-recovery; user will not be redirected after signing.\");\n }\n return hs.sendOperation(\n [\"change_recovery_account\", operationBody],\n options.hsCallbackUrl ? { callback: options.hsCallbackUrl } : {},\n () => {}\n );\n }\n },\n onError: options.onError,\n onSuccess: options.onSuccess,\n });\n}\n","import { PrivateKey, PublicKey } from \"../../../hive-tx\";\nimport {\n useMutation,\n useQuery,\n type UseMutationOptions,\n} from \"@tanstack/react-query\";\nimport { getAccountFullQueryOptions } from \"../queries\";\nimport { buildRevokeKeysOp } from \"./build-revoke-keys-op\";\nimport { broadcastOperations } from \"@/modules/core/hive-tx\";\n\ninterface Payload {\n currentKey: PrivateKey;\n /** Keys to revoke. Accepts a single key or an array. */\n revokingKey: PublicKey | PublicKey[];\n}\n\n/**\n * Revoke one or more keys from an account on the Hive blockchain.\n *\n * When revoking keys that exist only in active/posting authorities,\n * the owner field is omitted from the operation so active-level\n * signing is sufficient.\n */\ntype RevokeKeyOptions = Pick<\n UseMutationOptions<unknown, Error, Payload>,\n \"onSuccess\" | \"onError\"\n>;\n\nexport function useAccountRevokeKey(\n username: string | undefined,\n options?: RevokeKeyOptions\n) {\n const { data: accountData } = useQuery(getAccountFullQueryOptions(username));\n\n return useMutation({\n mutationKey: [\"accounts\", \"revoke-key\", accountData?.name],\n mutationFn: async ({ currentKey, revokingKey }: Payload) => {\n if (!accountData) {\n throw new Error(\n \"[SDK][Revoke key] – cannot update keys for anon user\"\n );\n }\n\n const revokingKeys = Array.isArray(revokingKey) ? revokingKey : [revokingKey];\n const op = buildRevokeKeysOp(accountData, revokingKeys);\n\n return broadcastOperations([[\"account_update\", op]], currentKey);\n },\n ...options,\n });\n}\n","import { QueryKeys } from \"@/modules/core\";\nimport {\n AccountFollowStats,\n FullAccount,\n} from \"../types\";\nimport { parseProfileMetadata } from \"@/modules/accounts\";\nimport { queryOptions } from \"@tanstack/react-query\";\nimport { callRPC } from \"@/modules/core/hive-tx\";\n\n/** The raw `condenser_api.get_accounts` row — every FullAccount field except the three\n * this query derives separately (follow_stats + reputation from bridge, profile parsed). */\ntype RawAccount = Omit<FullAccount, \"follow_stats\" | \"reputation\" | \"profile\">;\n\n/** Minimal shape read from `bridge.get_profile` (hivemind social profile): it carries\n * the reputation score, the follower/following counts and hivemind's parsed\n * (normalized) profile — the latter is used only to cross-validate the chain row. */\ninterface BridgeProfile {\n reputation?: number;\n stats?: { followers?: number; following?: number };\n metadata?: { profile?: Record<string, unknown> };\n}\n\n/** True when the chain row carries no account metadata at all. Legitimate for\n * accounts that never set a profile — but combined with a populated hivemind\n * profile it identifies a node serving stripped account rows. */\nfunction isMetadataStripped(account: RawAccount): boolean {\n return !account.posting_json_metadata && !account.json_metadata;\n}\n\n/** True when a hivemind `metadata.profile` object carries at least one real\n * value. Hivemind emits its fixed profile keys with empty strings for\n * accounts without a profile, so key presence alone proves nothing. */\nfunction hasProfileValues(profile?: Record<string, unknown> | null): boolean {\n if (!profile) return false;\n return Object.values(profile).some((value) =>\n typeof value === \"string\" ? value.length > 0 : value != null\n );\n}\n\nexport function getAccountFullQueryOptions(username: string | undefined) {\n return queryOptions({\n queryKey: QueryKeys.accounts.full(username),\n queryFn: async ({ signal }) => {\n if (!username) {\n return null;\n }\n\n // Fetch the chain account (balances/keys/vesting) and the hivemind profile in\n // parallel — both only need the username. bridge.get_profile carries BOTH the\n // follower/following counts and the reputation score, so it replaces the old\n // second-layer condenser_api.get_follow_count RPC *and* the reputation-api REST\n // call: condenser_api.get_accounts no longer returns a usable reputation (it is 0\n // since the hardfork), and there is no reason to make two extra round-trips for\n // data one profile object already carries.\n const [response, bridgeProfile] = await Promise.all([\n callRPC<RawAccount[]>(\n \"condenser_api.get_accounts\",\n [[username]],\n undefined,\n undefined,\n signal,\n // A correct node always answers get_accounts with an array — a null\n // result in a well-formed envelope is a node fault (observed in the\n // wild), so fail over to the next node instead of misreading it as\n // \"account does not exist\".\n (rows) => Array.isArray(rows)\n ),\n callRPC<BridgeProfile>(\n \"bridge.get_profile\",\n { account: username },\n undefined,\n undefined,\n signal\n ).catch((e): BridgeProfile | null => {\n // A caller cancel (aborted signal) must propagate — only genuine RPC/transport\n // failures degrade to reputation 0 / no follow_stats.\n if (signal?.aborted) throw e;\n return null;\n })\n ]);\n if (!response?.[0]) {\n // The account does not exist (e.g. not yet finalized on-chain during\n // signup). Treat absence as a recoverable null instead of throwing, so\n // consumers (useQuery hooks and fetchQuery callers) surface it as empty\n // data rather than an unhandled rejection / error-boundary crash.\n return null;\n }\n\n let chainAccount = response[0];\n\n // Cross-validate the chain row against the hivemind profile fetched in\n // the same query. Some public nodes serve account rows with BOTH\n // metadata fields stripped to \"\" (observed in the wild) while their own\n // hivemind still returns the real profile — and a merge base built from\n // such a row wipes the user's profile on the next partial\n // account_update2. When the row claims \"no metadata\" but hivemind\n // disagrees, re-read once (failover may pick another node) and otherwise\n // fail the query: an error here is recoverable, a poisoned cache entry\n // is not.\n if (\n isMetadataStripped(chainAccount) &&\n hasProfileValues(bridgeProfile?.metadata?.profile)\n ) {\n // The re-read carries a payload validator: a stripped row is treated\n // as a node fault, so the failover walk moves on to other nodes (and\n // repeat offenders earn a per-API health cooldown) instead of asking\n // the same lying node twice.\n const reread = await callRPC<RawAccount[]>(\n \"condenser_api.get_accounts\",\n [[username]],\n undefined,\n undefined,\n signal,\n (rows) =>\n Array.isArray(rows) &&\n (!rows[0] || !isMetadataStripped(rows[0] as RawAccount))\n );\n if (reread[0] && !isMetadataStripped(reread[0])) {\n chainAccount = reread[0];\n } else {\n throw new Error(\n `[SDK][Accounts] – inconsistent account row for ${username}: empty json metadata while hivemind profile is populated`\n );\n }\n }\n\n const profile = parseProfileMetadata(chainAccount.posting_json_metadata);\n\n // bridge.get_profile.stats → follower/following counts; `reputation` is the\n // computed score (e.g. 78.29). accountReputation() floors an in-range score, so\n // it yields the same value the reputation-api used to return. Both degrade to a\n // safe default if the profile call failed.\n const stats = bridgeProfile?.stats;\n const follow_stats: AccountFollowStats | undefined = stats\n ? {\n account: chainAccount.name,\n follower_count: stats.followers ?? 0,\n following_count: stats.following ?? 0\n }\n : undefined;\n const reputationValue: number = bridgeProfile?.reputation ?? 0;\n\n return {\n name: chainAccount.name,\n owner: chainAccount.owner,\n active: chainAccount.active,\n posting: chainAccount.posting,\n memo_key: chainAccount.memo_key,\n post_count: chainAccount.post_count,\n created: chainAccount.created,\n posting_json_metadata: chainAccount.posting_json_metadata,\n last_vote_time: chainAccount.last_vote_time,\n last_post: chainAccount.last_post,\n json_metadata: chainAccount.json_metadata,\n reward_hive_balance: chainAccount.reward_hive_balance,\n reward_hbd_balance: chainAccount.reward_hbd_balance,\n reward_vesting_hive: chainAccount.reward_vesting_hive,\n reward_vesting_balance: chainAccount.reward_vesting_balance,\n balance: chainAccount.balance,\n hbd_balance: chainAccount.hbd_balance,\n savings_balance: chainAccount.savings_balance,\n savings_hbd_balance: chainAccount.savings_hbd_balance,\n savings_hbd_last_interest_payment:\n chainAccount.savings_hbd_last_interest_payment,\n savings_hbd_seconds_last_update:\n chainAccount.savings_hbd_seconds_last_update,\n savings_hbd_seconds: chainAccount.savings_hbd_seconds,\n next_vesting_withdrawal: chainAccount.next_vesting_withdrawal,\n pending_claimed_accounts: chainAccount.pending_claimed_accounts,\n vesting_shares: chainAccount.vesting_shares,\n delegated_vesting_shares: chainAccount.delegated_vesting_shares,\n received_vesting_shares: chainAccount.received_vesting_shares,\n vesting_withdraw_rate: chainAccount.vesting_withdraw_rate,\n to_withdraw: chainAccount.to_withdraw,\n withdrawn: chainAccount.withdrawn,\n // int64 counters. Condenser serves them unquoted, so normalize here in case a\n // node quotes them, but leave an omitted counter undefined: absent is unknown,\n // and coercing it to 0 would understate every ratio derived from it.\n curation_rewards:\n chainAccount.curation_rewards === undefined\n ? undefined\n : Number(chainAccount.curation_rewards),\n posting_rewards:\n chainAccount.posting_rewards === undefined\n ? undefined\n : Number(chainAccount.posting_rewards),\n witness_votes: chainAccount.witness_votes,\n proxy: chainAccount.proxy,\n recovery_account: chainAccount.recovery_account,\n proxied_vsf_votes: chainAccount.proxied_vsf_votes,\n voting_manabar: chainAccount.voting_manabar,\n voting_power: chainAccount.voting_power,\n downvote_manabar: chainAccount.downvote_manabar,\n follow_stats,\n reputation: reputationValue,\n profile,\n } satisfies FullAccount;\n },\n enabled: !!username,\n staleTime: 60000,\n });\n}\n"]}
@@ -1,2 +1,2 @@
1
- import {d}from'./chunk-RZVMZQO7.js';import {b}from'./chunk-K2DAN37J.js';import {a}from'./chunk-HEILHNSR.js';function n(r,t,p){return b(["proposals","vote"],r,({proposalIds:e,approve:o})=>[d(r,e,o)],async e=>{try{let o=e?.id??e?.tx_id;t?.adapter?.recordActivity&&o&&t.adapter.recordActivity(150,o,e?.block_num).catch(d=>{console.debug("[SDK][Proposals][useProposalVote] recordActivity failed",{activityType:150,blockNum:e?.block_num,transactionId:o,error:d});}),t?.adapter?.invalidateQueries&&await t.adapter.invalidateQueries([a.proposals.list(),a.proposals.votesByUser(r)]);}catch(o){console.warn("[useProposalVote] Post-broadcast side-effect failed:",o);}},t,"active",{broadcastMode:p})}export{n as a};//# sourceMappingURL=chunk-EU3FL3RJ.js.map
2
- //# sourceMappingURL=chunk-EU3FL3RJ.js.map
1
+ import {d}from'./chunk-RZVMZQO7.js';import {b}from'./chunk-J2HM6MWA.js';import {a}from'./chunk-HEILHNSR.js';function n(r,t,p){return b(["proposals","vote"],r,({proposalIds:e,approve:o})=>[d(r,e,o)],async e=>{try{let o=e?.id??e?.tx_id;t?.adapter?.recordActivity&&o&&t.adapter.recordActivity(150,o,e?.block_num).catch(d=>{console.debug("[SDK][Proposals][useProposalVote] recordActivity failed",{activityType:150,blockNum:e?.block_num,transactionId:o,error:d});}),t?.adapter?.invalidateQueries&&await t.adapter.invalidateQueries([a.proposals.list(),a.proposals.votesByUser(r)]);}catch(o){console.warn("[useProposalVote] Post-broadcast side-effect failed:",o);}},t,"active",{broadcastMode:p})}export{n as a};//# sourceMappingURL=chunk-2PMKAOIU.js.map
2
+ //# sourceMappingURL=chunk-2PMKAOIU.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/modules/proposals/mutations/use-proposal-vote.ts"],"names":["useProposalVote","username","auth","broadcastMode","useBroadcastMutation","proposalIds","approve","buildProposalVoteOp","result","txId","error","QueryKeys"],"mappings":"4GAoEO,SAASA,CAAAA,CACdC,EACAC,CAAAA,CACAC,CAAAA,CACA,CACA,OAAOC,CAAAA,CACL,CAAC,WAAA,CAAa,MAAM,CAAA,CACpBH,EACA,CAAC,CAAE,WAAA,CAAAI,CAAAA,CAAa,OAAA,CAAAC,CAAQ,IAAM,CAC5BC,CAAAA,CAAoBN,CAAAA,CAAWI,CAAAA,CAAaC,CAAO,CACrD,EACA,MAAOE,CAAAA,EAAgB,CAErB,GAAI,CAIF,IAAMC,CAAAA,CAAOD,CAAAA,EAAQ,EAAA,EAAMA,CAAAA,EAAQ,KAAA,CAC/BN,CAAAA,EAAM,SAAS,cAAA,EAAkBO,CAAAA,EACnCP,CAAAA,CAAK,OAAA,CAAQ,cAAA,CAAe,GAAA,CAAKO,EAAMD,CAAAA,EAAQ,SAAS,CAAA,CAAE,KAAA,CAAOE,CAAAA,EAAU,CACzE,QAAQ,KAAA,CAAM,yDAAA,CAA2D,CACvE,YAAA,CAAc,GAAA,CACd,SAAUF,CAAAA,EAAQ,SAAA,CAClB,aAAA,CAAeC,CAAAA,CACf,KAAA,CAAAC,CACF,CAAC,EACH,CAAC,CAAA,CAICR,CAAAA,EAAM,OAAA,EAAS,iBAAA,EACjB,MAAMA,CAAAA,CAAK,OAAA,CAAQ,iBAAA,CAAkB,CACnCS,CAAAA,CAAU,SAAA,CAAU,MAAK,CACzBA,CAAAA,CAAU,UAAU,WAAA,CAAYV,CAAS,CAC3C,CAAC,EAEL,CAAA,MAASS,CAAAA,CAAO,CAEd,OAAA,CAAQ,KAAK,sDAAA,CAAwDA,CAAK,EAC5E,CACF,CAAA,CACAR,CAAAA,CACA,SACA,CAAE,aAAA,CAAAC,CAAc,CAClB,CACF","file":"chunk-EU3FL3RJ.js","sourcesContent":["import { useBroadcastMutation, QueryKeys } from \"@/modules/core\";\nimport type { BroadcastMode } from \"@/modules/core\";\nimport { buildProposalVoteOp } from \"@/modules/operations/builders\";\nimport type { AuthContextV2 } from \"@/modules/core/types\";\n\n/**\n * Payload for voting on proposals.\n */\nexport interface ProposalVotePayload {\n /** Array of proposal IDs to vote on */\n proposalIds: number[];\n /** True to approve, false to disapprove */\n approve: boolean;\n}\n\n/**\n * React Query mutation hook for voting on Hive proposals.\n *\n * This mutation broadcasts an update_proposal_votes operation to vote on\n * one or more proposals in the Hive Decentralized Fund (HDF).\n *\n * @param username - The username voting on proposals (required for broadcast)\n * @param auth - Authentication context with platform adapter and fallback configuration\n *\n * @returns React Query mutation result\n *\n * @remarks\n * **Post-Broadcast Actions:**\n * - Records activity (type 150) if adapter.recordActivity is available\n * - Invalidates proposal list cache to show updated vote status\n * - Invalidates voter's proposal votes cache\n *\n * **Multiple Proposals:**\n * - You can vote on multiple proposals in a single transaction\n * - All proposals receive the same vote (approve or disapprove)\n * - Proposal IDs are integers, not strings\n *\n * **Vote Types:**\n * - approve: true - Vote in favor of the proposal(s)\n * - approve: false - Remove your vote from the proposal(s)\n *\n * @example\n * ```typescript\n * const proposalVoteMutation = useProposalVote(username, {\n * adapter: myAdapter,\n * enableFallback: true,\n * fallbackChain: ['keychain', 'key', 'hivesigner']\n * });\n *\n * // Approve a single proposal\n * proposalVoteMutation.mutate({\n * proposalIds: [123],\n * approve: true\n * });\n *\n * // Approve multiple proposals\n * proposalVoteMutation.mutate({\n * proposalIds: [123, 124, 125],\n * approve: true\n * });\n *\n * // Remove vote from a proposal\n * proposalVoteMutation.mutate({\n * proposalIds: [123],\n * approve: false\n * });\n * ```\n */\nexport function useProposalVote(\n username: string | undefined,\n auth?: AuthContextV2,\n broadcastMode?: BroadcastMode\n) {\n return useBroadcastMutation<ProposalVotePayload>(\n [\"proposals\", \"vote\"],\n username,\n ({ proposalIds, approve }) => [\n buildProposalVoteOp(username!, proposalIds, approve)\n ],\n async (result: any) => {\n // Wrap post-broadcast side-effects in try-catch to prevent propagating errors\n try {\n // Activity tracking (fire-and-forget — non-critical, shouldn't block mutation completion)\n // Async broadcasts return BroadcastResult ({ tx_id, status }) instead of TransactionConfirmation,\n // so fall back to tx_id when id is absent.\n const txId = result?.id ?? result?.tx_id;\n if (auth?.adapter?.recordActivity && txId) {\n auth.adapter.recordActivity(150, txId, result?.block_num).catch((error) => {\n console.debug(\"[SDK][Proposals][useProposalVote] recordActivity failed\", {\n activityType: 150,\n blockNum: result?.block_num,\n transactionId: txId,\n error\n });\n });\n }\n\n // Cache invalidation\n if (auth?.adapter?.invalidateQueries) {\n await auth.adapter.invalidateQueries([\n QueryKeys.proposals.list(),\n QueryKeys.proposals.votesByUser(username!)\n ]);\n }\n } catch (error) {\n // Log but don't rethrow - don't fail mutation due to side-effect errors\n console.warn('[useProposalVote] Post-broadcast side-effect failed:', error);\n }\n },\n auth,\n 'active', // Use active authority for proposal votes (required by blockchain)\n { broadcastMode }\n );\n}\n"]}
1
+ {"version":3,"sources":["../../src/modules/proposals/mutations/use-proposal-vote.ts"],"names":["useProposalVote","username","auth","broadcastMode","useBroadcastMutation","proposalIds","approve","buildProposalVoteOp","result","txId","error","QueryKeys"],"mappings":"4GAoEO,SAASA,CAAAA,CACdC,EACAC,CAAAA,CACAC,CAAAA,CACA,CACA,OAAOC,CAAAA,CACL,CAAC,WAAA,CAAa,MAAM,CAAA,CACpBH,EACA,CAAC,CAAE,WAAA,CAAAI,CAAAA,CAAa,OAAA,CAAAC,CAAQ,IAAM,CAC5BC,CAAAA,CAAoBN,CAAAA,CAAWI,CAAAA,CAAaC,CAAO,CACrD,EACA,MAAOE,CAAAA,EAAgB,CAErB,GAAI,CAIF,IAAMC,CAAAA,CAAOD,CAAAA,EAAQ,EAAA,EAAMA,CAAAA,EAAQ,KAAA,CAC/BN,CAAAA,EAAM,SAAS,cAAA,EAAkBO,CAAAA,EACnCP,CAAAA,CAAK,OAAA,CAAQ,cAAA,CAAe,GAAA,CAAKO,EAAMD,CAAAA,EAAQ,SAAS,CAAA,CAAE,KAAA,CAAOE,CAAAA,EAAU,CACzE,QAAQ,KAAA,CAAM,yDAAA,CAA2D,CACvE,YAAA,CAAc,GAAA,CACd,SAAUF,CAAAA,EAAQ,SAAA,CAClB,aAAA,CAAeC,CAAAA,CACf,KAAA,CAAAC,CACF,CAAC,EACH,CAAC,CAAA,CAICR,CAAAA,EAAM,OAAA,EAAS,iBAAA,EACjB,MAAMA,CAAAA,CAAK,OAAA,CAAQ,iBAAA,CAAkB,CACnCS,CAAAA,CAAU,SAAA,CAAU,MAAK,CACzBA,CAAAA,CAAU,UAAU,WAAA,CAAYV,CAAS,CAC3C,CAAC,EAEL,CAAA,MAASS,CAAAA,CAAO,CAEd,OAAA,CAAQ,KAAK,sDAAA,CAAwDA,CAAK,EAC5E,CACF,CAAA,CACAR,CAAAA,CACA,SACA,CAAE,aAAA,CAAAC,CAAc,CAClB,CACF","file":"chunk-2PMKAOIU.js","sourcesContent":["import { useBroadcastMutation, QueryKeys } from \"@/modules/core\";\nimport type { BroadcastMode } from \"@/modules/core\";\nimport { buildProposalVoteOp } from \"@/modules/operations/builders\";\nimport type { AuthContextV2 } from \"@/modules/core/types\";\n\n/**\n * Payload for voting on proposals.\n */\nexport interface ProposalVotePayload {\n /** Array of proposal IDs to vote on */\n proposalIds: number[];\n /** True to approve, false to disapprove */\n approve: boolean;\n}\n\n/**\n * React Query mutation hook for voting on Hive proposals.\n *\n * This mutation broadcasts an update_proposal_votes operation to vote on\n * one or more proposals in the Hive Decentralized Fund (HDF).\n *\n * @param username - The username voting on proposals (required for broadcast)\n * @param auth - Authentication context with platform adapter and fallback configuration\n *\n * @returns React Query mutation result\n *\n * @remarks\n * **Post-Broadcast Actions:**\n * - Records activity (type 150) if adapter.recordActivity is available\n * - Invalidates proposal list cache to show updated vote status\n * - Invalidates voter's proposal votes cache\n *\n * **Multiple Proposals:**\n * - You can vote on multiple proposals in a single transaction\n * - All proposals receive the same vote (approve or disapprove)\n * - Proposal IDs are integers, not strings\n *\n * **Vote Types:**\n * - approve: true - Vote in favor of the proposal(s)\n * - approve: false - Remove your vote from the proposal(s)\n *\n * @example\n * ```typescript\n * const proposalVoteMutation = useProposalVote(username, {\n * adapter: myAdapter,\n * enableFallback: true,\n * fallbackChain: ['keychain', 'key', 'hivesigner']\n * });\n *\n * // Approve a single proposal\n * proposalVoteMutation.mutate({\n * proposalIds: [123],\n * approve: true\n * });\n *\n * // Approve multiple proposals\n * proposalVoteMutation.mutate({\n * proposalIds: [123, 124, 125],\n * approve: true\n * });\n *\n * // Remove vote from a proposal\n * proposalVoteMutation.mutate({\n * proposalIds: [123],\n * approve: false\n * });\n * ```\n */\nexport function useProposalVote(\n username: string | undefined,\n auth?: AuthContextV2,\n broadcastMode?: BroadcastMode\n) {\n return useBroadcastMutation<ProposalVotePayload>(\n [\"proposals\", \"vote\"],\n username,\n ({ proposalIds, approve }) => [\n buildProposalVoteOp(username!, proposalIds, approve)\n ],\n async (result: any) => {\n // Wrap post-broadcast side-effects in try-catch to prevent propagating errors\n try {\n // Activity tracking (fire-and-forget — non-critical, shouldn't block mutation completion)\n // Async broadcasts return BroadcastResult ({ tx_id, status }) instead of TransactionConfirmation,\n // so fall back to tx_id when id is absent.\n const txId = result?.id ?? result?.tx_id;\n if (auth?.adapter?.recordActivity && txId) {\n auth.adapter.recordActivity(150, txId, result?.block_num).catch((error) => {\n console.debug(\"[SDK][Proposals][useProposalVote] recordActivity failed\", {\n activityType: 150,\n blockNum: result?.block_num,\n transactionId: txId,\n error\n });\n });\n }\n\n // Cache invalidation\n if (auth?.adapter?.invalidateQueries) {\n await auth.adapter.invalidateQueries([\n QueryKeys.proposals.list(),\n QueryKeys.proposals.votesByUser(username!)\n ]);\n }\n } catch (error) {\n // Log but don't rethrow - don't fail mutation due to side-effect errors\n console.warn('[useProposalVote] Post-broadcast side-effect failed:', error);\n }\n },\n auth,\n 'active', // Use active authority for proposal votes (required by blockchain)\n { broadcastMode }\n );\n}\n"]}
@@ -1,2 +1,2 @@
1
- import {e}from'./chunk-QYY3VHLJ.js';import {b as b$1}from'./chunk-CNB64U7U.js';import {b}from'./chunk-K2DAN37J.js';import {a}from'./chunk-HEILHNSR.js';function l(u,o,e$1){return b(["accounts","claimAccount"],u,({creator:a,fee:t="0.000 HIVE"})=>[e(a,t)],async(a$1,t)=>{await b$1(o?.adapter,e$1,[a.accounts.full(t.creator)]);},o,"active",{broadcastMode:e$1})}export{l as a};//# sourceMappingURL=chunk-HESIUSO3.js.map
2
- //# sourceMappingURL=chunk-HESIUSO3.js.map
1
+ import {e}from'./chunk-QYY3VHLJ.js';import {b as b$1}from'./chunk-CNB64U7U.js';import {b}from'./chunk-J2HM6MWA.js';import {a}from'./chunk-HEILHNSR.js';function l(u,o,e$1){return b(["accounts","claimAccount"],u,({creator:a,fee:t="0.000 HIVE"})=>[e(a,t)],async(a$1,t)=>{await b$1(o?.adapter,e$1,[a.accounts.full(t.creator)]);},o,"active",{broadcastMode:e$1})}export{l as a};//# sourceMappingURL=chunk-3DS7HIZ6.js.map
2
+ //# sourceMappingURL=chunk-3DS7HIZ6.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/modules/accounts/mutations/use-claim-account.ts"],"names":["useClaimAccount","username","auth","broadcastMode","useBroadcastMutation","creator","fee","buildClaimAccountOp","_result","variables","invalidateAfterBroadcast","QueryKeys"],"mappings":"uJA+DO,SAASA,CAAAA,CACdC,EACAC,CAAAA,CACAC,GAAAA,CACA,CACA,OAAOC,CAAAA,CACL,CAAC,UAAA,CAAY,cAAc,CAAA,CAC3BH,EACA,CAAC,CAAE,OAAA,CAAAI,CAAAA,CAAS,GAAA,CAAAC,CAAAA,CAAM,YAAa,CAAA,GAAM,CACnCC,CAAAA,CAAoBF,CAAAA,CAASC,CAAG,CAClC,EACA,MAAOE,GAAAA,CAAcC,CAAAA,GAAc,CACjC,MAAMC,GAAAA,CAAyBR,GAAM,OAAA,CAASC,GAAAA,CAAe,CAC3DQ,CAAAA,CAAU,QAAA,CAAS,IAAA,CAAKF,EAAU,OAAO,CAC3C,CAAC,EACH,CAAA,CACAP,CAAAA,CACA,SACA,CAAE,aAAA,CAAAC,GAAc,CAClB,CACF","file":"chunk-HESIUSO3.js","sourcesContent":["import { useBroadcastMutation, invalidateAfterBroadcast, QueryKeys } from \"@/modules/core\";\nimport type { BroadcastMode } from \"@/modules/core\";\nimport { buildClaimAccountOp } from \"@/modules/operations/builders\";\nimport type { AuthContextV2 } from \"@/modules/core/types\";\n\n/**\n * Payload for claiming account creation tokens.\n */\nexport interface ClaimAccountPayload {\n /** Creator account claiming the token */\n creator: string;\n /** Fee for claiming (usually \"0.000 HIVE\" for RC-based claims) */\n fee?: string;\n}\n\n/**\n * React Query mutation hook for claiming account creation tokens.\n *\n * This mutation broadcasts a claim_account operation to claim an account\n * creation token using Resource Credits (RC). The claimed token can later\n * be used to create a new account for free using the create_claimed_account\n * operation.\n *\n * @param username - The username claiming the account token (required for broadcast)\n * @param auth - Authentication context with platform adapter and fallback configuration\n *\n * @returns React Query mutation result\n *\n * @remarks\n * **Post-Broadcast Actions:**\n * - Invalidates account cache to update pending_claimed_accounts count\n * - Updates account query data to set pending_claimed_accounts = 0 optimistically\n *\n * **Operation Details:**\n * - Uses native claim_account operation\n * - Fee: \"0.000 HIVE\" (uses RC instead of HIVE)\n * - Authority: Active key (required for claiming)\n *\n * **RC Requirements:**\n * - Requires sufficient Resource Credits (RC)\n * - RC amount varies based on network conditions\n * - Claiming without sufficient RC will fail\n *\n * **Use Case:**\n * - Claim tokens in advance when RC is available\n * - Create accounts later without paying HIVE fee\n * - Useful for onboarding services and apps\n *\n * @example\n * ```typescript\n * const claimMutation = useClaimAccount(username, {\n * adapter: myAdapter,\n * enableFallback: true,\n * fallbackChain: ['keychain', 'key', 'hivesigner']\n * });\n *\n * // Claim account token using RC\n * claimMutation.mutate({\n * creator: 'alice',\n * fee: '0.000 HIVE'\n * });\n * ```\n */\nexport function useClaimAccount(\n username: string | undefined,\n auth?: AuthContextV2,\n broadcastMode?: BroadcastMode\n) {\n return useBroadcastMutation<ClaimAccountPayload>(\n [\"accounts\", \"claimAccount\"],\n username,\n ({ creator, fee = \"0.000 HIVE\" }) => [\n buildClaimAccountOp(creator, fee)\n ],\n async (_result: any, variables) => {\n await invalidateAfterBroadcast(auth?.adapter, broadcastMode, [\n QueryKeys.accounts.full(variables.creator),\n ]);\n },\n auth,\n 'active',\n { broadcastMode }\n );\n}\n"]}
1
+ {"version":3,"sources":["../../src/modules/accounts/mutations/use-claim-account.ts"],"names":["useClaimAccount","username","auth","broadcastMode","useBroadcastMutation","creator","fee","buildClaimAccountOp","_result","variables","invalidateAfterBroadcast","QueryKeys"],"mappings":"uJA+DO,SAASA,CAAAA,CACdC,EACAC,CAAAA,CACAC,GAAAA,CACA,CACA,OAAOC,CAAAA,CACL,CAAC,UAAA,CAAY,cAAc,CAAA,CAC3BH,EACA,CAAC,CAAE,OAAA,CAAAI,CAAAA,CAAS,GAAA,CAAAC,CAAAA,CAAM,YAAa,CAAA,GAAM,CACnCC,CAAAA,CAAoBF,CAAAA,CAASC,CAAG,CAClC,EACA,MAAOE,GAAAA,CAAcC,CAAAA,GAAc,CACjC,MAAMC,GAAAA,CAAyBR,GAAM,OAAA,CAASC,GAAAA,CAAe,CAC3DQ,CAAAA,CAAU,QAAA,CAAS,IAAA,CAAKF,EAAU,OAAO,CAC3C,CAAC,EACH,CAAA,CACAP,CAAAA,CACA,SACA,CAAE,aAAA,CAAAC,GAAc,CAClB,CACF","file":"chunk-3DS7HIZ6.js","sourcesContent":["import { useBroadcastMutation, invalidateAfterBroadcast, QueryKeys } from \"@/modules/core\";\nimport type { BroadcastMode } from \"@/modules/core\";\nimport { buildClaimAccountOp } from \"@/modules/operations/builders\";\nimport type { AuthContextV2 } from \"@/modules/core/types\";\n\n/**\n * Payload for claiming account creation tokens.\n */\nexport interface ClaimAccountPayload {\n /** Creator account claiming the token */\n creator: string;\n /** Fee for claiming (usually \"0.000 HIVE\" for RC-based claims) */\n fee?: string;\n}\n\n/**\n * React Query mutation hook for claiming account creation tokens.\n *\n * This mutation broadcasts a claim_account operation to claim an account\n * creation token using Resource Credits (RC). The claimed token can later\n * be used to create a new account for free using the create_claimed_account\n * operation.\n *\n * @param username - The username claiming the account token (required for broadcast)\n * @param auth - Authentication context with platform adapter and fallback configuration\n *\n * @returns React Query mutation result\n *\n * @remarks\n * **Post-Broadcast Actions:**\n * - Invalidates account cache to update pending_claimed_accounts count\n * - Updates account query data to set pending_claimed_accounts = 0 optimistically\n *\n * **Operation Details:**\n * - Uses native claim_account operation\n * - Fee: \"0.000 HIVE\" (uses RC instead of HIVE)\n * - Authority: Active key (required for claiming)\n *\n * **RC Requirements:**\n * - Requires sufficient Resource Credits (RC)\n * - RC amount varies based on network conditions\n * - Claiming without sufficient RC will fail\n *\n * **Use Case:**\n * - Claim tokens in advance when RC is available\n * - Create accounts later without paying HIVE fee\n * - Useful for onboarding services and apps\n *\n * @example\n * ```typescript\n * const claimMutation = useClaimAccount(username, {\n * adapter: myAdapter,\n * enableFallback: true,\n * fallbackChain: ['keychain', 'key', 'hivesigner']\n * });\n *\n * // Claim account token using RC\n * claimMutation.mutate({\n * creator: 'alice',\n * fee: '0.000 HIVE'\n * });\n * ```\n */\nexport function useClaimAccount(\n username: string | undefined,\n auth?: AuthContextV2,\n broadcastMode?: BroadcastMode\n) {\n return useBroadcastMutation<ClaimAccountPayload>(\n [\"accounts\", \"claimAccount\"],\n username,\n ({ creator, fee = \"0.000 HIVE\" }) => [\n buildClaimAccountOp(creator, fee)\n ],\n async (_result: any, variables) => {\n await invalidateAfterBroadcast(auth?.adapter, broadcastMode, [\n QueryKeys.accounts.full(variables.creator),\n ]);\n },\n auth,\n 'active',\n { broadcastMode }\n );\n}\n"]}
@@ -1,2 +1,2 @@
1
- import {c}from'./chunk-32QJ72HH.js';import {e,f as f$1}from'./chunk-UXF4JZOD.js';var l=300*60*24,_=1e4,d=5e7;function f(e){let r=c(e.vesting_shares).amount,i=c(e.received_vesting_shares).amount,t=c(e.delegated_vesting_shares).amount,n=c(e.vesting_withdraw_rate).amount,s=(Number(e.to_withdraw)-Number(e.withdrawn))/1e6,a=Math.min(n,s);return r+i-t-a}function w(e,r,i){let t=e*1e6;return (r*i/1e4/50+1)*t/1e4}function N(e){if(Number.isFinite(e.lastHardfork))return e.lastHardfork>=28;let[r="0",i="0"]=(e.currentHardforkVersion??"0.0.0").split(".");return Number(r)>1||Number(r)===1&&Number(i)>=28}function h(e$1,r,i){let t=r.votePowerReserveRate||Number(r.raw?.globalDynamic?.vote_power_reserve_rate??0);if(!Number.isFinite(t)||t<=0)return 0;let n=f(e$1);if(!Number.isFinite(n)||n<=0)return 0;let s=n*1e6,a=Math.ceil(s*i*60*60*24/_/(t*l)),u=e(e$1),m=Math.min(u.current_mana,u.max_mana);return !Number.isFinite(m)||a>m?0:Math.max(a-d,0)}function p(e,r,i,t=1e4){if(!Number.isFinite(i)||!Number.isFinite(t))return 0;if(N(r))return h(e,r,t);let n=0;try{if(n=f(e),!Number.isFinite(n))return 0}catch{return 0}return w(n,i,t)}function v(e$1){return e(e$1).percentage/100}function R(e){if(!Number.isFinite(e))throw new TypeError("Voting power must be a finite number");if(e<0||e>100)throw new RangeError("Voting power must be between 0 and 100");return (100-e)*100*l/1e4}function V(e){let r=parseFloat(e.vesting_shares)+parseFloat(e.received_vesting_shares)-parseFloat(e.delegated_vesting_shares),i=Math.floor(Date.now()/1e3)-e.downvote_manabar.last_update_time,t=r*1e6/4;if(t<=0)return 0;let n=parseFloat(e.downvote_manabar.current_mana.toString())+i*t/l;n>t&&(n=t);let s=n*100/t;return isNaN(s)?0:s>100?100:s}function A(e){let{curation_rewards:r,posting_rewards:i}=e;if(r===void 0||i===void 0)return null;let t=r+i,n=c(e.vesting_shares).amount-c(e.delegated_vesting_shares).amount;return !Number.isFinite(t)||!Number.isFinite(n)||n<=0?null:t/n}function E(e){return f$1(e).percentage/100}function M(e,r,i,t=1e4){if(!Number.isFinite(i)||!Number.isFinite(t))return 0;let{fundRecentClaims:n,fundRewardBalance:s,base:a,quote:u}=r;if(!Number.isFinite(n)||!Number.isFinite(s)||!Number.isFinite(a)||!Number.isFinite(u)||n===0||u===0)return 0;let m=p(e,r,i,t);return Number.isFinite(m)?m/n*s*(a/u):0}export{p as a,v as b,R as c,V as d,A as e,E as f,M as g};//# sourceMappingURL=chunk-RVXGI5TW.js.map
2
- //# sourceMappingURL=chunk-RVXGI5TW.js.map
1
+ import {c}from'./chunk-32QJ72HH.js';import {e,f as f$1}from'./chunk-XEB43J5Q.js';var l=300*60*24,_=1e4,d=5e7;function f(e){let r=c(e.vesting_shares).amount,i=c(e.received_vesting_shares).amount,t=c(e.delegated_vesting_shares).amount,n=c(e.vesting_withdraw_rate).amount,s=(Number(e.to_withdraw)-Number(e.withdrawn))/1e6,a=Math.min(n,s);return r+i-t-a}function w(e,r,i){let t=e*1e6;return (r*i/1e4/50+1)*t/1e4}function N(e){if(Number.isFinite(e.lastHardfork))return e.lastHardfork>=28;let[r="0",i="0"]=(e.currentHardforkVersion??"0.0.0").split(".");return Number(r)>1||Number(r)===1&&Number(i)>=28}function h(e$1,r,i){let t=r.votePowerReserveRate||Number(r.raw?.globalDynamic?.vote_power_reserve_rate??0);if(!Number.isFinite(t)||t<=0)return 0;let n=f(e$1);if(!Number.isFinite(n)||n<=0)return 0;let s=n*1e6,a=Math.ceil(s*i*60*60*24/_/(t*l)),u=e(e$1),m=Math.min(u.current_mana,u.max_mana);return !Number.isFinite(m)||a>m?0:Math.max(a-d,0)}function p(e,r,i,t=1e4){if(!Number.isFinite(i)||!Number.isFinite(t))return 0;if(N(r))return h(e,r,t);let n=0;try{if(n=f(e),!Number.isFinite(n))return 0}catch{return 0}return w(n,i,t)}function v(e$1){return e(e$1).percentage/100}function R(e){if(!Number.isFinite(e))throw new TypeError("Voting power must be a finite number");if(e<0||e>100)throw new RangeError("Voting power must be between 0 and 100");return (100-e)*100*l/1e4}function V(e){let r=parseFloat(e.vesting_shares)+parseFloat(e.received_vesting_shares)-parseFloat(e.delegated_vesting_shares),i=Math.floor(Date.now()/1e3)-e.downvote_manabar.last_update_time,t=r*1e6/4;if(t<=0)return 0;let n=parseFloat(e.downvote_manabar.current_mana.toString())+i*t/l;n>t&&(n=t);let s=n*100/t;return isNaN(s)?0:s>100?100:s}function A(e){let{curation_rewards:r,posting_rewards:i}=e;if(r===void 0||i===void 0)return null;let t=r+i,n=c(e.vesting_shares).amount-c(e.delegated_vesting_shares).amount;return !Number.isFinite(t)||!Number.isFinite(n)||n<=0?null:t/n}function E(e){return f$1(e).percentage/100}function M(e,r,i,t=1e4){if(!Number.isFinite(i)||!Number.isFinite(t))return 0;let{fundRecentClaims:n,fundRewardBalance:s,base:a,quote:u}=r;if(!Number.isFinite(n)||!Number.isFinite(s)||!Number.isFinite(a)||!Number.isFinite(u)||n===0||u===0)return 0;let m=p(e,r,i,t);return Number.isFinite(m)?m/n*s*(a/u):0}export{p as a,v as b,R as c,V as d,A as e,E as f,M as g};//# sourceMappingURL=chunk-4EL7BARO.js.map
2
+ //# sourceMappingURL=chunk-4EL7BARO.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/modules/accounts/utils/account-power.ts"],"names":["HIVE_VOTING_MANA_REGENERATION_SECONDS","HIVE_100_PERCENT","HIVE_VOTE_DUST_THRESHOLD","getEffectiveVests","account","vesting","parseAsset","received","delegated","withdrawRate","alreadyWithdrawn","withdrawVests","vestsToRshares","vests","votingPowerValue","votePerc","vestingShares","hasStableVoteHardfork","dynamicProps","major","minor","stableVoteRshares","weight","reserveRate","effectiveVests","usedMana","mana","calculateVPMana","currentMana","votingRshares","totalVests","votingPower","powerRechargeTime","power","downVotingPower","totalShares","elapsed","maxMana","currentManaPerc","rewardsToStakeRatio","curation","posting","rewards","ownVests","rcPower","calculateRCMana","votingValue","fundRecentClaims","fundRewardBalance","base","quote","rShares"],"mappings":"iFAMA,IAAMA,CAAAA,CAAwC,GAAA,CAAS,EAAA,CAAK,EAAA,CACtDC,CAAAA,CAAmB,GAAA,CACnBC,CAAAA,CAA2B,GAAA,CAEjC,SAASC,CAAAA,CAAkBC,CAAAA,CAA8B,CACvD,IAAMC,CAAAA,CAAUC,CAAAA,CAAWF,CAAAA,CAAQ,cAAc,CAAA,CAAE,MAAA,CAC7CG,CAAAA,CAAWD,CAAAA,CAAWF,CAAAA,CAAQ,uBAAuB,CAAA,CAAE,MAAA,CACvDI,CAAAA,CAAYF,CAAAA,CAAWF,CAAAA,CAAQ,wBAAwB,CAAA,CAAE,MAAA,CACzDK,CAAAA,CAAeH,CAAAA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,MAAA,CAAO,QAAA,CAASC,CAAiB,CAAA,EAClC,CAAC,MAAA,CAAO,QAAA,CAASC,CAAI,CAAA,EACrB,CAAC,MAAA,CAAO,QAAA,CAASC,CAAK,CAAA,EAKpBH,CAAAA,GAAqB,CAAA,EAAKG,CAAAA,GAAU,CAAA,CACtC,OAAO,CAAA,CAGT,IAAMC,CAAAA,CAAUtB,CAAAA,CAAczB,CAAAA,CAASc,CAAAA,CAAcJ,CAAAA,CAAkBQ,CAAM,CAAA,CAE7E,OAAK,MAAA,CAAO,QAAA,CAAS6B,CAAO,CAAA,CAIpBA,CAAAA,CAAUJ,CAAAA,CAAoBC,CAAAA,EAAqBC,CAAAA,CAAOC,GAHzD,CAIX","file":"chunk-RVXGI5TW.js","sourcesContent":["import { parseAsset } from \"@/modules/core/utils\";\nimport { DynamicProps } from \"@/modules/core/types\";\nimport { FullAccount } from \"../types\";\nimport { calculateVPMana, calculateRCMana } from \"@/modules/core/hive-tx\";\nimport type { RCAccount } from \"@/modules/core/hive-tx\";\n\nconst HIVE_VOTING_MANA_REGENERATION_SECONDS = 5 * 60 * 60 * 24; // 5 days\nconst HIVE_100_PERCENT = 10000;\nconst HIVE_VOTE_DUST_THRESHOLD = 50_000_000;\n\nfunction getEffectiveVests(account: FullAccount): number {\n const vesting = parseAsset(account.vesting_shares).amount;\n const received = parseAsset(account.received_vesting_shares).amount;\n const delegated = parseAsset(account.delegated_vesting_shares).amount;\n const withdrawRate = parseAsset(account.vesting_withdraw_rate).amount;\n const alreadyWithdrawn =\n (Number(account.to_withdraw) - Number(account.withdrawn)) / 1e6;\n const withdrawVests = Math.min(withdrawRate, alreadyWithdrawn);\n\n return vesting + received - delegated - withdrawVests;\n}\n\nfunction vestsToRshares(vests: number, votingPowerValue: number, votePerc: number): number {\n const vestingShares = vests * 1e6;\n const power = (votingPowerValue * votePerc) / 1e4 / 50 + 1;\n return (power * vestingShares) / 1e4;\n}\n\nfunction hasStableVoteHardfork(dynamicProps: DynamicProps): boolean {\n if (Number.isFinite(dynamicProps.lastHardfork)) {\n return dynamicProps.lastHardfork >= 28;\n }\n\n const [major = \"0\", minor = \"0\"] = (dynamicProps.currentHardforkVersion ?? \"0.0.0\").split(\".\");\n return Number(major) > 1 || (Number(major) === 1 && Number(minor) >= 28);\n}\n\nfunction stableVoteRshares(\n account: FullAccount,\n dynamicProps: DynamicProps,\n weight: number\n): number {\n const reserveRate =\n dynamicProps.votePowerReserveRate ||\n Number(dynamicProps.raw?.globalDynamic?.vote_power_reserve_rate ?? 0);\n\n if (!Number.isFinite(reserveRate) || reserveRate <= 0) {\n return 0;\n }\n\n const effectiveVests = getEffectiveVests(account);\n if (!Number.isFinite(effectiveVests) || effectiveVests <= 0) {\n return 0;\n }\n\n const vestingShares = effectiveVests * 1e6;\n const usedMana =\n Math.ceil(\n (vestingShares * weight * 60 * 60 * 24) /\n HIVE_100_PERCENT /\n (reserveRate * HIVE_VOTING_MANA_REGENERATION_SECONDS)\n );\n\n const mana = calculateVPMana(account);\n const currentMana = Math.min(mana.current_mana, mana.max_mana);\n\n if (!Number.isFinite(currentMana) || usedMana > currentMana) {\n return 0;\n }\n\n return Math.max(usedMana - HIVE_VOTE_DUST_THRESHOLD, 0);\n}\n\nexport function votingRshares(\n account: FullAccount,\n dynamicProps: DynamicProps,\n votingPowerValue: number,\n weight: number = 10000\n): number {\n if (!Number.isFinite(votingPowerValue) || !Number.isFinite(weight)) {\n return 0;\n }\n\n if (hasStableVoteHardfork(dynamicProps)) {\n return stableVoteRshares(account, dynamicProps, weight);\n }\n\n let totalVests = 0;\n try {\n totalVests = getEffectiveVests(account);\n if (!Number.isFinite(totalVests)) {\n return 0;\n }\n } catch {\n return 0;\n }\n\n return vestsToRshares(totalVests, votingPowerValue, weight);\n}\n\nexport function votingPower(account: FullAccount): number {\n const calc = calculateVPMana(account);\n return calc.percentage / 100;\n}\n\nexport function powerRechargeTime(power: number) {\n if (!Number.isFinite(power)) {\n throw new TypeError(\"Voting power must be a finite number\");\n }\n if (power < 0 || power > 100) {\n throw new RangeError(\"Voting power must be between 0 and 100\");\n }\n const missingPower = 100 - power;\n return (\n (missingPower * 100 * HIVE_VOTING_MANA_REGENERATION_SECONDS) / 10000\n );\n}\n\nexport function downVotingPower(account: FullAccount): number {\n const totalShares =\n parseFloat(account.vesting_shares) +\n parseFloat(account.received_vesting_shares) -\n parseFloat(account.delegated_vesting_shares);\n const elapsed = Math.floor(Date.now() / 1000) - account.downvote_manabar.last_update_time;\n const maxMana = (totalShares * 1000000) / 4;\n\n if (maxMana <= 0) {\n return 0;\n }\n\n let currentMana =\n parseFloat(account.downvote_manabar.current_mana.toString()) +\n (elapsed * maxMana) / HIVE_VOTING_MANA_REGENERATION_SECONDS;\n\n if (currentMana > maxMana) {\n currentMana = maxMana;\n }\n const currentManaPerc = (currentMana * 100) / maxMana;\n\n if (isNaN(currentManaPerc)) {\n return 0;\n }\n\n if (currentManaPerc > 100) {\n return 100;\n }\n return currentManaPerc;\n}\n\n/**\n * Rewards/stake coefficient, known on Hive as the KE ratio: every VEST ever paid out\n * to the account as curation rewards or as the vested half of an author payout, over\n * the VESTS it still holds and has not delegated away. Both sides are VESTS, so the\n * value is independent of the HIVE price and of the global VESTS/HP rate.\n *\n * Returns null when the account carries no undelegated stake, where the ratio is\n * undefined rather than zero.\n *\n * Limits worth repeating wherever this is displayed: `posting_rewards` counts only the\n * vested half of an author payout, the denominator ignores stake delegated TO the\n * account (so an account curating with received delegation scores high), and the value\n * climbs during a power-down because the numerator is frozen history.\n */\nexport function rewardsToStakeRatio(account: FullAccount): number | null {\n // Absent counters are unknown, not zero. A row that omits one (or a cache entry\n // dehydrated by an older build, which omits both) would otherwise produce a\n // confident but understated ratio, which is worse than showing nothing.\n const { curation_rewards: curation, posting_rewards: posting } = account;\n if (curation === undefined || posting === undefined) {\n return null;\n }\n\n const rewards = curation + posting;\n const ownVests =\n parseAsset(account.vesting_shares).amount -\n parseAsset(account.delegated_vesting_shares).amount;\n\n // The SDK's parseAsset hands back a raw parseFloat, so a malformed asset string\n // reaches here as NaN rather than 0. Both sides need the finite check.\n if (!Number.isFinite(rewards) || !Number.isFinite(ownVests) || ownVests <= 0) {\n return null;\n }\n\n return rewards / ownVests;\n}\n\nexport function rcPower(account: RCAccount): number {\n const calc = calculateRCMana(account);\n return calc.percentage / 100;\n}\n\nexport function votingValue(\n account: FullAccount,\n dynamicProps: DynamicProps,\n votingPowerValue: number,\n weight: number = 10000\n): number {\n if (!Number.isFinite(votingPowerValue) || !Number.isFinite(weight)) {\n return 0;\n }\n const { fundRecentClaims, fundRewardBalance, base, quote } = dynamicProps;\n\n if (\n !Number.isFinite(fundRecentClaims) ||\n !Number.isFinite(fundRewardBalance) ||\n !Number.isFinite(base) ||\n !Number.isFinite(quote)\n ) {\n return 0;\n }\n\n if (fundRecentClaims === 0 || quote === 0) {\n return 0;\n }\n\n const rShares = votingRshares(account, dynamicProps, votingPowerValue, weight);\n\n if (!Number.isFinite(rShares)) {\n return 0;\n }\n\n return (rShares / fundRecentClaims) * fundRewardBalance * (base / quote);\n}\n"]}
1
+ {"version":3,"sources":["../../src/modules/accounts/utils/account-power.ts"],"names":["HIVE_VOTING_MANA_REGENERATION_SECONDS","HIVE_100_PERCENT","HIVE_VOTE_DUST_THRESHOLD","getEffectiveVests","account","vesting","parseAsset","received","delegated","withdrawRate","alreadyWithdrawn","withdrawVests","vestsToRshares","vests","votingPowerValue","votePerc","vestingShares","hasStableVoteHardfork","dynamicProps","major","minor","stableVoteRshares","weight","reserveRate","effectiveVests","usedMana","mana","calculateVPMana","currentMana","votingRshares","totalVests","votingPower","powerRechargeTime","power","downVotingPower","totalShares","elapsed","maxMana","currentManaPerc","rewardsToStakeRatio","curation","posting","rewards","ownVests","rcPower","calculateRCMana","votingValue","fundRecentClaims","fundRewardBalance","base","quote","rShares"],"mappings":"iFAMA,IAAMA,CAAAA,CAAwC,GAAA,CAAS,EAAA,CAAK,EAAA,CACtDC,CAAAA,CAAmB,GAAA,CACnBC,CAAAA,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I,CAAC,MAAA,CAAO,SAASR,CAAgB,CAAA,EAAK,CAAC,MAAA,CAAO,QAAA,CAASQ,CAAM,CAAA,CAC/D,OAAO,CAAA,CAET,GAAM,CAAE,gBAAA,CAAAyB,CAAAA,CAAkB,iBAAA,CAAAC,CAAAA,CAAmB,IAAA,CAAAC,CAAAA,CAAM,KAAA,CAAAC,CAAM,CAAA,CAAIhC,CAAAA,CAW7D,GARE,CAAC,MAAA,CAAO,QAAA,CAAS6B,CAAgB,CAAA,EACjC,CAAC,MAAA,CAAO,QAAA,CAASC,CAAiB,CAAA,EAClC,CAAC,MAAA,CAAO,QAAA,CAASC,CAAI,CAAA,EACrB,CAAC,MAAA,CAAO,QAAA,CAASC,CAAK,CAAA,EAKpBH,CAAAA,GAAqB,CAAA,EAAKG,CAAAA,GAAU,CAAA,CACtC,OAAO,CAAA,CAGT,IAAMC,CAAAA,CAAUtB,CAAAA,CAAczB,CAAAA,CAASc,CAAAA,CAAcJ,CAAAA,CAAkBQ,CAAM,CAAA,CAE7E,OAAK,MAAA,CAAO,QAAA,CAAS6B,CAAO,CAAA,CAIpBA,CAAAA,CAAUJ,CAAAA,CAAoBC,CAAAA,EAAqBC,CAAAA,CAAOC,GAHzD,CAIX","file":"chunk-4EL7BARO.js","sourcesContent":["import { parseAsset } from \"@/modules/core/utils\";\nimport { DynamicProps } from \"@/modules/core/types\";\nimport { FullAccount } from \"../types\";\nimport { calculateVPMana, calculateRCMana } from \"@/modules/core/hive-tx\";\nimport type { RCAccount } from \"@/modules/core/hive-tx\";\n\nconst HIVE_VOTING_MANA_REGENERATION_SECONDS = 5 * 60 * 60 * 24; // 5 days\nconst HIVE_100_PERCENT = 10000;\nconst HIVE_VOTE_DUST_THRESHOLD = 50_000_000;\n\nfunction getEffectiveVests(account: FullAccount): number {\n const vesting = parseAsset(account.vesting_shares).amount;\n const received = parseAsset(account.received_vesting_shares).amount;\n const delegated = parseAsset(account.delegated_vesting_shares).amount;\n const withdrawRate = parseAsset(account.vesting_withdraw_rate).amount;\n const alreadyWithdrawn =\n (Number(account.to_withdraw) - Number(account.withdrawn)) / 1e6;\n const withdrawVests = Math.min(withdrawRate, alreadyWithdrawn);\n\n return vesting + received - delegated - withdrawVests;\n}\n\nfunction vestsToRshares(vests: number, votingPowerValue: number, votePerc: number): number {\n const vestingShares = vests * 1e6;\n const power = (votingPowerValue * votePerc) / 1e4 / 50 + 1;\n return (power * vestingShares) / 1e4;\n}\n\nfunction hasStableVoteHardfork(dynamicProps: DynamicProps): boolean {\n if (Number.isFinite(dynamicProps.lastHardfork)) {\n return dynamicProps.lastHardfork >= 28;\n }\n\n const [major = \"0\", minor = \"0\"] = (dynamicProps.currentHardforkVersion ?? \"0.0.0\").split(\".\");\n return Number(major) > 1 || (Number(major) === 1 && Number(minor) >= 28);\n}\n\nfunction stableVoteRshares(\n account: FullAccount,\n dynamicProps: DynamicProps,\n weight: number\n): number {\n const reserveRate =\n dynamicProps.votePowerReserveRate ||\n Number(dynamicProps.raw?.globalDynamic?.vote_power_reserve_rate ?? 0);\n\n if (!Number.isFinite(reserveRate) || reserveRate <= 0) {\n return 0;\n }\n\n const effectiveVests = getEffectiveVests(account);\n if (!Number.isFinite(effectiveVests) || effectiveVests <= 0) {\n return 0;\n }\n\n const vestingShares = effectiveVests * 1e6;\n const usedMana =\n Math.ceil(\n (vestingShares * weight * 60 * 60 * 24) /\n HIVE_100_PERCENT /\n (reserveRate * HIVE_VOTING_MANA_REGENERATION_SECONDS)\n );\n\n const mana = calculateVPMana(account);\n const currentMana = Math.min(mana.current_mana, mana.max_mana);\n\n if (!Number.isFinite(currentMana) || usedMana > currentMana) {\n return 0;\n }\n\n return Math.max(usedMana - HIVE_VOTE_DUST_THRESHOLD, 0);\n}\n\nexport function votingRshares(\n account: FullAccount,\n dynamicProps: DynamicProps,\n votingPowerValue: number,\n weight: number = 10000\n): number {\n if (!Number.isFinite(votingPowerValue) || !Number.isFinite(weight)) {\n return 0;\n }\n\n if (hasStableVoteHardfork(dynamicProps)) {\n return stableVoteRshares(account, dynamicProps, weight);\n }\n\n let totalVests = 0;\n try {\n totalVests = getEffectiveVests(account);\n if (!Number.isFinite(totalVests)) {\n return 0;\n }\n } catch {\n return 0;\n }\n\n return vestsToRshares(totalVests, votingPowerValue, weight);\n}\n\nexport function votingPower(account: FullAccount): number {\n const calc = calculateVPMana(account);\n return calc.percentage / 100;\n}\n\nexport function powerRechargeTime(power: number) {\n if (!Number.isFinite(power)) {\n throw new TypeError(\"Voting power must be a finite number\");\n }\n if (power < 0 || power > 100) {\n throw new RangeError(\"Voting power must be between 0 and 100\");\n }\n const missingPower = 100 - power;\n return (\n (missingPower * 100 * HIVE_VOTING_MANA_REGENERATION_SECONDS) / 10000\n );\n}\n\nexport function downVotingPower(account: FullAccount): number {\n const totalShares =\n parseFloat(account.vesting_shares) +\n parseFloat(account.received_vesting_shares) -\n parseFloat(account.delegated_vesting_shares);\n const elapsed = Math.floor(Date.now() / 1000) - account.downvote_manabar.last_update_time;\n const maxMana = (totalShares * 1000000) / 4;\n\n if (maxMana <= 0) {\n return 0;\n }\n\n let currentMana =\n parseFloat(account.downvote_manabar.current_mana.toString()) +\n (elapsed * maxMana) / HIVE_VOTING_MANA_REGENERATION_SECONDS;\n\n if (currentMana > maxMana) {\n currentMana = maxMana;\n }\n const currentManaPerc = (currentMana * 100) / maxMana;\n\n if (isNaN(currentManaPerc)) {\n return 0;\n }\n\n if (currentManaPerc > 100) {\n return 100;\n }\n return currentManaPerc;\n}\n\n/**\n * Rewards/stake coefficient, known on Hive as the KE ratio: every VEST ever paid out\n * to the account as curation rewards or as the vested half of an author payout, over\n * the VESTS it still holds and has not delegated away. Both sides are VESTS, so the\n * value is independent of the HIVE price and of the global VESTS/HP rate.\n *\n * Returns null when the account carries no undelegated stake, where the ratio is\n * undefined rather than zero.\n *\n * Limits worth repeating wherever this is displayed: `posting_rewards` counts only the\n * vested half of an author payout, the denominator ignores stake delegated TO the\n * account (so an account curating with received delegation scores high), and the value\n * climbs during a power-down because the numerator is frozen history.\n */\nexport function rewardsToStakeRatio(account: FullAccount): number | null {\n // Absent counters are unknown, not zero. A row that omits one (or a cache entry\n // dehydrated by an older build, which omits both) would otherwise produce a\n // confident but understated ratio, which is worse than showing nothing.\n const { curation_rewards: curation, posting_rewards: posting } = account;\n if (curation === undefined || posting === undefined) {\n return null;\n }\n\n const rewards = curation + posting;\n const ownVests =\n parseAsset(account.vesting_shares).amount -\n parseAsset(account.delegated_vesting_shares).amount;\n\n // The SDK's parseAsset hands back a raw parseFloat, so a malformed asset string\n // reaches here as NaN rather than 0. Both sides need the finite check.\n if (!Number.isFinite(rewards) || !Number.isFinite(ownVests) || ownVests <= 0) {\n return null;\n }\n\n return rewards / ownVests;\n}\n\nexport function rcPower(account: RCAccount): number {\n const calc = calculateRCMana(account);\n return calc.percentage / 100;\n}\n\nexport function votingValue(\n account: FullAccount,\n dynamicProps: DynamicProps,\n votingPowerValue: number,\n weight: number = 10000\n): number {\n if (!Number.isFinite(votingPowerValue) || !Number.isFinite(weight)) {\n return 0;\n }\n const { fundRecentClaims, fundRewardBalance, base, quote } = dynamicProps;\n\n if (\n !Number.isFinite(fundRecentClaims) ||\n !Number.isFinite(fundRewardBalance) ||\n !Number.isFinite(base) ||\n !Number.isFinite(quote)\n ) {\n return 0;\n }\n\n if (fundRecentClaims === 0 || quote === 0) {\n return 0;\n }\n\n const rShares = votingRshares(account, dynamicProps, votingPowerValue, weight);\n\n if (!Number.isFinite(rShares)) {\n return 0;\n }\n\n return (rShares / fundRecentClaims) * fundRewardBalance * (base / quote);\n}\n"]}
@@ -1,2 +1,2 @@
1
- import {j}from'./chunk-UKK6NLAT.js';import {b as b$1}from'./chunk-CNB64U7U.js';import {b}from'./chunk-K2DAN37J.js';import {a}from'./chunk-HEILHNSR.js';function f(e,o,r){return b(["wallet","delegate-vesting-shares"],e,t=>[j(e,t.delegatee,t.vestingShares)],async(t,n)=>{await b$1(o?.adapter,r,[a.accounts.full(e),a.accounts.full(n.delegatee),["ecency-wallets","asset-info",e],["wallet","portfolio","v2",e]]);},o,"active",{broadcastMode:r})}export{f as a};//# sourceMappingURL=chunk-6DDGZBMD.js.map
2
- //# sourceMappingURL=chunk-6DDGZBMD.js.map
1
+ import {j}from'./chunk-UKK6NLAT.js';import {b as b$1}from'./chunk-CNB64U7U.js';import {b}from'./chunk-J2HM6MWA.js';import {a}from'./chunk-HEILHNSR.js';function f(e,o,r){return b(["wallet","delegate-vesting-shares"],e,t=>[j(e,t.delegatee,t.vestingShares)],async(t,n)=>{await b$1(o?.adapter,r,[a.accounts.full(e),a.accounts.full(n.delegatee),["ecency-wallets","asset-info",e],["wallet","portfolio","v2",e]]);},o,"active",{broadcastMode:r})}export{f as a};//# sourceMappingURL=chunk-4JZTDTIL.js.map
2
+ //# sourceMappingURL=chunk-4JZTDTIL.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/modules/wallet/mutations/use-delegate-vesting-shares.ts"],"names":["useDelegateVestingShares","username","auth","broadcastMode","useBroadcastMutation","payload","buildDelegateVestingSharesOp","_result","variables","invalidateAfterBroadcast","QueryKeys"],"mappings":"uJAmEO,SAASA,CAAAA,CACdC,CAAAA,CACAC,CAAAA,CACAC,CAAAA,CACA,CACA,OAAOC,CAAAA,CACL,CAAC,QAAA,CAAU,yBAAyB,CAAA,CACpCH,CAAAA,CACCI,CAAAA,EAAY,CACXC,CAAAA,CACEL,CAAAA,CACAI,CAAAA,CAAQ,SAAA,CACRA,CAAAA,CAAQ,aACV,CACF,CAAA,CACA,MAAOE,CAAAA,CAASC,CAAAA,GAAc,CAE5B,MAAMC,GAAAA,CAAyBP,GAAM,OAAA,CAASC,CAAAA,CAAe,CAC3DO,CAAAA,CAAU,QAAA,CAAS,IAAA,CAAKT,CAAQ,CAAA,CAChCS,CAAAA,CAAU,QAAA,CAAS,IAAA,CAAKF,CAAAA,CAAU,SAAS,CAAA,CAC3C,CAAC,gBAAA,CAAkB,aAAcP,CAAQ,CAAA,CACzC,CAAC,QAAA,CAAU,WAAA,CAAa,IAAA,CAAMA,CAAQ,CACxC,CAAC,EACH,CAAA,CACAC,CAAAA,CACA,QAAA,CACA,CAAE,aAAA,CAAAC,CAAc,CAClB,CACF","file":"chunk-6DDGZBMD.js","sourcesContent":["import { useBroadcastMutation, invalidateAfterBroadcast } from \"@/modules/core/mutations\";\nimport type { BroadcastMode } from \"@/modules/core/mutations\";\nimport { QueryKeys } from \"@/modules/core\";\nimport type { AuthContextV2 } from \"@/modules/core/types\";\nimport { buildDelegateVestingSharesOp } from \"@/modules/operations/builders\";\n\n/**\n * Payload for delegating Hive Power (vesting shares).\n */\nexport interface DelegateVestingSharesPayload {\n /** Account receiving HP delegation */\n delegatee: string;\n /** Amount of VESTS to delegate (e.g., \"1000.000000 VESTS\"). Use \"0.000000 VESTS\" to remove delegation. */\n vestingShares: string;\n}\n\n/**\n * React Query mutation hook for delegating Hive Power (HP).\n *\n * This mutation broadcasts a delegate_vesting_shares operation to delegate HP\n * to another account. **Requires ACTIVE authority**, not posting.\n *\n * @param username - The username delegating HP (required for broadcast)\n * @param auth - Authentication context with platform adapter and fallback configuration\n *\n * @returns React Query mutation result\n *\n * @remarks\n * **IMPORTANT: Active Authority Required**\n * - Delegation operations require ACTIVE key, not posting key\n * - Make sure your auth adapter provides getActiveKey() method\n * - Keychain/HiveAuth will prompt for Active authority\n *\n * **Delegation Mechanics:**\n * - Delegated HP can be used by the delegatee for resource credits\n * - Delegatee CANNOT power down or transfer the delegated HP\n * - Delegation can be removed by setting vestingShares to \"0.000000 VESTS\"\n * - Removing delegation has a 5-day cooldown before HP returns to delegator\n *\n * **Post-Broadcast Actions:**\n * - Invalidates delegations list cache to show updated delegation\n * - Invalidates account data for both delegator and delegatee\n *\n * @example\n * ```typescript\n * const delegateMutation = useDelegateVestingShares(username, {\n * adapter: {\n * ...myAdapter,\n * getActiveKey: async (username) => getActiveKeyFromStorage(username)\n * },\n * enableFallback: true,\n * fallbackChain: ['keychain', 'key', 'hivesigner']\n * });\n *\n * // Delegate HP\n * delegateMutation.mutate({\n * delegatee: 'alice',\n * vestingShares: '1000.000000 VESTS'\n * });\n *\n * // Remove delegation\n * delegateMutation.mutate({\n * delegatee: 'alice',\n * vestingShares: '0.000000 VESTS'\n * });\n * ```\n */\nexport function useDelegateVestingShares(\n username: string | undefined,\n auth?: AuthContextV2,\n broadcastMode?: BroadcastMode\n) {\n return useBroadcastMutation<DelegateVestingSharesPayload>(\n [\"wallet\", \"delegate-vesting-shares\"],\n username,\n (payload) => [\n buildDelegateVestingSharesOp(\n username!,\n payload.delegatee,\n payload.vestingShares\n )\n ],\n async (_result, variables) => {\n // Cache invalidation\n await invalidateAfterBroadcast(auth?.adapter, broadcastMode, [\n QueryKeys.accounts.full(username),\n QueryKeys.accounts.full(variables.delegatee),\n [\"ecency-wallets\", \"asset-info\", username],\n [\"wallet\", \"portfolio\", \"v2\", username]\n ]);\n },\n auth,\n 'active', // IMPORTANT: Active authority required\n { broadcastMode }\n );\n}\n"]}
1
+ {"version":3,"sources":["../../src/modules/wallet/mutations/use-delegate-vesting-shares.ts"],"names":["useDelegateVestingShares","username","auth","broadcastMode","useBroadcastMutation","payload","buildDelegateVestingSharesOp","_result","variables","invalidateAfterBroadcast","QueryKeys"],"mappings":"uJAmEO,SAASA,CAAAA,CACdC,CAAAA,CACAC,CAAAA,CACAC,CAAAA,CACA,CACA,OAAOC,CAAAA,CACL,CAAC,QAAA,CAAU,yBAAyB,CAAA,CACpCH,CAAAA,CACCI,CAAAA,EAAY,CACXC,CAAAA,CACEL,CAAAA,CACAI,CAAAA,CAAQ,SAAA,CACRA,CAAAA,CAAQ,aACV,CACF,CAAA,CACA,MAAOE,CAAAA,CAASC,CAAAA,GAAc,CAE5B,MAAMC,GAAAA,CAAyBP,GAAM,OAAA,CAASC,CAAAA,CAAe,CAC3DO,CAAAA,CAAU,QAAA,CAAS,IAAA,CAAKT,CAAQ,CAAA,CAChCS,CAAAA,CAAU,QAAA,CAAS,IAAA,CAAKF,CAAAA,CAAU,SAAS,CAAA,CAC3C,CAAC,gBAAA,CAAkB,aAAcP,CAAQ,CAAA,CACzC,CAAC,QAAA,CAAU,WAAA,CAAa,IAAA,CAAMA,CAAQ,CACxC,CAAC,EACH,CAAA,CACAC,CAAAA,CACA,QAAA,CACA,CAAE,aAAA,CAAAC,CAAc,CAClB,CACF","file":"chunk-4JZTDTIL.js","sourcesContent":["import { useBroadcastMutation, invalidateAfterBroadcast } from \"@/modules/core/mutations\";\nimport type { BroadcastMode } from \"@/modules/core/mutations\";\nimport { QueryKeys } from \"@/modules/core\";\nimport type { AuthContextV2 } from \"@/modules/core/types\";\nimport { buildDelegateVestingSharesOp } from \"@/modules/operations/builders\";\n\n/**\n * Payload for delegating Hive Power (vesting shares).\n */\nexport interface DelegateVestingSharesPayload {\n /** Account receiving HP delegation */\n delegatee: string;\n /** Amount of VESTS to delegate (e.g., \"1000.000000 VESTS\"). Use \"0.000000 VESTS\" to remove delegation. */\n vestingShares: string;\n}\n\n/**\n * React Query mutation hook for delegating Hive Power (HP).\n *\n * This mutation broadcasts a delegate_vesting_shares operation to delegate HP\n * to another account. **Requires ACTIVE authority**, not posting.\n *\n * @param username - The username delegating HP (required for broadcast)\n * @param auth - Authentication context with platform adapter and fallback configuration\n *\n * @returns React Query mutation result\n *\n * @remarks\n * **IMPORTANT: Active Authority Required**\n * - Delegation operations require ACTIVE key, not posting key\n * - Make sure your auth adapter provides getActiveKey() method\n * - Keychain/HiveAuth will prompt for Active authority\n *\n * **Delegation Mechanics:**\n * - Delegated HP can be used by the delegatee for resource credits\n * - Delegatee CANNOT power down or transfer the delegated HP\n * - Delegation can be removed by setting vestingShares to \"0.000000 VESTS\"\n * - Removing delegation has a 5-day cooldown before HP returns to delegator\n *\n * **Post-Broadcast Actions:**\n * - Invalidates delegations list cache to show updated delegation\n * - Invalidates account data for both delegator and delegatee\n *\n * @example\n * ```typescript\n * const delegateMutation = useDelegateVestingShares(username, {\n * adapter: {\n * ...myAdapter,\n * getActiveKey: async (username) => getActiveKeyFromStorage(username)\n * },\n * enableFallback: true,\n * fallbackChain: ['keychain', 'key', 'hivesigner']\n * });\n *\n * // Delegate HP\n * delegateMutation.mutate({\n * delegatee: 'alice',\n * vestingShares: '1000.000000 VESTS'\n * });\n *\n * // Remove delegation\n * delegateMutation.mutate({\n * delegatee: 'alice',\n * vestingShares: '0.000000 VESTS'\n * });\n * ```\n */\nexport function useDelegateVestingShares(\n username: string | undefined,\n auth?: AuthContextV2,\n broadcastMode?: BroadcastMode\n) {\n return useBroadcastMutation<DelegateVestingSharesPayload>(\n [\"wallet\", \"delegate-vesting-shares\"],\n username,\n (payload) => [\n buildDelegateVestingSharesOp(\n username!,\n payload.delegatee,\n payload.vestingShares\n )\n ],\n async (_result, variables) => {\n // Cache invalidation\n await invalidateAfterBroadcast(auth?.adapter, broadcastMode, [\n QueryKeys.accounts.full(username),\n QueryKeys.accounts.full(variables.delegatee),\n [\"ecency-wallets\", \"asset-info\", username],\n [\"wallet\", \"portfolio\", \"v2\", username]\n ]);\n },\n auth,\n 'active', // IMPORTANT: Active authority required\n { broadcastMode }\n );\n}\n"]}
@@ -1,2 +1,2 @@
1
- import {b as b$1,c}from'./chunk-EOSE4FQA.js';import {b}from'./chunk-K2DAN37J.js';import {a}from'./chunk-HEILHNSR.js';function P(c$1,i,h){return b(["posts","update-reply"],c$1,t=>{let e=[];if(e.push(b$1(t.author,t.permlink,t.parentAuthor,t.parentPermlink,t.title,t.body,t.jsonMetadata)),t.options){let{maxAcceptedPayout:o="1000000.000 HBD",percentHbd:s=1e4,allowVotes:a=true,allowCurationRewards:u=true,beneficiaries:r=[]}=t.options,m=[];if(r.length>0){let f=[...r].sort((n,g)=>n.account.localeCompare(g.account));m.push([0,{beneficiaries:f.map(n=>({account:n.account,weight:n.weight}))}]);}e.push(c(t.author,t.permlink,o,s,a,u,m));}return e},async(t,e)=>{if(i?.adapter?.invalidateQueries){let o=[a.resourceCredits.account(c$1)];o.push(a.posts.entry(`/@${e.parentAuthor}/${e.parentPermlink}`));let s=e.rootAuthor||e.parentAuthor,a$1=e.rootPermlink||e.parentPermlink;o.push({predicate:u=>{let r=u.queryKey;return Array.isArray(r)&&r[0]==="posts"&&r[1]==="discussions"&&r[2]===s&&r[3]===a$1}}),await i.adapter.invalidateQueries(o);}},i,"posting",{broadcastMode:h})}export{P as a};//# sourceMappingURL=chunk-7B5LNIZJ.js.map
2
- //# sourceMappingURL=chunk-7B5LNIZJ.js.map
1
+ import {b as b$1,c}from'./chunk-EOSE4FQA.js';import {b}from'./chunk-J2HM6MWA.js';import {a}from'./chunk-HEILHNSR.js';function P(c$1,i,h){return b(["posts","update-reply"],c$1,t=>{let e=[];if(e.push(b$1(t.author,t.permlink,t.parentAuthor,t.parentPermlink,t.title,t.body,t.jsonMetadata)),t.options){let{maxAcceptedPayout:o="1000000.000 HBD",percentHbd:s=1e4,allowVotes:a=true,allowCurationRewards:u=true,beneficiaries:r=[]}=t.options,m=[];if(r.length>0){let f=[...r].sort((n,g)=>n.account.localeCompare(g.account));m.push([0,{beneficiaries:f.map(n=>({account:n.account,weight:n.weight}))}]);}e.push(c(t.author,t.permlink,o,s,a,u,m));}return e},async(t,e)=>{if(i?.adapter?.invalidateQueries){let o=[a.resourceCredits.account(c$1)];o.push(a.posts.entry(`/@${e.parentAuthor}/${e.parentPermlink}`));let s=e.rootAuthor||e.parentAuthor,a$1=e.rootPermlink||e.parentPermlink;o.push({predicate:u=>{let r=u.queryKey;return Array.isArray(r)&&r[0]==="posts"&&r[1]==="discussions"&&r[2]===s&&r[3]===a$1}}),await i.adapter.invalidateQueries(o);}},i,"posting",{broadcastMode:h})}export{P as a};//# sourceMappingURL=chunk-4NADA62G.js.map
2
+ //# sourceMappingURL=chunk-4NADA62G.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/modules/posts/mutations/use-update-reply.ts"],"names":["useUpdateReply","username","auth","broadcastMode","useBroadcastMutation","payload","operations","buildCommentOp","maxAcceptedPayout","percentHbd","allowVotes","allowCurationRewards","beneficiaries","extensions","sortedBeneficiaries","a","b","buildCommentOptionsOp","_result","variables","queriesToInvalidate","QueryKeys","discussionsAuthor","discussionsPermlink","query","key"],"mappings":"qHAgGO,SAASA,CAAAA,CACdC,IACAC,CAAAA,CACAC,CAAAA,CACA,CACA,OAAOC,CAAAA,CACL,CAAC,OAAA,CAAS,cAAc,CAAA,CACxBH,IACCI,CAAAA,EAAY,CACX,IAAMC,CAAAA,CAA0B,EAAC,CAgBjC,GAbAA,CAAAA,CAAW,IAAA,CACTC,GAAAA,CACEF,CAAAA,CAAQ,MAAA,CACRA,CAAAA,CAAQ,SACRA,CAAAA,CAAQ,YAAA,CACRA,CAAAA,CAAQ,cAAA,CACRA,CAAAA,CAAQ,KAAA,CACRA,EAAQ,IAAA,CACRA,CAAAA,CAAQ,YACV,CACF,CAAA,CAGIA,CAAAA,CAAQ,QAAS,CACnB,GAAM,CACJ,iBAAA,CAAAG,CAAAA,CAAoB,iBAAA,CACpB,WAAAC,CAAAA,CAAa,GAAA,CACb,UAAA,CAAAC,CAAAA,CAAa,IAAA,CACb,oBAAA,CAAAC,EAAuB,IAAA,CACvB,aAAA,CAAAC,CAAAA,CAAgB,EAClB,CAAA,CAAIP,EAAQ,OAAA,CAENQ,CAAAA,CAAoB,EAAC,CAG3B,GAAID,CAAAA,CAAc,OAAS,CAAA,CAAG,CAE5B,IAAME,CAAAA,CAAsB,CAAC,GAAGF,CAAa,CAAA,CAAE,IAAA,CAAK,CAACG,CAAAA,CAAGC,CAAAA,GACtDD,CAAAA,CAAE,QAAQ,aAAA,CAAcC,CAAAA,CAAE,OAAO,CACnC,CAAA,CAEAH,CAAAA,CAAW,KAAK,CACd,CAAA,CACA,CACE,aAAA,CAAeC,CAAAA,CAAoB,GAAA,CAAIE,IAAM,CAC3C,OAAA,CAASA,CAAAA,CAAE,OAAA,CACX,MAAA,CAAQA,CAAAA,CAAE,MACZ,CAAA,CAAE,CACJ,CACF,CAAC,EACH,CAEAV,EAAW,IAAA,CACTW,CAAAA,CACEZ,EAAQ,MAAA,CACRA,CAAAA,CAAQ,SACRG,CAAAA,CACAC,CAAAA,CACAC,CAAAA,CACAC,CAAAA,CACAE,CACF,CACF,EACF,CAEA,OAAOP,CACT,CAAA,CACA,MAAOY,CAAAA,CAAcC,IAAc,CAKjC,GAAIjB,CAAAA,EAAM,OAAA,EAAS,iBAAA,CAAmB,CACpC,IAAMkB,CAAAA,CAA6B,CACjCC,CAAAA,CAAU,eAAA,CAAgB,OAAA,CAAQpB,GAAS,CAC7C,CAAA,CAGAmB,CAAAA,CAAoB,IAAA,CAClBC,CAAAA,CAAU,KAAA,CAAM,KAAA,CAAM,KAAKF,CAAAA,CAAU,YAAY,CAAA,CAAA,EAAIA,CAAAA,CAAU,cAAc,CAAA,CAAE,CACjF,CAAA,CAMA,IAAMG,CAAAA,CAAoBH,CAAAA,CAAU,UAAA,EAAcA,CAAAA,CAAU,aACtDI,GAAAA,CAAsBJ,CAAAA,CAAU,YAAA,EAAgBA,CAAAA,CAAU,cAAA,CAEhEC,CAAAA,CAAoB,KAAK,CACvB,SAAA,CAAYI,CAAAA,EAAe,CACzB,IAAMC,CAAAA,CAAMD,EAAM,QAAA,CAClB,OACE,KAAA,CAAM,OAAA,CAAQC,CAAG,CAAA,EACjBA,EAAI,CAAC,CAAA,GAAM,OAAA,EACXA,CAAAA,CAAI,CAAC,CAAA,GAAM,eACXA,CAAAA,CAAI,CAAC,CAAA,GAAMH,CAAAA,EACXG,CAAAA,CAAI,CAAC,IAAMF,GAEf,CACF,CAAC,CAAA,CAED,MAAMrB,CAAAA,CAAK,QAAQ,iBAAA,CAAkBkB,CAAmB,EAC1D,CACF,CAAA,CACAlB,CAAAA,CACA,UACA,CAAE,aAAA,CAAAC,CAAc,CAClB,CACF","file":"chunk-7B5LNIZJ.js","sourcesContent":["import { useBroadcastMutation, QueryKeys } from \"@/modules/core\";\nimport type { BroadcastMode } from \"@/modules/core\";\nimport { buildCommentOp, buildCommentOptionsOp } from \"@/modules/operations/builders\";\nimport type { AuthContextV2 } from \"@/modules/core/types\";\nimport type { Operation } from \"../../../hive-tx\";\nimport type { Beneficiary } from \"./use-comment\";\n\n/**\n * Payload for updating a reply/comment.\n */\nexport interface UpdateReplyPayload {\n /** Author of the comment/post */\n author: string;\n /** Permlink of the comment/post being updated */\n permlink: string;\n /** Parent author */\n parentAuthor: string;\n /** Parent permlink */\n parentPermlink: string;\n /** Title (empty for comments) */\n title: string;\n /** Updated content body */\n body: string;\n /** Updated JSON metadata object */\n jsonMetadata: Record<string, any>;\n /** Optional: Root post author (for nested replies, used for discussions cache invalidation) */\n rootAuthor?: string;\n /** Optional: Root post permlink (for nested replies, used for discussions cache invalidation) */\n rootPermlink?: string;\n /** Optional: Comment options (beneficiaries, rewards) */\n options?: {\n /** Maximum accepted payout (e.g., \"1000000.000 HBD\") */\n maxAcceptedPayout?: string;\n /** Percent of payout in HBD (10000 = 100%) */\n percentHbd?: number;\n /** Allow votes on this content */\n allowVotes?: boolean;\n /** Allow curation rewards */\n allowCurationRewards?: boolean;\n /** Beneficiaries array */\n beneficiaries?: Beneficiary[];\n };\n}\n\n/**\n * React Query mutation hook for updating existing replies/comments.\n *\n * This mutation broadcasts a comment operation (and optionally comment_options)\n * to update an existing reply/comment on the Hive blockchain.\n *\n * @param username - The username updating the comment (required for broadcast)\n * @param auth - Authentication context with platform adapter and fallback configuration\n *\n * @returns React Query mutation result\n *\n * @remarks\n * **Post-Broadcast Actions:**\n * - Invalidates parent post cache to reflect the updated comment\n * - Invalidates discussions cache (all sort orders)\n * - Invalidates RC cache (RC decreases after updating)\n *\n * **Operations:**\n * - Always includes a comment operation\n * - Optionally includes comment_options operation for beneficiaries/rewards\n *\n * **Important:**\n * - Updates use the same comment operation as creating new comments\n * - The blockchain identifies this as an update based on matching author/permlink\n * - Only the author can update their own content\n * - Content can only be updated before payout (within 7 days)\n *\n * @example\n * ```typescript\n * const updateReplyMutation = useUpdateReply(username, {\n * adapter: myAdapter,\n * enableFallback: true,\n * fallbackChain: ['keychain', 'key', 'hivesigner']\n * });\n *\n * // Update a reply\n * updateReplyMutation.mutate({\n * author: 'alice',\n * permlink: 're-bob-my-post-20260209',\n * parentAuthor: 'bob',\n * parentPermlink: 'my-post-20260209',\n * title: '',\n * body: 'Updated comment content!',\n * jsonMetadata: {\n * tags: ['comment'],\n * app: 'ecency/3.0.0-vision'\n * },\n * rootAuthor: 'bob',\n * rootPermlink: 'my-post-20260209'\n * });\n * ```\n */\nexport function useUpdateReply(\n username: string | undefined,\n auth?: AuthContextV2,\n broadcastMode?: BroadcastMode\n) {\n return useBroadcastMutation<UpdateReplyPayload>(\n [\"posts\", \"update-reply\"],\n username,\n (payload) => {\n const operations: Operation[] = [];\n\n // Main comment operation (same operation for create and update)\n operations.push(\n buildCommentOp(\n payload.author,\n payload.permlink,\n payload.parentAuthor,\n payload.parentPermlink,\n payload.title,\n payload.body,\n payload.jsonMetadata\n )\n );\n\n // Optional comment options operation\n if (payload.options) {\n const {\n maxAcceptedPayout = \"1000000.000 HBD\",\n percentHbd = 10000,\n allowVotes = true,\n allowCurationRewards = true,\n beneficiaries = []\n } = payload.options;\n\n const extensions: any[] = [];\n\n // Add beneficiaries extension if provided\n if (beneficiaries.length > 0) {\n // Sort beneficiaries alphabetically by account name (required by blockchain)\n const sortedBeneficiaries = [...beneficiaries].sort((a, b) =>\n a.account.localeCompare(b.account)\n );\n\n extensions.push([\n 0,\n {\n beneficiaries: sortedBeneficiaries.map(b => ({\n account: b.account,\n weight: b.weight\n }))\n }\n ]);\n }\n\n operations.push(\n buildCommentOptionsOp(\n payload.author,\n payload.permlink,\n maxAcceptedPayout,\n percentHbd,\n allowVotes,\n allowCurationRewards,\n extensions\n )\n );\n }\n\n return operations;\n },\n async (_result: any, variables) => {\n // No activity is recorded here. Activity rewards creating content. Every\n // broadcast from this mutation edits content that already exists.\n\n // Cache invalidation\n if (auth?.adapter?.invalidateQueries) {\n const queriesToInvalidate: any[] = [\n QueryKeys.resourceCredits.account(username!)\n ];\n\n // Invalidate parent entry\n queriesToInvalidate.push(\n QueryKeys.posts.entry(`/@${variables.parentAuthor}/${variables.parentPermlink}`)\n );\n\n // Invalidate discussions (matches all sort orders)\n // Use partial key to match all sort order variants\n // For nested replies, use rootAuthor/rootPermlink to match the root post's discussions\n // Fall back to parentAuthor/parentPermlink for direct replies to posts\n const discussionsAuthor = variables.rootAuthor || variables.parentAuthor;\n const discussionsPermlink = variables.rootPermlink || variables.parentPermlink;\n\n queriesToInvalidate.push({\n predicate: (query: any) => {\n const key = query.queryKey;\n return (\n Array.isArray(key) &&\n key[0] === \"posts\" &&\n key[1] === \"discussions\" &&\n key[2] === discussionsAuthor &&\n key[3] === discussionsPermlink\n );\n }\n });\n\n await auth.adapter.invalidateQueries(queriesToInvalidate);\n }\n },\n auth,\n 'posting',\n { broadcastMode }\n );\n}\n"]}
1
+ {"version":3,"sources":["../../src/modules/posts/mutations/use-update-reply.ts"],"names":["useUpdateReply","username","auth","broadcastMode","useBroadcastMutation","payload","operations","buildCommentOp","maxAcceptedPayout","percentHbd","allowVotes","allowCurationRewards","beneficiaries","extensions","sortedBeneficiaries","a","b","buildCommentOptionsOp","_result","variables","queriesToInvalidate","QueryKeys","discussionsAuthor","discussionsPermlink","query","key"],"mappings":"qHAgGO,SAASA,CAAAA,CACdC,IACAC,CAAAA,CACAC,CAAAA,CACA,CACA,OAAOC,CAAAA,CACL,CAAC,OAAA,CAAS,cAAc,CAAA,CACxBH,IACCI,CAAAA,EAAY,CACX,IAAMC,CAAAA,CAA0B,EAAC,CAgBjC,GAbAA,CAAAA,CAAW,IAAA,CACTC,GAAAA,CACEF,CAAAA,CAAQ,MAAA,CACRA,CAAAA,CAAQ,SACRA,CAAAA,CAAQ,YAAA,CACRA,CAAAA,CAAQ,cAAA,CACRA,CAAAA,CAAQ,KAAA,CACRA,EAAQ,IAAA,CACRA,CAAAA,CAAQ,YACV,CACF,CAAA,CAGIA,CAAAA,CAAQ,QAAS,CAC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EAAcA,CAAAA,CAAU,aACtDI,GAAAA,CAAsBJ,CAAAA,CAAU,YAAA,EAAgBA,CAAAA,CAAU,cAAA,CAEhEC,CAAAA,CAAoB,KAAK,CACvB,SAAA,CAAYI,CAAAA,EAAe,CACzB,IAAMC,CAAAA,CAAMD,EAAM,QAAA,CAClB,OACE,KAAA,CAAM,OAAA,CAAQC,CAAG,CAAA,EACjBA,EAAI,CAAC,CAAA,GAAM,OAAA,EACXA,CAAAA,CAAI,CAAC,CAAA,GAAM,eACXA,CAAAA,CAAI,CAAC,CAAA,GAAMH,CAAAA,EACXG,CAAAA,CAAI,CAAC,IAAMF,GAEf,CACF,CAAC,CAAA,CAED,MAAMrB,CAAAA,CAAK,QAAQ,iBAAA,CAAkBkB,CAAmB,EAC1D,CACF,CAAA,CACAlB,CAAAA,CACA,UACA,CAAE,aAAA,CAAAC,CAAc,CAClB,CACF","file":"chunk-4NADA62G.js","sourcesContent":["import { useBroadcastMutation, QueryKeys } from \"@/modules/core\";\nimport type { BroadcastMode } from \"@/modules/core\";\nimport { buildCommentOp, buildCommentOptionsOp } from \"@/modules/operations/builders\";\nimport type { AuthContextV2 } from \"@/modules/core/types\";\nimport type { Operation } from \"../../../hive-tx\";\nimport type { Beneficiary } from \"./use-comment\";\n\n/**\n * Payload for updating a reply/comment.\n */\nexport interface UpdateReplyPayload {\n /** Author of the comment/post */\n author: string;\n /** Permlink of the comment/post being updated */\n permlink: string;\n /** Parent author */\n parentAuthor: string;\n /** Parent permlink */\n parentPermlink: string;\n /** Title (empty for comments) */\n title: string;\n /** Updated content body */\n body: string;\n /** Updated JSON metadata object */\n jsonMetadata: Record<string, any>;\n /** Optional: Root post author (for nested replies, used for discussions cache invalidation) */\n rootAuthor?: string;\n /** Optional: Root post permlink (for nested replies, used for discussions cache invalidation) */\n rootPermlink?: string;\n /** Optional: Comment options (beneficiaries, rewards) */\n options?: {\n /** Maximum accepted payout (e.g., \"1000000.000 HBD\") */\n maxAcceptedPayout?: string;\n /** Percent of payout in HBD (10000 = 100%) */\n percentHbd?: number;\n /** Allow votes on this content */\n allowVotes?: boolean;\n /** Allow curation rewards */\n allowCurationRewards?: boolean;\n /** Beneficiaries array */\n beneficiaries?: Beneficiary[];\n };\n}\n\n/**\n * React Query mutation hook for updating existing replies/comments.\n *\n * This mutation broadcasts a comment operation (and optionally comment_options)\n * to update an existing reply/comment on the Hive blockchain.\n *\n * @param username - The username updating the comment (required for broadcast)\n * @param auth - Authentication context with platform adapter and fallback configuration\n *\n * @returns React Query mutation result\n *\n * @remarks\n * **Post-Broadcast Actions:**\n * - Invalidates parent post cache to reflect the updated comment\n * - Invalidates discussions cache (all sort orders)\n * - Invalidates RC cache (RC decreases after updating)\n *\n * **Operations:**\n * - Always includes a comment operation\n * - Optionally includes comment_options operation for beneficiaries/rewards\n *\n * **Important:**\n * - Updates use the same comment operation as creating new comments\n * - The blockchain identifies this as an update based on matching author/permlink\n * - Only the author can update their own content\n * - Content can only be updated before payout (within 7 days)\n *\n * @example\n * ```typescript\n * const updateReplyMutation = useUpdateReply(username, {\n * adapter: myAdapter,\n * enableFallback: true,\n * fallbackChain: ['keychain', 'key', 'hivesigner']\n * });\n *\n * // Update a reply\n * updateReplyMutation.mutate({\n * author: 'alice',\n * permlink: 're-bob-my-post-20260209',\n * parentAuthor: 'bob',\n * parentPermlink: 'my-post-20260209',\n * title: '',\n * body: 'Updated comment content!',\n * jsonMetadata: {\n * tags: ['comment'],\n * app: 'ecency/3.0.0-vision'\n * },\n * rootAuthor: 'bob',\n * rootPermlink: 'my-post-20260209'\n * });\n * ```\n */\nexport function useUpdateReply(\n username: string | undefined,\n auth?: AuthContextV2,\n broadcastMode?: BroadcastMode\n) {\n return useBroadcastMutation<UpdateReplyPayload>(\n [\"posts\", \"update-reply\"],\n username,\n (payload) => {\n const operations: Operation[] = [];\n\n // Main comment operation (same operation for create and update)\n operations.push(\n buildCommentOp(\n payload.author,\n payload.permlink,\n payload.parentAuthor,\n payload.parentPermlink,\n payload.title,\n payload.body,\n payload.jsonMetadata\n )\n );\n\n // Optional comment options operation\n if (payload.options) {\n const {\n maxAcceptedPayout = \"1000000.000 HBD\",\n percentHbd = 10000,\n allowVotes = true,\n allowCurationRewards = true,\n beneficiaries = []\n } = payload.options;\n\n const extensions: any[] = [];\n\n // Add beneficiaries extension if provided\n if (beneficiaries.length > 0) {\n // Sort beneficiaries alphabetically by account name (required by blockchain)\n const sortedBeneficiaries = [...beneficiaries].sort((a, b) =>\n a.account.localeCompare(b.account)\n );\n\n extensions.push([\n 0,\n {\n beneficiaries: sortedBeneficiaries.map(b => ({\n account: b.account,\n weight: b.weight\n }))\n }\n ]);\n }\n\n operations.push(\n buildCommentOptionsOp(\n payload.author,\n payload.permlink,\n maxAcceptedPayout,\n percentHbd,\n allowVotes,\n allowCurationRewards,\n extensions\n )\n );\n }\n\n return operations;\n },\n async (_result: any, variables) => {\n // No activity is recorded here. Activity rewards creating content. Every\n // broadcast from this mutation edits content that already exists.\n\n // Cache invalidation\n if (auth?.adapter?.invalidateQueries) {\n const queriesToInvalidate: any[] = [\n QueryKeys.resourceCredits.account(username!)\n ];\n\n // Invalidate parent entry\n queriesToInvalidate.push(\n QueryKeys.posts.entry(`/@${variables.parentAuthor}/${variables.parentPermlink}`)\n );\n\n // Invalidate discussions (matches all sort orders)\n // Use partial key to match all sort order variants\n // For nested replies, use rootAuthor/rootPermlink to match the root post's discussions\n // Fall back to parentAuthor/parentPermlink for direct replies to posts\n const discussionsAuthor = variables.rootAuthor || variables.parentAuthor;\n const discussionsPermlink = variables.rootPermlink || variables.parentPermlink;\n\n queriesToInvalidate.push({\n predicate: (query: any) => {\n const key = query.queryKey;\n return (\n Array.isArray(key) &&\n key[0] === \"posts\" &&\n key[1] === \"discussions\" &&\n key[2] === discussionsAuthor &&\n key[3] === discussionsPermlink\n );\n }\n });\n\n await auth.adapter.invalidateQueries(queriesToInvalidate);\n }\n },\n auth,\n 'posting',\n { broadcastMode }\n );\n}\n"]}
@@ -1,2 +1,2 @@
1
- import {d}from'./chunk-OBSTAXZB.js';import {b}from'./chunk-K2DAN37J.js';import {b as b$1}from'./chunk-POHYQBLL.js';import {a}from'./chunk-HEILHNSR.js';function l(t,r,e,u){return b(["communities","update",t],r,a=>[d(r,t,a)],async(a$1,d)=>{b$1().setQueriesData({queryKey:a.communities.singlePrefix(t)},o=>o&&{...o,...d}),e?.adapter?.invalidateQueries&&await e.adapter.invalidateQueries([[...a.communities.singlePrefix(t)]]);},e,"posting",{broadcastMode:u??"async"})}export{l as a};//# sourceMappingURL=chunk-SQZKXKLW.js.map
2
- //# sourceMappingURL=chunk-SQZKXKLW.js.map
1
+ import {d}from'./chunk-OBSTAXZB.js';import {b}from'./chunk-J2HM6MWA.js';import {b as b$1}from'./chunk-POHYQBLL.js';import {a}from'./chunk-HEILHNSR.js';function l(t,r,e,u){return b(["communities","update",t],r,a=>[d(r,t,a)],async(a$1,d)=>{b$1().setQueriesData({queryKey:a.communities.singlePrefix(t)},o=>o&&{...o,...d}),e?.adapter?.invalidateQueries&&await e.adapter.invalidateQueries([[...a.communities.singlePrefix(t)]]);},e,"posting",{broadcastMode:u??"async"})}export{l as a};//# sourceMappingURL=chunk-57A4DG2S.js.map
2
+ //# sourceMappingURL=chunk-57A4DG2S.js.map