@cogcoin/client 0.5.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 (289) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +136 -0
  3. package/dist/app-paths.d.ts +38 -0
  4. package/dist/app-paths.js +121 -0
  5. package/dist/art/banner.txt +13 -0
  6. package/dist/art/scroll.txt +13 -0
  7. package/dist/art/train-car.txt +6 -0
  8. package/dist/art/train-smoke.txt +6 -0
  9. package/dist/art/train.txt +6 -0
  10. package/dist/bitcoind/bootstrap/chainstate.d.ts +4 -0
  11. package/dist/bitcoind/bootstrap/chainstate.js +13 -0
  12. package/dist/bitcoind/bootstrap/constants.d.ts +7 -0
  13. package/dist/bitcoind/bootstrap/constants.js +12 -0
  14. package/dist/bitcoind/bootstrap/controller.d.ts +29 -0
  15. package/dist/bitcoind/bootstrap/controller.js +101 -0
  16. package/dist/bitcoind/bootstrap/download.d.ts +2 -0
  17. package/dist/bitcoind/bootstrap/download.js +196 -0
  18. package/dist/bitcoind/bootstrap/headers.d.ts +13 -0
  19. package/dist/bitcoind/bootstrap/headers.js +61 -0
  20. package/dist/bitcoind/bootstrap/paths.d.ts +4 -0
  21. package/dist/bitcoind/bootstrap/paths.js +15 -0
  22. package/dist/bitcoind/bootstrap/snapshot-file.d.ts +7 -0
  23. package/dist/bitcoind/bootstrap/snapshot-file.js +42 -0
  24. package/dist/bitcoind/bootstrap/state.d.ts +40 -0
  25. package/dist/bitcoind/bootstrap/state.js +70 -0
  26. package/dist/bitcoind/bootstrap/types.d.ts +28 -0
  27. package/dist/bitcoind/bootstrap/types.js +1 -0
  28. package/dist/bitcoind/bootstrap.d.ts +8 -0
  29. package/dist/bitcoind/bootstrap.js +7 -0
  30. package/dist/bitcoind/client/factory.d.ts +3 -0
  31. package/dist/bitcoind/client/factory.js +57 -0
  32. package/dist/bitcoind/client/follow-block-times.d.ts +8 -0
  33. package/dist/bitcoind/client/follow-block-times.js +25 -0
  34. package/dist/bitcoind/client/follow-loop.d.ts +10 -0
  35. package/dist/bitcoind/client/follow-loop.js +57 -0
  36. package/dist/bitcoind/client/internal-types.d.ts +63 -0
  37. package/dist/bitcoind/client/internal-types.js +18 -0
  38. package/dist/bitcoind/client/managed-client.d.ts +20 -0
  39. package/dist/bitcoind/client/managed-client.js +197 -0
  40. package/dist/bitcoind/client/rate-tracker.d.ts +2 -0
  41. package/dist/bitcoind/client/rate-tracker.js +24 -0
  42. package/dist/bitcoind/client/sync-engine.d.ts +3 -0
  43. package/dist/bitcoind/client/sync-engine.js +143 -0
  44. package/dist/bitcoind/client.d.ts +1 -0
  45. package/dist/bitcoind/client.js +1 -0
  46. package/dist/bitcoind/errors.d.ts +1 -0
  47. package/dist/bitcoind/errors.js +49 -0
  48. package/dist/bitcoind/index.d.ts +2 -0
  49. package/dist/bitcoind/index.js +1 -0
  50. package/dist/bitcoind/indexer-daemon-main.d.ts +1 -0
  51. package/dist/bitcoind/indexer-daemon-main.js +472 -0
  52. package/dist/bitcoind/indexer-daemon.d.ts +107 -0
  53. package/dist/bitcoind/indexer-daemon.js +391 -0
  54. package/dist/bitcoind/node.d.ts +8 -0
  55. package/dist/bitcoind/node.js +219 -0
  56. package/dist/bitcoind/normalize.d.ts +3 -0
  57. package/dist/bitcoind/normalize.js +47 -0
  58. package/dist/bitcoind/progress/assets.d.ts +10 -0
  59. package/dist/bitcoind/progress/assets.js +90 -0
  60. package/dist/bitcoind/progress/constants.d.ts +48 -0
  61. package/dist/bitcoind/progress/constants.js +53 -0
  62. package/dist/bitcoind/progress/controller.d.ts +28 -0
  63. package/dist/bitcoind/progress/controller.js +188 -0
  64. package/dist/bitcoind/progress/follow-scene.d.ts +40 -0
  65. package/dist/bitcoind/progress/follow-scene.js +367 -0
  66. package/dist/bitcoind/progress/formatting.d.ts +23 -0
  67. package/dist/bitcoind/progress/formatting.js +227 -0
  68. package/dist/bitcoind/progress/quote-scene.d.ts +4 -0
  69. package/dist/bitcoind/progress/quote-scene.js +137 -0
  70. package/dist/bitcoind/progress/train-scene.d.ts +9 -0
  71. package/dist/bitcoind/progress/train-scene.js +92 -0
  72. package/dist/bitcoind/progress/tty-renderer.d.ts +18 -0
  73. package/dist/bitcoind/progress/tty-renderer.js +150 -0
  74. package/dist/bitcoind/progress.d.ts +7 -0
  75. package/dist/bitcoind/progress.js +7 -0
  76. package/dist/bitcoind/quotes.d.ts +24 -0
  77. package/dist/bitcoind/quotes.js +195 -0
  78. package/dist/bitcoind/rpc.d.ts +71 -0
  79. package/dist/bitcoind/rpc.js +322 -0
  80. package/dist/bitcoind/service-paths.d.ts +19 -0
  81. package/dist/bitcoind/service-paths.js +49 -0
  82. package/dist/bitcoind/service.d.ts +40 -0
  83. package/dist/bitcoind/service.js +735 -0
  84. package/dist/bitcoind/testing.d.ts +9 -0
  85. package/dist/bitcoind/testing.js +9 -0
  86. package/dist/bitcoind/types.d.ts +396 -0
  87. package/dist/bitcoind/types.js +3 -0
  88. package/dist/bytes.d.ts +9 -0
  89. package/dist/bytes.js +36 -0
  90. package/dist/cli/commands/follow.d.ts +2 -0
  91. package/dist/cli/commands/follow.js +43 -0
  92. package/dist/cli/commands/mining-admin.d.ts +2 -0
  93. package/dist/cli/commands/mining-admin.js +92 -0
  94. package/dist/cli/commands/mining-read.d.ts +2 -0
  95. package/dist/cli/commands/mining-read.js +173 -0
  96. package/dist/cli/commands/mining-runtime.d.ts +2 -0
  97. package/dist/cli/commands/mining-runtime.js +108 -0
  98. package/dist/cli/commands/status.d.ts +2 -0
  99. package/dist/cli/commands/status.js +31 -0
  100. package/dist/cli/commands/sync.d.ts +2 -0
  101. package/dist/cli/commands/sync.js +52 -0
  102. package/dist/cli/commands/wallet-admin.d.ts +2 -0
  103. package/dist/cli/commands/wallet-admin.js +175 -0
  104. package/dist/cli/commands/wallet-mutation.d.ts +2 -0
  105. package/dist/cli/commands/wallet-mutation.js +681 -0
  106. package/dist/cli/commands/wallet-read.d.ts +2 -0
  107. package/dist/cli/commands/wallet-read.js +265 -0
  108. package/dist/cli/context.d.ts +3 -0
  109. package/dist/cli/context.js +75 -0
  110. package/dist/cli/io.d.ts +3 -0
  111. package/dist/cli/io.js +12 -0
  112. package/dist/cli/mining-format.d.ts +5 -0
  113. package/dist/cli/mining-format.js +156 -0
  114. package/dist/cli/mining-json.d.ts +49 -0
  115. package/dist/cli/mining-json.js +89 -0
  116. package/dist/cli/mutation-command-groups.d.ts +15 -0
  117. package/dist/cli/mutation-command-groups.js +71 -0
  118. package/dist/cli/mutation-json.d.ts +430 -0
  119. package/dist/cli/mutation-json.js +311 -0
  120. package/dist/cli/mutation-resolved-json.d.ts +124 -0
  121. package/dist/cli/mutation-resolved-json.js +129 -0
  122. package/dist/cli/mutation-success.d.ts +20 -0
  123. package/dist/cli/mutation-success.js +47 -0
  124. package/dist/cli/mutation-text-format.d.ts +22 -0
  125. package/dist/cli/mutation-text-format.js +171 -0
  126. package/dist/cli/mutation-text-write.d.ts +13 -0
  127. package/dist/cli/mutation-text-write.js +16 -0
  128. package/dist/cli/output.d.ts +185 -0
  129. package/dist/cli/output.js +1085 -0
  130. package/dist/cli/parse.d.ts +3 -0
  131. package/dist/cli/parse.js +971 -0
  132. package/dist/cli/preview-json.d.ts +416 -0
  133. package/dist/cli/preview-json.js +293 -0
  134. package/dist/cli/prompt.d.ts +3 -0
  135. package/dist/cli/prompt.js +33 -0
  136. package/dist/cli/read-json.d.ts +187 -0
  137. package/dist/cli/read-json.js +675 -0
  138. package/dist/cli/runner.d.ts +2 -0
  139. package/dist/cli/runner.js +129 -0
  140. package/dist/cli/signals.d.ts +3 -0
  141. package/dist/cli/signals.js +63 -0
  142. package/dist/cli/status-format.d.ts +2 -0
  143. package/dist/cli/status-format.js +48 -0
  144. package/dist/cli/types.d.ts +148 -0
  145. package/dist/cli/types.js +2 -0
  146. package/dist/cli/wallet-format.d.ts +29 -0
  147. package/dist/cli/wallet-format.js +637 -0
  148. package/dist/cli/workflow-hints.d.ts +13 -0
  149. package/dist/cli/workflow-hints.js +94 -0
  150. package/dist/cli-runner.d.ts +3 -0
  151. package/dist/cli-runner.js +3 -0
  152. package/dist/cli.d.ts +2 -0
  153. package/dist/cli.js +6 -0
  154. package/dist/client/default-client.d.ts +11 -0
  155. package/dist/client/default-client.js +118 -0
  156. package/dist/client/factory.d.ts +2 -0
  157. package/dist/client/factory.js +15 -0
  158. package/dist/client/initialization.d.ts +6 -0
  159. package/dist/client/initialization.js +30 -0
  160. package/dist/client/persistence.d.ts +5 -0
  161. package/dist/client/persistence.js +28 -0
  162. package/dist/client/store-adapter.d.ts +3 -0
  163. package/dist/client/store-adapter.js +20 -0
  164. package/dist/client.d.ts +2 -0
  165. package/dist/client.js +2 -0
  166. package/dist/index.d.ts +2 -0
  167. package/dist/index.js +1 -0
  168. package/dist/passive-status.d.ts +36 -0
  169. package/dist/passive-status.js +100 -0
  170. package/dist/sqlite/better-sqlite3.d.ts +26 -0
  171. package/dist/sqlite/better-sqlite3.js +4 -0
  172. package/dist/sqlite/checkpoints.d.ts +11 -0
  173. package/dist/sqlite/checkpoints.js +27 -0
  174. package/dist/sqlite/driver.d.ts +17 -0
  175. package/dist/sqlite/driver.js +98 -0
  176. package/dist/sqlite/index.d.ts +4 -0
  177. package/dist/sqlite/index.js +9 -0
  178. package/dist/sqlite/migrate.d.ts +2 -0
  179. package/dist/sqlite/migrate.js +37 -0
  180. package/dist/sqlite/store.d.ts +3 -0
  181. package/dist/sqlite/store.js +122 -0
  182. package/dist/sqlite/tip-meta.d.ts +26 -0
  183. package/dist/sqlite/tip-meta.js +97 -0
  184. package/dist/sqlite/types.d.ts +10 -0
  185. package/dist/sqlite/types.js +1 -0
  186. package/dist/types.d.ts +55 -0
  187. package/dist/types.js +1 -0
  188. package/dist/wallet/archive.d.ts +4 -0
  189. package/dist/wallet/archive.js +39 -0
  190. package/dist/wallet/cogop/constants.d.ts +32 -0
  191. package/dist/wallet/cogop/constants.js +32 -0
  192. package/dist/wallet/cogop/index.d.ts +32 -0
  193. package/dist/wallet/cogop/index.js +213 -0
  194. package/dist/wallet/cogop/numeric.d.ts +3 -0
  195. package/dist/wallet/cogop/numeric.js +24 -0
  196. package/dist/wallet/cogop/scriptpubkey.d.ts +2 -0
  197. package/dist/wallet/cogop/scriptpubkey.js +13 -0
  198. package/dist/wallet/cogop/validate-name.d.ts +2 -0
  199. package/dist/wallet/cogop/validate-name.js +18 -0
  200. package/dist/wallet/fs/atomic.d.ts +6 -0
  201. package/dist/wallet/fs/atomic.js +46 -0
  202. package/dist/wallet/fs/lock.d.ts +19 -0
  203. package/dist/wallet/fs/lock.js +61 -0
  204. package/dist/wallet/fs/status-file.d.ts +1 -0
  205. package/dist/wallet/fs/status-file.js +4 -0
  206. package/dist/wallet/lifecycle.d.ts +193 -0
  207. package/dist/wallet/lifecycle.js +1475 -0
  208. package/dist/wallet/material.d.ts +45 -0
  209. package/dist/wallet/material.js +118 -0
  210. package/dist/wallet/mining/config.d.ts +18 -0
  211. package/dist/wallet/mining/config.js +44 -0
  212. package/dist/wallet/mining/constants.d.ts +24 -0
  213. package/dist/wallet/mining/constants.js +24 -0
  214. package/dist/wallet/mining/control.d.ts +53 -0
  215. package/dist/wallet/mining/control.js +758 -0
  216. package/dist/wallet/mining/coordination.d.ts +40 -0
  217. package/dist/wallet/mining/coordination.js +121 -0
  218. package/dist/wallet/mining/hook-protocol.d.ts +47 -0
  219. package/dist/wallet/mining/hook-protocol.js +161 -0
  220. package/dist/wallet/mining/hook-runner.d.ts +1 -0
  221. package/dist/wallet/mining/hook-runner.js +52 -0
  222. package/dist/wallet/mining/hooks.d.ts +38 -0
  223. package/dist/wallet/mining/hooks.js +520 -0
  224. package/dist/wallet/mining/index.d.ts +8 -0
  225. package/dist/wallet/mining/index.js +6 -0
  226. package/dist/wallet/mining/runner.d.ts +155 -0
  227. package/dist/wallet/mining/runner.js +2574 -0
  228. package/dist/wallet/mining/runtime-artifacts.d.ts +17 -0
  229. package/dist/wallet/mining/runtime-artifacts.js +166 -0
  230. package/dist/wallet/mining/sentences.d.ts +23 -0
  231. package/dist/wallet/mining/sentences.js +281 -0
  232. package/dist/wallet/mining/state.d.ts +9 -0
  233. package/dist/wallet/mining/state.js +75 -0
  234. package/dist/wallet/mining/types.d.ts +141 -0
  235. package/dist/wallet/mining/types.js +1 -0
  236. package/dist/wallet/mining/visualizer.d.ts +19 -0
  237. package/dist/wallet/mining/visualizer.js +134 -0
  238. package/dist/wallet/mining/worker-main.d.ts +1 -0
  239. package/dist/wallet/mining/worker-main.js +17 -0
  240. package/dist/wallet/read/context.d.ts +20 -0
  241. package/dist/wallet/read/context.js +532 -0
  242. package/dist/wallet/read/filter.d.ts +9 -0
  243. package/dist/wallet/read/filter.js +42 -0
  244. package/dist/wallet/read/index.d.ts +4 -0
  245. package/dist/wallet/read/index.js +3 -0
  246. package/dist/wallet/read/project.d.ts +11 -0
  247. package/dist/wallet/read/project.js +300 -0
  248. package/dist/wallet/read/types.d.ts +144 -0
  249. package/dist/wallet/read/types.js +1 -0
  250. package/dist/wallet/runtime.d.ts +26 -0
  251. package/dist/wallet/runtime.js +28 -0
  252. package/dist/wallet/state/crypto.d.ts +31 -0
  253. package/dist/wallet/state/crypto.js +127 -0
  254. package/dist/wallet/state/provider.d.ts +37 -0
  255. package/dist/wallet/state/provider.js +312 -0
  256. package/dist/wallet/state/session.d.ts +12 -0
  257. package/dist/wallet/state/session.js +23 -0
  258. package/dist/wallet/state/storage.d.ts +19 -0
  259. package/dist/wallet/state/storage.js +55 -0
  260. package/dist/wallet/tx/anchor.d.ts +40 -0
  261. package/dist/wallet/tx/anchor.js +1210 -0
  262. package/dist/wallet/tx/cog.d.ts +92 -0
  263. package/dist/wallet/tx/cog.js +1055 -0
  264. package/dist/wallet/tx/common.d.ts +89 -0
  265. package/dist/wallet/tx/common.js +156 -0
  266. package/dist/wallet/tx/confirm.d.ts +15 -0
  267. package/dist/wallet/tx/confirm.js +24 -0
  268. package/dist/wallet/tx/domain-admin.d.ts +105 -0
  269. package/dist/wallet/tx/domain-admin.js +869 -0
  270. package/dist/wallet/tx/domain-market.d.ts +112 -0
  271. package/dist/wallet/tx/domain-market.js +1365 -0
  272. package/dist/wallet/tx/field.d.ts +101 -0
  273. package/dist/wallet/tx/field.js +1853 -0
  274. package/dist/wallet/tx/identity-selector.d.ts +12 -0
  275. package/dist/wallet/tx/identity-selector.js +52 -0
  276. package/dist/wallet/tx/index.d.ts +7 -0
  277. package/dist/wallet/tx/index.js +7 -0
  278. package/dist/wallet/tx/journal.d.ts +5 -0
  279. package/dist/wallet/tx/journal.js +31 -0
  280. package/dist/wallet/tx/register.d.ts +68 -0
  281. package/dist/wallet/tx/register.js +952 -0
  282. package/dist/wallet/tx/reputation.d.ts +72 -0
  283. package/dist/wallet/tx/reputation.js +693 -0
  284. package/dist/wallet/tx/targets.d.ts +7 -0
  285. package/dist/wallet/tx/targets.js +122 -0
  286. package/dist/wallet/types.d.ts +249 -0
  287. package/dist/wallet/types.js +1 -0
  288. package/dist/writing_quotes.json +1654 -0
  289. package/package.json +78 -0
