@cogcoin/client 1.1.7 → 1.1.9

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 (284) hide show
  1. package/README.md +1 -1
  2. package/dist/bitcoind/service.js +1 -1
  3. package/dist/cli/commands/mining-read.js +1 -1
  4. package/dist/cli/commands/wallet-mutation/anchor.d.ts +2 -0
  5. package/dist/cli/commands/wallet-mutation/anchor.js +33 -0
  6. package/dist/cli/commands/wallet-mutation/bitcoin-transfer.d.ts +2 -0
  7. package/dist/cli/commands/wallet-mutation/bitcoin-transfer.js +32 -0
  8. package/dist/cli/commands/wallet-mutation/cog.d.ts +2 -0
  9. package/dist/cli/commands/wallet-mutation/cog.js +131 -0
  10. package/dist/cli/commands/wallet-mutation/context.d.ts +3 -0
  11. package/dist/cli/commands/wallet-mutation/context.js +18 -0
  12. package/dist/cli/commands/wallet-mutation/domain-admin.d.ts +2 -0
  13. package/dist/cli/commands/wallet-mutation/domain-admin.js +173 -0
  14. package/dist/cli/commands/wallet-mutation/domain-market.d.ts +2 -0
  15. package/dist/cli/commands/wallet-mutation/domain-market.js +107 -0
  16. package/dist/cli/commands/wallet-mutation/field.d.ts +2 -0
  17. package/dist/cli/commands/wallet-mutation/field.js +125 -0
  18. package/dist/cli/commands/wallet-mutation/register.d.ts +2 -0
  19. package/dist/cli/commands/wallet-mutation/register.js +38 -0
  20. package/dist/cli/commands/wallet-mutation/registry.d.ts +3 -0
  21. package/dist/cli/commands/wallet-mutation/registry.js +39 -0
  22. package/dist/cli/commands/wallet-mutation/reputation.d.ts +2 -0
  23. package/dist/cli/commands/wallet-mutation/reputation.js +57 -0
  24. package/dist/cli/commands/wallet-mutation/types.d.ts +32 -0
  25. package/dist/cli/commands/wallet-mutation/types.js +1 -0
  26. package/dist/cli/commands/wallet-mutation.js +13 -765
  27. package/dist/cli/commands/wallet-read.js +4 -4
  28. package/dist/cli/mutation-success.d.ts +0 -2
  29. package/dist/cli/output/classify.d.ts +7 -0
  30. package/dist/cli/output/classify.js +94 -0
  31. package/dist/cli/output/render.d.ts +2 -0
  32. package/dist/cli/output/render.js +13 -0
  33. package/dist/cli/output/rules/cli-surface.d.ts +2 -0
  34. package/dist/cli/output/rules/cli-surface.js +110 -0
  35. package/dist/cli/output/rules/generic.d.ts +2 -0
  36. package/dist/cli/output/rules/generic.js +13 -0
  37. package/dist/cli/output/rules/index.d.ts +2 -0
  38. package/dist/cli/output/rules/index.js +24 -0
  39. package/dist/cli/output/rules/mining-update.d.ts +2 -0
  40. package/dist/cli/output/rules/mining-update.js +68 -0
  41. package/dist/cli/output/rules/services.d.ts +2 -0
  42. package/dist/cli/output/rules/services.js +110 -0
  43. package/dist/cli/output/rules/wallet-admin.d.ts +2 -0
  44. package/dist/cli/output/rules/wallet-admin.js +224 -0
  45. package/dist/cli/output/rules/wallet-mutations.d.ts +2 -0
  46. package/dist/cli/output/rules/wallet-mutations.js +274 -0
  47. package/dist/cli/output/types.d.ts +16 -0
  48. package/dist/cli/output/types.js +1 -0
  49. package/dist/cli/output.d.ts +2 -168
  50. package/dist/cli/output.js +6 -989
  51. package/dist/cli/pagination.d.ts +15 -0
  52. package/dist/cli/pagination.js +16 -0
  53. package/dist/cli/recommendations.d.ts +4 -0
  54. package/dist/cli/recommendations.js +108 -0
  55. package/dist/cli/wallet-format/availability.d.ts +5 -0
  56. package/dist/cli/wallet-format/availability.js +96 -0
  57. package/dist/cli/wallet-format/balance.d.ts +2 -0
  58. package/dist/cli/wallet-format/balance.js +162 -0
  59. package/dist/cli/wallet-format/domains.d.ts +8 -0
  60. package/dist/cli/wallet-format/domains.js +84 -0
  61. package/dist/cli/wallet-format/fields.d.ts +6 -0
  62. package/dist/cli/wallet-format/fields.js +61 -0
  63. package/dist/cli/wallet-format/identity.d.ts +5 -0
  64. package/dist/cli/wallet-format/identity.js +19 -0
  65. package/dist/cli/wallet-format/locks.d.ts +7 -0
  66. package/dist/cli/wallet-format/locks.js +52 -0
  67. package/dist/cli/wallet-format/overview.d.ts +2 -0
  68. package/dist/cli/wallet-format/overview.js +122 -0
  69. package/dist/cli/wallet-format/pending.d.ts +13 -0
  70. package/dist/cli/wallet-format/pending.js +101 -0
  71. package/dist/cli/wallet-format/shared.d.ts +7 -0
  72. package/dist/cli/wallet-format/shared.js +31 -0
  73. package/dist/cli/wallet-format/status.d.ts +3 -0
  74. package/dist/cli/wallet-format/status.js +27 -0
  75. package/dist/cli/wallet-format.d.ts +8 -30
  76. package/dist/cli/wallet-format.js +8 -830
  77. package/dist/cli/wallet-read-helpers.d.ts +6 -0
  78. package/dist/cli/wallet-read-helpers.js +17 -0
  79. package/dist/wallet/mining/candidate.d.ts +1 -1
  80. package/dist/wallet/mining/candidate.js +3 -3
  81. package/dist/wallet/mining/constants.d.ts +2 -2
  82. package/dist/wallet/mining/constants.js +2 -2
  83. package/dist/wallet/mining/engine-state.js +10 -0
  84. package/dist/wallet/mining/sentence-protocol.d.ts +2 -2
  85. package/dist/wallet/mining/sentences.js +8 -8
  86. package/dist/wallet/mining/visualizer-sync.js +79 -15
  87. package/dist/wallet/read/context.js +1 -1
  88. package/dist/wallet/reset/artifacts.d.ts +16 -0
  89. package/dist/wallet/reset/artifacts.js +141 -0
  90. package/dist/wallet/reset/execution.d.ts +38 -0
  91. package/dist/wallet/reset/execution.js +458 -0
  92. package/dist/wallet/reset/preflight.d.ts +7 -0
  93. package/dist/wallet/reset/preflight.js +116 -0
  94. package/dist/wallet/reset/preview.d.ts +2 -0
  95. package/dist/wallet/reset/preview.js +50 -0
  96. package/dist/wallet/reset/process-cleanup.d.ts +12 -0
  97. package/dist/wallet/reset/process-cleanup.js +179 -0
  98. package/dist/wallet/reset/types.d.ts +189 -0
  99. package/dist/wallet/reset/types.js +1 -0
  100. package/dist/wallet/reset.d.ts +4 -119
  101. package/dist/wallet/reset.js +4 -882
  102. package/dist/wallet/tx/anchor/confirm.d.ts +15 -0
  103. package/dist/wallet/tx/anchor/confirm.js +60 -0
  104. package/dist/wallet/tx/anchor/draft.d.ts +39 -0
  105. package/dist/wallet/tx/anchor/draft.js +167 -0
  106. package/dist/wallet/tx/anchor/index.d.ts +5 -0
  107. package/dist/wallet/tx/anchor/index.js +148 -0
  108. package/dist/wallet/tx/anchor/intent.d.ts +61 -0
  109. package/dist/wallet/tx/anchor/intent.js +101 -0
  110. package/dist/wallet/tx/anchor/plan.d.ts +3 -0
  111. package/dist/wallet/tx/anchor/plan.js +18 -0
  112. package/dist/wallet/tx/anchor/result.d.ts +25 -0
  113. package/dist/wallet/tx/anchor/result.js +20 -0
  114. package/dist/wallet/tx/anchor.d.ts +1 -39
  115. package/dist/wallet/tx/anchor.js +1 -494
  116. package/dist/wallet/tx/bitcoin-transfer/confirm.d.ts +7 -0
  117. package/dist/wallet/tx/bitcoin-transfer/confirm.js +11 -0
  118. package/dist/wallet/tx/bitcoin-transfer/index.d.ts +5 -0
  119. package/dist/wallet/tx/bitcoin-transfer/index.js +112 -0
  120. package/dist/wallet/tx/bitcoin-transfer/intent.d.ts +52 -0
  121. package/dist/wallet/tx/bitcoin-transfer/intent.js +74 -0
  122. package/dist/wallet/tx/bitcoin-transfer/plan.d.ts +5 -0
  123. package/dist/wallet/tx/bitcoin-transfer/plan.js +21 -0
  124. package/dist/wallet/tx/bitcoin-transfer/result.d.ts +19 -0
  125. package/dist/wallet/tx/bitcoin-transfer/result.js +16 -0
  126. package/dist/wallet/tx/bitcoin-transfer.d.ts +1 -35
  127. package/dist/wallet/tx/bitcoin-transfer.js +1 -200
  128. package/dist/wallet/tx/cog/confirm.d.ts +13 -0
  129. package/dist/wallet/tx/cog/confirm.js +59 -0
  130. package/dist/wallet/tx/cog/draft.d.ts +20 -0
  131. package/dist/wallet/tx/cog/draft.js +114 -0
  132. package/dist/wallet/tx/cog/index.d.ts +6 -0
  133. package/dist/wallet/tx/cog/index.js +117 -0
  134. package/dist/wallet/tx/cog/intent.d.ts +30 -0
  135. package/dist/wallet/tx/cog/intent.js +169 -0
  136. package/dist/wallet/tx/cog/plan.d.ts +19 -0
  137. package/dist/wallet/tx/cog/plan.js +65 -0
  138. package/dist/wallet/tx/cog/result.d.ts +27 -0
  139. package/dist/wallet/tx/cog/result.js +28 -0
  140. package/dist/wallet/tx/cog/types.d.ts +186 -0
  141. package/dist/wallet/tx/cog/types.js +2 -0
  142. package/dist/wallet/tx/cog/variants/claim.d.ts +3 -0
  143. package/dist/wallet/tx/cog/variants/claim.js +92 -0
  144. package/dist/wallet/tx/cog/variants/lock.d.ts +2 -0
  145. package/dist/wallet/tx/cog/variants/lock.js +102 -0
  146. package/dist/wallet/tx/cog/variants/send.d.ts +2 -0
  147. package/dist/wallet/tx/cog/variants/send.js +77 -0
  148. package/dist/wallet/tx/cog.d.ts +1 -96
  149. package/dist/wallet/tx/cog.js +1 -824
  150. package/dist/wallet/tx/common.d.ts +14 -199
  151. package/dist/wallet/tx/common.js +10 -493
  152. package/dist/wallet/tx/domain-admin/confirm.d.ts +17 -0
  153. package/dist/wallet/tx/domain-admin/confirm.js +58 -0
  154. package/dist/wallet/tx/domain-admin/draft.d.ts +20 -0
  155. package/dist/wallet/tx/domain-admin/draft.js +161 -0
  156. package/dist/wallet/tx/domain-admin/index.d.ts +9 -0
  157. package/dist/wallet/tx/domain-admin/index.js +150 -0
  158. package/dist/wallet/tx/domain-admin/intent.d.ts +12 -0
  159. package/dist/wallet/tx/domain-admin/intent.js +61 -0
  160. package/dist/wallet/tx/domain-admin/plan.d.ts +19 -0
  161. package/dist/wallet/tx/domain-admin/plan.js +64 -0
  162. package/dist/wallet/tx/domain-admin/result.d.ts +19 -0
  163. package/dist/wallet/tx/domain-admin/result.js +33 -0
  164. package/dist/wallet/tx/domain-admin/types.d.ts +162 -0
  165. package/dist/wallet/tx/domain-admin/types.js +1 -0
  166. package/dist/wallet/tx/domain-admin/variants/canonical.d.ts +2 -0
  167. package/dist/wallet/tx/domain-admin/variants/canonical.js +22 -0
  168. package/dist/wallet/tx/domain-admin/variants/delegate.d.ts +3 -0
  169. package/dist/wallet/tx/domain-admin/variants/delegate.js +60 -0
  170. package/dist/wallet/tx/domain-admin/variants/endpoint.d.ts +3 -0
  171. package/dist/wallet/tx/domain-admin/variants/endpoint.js +102 -0
  172. package/dist/wallet/tx/domain-admin/variants/miner.d.ts +3 -0
  173. package/dist/wallet/tx/domain-admin/variants/miner.js +59 -0
  174. package/dist/wallet/tx/domain-admin.d.ts +1 -107
  175. package/dist/wallet/tx/domain-admin.js +1 -729
  176. package/dist/wallet/tx/domain-market/confirm.d.ts +6 -0
  177. package/dist/wallet/tx/domain-market/confirm.js +52 -0
  178. package/dist/wallet/tx/domain-market/draft.d.ts +43 -0
  179. package/dist/wallet/tx/domain-market/draft.js +286 -0
  180. package/dist/wallet/tx/domain-market/index.d.ts +6 -0
  181. package/dist/wallet/tx/domain-market/index.js +145 -0
  182. package/dist/wallet/tx/domain-market/intent.d.ts +15 -0
  183. package/dist/wallet/tx/domain-market/intent.js +131 -0
  184. package/dist/wallet/tx/domain-market/plan.d.ts +31 -0
  185. package/dist/wallet/tx/domain-market/plan.js +98 -0
  186. package/dist/wallet/tx/domain-market/result.d.ts +45 -0
  187. package/dist/wallet/tx/domain-market/result.js +88 -0
  188. package/dist/wallet/tx/domain-market/types.d.ts +221 -0
  189. package/dist/wallet/tx/domain-market/types.js +1 -0
  190. package/dist/wallet/tx/domain-market/variants/buy.d.ts +2 -0
  191. package/dist/wallet/tx/domain-market/variants/buy.js +103 -0
  192. package/dist/wallet/tx/domain-market/variants/sell.d.ts +2 -0
  193. package/dist/wallet/tx/domain-market/variants/sell.js +91 -0
  194. package/dist/wallet/tx/domain-market/variants/transfer.d.ts +2 -0
  195. package/dist/wallet/tx/domain-market/variants/transfer.js +105 -0
  196. package/dist/wallet/tx/domain-market.d.ts +1 -116
  197. package/dist/wallet/tx/domain-market.js +1 -1078
  198. package/dist/wallet/tx/draft-build.d.ts +60 -0
  199. package/dist/wallet/tx/draft-build.js +127 -0
  200. package/dist/wallet/tx/executor.d.ts +6 -40
  201. package/dist/wallet/tx/executor.js +6 -100
  202. package/dist/wallet/tx/fee.d.ts +30 -0
  203. package/dist/wallet/tx/fee.js +98 -0
  204. package/dist/wallet/tx/field/confirm.d.ts +11 -0
  205. package/dist/wallet/tx/field/confirm.js +19 -0
  206. package/dist/wallet/tx/field/draft.d.ts +23 -0
  207. package/dist/wallet/tx/field/draft.js +202 -0
  208. package/dist/wallet/tx/field/index.d.ts +5 -0
  209. package/dist/wallet/tx/field/index.js +140 -0
  210. package/dist/wallet/tx/field/intent.d.ts +5 -0
  211. package/dist/wallet/tx/field/intent.js +50 -0
  212. package/dist/wallet/tx/field/plan.d.ts +20 -0
  213. package/dist/wallet/tx/field/plan.js +65 -0
  214. package/dist/wallet/tx/field/result.d.ts +29 -0
  215. package/dist/wallet/tx/field/result.js +103 -0
  216. package/dist/wallet/tx/field/types.d.ts +163 -0
  217. package/dist/wallet/tx/field/types.js +1 -0
  218. package/dist/wallet/tx/field/variants/clear.d.ts +2 -0
  219. package/dist/wallet/tx/field/variants/clear.js +60 -0
  220. package/dist/wallet/tx/field/variants/create.d.ts +2 -0
  221. package/dist/wallet/tx/field/variants/create.js +67 -0
  222. package/dist/wallet/tx/field/variants/set.d.ts +2 -0
  223. package/dist/wallet/tx/field/variants/set.js +195 -0
  224. package/dist/wallet/tx/field.d.ts +1 -95
  225. package/dist/wallet/tx/field.js +1 -920
  226. package/dist/wallet/tx/mining-preemption.d.ts +6 -0
  227. package/dist/wallet/tx/mining-preemption.js +7 -0
  228. package/dist/wallet/tx/primitives.d.ts +13 -0
  229. package/dist/wallet/tx/primitives.js +42 -0
  230. package/dist/wallet/tx/psbt-assert.d.ts +14 -0
  231. package/dist/wallet/tx/psbt-assert.js +39 -0
  232. package/dist/wallet/tx/publish.d.ts +37 -0
  233. package/dist/wallet/tx/publish.js +88 -0
  234. package/dist/wallet/tx/readiness.d.ts +7 -0
  235. package/dist/wallet/tx/readiness.js +61 -0
  236. package/dist/wallet/tx/reconcile.d.ts +24 -0
  237. package/dist/wallet/tx/reconcile.js +72 -0
  238. package/dist/wallet/tx/register/confirm.d.ts +6 -0
  239. package/dist/wallet/tx/register/confirm.js +66 -0
  240. package/dist/wallet/tx/register/draft.d.ts +42 -0
  241. package/dist/wallet/tx/register/draft.js +181 -0
  242. package/dist/wallet/tx/register/index.d.ts +6 -0
  243. package/dist/wallet/tx/register/index.js +158 -0
  244. package/dist/wallet/tx/register/intent.d.ts +74 -0
  245. package/dist/wallet/tx/register/intent.js +119 -0
  246. package/dist/wallet/tx/register/plan.d.ts +43 -0
  247. package/dist/wallet/tx/register/plan.js +168 -0
  248. package/dist/wallet/tx/register/result.d.ts +78 -0
  249. package/dist/wallet/tx/register/result.js +41 -0
  250. package/dist/wallet/tx/register.d.ts +1 -70
  251. package/dist/wallet/tx/register.js +1 -681
  252. package/dist/wallet/tx/reputation/confirm.d.ts +11 -0
  253. package/dist/wallet/tx/reputation/confirm.js +51 -0
  254. package/dist/wallet/tx/reputation/draft.d.ts +20 -0
  255. package/dist/wallet/tx/reputation/draft.js +130 -0
  256. package/dist/wallet/tx/reputation/index.d.ts +4 -0
  257. package/dist/wallet/tx/reputation/index.js +162 -0
  258. package/dist/wallet/tx/reputation/intent.d.ts +36 -0
  259. package/dist/wallet/tx/reputation/intent.js +157 -0
  260. package/dist/wallet/tx/reputation/plan.d.ts +19 -0
  261. package/dist/wallet/tx/reputation/plan.js +64 -0
  262. package/dist/wallet/tx/reputation/result.d.ts +21 -0
  263. package/dist/wallet/tx/reputation/result.js +31 -0
  264. package/dist/wallet/tx/reputation/types.d.ts +130 -0
  265. package/dist/wallet/tx/reputation/types.js +1 -0
  266. package/dist/wallet/tx/reputation.d.ts +1 -74
  267. package/dist/wallet/tx/reputation.js +1 -556
  268. package/dist/wallet/tx/signing.d.ts +18 -0
  269. package/dist/wallet/tx/signing.js +31 -0
  270. package/dist/wallet/tx/state-persist.d.ts +27 -0
  271. package/dist/wallet/tx/state-persist.js +54 -0
  272. package/dist/wallet/tx/types.d.ts +44 -0
  273. package/dist/wallet/tx/types.js +1 -0
  274. package/package.json +1 -1
  275. package/dist/cli/mining-json.d.ts +0 -20
  276. package/dist/cli/mining-json.js +0 -46
  277. package/dist/cli/mutation-json.d.ts +0 -325
  278. package/dist/cli/mutation-json.js +0 -269
  279. package/dist/cli/mutation-resolved-json.d.ts +0 -117
  280. package/dist/cli/mutation-resolved-json.js +0 -123
  281. package/dist/cli/preview-json.d.ts +0 -319
  282. package/dist/cli/preview-json.js +0 -254
  283. package/dist/cli/read-json.d.ts +0 -190
  284. package/dist/cli/read-json.js +0 -627
