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