@laceio/sdk 0.1.0 → 0.1.1-canary.0

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 (408) hide show
  1. package/dist/{Ed25519PublicKey-lvu1s54U.cjs → Address-AMKTo-dA.cjs} +17150 -61
  2. package/dist/{Ed25519PublicKey-CjnuAYRR.js → Address-_c_-9hLC.js} +16955 -264
  3. package/dist/{Bip32Account-r3KAhCgU.js → Bip32Account-CaW1zC9Y.js} +4 -5
  4. package/dist/{Bip32Account-Cz3h0ZUa.cjs → Bip32Account-DOaGmKpv.cjs} +4 -5
  5. package/dist/Cardano-B-gyqBBD.js +311 -0
  6. package/dist/Cardano-BQ_af0Y3.cjs +322 -0
  7. package/dist/Ed25519PublicKey-B3QcR0J2.cjs +88 -0
  8. package/dist/Ed25519PublicKey-DIE19xHg.js +83 -0
  9. package/dist/InMemoryKeyAgent-Bc_xZY-v.cjs +652 -0
  10. package/dist/InMemoryKeyAgent-D8T3vtXy.js +631 -0
  11. package/dist/{PaymentAddress-DhbtuYb7.cjs → PaymentAddress-B4n1KZMx.cjs} +1 -2
  12. package/dist/{PaymentAddress-xSmGUQ-8.js → PaymentAddress-Cml3EA1n.js} +1 -2
  13. package/dist/Percent-Cfuw5YyL.cjs +11 -0
  14. package/dist/Percent-DpvyJ_93.js +5 -0
  15. package/dist/SodiumBip32Ed25519-BaD-kjyx.cjs +380 -0
  16. package/dist/SodiumBip32Ed25519-DCikAMsl.js +363 -0
  17. package/dist/{TransactionBuilder-CeJTNzm-.cjs → TransactionBuilder-BakTJvsJ.cjs} +59 -89
  18. package/dist/{TransactionBuilder-DGNDM4kt.js → TransactionBuilder-D2ErwVWv.js} +5 -71
  19. package/dist/_md-6zV2Cme0.cjs +684 -0
  20. package/dist/_md-gbUqlhqd.js +399 -0
  21. package/dist/_web-crypto-random-bytes-BvzwTYPG.js +197 -0
  22. package/dist/acc-module-NL_8mEHH.cjs +27654 -0
  23. package/dist/acc-module-ur8CkBd1.js +27624 -0
  24. package/dist/account-call-B7cF8ly4.cjs +293 -0
  25. package/dist/account-call-BF4rBcNw.js +3 -0
  26. package/dist/account-call-CoCq3V55.js +252 -0
  27. package/dist/account-call-DFcD257E.cjs +4 -0
  28. package/dist/account-guards-BeKbV9D1.cjs +41 -0
  29. package/dist/account-guards-qnFXuXSE.js +36 -0
  30. package/dist/{activity-type.stable-ClO9j_PH.cjs → activity-type-BPXxdHBP.cjs} +2 -1
  31. package/dist/{activity-type.stable-Ml0SOYv9.js → activity-type-C1geyPsH.js} +2 -1
  32. package/dist/address-OxwXIwbF.js +15502 -0
  33. package/dist/address-book-address-validator-BqYM0Uyp.cjs +41 -0
  34. package/dist/{address-book-address-validator-BhqRfmlL.cjs → address-book-address-validator-CGIcqn5W.cjs} +5 -4
  35. package/dist/{address-book-address-validator-VqIOB8PY.js → address-book-address-validator-FkkYim3z.js} +6 -4
  36. package/dist/address-book-address-validator-RSx2Jozy.js +39 -0
  37. package/dist/address-lECYBd9-.cjs +13043 -0
  38. package/dist/{apply-vkey-witnesses-Ctzk7eye.cjs → apply-vkey-witnesses-1jyczTkw.cjs} +1 -1
  39. package/dist/{apply-vkey-witnesses-Dfo7XfhL.js → apply-vkey-witnesses-Byb40-yJ.js} +1 -1
  40. package/dist/artefact-loader-Cqc9eSkL.cjs +182 -0
  41. package/dist/artefact-loader-D0T2f6F7.js +159 -0
  42. package/dist/auto-dismiss-failure-on-success-BWJceNXd.cjs +37 -0
  43. package/dist/auto-dismiss-failure-on-success-Bpod-v4r.js +31 -0
  44. package/dist/bip32-EPpcFrpH.cjs +3851 -0
  45. package/dist/{bip32ed25519-D2In8WzR.cjs → bip32ed25519-CRiG-Kjg.cjs} +5 -4
  46. package/dist/{bip32ed25519-qsLH_eWO.js → bip32ed25519-E-fCUZNv.js} +6 -4
  47. package/dist/bip39-DZomfqeY.js +9 -0
  48. package/dist/bip39-MAck9iod.cjs +26 -0
  49. package/dist/bitcoin-data-provider-D0OT_Uiu.cjs +26 -0
  50. package/dist/bitcoin-data-provider-LN_8oamW.js +21 -0
  51. package/dist/bitcoin.cjs +48 -0
  52. package/dist/bitcoin.d.ts +29805 -1
  53. package/dist/bitcoin.js +22 -0
  54. package/dist/{blake2b-BGHUWMsV.js → blake2b-BL-eR5G2.js} +6 -4
  55. package/dist/{blake2b-DspUqw68.cjs → blake2b-Iy324FwH.cjs} +5 -4
  56. package/dist/{blockfrost-tx-submit-provider-BUEOmdvc.js → blockfrost-tx-submit-provider-BHDLgOIE.js} +9 -162
  57. package/dist/{blockfrost-tx-submit-provider-B5dWbdrZ.cjs → blockfrost-tx-submit-provider-BxC19smv.cjs} +7 -171
  58. package/dist/{blockingWithLatestFrom-BhaE7pnA.js → blockingWithLatestFrom-FUfZFEUG.js} +1 -1
  59. package/dist/{blockingWithLatestFrom-DkuT3G2a.cjs → blockingWithLatestFrom-bmCPgA3c.cjs} +1 -1
  60. package/dist/bn-BFq5a4dk.cjs +2553 -0
  61. package/dist/{SodiumBip32Ed25519-BEfo1Q9m.js → browser-D5jRKv_L.js} +4 -401
  62. package/dist/bytes.vo-CziaOsba.js +24 -0
  63. package/dist/bytes.vo-hecRu3YZ.cjs +35 -0
  64. package/dist/{cardano-network-id-to-network-type-PXvn1ycQ.cjs → cardano-network-id-to-network-type-BwG_d6QP.cjs} +1 -1
  65. package/dist/{cardano-network-id-to-network-type-DHgKhDAK.js → cardano-network-id-to-network-type-CYJheetp.js} +1 -1
  66. package/dist/{cardano-network-id.vo-CbNNKd-k.cjs → cardano-network-id.vo-C5VuBXT3.cjs} +2 -2
  67. package/dist/{cardano-network-id.vo-CTYe-Oix.js → cardano-network-id.vo-CeLJqmb_.js} +2 -2
  68. package/dist/{cardano-tx-id.vo-BMwemq5x.js → cardano-tx-id.vo-DJ70NC0-.js} +1 -1
  69. package/dist/{cardano-tx-id.vo-NY-gCOWJ.cjs → cardano-tx-id.vo-lnyO9XaW.cjs} +1 -1
  70. package/dist/cardano.cjs +31 -24
  71. package/dist/cardano.d.ts +27602 -8121
  72. package/dist/cardano.js +21 -13
  73. package/dist/client-Bw2foG5E.cjs +808 -0
  74. package/dist/const-BB3MccLt.js +153 -0
  75. package/dist/{const-BErUlcZw.cjs → const-BWBAzOmN.cjs} +1 -1
  76. package/dist/const-CSWmOyzn.cjs +42 -0
  77. package/dist/{const-Dy8Ctnpd.cjs → const-D3mCkwrM.cjs} +5 -5
  78. package/dist/const-DW7z3R5k.js +13 -0
  79. package/dist/{const-DeUA7zYl.js → const-DbuUHSzR.js} +5 -5
  80. package/dist/const-DgBzKfz6.cjs +31995 -0
  81. package/dist/{const-DVW6DGkZ.js → const-xGSNCtwQ.js} +1 -1
  82. package/dist/contract-BsIGhsYa.js +171 -0
  83. package/dist/contract-DD6CGnpB.cjs +189 -0
  84. package/dist/create-add-accounts-2mQA0ST2.js +102 -0
  85. package/dist/create-add-accounts-B6mR2NMn.cjs +114 -0
  86. package/dist/{delegation-tx-builder-CF0VunDW.cjs → delegation-tx-builder-Cp30jtj9.cjs} +9 -8
  87. package/dist/{delegation-tx-builder-C8LQxU2R.js → delegation-tx-builder-DUMikSTg.js} +9 -7
  88. package/dist/{deregistration-tx-builder-DcUXA3Ls.cjs → deregistration-tx-builder-B-ZeY-dR.cjs} +10 -9
  89. package/dist/{deregistration-tx-builder-BOBPP8m_.js → deregistration-tx-builder-CRLrK99U.js} +10 -8
  90. package/dist/device-commitment-hex.vo-BIUYUNz1.cjs +31 -0
  91. package/dist/device-commitment-hex.vo-D9FsYLn7.js +26 -0
  92. package/dist/device-key-BToCoS4D.js +2394 -0
  93. package/dist/device-key-D6euvxFi.cjs +2489 -0
  94. package/dist/device-readers-BHJeNR8I.js +3 -0
  95. package/dist/device-readers-Dw7uTNM5.cjs +167 -0
  96. package/dist/device-readers-b4g2j3QL.js +144 -0
  97. package/dist/device-readers-cxcJcWq5.cjs +7 -0
  98. package/dist/dist-B00GN41m.js +141 -0
  99. package/dist/dist-BA1xnF9O.cjs +4413 -0
  100. package/dist/dist-BmHOXLe8.cjs +3814 -0
  101. package/dist/dist-Br0OVXKt.cjs +535 -0
  102. package/dist/dist-C1JK9C1I.cjs +3452 -0
  103. package/dist/dist-DKEViNEI.cjs +1306 -0
  104. package/dist/dist-Dwqx184a.cjs +43175 -0
  105. package/dist/dist-MJof_Ky1.cjs +145 -0
  106. package/dist/dist-p84sVVJ9.cjs +1394 -0
  107. package/dist/{earn-rewards-tx-builder-BRlTueHS.js → earn-rewards-tx-builder-8G_rouIk.js} +9 -7
  108. package/dist/{earn-rewards-tx-builder-RgO0QUY8.cjs → earn-rewards-tx-builder-cOUNV58E.cjs} +9 -8
  109. package/dist/enc-key-circuits-0Dud78IB.js +13 -0
  110. package/dist/enc-key-circuits-yjPHbuo_.cjs +24 -0
  111. package/dist/english-BZ_ebp2-.cjs +2057 -0
  112. package/dist/envelopes-B3QCzo5p.js +2658 -0
  113. package/dist/envelopes-BdE1xlgz.cjs +2777 -0
  114. package/dist/errors-BA3b8aVu.cjs +584 -0
  115. package/dist/errors-pkQdxW-7.js +392 -0
  116. package/dist/experimental.cjs +6820 -0
  117. package/dist/experimental.d.ts +63552 -0
  118. package/dist/experimental.js +6670 -0
  119. package/dist/fees-6C2uEWFK.js +653 -0
  120. package/dist/fees-DtC71fOx.cjs +820 -0
  121. package/dist/gated-call-BrPjKolT.js +3 -0
  122. package/dist/gated-call-CcsuW9L5.js +691 -0
  123. package/dist/gated-call-DdDrxEq5.cjs +732 -0
  124. package/dist/gated-call-Dk7PazhG.cjs +4 -0
  125. package/dist/grant-rules-B7eDuD5G.cjs +5468 -0
  126. package/dist/grant-rules-qLrKUIR3.js +5217 -0
  127. package/dist/grant-status-CDmZpx32.js +296 -0
  128. package/dist/grant-status-CQtwjLsA.cjs +337 -0
  129. package/dist/grants-Bnb-3Hkv.cjs +16 -0
  130. package/dist/grants-CIb6nOV7.cjs +273 -0
  131. package/dist/grants-CYY0AquW.js +202 -0
  132. package/dist/grants-DOsFSotP.js +4 -0
  133. package/dist/{group-cardano-addresses-by-account-C-1GHUu8.cjs → group-cardano-addresses-by-account-BGOtPV-Y.cjs} +4 -40
  134. package/dist/{group-cardano-addresses-by-account-p4dXmCoj.js → group-cardano-addresses-by-account-TqvESg9x.js} +6 -37
  135. package/dist/{guarded-transaction-signer-DZSGHp1K.js → guarded-transaction-signer-BbVDE9Nn.js} +12 -18
  136. package/dist/{guarded-transaction-signer-BLSezbfV.cjs → guarded-transaction-signer-DTLjAkif.cjs} +26 -26
  137. package/dist/hex-BVtOKJki.cjs +263 -0
  138. package/dist/hex-CGYJPK_Z.js +192 -0
  139. package/dist/http-client-B7_kBTYn.js +155 -0
  140. package/dist/http-client-DYQ_7Rdf.cjs +167 -0
  141. package/dist/identity-DxPhxkZs.js +239 -0
  142. package/dist/identity-y41Yle03.cjs +274 -0
  143. package/dist/in-memory-wallet-integration-5BKiAvPT.js +20861 -0
  144. package/dist/{in-memory-wallet-integration-CUTa68ET.js → in-memory-wallet-integration-BCOqDgbt.js} +10 -107
  145. package/dist/in-memory-wallet-integration-Bi8I9Dso.js +128 -0
  146. package/dist/in-memory-wallet-integration-Bsl2ONua.cjs +239 -0
  147. package/dist/in-memory-wallet-integration-DZ0CAyvY.cjs +20865 -0
  148. package/dist/{in-memory-wallet-integration-Dw_S7amX.cjs → in-memory-wallet-integration-DsFm8gLk.cjs} +21 -112
  149. package/dist/{in-memory-wallet-integration-Z4Bp_DTv.cjs → in-memory-wallet-integration-aW_SF-go.cjs} +8 -5
  150. package/dist/{in-memory-wallet-integration-B6cbAlvD.js → in-memory-wallet-integration-mIEc8EfR.js} +9 -5
  151. package/dist/index.cjs +95 -58
  152. package/dist/index.d.ts +45152 -13448
  153. package/dist/index.js +55 -28
  154. package/dist/{init-CVi8J0zk.cjs → init-5SfWgCYD.cjs} +3 -3
  155. package/dist/{init-Ci7aqWCf2.cjs → init-8NVWbo302.cjs} +2 -2
  156. package/dist/init-B-C7n6u6.js +5 -0
  157. package/dist/{init-BFMWRf-L.js → init-B-ppfGO-.js} +1 -1
  158. package/dist/{init-IiR093Jw.cjs → init-B2OUhY5T.cjs} +2 -2
  159. package/dist/{init-DXnus199.cjs → init-B6Eg_o6G.cjs} +5 -5
  160. package/dist/{init-4hDl5bpr.js → init-BAWMHL1k.js} +2 -2
  161. package/dist/init-BC2CZZOu2.cjs +2002 -0
  162. package/dist/{init-a228hXnS.cjs → init-BF-a2p6E.cjs} +65 -73
  163. package/dist/{init-fFirX8OY.cjs → init-BFxlQAD8.cjs} +1 -1
  164. package/dist/init-BJE1ry0O.js +17 -0
  165. package/dist/{init-BVnI4z2J.js → init-BPKBVOHU.js} +2 -2
  166. package/dist/{init-bdqZBd-o.js → init-BSP_xcpB.js} +2 -2
  167. package/dist/{init-CFNOn3lo.js → init-BSd7mznK.js} +3 -3
  168. package/dist/{init-MjR4swi6.js → init-BUJTT0MN.js} +36 -43
  169. package/dist/init-BUpFzYsD.cjs +143 -0
  170. package/dist/{init-BvpYHyLH.cjs → init-BZ-WyAIL.cjs} +3 -3
  171. package/dist/init-BZdfdLX7.js +422 -0
  172. package/dist/{init-CJeOys1w.cjs → init-B_HWNXMD.cjs} +2 -2
  173. package/dist/init-BbIMt6xU.cjs +6 -0
  174. package/dist/{init-BYdN1aqE.cjs → init-BewG6swt.cjs} +2 -2
  175. package/dist/{init-BX0AZAVH2.js → init-Bilqsbng.js} +2 -2
  176. package/dist/{init-Tpn9VkFu.cjs → init-BpwlQ6wF.cjs} +1 -1
  177. package/dist/{init-D5-P0HXK.js → init-BtQOzUjX.js} +1 -1
  178. package/dist/{init-BvGz3qUd2.js → init-CCTscPaY2.js} +2 -2
  179. package/dist/{init-D4hPipCD.cjs → init-CH0yyBof.cjs} +1 -1
  180. package/dist/init-CaIkrXal.cjs +121 -0
  181. package/dist/init-CkZy4IMf.cjs +107 -0
  182. package/dist/{init-Drr2f_Pr.js → init-CmfcY7SV.js} +1 -1
  183. package/dist/{init-Kf3_OLv6.js → init-CnJAlks_.js} +1 -1
  184. package/dist/{init-Cdjt_z-b.cjs → init-CqqmtAIK.cjs} +4 -4
  185. package/dist/{init-Bb0avZeZ.js → init-Cu2znmIc.js} +5 -5
  186. package/dist/init-Cz5LAizN.js +2001 -0
  187. package/dist/init-D4WM3-Mn.cjs +18 -0
  188. package/dist/init-DMi2FGpf.cjs +424 -0
  189. package/dist/{init-lcaUSOOG.js → init-DPTJohPd.js} +1 -1
  190. package/dist/{init-BTYLMF9F2.cjs → init-DexLSprL2.cjs} +258 -61
  191. package/dist/init-DfKPgD21.js +106 -0
  192. package/dist/init-DgzRsI-C.js +141 -0
  193. package/dist/init-Dj4Cn7-P.js +4789 -0
  194. package/dist/init-DktAnYI0.cjs +2354 -0
  195. package/dist/{init-DFwhgert.cjs → init-DmyuM9Lo.cjs} +1 -1
  196. package/dist/{init-CX_zLXc6.js → init-IBnizp1U.js} +5 -5
  197. package/dist/init-MDKB6tGI2.cjs +4790 -0
  198. package/dist/{init-DbZ5byj42.js → init-TbB38KNt2.js} +258 -60
  199. package/dist/init-X6m_cqDy.js +2353 -0
  200. package/dist/{init-DvVgKCaP2.cjs → init-bzvl1JhF.cjs} +2 -2
  201. package/dist/{init-BgrY29gW.js → init-dsYkC_0B.js} +4 -4
  202. package/dist/{init-B5BsI3DR.cjs → init-kvn5FlPS.cjs} +7 -7
  203. package/dist/init-vfy9DW_E.js +119 -0
  204. package/dist/{init-BE_6Jyc4.js → init-w7xl6LsP.js} +3 -3
  205. package/dist/{init-DEsWVyn5.cjs → init-wgiBUmyW.cjs} +1 -1
  206. package/dist/{is-retriable-error-DWv_ob-f.js → is-retriable-error-CmFR20pe.js} +1 -1
  207. package/dist/{is-retriable-error-Dtb4JGjd.cjs → is-retriable-error-D2yo0_lS.cjs} +1 -1
  208. package/dist/jubjub-authoriser-A2c8vmkN.js +84 -0
  209. package/dist/jubjub-authoriser-D3ZDgzcF.cjs +85 -0
  210. package/dist/key-source-CcLTx8HK.js +2761 -0
  211. package/dist/key-source-D2tTAag-.cjs +806 -0
  212. package/dist/{key-value-store-DTX1quRS.js → key-value-store-DZcNDB3n.js} +1 -1
  213. package/dist/{key-value-store-B-XRIwaM.cjs → key-value-store-Htj4RgMe.cjs} +1 -1
  214. package/dist/keyDerivation-DcKRUCVh.cjs +274 -0
  215. package/dist/keyDerivation-QGesIMbS.js +4077 -0
  216. package/dist/{lace-context-FpU3iG3f.cjs → lace-context-BN0b_ury.cjs} +4 -4
  217. package/dist/{lace-context-BQvvxVLm.js → lace-context-DMRJ87Vg.js} +4 -4
  218. package/dist/lib-BC-62Byh.cjs +2359 -0
  219. package/dist/lib-JYqcAX0c.js +2354 -0
  220. package/dist/midnight-account-id.vo--Vcx34Xk.cjs +10 -0
  221. package/dist/midnight-account-id.vo-BuB8fiVO.js +5 -0
  222. package/dist/midnight-engine-B7D2hbHo.js +5 -0
  223. package/dist/midnight-engine-D5ikN_5F.cjs +6 -0
  224. package/dist/midnight-wallet-BOdFD6SX.cjs +24 -0
  225. package/dist/midnight-wallet-CAqZrNVe.js +18 -0
  226. package/dist/midnight.cjs +1412 -0
  227. package/dist/midnight.d.ts +28609 -0
  228. package/dist/midnight.js +1355 -0
  229. package/dist/modules-cardano-BiL9hoM3.js +996 -0
  230. package/dist/modules-cardano-UeXks3sd.cjs +1109 -0
  231. package/dist/node-relay-BOuvdZvC.cjs +49 -0
  232. package/dist/node-relay-CLtc5n1v.js +48 -0
  233. package/dist/outputs-5qdW8s-f.js +196 -0
  234. package/dist/outputs-BEM1GPMf.cjs +339 -0
  235. package/dist/{SodiumBip32Ed25519-BQUcrQWX.cjs → pbkdf2-B1veireP.cjs} +6 -411
  236. package/dist/pending-operation-CfTUNQVD.cjs +26 -0
  237. package/dist/pending-operation-Ljijb1Uh.js +21 -0
  238. package/dist/providers-1on_fwJO.cjs +364 -0
  239. package/dist/providers-C1MsxfMA.js +341 -0
  240. package/dist/redacted-4SJPqt-G.js +81 -0
  241. package/dist/redacted-DwxIDdIF.cjs +86 -0
  242. package/dist/{reselect-DPML1uFN.cjs → reselect-kP4DaAII.cjs} +1 -1
  243. package/dist/{retry-config-oNtfdyrG.cjs → retry-config-BGv5q5QM.cjs} +1 -1
  244. package/dist/{retry-config-VdbuqBsI.js → retry-config-Bu5Yn5ua.js} +1 -1
  245. package/dist/safe-buffer-CqGpSFCQ.js +43 -0
  246. package/dist/safe-buffer-DbXbwhUQ.cjs +48 -0
  247. package/dist/sdk-1SRu8Ype.cjs +1445 -0
  248. package/dist/sdk-BneJm7ey.js +1249 -0
  249. package/dist/sdk-init-9TG1ZvHF.cjs +3795 -0
  250. package/dist/sdk-init-Ce3mD-8F.js +1047 -0
  251. package/dist/secret-box-CSmRp6Tt.js +3777 -0
  252. package/dist/secret-box-ZfbYwBgS.cjs +6970 -0
  253. package/dist/send-proof-progress-DtAcrMP6.cjs +33 -0
  254. package/dist/send-proof-progress-Dx2cUz1B.js +22 -0
  255. package/dist/sha2-DaRJZOjk.cjs +390 -0
  256. package/dist/sha2-c4sB6peD.js +378 -0
  257. package/dist/side-effects-C3BhLrdP.js +768 -0
  258. package/dist/side-effects-DG0R-KFc.cjs +804 -0
  259. package/dist/sign-bitcoin-transaction-with-seed-C7vq9om8.js +147 -0
  260. package/dist/sign-bitcoin-transaction-with-seed-Ds1dwzan.cjs +158 -0
  261. package/dist/signer--2I6poMD.js +2 -0
  262. package/dist/signer-CX21Ups_.cjs +121 -0
  263. package/dist/signer-Cnn9q9oY.js +92 -0
  264. package/dist/signer-DbSxjk0F.cjs +7 -0
  265. package/dist/signer-factory-B5oFuUZ-.cjs +130 -0
  266. package/dist/signer-factory-BAt8FPNc.cjs +281 -0
  267. package/dist/signer-factory-BGE4nL4k.js +129 -0
  268. package/dist/signer-factory-C4pgsiJi.js +281 -0
  269. package/dist/{signer-factory-DySc1wRX.cjs → signer-factory-D95jQIPV.cjs} +9 -6
  270. package/dist/{signer-factory-D4HrwFPl.js → signer-factory-PrpsGX-8.js} +10 -6
  271. package/dist/{slice-BZTQgYSs.js → slice-B-xJcuT1.js} +4 -4
  272. package/dist/slice-B4QOYaOG.cjs +105 -0
  273. package/dist/{slice-CtIMw2YT.cjs → slice-B9QKuhi0.cjs} +3 -3
  274. package/dist/slice-BKnGkAkd.cjs +9031 -0
  275. package/dist/{slice-Bhwmqn1p.cjs → slice-Bf4enJKZ.cjs} +8 -8
  276. package/dist/{slice-DaNVz7_l.js → slice-ByNWnxKS.js} +8 -8
  277. package/dist/{slice-C2UDQrdt.js → slice-C1zOeseG.js} +449 -355
  278. package/dist/{slice-DFLyKRm5.cjs → slice-C4toRM6A.cjs} +2 -2
  279. package/dist/{slice-Cx4dULDA.cjs → slice-C8YVv4Qn.cjs} +1 -1
  280. package/dist/{slice-jnpOgiSZ.cjs → slice-CaMfviYu.cjs} +3 -3
  281. package/dist/{slice-DFvrwUur.js → slice-CgeRsYRg.js} +6 -6
  282. package/dist/slice-Cwt8jShq.js +9013 -0
  283. package/dist/{slice-zNEspZND.js → slice-D0VzpMbY.js} +2 -2
  284. package/dist/slice-D14F78Ca.js +87 -0
  285. package/dist/{slice-F6A1YKOF.cjs → slice-DLflttAu.cjs} +479 -366
  286. package/dist/{slice-C96EdeY1.js → slice-DcO-iNz2.js} +1 -1
  287. package/dist/{slice-C19quNWM.cjs → slice-DimtxfAT.cjs} +2 -2
  288. package/dist/{slice-KiNoGwD9.js → slice-DlTEqIoI.js} +1 -1
  289. package/dist/{slice-ws8PccRX.js → slice-Dn0WojD7.js} +3 -3
  290. package/dist/{slice-BLSxLmie.cjs → slice-Dongunf7.cjs} +4 -4
  291. package/dist/{slice-B6vPum19.js → slice-DpufJAjJ.js} +2 -2
  292. package/dist/{slice-exhhmucR.cjs → slice-DtitVc9L.cjs} +7 -7
  293. package/dist/{slice-Bjj2t2ut.cjs → slice-WMMMc1Xv.cjs} +2 -2
  294. package/dist/slice-a8VuIqzS.cjs +378 -0
  295. package/dist/slice-bRASyM-m.js +354 -0
  296. package/dist/{slice-CBFrgHSH.js → slice-hNyKbDry.js} +3 -3
  297. package/dist/{InMemoryKeyAgent-pyB2gA-N.cjs → src-BayYMIjw.cjs} +20 -8228
  298. package/dist/{InMemoryKeyAgent-D-3HejxN.js → src-CgINPlSx.js} +29 -4811
  299. package/dist/store-AUlTfcI_.js +37 -0
  300. package/dist/store-C7AneHEY.cjs +66 -0
  301. package/dist/submit-BuBCVi-l.cjs +87 -0
  302. package/dist/submit-D37lxFrK.js +70 -0
  303. package/dist/submit-bitcoin-tx-DFLnhidO.js +983 -0
  304. package/dist/submit-bitcoin-tx-sih2hSfb.cjs +1049 -0
  305. package/dist/{subtractValueQuantities-DfZg6oiG.js → subtractValueQuantities-BuDJVxq6.js} +3 -22
  306. package/dist/{subtractValueQuantities-C8qDTtgH.cjs → subtractValueQuantities-CqR606HV.cjs} +2 -32
  307. package/dist/{sync-operation-utils-BrQyWFS_.cjs → sync-operation-utils--Z_IQfyW.cjs} +0 -66
  308. package/dist/{sync-operation-utils-CAaCGvEN.js → sync-operation-utils-BimBpvI3.js} +1 -37
  309. package/dist/token-color.vo-CItgoOjw.js +26 -0
  310. package/dist/token-color.vo-Ca4hUXfh.cjs +37 -0
  311. package/dist/token-id-mapper-BVau2RXa.js +16 -0
  312. package/dist/token-id-mapper-CSeLzM4o.cjs +18 -0
  313. package/dist/{token-id-mapper-pDaTxpw2.js → token-id-mapper-ClBeIdJR.js} +2 -2
  314. package/dist/{token-id-mapper-DYcd8hhQ.cjs → token-id-mapper-D0wFdbOy.cjs} +2 -2
  315. package/dist/types-BhzypKMS.cjs +15 -0
  316. package/dist/types-DTE1ctDB.js +10 -0
  317. package/dist/types-DXSxXGz0.js +12 -0
  318. package/dist/types-Dls6Z5gV.cjs +23 -0
  319. package/dist/{util-P4PX2muj.cjs → util-D1YlKzrc.cjs} +2 -2
  320. package/dist/{util-CQSJU0wT.js → util-DHxtzUzY.js} +2 -2
  321. package/dist/{utils-Bv4OHT4S.cjs → utils-DYf4iZKX.cjs} +7 -1
  322. package/dist/{utils-DrtzChYN.js → utils-DcnoETEP.js} +2 -2
  323. package/dist/utils-Du0YXRcU.cjs +112 -0
  324. package/dist/utils-fF_rnZe3.js +65 -0
  325. package/dist/v8Signatures-ClGpA8mS.cjs +71 -0
  326. package/dist/{vote-delegation-tx-builder-69gOEkCB.cjs → vote-delegation-tx-builder-BjZxCOd3.cjs} +9 -8
  327. package/dist/{vote-delegation-tx-builder-BRJ_pf-c.js → vote-delegation-tx-builder-DRJwPXkD.js} +9 -7
  328. package/dist/watch-FGE4B_Ge.js +13056 -0
  329. package/dist/watch-imlsRZDp.cjs +52207 -0
  330. package/package.json +95 -3
  331. package/dist/Address-4KjeDt_x.cjs +0 -17269
  332. package/dist/Address-_VPkf7Xh.js +0 -17101
  333. package/dist/account-guards.stable-BKyYPj4z.cjs +0 -10
  334. package/dist/account-guards.stable-BdmQ43vC.js +0 -5
  335. package/dist/init-BR9ZIbED.cjs +0 -378
  336. package/dist/init-B_k1RUN_.cjs +0 -21
  337. package/dist/init-Bs3b5ZQH.js +0 -378
  338. package/dist/init-ChfcrHgG2.cjs +0 -4354
  339. package/dist/init-D1uUMMpG.js +0 -19
  340. package/dist/init-DV1OSZiK.js +0 -4352
  341. package/dist/modules-cardano-BINzpXpk.js +0 -5454
  342. package/dist/modules-cardano-Dt8OwoQb.cjs +0 -5640
  343. package/dist/slice-Caf98m0d2.js +0 -107
  344. package/dist/slice-PM6llajQ2.cjs +0 -125
  345. /package/dist/{BigIntMath-CoJWXt1h.cjs → BigIntMath-CBciEQn2.cjs} +0 -0
  346. /package/dist/{BigIntMath-BWUJOsOW.js → BigIntMath-X3EniYDo.js} +0 -0
  347. /package/dist/{ChainId-sdLmlIRk.cjs → ChainId-CNPSU9nn.cjs} +0 -0
  348. /package/dist/{ChainId-CKbm87yQ.js → ChainId-CeoG8Sov.js} +0 -0
  349. /package/dist/{_polyfill-node.process-4fnlkbBi.cjs → _polyfill-node.process-5UxyjoHG.cjs} +0 -0
  350. /package/dist/{account-id.vo-Xpgnu-av.cjs → account-id.vo-DYZBZQsz.cjs} +0 -0
  351. /package/dist/{account-id.vo-DP0BtOoF.js → account-id.vo-KDTWJ-W5.js} +0 -0
  352. /package/dist/{actions-BNagEO6m.cjs → actions-BnHFVSr_.cjs} +0 -0
  353. /package/dist/{actions-BWTyAr7B.js → actions-Cwj0ApZf.js} +0 -0
  354. /package/dist/{asyncoption-po7-RiA5.cjs → asyncoption-CYcZNBRM.cjs} +0 -0
  355. /package/dist/{asyncoption-CzIVH5Y1.js → asyncoption-DZQGfznq.js} +0 -0
  356. /package/dist/{bignum.vo-DhhZ9HP1.js → bignum.vo-Co6tMH2q.js} +0 -0
  357. /package/dist/{bignum.vo-CpkrIXjH.cjs → bignum.vo-Du-bpvar.cjs} +0 -0
  358. /package/dist/{blockchain-network-id.vo-CbgrAY_K.js → blockchain-network-id.vo-C6Jowh8t.js} +0 -0
  359. /package/dist/{blockchain-network-id.vo-5iC6Kffo.cjs → blockchain-network-id.vo-DEQ14dYj.cjs} +0 -0
  360. /package/dist/{composite-signer-factory-DABpCe1_.js → composite-signer-factory-D9RWY-1V.js} +0 -0
  361. /package/dist/{composite-signer-factory-BizuNPP7.cjs → composite-signer-factory-v4Pxn8bA.cjs} +0 -0
  362. /package/dist/{error-ggOihIfv.cjs → error-B6wj9nPv.cjs} +0 -0
  363. /package/dist/{error-DHKO2iS4.js → error-CvEYL98P.js} +0 -0
  364. /package/dist/{esm-browser-DnXNvpcn.cjs → esm-browser-CZbMeVod.cjs} +0 -0
  365. /package/dist/{esm-browser-BBVQuyQv.js → esm-browser-DpAD_RKv.js} +0 -0
  366. /package/dist/{feature-flag-key.vo-DoGK5Bfh.js → feature-flag-key.vo-9reURsOQ.js} +0 -0
  367. /package/dist/{feature-flag-key.vo-CP1Z9s8e.cjs → feature-flag-key.vo-KTIdnzYX.cjs} +0 -0
  368. /package/dist/{first-state-of-status-Bx4-QQ5m.cjs → first-state-of-status-9ICeDNSa.cjs} +0 -0
  369. /package/dist/{first-state-of-status-D7XzEuSa.js → first-state-of-status-BscbKj_t.js} +0 -0
  370. /package/dist/{init-4319psUJ.cjs → init-BT67pd9x.cjs} +0 -0
  371. /package/dist/{init-AFUM1TSg.js → init-CHk1fvJ2.js} +0 -0
  372. /package/dist/{init-ZX90nEJe2.js → init-DIyNx6DZ.js} +0 -0
  373. /package/dist/{init-CTQ2g6Xt.js → init-DtxxFaCx.js} +0 -0
  374. /package/dist/{init-Dt1Xifg_2.cjs → init-J8QobR93.cjs} +0 -0
  375. /package/dist/{init-BNewLCqw.cjs → init-xzZPlQwB.cjs} +0 -0
  376. /package/dist/{is-redux-persist-state-DxJSsvxB.cjs → is-redux-persist-state-C5luvPEH.cjs} +0 -0
  377. /package/dist/{is-redux-persist-state-Bl2n4VMr.js → is-redux-persist-state-CjcqyCoh.js} +0 -0
  378. /package/dist/{isNotNil-CZxBMfL5.js → isNotNil-Be7gCY0m.js} +0 -0
  379. /package/dist/{isNotNil-C_SO1tcC.cjs → isNotNil-CrYIUFry.cjs} +0 -0
  380. /package/dist/{logging-BvMDKgl0.js → logging-BAMMfn5j.js} +0 -0
  381. /package/dist/{logging-Bh9ikph3.cjs → logging-CbxgIX9V.cjs} +0 -0
  382. /package/dist/{metadatum-B-sxBnSY.cjs → metadatum-BGvFqGPt.cjs} +0 -0
  383. /package/dist/{metadatum-Ego4jVas.js → metadatum-BVocMYy_.js} +0 -0
  384. /package/dist/{repo-slice-BzZQUTj8.cjs → repo-slice-BB_W-6OL.cjs} +0 -0
  385. /package/dist/{repo-slice-vCcQJotS.js → repo-slice-BQlssw9M.js} +0 -0
  386. /package/dist/{reselect-BPkMzw3k.js → reselect-JIgawvPe.js} +0 -0
  387. /package/dist/{serializable-BxFUShKY.js → serializable-F7OtYl8d.js} +0 -0
  388. /package/dist/{serializable-DWgkHhv_.cjs → serializable-n3UoxbZc.cjs} +0 -0
  389. /package/dist/{slice-DY-DNtSi.js → slice-5dGBAz6w.js} +0 -0
  390. /package/dist/{slice-BEFoeqgr.cjs → slice-BzJgg9FS.cjs} +0 -0
  391. /package/dist/{src-CPmX4KUh.cjs → src-CeBNkonz.cjs} +0 -0
  392. /package/dist/{src-XOZXPKxe.js → src-Cv1ifqbe.js} +0 -0
  393. /package/dist/{time-CQPt4FdU.js → time-ByoKevdZ.js} +0 -0
  394. /package/dist/{time-Blvoyh9G.cjs → time-qD7edGU0.cjs} +0 -0
  395. /package/dist/{time.vo-Xln4yGBU.js → time.vo-C17-tYq3.js} +0 -0
  396. /package/dist/{time.vo-rwWwJzmP.cjs → time.vo-TmYE-_Y2.cjs} +0 -0
  397. /package/dist/{toEmpty-CzmoZVLN.cjs → toEmpty-Db6V94Mf.cjs} +0 -0
  398. /package/dist/{toEmpty-DzLd-ZCi.js → toEmpty-Djj-QbpI.js} +0 -0
  399. /package/dist/{token-id.vo-l8fuSpem.cjs → token-id.vo-CZ622zcZ.cjs} +0 -0
  400. /package/dist/{token-id.vo-DMKSaMlc.js → token-id.vo-IDI9C_Qm.js} +0 -0
  401. /package/dist/{types-B61DQoFW.js → types-By-XeXWg.js} +0 -0
  402. /package/dist/{types-CUC-Kcqh.cjs → types-Cn6WlQV6.cjs} +0 -0
  403. /package/dist/{util-BV3iGOrz.cjs → util-Cp1h58uD.cjs} +0 -0
  404. /package/dist/{util-BsQKLorV.js → util-DHppXj7U.js} +0 -0
  405. /package/dist/{util-selector-CKIyoAOz.js → util-selector-BWmHpo92.js} +0 -0
  406. /package/dist/{util-selector-C9H5RsNw.cjs → util-selector-glXkO-jR.cjs} +0 -0
  407. /package/dist/{while-active-CNXeLxre.js → while-active-CDBnUlQA.js} +0 -0
  408. /package/dist/{while-active-BsDWSNrO.cjs → while-active-I2TlHtm7.cjs} +0 -0
