@laceio/sdk 0.1.1 → 0.1.2-canary.1

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 (388) hide show
  1. package/dist/{TransactionBuilder-DrB3NVTi.cjs → TransactionBuilder-X1H9Gze6.cjs} +64 -14
  2. package/dist/{TransactionBuilder-V6aLx4SV.js → TransactionBuilder-bp2aMDhg.js} +23 -15
  3. package/dist/{_polyfill-buffer-patch-BnPVerlG.cjs → _polyfill-buffer-patch-CM8X7JiY.cjs} +21 -2
  4. package/dist/_polyfill-buffer-patch-yNxN4d5E.js +1467 -0
  5. package/dist/_web-crypto-random-bytes-Bo-GTcRS.js +197 -0
  6. package/dist/acc-module-4iIUv6My.cjs +27654 -0
  7. package/dist/acc-module-Cmj8EsIb.js +27624 -0
  8. package/dist/account-BOQruszJ.js +6 -0
  9. package/dist/account-BUOj4pYJ.cjs +11 -0
  10. package/dist/account-call-7wnopBq0.cjs +5 -0
  11. package/dist/account-call-B9d_2Xwi.js +4 -0
  12. package/dist/account-call-Bd4Rpbvt.cjs +323 -0
  13. package/dist/account-call-C3CkDqEC.js +276 -0
  14. package/dist/account-guards-BtjTGxDZ.cjs +42 -0
  15. package/dist/account-guards-D9Lu5T3W.js +36 -0
  16. package/dist/account-tokens-DvkOFVON.js +16 -0
  17. package/dist/account-tokens-nwcvwLu4.cjs +21 -0
  18. package/dist/{activity-type.stable-BJEfeLxL.cjs → activity-type-Ch6ljxBy.cjs} +2 -1
  19. package/dist/{activity-type.stable-C76_hWd7.js → activity-type-GsJGWs-3.js} +2 -1
  20. package/dist/address-B9ntKL8K.js +13761 -0
  21. package/dist/address-BXp-mY8H.cjs +11270 -0
  22. package/dist/{address-book-address-validator-DIUolI-s.js → address-book-address-validator-0J9XAADH.js} +2 -2
  23. package/dist/address-book-address-validator-DK0dnsRS.cjs +41 -0
  24. package/dist/address-book-address-validator-Di_ywo8M.js +39 -0
  25. package/dist/{address-book-address-validator-DNwQGlOB.cjs → address-book-address-validator-Dte_YQ2L.cjs} +2 -2
  26. package/dist/artefact-loader-BWWYAD7E.cjs +183 -0
  27. package/dist/artefact-loader-Dik4HIfv.js +160 -0
  28. package/dist/auto-dismiss-failure-on-success-C-qoJuid.cjs +37 -0
  29. package/dist/auto-dismiss-failure-on-success-s8MGDEIu.js +31 -0
  30. package/dist/bip32-D6wd_QMn.cjs +3851 -0
  31. package/dist/bitcoin-data-provider-BYPSmuZS.js +21 -0
  32. package/dist/bitcoin-data-provider-w1oEDSU3.cjs +26 -0
  33. package/dist/bitcoin.cjs +45 -0
  34. package/dist/bitcoin.d.ts +29906 -1
  35. package/dist/bitcoin.js +20 -0
  36. package/dist/{blockfrost-tx-submit-provider-DPTrapz-.js → blockfrost-tx-submit-provider-CBWQ0wK9.js} +5 -157
  37. package/dist/{blockfrost-tx-submit-provider-BAIzV5o3.cjs → blockfrost-tx-submit-provider-CLNQ5ycR.cjs} +3 -167
  38. package/dist/bn-d3nSOIf7.cjs +2553 -0
  39. package/dist/browser-B1eMbDwh.js +7468 -0
  40. package/dist/bytes.vo-BB7_4JK6.js +23 -0
  41. package/dist/bytes.vo-BNRquqaO.cjs +34 -0
  42. package/dist/cardano-DfPwhwm-.js +3 -0
  43. package/dist/{cardano-network-id.vo-DSxrFk9S.cjs → cardano-network-id.vo-BEDPn6Li.cjs} +1 -1
  44. package/dist/{cardano-network-id.vo-CK1tNQDg.js → cardano-network-id.vo-Cfpvbod9.js} +1 -1
  45. package/dist/cardano.cjs +22 -18
  46. package/dist/cardano.d.ts +16962 -1716
  47. package/dist/cardano.js +16 -11
  48. package/dist/client-DXBLHk7K.cjs +808 -0
  49. package/dist/codecs-Cswkg7Tm.cjs +4051 -0
  50. package/dist/codecs-Dc1Krpbt.js +3903 -0
  51. package/dist/{const-C84qHkjp.js → const-BJfIK_G-.js} +4 -4
  52. package/dist/const-BhYOdznB.cjs +42 -0
  53. package/dist/const-BsnjG2_Q.cjs +32071 -0
  54. package/dist/const-CUnCl5U0.js +13 -0
  55. package/dist/{const-DXk2tFyv.js → const-CjmfjBP3.js} +1 -1
  56. package/dist/{const-BDEg2Trq.cjs → const-D-eZIS4n.cjs} +4 -4
  57. package/dist/const-D0CbQlo4.js +154 -0
  58. package/dist/{const-BY8B3_0_.cjs → const-iwzZEE_w.cjs} +1 -1
  59. package/dist/contract-1R86jhSw.js +171 -0
  60. package/dist/contract-MKLzYVkW.cjs +189 -0
  61. package/dist/create-add-accounts-Brqk84vF.js +102 -0
  62. package/dist/create-add-accounts-DzXIh7Ot.cjs +114 -0
  63. package/dist/{delegation-tx-builder-CRpLP6jH.cjs → delegation-tx-builder-Dof_0N_d.cjs} +6 -6
  64. package/dist/{delegation-tx-builder-CGVqlaFE.js → delegation-tx-builder-Dy3-2Auz.js} +5 -5
  65. package/dist/{deregistration-tx-builder-DZGwB4cz.cjs → deregistration-tx-builder-CcLwyFpj.cjs} +6 -6
  66. package/dist/{deregistration-tx-builder-B-CrUyX6.js → deregistration-tx-builder-QkWW_gWl.js} +5 -5
  67. package/dist/device-commitment-hex.vo-5wFtQvDS.js +26 -0
  68. package/dist/device-commitment-hex.vo-CT3RmAug.cjs +31 -0
  69. package/dist/device-readers-CUHYoYOH.js +145 -0
  70. package/dist/device-readers-CdxS2btd.cjs +168 -0
  71. package/dist/device-readers-D_JZeNL2.cjs +8 -0
  72. package/dist/device-readers-DwSNCGPP.js +4 -0
  73. package/dist/dist-BMi5ZjEq.cjs +43175 -0
  74. package/dist/dist-BtIq4XFn.cjs +535 -0
  75. package/dist/dist-C3SHC_Ho.cjs +1394 -0
  76. package/dist/dist-CykEjYEX.cjs +3814 -0
  77. package/dist/dist-Dcsxh3be.cjs +3452 -0
  78. package/dist/dist-DqJfSlTd.cjs +4413 -0
  79. package/dist/dist-nTZ70qj7.cjs +1306 -0
  80. package/dist/{earn-rewards-tx-builder-D5sUT5v8.cjs → earn-rewards-tx-builder-BP5JMIKS.cjs} +6 -6
  81. package/dist/{earn-rewards-tx-builder-BDbTDZmD.js → earn-rewards-tx-builder-Cku4BmNU.js} +5 -5
  82. package/dist/enc-key-circuits-B7BjgUL9.js +13 -0
  83. package/dist/enc-key-circuits-BLrZrBVI.cjs +24 -0
  84. package/dist/english-Byb9M0E_.cjs +2057 -0
  85. package/dist/envelopes-BGoO_v8m.js +1621 -0
  86. package/dist/envelopes-CH25R-DN.cjs +1722 -0
  87. package/dist/errors-BIftM8ZN.cjs +688 -0
  88. package/dist/errors-DSq5wUwt.js +466 -0
  89. package/dist/esm-HBSUQw3w.js +384 -0
  90. package/dist/esm-LZuaZjMf.cjs +389 -0
  91. package/dist/experimental.cjs +7349 -0
  92. package/dist/experimental.d.ts +86279 -0
  93. package/dist/experimental.js +7184 -0
  94. package/dist/gated-call-CDCVZIK-.cjs +5 -0
  95. package/dist/gated-call-D-tT7P_t.js +722 -0
  96. package/dist/gated-call-D_VT2quk.js +4 -0
  97. package/dist/gated-call-DgJm1Mi_.cjs +787 -0
  98. package/dist/grant-circuits-DswmW3nI.cjs +71 -0
  99. package/dist/grant-circuits-Jxb5y1HW.js +42 -0
  100. package/dist/grant-rules-By07_eDi.js +6824 -0
  101. package/dist/grant-rules-BzVTWXS7.cjs +7099 -0
  102. package/dist/grant-spend-B3Md9L0n.js +215 -0
  103. package/dist/grant-spend-oWmzRsjH.cjs +217 -0
  104. package/dist/grant-status-B2y49iIu.js +2688 -0
  105. package/dist/grant-status-DOr3t_u8.cjs +2820 -0
  106. package/dist/grants-2BZ-qEVQ.js +5 -0
  107. package/dist/grants-BPoLSiMt.cjs +18 -0
  108. package/dist/grants-BoI5uwSF.cjs +272 -0
  109. package/dist/grants-CtofFu-e.js +213 -0
  110. package/dist/{group-cardano-addresses-by-account-B533oVXR.cjs → group-cardano-addresses-by-account-Bp0g4wEY.cjs} +3 -39
  111. package/dist/{group-cardano-addresses-by-account-RHKoEskR.js → group-cardano-addresses-by-account-SR8MMrZf.js} +5 -35
  112. package/dist/{guarded-transaction-signer-Bxl6_XNd.cjs → guarded-transaction-signer-MFpPg98D.cjs} +17 -18
  113. package/dist/{guarded-transaction-signer-CpKLj8Kp.js → guarded-transaction-signer-P6Rp1faj.js} +8 -15
  114. package/dist/hex-D9ITYbwt.cjs +263 -0
  115. package/dist/hex-mkXcV3pN.js +191 -0
  116. package/dist/http-client-B3N-TMxu.cjs +167 -0
  117. package/dist/http-client-TRlhDZGh.js +155 -0
  118. package/dist/identity-BMLuufva.cjs +263 -0
  119. package/dist/identity-DII6f-h7.js +233 -0
  120. package/dist/in-memory-wallet-integration-B2xzxORj.cjs +20741 -0
  121. package/dist/in-memory-wallet-integration-CBRiPjLO.js +130 -0
  122. package/dist/in-memory-wallet-integration-CULUB5Tf.cjs +240 -0
  123. package/dist/{in-memory-wallet-integration-D-qn65Kx.js → in-memory-wallet-integration-ChIOirMW.js} +5 -2
  124. package/dist/{in-memory-wallet-integration-Croiuopx.js → in-memory-wallet-integration-CljprQQV.js} +7 -104
  125. package/dist/{in-memory-wallet-integration-DVh9sRXa.cjs → in-memory-wallet-integration-Cm6P8sk6.cjs} +3 -2
  126. package/dist/in-memory-wallet-integration-TM9bBphA.js +20738 -0
  127. package/dist/{in-memory-wallet-integration-CnLYeX4-.cjs → in-memory-wallet-integration-t9I00R_V.cjs} +17 -108
  128. package/dist/index.cjs +84 -47
  129. package/dist/index.d.ts +37505 -10036
  130. package/dist/index.js +52 -24
  131. package/dist/{init-CLHuAMB-.js → init-0zzs9aqU.js} +4 -4
  132. package/dist/{init-U8c9yHYx.cjs → init-5KcGcBb5.cjs} +1 -1
  133. package/dist/{init-CigestoM.js → init-B3-1ghyx.js} +2 -2
  134. package/dist/init-B8U3ABhS.cjs +107 -0
  135. package/dist/init-BJn-8_hf.js +141 -0
  136. package/dist/init-BPU3j8sT.cjs +6 -0
  137. package/dist/init-BRzH6xu-2.cjs +2797 -0
  138. package/dist/init-BmzfDaKL.js +1142 -0
  139. package/dist/{init-C-jErzp5.cjs → init-BopV9ed4.cjs} +2 -2
  140. package/dist/init-BpHTq2R5.js +105 -0
  141. package/dist/init-BpSITBfF.js +39 -0
  142. package/dist/{init-DX4WyB0R.cjs → init-BrdVzxei.cjs} +3 -3
  143. package/dist/{init-LfyMo-sS.cjs → init-BwkU0ruo.cjs} +2 -2
  144. package/dist/{init-CB__aLD7.cjs → init-C-G32J12.cjs} +2 -2
  145. package/dist/init-C00gw1zi.js +422 -0
  146. package/dist/{init-TkPq_Ny_.js → init-C2RgrfZe.js} +1 -1
  147. package/dist/init-C5mYyFTv.js +3584 -0
  148. package/dist/{init-DcYY6zMD.js → init-C8URA2OX.js} +1 -1
  149. package/dist/init-CDkRynJa.js +2796 -0
  150. package/dist/{init-Cg9XdAru.js → init-CNM5m7M2.js} +4 -4
  151. package/dist/init-CR7BfztQ.cjs +18 -0
  152. package/dist/{init-CSHwHnfg.cjs → init-CSDpdu0Q.cjs} +2 -2
  153. package/dist/{init-aJHl-7AO.js → init-CX0AMQUn.js} +2 -2
  154. package/dist/{init-FMGDET-9.js → init-CfTbSEKy.js} +259 -60
  155. package/dist/{init-CR6tpw1B.js → init-Cigr_tKx.js} +47 -43
  156. package/dist/init-Clu8pxwQ.cjs +1181 -0
  157. package/dist/{init-CFYsq82V.js → init-CyAY4Lzl.js} +1 -1
  158. package/dist/{init-BKhH6mVR.cjs → init-D6BxBs7e.cjs} +1 -1
  159. package/dist/init-D8OeObDF.cjs +1141 -0
  160. package/dist/init-D9g1HXYf.cjs +40 -0
  161. package/dist/{init-CNLGJJRx.js → init-DA7zmptx.js} +1 -1
  162. package/dist/{init-DkIc5nqF.cjs → init-DFMiP2ZH.cjs} +1 -1
  163. package/dist/{init-zSzCjoor.js → init-DFjT8YvT.js} +4 -4
  164. package/dist/init-DGjXwWs2.cjs +143 -0
  165. package/dist/init-DHrCbpkW.cjs +121 -0
  166. package/dist/init-DRzJR02G.cjs +3585 -0
  167. package/dist/{init-B64zCLxG.cjs → init-DUF4ar8P.cjs} +4 -4
  168. package/dist/init-DlqJuHhl.js +119 -0
  169. package/dist/{init-y2Ra0vZP.js → init-Dnsv155v.js} +3 -3
  170. package/dist/init-DuYENxci.js +17 -0
  171. package/dist/{init-D6DBUsD3.cjs → init-Dv3zKj0r.cjs} +4 -4
  172. package/dist/{init-BtzMZ7Pk.cjs → init-Dy-05ktr.cjs} +1 -1
  173. package/dist/{init-BsCBAGWf.cjs → init-EP0CUWNK.cjs} +2 -2
  174. package/dist/{init-BJVU54pI.cjs → init-EhzD7a8i.cjs} +1 -1
  175. package/dist/{init-w9GEs73W.js → init-Fw89ZmrR.js} +2 -2
  176. package/dist/init-GsT2AEa4.cjs +424 -0
  177. package/dist/{init-Rxohwpmu.js → init-NCjgwCZy.js} +2 -2
  178. package/dist/{init-DxUHsN53.cjs → init-NdhG_VrF.cjs} +6 -6
  179. package/dist/{init-DDdhguVC.js → init-SZ01tARX2.js} +2 -2
  180. package/dist/{init-BAJJzBza.js → init-Y3mkB4XS.js} +2 -2
  181. package/dist/init-c4l6r-o-.js +5 -0
  182. package/dist/{init-Dku4b2lG.js → init-kEfUTuG2.js} +1 -1
  183. package/dist/{init-C7IeJwQR.cjs → init-lzHt4Cli.cjs} +256 -59
  184. package/dist/init-qSEd_Spq.js +1182 -0
  185. package/dist/{init-anYu6XB7.cjs → init-rmt7-fQE.cjs} +2 -2
  186. package/dist/{init-C4Bkib9u.cjs → init-zU-_9Gsp.cjs} +67 -65
  187. package/dist/{is-retriable-error-BU0e3hVI.js → is-retriable-error-BUiVJDwH.js} +1 -1
  188. package/dist/{is-retriable-error-CeeuHqDa.cjs → is-retriable-error-Dpt860if.cjs} +1 -1
  189. package/dist/jubjub-authoriser-D7zDXu3V.js +86 -0
  190. package/dist/jubjub-authoriser-Dgu6o3Sv.cjs +87 -0
  191. package/dist/key-source-5oUBFiC7.cjs +583 -0
  192. package/dist/key-source-B08HukZg.js +2550 -0
  193. package/dist/keyDerivation-D3k9XyHg.js +4077 -0
  194. package/dist/keyDerivation-u0nBA93T.cjs +274 -0
  195. package/dist/{lace-context-CZcNHr4M.js → lace-context-BZciB9c7.js} +4 -4
  196. package/dist/{lace-context-fJTDghdp.cjs → lace-context-DgR6vLli.cjs} +4 -4
  197. package/dist/lib--iqvW4O_.js +2354 -0
  198. package/dist/lib-Yk6Upl5D.cjs +2359 -0
  199. package/dist/{libsodium-wrappers-UH0LaOUE.js → libsodium-wrappers-BhbOA8dQ.js} +3 -1647
  200. package/dist/midnight-account-id.vo-0x9X-r3l.cjs +10 -0
  201. package/dist/midnight-account-id.vo-DjCAGcqc.js +5 -0
  202. package/dist/midnight-engine-DpemplKO.js +5 -0
  203. package/dist/midnight-engine-xU1wotne.cjs +6 -0
  204. package/dist/midnight-wallet-DIsAlSn6.js +18 -0
  205. package/dist/midnight-wallet-XTZc2li7.cjs +24 -0
  206. package/dist/midnight.cjs +1408 -0
  207. package/dist/midnight.d.ts +28934 -0
  208. package/dist/midnight.js +1352 -0
  209. package/dist/modules-cardano-D9Gs2j60.cjs +1108 -0
  210. package/dist/modules-cardano-VIM8fKu-.js +995 -0
  211. package/dist/node-relay-DWe1U0w2.cjs +49 -0
  212. package/dist/node-relay-h4i5IlAQ.js +48 -0
  213. package/dist/outputs-Bd2yZVjx.js +720 -0
  214. package/dist/outputs-CJoQBIA2.cjs +990 -0
  215. package/dist/pbkdf2-CIW-oWrm.cjs +1337 -0
  216. package/dist/pending-operation-B0_P78Jo.cjs +26 -0
  217. package/dist/pending-operation-BIS6mpjB.js +21 -0
  218. package/dist/providers-FjhM47BH.cjs +388 -0
  219. package/dist/providers-WtiSuxFu.js +365 -0
  220. package/dist/redacted-BmE2aXqr.js +81 -0
  221. package/dist/redacted-CRZJLS3w.cjs +86 -0
  222. package/dist/{retry-config-DC5IMaH7.cjs → retry-config-BaCfVC1H.cjs} +1 -1
  223. package/dist/{retry-config-BcUmMS--.js → retry-config-Dmgt28wM.js} +1 -1
  224. package/dist/safe-buffer-B_vMqJWU.js +43 -0
  225. package/dist/safe-buffer-DYOwEfHB.cjs +48 -0
  226. package/dist/sdk-Cb-gZnS9.js +1241 -0
  227. package/dist/sdk-DffwmX8b.cjs +1439 -0
  228. package/dist/sdk-init-Bln9rFtn.js +4138 -0
  229. package/dist/sdk-init-CYViTJY_.cjs +3841 -0
  230. package/dist/{seam-cardano-CATqBEyK.js → seam-cardano-B_etH4F4.js} +1 -1
  231. package/dist/{bytes.vo-TgiwogWF.js → secret-box-DUR0ACYz.js} +3 -25
  232. package/dist/{bytes.vo-Ck5u40RA.cjs → secret-box-DrjLZuS1.cjs} +1 -35
  233. package/dist/send-proof-progress-C-ljq1x5.js +30 -0
  234. package/dist/send-proof-progress-vmsaSfbz.cjs +47 -0
  235. package/dist/side-effects-BnqYz7Nl.js +768 -0
  236. package/dist/side-effects-CngaeXi0.cjs +804 -0
  237. package/dist/sign-bitcoin-transaction-with-seed-D4z62-jV.js +147 -0
  238. package/dist/sign-bitcoin-transaction-with-seed-DsLYXnCY.cjs +158 -0
  239. package/dist/signer-3fk8lZtE.cjs +7 -0
  240. package/dist/signer-CsL28DrK.cjs +121 -0
  241. package/dist/signer-DGluibtn.js +92 -0
  242. package/dist/signer-RqB5pu3K.js +2 -0
  243. package/dist/signer-factory-BA7WFJVZ.js +282 -0
  244. package/dist/signer-factory-Cwd6o-lG.cjs +281 -0
  245. package/dist/{signer-factory-9URFliA5.js → signer-factory-DObB55D4.js} +6 -3
  246. package/dist/signer-factory-DhZiE03y.cjs +149 -0
  247. package/dist/{signer-factory-BWGUmnvm.cjs → signer-factory-Ds6G2AZk.cjs} +4 -3
  248. package/dist/signer-factory-hzSRaIw2.js +148 -0
  249. package/dist/{slice-CuHUaPZx.cjs → slice-7G2xxYKJ.cjs} +3 -3
  250. package/dist/{slice-DZmQJNV8.cjs → slice-B4CdYoPu.cjs} +2 -2
  251. package/dist/slice-BPNuHKfw.js +9091 -0
  252. package/dist/{slice-DGcNrbPR.cjs → slice-Bg6HEr3K.cjs} +4 -4
  253. package/dist/{slice-DtaO72qY.cjs → slice-Bs2aMERu.cjs} +3 -3
  254. package/dist/{slice-HeHCv3bl.cjs → slice-C34iOOUH.cjs} +7 -7
  255. package/dist/{slice-Do2R2CYW.cjs → slice-C9TT5KhY.cjs} +6 -6
  256. package/dist/{slice-eIwcwKHI.js → slice-CK07EBCo.js} +4 -4
  257. package/dist/{slice-CnyWevM9.js → slice-CU80pbiu.js} +3 -3
  258. package/dist/{slice-CobanYgn.js → slice-CwyYrh1H.js} +2 -2
  259. package/dist/slice-Czfp6t84.cjs +436 -0
  260. package/dist/{slice-d0p6-xj5.js → slice-D-9aPKG-.js} +6 -6
  261. package/dist/{slice-maaskdUn.js → slice-DBpJ2QGf.js} +6 -6
  262. package/dist/{slice-mxLQ_FeY.cjs → slice-DTZTiJle.cjs} +352 -39
  263. package/dist/{slice-zJ9XVYjZ.js → slice-Da426sf9.js} +1 -1
  264. package/dist/{slice-D11m2EKl.cjs → slice-DayJvMRD.cjs} +1 -1
  265. package/dist/slice-DnBWfA-k.cjs +9109 -0
  266. package/dist/{slice-oqm_r1cS.cjs → slice-DnG-yvpI.cjs} +2 -2
  267. package/dist/{slice-BNu73oBa.js → slice-DyNs7oWp.js} +2 -2
  268. package/dist/{slice-CB4SnzMm.js → slice-GwiiJRoq.js} +3 -3
  269. package/dist/slice-oWnc7YVD.js +412 -0
  270. package/dist/{slice-B2PhoWAg.js → slice-qt0uBExh.js} +325 -37
  271. package/dist/slice-t8Gzj55G2.cjs +106 -0
  272. package/dist/slice-t8Q1cHm-.js +88 -0
  273. package/dist/src-BDzYIksE.cjs +20637 -0
  274. package/dist/src-BFoefPv_.js +20755 -0
  275. package/dist/store-B1Lq3cEf.cjs +66 -0
  276. package/dist/store-DuBG8qh5.js +37 -0
  277. package/dist/submit-Bs77dPn_.cjs +413 -0
  278. package/dist/submit-DOv8Z0Vf.js +336 -0
  279. package/dist/submit-bitcoin-tx-D6oYgH5S.js +983 -0
  280. package/dist/submit-bitcoin-tx-goFuRL7K.cjs +1049 -0
  281. package/dist/{sync-operation-utils-BYXLO80m.js → sync-operation-utils-31iFLExW.js} +2 -38
  282. package/dist/{sync-operation-utils-SdPbwFoD.cjs → sync-operation-utils-COIZ66-I.cjs} +1 -67
  283. package/dist/token-id-mapper-Bnds3xKH.cjs +18 -0
  284. package/dist/{token-id-mapper-DsPAL6Nh.cjs → token-id-mapper-CVyQJUKY.cjs} +2 -2
  285. package/dist/token-id-mapper-CnKHQ8DV.js +16 -0
  286. package/dist/{token-id-mapper-B2ivlLv3.js → token-id-mapper-D29Ggv8h.js} +2 -2
  287. package/dist/tokens-Cevp7rdU.cjs +62 -0
  288. package/dist/tokens-Diw4MLRM.js +44 -0
  289. package/dist/types-B8uiJn-X.js +12 -0
  290. package/dist/types-BHC12eSa.js +33 -0
  291. package/dist/types-CJT6XF2c.js +10 -0
  292. package/dist/types-CLRUYpfe.cjs +23 -0
  293. package/dist/types-Cc3mC8u0.cjs +50 -0
  294. package/dist/types-DWbVZpnF.cjs +15 -0
  295. package/dist/unwrap-provider-result-BZSiwabU.js +32 -0
  296. package/dist/unwrap-provider-result-ZqfBsTkk.cjs +39 -0
  297. package/dist/{util-CGzqQ8IV.cjs → util-Bu4W5lF4.cjs} +1 -1
  298. package/dist/{util-BaLzwa32.js → util-Cp5cZkfK.js} +1 -1
  299. package/dist/{utils-o8aMjfln.js → utils-BfBEUvWA.js} +2 -2
  300. package/dist/utils-DFwzEvbv.js +65 -0
  301. package/dist/{utils-5JvjbqH3.cjs → utils-DsElZgCI.cjs} +7 -1
  302. package/dist/utils-IXxR-Djh.cjs +112 -0
  303. package/dist/v8Signatures-CO_Uloy7.cjs +71 -0
  304. package/dist/{vote-delegation-tx-builder-CmKv6GoG.js → vote-delegation-tx-builder-BsBSDmcX.js} +5 -5
  305. package/dist/{vote-delegation-tx-builder-BpEMSti4.cjs → vote-delegation-tx-builder-DSs8nybk.cjs} +6 -6
  306. package/dist/watch-CUEvcP-V.js +21997 -0
  307. package/dist/watch-DMF2s-II.cjs +52281 -0
  308. package/package.json +96 -4
  309. package/dist/account-guards.stable-B1DSSh9D.cjs +0 -10
  310. package/dist/account-guards.stable-JRQ5qx2V.js +0 -5
  311. package/dist/codecs-B7X9pAsK.cjs +0 -1945
  312. package/dist/codecs-CC1Xjntz.js +0 -1882
  313. package/dist/init-Bv53hpLM.js +0 -19
  314. package/dist/init-CRbjI7p1.js +0 -3494
  315. package/dist/init-DAna1KCg.cjs +0 -3495
  316. package/dist/init-DGe47B22.cjs +0 -364
  317. package/dist/init-DMtyvYfC.cjs +0 -21
  318. package/dist/init-TkPDD750.js +0 -363
  319. package/dist/modules-cardano-BDvuL4Xx.js +0 -5248
  320. package/dist/modules-cardano-D2G3De2P.cjs +0 -5432
  321. package/dist/slice-CGVHXHDt.cjs +0 -125
  322. package/dist/slice-DhvF7L6X.js +0 -107
  323. /package/dist/{account-id.vo-LvCBVn5r.cjs → account-id.vo-DwqFjK5u.cjs} +0 -0
  324. /package/dist/{account-id.vo-MYSI7YFm.js → account-id.vo-OPz2v-JZ.js} +0 -0
  325. /package/dist/{actions-DdGbj7c7.cjs → actions-B2BJ4RTy.cjs} +0 -0
  326. /package/dist/{actions-9QSQR-GB.js → actions-iLXdgL5Y.js} +0 -0
  327. /package/dist/{apply-vkey-witnesses-ClZbpk5w.js → apply-vkey-witnesses-BKx3lcs0.js} +0 -0
  328. /package/dist/{apply-vkey-witnesses-CLzVSWxl.cjs → apply-vkey-witnesses-ZnFS0jnJ.cjs} +0 -0
  329. /package/dist/{asyncoption-Cw07zPH7.js → asyncoption-CruEYOBI.js} +0 -0
  330. /package/dist/{asyncoption-DYoGuQfP.cjs → asyncoption-i0VbqVTq.cjs} +0 -0
  331. /package/dist/{bignum.vo-B0rK_PQ1.js → bignum.vo-CEXOIew0.js} +0 -0
  332. /package/dist/{bignum.vo-DsG3kNiZ.cjs → bignum.vo-hx2kuqlA.cjs} +0 -0
  333. /package/dist/{bip32ed25519-1ApqeAZk.cjs → bip32ed25519-B7Yat217.cjs} +0 -0
  334. /package/dist/{bip32ed25519-DetAdGwD.js → bip32ed25519-FQ8qvdcq.js} +0 -0
  335. /package/dist/{blake2b-DOEVc57D.js → blake2b-BiQTw3GC.js} +0 -0
  336. /package/dist/{blake2b-B9tftbvG.cjs → blake2b-DEeVUdKR.cjs} +0 -0
  337. /package/dist/{blockchain-network-id.vo-BXpZhvvQ.cjs → blockchain-network-id.vo-BAKEwGjG.cjs} +0 -0
  338. /package/dist/{blockchain-network-id.vo-DNRkuT5B.js → blockchain-network-id.vo-CiVykuqG.js} +0 -0
  339. /package/dist/{blockingWithLatestFrom-C5wp_uA-.js → blockingWithLatestFrom-Cd8c8EPG.js} +0 -0
  340. /package/dist/{blockingWithLatestFrom-DY8OPg0w.cjs → blockingWithLatestFrom-D8kBPBMX.cjs} +0 -0
  341. /package/dist/{cardano-network-id-to-network-type-CrZfUcyP.js → cardano-network-id-to-network-type-BWwzeEtM.js} +0 -0
  342. /package/dist/{cardano-network-id-to-network-type-BDTF-HmK.cjs → cardano-network-id-to-network-type-C0ufJOyE.cjs} +0 -0
  343. /package/dist/{cardano-tx-id.vo-BPhV-AmZ.cjs → cardano-tx-id.vo-TLjJZHCI.cjs} +0 -0
  344. /package/dist/{cardano-tx-id.vo-DF9NzZXk.js → cardano-tx-id.vo-eVnKuzlm.js} +0 -0
  345. /package/dist/{composite-signer-factory-_46QsNBz.js → composite-signer-factory-CR8YHA1y.js} +0 -0
  346. /package/dist/{composite-signer-factory-BpF1mIYA.cjs → composite-signer-factory-m5cVs9h_.cjs} +0 -0
  347. /package/dist/{error-CNIquqT5.cjs → error-Cb3EnD0u.cjs} +0 -0
  348. /package/dist/{error-BCp9NkPi.js → error-DIZOY2Lw.js} +0 -0
  349. /package/dist/{esm-browser-C93Q-EOI.js → esm-browser-MG97cre9.js} +0 -0
  350. /package/dist/{esm-browser-DTc9IK3D.cjs → esm-browser-bweqfBlL.cjs} +0 -0
  351. /package/dist/{feature-flag-key.vo-ofrB6ZVQ.js → feature-flag-key.vo-DN_-4-sG.js} +0 -0
  352. /package/dist/{feature-flag-key.vo-BPz-ZAp6.cjs → feature-flag-key.vo-RlfHL3hq.cjs} +0 -0
  353. /package/dist/{first-state-of-status-OROkXcRv.cjs → first-state-of-status-CbT7hPa4.cjs} +0 -0
  354. /package/dist/{first-state-of-status-DQnMT3ya.js → first-state-of-status-unPynOuM.js} +0 -0
  355. /package/dist/{init-Es3wHW7D.js → init-829HRYcz.js} +0 -0
  356. /package/dist/{init-CKipPE_c.js → init-A-VyGSNW2.js} +0 -0
  357. /package/dist/{init-DFQQ9dTW.cjs → init-Atisw4x2.cjs} +0 -0
  358. /package/dist/{init-C5CEZ1m0.cjs → init-BFcvPHL-.cjs} +0 -0
  359. /package/dist/{init-IAk_CkGa.cjs → init-BgNobbNq.cjs} +0 -0
  360. /package/dist/{init-cqN3uX2j.js → init-atCFur0v.js} +0 -0
  361. /package/dist/{is-redux-persist-state-CTn3WZVh.cjs → is-redux-persist-state-BCFnSm36.cjs} +0 -0
  362. /package/dist/{is-redux-persist-state-Cxcd0_bM.js → is-redux-persist-state-yBfq0h_E.js} +0 -0
  363. /package/dist/{key-value-store-8cMzeNyG.js → key-value-store--W3SrMaw.js} +0 -0
  364. /package/dist/{key-value-store-DUAepXQf.cjs → key-value-store-C2Xt5Emp.cjs} +0 -0
  365. /package/dist/{repo-slice-WxetRhMY.cjs → repo-slice-7X4AYYVm.cjs} +0 -0
  366. /package/dist/{repo-slice-DwyMhCR1.js → repo-slice-RxFm0zDZ.js} +0 -0
  367. /package/dist/{reselect-CRDqmQY9.cjs → reselect-Bd94u0K-.cjs} +0 -0
  368. /package/dist/{reselect-C06X06oX.js → reselect-CGoLzEPv.js} +0 -0
  369. /package/dist/{serializable-B8GahgE1.js → serializable-BHdKIgk3.js} +0 -0
  370. /package/dist/{serializable-CRdnFaLZ.cjs → serializable-BxHkoPdk.cjs} +0 -0
  371. /package/dist/{slice-D11FHQuQ.cjs → slice-BiRsDKOK.cjs} +0 -0
  372. /package/dist/{slice-Be7hj4Iy.js → slice-Bk0Sv05J.js} +0 -0
  373. /package/dist/{slice-FioKeHtA.cjs → slice-Dqw1ecum.cjs} +0 -0
  374. /package/dist/{slice-B87b52iM.js → slice-obCSLm1x.js} +0 -0
  375. /package/dist/{src-vq1wS9sZ.js → src-BlxEp6Mm.js} +0 -0
  376. /package/dist/{src-BTPIvlDI.cjs → src-Cqp0B2M_.cjs} +0 -0
  377. /package/dist/{time.vo-CQ8pSXz2.cjs → time.vo-D3wWRw9L.cjs} +0 -0
  378. /package/dist/{time.vo-DkYYGYp6.js → time.vo-tNheinXm.js} +0 -0
  379. /package/dist/{toEmpty-CgAl3097.js → toEmpty-8Zax1MPd.js} +0 -0
  380. /package/dist/{toEmpty-DAMmNB5r.cjs → toEmpty-CYAbupM4.cjs} +0 -0
  381. /package/dist/{token-id.vo-ClsroxHO.js → token-id.vo-Bvwhr3ZE.js} +0 -0
  382. /package/dist/{token-id.vo-BxG9TG0O.cjs → token-id.vo-DXv5uS9n.cjs} +0 -0
  383. /package/dist/{util-DxzlYNS5.js → util-C8a4fA9p.js} +0 -0
  384. /package/dist/{util-CmdAhheh.cjs → util-CzeB3hfa.cjs} +0 -0
  385. /package/dist/{util-selector-CcK-GAdE.js → util-selector-BSTsxgne.js} +0 -0
  386. /package/dist/{util-selector-BcAncU4L.cjs → util-selector-BWPH68_l.cjs} +0 -0
  387. /package/dist/{while-active-BpppWuCs.js → while-active-B0lWy_6l.js} +0 -0
  388. /package/dist/{while-active-Dhc2LwOm.cjs → while-active-Dsowp0Fi.cjs} +0 -0