@@ -1,556 +1 @@
1
- import { createHash, randomBytes } from "node:crypto";
2
- import { encodeSentence } from "@cogcoin/scoring";
3
- import { getBalance, lookupDomain, } from "@cogcoin/indexer/queries";
4
- import { attachOrStartManagedBitcoindService } from "../../bitcoind/service.js";
5
- import { createRpcClient } from "../../bitcoind/node.js";
6
- import {} from "../runtime.js";
7
- import {} from "../state/provider.js";
8
- import { serializeRepCommit, serializeRepRevoke, validateDomainName, } from "../cogop/index.js";
9
- import { openWalletReadContext } from "../read/index.js";
10
- import { assertFixedInputPrefixMatches, assertFundingInputsAfterFixedPrefix, assertWalletMutationContextReady, buildWalletMutationTransactionWithReserveFallback, createFundingMutationSender, createWalletMutationFeeMetadata, formatCogAmount, getDecodedInputScriptPubKeyHex, isLocalWalletScript, mergeFixedWalletInputs, outpointKey, unlockTemporaryBuilderLocks, updateMutationRecord, } from "./common.js";
11
- import { confirmTypedAcknowledgement as confirmSharedTypedAcknowledgement, confirmYesNo as confirmSharedYesNo, } from "./confirm.js";
12
- import { executeWalletMutationOperation, persistWalletMutationState, publishWalletMutation, resolveExistingWalletMutation, } from "./executor.js";
13
- import { getCanonicalIdentitySelector } from "./identity-selector.js";
14
- import { upsertPendingMutation } from "./journal.js";
15
- function normalizeDomainName(domainName, errorCode) {
16
- const normalized = domainName.trim().toLowerCase();
17
- if (normalized.length === 0) {
18
- throw new Error(errorCode);
19
- }
20
- validateDomainName(normalized);
21
- return normalized;
22
- }
23
- function createSupportKey(sourceDomainId, targetDomainId) {
24
- return `${sourceDomainId}:${targetDomainId}`;
25
- }
26
- function encodeOpReturnScript(payload) {
27
- if (payload.length <= 75) {
28
- return Buffer.concat([
29
- Buffer.from([0x6a, payload.length]),
30
- Buffer.from(payload),
31
- ]).toString("hex");
32
- }
33
- return Buffer.concat([
34
- Buffer.from([0x6a, 0x4c, payload.length]),
35
- Buffer.from(payload),
36
- ]).toString("hex");
37
- }
38
- function satsToBtcNumber(value) {
39
- return Number(value) / 100_000_000;
40
- }
41
- function valueToSats(value) {
42
- const text = typeof value === "number" ? value.toFixed(8) : value;
43
- const match = /^(-?)(\d+)(?:\.(\d{0,8}))?$/.exec(text.trim());
44
- if (match == null) {
45
- throw new Error(`wallet_reputation_invalid_amount_${text}`);
46
- }
47
- const sign = match[1] === "-" ? -1n : 1n;
48
- const whole = BigInt(match[2] ?? "0");
49
- const fraction = BigInt((match[3] ?? "").padEnd(8, "0"));
50
- return sign * ((whole * 100000000n) + fraction);
51
- }
52
- function createIntentFingerprint(parts) {
53
- return createHash("sha256")
54
- .update(parts.map((part) => String(part)).join("\n"))
55
- .digest("hex");
56
- }
57
- function createResolvedReputationSenderSummary(sender, selector) {
58
- return {
59
- selector,
60
- localIndex: sender.localIndex,
61
- scriptPubKeyHex: sender.scriptPubKeyHex,
62
- address: sender.address,
63
- };
64
- }
65
- function createResolvedReputationSummary(options) {
66
- return {
67
- sender: createResolvedReputationSenderSummary(options.sender, options.senderSelector),
68
- effect: options.kind === "give"
69
- ? {
70
- kind: "give-support",
71
- burnCogtoshi: options.amountCogtoshi.toString(),
72
- }
73
- : {
74
- kind: "revoke-support",
75
- burnCogtoshi: options.amountCogtoshi.toString(),
76
- },
77
- review: {
78
- included: options.review.payloadHex !== null,
79
- byteLength: options.review.payload?.length ?? null,
80
- },
81
- selfStake: options.selfStake,
82
- };
83
- }
84
- function describeReputationEffect(effect) {
85
- if (effect.kind === "give-support") {
86
- return `burn ${effect.burnCogtoshi} cogtoshi to publish support`;
87
- }
88
- return `revoke visible support with no refund of the previously burned ${effect.burnCogtoshi} cogtoshi`;
89
- }
90
- function describeReputationReview(review) {
91
- if (!review.included || review.byteLength === null) {
92
- return "none";
93
- }
94
- return `included (${review.byteLength} bytes)`;
95
- }
96
- function resolveReputationOperation(context, sourceDomainName, targetDomainName, errorPrefix) {
97
- assertWalletMutationContextReady(context, errorPrefix);
98
- const sourceDomain = lookupDomain(context.snapshot.state, sourceDomainName);
99
- if (sourceDomain === null) {
100
- throw new Error(`${errorPrefix}_source_domain_not_found`);
101
- }
102
- if (!sourceDomain.anchored) {
103
- throw new Error(`${errorPrefix}_source_domain_not_anchored`);
104
- }
105
- const targetDomain = lookupDomain(context.snapshot.state, targetDomainName);
106
- if (targetDomain === null) {
107
- throw new Error(`${errorPrefix}_target_domain_not_found`);
108
- }
109
- if (!targetDomain.anchored) {
110
- throw new Error(`${errorPrefix}_target_domain_not_anchored`);
111
- }
112
- const ownerHex = Buffer.from(sourceDomain.ownerScriptPubKey).toString("hex");
113
- if (ownerHex !== context.localState.state.funding.scriptPubKeyHex || context.model.walletAddress == null) {
114
- throw new Error(`${errorPrefix}_source_owner_not_locally_controlled`);
115
- }
116
- return {
117
- readContext: context,
118
- state: context.localState.state,
119
- sender: createFundingMutationSender(context.localState.state),
120
- senderSelector: context.model.walletAddress,
121
- sourceDomain,
122
- targetDomain,
123
- availableBalanceCogtoshi: getBalance(context.snapshot.state, sourceDomain.ownerScriptPubKey),
124
- currentNetSupportCogtoshi: context.snapshot.state.consensus.supportByPair.get(createSupportKey(sourceDomain.domainId, targetDomain.domainId)) ?? 0n,
125
- };
126
- }
127
- function buildPlanForReputationOperation(options) {
128
- const fundingUtxos = options.allUtxos.filter((entry) => entry.scriptPubKey === options.state.funding.scriptPubKeyHex
129
- && entry.confirmations >= 1
130
- && entry.spendable !== false
131
- && entry.safe !== false);
132
- return {
133
- sender: options.sender,
134
- changeAddress: options.state.funding.address,
135
- fixedInputs: [],
136
- outputs: [{ data: Buffer.from(options.opReturnData).toString("hex") }],
137
- changePosition: 1,
138
- expectedOpReturnScriptHex: encodeOpReturnScript(options.opReturnData),
139
- allowedFundingScriptPubKeyHex: options.state.funding.scriptPubKeyHex,
140
- eligibleFundingOutpointKeys: new Set(fundingUtxos.map((entry) => outpointKey({ txid: entry.txid, vout: entry.vout }))),
141
- errorPrefix: options.errorPrefix,
142
- };
143
- }
144
- function validateFundedDraft(decoded, funded, plan) {
145
- const inputs = decoded.tx.vin;
146
- const outputs = decoded.tx.vout;
147
- if (inputs.length === 0) {
148
- throw new Error(`${plan.errorPrefix}_missing_sender_input`);
149
- }
150
- if (outputs[0]?.scriptPubKey?.hex !== plan.expectedOpReturnScriptHex) {
151
- throw new Error(`${plan.errorPrefix}_opreturn_mismatch`);
152
- }
153
- if (funded.changepos === -1) {
154
- if (outputs.length !== 1) {
155
- throw new Error(`${plan.errorPrefix}_unexpected_output_count`);
156
- }
157
- return;
158
- }
159
- if (funded.changepos !== plan.changePosition || outputs.length !== 2) {
160
- throw new Error(`${plan.errorPrefix}_change_position_mismatch`);
161
- }
162
- if (outputs[funded.changepos]?.scriptPubKey?.hex !== plan.allowedFundingScriptPubKeyHex) {
163
- throw new Error(`${plan.errorPrefix}_change_output_mismatch`);
164
- }
165
- }
166
- async function buildTransaction(options) {
167
- return buildWalletMutationTransactionWithReserveFallback({
168
- rpc: options.rpc,
169
- walletName: options.walletName,
170
- state: options.state,
171
- plan: options.plan,
172
- validateFundedDraft,
173
- finalizeErrorCode: `${options.plan.errorPrefix}_finalize_failed`,
174
- mempoolRejectPrefix: `${options.plan.errorPrefix}_mempool_rejected`,
175
- feeRate: options.feeRateSatVb,
176
- });
177
- }
178
- function createDraftMutation(options) {
179
- if (options.existing !== null && options.existing !== undefined) {
180
- return {
181
- ...options.existing,
182
- kind: options.kind,
183
- domainName: options.sourceDomainName,
184
- senderScriptPubKeyHex: options.sender.scriptPubKeyHex,
185
- senderLocalIndex: options.sender.localIndex,
186
- recipientDomainName: options.targetDomainName,
187
- amountCogtoshi: options.amountCogtoshi,
188
- reviewPayloadHex: options.reviewPayloadHex,
189
- status: "draft",
190
- lastUpdatedAtUnixMs: options.nowUnixMs,
191
- attemptedTxid: null,
192
- attemptedWtxid: null,
193
- ...createWalletMutationFeeMetadata(options.feeSelection),
194
- temporaryBuilderLockedOutpoints: [],
195
- };
196
- }
197
- return {
198
- mutationId: randomBytes(12).toString("hex"),
199
- kind: options.kind,
200
- domainName: options.sourceDomainName,
201
- parentDomainName: null,
202
- senderScriptPubKeyHex: options.sender.scriptPubKeyHex,
203
- senderLocalIndex: options.sender.localIndex,
204
- amountCogtoshi: options.amountCogtoshi,
205
- recipientDomainName: options.targetDomainName,
206
- reviewPayloadHex: options.reviewPayloadHex,
207
- intentFingerprintHex: options.intentFingerprintHex,
208
- status: "draft",
209
- createdAtUnixMs: options.nowUnixMs,
210
- lastUpdatedAtUnixMs: options.nowUnixMs,
211
- attemptedTxid: null,
212
- attemptedWtxid: null,
213
- ...createWalletMutationFeeMetadata(options.feeSelection),
214
- temporaryBuilderLockedOutpoints: [],
215
- };
216
- }
217
- async function saveUpdatedMutationState(options) {
218
- return persistWalletMutationState(options);
219
- }
220
- function mutationNeedsRepair(mutation, context) {
221
- if (context.snapshot === null || mutation.recipientDomainName == null) {
222
- return false;
223
- }
224
- const sourceDomain = lookupDomain(context.snapshot.state, mutation.domainName);
225
- const targetDomain = lookupDomain(context.snapshot.state, mutation.recipientDomainName);
226
- if (sourceDomain === null || targetDomain === null) {
227
- return true;
228
- }
229
- return !sourceDomain.anchored
230
- || !targetDomain.anchored
231
- || Buffer.from(sourceDomain.ownerScriptPubKey).toString("hex") !== mutation.senderScriptPubKeyHex;
232
- }
233
- async function reconcilePendingReputationMutation(options) {
234
- if (options.mutation.status === "confirmed" || options.mutation.status === "live") {
235
- return {
236
- state: options.state,
237
- mutation: options.mutation,
238
- resolution: options.mutation.status,
239
- };
240
- }
241
- if (options.mutation.status === "repair-required") {
242
- return {
243
- state: options.state,
244
- mutation: options.mutation,
245
- resolution: "repair-required",
246
- };
247
- }
248
- const walletTx = options.mutation.attemptedTxid === null
249
- ? null
250
- : await options.rpc.getTransaction(options.walletName, options.mutation.attemptedTxid).catch(() => null);
251
- if (walletTx !== null) {
252
- await unlockTemporaryBuilderLocks(options.rpc, options.walletName, options.mutation.temporaryBuilderLockedOutpoints);
253
- const status = walletTx.confirmations > 0 ? "confirmed" : "live";
254
- const nextMutation = updateMutationRecord(options.mutation, status, options.nowUnixMs, {
255
- temporaryBuilderLockedOutpoints: [],
256
- });
257
- let nextState = upsertPendingMutation(options.state, nextMutation);
258
- nextState = await saveUpdatedMutationState({
259
- state: nextState,
260
- provider: options.provider,
261
- nowUnixMs: options.nowUnixMs,
262
- paths: options.paths,
263
- });
264
- return {
265
- state: nextState,
266
- mutation: nextMutation,
267
- resolution: status,
268
- };
269
- }
270
- if (mutationNeedsRepair(options.mutation, options.context)) {
271
- await unlockTemporaryBuilderLocks(options.rpc, options.walletName, options.mutation.temporaryBuilderLockedOutpoints);
272
- const repair = updateMutationRecord(options.mutation, "repair-required", options.nowUnixMs, {
273
- temporaryBuilderLockedOutpoints: [],
274
- });
275
- let nextState = upsertPendingMutation(options.state, repair);
276
- nextState = await saveUpdatedMutationState({
277
- state: nextState,
278
- provider: options.provider,
279
- nowUnixMs: options.nowUnixMs,
280
- paths: options.paths,
281
- });
282
- return { state: nextState, mutation: repair, resolution: "repair-required" };
283
- }
284
- if (options.mutation.status === "broadcast-unknown"
285
- || options.mutation.status === "draft"
286
- || options.mutation.status === "broadcasting") {
287
- await unlockTemporaryBuilderLocks(options.rpc, options.walletName, options.mutation.temporaryBuilderLockedOutpoints);
288
- const canceled = updateMutationRecord(options.mutation, "canceled", options.nowUnixMs, {
289
- temporaryBuilderLockedOutpoints: [],
290
- });
291
- let nextState = upsertPendingMutation(options.state, canceled);
292
- nextState = await saveUpdatedMutationState({
293
- state: nextState,
294
- provider: options.provider,
295
- nowUnixMs: options.nowUnixMs,
296
- paths: options.paths,
297
- });
298
- return { state: nextState, mutation: canceled, resolution: "not-seen" };
299
- }
300
- return {
301
- state: options.state,
302
- mutation: options.mutation,
303
- resolution: "continue",
304
- };
305
- }
306
- async function confirmYesNo(prompter, message, errorCode, options) {
307
- await confirmSharedYesNo(prompter, message, {
308
- assumeYes: options.assumeYes,
309
- errorCode,
310
- requiresTtyErrorCode: options.requiresTtyErrorCode,
311
- });
312
- }
313
- async function confirmTyped(prompter, expected, prompt, errorCode, options) {
314
- await confirmSharedTypedAcknowledgement(prompter, {
315
- assumeYes: options.assumeYes,
316
- expected,
317
- prompt,
318
- errorCode,
319
- requiresTtyErrorCode: options.requiresTtyErrorCode,
320
- typedAckRequiredErrorCode: options.typedAckRequiredErrorCode,
321
- });
322
- }
323
- async function confirmReputationMutation(prompter, options) {
324
- prompter.writeLine(`${options.kind === "give" ? "Giving" : "Revoking"} reputation from "${options.sourceDomainName}" to "${options.targetDomainName}".`);
325
- prompter.writeLine(`Resolved sender: ${options.resolved.sender.selector} (${options.resolved.sender.address})`);
326
- prompter.writeLine(`Burn amount: ${formatCogAmount(options.amountCogtoshi)}`);
327
- prompter.writeLine(`Effect: ${describeReputationEffect(options.resolved.effect)}.`);
328
- prompter.writeLine(`Review: ${describeReputationReview(options.resolved.review)}.`);
329
- if (options.reviewText !== null) {
330
- prompter.writeLine("Warning: review text will be encoded and published publicly in the mempool and on-chain.");
331
- }
332
- if (options.kind === "give" && options.resolved.selfStake) {
333
- prompter.writeLine("Self-stake: yes.");
334
- prompter.writeLine("Warning: this is self-stake.");
335
- prompter.writeLine("Self-stake is irrevocable and cannot later be revoked.");
336
- await confirmTyped(prompter, options.sourceDomainName, `Type ${options.sourceDomainName} to continue: `, "wallet_rep_give_confirmation_rejected", {
337
- assumeYes: options.assumeYes,
338
- requiresTtyErrorCode: "wallet_rep_give_requires_tty",
339
- typedAckRequiredErrorCode: "wallet_rep_give_typed_ack_required",
340
- });
341
- return;
342
- }
343
- await confirmYesNo(prompter, options.kind === "give"
344
- ? "This burns COG to publish a reputation commitment."
345
- : "This revokes visible support but the burned COG is not refunded.", options.kind === "give"
346
- ? "wallet_rep_give_confirmation_rejected"
347
- : "wallet_rep_revoke_confirmation_rejected", {
348
- assumeYes: options.assumeYes,
349
- requiresTtyErrorCode: options.kind === "give"
350
- ? "wallet_rep_give_requires_tty"
351
- : "wallet_rep_revoke_requires_tty",
352
- });
353
- }
354
- async function encodeReviewText(reviewText, errorPrefix) {
355
- const trimmed = reviewText?.trim() ?? "";
356
- if (trimmed === "") {
357
- return {
358
- text: null,
359
- payload: undefined,
360
- payloadHex: null,
361
- };
362
- }
363
- return encodeSentence(trimmed)
364
- .then((payload) => ({
365
- text: trimmed,
366
- payload,
367
- payloadHex: Buffer.from(payload).toString("hex"),
368
- }))
369
- .catch((error) => {
370
- throw new Error(error instanceof Error ? `${errorPrefix}_invalid_review_${error.message}` : `${errorPrefix}_invalid_review`);
371
- });
372
- }
373
- async function submitReputationMutation(options) {
374
- if (!options.prompter.isInteractive && options.assumeYes !== true) {
375
- throw new Error(`${options.errorPrefix}_requires_tty`);
376
- }
377
- if (options.amountCogtoshi <= 0n) {
378
- throw new Error(`${options.errorPrefix}_invalid_amount`);
379
- }
380
- const execution = await executeWalletMutationOperation({
381
- ...options,
382
- controlLockPurpose: options.errorPrefix,
383
- preemptionReason: options.errorPrefix,
384
- async resolveOperation(readContext) {
385
- const normalizedSourceDomainName = normalizeDomainName(options.sourceDomainName, `${options.errorPrefix}_missing_source_domain`);
386
- const normalizedTargetDomainName = normalizeDomainName(options.targetDomainName, `${options.errorPrefix}_missing_target_domain`);
387
- const operation = resolveReputationOperation(readContext, normalizedSourceDomainName, normalizedTargetDomainName, options.errorPrefix);
388
- if (operation.availableBalanceCogtoshi < options.amountCogtoshi) {
389
- throw new Error(`${options.errorPrefix}_insufficient_cog_balance`);
390
- }
391
- if (options.kind === "rep-revoke") {
392
- if (operation.sourceDomain.domainId === operation.targetDomain.domainId) {
393
- throw new Error(`${options.errorPrefix}_self_revoke_not_allowed`);
394
- }
395
- if (options.amountCogtoshi > operation.currentNetSupportCogtoshi) {
396
- throw new Error(`${options.errorPrefix}_amount_exceeds_net_support`);
397
- }
398
- }
399
- const review = await encodeReviewText(options.reviewText, options.errorPrefix);
400
- const selfStake = operation.sourceDomain.domainId === operation.targetDomain.domainId;
401
- return {
402
- ...operation,
403
- normalizedSourceDomainName,
404
- normalizedTargetDomainName,
405
- review,
406
- resolved: createResolvedReputationSummary({
407
- kind: options.kind === "rep-give" ? "give" : "revoke",
408
- sender: operation.sender,
409
- senderSelector: operation.senderSelector,
410
- amountCogtoshi: options.amountCogtoshi,
411
- review,
412
- selfStake,
413
- }),
414
- };
415
- },
416
- createIntentFingerprint(operation) {
417
- return createIntentFingerprint([
418
- options.kind,
419
- operation.state.walletRootId,
420
- operation.sourceDomain.name,
421
- operation.targetDomain.name,
422
- options.amountCogtoshi,
423
- operation.review.payloadHex ?? "",
424
- ]);
425
- },
426
- async resolveExistingMutation({ operation, existingMutation, execution }) {
427
- if (existingMutation === null) {
428
- return {
429
- state: operation.state,
430
- replacementFixedInputs: null,
431
- result: null,
432
- };
433
- }
434
- return resolveExistingWalletMutation({
435
- existingMutation,
436
- execution,
437
- repairRequiredErrorCode: `${options.errorPrefix}_repair_required`,
438
- reconcileExistingMutation: (mutation) => reconcilePendingReputationMutation({
439
- state: operation.state,
440
- mutation,
441
- provider: execution.provider,
442
- nowUnixMs: execution.nowUnixMs,
443
- paths: execution.paths,
444
- rpc: execution.rpc,
445
- walletName: execution.walletName,
446
- context: execution.readContext,
447
- }),
448
- createReuseResult: ({ mutation, resolution, fees }) => ({
449
- kind: options.kind === "rep-give" ? "give" : "revoke",
450
- sourceDomainName: operation.normalizedSourceDomainName,
451
- targetDomainName: operation.normalizedTargetDomainName,
452
- amountCogtoshi: options.amountCogtoshi,
453
- txid: mutation.attemptedTxid ?? "unknown",
454
- status: resolution,
455
- reusedExisting: true,
456
- reviewIncluded: operation.review.payloadHex !== null,
457
- resolved: operation.resolved,
458
- fees,
459
- }),
460
- });
461
- },
462
- async confirm({ operation }) {
463
- await confirmReputationMutation(options.prompter, {
464
- kind: options.kind === "rep-give" ? "give" : "revoke",
465
- sourceDomainName: operation.normalizedSourceDomainName,
466
- targetDomainName: operation.normalizedTargetDomainName,
467
- amountCogtoshi: options.amountCogtoshi,
468
- reviewText: operation.review.text,
469
- resolved: operation.resolved,
470
- assumeYes: options.assumeYes,
471
- });
472
- },
473
- createDraftMutation({ operation, existingMutation, execution, intentFingerprintHex }) {
474
- return {
475
- mutation: createDraftMutation({
476
- kind: options.kind,
477
- sourceDomainName: operation.normalizedSourceDomainName,
478
- targetDomainName: operation.normalizedTargetDomainName,
479
- amountCogtoshi: options.amountCogtoshi,
480
- sender: operation.sender,
481
- intentFingerprintHex,
482
- nowUnixMs: execution.nowUnixMs,
483
- reviewPayloadHex: operation.review.payloadHex,
484
- feeSelection: execution.feeSelection,
485
- existing: existingMutation,
486
- }),
487
- prepared: null,
488
- };
489
- },
490
- async build({ operation, state, execution, replacementFixedInputs }) {
491
- const opReturnData = options.kind === "rep-give"
492
- ? serializeRepCommit(operation.sourceDomain.domainId, operation.targetDomain.domainId, options.amountCogtoshi, operation.review.payload).opReturnData
493
- : serializeRepRevoke(operation.sourceDomain.domainId, operation.targetDomain.domainId, options.amountCogtoshi, operation.review.payload).opReturnData;
494
- const reputationPlan = buildPlanForReputationOperation({
495
- state,
496
- allUtxos: await execution.rpc.listUnspent(execution.walletName, 1),
497
- sender: operation.sender,
498
- opReturnData,
499
- errorPrefix: options.errorPrefix,
500
- });
501
- return buildTransaction({
502
- rpc: execution.rpc,
503
- walletName: execution.walletName,
504
- state,
505
- plan: {
506
- ...reputationPlan,
507
- fixedInputs: mergeFixedWalletInputs(reputationPlan.fixedInputs, replacementFixedInputs),
508
- },
509
- feeRateSatVb: execution.feeSelection.feeRateSatVb,
510
- });
511
- },
512
- publish({ state, execution, built, mutation }) {
513
- return publishWalletMutation({
514
- rpc: execution.rpc,
515
- walletName: execution.walletName,
516
- snapshotHeight: execution.readContext.snapshot?.tip?.height ?? null,
517
- built,
518
- mutation,
519
- state,
520
- provider: execution.provider,
521
- nowUnixMs: execution.nowUnixMs,
522
- paths: execution.paths,
523
- errorPrefix: options.errorPrefix,
524
- });
525
- },
526
- createResult({ operation, mutation, built, status, reusedExisting, fees }) {
527
- return {
528
- kind: options.kind === "rep-give" ? "give" : "revoke",
529
- sourceDomainName: operation.normalizedSourceDomainName,
530
- targetDomainName: operation.normalizedTargetDomainName,
531
- amountCogtoshi: options.amountCogtoshi,
532
- txid: mutation.attemptedTxid ?? built?.txid ?? "unknown",
533
- status: status,
534
- reusedExisting,
535
- reviewIncluded: operation.review.payloadHex !== null,
536
- resolved: operation.resolved,
537
- fees,
538
- };
539
- },
540
- });
541
- return execution.result;
542
- }
543
- export async function giveReputation(options) {
544
- return submitReputationMutation({
545
- ...options,
546
- kind: "rep-give",
547
- errorPrefix: "wallet_rep_give",
548
- });
549
- }
550
- export async function revokeReputation(options) {
551
- return submitReputationMutation({
552
- ...options,
553
- kind: "rep-revoke",
554
- errorPrefix: "wallet_rep_revoke",
555
- });
556
- }
1
+ export * from "./reputation/index.js";
@@ -0,0 +1,18 @@
1
+ import type { RpcFinalizePsbtResult, RpcTransaction, RpcWalletProcessPsbtResult } from "../../bitcoind/types.js";
2
+ import type { WalletStateV1 } from "../types.js";
3
+ import type { WalletMutationRpcClient } from "./types.js";
4
+ export declare function signAndFinalizeWalletMutation(options: {
5
+ rpc: WalletMutationRpcClient;
6
+ walletName: string;
7
+ state: WalletStateV1;
8
+ psbt: string;
9
+ finalizeErrorCode: string;
10
+ mempoolRejectPrefix: string;
11
+ recoverManagedCoreWalletLockedOnce?: boolean;
12
+ onManagedCoreWalletLockedRecoveryOutcome?: (outcome: "recovered" | "still-locked") => void;
13
+ }): Promise<{
14
+ signed: RpcWalletProcessPsbtResult;
15
+ finalized: RpcFinalizePsbtResult;
16
+ rawHex: string;
17
+ decodedRaw: RpcTransaction;
18
+ }>;
@@ -0,0 +1,31 @@
1
+ import { MANAGED_CORE_WALLET_UNLOCK_TIMEOUT_SECONDS, withUnlockedManagedCoreWallet, } from "../managed-core-wallet.js";
2
+ export async function signAndFinalizeWalletMutation(options) {
3
+ return withUnlockedManagedCoreWallet({
4
+ rpc: options.rpc,
5
+ walletName: options.walletName,
6
+ internalPassphrase: options.state.managedCoreWallet.internalPassphrase,
7
+ timeoutSeconds: MANAGED_CORE_WALLET_UNLOCK_TIMEOUT_SECONDS,
8
+ recoverLockedWalletOnce: options.recoverManagedCoreWalletLockedOnce,
9
+ onLockedWalletRecoveryOutcome: options.onManagedCoreWalletLockedRecoveryOutcome,
10
+ run: async () => {
11
+ const signed = await options.rpc.walletProcessPsbt(options.walletName, options.psbt, true, "DEFAULT");
12
+ const finalized = await options.rpc.finalizePsbt(signed.psbt, true);
13
+ if (!finalized.complete || finalized.hex == null) {
14
+ throw new Error(options.finalizeErrorCode);
15
+ }
16
+ const rawHex = finalized.hex;
17
+ const decodedRaw = await options.rpc.decodeRawTransaction(rawHex);
18
+ const mempoolResult = await options.rpc.testMempoolAccept([rawHex]);
19
+ const accepted = mempoolResult[0];
20
+ if (accepted == null || !accepted.allowed) {
21
+ throw new Error(`${options.mempoolRejectPrefix}_${accepted?.["reject-reason"] ?? "unknown"}`);
22
+ }
23
+ return {
24
+ signed,
25
+ finalized,
26
+ rawHex,
27
+ decodedRaw,
28
+ };
29
+ },
30
+ });
31
+ }
@@ -0,0 +1,27 @@
1
+ import type { RpcLockedUnspent } from "../../bitcoind/types.js";
2
+ import { type WalletSecretProvider } from "../state/provider.js";
3
+ import type { OutpointRecord, PendingMutationRecord, PendingMutationStatus, WalletStateV1 } from "../types.js";
4
+ import type { WalletRuntimePaths } from "../runtime.js";
5
+ import type { WalletMutationFeeSelectionSource } from "./fee.js";
6
+ import type { WalletMutationRpcClient } from "./types.js";
7
+ export declare function saveWalletStatePreservingUnlock(options: {
8
+ state: WalletStateV1;
9
+ provider: WalletSecretProvider;
10
+ nowUnixMs?: number;
11
+ paths: WalletRuntimePaths;
12
+ }): Promise<void>;
13
+ export declare function updateMutationRecord(mutation: PendingMutationRecord, status: PendingMutationStatus, nowUnixMs: number, options?: {
14
+ attemptedTxid?: string | null;
15
+ attemptedWtxid?: string | null;
16
+ temporaryBuilderLockedOutpoints?: OutpointRecord[];
17
+ selectedFeeRateSatVb?: number | null;
18
+ feeSelectionSource?: WalletMutationFeeSelectionSource | null;
19
+ }): PendingMutationRecord;
20
+ export declare function unlockTemporaryBuilderLocks(rpc: Pick<WalletMutationRpcClient, "lockUnspent">, walletName: string, outpoints: OutpointRecord[]): Promise<void>;
21
+ export declare function diffTemporaryLockedOutpoints(before: RpcLockedUnspent[], after: RpcLockedUnspent[]): OutpointRecord[];
22
+ export declare function persistWalletMutationState(options: {
23
+ state: WalletStateV1;
24
+ provider: WalletSecretProvider;
25
+ nowUnixMs: number;
26
+ paths: WalletRuntimePaths;
27
+ }): Promise<WalletStateV1>;