@@ -0,0 +1,732 @@
1
+ const require_bytes_vo = require("./bytes.vo-hecRu3YZ.cjs");
2
+ const require_errors = require("./errors-BA3b8aVu.cjs");
3
+ const require_submit = require("./submit-BuBCVi-l.cjs");
4
+ const require_acc_module = require("./acc-module-NL_8mEHH.cjs");
5
+ const require_signer = require("./signer-CX21Ups_.cjs");
6
+ //#region ../../packages/contract/passport/src/value-objects/use-counter.vo.ts
7
+ /** Types a bigint as an authoriser's use counter. It checks nothing. */
8
+ const UseCounter = (value) => value;
9
+ //#endregion
10
+ //#region ../../packages/contract/passport/src/value-objects/device-epoch.vo.ts
11
+ /** Types a bigint as a device authoriser's epoch. It checks nothing. */
12
+ const DeviceEpoch = (value) => value;
13
+ //#endregion
14
+ //#region ../../packages/module/passport-account/src/acc/verifier-key-insert.ts
15
+ /**
16
+ * The operation version the vendored contract's verifier keys belong to.
17
+ * The compiler this module pins emits keys under the v7 header, which the
18
+ * ledger files under operation version 'v4'; the midnight-js maintenance
19
+ * helpers still assume 'v3' and refuse these keys before a transaction
20
+ * exists, so the insert is built against the ledger directly.
21
+ */
22
+ const VERIFIER_KEY_OPERATION_VERSION = "v4";
23
+ /** The header every verifier key of the pinned compiler starts with. */
24
+ const VERIFIER_KEY_HEADER = "midnight:verifier-key[v7]:";
25
+ const headerOf = (verifierKey) => new TextDecoder().decode(verifierKey.subarray(0, 26));
26
+ /**
27
+ * Refuses a verifier key under any other header, naming the operation.
28
+ * The ledger would refuse it too, but only once a transaction is being
29
+ * built, after the key has been downloaded and a wave planned around it.
30
+ */
31
+ const assertVerifierKeyHeader = (operation, verifierKey) => {
32
+ const header = headerOf(verifierKey);
33
+ if (header !== VERIFIER_KEY_HEADER) throw new Error(`The verifier key of '${operation}' is not a ${VERIFIER_KEY_HEADER} key, got '${header}'`);
34
+ };
35
+ /**
36
+ * The maintenance update entry that installs one operation's verifier
37
+ * key under the operation version the pinned compiler's keys belong to.
38
+ */
39
+ const verifierKeyInsert = (ledger, operation, verifierKey) => {
40
+ assertVerifierKeyHeader(operation, verifierKey);
41
+ return new ledger.VerifierKeyInsert(operation, new ledger.ContractOperationVersionedVerifierKey(VERIFIER_KEY_OPERATION_VERSION, verifierKey));
42
+ };
43
+ //#endregion
44
+ //#region ../../packages/module/passport-account/src/acc/wave-plan.ts
45
+ /**
46
+ * Most verifier key bytes one transaction may carry. A deploy or
47
+ * maintenance update above it is refused by the node for exhausting the
48
+ * block limits, so the roster is split into waves packed under this
49
+ * figure. The budget is a packing heuristic over the measured key sizes,
50
+ * not the node's own weight check.
51
+ */
52
+ const VERIFIER_BYTE_BUDGET = 15e3;
53
+ const sizeOf = (sizes, operation) => {
54
+ const size = sizes.get(operation);
55
+ if (size === void 0) throw new Error(`No verifier key size for operation '${operation}'`);
56
+ return size;
57
+ };
58
+ const assertBudget = (budget) => {
59
+ if (!Number.isFinite(budget) || budget <= 0) throw new Error(`The verifier byte budget must be a positive number, got ${budget}`);
60
+ };
61
+ /**
62
+ * Packs the operations greedily, in order, into batches no larger than
63
+ * the budget. Greedy over one fixed order keeps the plan deterministic
64
+ * for a given roster and key set, so a retry computes the same waves.
65
+ */
66
+ const packOperations = (operations, sizes, budget) => {
67
+ const batches = [];
68
+ let current = {
69
+ operations: [],
70
+ verifierBytes: 0
71
+ };
72
+ for (const operation of operations) {
73
+ const size = sizeOf(sizes, operation);
74
+ if (size > budget) throw new Error(`The verifier key of '${operation}' (${size} bytes) exceeds the ${budget} byte wave budget`);
75
+ if (current.verifierBytes + size > budget) {
76
+ batches.push(current);
77
+ current = {
78
+ operations: [],
79
+ verifierBytes: 0
80
+ };
81
+ }
82
+ current.operations.push(operation);
83
+ current.verifierBytes += size;
84
+ }
85
+ if (current.operations.length > 0) batches.push(current);
86
+ return batches;
87
+ };
88
+ /**
89
+ * The maintenance waves for the given batches. Retirement rides on the
90
+ * last of them, the last update that needs the authority; with nothing
91
+ * left to install, a retire-only update is the whole of it.
92
+ */
93
+ const toMaintenanceWaves = (batches, shouldRetire) => {
94
+ const waves = batches.map((batch) => ({
95
+ kind: "maintenance",
96
+ ...batch,
97
+ retiresAuthority: false
98
+ }));
99
+ if (!shouldRetire) return waves;
100
+ const last = waves.at(-1);
101
+ if (last) last.retiresAuthority = true;
102
+ else waves.push({
103
+ kind: "maintenance",
104
+ operations: [],
105
+ verifierBytes: 0,
106
+ retiresAuthority: true
107
+ });
108
+ return waves;
109
+ };
110
+ /**
111
+ * Plans a fresh deployment: the deploy carries the longest prefix of the
112
+ * roster under the budget, and every later wave is one maintenance update
113
+ * with the next batch. The order is the roster's, so the activation
114
+ * circuit lands in the deploy and the account is usable as early as the
115
+ * waves allow.
116
+ */
117
+ const planDeployWaves = (operations, sizes, { retireAuthority, budget = VERIFIER_BYTE_BUDGET }) => {
118
+ assertBudget(budget);
119
+ const [deploy, ...rest] = packOperations(operations, sizes, budget);
120
+ if (!deploy) throw new Error("A deployment needs at least one operation");
121
+ return [{
122
+ kind: "deploy",
123
+ ...deploy,
124
+ retiresAuthority: false
125
+ }, ...toMaintenanceWaves(rest, retireAuthority)];
126
+ };
127
+ /**
128
+ * Plans the waves a deployed contract still needs: the roster operations
129
+ * not yet installed, packed as maintenance updates, and the retirement
130
+ * when the account is to be locked and its authority is still live.
131
+ * Installed operations are read from chain rather than from any local
132
+ * count, so a wave that landed without being recorded is never sent
133
+ * twice.
134
+ *
135
+ * @throws {@link AuthorityRetiredError} when operations are missing but
136
+ * the authority is already retired: nothing can install them any more.
137
+ */
138
+ const planResumeWaves = ({ operations, sizes, installed, isAuthorityRetired, retireAuthority, budget = VERIFIER_BYTE_BUDGET }) => {
139
+ assertBudget(budget);
140
+ const installedSet = new Set(installed);
141
+ const missing = operations.filter((operation) => !installedSet.has(operation));
142
+ if (isAuthorityRetired) {
143
+ if (missing.length > 0) throw new require_errors.AuthorityRetiredError(`The maintenance authority is retired and ${missing.length} operations are not installed: ${missing.join(", ")}`);
144
+ return [];
145
+ }
146
+ return toMaintenanceWaves(packOperations(missing, sizes, budget), retireAuthority);
147
+ };
148
+ //#endregion
149
+ //#region ../../packages/module/passport-account/src/acc/deploy.ts
150
+ /** Every impure circuit of the jubjub arm, activation included. */
151
+ const JUBJUB_ARM_CIRCUITS = ["activate_initial_device", ...[
152
+ "withdraw_unshielded",
153
+ "append_inbox",
154
+ "withdraw_shielded",
155
+ "withdraw_shielded_to_contract",
156
+ "rotate_enc_key",
157
+ "add_device",
158
+ "remove_device"
159
+ ]].map((base) => `${base}_with_jubjub`);
160
+ /** Permissionless deposit circuits shared by all arms. */
161
+ const SHARED_CIRCUITS = ["deposit_unshielded", "deposit_shielded"];
162
+ /** The grant lifecycle circuits, authorised by a jubjub device. */
163
+ const GRANT_LIFECYCLE_BASES = [
164
+ "issue_grant",
165
+ "revoke_grant",
166
+ "revoke_all_grants"
167
+ ];
168
+ /** The withdrawals a grantee may run under a grant from a jubjub owner. */
169
+ const GRANT_WITHDRAWAL_BASES = [
170
+ "withdraw_unshielded",
171
+ "withdraw_shielded",
172
+ "withdraw_shielded_to_contract"
173
+ ];
174
+ /** The scoped grant circuits of the jubjub arm. */
175
+ const GRANT_CIRCUITS = [...GRANT_LIFECYCLE_BASES.map((base) => `${base}_with_jubjub`), ...GRANT_WITHDRAWAL_BASES.map((base) => `${base}_with_grant_jubjub`)];
176
+ /**
177
+ * The complete operation set this module deploys, in installation order:
178
+ * the deposits, the jubjub device arm and the jubjub grant circuits. The
179
+ * compiled contract also carries k256 and P-256 arms and the recovery
180
+ * circuits; none of their verifier keys are installed, so on an account
181
+ * deployed here only jubjub devices can ever authorise.
182
+ */
183
+ const DEPLOYED_OPERATIONS = [
184
+ ...SHARED_CIRCUITS,
185
+ ...JUBJUB_ARM_CIRCUITS,
186
+ ...GRANT_CIRCUITS
187
+ ];
188
+ const ACTIVATE_INITIAL_DEVICE_CIRCUIT = "activate_initial_device_with_jubjub";
189
+ const SALT_LENGTH = 32;
190
+ const RECOVERY_WRAP_LENGTH = 64;
191
+ const PRIVATE_STATE_ID_LENGTH$1 = 8;
192
+ /** Three days, the veto window published with the throwaway recovery. */
193
+ const VETO_WINDOW_SECONDS = 259200n;
194
+ const DEPLOY_TX_TTL_MS = 6e4;
195
+ /** How long a landed wave may take to show in the indexer's state. */
196
+ const AUTHORITY_POLL_ATTEMPTS = 60;
197
+ const AUTHORITY_POLL_DELAY_MS = 2e3;
198
+ /** How long a landed deploy may take to appear in the indexer at all. */
199
+ const INDEXED_POLL_ATTEMPTS = 30;
200
+ const defaultSleep = async (ms) => new Promise((resolve) => {
201
+ setTimeout(resolve, ms);
202
+ });
203
+ /**
204
+ * The contract's witness implementations over {@link AccountPrivateState}.
205
+ * `held_coin` serves the exact qualified coin a shielded spend consumes;
206
+ * a color the store has not captured cannot be spent by a conforming
207
+ * client, so the witness refuses it.
208
+ */
209
+ const accountWitnesses = { held_coin: (context, color) => {
210
+ const key = require_bytes_vo.HexBytes.fromByteArray(color);
211
+ const stored = context.privateState.coins[key];
212
+ if (!stored) throw new Error(`held_coin witness: no coin for color ${key} in the local store`);
213
+ return [context.privateState, {
214
+ nonce: require_bytes_vo.ByteArray.fromHex(require_bytes_vo.HexBytes(stored.nonceHex)),
215
+ color: require_bytes_vo.ByteArray.fromHex(require_bytes_vo.HexBytes(stored.colorHex)),
216
+ value: BigInt(stored.value),
217
+ mt_index: BigInt(stored.mtIndex)
218
+ }];
219
+ } };
220
+ /** The private state a handle starts from: no captured coins yet. */
221
+ const initialAccountPrivateState = () => ({ coins: {} });
222
+ const transactionTtl = () => new Date(Date.now() + DEPLOY_TX_TTL_MS);
223
+ const defaultRandomBytes = (length) => crypto.getRandomValues(new Uint8Array(length));
224
+ const importChainModules = async () => Promise.all([
225
+ import("@midnight-ntwrk/midnight-js-contracts"),
226
+ import("@midnightntwrk/ledger-v9"),
227
+ import("@midnight-ntwrk/midnight-js-network-id"),
228
+ import("@midnight-ntwrk/compact-js/effect/CompiledContract")
229
+ ]);
230
+ /**
231
+ * Names the verifier keys this build installs: the lowercase hex sha256
232
+ * over each roster operation's name and the sha256 pin of its verifier
233
+ * key, in installation order. A deployment records it once the deploy
234
+ * lands, and a resume compares it before any wave, so an account never
235
+ * holds verifier keys of two builds.
236
+ */
237
+ const deployedVerifierKeysDigest = async () => {
238
+ const pins = DEPLOYED_OPERATIONS.map((operation) => {
239
+ const pin = require_acc_module.expectedVk[operation];
240
+ if (!pin) throw new Error(`No verifier key pin for '${operation}'`);
241
+ return `${operation}:${pin}`;
242
+ });
243
+ const digest = await crypto.subtle.digest("SHA-256", new TextEncoder().encode(pins.join("\n")));
244
+ return require_bytes_vo.HexBytes.fromByteArray(new Uint8Array(digest));
245
+ };
246
+ /**
247
+ * The verifier key of every roster operation, downloaded through the zk
248
+ * config provider so each one is checked against its pin and its header,
249
+ * and the sizes the wave plan is computed from. The plan follows the
250
+ * real keys, so a roster or key-size change re-plans itself.
251
+ */
252
+ const loadVerifierKeys = async (providers, operations) => {
253
+ const zkConfig = providers.zkConfigProvider;
254
+ const keys = new Map(await Promise.all(operations.map(async (operation) => {
255
+ const key = await zkConfig.getVerifierKey(operation);
256
+ assertVerifierKeyHeader(operation, key);
257
+ return [operation, key];
258
+ })));
259
+ return {
260
+ keys,
261
+ sizes: new Map([...keys].map(([operation, key]) => [operation, key.length]))
262
+ };
263
+ };
264
+ const queryContractState = async ({ providers, address }) => providers.publicDataProvider.queryContractState(address);
265
+ /** The contract state as the indexer serves it, which must exist. */
266
+ const readProvidedState = async (chain) => {
267
+ const state = await queryContractState(chain);
268
+ if (!state) throw new require_errors.AccountContractMissingError(`No live Account Custody Contract found at ${chain.address}.`);
269
+ return state;
270
+ };
271
+ /**
272
+ * The contract state as it stands on chain, read as the ledger's class.
273
+ * The public data provider hands back a compact-runtime state; the two
274
+ * bridge by serialisation.
275
+ */
276
+ const readContractState = async (chain) => chain.ledger.ContractState.deserialize((await readProvidedState(chain)).serialize());
277
+ /**
278
+ * Blocks until the indexer serves the contract the deploy created. The
279
+ * deploy is final once its submission settles, but the indexer can lag
280
+ * the block it landed in, and the first wave reads the authority counter
281
+ * from it.
282
+ */
283
+ const awaitContractIndexed = async (chain, sleep) => {
284
+ for (let attempt = 0; attempt < INDEXED_POLL_ATTEMPTS; attempt++) {
285
+ if (await queryContractState(chain)) return;
286
+ await sleep(AUTHORITY_POLL_DELAY_MS);
287
+ }
288
+ throw new require_errors.AccountContractMissingError(`The Account Custody Contract deployed at ${chain.address} never appeared in the indexer.`);
289
+ };
290
+ /**
291
+ * Blocks until the chain shows the counter a wave advanced the authority
292
+ * to. The next update must be built against the advanced counter, and
293
+ * the indexer can lag the block the wave landed in.
294
+ */
295
+ const awaitAuthorityCounter = async (chain, expected, sleep) => {
296
+ for (let attempt = 0; attempt < AUTHORITY_POLL_ATTEMPTS; attempt++) {
297
+ const { maintenanceAuthority } = await readContractState(chain);
298
+ if (maintenanceAuthority.counter >= expected) return;
299
+ await sleep(AUTHORITY_POLL_DELAY_MS);
300
+ }
301
+ throw new Error(`The maintenance authority counter of ${chain.address} never reached ${expected}`);
302
+ };
303
+ const verifierKeyOf = (verifierKeys, operation) => {
304
+ const key = verifierKeys.get(operation);
305
+ if (!key) throw new Error(`No verifier key loaded for '${operation}'`);
306
+ return key;
307
+ };
308
+ /**
309
+ * Submits the maintenance waves in order, each one update carrying its
310
+ * batch of verifier key inserts, signed by the maintenance authority key.
311
+ * The counter is read from chain before every update because each
312
+ * applied update advances it, and a wave that retires the authority
313
+ * installs the unsatisfiable committee at the counter its own application
314
+ * leaves behind.
315
+ */
316
+ const installWaves = async ({ providers, ledger, address, networkId, waves, verifierKeys, authorityKey, sleep }) => {
317
+ const chain = {
318
+ providers,
319
+ ledger,
320
+ address
321
+ };
322
+ for (const [index, wave] of waves.entries()) {
323
+ const { maintenanceAuthority } = await readContractState(chain);
324
+ const counter = maintenanceAuthority.counter;
325
+ const updates = wave.operations.map((operation) => verifierKeyInsert(ledger, operation, verifierKeyOf(verifierKeys, operation)));
326
+ if (wave.retiresAuthority) updates.push(new ledger.ReplaceAuthority(new ledger.ContractMaintenanceAuthority([], 1, counter + 1n)));
327
+ const update = new ledger.MaintenanceUpdate(address, updates, counter);
328
+ const signed = update.addSignature(0n, ledger.signData(authorityKey, update.dataToSign));
329
+ const waveTx = ledger.Transaction.fromParts(networkId.getNetworkId(), void 0, void 0, ledger.Intent.new(transactionTtl()).addMaintenanceUpdate(signed));
330
+ require_submit.assertSubmitted(`Verifier key wave ${index + 1} of ${waves.length}`, await require_submit.submitTx(providers, { unprovenTx: waveTx }));
331
+ await awaitAuthorityCounter(chain, counter + 1n, sleep);
332
+ }
333
+ };
334
+ /**
335
+ * Connects to the deployed contract and returns the account with its
336
+ * activation call. The connection checks the pinned circuits' keys on
337
+ * chain, so it runs only once every wave is in.
338
+ */
339
+ const toDeployedAccount = async ({ providers, findContract, compiledContract, address, publicKey, salt, privateStateId, isActivated }) => {
340
+ const found = await findContract(providers, {
341
+ contractAddress: address,
342
+ compiledContract,
343
+ privateStateId,
344
+ initialPrivateState: initialAccountPrivateState()
345
+ });
346
+ return {
347
+ address,
348
+ salt,
349
+ isActivated,
350
+ activate: async () => {
351
+ const finalized = await require_submit.submitWithDustRetry(async () => found.callTx[ACTIVATE_INITIAL_DEVICE_CIRCUIT](publicKey, salt));
352
+ require_submit.assertSubmitted("Account activation", finalized);
353
+ return finalized;
354
+ }
355
+ };
356
+ };
357
+ const compileAccountContract = (CompiledContract) => CompiledContract.make("account", require_acc_module.Contract).pipe(CompiledContract.withWitnesses(accountWitnesses));
358
+ const privateStateIdFrom = (randomBytes) => `account-${require_bytes_vo.HexBytes.fromByteArray(randomBytes(PRIVATE_STATE_ID_LENGTH$1))}`;
359
+ /**
360
+ * The state the deploy carries: the constructor's data and maintenance
361
+ * authority with only the first wave's operations, each one's verifier
362
+ * key set from the downloaded, header-checked bytes. The pipeline's own
363
+ * state is not reused as is because compact-js fills verifier keys only
364
+ * for the circuits the zk config provider lists, the manifest-pinned
365
+ * ones, so the deposits would land without a key.
366
+ */
367
+ const toDeployedState = ({ ledger, fullState, operations, verifierKeys }) => {
368
+ const deployedState = new ledger.ContractState();
369
+ deployedState.data = fullState.data;
370
+ deployedState.maintenanceAuthority = fullState.maintenanceAuthority;
371
+ for (const name of operations) {
372
+ const operation = fullState.operation(name);
373
+ if (!operation) throw new Error(`Compiled account contract has no operation '${name}'`);
374
+ operation.verifierKey = verifierKeyOf(verifierKeys, name);
375
+ deployedState.setOperation(name, operation);
376
+ }
377
+ return deployedState;
378
+ };
379
+ /**
380
+ * Deploys a fresh Account Custody Contract carrying the deposits, the
381
+ * jubjub device arm and the jubjub grant circuits, and returns its
382
+ * address, the boot salt, and the activation call.
383
+ *
384
+ * The constructor cannot insert the initial device entry (the contract
385
+ * address does not exist yet inside it), so it stores a salted boot
386
+ * commitment over the authoriser's public key with no device entry yet;
387
+ * `activate` presents the same key and salt to install the real entry
388
+ * once every wave is in.
389
+ *
390
+ * The constructor also publishes the account's recovery material: a
391
+ * recovery public key, the wrap its secret is sealed under, and the veto
392
+ * window a recovery must survive. This module offers no recovery, so it
393
+ * publishes a throwaway: a fresh jubjub key whose secret is discarded
394
+ * here and a three day window. No secret is sealed, so the wrap is left
395
+ * empty: all zero bytes are the unambiguous "no container" encoding,
396
+ * whereas random bytes would be indistinguishable on chain from a sealed
397
+ * viewing secret. Nobody holds the secret, so the account is recoverable
398
+ * by nobody, exactly as before the contract gained the field.
399
+ *
400
+ * The roster's verifier keys exceed what one transaction may carry, so
401
+ * the deployment runs in waves: the deploy carries the budgeted prefix of
402
+ * the roster, and each later wave is one maintenance update inserting
403
+ * the next batch, signed by the maintenance authority the deploy minted.
404
+ * `onDeployed` is called between the deploy and the first update with
405
+ * what a retry needs ({@link PendingDeployment}), so an interruption
406
+ * leaves a deployment {@link resumeAccountDeployment} can finish.
407
+ *
408
+ * The maintenance authority's signing key is total custody: it can
409
+ * replace any operation's verifier key and release the account's assets
410
+ * around the device seam. `lockAccount` decides its fate, explicitly:
411
+ *
412
+ * - `true`: the last wave also replaces the authority with an
413
+ * unsatisfiable one (empty committee at threshold 1). No maintenance
414
+ * update can ever be signed again, so the device seam becomes the only
415
+ * way to move the account's assets. The cost is that the account can
416
+ * never receive a future arm's circuits.
417
+ * - `false`: the deploy-time authority stays live on-chain, but this
418
+ * implementation discards its signing key once the account is
419
+ * activated; the key is held only for the duration of the flow and in
420
+ * the pending record a retry reads. Keeping the authority live is the
421
+ * caller's informed choice, accepted knowing the key amounts to full
422
+ * custody wherever it survives.
423
+ */
424
+ const deployAccount = async ({ providers, authoriser, encPublicKey, lockAccount, onDeployed, randomBytes = defaultRandomBytes, sleep = defaultSleep }) => {
425
+ const [contracts, ledger, networkId, CompiledContract] = await importChainModules();
426
+ const publicKey = await authoriser.devicePublicKey();
427
+ const salt = randomBytes(SALT_LENGTH);
428
+ const bootCommitment = require_acc_module.pureCircuits.derive_boot_commitment_with_jubjub(salt, publicKey);
429
+ const recoveryPublicKey = require_signer.JubjubDevice.generate().pk;
430
+ const recoveryWrap = new Uint8Array(RECOVERY_WRAP_LENGTH);
431
+ const privateStateId = privateStateIdFrom(randomBytes);
432
+ const compiledContract = compileAccountContract(CompiledContract);
433
+ const createDeployTransaction = contracts.createUnprovenDeployTx;
434
+ const deployData = await createDeployTransaction(providers, {
435
+ compiledContract,
436
+ initialPrivateState: initialAccountPrivateState(),
437
+ args: [
438
+ bootCommitment,
439
+ encPublicKey,
440
+ recoveryPublicKey,
441
+ recoveryWrap,
442
+ VETO_WINDOW_SECONDS
443
+ ]
444
+ });
445
+ const fullState = ledger.ContractState.deserialize(deployData.public.initialContractState.serialize());
446
+ const { keys: verifierKeys, sizes } = await loadVerifierKeys(providers, DEPLOYED_OPERATIONS);
447
+ const verifierKeysDigest = await deployedVerifierKeysDigest();
448
+ const [deployWave, ...maintenanceWaves] = planDeployWaves(DEPLOYED_OPERATIONS, sizes, { retireAuthority: lockAccount });
449
+ const deploy = new ledger.ContractDeploy(toDeployedState({
450
+ ledger,
451
+ fullState,
452
+ operations: deployWave.operations,
453
+ verifierKeys
454
+ }));
455
+ const address = String(deploy.address);
456
+ require_submit.assertSubmitted("Account deploy", await require_submit.submitTx(providers, { unprovenTx: ledger.Transaction.fromParts(networkId.getNetworkId(), void 0, void 0, ledger.Intent.new(transactionTtl()).addDeploy(deploy)) }));
457
+ const authorityKey = deployData.private.signingKey;
458
+ await onDeployed(address, {
459
+ operations: [...DEPLOYED_OPERATIONS],
460
+ lockAccount,
461
+ verifierKeysDigest,
462
+ saltHex: require_bytes_vo.HexBytes.fromByteArray(salt),
463
+ authorityKey
464
+ });
465
+ await awaitContractIndexed({
466
+ providers,
467
+ ledger,
468
+ address
469
+ }, sleep);
470
+ await installWaves({
471
+ providers,
472
+ ledger,
473
+ address,
474
+ networkId,
475
+ waves: maintenanceWaves,
476
+ verifierKeys,
477
+ authorityKey,
478
+ sleep
479
+ });
480
+ return toDeployedAccount({
481
+ providers,
482
+ findContract: contracts.findDeployedContract,
483
+ compiledContract,
484
+ address,
485
+ publicKey,
486
+ salt,
487
+ privateStateId,
488
+ isActivated: false
489
+ });
490
+ };
491
+ /**
492
+ * Finishes a deployment whose waves were interrupted. The operations the
493
+ * contract already holds are read from chain, the waves still missing
494
+ * are planned from the pending roster and submitted, and the account is
495
+ * returned with its activation call; a deployment that only missed its
496
+ * activation plans no wave at all. A deployment the chain shows already
497
+ * activated, because the creation died between its activation and its
498
+ * final record write, installs nothing and is returned as activated. The
499
+ * lock choice is the one made when the deployment began; a locked
500
+ * deployment the chain shows activated is checked to have retired its
501
+ * authority, since the flow retires it before it activates. A deployment
502
+ * recorded under other verifier key pins than this build installs is
503
+ * refused before the chain is read.
504
+ *
505
+ * @throws {@link CreationArtefactMismatchError} when the recorded
506
+ * verifier key digest is missing or is not this build's.
507
+ * @throws {@link AuthorityNotRetiredError} when the deployment was to lock
508
+ * the account and the chain shows it activated with the authority live.
509
+ * @throws {@link AuthorityRetiredError} when operations are missing but
510
+ * the authority has already been retired, which no update can mend.
511
+ * @throws {@link AccountContractMissingError} when the address holds no
512
+ * live contract.
513
+ */
514
+ const resumeAccountDeployment = async ({ providers, authoriser, address, pending, randomBytes = defaultRandomBytes, sleep = defaultSleep }) => {
515
+ if (pending.verifierKeysDigest !== await deployedVerifierKeysDigest()) throw new require_errors.CreationArtefactMismatchError(`The unfinished creation of the account at ${address} was started under other verifier key pins than this build installs, so it cannot be resumed.`);
516
+ const [contracts, ledger$1, networkId, CompiledContract] = await importChainModules();
517
+ const publicKey = await authoriser.devicePublicKey();
518
+ const chain = {
519
+ providers,
520
+ ledger: ledger$1,
521
+ address
522
+ };
523
+ const provided = await readProvidedState(chain);
524
+ const isActivated = require_acc_module.ledger(provided.data).booted;
525
+ const onChain = ledger$1.ContractState.deserialize(provided.serialize());
526
+ const isAuthorityRetired = onChain.maintenanceAuthority.committee.length === 0;
527
+ if (isActivated && pending.lockAccount && !isAuthorityRetired) throw new require_errors.AuthorityNotRetiredError(`The account at ${address} was created to be locked and is activated, but its maintenance authority is still live.`);
528
+ if (!isActivated) {
529
+ const { keys: verifierKeys, sizes } = await loadVerifierKeys(providers, pending.operations);
530
+ const waves = planResumeWaves({
531
+ operations: pending.operations,
532
+ sizes,
533
+ installed: onChain.operations().map(String),
534
+ isAuthorityRetired,
535
+ retireAuthority: pending.lockAccount
536
+ });
537
+ await installWaves({
538
+ ...chain,
539
+ networkId,
540
+ waves,
541
+ verifierKeys,
542
+ authorityKey: pending.authorityKey,
543
+ sleep
544
+ });
545
+ }
546
+ return toDeployedAccount({
547
+ providers,
548
+ findContract: contracts.findDeployedContract,
549
+ compiledContract: compileAccountContract(CompiledContract),
550
+ address,
551
+ publicKey,
552
+ salt: require_bytes_vo.ByteArray.fromHex(require_bytes_vo.HexBytes(pending.saltHex)),
553
+ privateStateId: privateStateIdFrom(randomBytes),
554
+ isActivated
555
+ });
556
+ };
557
+ //#endregion
558
+ //#region ../../packages/module/passport-account/src/acc/use-counter.ts
559
+ /** How far past the last known counter the rescan probes. */
560
+ const RESCAN_LIMIT = 4096n;
561
+ /**
562
+ * Candidates batched per deviceCommitments call. 64 keeps a typical rescan
563
+ * (small counter drift) at one ceremony while it caps a full-window miss at
564
+ * 64 ceremonies instead of 4096, and the per-chunk membership check stops
565
+ * the scan before the remaining commitments are ever computed.
566
+ */
567
+ const RESCAN_CHUNK = 64n;
568
+ const isLiveEntry = (ledgerState, commitmentHex) => ledgerState.devices.member(require_bytes_vo.ByteArray.fromHex(require_bytes_vo.HexBytes(commitmentHex)));
569
+ const probeInBatches = async (deviceCommitments, { ledgerState, address, epoch, from, to }) => {
570
+ for (let chunkStart = from; chunkStart < to; chunkStart += RESCAN_CHUNK) {
571
+ const counters = [];
572
+ const chunkEnd = chunkStart + RESCAN_CHUNK < to ? chunkStart + RESCAN_CHUNK : to;
573
+ for (let candidate = chunkStart; candidate < chunkEnd; candidate++) counters.push(UseCounter(candidate));
574
+ const commitments = await deviceCommitments(address, epoch, counters);
575
+ for (const [index, useCounter] of counters.entries()) {
576
+ const commitmentHex = commitments[index];
577
+ if (isLiveEntry(ledgerState, commitmentHex)) return {
578
+ useCounter,
579
+ commitmentHex
580
+ };
581
+ }
582
+ }
583
+ };
584
+ const probeOneByOne = async ({ ledgerState, authoriser, address, epoch, from, to }) => {
585
+ for (let candidate = from; candidate < to; candidate++) {
586
+ const useCounter = UseCounter(candidate);
587
+ const commitmentHex = await authoriser.deviceCommitment(address, epoch, useCounter);
588
+ if (isLiveEntry(ledgerState, commitmentHex)) return {
589
+ useCounter,
590
+ commitmentHex
591
+ };
592
+ }
593
+ };
594
+ const probeWindow = async (props) => {
595
+ const { deviceCommitments } = props.authoriser;
596
+ return deviceCommitments ? probeInBatches(deviceCommitments, props) : probeOneByOne(props);
597
+ };
598
+ /**
599
+ * Recovers the device's current use counter from chain. The Account
600
+ * Custody Contract stores one rolling entry per device, positioned at the
601
+ * counter of its next authorisation, so the local counter can fall behind
602
+ * after out-of-band calls or lost state. Candidate counters are probed
603
+ * from the last known value (0 when unknown): the commitment computed for
604
+ * each candidate is tested for membership in the on-chain device set, and
605
+ * the first live entry wins. That window ends after RESCAN_LIMIT
606
+ * candidates, and only then are the counters below the anchor probed,
607
+ * from 0 up to it: a device removed and re-enrolled gets a fresh entry at
608
+ * a low counter while the persisted anchor still holds the old high one,
609
+ * and without the second pass such a device reads as revoked. A device
610
+ * with no entry in either pass is not registered on the account, has been
611
+ * revoked, or holds a counter beyond the probed window (a synced passkey
612
+ * used heavily on another device can outrun RESCAN_LIMIT between
613
+ * sign-ins here); the miss raises DeviceEntryNotFoundError, which names
614
+ * that ambiguity. An authoriser exposing deviceCommitments is probed in
615
+ * RESCAN_CHUNK batches so one key ceremony covers a whole chunk of
616
+ * candidates; otherwise each candidate costs one deviceCommitment call.
617
+ */
618
+ const resolveUseCounter = async ({ ledgerState, authoriser, address, knownUseCounter }) => {
619
+ const epoch = DeviceEpoch(ledgerState.device_epoch);
620
+ const anchor = knownUseCounter ?? 0n;
621
+ const probe = async (from, to) => probeWindow({
622
+ ledgerState,
623
+ authoriser,
624
+ address,
625
+ epoch,
626
+ from,
627
+ to
628
+ });
629
+ const ahead = await probe(anchor, anchor + RESCAN_LIMIT);
630
+ if (ahead) return ahead;
631
+ const behind = await probe(0n, anchor);
632
+ if (behind) return behind;
633
+ throw new require_errors.DeviceEntryNotFoundError(`No live device entry on the ledger within ${RESCAN_LIMIT} counters of the last known one (${anchor}), nor below it; the device is not registered on this account, or its counter has moved beyond the probed window.`);
634
+ };
635
+ //#endregion
636
+ //#region ../../packages/module/passport-account/src/acc/gated-call.ts
637
+ const PRIVATE_STATE_ID_LENGTH = 8;
638
+ /**
639
+ * Connects to a deployed Account Custody Contract and returns the handle
640
+ * gated calls run through. The private state starts without the account
641
+ * encryption secret: the device-management and grant lifecycle circuits
642
+ * consume no witnesses, so no coin or encryption key material is needed.
643
+ * Shielded flows will seed the viewing secret when they arrive.
644
+ */
645
+ const connectAccountHandle = async (providers, contractAddress) => {
646
+ const [contracts, CompiledContract] = await Promise.all([import("@midnight-ntwrk/midnight-js-contracts"), import("@midnight-ntwrk/compact-js/effect/CompiledContract")]);
647
+ const compiledContract = CompiledContract.make("account", require_acc_module.Contract).pipe(CompiledContract.withWitnesses(accountWitnesses));
648
+ const findContract = contracts.findDeployedContract;
649
+ return findContract(providers, {
650
+ contractAddress,
651
+ compiledContract,
652
+ privateStateId: `account-${require_bytes_vo.HexBytes.fromByteArray(crypto.getRandomValues(new Uint8Array(PRIVATE_STATE_ID_LENGTH)))}`,
653
+ initialPrivateState: initialAccountPrivateState()
654
+ });
655
+ };
656
+ /**
657
+ * Executes one authorised circuit call against a deployed Account Custody
658
+ * Contract: resolves the device's current use counter from the ledger,
659
+ * has the authoriser sign the call over the observed auth nonce, submits
660
+ * the circuit with the authorising material appended as its trailing
661
+ * arguments (pk, use counter, announcement, closing scalar, grind nonce),
662
+ * and returns the counter the device holds after the accepted call: the
663
+ * consumed one plus one.
664
+ *
665
+ * A transaction that lands with a failing status rejects instead of
666
+ * returning: the contract applied nothing, so no counter may advance and
667
+ * no roster change may be recorded for it.
668
+ */
669
+ const executeGatedCall = async ({ handle, authoriser, circuit, args, address, ledgerState, knownUseCounter }) => {
670
+ const call = handle.callTx[circuit];
671
+ if (!call) throw new Error(`Account contract handle has no circuit '${circuit}'`);
672
+ const { useCounter } = await resolveUseCounter({
673
+ ledgerState,
674
+ authoriser,
675
+ address,
676
+ knownUseCounter
677
+ });
678
+ const authorisation = await authoriser.authorise({
679
+ account: address,
680
+ circuit,
681
+ args,
682
+ witnessValues: [],
683
+ authNonce: ledgerState.auth_nonce,
684
+ useCounter
685
+ });
686
+ const finalized = await require_submit.submitWithDustRetry(async () => call(...args, ...require_signer.authArgs(authorisation)));
687
+ require_submit.assertSubmitted(`Call to ${circuit}`, finalized);
688
+ return UseCounter(useCounter + 1n);
689
+ };
690
+ //#endregion
691
+ Object.defineProperty(exports, "DeviceEpoch", {
692
+ enumerable: true,
693
+ get: function() {
694
+ return DeviceEpoch;
695
+ }
696
+ });
697
+ Object.defineProperty(exports, "UseCounter", {
698
+ enumerable: true,
699
+ get: function() {
700
+ return UseCounter;
701
+ }
702
+ });
703
+ Object.defineProperty(exports, "connectAccountHandle", {
704
+ enumerable: true,
705
+ get: function() {
706
+ return connectAccountHandle;
707
+ }
708
+ });
709
+ Object.defineProperty(exports, "deployAccount", {
710
+ enumerable: true,
711
+ get: function() {
712
+ return deployAccount;
713
+ }
714
+ });
715
+ Object.defineProperty(exports, "executeGatedCall", {
716
+ enumerable: true,
717
+ get: function() {
718
+ return executeGatedCall;
719
+ }
720
+ });
721
+ Object.defineProperty(exports, "resolveUseCounter", {
722
+ enumerable: true,
723
+ get: function() {
724
+ return resolveUseCounter;
725
+ }
726
+ });
727
+ Object.defineProperty(exports, "resumeAccountDeployment", {
728
+ enumerable: true,
729
+ get: function() {
730
+ return resumeAccountDeployment;
731
+ }
732
+ });