@@ -0,0 +1,1408 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_rolldown_runtime = require("./rolldown-runtime-Br2OG8yv.cjs");
3
+ const require__polyfill_buffer_patch = require("./_polyfill-buffer-patch-CM8X7JiY.cjs");
4
+ require("./codecs-Cswkg7Tm.cjs");
5
+ require("./util-Bu4W5lF4.cjs");
6
+ const require_bytes_vo = require("./bytes.vo-BNRquqaO.cjs");
7
+ const require_sdk = require("./sdk-DffwmX8b.cjs");
8
+ const require_time_vo = require("./time.vo-D3wWRw9L.cjs");
9
+ const require_bignum_vo = require("./bignum.vo-hx2kuqlA.cjs");
10
+ const require_asyncoption = require("./asyncoption-i0VbqVTq.cjs");
11
+ const require_key_source = require("./key-source-5oUBFiC7.cjs");
12
+ const require_store = require("./store-B1Lq3cEf.cjs");
13
+ const require_const = require("./const-iwzZEE_w.cjs");
14
+ const require_account_id_vo = require("./account-id.vo-DwqFjK5u.cjs");
15
+ require("./slice-C9TT5KhY.cjs");
16
+ require("./retry-config-BaCfVC1H.cjs");
17
+ const require_activity_type = require("./activity-type-Ch6ljxBy.cjs");
18
+ const require_token_id_vo = require("./token-id.vo-DXv5uS9n.cjs");
19
+ require("./bn-d3nSOIf7.cjs");
20
+ const require_const$1 = require("./const-BsnjG2_Q.cjs");
21
+ const require_watch = require("./watch-DMF2s-II.cjs");
22
+ const require_midnight_account_id_vo = require("./midnight-account-id.vo-0x9X-r3l.cjs");
23
+ const require_slice$1 = require("./slice-Czfp6t84.cjs");
24
+ const require_utils = require("./utils-IXxR-Djh.cjs");
25
+ const require_dist = require("./dist-BtIq4XFn.cjs");
26
+ require("./client-DXBLHk7K.cjs");
27
+ let rxjs = require("rxjs");
28
+ let _reduxjs_toolkit = require("@reduxjs/toolkit");
29
+ let ts_log = require("ts-log");
30
+ let _midnight_ntwrk_ledger_v8 = require("@midnight-ntwrk/ledger-v8");
31
+ _midnight_ntwrk_ledger_v8 = require_rolldown_runtime.__toESM(_midnight_ntwrk_ledger_v8);
32
+ let lodash_inRange = require("lodash/inRange.js");
33
+ lodash_inRange = require_rolldown_runtime.__toESM(lodash_inRange);
34
+ let lodash_toLower = require("lodash/toLower.js");
35
+ lodash_toLower = require_rolldown_runtime.__toESM(lodash_toLower);
36
+ //#region src/create-midnight-accounts.ts
37
+ /**
38
+ * Derives a Midnight account index using the entity's encrypted recovery material.
39
+ * Indexes must be integers in `[0, 2³¹)`. Omitted networks use the integration's
40
+ * defaults. Rejects duplicate accounts, an entity with neither a Midnight
41
+ * seed nor a recovery phrase (a passkey entity), unavailable integration and
42
+ * decryption or derivation errors. Other blockchain accounts are preserved.
43
+ *
44
+ * Returns an updated entity without dispatching. For a new entity, dispatch
45
+ * `wallets.addWallet`; for an existing one, dispatch `wallets.updateWallet`
46
+ * with its updated `accounts` and `blockchainSpecific`.
47
+ */
48
+ const createMidnightAccounts = async (wallet, props) => {
49
+ if (!Number.isInteger(props.accountIndex) || props.accountIndex < 0 || props.accountIndex >= 2 ** 31) throw new RangeError("Midnight account index must be an integer in [0, 2³¹)");
50
+ if (!props.wallet.blockchainSpecific.Midnight?.encryptedSeed && !props.wallet.encryptedRecoveryPhrase) throw new Error("The entity holds no Midnight seed and no recovery phrase: derive the accounts of a passkey entity with createMidnightPasskeyWalletEntity({ accounts })");
51
+ const integration = (await wallet._loadModules("addons.loadInMemoryWalletIntegration")).find((candidate) => candidate.blockchainName === "Midnight");
52
+ if (!integration) throw new Error("Midnight integration is not loaded");
53
+ const { wallet: updated } = await integration.addAccounts(props, { logger: ts_log.dummyLogger });
54
+ const accountIds = updated.accounts.map((account) => account.accountId);
55
+ if (new Set(accountIds).size !== accountIds.length) throw new Error("Midnight account already exists");
56
+ return updated;
57
+ };
58
+ //#endregion
59
+ //#region ../../packages/contract/midnight-context/src/store/index.ts
60
+ var store_default = require_store.inferStoreContext({
61
+ load: async () => Promise.resolve().then(() => require("./init-B8U3ABhS.cjs")),
62
+ context: {
63
+ actions: require_slice$1.midnightContextActions,
64
+ selectors: require_slice$1.midnightContextSelectors
65
+ }
66
+ });
67
+ //#endregion
68
+ //#region ../../packages/contract/midnight-context/src/contract.ts
69
+ const midnightContextStoreContract = require_store.inferContractContext({
70
+ name: require_sdk.ContractName("midnight-context-store"),
71
+ instance: "exactly-one",
72
+ contractType: "store",
73
+ dependsOn: require_store.combineContracts([require_sdk.networkStoreContract, require_sdk.featureStoreContract]),
74
+ mixin: require_sdk.createMixin((laceModule) => ({ store: require_sdk.combineStore(laceModule, store_default) }))
75
+ });
76
+ const midnightDependencyContract = require_store.inferContractContext({
77
+ contractType: "sideEffectDependency",
78
+ name: require_sdk.ContractName("midnight-dependency"),
79
+ instance: "exactly-one"
80
+ });
81
+ //#endregion
82
+ //#region ../../packages/contract/midnight-context/src/midnight-engine-addon.ts
83
+ /**
84
+ * Engine access for code outside the store, such as the SDK's Midnight
85
+ * helpers. Implemented by the headless Midnight engine module only.
86
+ */
87
+ const midnightEngineAddonContract = require_store.inferContractContext({
88
+ name: require_sdk.ContractName("midnight-engine-addon"),
89
+ instance: "exactly-one",
90
+ contractType: "addon",
91
+ provides: { addons: ["loadMidnightEngine"] }
92
+ });
93
+ //#endregion
94
+ //#region ../../packages/contract/midnight-context/src/dust-utils.ts
95
+ /**
96
+ * Determines the designation target type based on NIGHT coin registration and dust balance.
97
+ *
98
+ * TODO: Update when SDK supports distinguishing self vs external designation.
99
+ * Currently, the SDK's `registeredForDustGeneration` flag only indicates that NIGHT is
100
+ * participating in dust generation, but does not specify the target dust address.
101
+ * Until SDK provides this information, we treat all designation as 'self'.
102
+ *
103
+ * @returns 'self' when user has designation (registered NIGHT or dust balance), 'none' otherwise.
104
+ * Note: 'external' is not returned until SDK supports proper detection.
105
+ */
106
+ const getDesignationTargetType = (coins, currentDustValue) => {
107
+ return coins.some((coin) => coin.registeredForDustGeneration === true) || currentDustValue > 0n ? "self" : "none";
108
+ };
109
+ const TOKEN_FORBIDDEN_NAMES = [
110
+ "dust",
111
+ "lace",
112
+ "midnight",
113
+ "tdust",
114
+ "night",
115
+ "tnight"
116
+ ];
117
+ /** Checks reserved and additional excluded names case-insensitively; trim input first. */
118
+ const isForbiddenTokenName = (name, extraExcludedTokenNames = []) => [...TOKEN_FORBIDDEN_NAMES, ...extraExcludedTokenNames.map(lodash_toLower.default)].includes((0, lodash_toLower.default)(name));
119
+ /** Checks case-insensitive display-name collisions; omit the current token from the list. */
120
+ const isTakenTokenName = (name, takenTokenNames = []) => takenTokenNames.map(lodash_toLower.default).includes((0, lodash_toLower.default)(name));
121
+ const createTokenNameValidator = (minLength, maxLength) => (name, excludedNames = []) => {
122
+ const isInvalidNameLength = !(0, lodash_inRange.default)(name.trim().length, minLength, maxLength + 1);
123
+ return !(isForbiddenTokenName(name, excludedNames) || isInvalidNameLength);
124
+ };
125
+ /** Validates display-name length and reserved names; trim before validating and saving. */
126
+ const isTokenFullNameValid = createTokenNameValidator(1, 30);
127
+ /** Validates ticker length and reserved names; trim before validating and saving. */
128
+ const isTokenShortNameValid = createTokenNameValidator(1, 4);
129
+ /** Direct import of this is an anti-pattern. OK for tests. */
130
+ const midnightSyncActions = { midnightSync: {
131
+ requestResync: (0, _reduxjs_toolkit.createAction)("midnight/requestResync"),
132
+ resync: (0, _reduxjs_toolkit.createAction)("midnight/resync"),
133
+ restartWalletWatch: (0, _reduxjs_toolkit.createAction)("midnight/restartWalletWatch"),
134
+ restartAccountWatch: (0, _reduxjs_toolkit.createAction)("midnight/restartAccountWatch")
135
+ } };
136
+ //#endregion
137
+ //#region ../../packages/module/midnight-sync/src/store/prepare-midnight-tx.ts
138
+ const constructDustDesignationTransaction = ({ address, networkId, nightUtxos, nightVerifyingKey, ttl = new Date(Date.now() + require_const$1.defaultTxTtlLength), allowFeePayment }) => {
139
+ const parsedAddress = require_dist.MidnightBech32m.parse(address);
140
+ const receiverData = require_dist.DustAddress.codec.decode(networkId, parsedAddress).data;
141
+ const currentTime = /* @__PURE__ */ new Date();
142
+ const intent = _midnight_ntwrk_ledger_v8.Intent.new(ttl);
143
+ const totalNightValue = nightUtxos.map(({ utxo: { value } }) => require_bignum_vo.BigNumber.valueOf(value)).reduce((total, value) => total + value, 0n);
144
+ const inputs = nightUtxos.map(({ utxo }) => ({
145
+ ...utxo,
146
+ owner: nightVerifyingKey
147
+ }));
148
+ const outputs = inputs.map((input) => ({
149
+ owner: _midnight_ntwrk_ledger_v8.addressFromKey(nightVerifyingKey),
150
+ type: input.type,
151
+ value: input.value
152
+ }));
153
+ intent.guaranteedUnshieldedOffer = _midnight_ntwrk_ledger_v8.UnshieldedOffer.new(inputs, outputs, []);
154
+ const dustRegistration = new _midnight_ntwrk_ledger_v8.DustRegistration("signature", nightVerifyingKey, receiverData, allowFeePayment ?? totalNightValue);
155
+ intent.dustActions = new _midnight_ntwrk_ledger_v8.DustActions("signature", "pre-proof", currentTime, [], [dustRegistration]);
156
+ return _midnight_ntwrk_ledger_v8.Transaction.fromParts(networkId, void 0, void 0, intent);
157
+ };
158
+ const constructUnshieldedTransaction = ({ networkId, transfers, ttl = new Date(Date.now() + require_const$1.defaultTxTtlLength) }) => {
159
+ const intent = _midnight_ntwrk_ledger_v8.Intent.new(ttl);
160
+ const outputs = transfers.map(({ address, amount, tokenId }) => ({
161
+ value: amount,
162
+ owner: require_dist.UnshieldedAddress.codec.decode(networkId, require_dist.MidnightBech32m.parse(address)).data.toString("hex"),
163
+ type: tokenId
164
+ }));
165
+ intent.guaranteedUnshieldedOffer = _midnight_ntwrk_ledger_v8.UnshieldedOffer.new([], outputs, []);
166
+ return _midnight_ntwrk_ledger_v8.Transaction.fromParts(networkId, void 0, void 0, intent);
167
+ };
168
+ const constructShieldedTransaction = ({ networkId, transfers }) => {
169
+ const toOffer = ({ address, amount, tokenId }) => {
170
+ const decodedAddress = require_dist.ShieldedAddress.codec.decode(networkId, require_dist.MidnightBech32m.parse(address));
171
+ const output = _midnight_ntwrk_ledger_v8.ZswapOutput.new(_midnight_ntwrk_ledger_v8.createShieldedCoinInfo(tokenId, amount), 0, decodedAddress.coinPublicKey.toHexString(), decodedAddress.encryptionPublicKey.toHexString());
172
+ return _midnight_ntwrk_ledger_v8.ZswapOffer.fromOutput(output, tokenId, amount);
173
+ };
174
+ const [firstTransfer, ...remainingTransfers] = transfers;
175
+ if (!firstTransfer) throw new Error("At least one token transfer is required");
176
+ const offer = remainingTransfers.map(toOffer).reduce((merged, singleton) => merged.merge(singleton), toOffer(firstTransfer));
177
+ return _midnight_ntwrk_ledger_v8.Transaction.fromParts(networkId, offer);
178
+ };
179
+ /** Normalize token-state IDs and reject a batch before any engine operation. */
180
+ const normalizeMidnightTransfers = (networkId, kind, outputs) => {
181
+ if (kind !== "shielded" && kind !== "unshielded") throw new Error("Unsupported Midnight transfer kind");
182
+ if (outputs.length === 0) throw new Error("At least one token transfer is required");
183
+ return outputs.map(({ to, tokenId, amount }) => {
184
+ if (typeof amount !== "bigint" || amount <= 0n) throw new Error("Transfer amount must be a positive bigint");
185
+ const prefix = `unshielded-${networkId}`;
186
+ if (kind === "unshielded" && !tokenId.startsWith(prefix)) throw new Error("Unshielded token ID must match the transfer kind and network");
187
+ const raw = kind === "unshielded" ? require_utils.fromUnshieldedTokenType(tokenId, networkId) : tokenId;
188
+ if (!/^[0-9a-f]{64}$/.test(raw)) throw new Error("Invalid token ID or token-kind mismatch");
189
+ const parsed = require_dist.MidnightBech32m.parse(to);
190
+ if (kind === "shielded") require_dist.ShieldedAddress.codec.decode(networkId, parsed);
191
+ else require_dist.UnshieldedAddress.codec.decode(networkId, parsed);
192
+ return {
193
+ address: to,
194
+ tokenId: require_token_id_vo.TokenId(raw),
195
+ amount
196
+ };
197
+ });
198
+ };
199
+ /** Keep designation's zero-fee exception identical in headless and UI preparation. */
200
+ const estimatePreparedMidnightFee = (wallet, tx, { isDustDesignation, dustBalance, areKeysAvailable }) => {
201
+ if (isDustDesignation && dustBalance === 0n) return (0, rxjs.of)(0n);
202
+ return areKeysAvailable ? wallet.estimateTransactionFee(tx, { currentTime: /* @__PURE__ */ new Date() }) : wallet.calculateTransactionFee(tx);
203
+ };
204
+ //#endregion
205
+ //#region ../../packages/lib/vendor/src/temenos-attested-prover.ts
206
+ var TemenosAttestationError = class extends require_watch.AttestationError {
207
+ constructor(phase, checkId) {
208
+ super("temenos", phase === "obtain-evidence" ? "evidence" : phase === "fetch-expected-values" ? "policy" : phase === "bind-channel" ? "channel" : "appraisal", checkId ? `Temenos attestation failed: check "${checkId}" of phase "${phase}"` : `Temenos attestation failed at phase "${phase}"`);
209
+ this.phase = phase;
210
+ this.checkId = checkId;
211
+ this.name = "TemenosAttestationError";
212
+ }
213
+ };
214
+ /**
215
+ * `pointerContractAddress` is the one on-chain constant: the pointer's
216
+ * `current` cell names the attestation ledger, so a ledger redeploy is a
217
+ * pointer update, not a Lace release. All Temenos deployments register on the
218
+ * single preprod pointer, whatever network the proof server serves, so this
219
+ * stays on preprod on every network. The caller resolves the ledger
220
+ * indexer from Lace configuration at the start of each attestation run.
221
+ *
222
+ * `wardenTlsCertificate` is empty by design: a browser context cannot pin
223
+ * the transport certificate, so the Warden is reached over public WebPKI
224
+ * TLS — its verdict is defense-in-depth on top of the local checks, not a
225
+ * trust root.
226
+ */
227
+ const SHARED_TEMENOS_DEPLOYMENT = {
228
+ pointerContractAddress: "a58974f1cacda177edfea3bdc76c1cd48d5e3107b9a543b9d65cee6b454c9122",
229
+ wardenUrl: "https://warden.wastedp.io",
230
+ wardenTlsCertificate: ""
231
+ };
232
+ const TEMENOS_PREPROD_DEPLOYMENT = {
233
+ ...SHARED_TEMENOS_DEPLOYMENT,
234
+ proofServerApiUrl: "https://api.proofserver.wastedp.io",
235
+ attestationHost: "attestation.proofserver.wastedp.io",
236
+ akxServerUrl: "https://attestation.proofserver.wastedp.io/tee_attestation",
237
+ applicationId: "afe48970b7083e1b2855acce95a488e93a7c257a34f6275e77ac26f79ac7ad05"
238
+ };
239
+ /**
240
+ * Attestation parameters per network, matching `TEMENOS_PROOF_SERVER_MODES`
241
+ * entry for entry. Values are build-baked and reviewed like code; the
242
+ * persisted mode carries only the URL, so nothing here can be injected via
243
+ * feature-flag payloads.
244
+ */
245
+ const TEMENOS_ATTESTATION_CONFIGS = {
246
+ mainnet: {
247
+ ...SHARED_TEMENOS_DEPLOYMENT,
248
+ proofServerApiUrl: "https://api.proofserver.mainnet.wastedp.io",
249
+ attestationHost: "attestation.proofserver.mainnet.wastedp.io",
250
+ akxServerUrl: "https://attestation.proofserver.mainnet.wastedp.io/tee_attestation",
251
+ applicationId: "70402462424c122c65e2d3d2312757face3974940c9ac5d09249b61028350427"
252
+ },
253
+ preprod: TEMENOS_PREPROD_DEPLOYMENT,
254
+ preview: {
255
+ ...SHARED_TEMENOS_DEPLOYMENT,
256
+ proofServerApiUrl: "https://api.proofserver.preview.wastedp.io",
257
+ attestationHost: "attestation.proofserver.preview.wastedp.io",
258
+ akxServerUrl: "https://attestation.proofserver.preview.wastedp.io/tee_attestation",
259
+ applicationId: "b294b8879607f7d0f5cca3808a4b64aab7992de2a73d1e55dbafb091efca25f2"
260
+ }
261
+ };
262
+ for (const [networkId, mode] of Object.entries(require_const$1.TEMENOS_PROOF_SERVER_MODES)) {
263
+ if (!mode) continue;
264
+ if (TEMENOS_ATTESTATION_CONFIGS[networkId]?.proofServerApiUrl !== mode.url) throw new Error(`TEMENOS_PROOF_SERVER_MODES[${networkId}] ("${mode.url}") has no matching entry in TEMENOS_ATTESTATION_CONFIGS`);
265
+ }
266
+ /** temenos-spec phases 1–5 of the AKX flow, in execution order. */
267
+ const TEMENOS_ATTESTATION_PHASES = [
268
+ "obtain-evidence",
269
+ "fetch-expected-values",
270
+ "verify-locally",
271
+ "warden-verify",
272
+ "bind-channel"
273
+ ];
274
+ const PHASE_MAP = {
275
+ "obtain-evidence": "obtain-evidence",
276
+ "fetch-expected-values": "fetch-expected-values",
277
+ "verify-locally": "verify-locally",
278
+ "warden-verify": "warden-verify",
279
+ "bind-channel": "bind-channel"
280
+ };
281
+ /**
282
+ * `nonce-freshness` belongs to the library's SPKI-pin flow, which Lace never
283
+ * runs (the AKX evidence provider always yields epoch-key evidence) — it has
284
+ * no contract ID, so its events are dropped rather than mislabeled.
285
+ */
286
+ const mapCheckId = (id) => id === "nonce-freshness" ? void 0 : id;
287
+ const mapPhaseEvent = (event) => {
288
+ if (event.status === "check") {
289
+ const id = mapCheckId(event.check.id);
290
+ if (!id) return void 0;
291
+ return {
292
+ type: "check",
293
+ check: {
294
+ id,
295
+ status: event.check.status,
296
+ detail: event.check.detail
297
+ }
298
+ };
299
+ }
300
+ if (event.phase === "prove") return void 0;
301
+ const phase = PHASE_MAP[event.phase];
302
+ switch (event.status) {
303
+ case "started": return {
304
+ type: "phase",
305
+ phase,
306
+ status: "started"
307
+ };
308
+ case "completed": return {
309
+ type: "phase",
310
+ phase,
311
+ status: "completed",
312
+ ...event.detail === void 0 ? {} : { detail: event.detail }
313
+ };
314
+ case "failed": return {
315
+ type: "phase",
316
+ phase,
317
+ status: "failed",
318
+ detail: event.error.message
319
+ };
320
+ }
321
+ };
322
+ const toTemenosAttestationError = (error, fallbackPhase, { LocalCheckFailedError, AttestationVerificationError }) => {
323
+ const mapped = error instanceof LocalCheckFailedError ? new TemenosAttestationError("verify-locally", mapCheckId(error.checkId)) : error instanceof AttestationVerificationError ? new TemenosAttestationError(error.phase === "prove" ? fallbackPhase : PHASE_MAP[error.phase]) : new TemenosAttestationError(fallbackPhase);
324
+ mapped.cause = error;
325
+ return mapped;
326
+ };
327
+ /**
328
+ * `/prove` payloads travel as AEAD records tunneled through the AKX channel.
329
+ * The enclave proxy forwards to `/prove` only, so the session offers nothing
330
+ * else: the public API endpoint is never contacted from this flow.
331
+ */
332
+ const createTunneledSession = (session) => ({
333
+ prove: async (payload) => {
334
+ const response = await session.prove({ body: payload });
335
+ if (response.status !== 200) throw new Error(`Proof server returned ${response.status} through the attested channel`);
336
+ return response.body;
337
+ },
338
+ close: async () => session.close()
339
+ });
340
+ /**
341
+ * {@link createTemenosAttestedProver} with a deployment override that replaces
342
+ * the baked deployment and skips its proof-server URL match. No public entry
343
+ * re-exports it; only tests driving the verifier library's mock fixtures pass
344
+ * the override.
345
+ *
346
+ * @internal
347
+ */
348
+ const createTemenosAttestedProverWith = ({ networkId, proofServerApiUrl, trustRoots, getLedgerIndexerUrl, verifier }, testSeam) => {
349
+ const baked = TEMENOS_ATTESTATION_CONFIGS[networkId];
350
+ const deployment = testSeam?.config ?? (baked?.proofServerApiUrl === proofServerApiUrl ? baked : void 0);
351
+ if (!deployment) throw new Error(`No baked Temenos attestation config on ${networkId} for proof server "${proofServerApiUrl}"`);
352
+ if (!trustRoots?.amdRootCertificates?.length || trustRoots.amdRootCertificates.some((root) => root.trim().length === 0)) throw new require_watch.AttestationError("temenos", "policy", "Temenos requires explicit AMD trust roots");
353
+ const amdRootCertificates = [...trustRoots.amdRootCertificates];
354
+ return {
355
+ id: "temenos",
356
+ operations: ["prove"],
357
+ phases: TEMENOS_ATTESTATION_PHASES,
358
+ establishAttestedSession: async (onEvent, signal) => {
359
+ signal?.throwIfAborted();
360
+ const config = {
361
+ ...deployment,
362
+ amdRootCertificates,
363
+ indexerUrl: await getLedgerIndexerUrl()
364
+ };
365
+ const operationVerifier = verifier.createVerifier(config, signal);
366
+ let currentPhase = "obtain-evidence";
367
+ try {
368
+ return createTunneledSession(await operationVerifier.establishVerifiedSession((event) => {
369
+ if (event.status === "started") signal?.throwIfAborted();
370
+ if (event.status === "started" && event.phase !== "prove") currentPhase = PHASE_MAP[event.phase];
371
+ const mapped = mapPhaseEvent(event);
372
+ if (mapped) onEvent(mapped);
373
+ }));
374
+ } catch (error) {
375
+ throw toTemenosAttestationError(error, currentPhase, verifier);
376
+ }
377
+ }
378
+ };
379
+ };
380
+ /**
381
+ * The real Temenos attestation driver: runs the verifier library's full
382
+ * pipeline — evidence from `GET /enclave-key`, expected values from the
383
+ * on-chain registration via the indexer, the nine local checks against
384
+ * explicitly supplied AMD roots, Warden verification, and the AKX
385
+ * attested-channel handshake — then hands back a session that tunnels
386
+ * through that channel. Trust-root sourcing is separate from this adapter.
387
+ * Only the deployment baked for `networkId` is accepted, and only
388
+ * when `proofServerApiUrl` names its proof server.
389
+ */
390
+ const createTemenosAttestedProver = (props) => createTemenosAttestedProverWith(props);
391
+ //#endregion
392
+ //#region ../../packages/module/midnight-sync/src/sdk.ts
393
+ const createMidnightSyncModule = (options) => require_store.inferModuleContext({
394
+ moduleName: require_sdk.ModuleName("midnight-sync"),
395
+ implements: require_store.combineContracts([
396
+ require_sdk.inMemoryIntegrationAddonContract,
397
+ require_sdk.tokensStoreContract,
398
+ require_sdk.syncStoreContract,
399
+ require_sdk.addressesStoreContract,
400
+ midnightContextStoreContract,
401
+ midnightDependencyContract,
402
+ midnightEngineAddonContract,
403
+ require_sdk.signerFactoryAddonContract
404
+ ]),
405
+ dependsOn: require_store.combineContracts([
406
+ require_sdk.activitiesStoreContract,
407
+ require_sdk.failuresStoreContract,
408
+ require_sdk.featureStoreContract,
409
+ require_sdk.networkStoreContract,
410
+ require_sdk.walletActiveStateDependencyContract,
411
+ require_sdk.walletRepoStoreContract
412
+ ]),
413
+ feature: {
414
+ willLoad: (featureFlags) => featureFlags.some((flag) => flag.key === require_watch.FEATURE_FLAG_MIDNIGHT),
415
+ metadata: {
416
+ name: "MidnightSync",
417
+ description: "Midnight engine, wallet lifecycle and signer"
418
+ }
419
+ },
420
+ store: require_store.inferStoreContext({
421
+ load: async () => {
422
+ const { createSdkStoreInit } = await Promise.resolve().then(() => require("./sdk-init-CYViTJY_.cjs"));
423
+ return { default: createSdkStoreInit(options) };
424
+ },
425
+ context: {
426
+ actions: midnightSyncActions,
427
+ selectors: {}
428
+ }
429
+ }),
430
+ addons: {
431
+ loadSignerFactory: async () => Promise.resolve().then(() => require("./signer-factory-DhZiE03y.cjs")),
432
+ loadMidnightEngine: async () => Promise.resolve().then(() => require("./midnight-engine-xU1wotne.cjs")),
433
+ loadInMemoryWalletIntegration: async () => Promise.resolve().then(() => require("./in-memory-wallet-integration-CULUB5Tf.cjs")).then((module) => ({ default: module.inMemoryWalletIntegrationReactNative }))
434
+ }
435
+ });
436
+ //#endregion
437
+ //#region src/midnight-module.ts
438
+ const publicEndpoints = (networkId) => ({
439
+ nodeAddress: `https://rpc.${networkId}.midnight.network`,
440
+ indexerAddress: `https://indexer.${networkId}.midnight.network/api/v4/graphql`
441
+ });
442
+ /**
443
+ * The public Midnight endpoints the SDK syncs through by default. Every other
444
+ * network needs its endpoints from `networks` before `selectMidnightNetwork`
445
+ * accepts it.
446
+ */
447
+ const MIDNIGHT_PUBLIC_ENDPOINTS = {
448
+ [require_const$1.MidnightSDKNetworkIds.MainNet]: publicEndpoints(require_const$1.MidnightSDKNetworkIds.MainNet),
449
+ [require_const$1.MidnightSDKNetworkIds.PreProd]: publicEndpoints(require_const$1.MidnightSDKNetworkIds.PreProd),
450
+ [require_const$1.MidnightSDKNetworkIds.Preview]: publicEndpoints(require_const$1.MidnightSDKNetworkIds.Preview),
451
+ [require_const$1.MidnightSDKNetworkIds.QaNet]: publicEndpoints(require_const$1.MidnightSDKNetworkIds.QaNet)
452
+ };
453
+ /** The public node of Midnight Preview. */
454
+ const MIDNIGHT_PREVIEW_NODE_URL = MIDNIGHT_PUBLIC_ENDPOINTS[require_const$1.MidnightSDKNetworkIds.Preview].nodeAddress;
455
+ /** The public indexer of Midnight Preview. */
456
+ const MIDNIGHT_PREVIEW_INDEXER_URL = MIDNIGHT_PUBLIC_ENDPOINTS[require_const$1.MidnightSDKNetworkIds.Preview].indexerAddress;
457
+ /** A proof server on the consumer's own machine, the default prover. */
458
+ const MIDNIGHT_LOCAL_PROOF_SERVER_URL = "http://localhost:6300";
459
+ const isPublicNetworkId = (networkId) => networkId in MIDNIGHT_PUBLIC_ENDPOINTS;
460
+ const passwordAuth = (password) => {
461
+ const owned = require_bytes_vo.ByteArray.clone(require_bytes_vo.ByteArray(password));
462
+ return {
463
+ authenticate: () => (0, rxjs.of)(true),
464
+ accessAuthSecret: (callback) => {
465
+ const clone = require_sdk.AuthSecret(require_bytes_vo.ByteArray.clone(owned));
466
+ return callback(clone).pipe((0, rxjs.tap)(() => clone.fill(0)), (0, rxjs.finalize)(() => clone.fill(0)));
467
+ }
468
+ };
469
+ };
470
+ const proofServerMode = (url) => {
471
+ const { hostname } = new URL(url);
472
+ return hostname === "localhost" || hostname === "127.0.0.1" ? {
473
+ kind: "local-host",
474
+ url
475
+ } : {
476
+ kind: "delegated",
477
+ url,
478
+ label: hostname
479
+ };
480
+ };
481
+ const defaultProofServers = (proofServerUrl, networks, createAttestedProver) => Object.fromEntries(require_const$1.MidnightSDKNetworkId.map((networkId) => {
482
+ const mode = networks[networkId]?.proofServer ?? proofServerMode(proofServerUrl);
483
+ require_const$1.assertProofServerRouting(mode, !!createAttestedProver);
484
+ return [networkId, mode];
485
+ }));
486
+ const networkOverrides = (networks) => Object.fromEntries(require_const$1.MidnightSDKNetworkId.map((networkId) => {
487
+ const { proofServer: _, ...endpoints } = networks[networkId] ?? {};
488
+ return [networkId, {
489
+ ...isPublicNetworkId(networkId) && MIDNIGHT_PUBLIC_ENDPOINTS[networkId],
490
+ ...endpoints
491
+ }];
492
+ }));
493
+ /** The networks whose overrides carry both endpoints; the contract defaults are not served. */
494
+ const supportedNetworkIds = (overrides) => require_const$1.MidnightSDKNetworkId.filter((networkId) => overrides[networkId]?.nodeAddress !== void 0 && overrides[networkId]?.indexerAddress !== void 0);
495
+ /**
496
+ * The Midnight engine for `createLaceWallet`: syncs every in-memory Midnight
497
+ * account on the active network, persists its state through the loaded
498
+ * storage module and signs with the password instead of a prompt. Loads
499
+ * behind `FEATURE_FLAG_MIDNIGHT`. The password is copied here, but the
500
+ * caller's buffer must stay intact until its last entity helper call that
501
+ * takes the same bytes.
502
+ *
503
+ * The `config` of `createLaceWallet` must then set
504
+ * `defaultMidnightTestnetNetworkId`, the testnet a wallet starts on, as
505
+ * Cardano needs `defaultTestnetChainId`; without a testnet there,
506
+ * `createLaceWallet` rejects.
507
+ */
508
+ const createMidnightModule = ({ password, proofServerUrl = MIDNIGHT_LOCAL_PROOF_SERVER_URL, networks = {}, batchUpdates, createAttestedProver }) => {
509
+ const overrides = networkOverrides(networks);
510
+ return createMidnightSyncModule({
511
+ auth: passwordAuth(password),
512
+ networks: overrides,
513
+ supportedNetworkIds: supportedNetworkIds(overrides),
514
+ defaultProofServers: defaultProofServers(proofServerUrl, networks, createAttestedProver),
515
+ batchUpdates,
516
+ createAttestedProver
517
+ });
518
+ };
519
+ //#endregion
520
+ //#region src/midnight-passkey-wallet-entity.ts
521
+ /**
522
+ * Derives the Midnight accounts of the passkey's words inside one assertion.
523
+ * Unlike the Cardano passkey entity, the result is an `InMemory` wallet: the
524
+ * Midnight engine needs the account keys while it syncs, so each account
525
+ * holds its keys sealed under `password`. The entity holds no recovery
526
+ * phrase and no seed, and no account of another blockchain.
527
+ */
528
+ const createMidnightPasskeyWalletEntity = async (wallet, { keySource, password, walletName, accounts = [] }) => keySource.withPasskeyMnemonic(async (words) => {
529
+ let entity = await require_sdk.createBlockchainWalletEntity(wallet, "Midnight", {
530
+ mnemonicWords: [...words],
531
+ password,
532
+ walletName
533
+ });
534
+ if (entity.accounts.length === 0) throw new Error("No Midnight account derived: load createMidnightModule behind FEATURE_FLAG_MIDNIGHT");
535
+ for (const account of accounts) entity = await createMidnightAccounts(wallet, {
536
+ ...account,
537
+ wallet: entity,
538
+ password
539
+ });
540
+ return withoutSeedMaterial(entity);
541
+ });
542
+ const withoutSeedMaterial = ({ encryptedRecoveryPhrase: _phrase, blockchainSpecific: { Midnight: _seed, ...blockchainSpecific }, ...entity }) => ({
543
+ ...entity,
544
+ blockchainSpecific
545
+ });
546
+ //#endregion
547
+ //#region src/midnight-errors.ts
548
+ /** The loadout has no endpoints for the network: none public, none from `networks`. */
549
+ var MidnightNetworkNotConfiguredError = class extends Error {
550
+ code = "midnight-network-not-configured";
551
+ constructor(networkId) {
552
+ super(`Midnight network "${networkId}" has no endpoints in this loadout: pass networks.${networkId} with nodeAddress and indexerAddress to createMidnightModule`);
553
+ this.name = "MidnightNetworkNotConfiguredError";
554
+ }
555
+ };
556
+ /** No single in-memory Midnight account on the active network answers the request. */
557
+ var MidnightAccountNotFoundError = class extends Error {
558
+ code = "midnight-account-not-found";
559
+ constructor(message) {
560
+ super(message);
561
+ this.name = "MidnightAccountNotFoundError";
562
+ }
563
+ };
564
+ /** The engine did not start the account's wallets within the wait. */
565
+ var MidnightWalletNotReadyError = class extends Error {
566
+ code = "midnight-wallet-not-ready";
567
+ constructor(accountId, timeoutMs) {
568
+ super(`Midnight wallet for account "${accountId}" did not start within ${timeoutMs}ms`);
569
+ this.name = "MidnightWalletNotReadyError";
570
+ }
571
+ };
572
+ /** The account holds no available NIGHT to register for DUST generation. */
573
+ var MidnightNothingToRegisterError = class extends Error {
574
+ code = "midnight-nothing-to-register";
575
+ constructor(accountId) {
576
+ super(`Account "${accountId}" has no available NIGHT to register`);
577
+ this.name = "MidnightNothingToRegisterError";
578
+ }
579
+ };
580
+ /**
581
+ * `submitMidnightTx` stopped waiting for the node to report the transaction final. The engine had already been
582
+ * given the transaction, so it may be on chain or reach it later: look for `activityHash` in the account's
583
+ * activities before submitting again.
584
+ */
585
+ var MidnightSubmitTimeoutError = class extends Error {
586
+ code = "midnight-submit-timeout";
587
+ /** The transaction's hash, which is the `activityId` of its activity. */
588
+ activityHash;
589
+ constructor(activityHash, timeoutMs) {
590
+ super(`Midnight transaction ${activityHash} was not reported final within ${timeoutMs}ms and may still reach the chain`);
591
+ this.name = "MidnightSubmitTimeoutError";
592
+ this.activityHash = activityHash;
593
+ }
594
+ };
595
+ //#endregion
596
+ //#region src/select-midnight-network.ts
597
+ /**
598
+ * Makes `networkId` the active Midnight network. A testnet also becomes the
599
+ * selected testnet, so the wallet's testnet toggle returns to it. Throws
600
+ * `MidnightNetworkNotConfiguredError` for a network the loadout has no
601
+ * endpoints for: one outside `MIDNIGHT_PUBLIC_ENDPOINTS` whose `networks`
602
+ * override lacks `nodeAddress` or `indexerAddress`.
603
+ */
604
+ const selectMidnightNetwork = (wallet, networkId) => {
605
+ if (!(wallet.getState().midnightContext?.supportedNetworksIds ?? []).includes(networkId)) throw new MidnightNetworkNotConfiguredError(networkId);
606
+ if (networkId === require_const$1.MidnightSDKNetworkIds.MainNet) {
607
+ wallet.dispatch("network.setNetworkType", "mainnet");
608
+ return;
609
+ }
610
+ wallet.dispatch("network.setBlockchainNetworks", {
611
+ blockchain: "Midnight",
612
+ mainnet: require_const$1.MidnightNetworkId(require_const$1.MidnightSDKNetworkIds.MainNet),
613
+ testnet: require_const$1.MidnightNetworkId(networkId)
614
+ });
615
+ wallet.dispatch("network.setNetworkType", "testnet");
616
+ };
617
+ //#endregion
618
+ //#region src/midnight-timeouts.ts
619
+ /** The longest delay a timer honours; a longer one, or `Infinity`, fires at once. */
620
+ const MAX_TIMEOUT_MS = 2 ** 31 - 1;
621
+ /**
622
+ * Applies a timeout option's default and refuses a value no timer can honour:
623
+ * not a finite positive number of milliseconds, or above `MAX_TIMEOUT_MS`.
624
+ */
625
+ const resolveTimeoutMs = (name, value, fallback) => {
626
+ const resolved = value ?? fallback;
627
+ if (typeof resolved !== "number" || !Number.isFinite(resolved) || resolved <= 0 || resolved > MAX_TIMEOUT_MS) throw new RangeError(`${name} must be a positive number of milliseconds up to ${MAX_TIMEOUT_MS}; got ${String(resolved)}`);
628
+ return resolved;
629
+ };
630
+ //#endregion
631
+ //#region src/midnight-wallet.ts
632
+ const DEFAULT_START_TIMEOUT_MS = 12e4;
633
+ const resolveMidnightAccountId = async ({ stateObservables }, requestedAccountId) => {
634
+ const wallets = await (0, rxjs.firstValueFrom)(stateObservables.wallets.selectAll$);
635
+ const activeNetworkIds = await (0, rxjs.firstValueFrom)(stateObservables.network.selectAllActiveNetworkIds$);
636
+ const accounts = wallets.flatMap((wallet) => wallet.accounts).filter(require_utils.isInMemoryMidnightAccount).filter((account) => activeNetworkIds.includes(account.blockchainNetworkId));
637
+ if (requestedAccountId) {
638
+ const found = accounts.find((account) => account.accountId === requestedAccountId);
639
+ if (!found) throw new MidnightAccountNotFoundError(`Midnight account "${requestedAccountId}" not found on the active network`);
640
+ return found.accountId;
641
+ }
642
+ if (accounts.length === 0) throw new MidnightAccountNotFoundError("No Midnight accounts found on the active network");
643
+ if (accounts.length > 1) throw new MidnightAccountNotFoundError(`Multiple Midnight accounts found (${accounts.length}) — specify accountId to disambiguate`);
644
+ return accounts[0].accountId;
645
+ };
646
+ /**
647
+ * The engine's wallet for the account, emitted once the engine starts it and
648
+ * again whenever the engine replaces it (a sync reset or a restart). Emits
649
+ * `undefined` while the engine has stopped the account's wallet and not yet
650
+ * replaced it. Resolves the account on subscription and errors with
651
+ * `MidnightAccountNotFoundError`, or with `MidnightWalletNotReadyError` when
652
+ * no wallet arrives within `startTimeout`, at first or after a stop, so a
653
+ * subscriber that was already watching fails the same way a new one would.
654
+ */
655
+ const observeMidnightWallet = (wallet, { accountId, startTimeout: requestedStartTimeout }) => (0, rxjs.defer)(async () => {
656
+ const startTimeout = resolveTimeoutMs("startTimeout", requestedStartTimeout, DEFAULT_START_TIMEOUT_MS);
657
+ const resolvedAccountId = await resolveMidnightAccountId(wallet, accountId);
658
+ const [registry$] = await wallet._loadModules("addons.loadMidnightEngine");
659
+ if (!registry$) throw new MidnightWalletNotReadyError(resolvedAccountId, startTimeout);
660
+ return {
661
+ resolvedAccountId,
662
+ registry$,
663
+ startTimeout
664
+ };
665
+ }).pipe((0, rxjs.switchMap)(({ resolvedAccountId, registry$, startTimeout }) => {
666
+ const notReady = () => (0, rxjs.throwError)(() => new MidnightWalletNotReadyError(resolvedAccountId, startTimeout));
667
+ return registry$.pipe((0, rxjs.map)((wallets) => wallets[resolvedAccountId]), (0, rxjs.distinctUntilChanged)(), (0, rxjs.skipWhile)((candidate) => !candidate), (0, rxjs.timeout)({
668
+ first: startTimeout,
669
+ with: notReady
670
+ }), (0, rxjs.switchMap)((candidate) => candidate ? (0, rxjs.of)(candidate) : (0, rxjs.concat)((0, rxjs.of)(void 0), (0, rxjs.timer)(startTimeout).pipe((0, rxjs.switchMap)(notReady)))));
671
+ }));
672
+ /** The engine's wallet for the account, once the engine has started it. */
673
+ const midnightWalletFor = async (wallet, props) => (0, rxjs.firstValueFrom)(observeMidnightWallet(wallet, props).pipe((0, rxjs.filter)((candidate) => !!candidate)));
674
+ const toError = (error) => error instanceof Error ? error : new Error(String(error));
675
+ /** Runs one engine operation for the account and settles it as a `Result`. */
676
+ const withMidnightWallet = async (wallet, props, operation) => {
677
+ try {
678
+ return require_asyncoption.Ok(await (0, rxjs.firstValueFrom)(operation(await midnightWalletFor(wallet, props))));
679
+ } catch (error) {
680
+ return require_asyncoption.Err(toError(error));
681
+ }
682
+ };
683
+ //#endregion
684
+ //#region src/observe-midnight-balances.ts
685
+ const sumNight = (coins) => coins.filter(({ utxo }) => utxo.type === require_const$1.NIGHT_TOKEN_ID).reduce((sum, { utxo }) => sum + utxo.value, 0n);
686
+ const sameBalances = (a, b) => a.address.unshielded === b.address.unshielded && a.night.available === b.night.available && a.night.pending === b.night.pending && a.dust.balance === b.dust.balance && a.dust.available === b.dust.available && a.synced.unshielded === b.synced.unshielded && a.synced.shielded === b.synced.shielded && a.synced.dust === b.synced.dust;
687
+ const NOT_SYNCED = {
688
+ unshielded: false,
689
+ shielded: false,
690
+ dust: false
691
+ };
692
+ const balancesOf = (midnightWallet) => (0, rxjs.combineLatest)([
693
+ midnightWallet.state(),
694
+ midnightWallet.syncProgress$,
695
+ midnightWallet.address$
696
+ ]).pipe((0, rxjs.map)(([state, progress, address]) => ({
697
+ accountId: midnightWallet.accountId,
698
+ address,
699
+ night: {
700
+ available: sumNight(state.unshielded.availableCoins),
701
+ pending: sumNight(state.unshielded.pendingCoins)
702
+ },
703
+ dust: require_watch.midnightDustBalances(state),
704
+ synced: progress.isStrictlyComplete
705
+ })));
706
+ /**
707
+ * The account's NIGHT and DUST, straight from the engine, from the moment
708
+ * it starts the account's wallets. Balances are complete once `synced`
709
+ * reports the sub-wallet caught up; a transfer needs unshielded and dust.
710
+ * NIGHT is summed from the engine's state, not from the store's token
711
+ * balances; DUST is summed as the store sums it.
712
+ *
713
+ * Follows the engine across a sync reset or restart. While the engine has
714
+ * stopped the account's wallets and not yet replaced them, it repeats the
715
+ * last balances with every `synced` flag false; once the new wallets start,
716
+ * it emits theirs.
717
+ *
718
+ * Cold: the account is resolved on subscription. Errors the subscriber with
719
+ * `MidnightAccountNotFoundError`, or with `MidnightWalletNotReadyError` when
720
+ * no wallets run for `startTimeout`, at first or after a stop.
721
+ */
722
+ const observeMidnightBalances = (wallet, props = {}) => observeMidnightWallet(wallet, props).pipe((0, rxjs.switchMap)((midnightWallet) => midnightWallet ? balancesOf(midnightWallet) : (0, rxjs.of)(void 0)), (0, rxjs.scan)((last, next) => next ?? (last && {
723
+ ...last,
724
+ synced: NOT_SYNCED
725
+ }), void 0), (0, rxjs.filter)((balances) => !!balances), (0, rxjs.distinctUntilChanged)(sameBalances));
726
+ //#endregion
727
+ //#region src/balance-midnight-recipe.ts
728
+ const messageOf = (error) => error instanceof Error ? error.message : String(error);
729
+ /**
730
+ * Releases a recipe the engine built, then rethrows the error that made it
731
+ * useless. The engine reserves a recipe's inputs when it builds it and the
732
+ * caller never receives this recipe, so nothing else could release them. If
733
+ * the release fails too, the error is an `AggregateError` of both failures and
734
+ * the coins stay reserved until a sync reset.
735
+ */
736
+ const releaseThenThrow = (midnightWallet, recipe, error) => (0, rxjs.concat)(midnightWallet.revert(recipe).pipe((0, rxjs.ignoreElements)(), (0, rxjs.catchError)((releaseError) => (0, rxjs.throwError)(() => new AggregateError([error, releaseError], `${messageOf(error)}; the coins it reserved could not be released: ${messageOf(releaseError)}`)))), (0, rxjs.throwError)(() => error));
737
+ /**
738
+ * Pays a built recipe's fee with DUST. The engine books the recipe's inputs
739
+ * when it builds it, so a failure here releases them before the error is
740
+ * returned: the caller has no recipe to discard.
741
+ */
742
+ const balanceMidnightRecipe = (midnightWallet, recipe, ttl) => midnightWallet.balanceUnprovenTransaction(recipe.transaction, {
743
+ ttl,
744
+ tokenKindsToBalance: ["dust"]
745
+ }).pipe((0, rxjs.catchError)((balancingError) => releaseThenThrow(midnightWallet, recipe, balancingError)));
746
+ //#endregion
747
+ //#region src/build-midnight-transfer.ts
748
+ /**
749
+ * Builds an unshielded NIGHT transfer, selecting the inputs and the DUST
750
+ * that pays its fee. The recipe is unsigned and unproven, and reserves its
751
+ * inputs (see `MidnightTxRecipe`): obtain consent from `estimateMidnightFee`,
752
+ * which reserves nothing, before building. When the fee cannot be paid, the
753
+ * inputs the build reserved are released and the balancing error is returned;
754
+ * if that release fails too, the error is an `AggregateError` of both failures
755
+ * and the NIGHT stays reserved until a sync reset.
756
+ */
757
+ const buildMidnightTransfer = async (wallet, { to, amount, ttl, ...account }) => withMidnightWallet(wallet, account, (midnightWallet) => (0, rxjs.defer)(() => {
758
+ normalizeMidnightTransfers(midnightWallet.networkId, "unshielded", [{
759
+ to,
760
+ amount,
761
+ tokenId: require_utils.toUnshieldedTokenType(require_const$1.NIGHT_TOKEN_ID, midnightWallet.networkId)
762
+ }]);
763
+ const resolvedTtl = ttl ?? new Date(Date.now() + 36e5);
764
+ return midnightWallet.transferTransaction([{
765
+ type: "unshielded",
766
+ outputs: [{
767
+ type: require_const$1.NIGHT_TOKEN_ID,
768
+ receiverAddress: require_dist.UnshieldedAddress.codec.decode(midnightWallet.networkId, require_dist.MidnightBech32m.parse(to)),
769
+ amount
770
+ }]
771
+ }], {
772
+ ttl: resolvedTtl,
773
+ payFees: false
774
+ }).pipe((0, rxjs.switchMap)((recipe) => balanceMidnightRecipe(midnightWallet, recipe, resolvedTtl)));
775
+ }));
776
+ //#endregion
777
+ //#region src/build-midnight-transfers.ts
778
+ /**
779
+ * Builds an unsigned, unproven batch. The engine selects tokens and fee DUST
780
+ * and reserves them (see `MidnightTxRecipe`): obtain consent from
781
+ * `estimateMidnightFee`, which reserves nothing, before building. When the
782
+ * fee cannot be paid, the inputs the build reserved are released and the
783
+ * balancing error is returned; if that release fails too, the error is an
784
+ * `AggregateError` of both failures and the coins stay reserved until a sync
785
+ * reset.
786
+ */
787
+ const buildMidnightTransfers = async (wallet, { kind, outputs, ttl, ...account }) => withMidnightWallet(wallet, account, (engine) => (0, rxjs.defer)(() => {
788
+ const transfers = normalizeMidnightTransfers(engine.networkId, kind, outputs);
789
+ const desiredOutputs = kind === "shielded" ? {
790
+ type: "shielded",
791
+ outputs: transfers.map(({ address, tokenId, amount }) => ({
792
+ type: tokenId,
793
+ amount,
794
+ receiverAddress: require_dist.ShieldedAddress.codec.decode(engine.networkId, require_dist.MidnightBech32m.parse(address))
795
+ }))
796
+ } : {
797
+ type: "unshielded",
798
+ outputs: transfers.map(({ address, tokenId, amount }) => ({
799
+ type: tokenId,
800
+ amount,
801
+ receiverAddress: require_dist.UnshieldedAddress.codec.decode(engine.networkId, require_dist.MidnightBech32m.parse(address))
802
+ }))
803
+ };
804
+ const resolvedTtl = ttl ?? new Date(Date.now() + 36e5);
805
+ return engine.transferTransaction([desiredOutputs], {
806
+ ttl: resolvedTtl,
807
+ payFees: false
808
+ }).pipe((0, rxjs.switchMap)((recipe) => balanceMidnightRecipe(engine, recipe, resolvedTtl)));
809
+ }));
810
+ //#endregion
811
+ //#region src/register-midnight-dust.ts
812
+ /**
813
+ * Whether the account already takes part in DUST generation: registered
814
+ * NIGHT, generated DUST, or generation capacity (the contract's
815
+ * `getDesignationTargetType` plus capacity). The engine does not report where
816
+ * registered NIGHT generates, so this covers a designation to the account's
817
+ * own address and to an external one alike.
818
+ */
819
+ const isDesignatedForDust = (state, nightCoins) => getDesignationTargetType(nightCoins.map(({ utxo, meta }) => ({
820
+ status: "available",
821
+ value: require_bignum_vo.BigNumber(utxo.value),
822
+ registeredForDustGeneration: meta.registeredForDustGeneration
823
+ })), state.dust.totalCoins.reduce((sum, coin) => sum + coin.generatedNow, 0n)) !== "none" || state.dust.totalCoins.some((coin) => coin.maxCap > 0n);
824
+ /** Internal unsigned selection shared with fee estimation. */
825
+ const prepareMidnightDustRegistration = (midnightWallet, { dustAddress: destination, ttl }) => (0, rxjs.combineLatest)([midnightWallet.state().pipe((0, rxjs.take)(1)), midnightWallet.address$.pipe((0, rxjs.take)(1))]).pipe((0, rxjs.map)(([state, address]) => {
826
+ if (ttl !== void 0) throw new Error("A DUST registration does not accept ttl: the engine sets its validity window");
827
+ const nightCoins = state.unshielded.availableCoins.filter(({ utxo }) => utxo.type === require_const$1.NIGHT_TOKEN_ID);
828
+ if (nightCoins.length === 0 || nightCoins.every(({ utxo }) => utxo.value <= 0n)) throw new MidnightNothingToRegisterError(midnightWallet.accountId);
829
+ const dustAddress = require_dist.DustAddress.codec.decode(midnightWallet.networkId, require_dist.MidnightBech32m.parse(destination ?? address.dust));
830
+ if (destination !== void 0 && isDesignatedForDust(state, nightCoins)) throw new Error("DUST destination cannot be changed while the account is designated for DUST generation");
831
+ return {
832
+ state,
833
+ nightCoins,
834
+ dustAddress,
835
+ destination: destination ?? address.dust,
836
+ isRepeatRegistration: nightCoins.some((coin) => coin.meta.registeredForDustGeneration)
837
+ };
838
+ }));
839
+ /**
840
+ * Registers every available NIGHT UTXO. Obtain consumer consent before
841
+ * calling: registration signs internally.
842
+ *
843
+ * - An explicit `dustAddress` is refused while the account is designated for
844
+ * DUST generation (registered NIGHT, generated DUST or generation capacity),
845
+ * so it never redirects an existing designation.
846
+ * - Without `dustAddress` the NIGHT is registered to the account's own DUST
847
+ * address, whatever it is registered to now. NIGHT registered to an external
848
+ * address is therefore re-registered to the account's own address. When some
849
+ * NIGHT is already registered, the registration is balanced with DUST.
850
+ *
851
+ * The returned recipe reserves the NIGHT it registers (see `MidnightTxRecipe`).
852
+ * When the registration cannot be built, the NIGHT it reserved is released
853
+ * and the build error is returned; if that release fails too, the error is an
854
+ * `AggregateError` of both failures, and the NIGHT stays reserved until a
855
+ * sync reset. The wallet library does not release it when the fee query of a
856
+ * first registration fails; it then also stays reserved until a sync reset.
857
+ */
858
+ const registerMidnightDust = async (wallet, { ttl, dustAddress: destination, ...account } = {}) => withMidnightWallet(wallet, account, (midnightWallet) => prepareMidnightDustRegistration(midnightWallet, {
859
+ dustAddress: destination,
860
+ ttl
861
+ }).pipe((0, rxjs.switchMap)(({ nightCoins, dustAddress, isRepeatRegistration }) => {
862
+ const registration$ = midnightWallet.registerNightUtxosForDustGeneration(nightCoins, dustAddress);
863
+ if (!isRepeatRegistration) return registration$;
864
+ return registration$.pipe((0, rxjs.switchMap)((registration) => balanceMidnightRecipe(midnightWallet, registration, new Date(Date.now() + require_const$1.defaultTxTtlLength))));
865
+ })));
866
+ //#endregion
867
+ //#region src/estimate-midnight-fee.ts
868
+ /**
869
+ * Estimates DUST from unsigned preparation, without registering or signing.
870
+ * A first registration with no spendable DUST estimates zero; a repeat
871
+ * registration is estimated like the DUST balancing it performs.
872
+ * Estimates depend on current state/time and are not guaranteed final charges.
873
+ * Insufficient spendable DUST returns an error.
874
+ */
875
+ const estimateMidnightFee = async (wallet, request) => {
876
+ return withMidnightWallet(wallet, request.kind === "transfer" ? request.transfer : request.registration, (engine) => (0, rxjs.defer)(() => {
877
+ return (0, rxjs.combineLatest)([request.kind === "transfer" ? engine.state().pipe((0, rxjs.take)(1), (0, rxjs.map)((state) => {
878
+ const { kind, outputs, ttl } = request.transfer;
879
+ const transfers = normalizeMidnightTransfers(engine.networkId, kind, outputs);
880
+ return {
881
+ state,
882
+ tx: (kind === "shielded" ? constructShieldedTransaction : constructUnshieldedTransaction)({
883
+ networkId: engine.networkId,
884
+ transfers,
885
+ ttl
886
+ }),
887
+ isFirstDesignation: false
888
+ };
889
+ })) : prepareMidnightDustRegistration(engine, request.registration).pipe((0, rxjs.map)(({ state, nightCoins, destination, isRepeatRegistration }) => ({
890
+ state,
891
+ tx: constructDustDesignationTransaction({
892
+ networkId: engine.networkId,
893
+ address: destination,
894
+ nightUtxos: nightCoins,
895
+ nightVerifyingKey: engine.nightVerifyingKey,
896
+ allowFeePayment: isRepeatRegistration ? 0n : void 0
897
+ }),
898
+ isFirstDesignation: !isRepeatRegistration
899
+ }))), engine.areKeysAvailable$.pipe((0, rxjs.take)(1))]).pipe((0, rxjs.switchMap)(([{ state, tx, isFirstDesignation }, areKeysAvailable]) => {
900
+ const availableDust = state.dust.balance(/* @__PURE__ */ new Date());
901
+ return estimatePreparedMidnightFee(engine, tx, {
902
+ isDustDesignation: isFirstDesignation,
903
+ dustBalance: availableDust,
904
+ areKeysAvailable
905
+ }).pipe((0, rxjs.map)((dustFee) => {
906
+ if (dustFee > availableDust) throw new Error("Insufficient spendable DUST");
907
+ return {
908
+ dustFee,
909
+ availableDust
910
+ };
911
+ }));
912
+ }));
913
+ }));
914
+ };
915
+ //#endregion
916
+ //#region ../../packages/lib/vendor/src/midnight-sign-data.ts
917
+ require__polyfill_buffer_patch.init__polyfill_buffer_patch();
918
+ /** Decode the connector transport form, preserving Buffer's permissive hex/base64 handling. */
919
+ const decodeMidnightSignData = (data, encoding) => {
920
+ switch (encoding) {
921
+ case "hex": return new Uint8Array(require__polyfill_buffer_patch.import_buffer.Buffer.from(data, "hex"));
922
+ case "base64": return new Uint8Array(require__polyfill_buffer_patch.import_buffer.Buffer.from(data, "base64"));
923
+ case "text": return new TextEncoder().encode(data);
924
+ default: throw new Error(`Unsupported encoding: ${String(encoding)}`);
925
+ }
926
+ };
927
+ const SIGNED_MESSAGE_PREFIX = "midnight_signed_message:";
928
+ /**
929
+ * Prefixes decoded payload bytes with UTF-8 `midnight_signed_message:<byteLength>:`.
930
+ * The length excludes the prefix; sign and verify these bytes, not the transport encoding.
931
+ */
932
+ const applyMidnightSignedMessagePrefix = (data) => {
933
+ const header = new TextEncoder().encode(`${SIGNED_MESSAGE_PREFIX}${data.length}:`);
934
+ const prefixed = new Uint8Array(header.length + data.length);
935
+ prefixed.set(header, 0);
936
+ prefixed.set(data, header.length);
937
+ return prefixed;
938
+ };
939
+ //#endregion
940
+ //#region src/sign-midnight-data.ts
941
+ /**
942
+ * Signs a connector-compatible message with the selected account's unshielded
943
+ * NIGHT key. Obtain consumer consent for this payload and account before calling;
944
+ * this helper shows no prompt and the module's password unlocks the key.
945
+ *
946
+ * Decodes hex/base64 with Buffer (including permissive malformed input), or text
947
+ * as UTF-8, then prefixes `midnight_signed_message:<byteLength>:`. Empty payloads
948
+ * still receive the prefix. Only the `unshielded` key type is supported.
949
+ * Returns the original payload, signature and verifying key. Account resolution,
950
+ * unsupported options and signing failures settle as `Err<Error>`.
951
+ */
952
+ const signMidnightData = async (wallet, { data, options, ...account }) => withMidnightWallet(wallet, account, (midnightWallet) => (0, rxjs.defer)(() => {
953
+ if (options.keyType !== "unshielded") throw new Error(`Unsupported key type: ${String(options.keyType)}`);
954
+ const bytes = applyMidnightSignedMessagePrefix(decodeMidnightSignData(data, options.encoding));
955
+ return midnightWallet.signData(bytes).pipe((0, rxjs.map)(({ signature, verifyingKey }) => ({
956
+ data,
957
+ signature,
958
+ verifyingKey
959
+ })));
960
+ }));
961
+ //#endregion
962
+ //#region src/discard-midnight-tx.ts
963
+ /**
964
+ * Releases the coins a built recipe holds, so they return to the account's
965
+ * available balance and a later build can select them.
966
+ *
967
+ * Discard only a recipe that never reached proving: consent declined,
968
+ * `signMidnightTx` failed, or `proveMidnightTx` returned
969
+ * `MidnightAccountNotFoundError`, `MidnightWalletNotReadyError` or a
970
+ * `RangeError` for its `proveTimeout`, which are raised before proving. Do
971
+ * not discard after any other `proveMidnightTx`
972
+ * error, including a timeout, nor after it returned a transaction: the engine
973
+ * releases a recipe whose proving fails, and releases a proved transaction
974
+ * that never reaches the chain once its validity window (`ttl`) has passed.
975
+ * Pass the `accountId` the recipe was built with: under another account the
976
+ * release finds no reserved coins and still reports `Ok`. The release works
977
+ * per coin, not per transaction, so discarding a recipe the engine has
978
+ * already released, or one built before a sync reset cleared its
979
+ * reservation, can free coins that a later build reserved
980
+ * for a transaction still in flight. For the same reason, never discard a
981
+ * recipe whose transaction was passed to `submitMidnightTx`.
982
+ */
983
+ const discardMidnightTx = async (wallet, { recipe, ...account }) => withMidnightWallet(wallet, account, (midnightWallet) => (0, rxjs.defer)(() => midnightWallet.revert(recipe)));
984
+ //#endregion
985
+ //#region src/sign-midnight-tx.ts
986
+ /**
987
+ * Signs the recipe's unshielded inputs with the account's NIGHT key. The
988
+ * module's password unlocks the key; no prompt is shown. Obtain consumer consent
989
+ * for the exact transaction and account before invoking this helper.
990
+ */
991
+ const signMidnightTx = async (wallet, { recipe, ...account }) => withMidnightWallet(wallet, account, (midnightWallet) => (0, rxjs.defer)(() => midnightWallet.signRecipe(recipe)));
992
+ //#endregion
993
+ //#region src/prove-midnight-tx.ts
994
+ /** How long every proving helper waits for the proof server unless told otherwise. */
995
+ const DEFAULT_PROVE_TIMEOUT_MS = 10 * 6e4;
996
+ /** Applies the default `proveTimeout` and refuses a value no timer can honour. */
997
+ const resolveProveTimeout = (proveTimeout) => resolveTimeoutMs("proveTimeout", proveTimeout, DEFAULT_PROVE_TIMEOUT_MS);
998
+ /**
999
+ * Proves the recipe through the proof server the module was configured
1000
+ * with. Timeout stops observation; it does not cancel underlying proving.
1001
+ */
1002
+ const proveMidnightTx = async (wallet, { recipe, onProgress, proveTimeout, ...account }) => withMidnightWallet(wallet, account, (midnightWallet) => {
1003
+ const limit = resolveProveTimeout(proveTimeout);
1004
+ let observer = onProgress;
1005
+ return (0, rxjs.defer)(() => onProgress ? midnightWallet.finalizeRecipe(recipe, (event) => observer?.(event)) : midnightWallet.finalizeRecipe(recipe)).pipe((0, rxjs.timeout)(limit), (0, rxjs.finalize)(() => {
1006
+ observer = void 0;
1007
+ }));
1008
+ });
1009
+ //#endregion
1010
+ //#region ../../packages/module/dapp-connector-midnight/src/store/helpers/derive-pending-activity-from-midnight-tx.ts
1011
+ const utxoKey = (intentHash, outputNo) => `${intentHash}#${outputNo}`;
1012
+ const processOffer = (offer, ownUtxoIndex, ownUserAddressHex) => {
1013
+ if (!offer) return {
1014
+ nightDelta: 0n,
1015
+ isInvolved: false
1016
+ };
1017
+ let nightDelta = 0n;
1018
+ let isInvolved = false;
1019
+ for (const input of offer.inputs) {
1020
+ const own = ownUtxoIndex.get(utxoKey(input.intentHash, input.outputNo));
1021
+ if (!own) continue;
1022
+ isInvolved = true;
1023
+ if (own.utxo.type === "0000000000000000000000000000000000000000000000000000000000000000") nightDelta -= own.utxo.value;
1024
+ }
1025
+ for (const output of offer.outputs) {
1026
+ if (output.owner !== ownUserAddressHex) continue;
1027
+ isInvolved = true;
1028
+ if (output.type === "0000000000000000000000000000000000000000000000000000000000000000") nightDelta += output.value;
1029
+ }
1030
+ return {
1031
+ nightDelta,
1032
+ isInvolved
1033
+ };
1034
+ };
1035
+ const buildOwnUtxoIndex = (nightUtxos) => {
1036
+ const index = /* @__PURE__ */ new Map();
1037
+ for (const entry of nightUtxos) index.set(utxoKey(entry.utxo.intentHash, entry.utxo.outputNo), entry);
1038
+ return index;
1039
+ };
1040
+ const derivePendingActivityFromMidnightTx = ({ deserializedTx, accountId, ownUserAddressHex, nightUtxos, networkId }) => {
1041
+ const ownUtxoIndex = buildOwnUtxoIndex(nightUtxos);
1042
+ let nightAmount = 0n;
1043
+ let isAccountInvolved = false;
1044
+ for (const intent of deserializedTx.intents?.values() ?? []) for (const offer of [intent.guaranteedUnshieldedOffer, intent.fallibleUnshieldedOffer]) {
1045
+ const { nightDelta, isInvolved } = processOffer(offer, ownUtxoIndex, ownUserAddressHex);
1046
+ nightAmount += nightDelta;
1047
+ isAccountInvolved = isAccountInvolved || isInvolved;
1048
+ }
1049
+ if (!isAccountInvolved) return void 0;
1050
+ const tokenBalanceChanges = nightAmount === 0n ? [] : [{
1051
+ tokenId: require_token_id_vo.TokenId(require_utils.toUnshieldedTokenType(require_const$1.NIGHT_TOKEN_ID, networkId)),
1052
+ amount: require_bignum_vo.BigNumber(nightAmount)
1053
+ }];
1054
+ return {
1055
+ accountId,
1056
+ activityId: deserializedTx.transactionHash(),
1057
+ timestamp: require_time_vo.Timestamp(Date.now()),
1058
+ tokenBalanceChanges,
1059
+ type: require_activity_type.ActivityType.Pending
1060
+ };
1061
+ };
1062
+ //#endregion
1063
+ //#region src/submit-midnight-tx.ts
1064
+ const DEFAULT_SUBMIT_TIMEOUT_MS = 5 * 6e4;
1065
+ const PENDING_ROW_STATE_TIMEOUT_MS = 1e4;
1066
+ /** Records the Pending activity unless the account already has a confirmed row for the transaction. */
1067
+ const recordPendingActivity = ({ dispatch, activities, midnightWallet, transaction, utxos }) => {
1068
+ try {
1069
+ const activity = derivePendingActivityFromMidnightTx({
1070
+ deserializedTx: transaction,
1071
+ accountId: midnightWallet.accountId,
1072
+ ownUserAddressHex: (0, _midnight_ntwrk_ledger_v8.addressFromKey)(midnightWallet.nightVerifyingKey),
1073
+ nightUtxos: utxos,
1074
+ networkId: midnightWallet.networkId
1075
+ });
1076
+ if (!activity) return void 0;
1077
+ const current = activities[activity.accountId]?.find((row) => row.activityId === activity.activityId);
1078
+ if (current && current.type !== require_activity_type.ActivityType.Pending) return void 0;
1079
+ dispatch("activities.upsertActivities", {
1080
+ accountId: activity.accountId,
1081
+ activities: [activity]
1082
+ });
1083
+ return activity;
1084
+ } catch {
1085
+ return;
1086
+ }
1087
+ };
1088
+ /**
1089
+ * Submits a proved transaction after consumer authorization and resolves once the node reports it final: the
1090
+ * engine submits at its `Finalized` stage, so `Ok` means the transaction is on chain. `txId` is the engine's
1091
+ * identifier, which is not the activity hash; the activity hash is `transaction.transactionHash()`.
1092
+ *
1093
+ * On an instance that tracks activities, the transaction's Pending activity, keyed by the activity hash, is
1094
+ * recorded when the submission is handed to the engine, before finality; the history sync then replaces it with
1095
+ * the confirmed row. The engine reports no acceptance before finality, so the row is written as soon as the call
1096
+ * is issued. When the engine fails the submission it releases the transaction's coins and the Pending row is
1097
+ * removed; if the transaction reaches the chain anyway, the history sync records it. Tracking failures never fail
1098
+ * a submission.
1099
+ *
1100
+ * An `Err` does not prove that nothing was broadcast. {@link MidnightSubmitTimeoutError} (`code`
1101
+ * `midnight-submit-timeout`) means the node did not report finality within `submitTimeout`: the transaction may
1102
+ * still reach the chain, and its Pending row stays. The SDK keeps listening to the engine's submission after the
1103
+ * timeout, for as long as that submission runs in this process: a failure it reports later removes the row, a
1104
+ * confirmation reaches the history sync. A row whose outcome this process never learns (it ends first) stays
1105
+ * until the history sync confirms it or the consumer removes it. The account-resolution errors
1106
+ * (`MidnightAccountNotFoundError`, `MidnightWalletNotReadyError`) precede the call and so precede any broadcast;
1107
+ * any other error is the engine's, and may also arrive after broadcast. Before retrying, check the account's
1108
+ * activities for the activity hash.
1109
+ */
1110
+ const submitMidnightTx = async (wallet, { transaction, submitTimeout: requestedSubmitTimeout, ...account }) => withMidnightWallet(wallet, account, (midnightWallet) => (0, rxjs.defer)(() => {
1111
+ const submitTimeout = resolveTimeoutMs("submitTimeout", requestedSubmitTimeout, DEFAULT_SUBMIT_TIMEOUT_MS);
1112
+ const { dispatch } = wallet;
1113
+ const activities$ = dispatch ? wallet.stateObservables.activities?.selectAllMap$ : void 0;
1114
+ const latestActivities$ = activities$ ? activities$.pipe((0, rxjs.startWith)(void 0), (0, rxjs.catchError)(() => (0, rxjs.of)(void 0))) : (0, rxjs.of)(void 0);
1115
+ const utxos$ = activities$ ? (0, rxjs.defer)(() => midnightWallet.state()).pipe((0, rxjs.take)(1), (0, rxjs.map)((state) => [...state.unshielded.availableCoins, ...state.unshielded.pendingCoins]), (0, rxjs.defaultIfEmpty)(void 0), (0, rxjs.catchError)(() => (0, rxjs.of)(void 0))) : (0, rxjs.of)(void 0);
1116
+ const removePendingRow = (pending) => {
1117
+ if (!dispatch || !activities$) return;
1118
+ activities$.pipe((0, rxjs.take)(1), (0, rxjs.catchError)(() => (0, rxjs.of)(void 0))).subscribe((latest) => {
1119
+ if ((latest?.[pending.accountId]?.find((row) => row.activityId === pending.activityId))?.type !== require_activity_type.ActivityType.Pending) return;
1120
+ try {
1121
+ dispatch("activities.removeActivities", {
1122
+ accountId: pending.accountId,
1123
+ activityIds: [pending.activityId]
1124
+ });
1125
+ } catch {}
1126
+ });
1127
+ };
1128
+ const settle = (finality$, pending) => {
1129
+ const outcome$ = finality$.pipe((0, rxjs.share)({
1130
+ connector: () => new rxjs.ReplaySubject(1),
1131
+ resetOnError: false,
1132
+ resetOnComplete: false
1133
+ }));
1134
+ if (pending) outcome$.subscribe({
1135
+ next: () => void 0,
1136
+ error: () => {
1137
+ removePendingRow(pending);
1138
+ }
1139
+ });
1140
+ return outcome$.pipe((0, rxjs.timeout)({
1141
+ first: submitTimeout,
1142
+ with: () => (0, rxjs.throwError)(() => new MidnightSubmitTimeoutError(transaction.transactionHash(), submitTimeout))
1143
+ }), (0, rxjs.map)((txId) => ({ txId })));
1144
+ };
1145
+ return utxos$.pipe((0, rxjs.timeout)({
1146
+ first: Math.min(PENDING_ROW_STATE_TIMEOUT_MS, submitTimeout),
1147
+ with: () => (0, rxjs.of)(void 0)
1148
+ }), (0, rxjs.switchMap)((utxos) => {
1149
+ const finality$ = midnightWallet.submitTransaction(transaction);
1150
+ return (0, rxjs.of)(utxos).pipe((0, rxjs.withLatestFrom)(latestActivities$), (0, rxjs.map)(([coins, activities]) => dispatch && activities && coins ? recordPendingActivity({
1151
+ dispatch,
1152
+ activities,
1153
+ midnightWallet,
1154
+ transaction,
1155
+ utxos: coins
1156
+ }) : void 0), (0, rxjs.switchMap)((pending) => settle(finality$, pending)));
1157
+ }));
1158
+ }));
1159
+ //#endregion
1160
+ //#region src/modules-midnight.ts
1161
+ var modules_midnight_exports = /* @__PURE__ */ require_rolldown_runtime.__exportAll({
1162
+ featureDev: () => require_sdk.sdk_default$2,
1163
+ storageInMemory: () => require_sdk.sdk_default$1,
1164
+ storageWebIndexeddb: () => require_sdk.sdk_default
1165
+ });
1166
+ //#endregion
1167
+ //#region src/midnight-proving-provider.ts
1168
+ const withinTimeout = async (operation, milliseconds) => (0, rxjs.firstValueFrom)((0, rxjs.from)(operation).pipe((0, rxjs.timeout)(milliseconds)));
1169
+ /**
1170
+ * Captures one account identity and resolves its current engine on every use.
1171
+ * No proof-server URL or wallet keys are exposed. Factory failures are `Err`;
1172
+ * `check`/`prove` reject on transport or attestation failure without fallback,
1173
+ * and on timeout.
1174
+ * The consumer must authorize disclosure of the circuit preimage to the configured prover.
1175
+ */
1176
+ const getMidnightProvingProvider = async (wallet, { keyMaterialProvider, proveTimeout: requestedProveTimeout, ...selection }) => {
1177
+ try {
1178
+ const proveTimeout = resolveProveTimeout(requestedProveTimeout);
1179
+ const accountId = await resolveMidnightAccountId(wallet, selection.accountId);
1180
+ const account = {
1181
+ ...selection,
1182
+ accountId
1183
+ };
1184
+ await midnightWalletFor(wallet, account);
1185
+ const provider = require_watch.createProvingProviderFromCircuits({
1186
+ check: async (payload) => (await midnightWalletFor(wallet, account)).proofCircuitProvider.check(payload),
1187
+ prove: async (payload) => (await midnightWalletFor(wallet, account)).proofCircuitProvider.prove(payload)
1188
+ }, keyMaterialProvider, { onKeyMaterialError: "propagate" });
1189
+ return require_asyncoption.Ok({
1190
+ check: async (serializedPreimage, keyLocation) => withinTimeout(provider.check(serializedPreimage, keyLocation), proveTimeout),
1191
+ prove: async (serializedPreimage, keyLocation, overwriteBindingInput) => withinTimeout(provider.prove(serializedPreimage, keyLocation, overwriteBindingInput), proveTimeout)
1192
+ });
1193
+ } catch (error) {
1194
+ return require_asyncoption.Err(error instanceof Error ? error : new Error(String(error)));
1195
+ }
1196
+ };
1197
+ //#endregion
1198
+ //#region ../../packages/lib/vendor/src/midnight-connector-transaction.ts
1199
+ require__polyfill_buffer_patch.init__polyfill_buffer_patch();
1200
+ /** Deserialize a hex-encoded, proven and bound connector transaction. */
1201
+ const deserializeMidnightSealedTransaction = async (tx) => _midnight_ntwrk_ledger_v8.Transaction.deserialize("signature", "proof", "binding", require__polyfill_buffer_patch.import_buffer.Buffer.from(tx, "hex"));
1202
+ /** Deserialize a hex-encoded, proven connector transaction that is not yet bound. */
1203
+ const deserializeMidnightUnsealedTransaction = async (tx) => _midnight_ntwrk_ledger_v8.Transaction.deserialize("signature", "proof", "pre-binding", require__polyfill_buffer_patch.import_buffer.Buffer.from(tx, "hex"));
1204
+ /**
1205
+ * Groups connector outputs into the wallet SDK's transfer shape, unshielded
1206
+ * first; a kind without outputs is omitted. Throws when a recipient is not a
1207
+ * Bech32m address of its kind on `networkId`.
1208
+ */
1209
+ const groupMidnightConnectorOutputs = (desiredOutputs, networkId) => {
1210
+ const unshielded = [];
1211
+ const shielded = [];
1212
+ for (const { kind, type, recipient, value } of desiredOutputs) {
1213
+ const parsedAddress = require_dist.MidnightBech32m.parse(recipient);
1214
+ if (kind === "unshielded") unshielded.push({
1215
+ type,
1216
+ receiverAddress: require_dist.UnshieldedAddress.codec.decode(networkId, parsedAddress),
1217
+ amount: value
1218
+ });
1219
+ if (kind === "shielded") shielded.push({
1220
+ type,
1221
+ receiverAddress: require_dist.ShieldedAddress.codec.decode(networkId, parsedAddress),
1222
+ amount: value
1223
+ });
1224
+ }
1225
+ const result = [];
1226
+ if (unshielded.length) result.push({
1227
+ type: "unshielded",
1228
+ outputs: unshielded
1229
+ });
1230
+ if (shielded.length) result.push({
1231
+ type: "shielded",
1232
+ outputs: shielded
1233
+ });
1234
+ return result;
1235
+ };
1236
+ /** Sums connector inputs per kind and token type into the wallet SDK's swap shape. */
1237
+ const groupMidnightConnectorInputs = (desiredInputs) => desiredInputs.reduce((inputs, { kind, type, value }) => {
1238
+ if (kind === "shielded" || kind === "unshielded") {
1239
+ const tokens = inputs[kind] ?? {};
1240
+ tokens[type] = (tokens[type] ?? 0n) + value;
1241
+ inputs[kind] = tokens;
1242
+ }
1243
+ return inputs;
1244
+ }, {});
1245
+ //#endregion
1246
+ //#region src/midnight-connector-transactions.ts
1247
+ const validateOptions = (options) => {
1248
+ if (options !== void 0 && (!options || typeof options !== "object" || Array.isArray(options) || options.payFees !== void 0 && typeof options.payFees !== "boolean")) throw new Error("Invalid Midnight fee options");
1249
+ };
1250
+ const validateTokens = (tokens) => {
1251
+ if (!Array.isArray(tokens)) throw new Error("Expected Midnight token array");
1252
+ for (const token of tokens) {
1253
+ if (!token || token.kind !== "shielded" && token.kind !== "unshielded") throw new Error("Unsupported Midnight token kind");
1254
+ if (typeof token.type !== "string" || !/^[\da-f]{64}$/i.test(token.type)) throw new Error("Expected a raw Midnight ledger token type");
1255
+ if (typeof token.value !== "bigint" || token.value < 0n) throw new Error("Expected a non-negative Midnight token value");
1256
+ }
1257
+ };
1258
+ const validateBalance = ({ tx, options }) => {
1259
+ validateOptions(options);
1260
+ if (typeof tx !== "string" || !/^(?:[\da-f]{2})+$/i.test(tx)) throw new Error("Expected a hexadecimal Midnight transaction");
1261
+ };
1262
+ const reservedBy = (recipe) => recipe.type === "UNPROVEN_TRANSACTION" ? recipe : recipe.balancingTransaction && {
1263
+ type: "UNPROVEN_TRANSACTION",
1264
+ transaction: recipe.balancingTransaction
1265
+ };
1266
+ const finalize = async (wallet, recipe, { sign, proveTimeout }) => {
1267
+ const reserved = reservedBy(recipe);
1268
+ const prepared = sign ? await (0, rxjs.firstValueFrom)(wallet.signRecipe(recipe).pipe((0, rxjs.catchError)((signingError) => reserved ? releaseThenThrow(wallet, reserved, signingError) : (0, rxjs.throwError)(() => signingError)))) : recipe;
1269
+ return (0, rxjs.firstValueFrom)(wallet.finalizeRecipe(prepared).pipe((0, rxjs.timeout)(proveTimeout)));
1270
+ };
1271
+ /**
1272
+ * Balances, signs and proves a binding transaction; never submits it.
1273
+ * Obtain consumer consent for the transaction, account and prover disclosure before calling.
1274
+ */
1275
+ const balanceMidnightSealedTransaction = async (wallet, props) => withMidnightWallet(wallet, props, (engine) => (0, rxjs.defer)(async () => {
1276
+ const proveTimeout = resolveProveTimeout(props.proveTimeout);
1277
+ validateBalance(props);
1278
+ const transaction = await deserializeMidnightSealedTransaction(props.tx);
1279
+ return finalize(engine, await (0, rxjs.firstValueFrom)(engine.balanceFinalizedTransaction(transaction, {
1280
+ ttl: new Date(Date.now() + require_const$1.defaultTxTtlLength),
1281
+ tokenKindsToBalance: props.options?.payFees === false ? ["shielded", "unshielded"] : void 0
1282
+ })), {
1283
+ sign: true,
1284
+ proveTimeout
1285
+ });
1286
+ }));
1287
+ /**
1288
+ * Balances, signs and proves a pre-binding transaction; never submits it.
1289
+ * Obtain consumer consent for the transaction, account and prover disclosure before calling.
1290
+ */
1291
+ const balanceMidnightUnsealedTransaction = async (wallet, props) => withMidnightWallet(wallet, props, (engine) => (0, rxjs.defer)(async () => {
1292
+ const proveTimeout = resolveProveTimeout(props.proveTimeout);
1293
+ validateBalance(props);
1294
+ const transaction = await deserializeMidnightUnsealedTransaction(props.tx);
1295
+ return finalize(engine, await (0, rxjs.firstValueFrom)(engine.balanceUnboundTransaction(transaction, {
1296
+ ttl: new Date(Date.now() + require_const$1.defaultTxTtlLength),
1297
+ tokenKindsToBalance: props.options?.payFees === false ? ["shielded", "unshielded"] : void 0
1298
+ })), {
1299
+ sign: true,
1300
+ proveTimeout
1301
+ });
1302
+ }));
1303
+ /**
1304
+ * Builds and proves connector transfers, including mixed token kinds; signs when unshielded outputs exist.
1305
+ * Obtain consumer consent before calling. Returns a native finalized transaction without submitting.
1306
+ * Fees default to enabled; use `buildMidnightTransfers` for separate homogeneous build/sign/prove stages.
1307
+ */
1308
+ const makeMidnightTransfer = async (wallet, props) => withMidnightWallet(wallet, props, (engine) => (0, rxjs.defer)(async () => {
1309
+ const proveTimeout = resolveProveTimeout(props.proveTimeout);
1310
+ validateOptions(props.options);
1311
+ validateTokens(props.desiredOutputs);
1312
+ const outputs = groupMidnightConnectorOutputs(props.desiredOutputs, engine.networkId);
1313
+ const ttl = new Date(Date.now() + require_const$1.defaultTxTtlLength);
1314
+ return finalize(engine, await (0, rxjs.firstValueFrom)(engine.transferTransaction(outputs, {
1315
+ ttl,
1316
+ payFees: false
1317
+ }).pipe((0, rxjs.switchMap)((built) => props.options?.payFees ?? true ? balanceMidnightRecipe(engine, built, ttl) : (0, rxjs.of)(built)))), {
1318
+ sign: outputs.some((output) => output.type === "unshielded"),
1319
+ proveTimeout
1320
+ });
1321
+ }));
1322
+ const assertOutputKindsHaveInputs = (inputs, outputs) => {
1323
+ const missing = outputs.map((output) => output.type).filter((kind) => inputs[kind] === void 0);
1324
+ if (missing.length > 0) throw new Error(`Midnight intent requests ${missing.join(" and ")} outputs without inputs of that kind, which the wallet library would drop`);
1325
+ };
1326
+ /**
1327
+ * Builds and proves an intent, signing when inputs or outputs include unshielded tokens.
1328
+ * Obtain consumer consent before calling. Never submits. `intentId` is accepted but ignored,
1329
+ * matching the existing connector; no intent ordering is guaranteed. Every output kind
1330
+ * needs an input of the same kind: the wallet library builds a leg from its inputs and
1331
+ * drops the outputs of a kind without any, so such a request is refused before anything
1332
+ * is reserved or signed. When the fee cannot be paid, the inputs the build reserved are
1333
+ * released and the balancing error is returned; if that release fails too, the error is
1334
+ * an `AggregateError` of both failures and the coins stay reserved until a sync reset.
1335
+ */
1336
+ const makeMidnightIntent = async (wallet, props) => withMidnightWallet(wallet, props, (engine) => (0, rxjs.defer)(async () => {
1337
+ const proveTimeout = resolveProveTimeout(props.proveTimeout);
1338
+ validateOptions(props.options);
1339
+ if (!props.options || typeof props.options.payFees !== "boolean" || props.options.intentId !== "random" && typeof props.options.intentId !== "number") throw new Error("Invalid Midnight intent options");
1340
+ validateTokens(props.desiredInputs);
1341
+ validateTokens(props.desiredOutputs);
1342
+ const inputs = groupMidnightConnectorInputs(props.desiredInputs);
1343
+ const outputs = groupMidnightConnectorOutputs(props.desiredOutputs, engine.networkId);
1344
+ assertOutputKindsHaveInputs(inputs, outputs);
1345
+ const ttl = new Date(Date.now() + require_const$1.defaultTxTtlLength);
1346
+ return finalize(engine, await (0, rxjs.firstValueFrom)(engine.initSwap(inputs, outputs, {
1347
+ ttl,
1348
+ payFees: false
1349
+ }).pipe((0, rxjs.switchMap)((built) => props.options.payFees ? balanceMidnightRecipe(engine, built, ttl) : (0, rxjs.of)(built)))), {
1350
+ sign: !!inputs.unshielded || outputs.some((output) => output.type === "unshielded"),
1351
+ proveTimeout
1352
+ });
1353
+ }));
1354
+ //#endregion
1355
+ exports.AccountId = require_account_id_vo.AccountId;
1356
+ exports.Err = require_asyncoption.Err;
1357
+ exports.FEATURE_FLAG_MIDNIGHT = require_watch.FEATURE_FLAG_MIDNIGHT;
1358
+ exports.FEATURE_FLAG_MIDNIGHT_UNSHIELDED = require_watch.FEATURE_FLAG_MIDNIGHT_UNSHIELDED;
1359
+ exports.FEATURE_FLAG_NETWORK_TYPE = require_const.FEATURE_FLAG_NETWORK_TYPE;
1360
+ exports.MIDNIGHT_LOCAL_PROOF_SERVER_URL = MIDNIGHT_LOCAL_PROOF_SERVER_URL;
1361
+ exports.MIDNIGHT_PREVIEW_INDEXER_URL = MIDNIGHT_PREVIEW_INDEXER_URL;
1362
+ exports.MIDNIGHT_PREVIEW_NODE_URL = MIDNIGHT_PREVIEW_NODE_URL;
1363
+ exports.MIDNIGHT_PUBLIC_ENDPOINTS = MIDNIGHT_PUBLIC_ENDPOINTS;
1364
+ exports.MidnightAccountId = require_midnight_account_id_vo.MidnightAccountId;
1365
+ exports.MidnightAccountNotFoundError = MidnightAccountNotFoundError;
1366
+ exports.MidnightNetworkId = require_const$1.MidnightNetworkId;
1367
+ exports.MidnightNetworkNotConfiguredError = MidnightNetworkNotConfiguredError;
1368
+ exports.MidnightNothingToRegisterError = MidnightNothingToRegisterError;
1369
+ exports.MidnightSDKNetworkIds = require_const$1.MidnightSDKNetworkIds;
1370
+ exports.MidnightSubmitTimeoutError = MidnightSubmitTimeoutError;
1371
+ exports.MidnightWalletNotReadyError = MidnightWalletNotReadyError;
1372
+ exports.NIGHT_TOKEN_ID = require_const$1.NIGHT_TOKEN_ID;
1373
+ exports.Ok = require_asyncoption.Ok;
1374
+ exports.WalletId = require_sdk.WalletId;
1375
+ exports.WalletType = require_sdk.WalletType;
1376
+ exports.balanceMidnightSealedTransaction = balanceMidnightSealedTransaction;
1377
+ exports.balanceMidnightUnsealedTransaction = balanceMidnightUnsealedTransaction;
1378
+ exports.buildMidnightTransfer = buildMidnightTransfer;
1379
+ exports.buildMidnightTransfers = buildMidnightTransfers;
1380
+ exports.createInMemoryWalletEntity = require_sdk.createInMemoryWalletEntity;
1381
+ exports.createLaceWallet = require_sdk.createLaceWallet;
1382
+ exports.createMidnightAccounts = createMidnightAccounts;
1383
+ exports.createMidnightModule = createMidnightModule;
1384
+ exports.createMidnightPasskeyWalletEntity = createMidnightPasskeyWalletEntity;
1385
+ exports.createPasskeyKeySource = require_key_source.createPasskeyKeySource;
1386
+ exports.createTemenosAttestedProver = createTemenosAttestedProver;
1387
+ exports.discardMidnightTx = discardMidnightTx;
1388
+ exports.estimateMidnightFee = estimateMidnightFee;
1389
+ exports.getMidnightProvingProvider = getMidnightProvingProvider;
1390
+ exports.isForbiddenTokenName = isForbiddenTokenName;
1391
+ exports.isTakenTokenName = isTakenTokenName;
1392
+ exports.isTokenFullNameValid = isTokenFullNameValid;
1393
+ exports.isTokenShortNameValid = isTokenShortNameValid;
1394
+ Object.defineProperty(exports, "m", {
1395
+ enumerable: true,
1396
+ get: function() {
1397
+ return modules_midnight_exports;
1398
+ }
1399
+ });
1400
+ exports.makeMidnightIntent = makeMidnightIntent;
1401
+ exports.makeMidnightTransfer = makeMidnightTransfer;
1402
+ exports.observeMidnightBalances = observeMidnightBalances;
1403
+ exports.proveMidnightTx = proveMidnightTx;
1404
+ exports.registerMidnightDust = registerMidnightDust;
1405
+ exports.selectMidnightNetwork = selectMidnightNetwork;
1406
+ exports.signMidnightData = signMidnightData;
1407
+ exports.signMidnightTx = signMidnightTx;
1408
+ exports.submitMidnightTx = submitMidnightTx;