@@ -0,0 +1,416 @@
1
+ import type { AnchorDomainResult, CogMutationResult, DomainAdminMutationResult, DomainMarketMutationResult, FieldMutationResult, RegisterDomainResult, ReputationMutationResult } from "../wallet/tx/index.js";
2
+ import type { WalletRepairResult } from "../wallet/lifecycle.js";
3
+ import type { MiningControlPlaneView, MiningRuntimeStatusV1 } from "../wallet/mining/index.js";
4
+ export declare function buildSingleTxMutationPreviewData(options: {
5
+ kind: string;
6
+ localStatus: string;
7
+ txid: string | null | undefined;
8
+ wtxid?: string | null | undefined;
9
+ reusedExisting: boolean;
10
+ intent: Record<string, unknown>;
11
+ journalKind?: string | null;
12
+ intentFingerprintHex?: string | null;
13
+ }): {
14
+ resultType: "single-tx-mutation";
15
+ mutation: {
16
+ kind: string;
17
+ journalKind: string;
18
+ localStatus: string;
19
+ reusedExisting: boolean;
20
+ intentFingerprintHex: string | null;
21
+ };
22
+ transaction: {
23
+ txid: string | null;
24
+ wtxid: string | null;
25
+ };
26
+ intent: Record<string, unknown>;
27
+ };
28
+ export declare function buildFamilyMutationPreviewData(options: {
29
+ familyKind: string;
30
+ familyStatus: string;
31
+ reusedExisting: boolean;
32
+ intent: Record<string, unknown>;
33
+ currentStep?: string | null;
34
+ tx1Txid?: string | null | undefined;
35
+ tx1Wtxid?: string | null | undefined;
36
+ tx2Txid?: string | null | undefined;
37
+ tx2Wtxid?: string | null | undefined;
38
+ intentFingerprintHex?: string | null;
39
+ }): {
40
+ resultType: "family-mutation";
41
+ family: {
42
+ kind: string;
43
+ localStatus: string;
44
+ reusedExisting: boolean;
45
+ currentStep: string | null;
46
+ intentFingerprintHex: string | null;
47
+ };
48
+ transactions: {
49
+ tx1: {
50
+ txid: string | null;
51
+ wtxid: string | null;
52
+ };
53
+ tx2: {
54
+ txid: string | null;
55
+ wtxid: string | null;
56
+ };
57
+ };
58
+ intent: Record<string, unknown>;
59
+ };
60
+ export declare function buildStateChangePreviewData(options: {
61
+ kind: string;
62
+ state: Record<string, unknown>;
63
+ before?: Record<string, unknown> | null;
64
+ after?: Record<string, unknown> | null;
65
+ }): {
66
+ resultType: "state-change";
67
+ stateChange: {
68
+ kind: string;
69
+ before: Record<string, unknown> | null;
70
+ after: Record<string, unknown> | null;
71
+ };
72
+ state: Record<string, unknown>;
73
+ };
74
+ export declare function buildRegisterPreviewData(result: RegisterDomainResult, options: {
75
+ forceRace: boolean;
76
+ fromIdentity: string | null;
77
+ }): {
78
+ resolved: {
79
+ path: "root" | "subdomain";
80
+ parentDomainName: string | null;
81
+ sender: {
82
+ selector: string;
83
+ localIndex: number;
84
+ scriptPubKeyHex: string;
85
+ address: string;
86
+ };
87
+ economicEffect: {
88
+ kind: "treasury-payment" | "cog-burn";
89
+ amount: string | null;
90
+ };
91
+ };
92
+ resultType: "single-tx-mutation";
93
+ mutation: {
94
+ kind: string;
95
+ journalKind: string;
96
+ localStatus: string;
97
+ reusedExisting: boolean;
98
+ intentFingerprintHex: string | null;
99
+ };
100
+ transaction: {
101
+ txid: string | null;
102
+ wtxid: string | null;
103
+ };
104
+ intent: Record<string, unknown>;
105
+ };
106
+ export declare function buildDomainMarketPreviewData(result: DomainMarketMutationResult, options: {
107
+ commandKind: "transfer" | "sell" | "unsell" | "buy";
108
+ fromIdentity?: string | null;
109
+ }): {
110
+ resolved: {
111
+ buyer: {
112
+ selector: string;
113
+ localIndex: number;
114
+ scriptPubKeyHex: string;
115
+ address: string;
116
+ } | null;
117
+ seller: {
118
+ scriptPubKeyHex: string;
119
+ address: string | null;
120
+ } | null;
121
+ sender?: undefined;
122
+ recipient?: undefined;
123
+ economicEffect?: undefined;
124
+ } | {
125
+ sender: {
126
+ selector: string;
127
+ localIndex: number;
128
+ scriptPubKeyHex: string;
129
+ address: string;
130
+ };
131
+ recipient: {
132
+ scriptPubKeyHex: string;
133
+ address: string | null;
134
+ opaque: boolean;
135
+ } | null;
136
+ economicEffect: {
137
+ kind: "ownership-transfer";
138
+ clearsListing: boolean;
139
+ listedPriceCogtoshi?: undefined;
140
+ } | {
141
+ kind: "listing-set" | "listing-clear";
142
+ listedPriceCogtoshi: string;
143
+ clearsListing?: undefined;
144
+ };
145
+ buyer?: undefined;
146
+ seller?: undefined;
147
+ } | null;
148
+ resultType: "single-tx-mutation";
149
+ mutation: {
150
+ kind: string;
151
+ journalKind: string;
152
+ localStatus: string;
153
+ reusedExisting: boolean;
154
+ intentFingerprintHex: string | null;
155
+ };
156
+ transaction: {
157
+ txid: string | null;
158
+ wtxid: string | null;
159
+ };
160
+ intent: Record<string, unknown>;
161
+ };
162
+ export declare function buildCogPreviewData(result: CogMutationResult, options: {
163
+ commandKind: "send" | "claim" | "reclaim" | "cog-lock";
164
+ fromIdentity: string | null;
165
+ timeoutBlocksOrDuration?: string | null;
166
+ timeoutHeight?: string | null;
167
+ conditionHex?: string | null;
168
+ }): {
169
+ resolved: {
170
+ claimPath?: import("../wallet/tx/cog.js").CogResolvedClaimPath | null | undefined;
171
+ sender: {
172
+ selector: string;
173
+ localIndex: number;
174
+ scriptPubKeyHex: string;
175
+ address: string;
176
+ };
177
+ };
178
+ resultType: "single-tx-mutation";
179
+ mutation: {
180
+ kind: string;
181
+ journalKind: string;
182
+ localStatus: string;
183
+ reusedExisting: boolean;
184
+ intentFingerprintHex: string | null;
185
+ };
186
+ transaction: {
187
+ txid: string | null;
188
+ wtxid: string | null;
189
+ };
190
+ intent: Record<string, unknown>;
191
+ };
192
+ export declare function buildAnchorPreviewData(result: AnchorDomainResult, options: {
193
+ foundingMessageText: string | null;
194
+ }): {
195
+ resultType: "family-mutation";
196
+ family: {
197
+ kind: string;
198
+ localStatus: string;
199
+ reusedExisting: boolean;
200
+ currentStep: string | null;
201
+ intentFingerprintHex: string | null;
202
+ };
203
+ transactions: {
204
+ tx1: {
205
+ txid: string | null;
206
+ wtxid: string | null;
207
+ };
208
+ tx2: {
209
+ txid: string | null;
210
+ wtxid: string | null;
211
+ };
212
+ };
213
+ intent: Record<string, unknown>;
214
+ };
215
+ export declare function buildDomainAdminPreviewData(result: DomainAdminMutationResult, options: {
216
+ commandKind: "domain-endpoint-set" | "domain-endpoint-clear" | "domain-delegate-set" | "domain-delegate-clear" | "domain-miner-set" | "domain-miner-clear" | "domain-canonical";
217
+ }): {
218
+ resolved: {
219
+ sender: {
220
+ selector: string;
221
+ localIndex: number;
222
+ scriptPubKeyHex: string;
223
+ address: string;
224
+ };
225
+ target: {
226
+ scriptPubKeyHex: string;
227
+ address: string | null;
228
+ opaque: boolean;
229
+ } | null;
230
+ effect: {
231
+ kind: "endpoint-set";
232
+ byteLength: number;
233
+ } | {
234
+ kind: "endpoint-clear" | "delegate-set" | "delegate-clear" | "miner-set" | "miner-clear" | "canonicalize-owner";
235
+ byteLength?: undefined;
236
+ };
237
+ } | null;
238
+ resultType: "single-tx-mutation";
239
+ mutation: {
240
+ kind: string;
241
+ journalKind: string;
242
+ localStatus: string;
243
+ reusedExisting: boolean;
244
+ intentFingerprintHex: string | null;
245
+ };
246
+ transaction: {
247
+ txid: string | null;
248
+ wtxid: string | null;
249
+ };
250
+ intent: Record<string, unknown>;
251
+ };
252
+ export declare function buildFieldPreviewData(result: FieldMutationResult): {
253
+ resolved: {
254
+ sender: {
255
+ selector: string;
256
+ localIndex: number;
257
+ scriptPubKeyHex: string;
258
+ address: string;
259
+ };
260
+ path: import("../wallet/tx/field.js").FieldResolvedPath;
261
+ value: {
262
+ format: number;
263
+ byteLength: number;
264
+ } | null;
265
+ effect: {
266
+ kind: "create-and-initialize-field";
267
+ tx1BurnCogtoshi: "100";
268
+ tx2AdditionalBurnCogtoshi: "1";
269
+ burnCogtoshi?: undefined;
270
+ } | {
271
+ kind: "create-empty-field" | "write-field-value" | "clear-field-value";
272
+ burnCogtoshi: "0" | "1" | "100";
273
+ tx1BurnCogtoshi?: undefined;
274
+ tx2AdditionalBurnCogtoshi?: undefined;
275
+ };
276
+ } | null;
277
+ resultType: "family-mutation";
278
+ family: {
279
+ kind: string;
280
+ localStatus: string;
281
+ reusedExisting: boolean;
282
+ currentStep: string | null;
283
+ intentFingerprintHex: string | null;
284
+ };
285
+ transactions: {
286
+ tx1: {
287
+ txid: string | null;
288
+ wtxid: string | null;
289
+ };
290
+ tx2: {
291
+ txid: string | null;
292
+ wtxid: string | null;
293
+ };
294
+ };
295
+ intent: Record<string, unknown>;
296
+ } | {
297
+ resolved: {
298
+ sender: {
299
+ selector: string;
300
+ localIndex: number;
301
+ scriptPubKeyHex: string;
302
+ address: string;
303
+ };
304
+ path: import("../wallet/tx/field.js").FieldResolvedPath;
305
+ value: {
306
+ format: number;
307
+ byteLength: number;
308
+ } | null;
309
+ effect: {
310
+ kind: "create-and-initialize-field";
311
+ tx1BurnCogtoshi: "100";
312
+ tx2AdditionalBurnCogtoshi: "1";
313
+ burnCogtoshi?: undefined;
314
+ } | {
315
+ kind: "create-empty-field" | "write-field-value" | "clear-field-value";
316
+ burnCogtoshi: "0" | "1" | "100";
317
+ tx1BurnCogtoshi?: undefined;
318
+ tx2AdditionalBurnCogtoshi?: undefined;
319
+ };
320
+ } | null;
321
+ resultType: "single-tx-mutation";
322
+ mutation: {
323
+ kind: string;
324
+ journalKind: string;
325
+ localStatus: string;
326
+ reusedExisting: boolean;
327
+ intentFingerprintHex: string | null;
328
+ };
329
+ transaction: {
330
+ txid: string | null;
331
+ wtxid: string | null;
332
+ };
333
+ intent: Record<string, unknown>;
334
+ };
335
+ export declare function buildReputationPreviewData(result: ReputationMutationResult): {
336
+ resolved: {
337
+ sender: {
338
+ selector: string;
339
+ localIndex: number;
340
+ scriptPubKeyHex: string;
341
+ address: string;
342
+ };
343
+ effect: {
344
+ kind: "give-support" | "revoke-support";
345
+ burnCogtoshi: string;
346
+ };
347
+ review: {
348
+ included: boolean;
349
+ byteLength: number | null;
350
+ };
351
+ selfStake: boolean;
352
+ } | null;
353
+ resultType: "single-tx-mutation";
354
+ mutation: {
355
+ kind: string;
356
+ journalKind: string;
357
+ localStatus: string;
358
+ reusedExisting: boolean;
359
+ intentFingerprintHex: string | null;
360
+ };
361
+ transaction: {
362
+ txid: string | null;
363
+ wtxid: string | null;
364
+ };
365
+ intent: Record<string, unknown>;
366
+ };
367
+ export declare function buildWalletLockPreviewData(result: {
368
+ walletRootId: string | null;
369
+ }): {
370
+ resultType: "state-change";
371
+ stateChange: {
372
+ kind: string;
373
+ before: Record<string, unknown> | null;
374
+ after: Record<string, unknown> | null;
375
+ };
376
+ state: Record<string, unknown>;
377
+ };
378
+ export declare function buildRepairPreviewData(result: WalletRepairResult): {
379
+ resultType: "state-change";
380
+ stateChange: {
381
+ kind: string;
382
+ before: Record<string, unknown> | null;
383
+ after: Record<string, unknown> | null;
384
+ };
385
+ state: Record<string, unknown>;
386
+ };
387
+ export declare function buildHooksPreviewData(kind: "hooks-enable-mining" | "hooks-disable-mining" | "mine-setup", view: MiningControlPlaneView): {
388
+ resultType: "state-change";
389
+ stateChange: {
390
+ kind: string;
391
+ before: Record<string, unknown> | null;
392
+ after: Record<string, unknown> | null;
393
+ };
394
+ state: Record<string, unknown>;
395
+ };
396
+ export declare function buildMineStartPreviewData(result: {
397
+ started: boolean;
398
+ snapshot: MiningRuntimeStatusV1 | null;
399
+ }): {
400
+ resultType: "state-change";
401
+ stateChange: {
402
+ kind: string;
403
+ before: Record<string, unknown> | null;
404
+ after: Record<string, unknown> | null;
405
+ };
406
+ state: Record<string, unknown>;
407
+ };
408
+ export declare function buildMineStopPreviewData(snapshot: MiningRuntimeStatusV1 | null): {
409
+ resultType: "state-change";
410
+ stateChange: {
411
+ kind: string;
412
+ before: Record<string, unknown> | null;
413
+ after: Record<string, unknown> | null;
414
+ };
415
+ state: Record<string, unknown>;
416
+ };
@@ -0,0 +1,293 @@
1
+ import { buildCogResolvedJson, buildDomainAdminResolvedJson, buildDomainMarketResolvedJson, buildFieldResolvedJson, buildRegisterResolvedJson, buildReputationResolvedJson, decimalOrNull, } from "./mutation-resolved-json.js";
2
+ function normalizeTxSummary(txid, wtxid) {
3
+ return {
4
+ txid: txid ?? null,
5
+ wtxid: wtxid ?? null,
6
+ };
7
+ }
8
+ export function buildSingleTxMutationPreviewData(options) {
9
+ return {
10
+ resultType: "single-tx-mutation",
11
+ mutation: {
12
+ kind: options.kind,
13
+ journalKind: options.journalKind ?? options.kind,
14
+ localStatus: options.localStatus,
15
+ reusedExisting: options.reusedExisting,
16
+ intentFingerprintHex: options.intentFingerprintHex ?? null,
17
+ },
18
+ transaction: normalizeTxSummary(options.txid, options.wtxid),
19
+ intent: options.intent,
20
+ };
21
+ }
22
+ export function buildFamilyMutationPreviewData(options) {
23
+ return {
24
+ resultType: "family-mutation",
25
+ family: {
26
+ kind: options.familyKind,
27
+ localStatus: options.familyStatus,
28
+ reusedExisting: options.reusedExisting,
29
+ currentStep: options.currentStep ?? null,
30
+ intentFingerprintHex: options.intentFingerprintHex ?? null,
31
+ },
32
+ transactions: {
33
+ tx1: normalizeTxSummary(options.tx1Txid, options.tx1Wtxid),
34
+ tx2: normalizeTxSummary(options.tx2Txid, options.tx2Wtxid),
35
+ },
36
+ intent: options.intent,
37
+ };
38
+ }
39
+ export function buildStateChangePreviewData(options) {
40
+ return {
41
+ resultType: "state-change",
42
+ stateChange: {
43
+ kind: options.kind,
44
+ before: options.before ?? null,
45
+ after: options.after ?? null,
46
+ },
47
+ state: options.state,
48
+ };
49
+ }
50
+ export function buildRegisterPreviewData(result, options) {
51
+ return {
52
+ ...buildSingleTxMutationPreviewData({
53
+ kind: "register",
54
+ localStatus: result.status,
55
+ txid: result.txid,
56
+ reusedExisting: result.reusedExisting,
57
+ intent: {
58
+ domainName: result.domainName,
59
+ registerKind: result.registerKind,
60
+ forceRace: options.forceRace,
61
+ fromIdentitySelector: options.fromIdentity,
62
+ },
63
+ }),
64
+ resolved: buildRegisterResolvedJson(result),
65
+ };
66
+ }
67
+ export function buildDomainMarketPreviewData(result, options) {
68
+ const intent = {
69
+ domainName: result.domainName,
70
+ listedPriceCogtoshi: decimalOrNull(result.listedPriceCogtoshi),
71
+ recipientScriptPubKeyHex: result.recipientScriptPubKeyHex ?? null,
72
+ };
73
+ if (options.commandKind === "buy") {
74
+ intent.fromIdentitySelector = options.fromIdentity ?? null;
75
+ }
76
+ const data = buildSingleTxMutationPreviewData({
77
+ kind: options.commandKind,
78
+ localStatus: result.status,
79
+ txid: result.txid,
80
+ reusedExisting: result.reusedExisting,
81
+ intent,
82
+ journalKind: result.kind,
83
+ });
84
+ if (options.commandKind !== "buy") {
85
+ return {
86
+ ...data,
87
+ resolved: buildDomainMarketResolvedJson(result, options.commandKind),
88
+ };
89
+ }
90
+ return {
91
+ ...data,
92
+ resolved: buildDomainMarketResolvedJson(result, options.commandKind),
93
+ };
94
+ }
95
+ export function buildCogPreviewData(result, options) {
96
+ const data = buildSingleTxMutationPreviewData({
97
+ kind: options.commandKind,
98
+ localStatus: result.status,
99
+ txid: result.txid,
100
+ reusedExisting: result.reusedExisting,
101
+ intent: {
102
+ amountCogtoshi: decimalOrNull(result.amountCogtoshi),
103
+ recipientScriptPubKeyHex: result.recipientScriptPubKeyHex ?? null,
104
+ recipientDomainName: result.recipientDomainName ?? null,
105
+ lockId: result.lockId ?? null,
106
+ fromIdentitySelector: options.fromIdentity,
107
+ timeoutBlocksOrDuration: options.timeoutBlocksOrDuration ?? null,
108
+ timeoutHeight: options.timeoutHeight ?? null,
109
+ conditionHex: options.conditionHex ?? null,
110
+ },
111
+ journalKind: result.kind,
112
+ });
113
+ return {
114
+ ...data,
115
+ resolved: buildCogResolvedJson(result, options.commandKind),
116
+ };
117
+ }
118
+ export function buildAnchorPreviewData(result, options) {
119
+ return buildFamilyMutationPreviewData({
120
+ familyKind: "anchor",
121
+ familyStatus: result.status,
122
+ reusedExisting: result.reusedExisting,
123
+ currentStep: result.status === "confirmed" ? "confirmed" : "submitted",
124
+ tx1Txid: result.tx1Txid,
125
+ tx2Txid: result.tx2Txid,
126
+ intent: {
127
+ domainName: result.domainName,
128
+ dedicatedIndex: result.dedicatedIndex,
129
+ foundingMessageIncluded: options.foundingMessageText !== null,
130
+ },
131
+ });
132
+ }
133
+ export function buildDomainAdminPreviewData(result, options) {
134
+ const data = buildSingleTxMutationPreviewData({
135
+ kind: options.commandKind,
136
+ localStatus: result.status,
137
+ txid: result.txid,
138
+ reusedExisting: result.reusedExisting,
139
+ intent: {
140
+ domainName: result.domainName,
141
+ recipientScriptPubKeyHex: result.recipientScriptPubKeyHex ?? null,
142
+ endpointValueHex: result.endpointValueHex ?? null,
143
+ endpointByteLength: result.endpointValueHex === null || result.endpointValueHex === undefined
144
+ ? null
145
+ : result.endpointValueHex.length / 2,
146
+ },
147
+ journalKind: result.kind,
148
+ });
149
+ return {
150
+ ...data,
151
+ resolved: buildDomainAdminResolvedJson(result),
152
+ };
153
+ }
154
+ export function buildFieldPreviewData(result) {
155
+ if (result.family) {
156
+ return {
157
+ ...buildFamilyMutationPreviewData({
158
+ familyKind: "field",
159
+ familyStatus: result.status,
160
+ reusedExisting: result.reusedExisting,
161
+ currentStep: result.status === "confirmed" ? "confirmed" : "submitted",
162
+ tx1Txid: result.tx1Txid ?? null,
163
+ tx2Txid: result.tx2Txid ?? null,
164
+ intent: {
165
+ domainName: result.domainName,
166
+ fieldName: result.fieldName,
167
+ fieldId: result.fieldId,
168
+ permanent: result.permanent,
169
+ format: result.format,
170
+ },
171
+ }),
172
+ resolved: buildFieldResolvedJson(result),
173
+ };
174
+ }
175
+ return {
176
+ ...buildSingleTxMutationPreviewData({
177
+ kind: result.kind,
178
+ localStatus: result.status,
179
+ txid: result.txid,
180
+ reusedExisting: result.reusedExisting,
181
+ intent: {
182
+ domainName: result.domainName,
183
+ fieldName: result.fieldName,
184
+ fieldId: result.fieldId,
185
+ permanent: result.permanent,
186
+ format: result.format,
187
+ },
188
+ }),
189
+ resolved: buildFieldResolvedJson(result),
190
+ };
191
+ }
192
+ export function buildReputationPreviewData(result) {
193
+ const data = buildSingleTxMutationPreviewData({
194
+ kind: result.kind === "give" ? "rep-give" : "rep-revoke",
195
+ localStatus: result.status,
196
+ txid: result.txid,
197
+ reusedExisting: result.reusedExisting,
198
+ intent: {
199
+ sourceDomainName: result.sourceDomainName,
200
+ targetDomainName: result.targetDomainName,
201
+ amountCogtoshi: result.amountCogtoshi.toString(),
202
+ reviewIncluded: result.reviewIncluded,
203
+ },
204
+ });
205
+ return {
206
+ ...data,
207
+ resolved: buildReputationResolvedJson(result),
208
+ };
209
+ }
210
+ export function buildWalletLockPreviewData(result) {
211
+ return buildStateChangePreviewData({
212
+ kind: "wallet-lock",
213
+ state: {
214
+ walletRootId: result.walletRootId,
215
+ locked: true,
216
+ },
217
+ });
218
+ }
219
+ export function buildRepairPreviewData(result) {
220
+ return buildStateChangePreviewData({
221
+ kind: "repair",
222
+ state: {
223
+ walletRootId: result.walletRootId,
224
+ recoveredFromBackup: result.recoveredFromBackup,
225
+ recreatedManagedCoreWallet: result.recreatedManagedCoreWallet,
226
+ bitcoindServiceAction: result.bitcoindServiceAction,
227
+ bitcoindCompatibilityIssue: result.bitcoindCompatibilityIssue,
228
+ managedCoreReplicaAction: result.managedCoreReplicaAction,
229
+ bitcoindPostRepairHealth: result.bitcoindPostRepairHealth,
230
+ resetIndexerDatabase: result.resetIndexerDatabase,
231
+ indexerDaemonAction: result.indexerDaemonAction,
232
+ indexerCompatibilityIssue: result.indexerCompatibilityIssue,
233
+ indexerPostRepairHealth: result.indexerPostRepairHealth,
234
+ miningPreRepairRunMode: result.miningPreRepairRunMode,
235
+ miningResumeAction: result.miningResumeAction,
236
+ miningPostRepairRunMode: result.miningPostRepairRunMode,
237
+ miningResumeError: result.miningResumeError,
238
+ note: result.note,
239
+ },
240
+ });
241
+ }
242
+ function summarizeRuntime(snapshot) {
243
+ if (snapshot === null) {
244
+ return null;
245
+ }
246
+ return {
247
+ runMode: snapshot.runMode,
248
+ miningState: snapshot.miningState,
249
+ currentPhase: snapshot.currentPhase,
250
+ backgroundWorkerPid: snapshot.backgroundWorkerPid,
251
+ backgroundWorkerRunId: snapshot.backgroundWorkerRunId,
252
+ note: snapshot.note,
253
+ };
254
+ }
255
+ export function buildHooksPreviewData(kind, view) {
256
+ return buildStateChangePreviewData({
257
+ kind,
258
+ state: {
259
+ hook: {
260
+ mode: view.hook.mode,
261
+ validationState: view.hook.validationState,
262
+ operatorValidationState: view.hook.operatorValidationState,
263
+ validationError: view.hook.validationError,
264
+ cooldownActive: view.hook.cooldownActive,
265
+ },
266
+ provider: {
267
+ configured: view.provider.configured,
268
+ provider: view.provider.provider,
269
+ status: view.provider.status,
270
+ },
271
+ runtime: summarizeRuntime(view.runtime),
272
+ },
273
+ });
274
+ }
275
+ export function buildMineStartPreviewData(result) {
276
+ return buildStateChangePreviewData({
277
+ kind: "mine-start",
278
+ state: {
279
+ started: result.started,
280
+ runtime: summarizeRuntime(result.snapshot),
281
+ },
282
+ });
283
+ }
284
+ export function buildMineStopPreviewData(snapshot) {
285
+ return buildStateChangePreviewData({
286
+ kind: "mine-stop",
287
+ state: {
288
+ stopped: snapshot !== null,
289
+ runtime: summarizeRuntime(snapshot),
290
+ note: snapshot?.note ?? "Background mining was not active.",
291
+ },
292
+ });
293
+ }
@@ -0,0 +1,3 @@
1
+ import type { WalletPrompter } from "../wallet/lifecycle.js";
2
+ import type { ReadableLike, WritableLike } from "./types.js";
3
+ export declare function createTerminalPrompter(input: NodeJS.ReadStream | ReadableLike, output: NodeJS.WriteStream | WritableLike): WalletPrompter;