@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
@@ -0,0 +1,60 @@
1
+ import type { RpcDecodedPsbt, RpcWalletCreateFundedPsbtResult } from "../../bitcoind/types.js";
2
+ import type { OutpointRecord, WalletStateV1 } from "../types.js";
3
+ import type { BuiltWalletMutationTransaction, FixedWalletInput, WalletMutationRpcClient } from "./types.js";
4
+ export declare function fundAndValidateWalletMutationDraft<TPlan>(options: {
5
+ rpc: WalletMutationRpcClient;
6
+ walletName: string;
7
+ plan: TPlan & {
8
+ fixedInputs: FixedWalletInput[];
9
+ outputs: unknown[];
10
+ changeAddress: string;
11
+ changePosition?: number | null;
12
+ allowedFundingScriptPubKeyHex: string;
13
+ eligibleFundingOutpointKeys: Set<string>;
14
+ };
15
+ validateFundedDraft(decoded: RpcDecodedPsbt, funded: RpcWalletCreateFundedPsbtResult, plan: TPlan): void;
16
+ feeRate?: number;
17
+ availableFundingMinConf?: number;
18
+ }): Promise<{
19
+ funded: RpcWalletCreateFundedPsbtResult;
20
+ decoded: RpcDecodedPsbt;
21
+ }>;
22
+ export declare function buildWalletMutationTransaction<TPlan>(options: {
23
+ rpc: WalletMutationRpcClient;
24
+ walletName: string;
25
+ state: WalletStateV1;
26
+ plan: TPlan & {
27
+ fixedInputs: FixedWalletInput[];
28
+ outputs: unknown[];
29
+ changeAddress: string;
30
+ changePosition?: number | null;
31
+ allowedFundingScriptPubKeyHex: string;
32
+ eligibleFundingOutpointKeys: Set<string>;
33
+ };
34
+ validateFundedDraft(decoded: RpcDecodedPsbt, funded: RpcWalletCreateFundedPsbtResult, plan: TPlan): void;
35
+ finalizeErrorCode: string;
36
+ mempoolRejectPrefix: string;
37
+ feeRate?: number;
38
+ availableFundingMinConf?: number;
39
+ temporarilyUnlockedPolicyOutpoints?: readonly OutpointRecord[];
40
+ recoverManagedCoreWalletLockedOnce?: boolean;
41
+ onManagedCoreWalletLockedRecoveryOutcome?: (outcome: "recovered" | "still-locked") => void;
42
+ }): Promise<BuiltWalletMutationTransaction>;
43
+ export declare function buildWalletMutationTransactionWithReserveFallback<TPlan>(options: {
44
+ rpc: WalletMutationRpcClient;
45
+ walletName: string;
46
+ state: WalletStateV1;
47
+ plan: TPlan & {
48
+ fixedInputs: FixedWalletInput[];
49
+ outputs: unknown[];
50
+ changeAddress: string;
51
+ changePosition: number;
52
+ allowedFundingScriptPubKeyHex: string;
53
+ eligibleFundingOutpointKeys: Set<string>;
54
+ };
55
+ validateFundedDraft(decoded: RpcDecodedPsbt, funded: RpcWalletCreateFundedPsbtResult, plan: TPlan): void;
56
+ finalizeErrorCode: string;
57
+ mempoolRejectPrefix: string;
58
+ feeRate?: number;
59
+ availableFundingMinConf?: number;
60
+ }): Promise<BuiltWalletMutationTransaction>;
@@ -0,0 +1,127 @@
1
+ import { DEFAULT_WALLET_MUTATION_FEE_RATE_SAT_VB } from "./fee.js";
2
+ import { getDecodedInputScriptPubKeyHex, getDecodedInputVout } from "./psbt-assert.js";
3
+ import { outpointKey } from "./primitives.js";
4
+ import { unlockTemporaryBuilderLocks } from "./state-persist.js";
5
+ import { signAndFinalizeWalletMutation } from "./signing.js";
6
+ function btcNumberToSats(value) {
7
+ return BigInt(Math.round(value * 100_000_000));
8
+ }
9
+ function valueToSats(value) {
10
+ return typeof value === "string"
11
+ ? BigInt(Math.round(Number(value) * 100_000_000))
12
+ : btcNumberToSats(value);
13
+ }
14
+ function isSpendableFundingUtxo(entry, fundingScriptPubKeyHex, minConf) {
15
+ return entry.scriptPubKey === fundingScriptPubKeyHex
16
+ && entry.confirmations >= minConf
17
+ && entry.spendable !== false
18
+ && entry.safe !== false;
19
+ }
20
+ function isReserveFloorFundingError(error) {
21
+ void error;
22
+ return false;
23
+ }
24
+ function computeRemainingFundingValueSats(options) {
25
+ let remaining = 0n;
26
+ for (const value of options.availableFundingValueByKey.values()) {
27
+ remaining += value;
28
+ }
29
+ for (const [index, input] of options.decoded.tx.vin.entries()) {
30
+ const scriptPubKeyHex = getDecodedInputScriptPubKeyHex(options.decoded, index);
31
+ const vout = getDecodedInputVout(input);
32
+ if (scriptPubKeyHex !== options.fundingScriptPubKeyHex || vout === null || typeof input.txid !== "string") {
33
+ continue;
34
+ }
35
+ remaining -= options.availableFundingValueByKey.get(outpointKey({
36
+ txid: input.txid,
37
+ vout,
38
+ })) ?? 0n;
39
+ }
40
+ for (const output of options.decoded.tx.vout) {
41
+ if (output.scriptPubKey?.hex !== options.fundingScriptPubKeyHex) {
42
+ continue;
43
+ }
44
+ remaining += valueToSats(output.value);
45
+ }
46
+ return remaining;
47
+ }
48
+ export async function fundAndValidateWalletMutationDraft(options) {
49
+ const availableFundingMinConf = options.availableFundingMinConf ?? 1;
50
+ const availableFundingUtxos = (await options.rpc.listUnspent(options.walletName, availableFundingMinConf))
51
+ .filter((entry) => isSpendableFundingUtxo(entry, options.plan.allowedFundingScriptPubKeyHex, availableFundingMinConf));
52
+ const validationPlan = {
53
+ ...options.plan,
54
+ eligibleFundingOutpointKeys: new Set([
55
+ ...options.plan.eligibleFundingOutpointKeys,
56
+ ...availableFundingUtxos.map((entry) => outpointKey({ txid: entry.txid, vout: entry.vout })),
57
+ ]),
58
+ };
59
+ const funded = await options.rpc.walletCreateFundedPsbt(options.walletName, options.plan.fixedInputs, options.plan.outputs, 0, {
60
+ add_inputs: true,
61
+ include_unsafe: false,
62
+ minconf: availableFundingMinConf,
63
+ changeAddress: options.plan.changeAddress,
64
+ ...(options.plan.changePosition == null ? {} : { changePosition: options.plan.changePosition }),
65
+ lockUnspents: false,
66
+ fee_rate: options.feeRate ?? DEFAULT_WALLET_MUTATION_FEE_RATE_SAT_VB,
67
+ replaceable: true,
68
+ subtractFeeFromOutputs: [],
69
+ });
70
+ const decoded = await options.rpc.decodePsbt(funded.psbt);
71
+ options.validateFundedDraft(decoded, funded, validationPlan);
72
+ return {
73
+ funded,
74
+ decoded,
75
+ };
76
+ }
77
+ export async function buildWalletMutationTransaction(options) {
78
+ const temporaryBuilderLockedOutpoints = [];
79
+ try {
80
+ const { funded, decoded } = await fundAndValidateWalletMutationDraft({
81
+ rpc: options.rpc,
82
+ walletName: options.walletName,
83
+ plan: options.plan,
84
+ validateFundedDraft: options.validateFundedDraft,
85
+ feeRate: options.feeRate,
86
+ availableFundingMinConf: options.availableFundingMinConf,
87
+ });
88
+ const { signed, rawHex, decodedRaw } = await signAndFinalizeWalletMutation({
89
+ rpc: options.rpc,
90
+ walletName: options.walletName,
91
+ state: options.state,
92
+ psbt: funded.psbt,
93
+ finalizeErrorCode: options.finalizeErrorCode,
94
+ mempoolRejectPrefix: options.mempoolRejectPrefix,
95
+ recoverManagedCoreWalletLockedOnce: options.recoverManagedCoreWalletLockedOnce,
96
+ onManagedCoreWalletLockedRecoveryOutcome: options.onManagedCoreWalletLockedRecoveryOutcome,
97
+ });
98
+ return {
99
+ funded,
100
+ decoded,
101
+ psbt: signed.psbt,
102
+ rawHex,
103
+ txid: decodedRaw.txid,
104
+ wtxid: decodedRaw.hash ?? null,
105
+ temporaryBuilderLockedOutpoints,
106
+ };
107
+ }
108
+ catch (error) {
109
+ await unlockTemporaryBuilderLocks(options.rpc, options.walletName, temporaryBuilderLockedOutpoints);
110
+ throw error;
111
+ }
112
+ }
113
+ export async function buildWalletMutationTransactionWithReserveFallback(options) {
114
+ void isReserveFloorFundingError;
115
+ void computeRemainingFundingValueSats;
116
+ return buildWalletMutationTransaction({
117
+ rpc: options.rpc,
118
+ walletName: options.walletName,
119
+ state: options.state,
120
+ plan: options.plan,
121
+ validateFundedDraft: options.validateFundedDraft,
122
+ finalizeErrorCode: options.finalizeErrorCode,
123
+ mempoolRejectPrefix: options.mempoolRejectPrefix,
124
+ feeRate: options.feeRate,
125
+ availableFundingMinConf: options.availableFundingMinConf,
126
+ });
127
+ }
@@ -4,7 +4,9 @@ import { openWalletReadContext, type WalletReadContext } from "../read/index.js"
4
4
  import { type WalletRuntimePaths } from "../runtime.js";
5
5
  import { type WalletSecretProvider } from "../state/provider.js";
6
6
  import type { PendingMutationRecord, PendingMutationStatus, WalletStateV1 } from "../types.js";
7
- import { type BuiltWalletMutationTransaction, type FixedWalletInput, type WalletMutationFeeSelection, type WalletMutationFeeSummary, type WalletMutationRpcClient } from "./common.js";
7
+ import { type WalletMutationFeeSelection, type WalletMutationFeeSummary } from "./fee.js";
8
+ import type { WalletMutationPublishResult } from "./publish.js";
9
+ import type { BuiltWalletMutationTransaction, FixedWalletInput, WalletMutationRpcClient } from "./types.js";
8
10
  export interface WalletMutationExecutionContext<TRpc extends WalletMutationRpcClient> {
9
11
  provider: WalletSecretProvider;
10
12
  nowUnixMs: number;
@@ -26,17 +28,6 @@ export interface WalletMutationReconcileResult {
26
28
  mutation: PendingMutationRecord;
27
29
  resolution: "confirmed" | "live" | "repair-required" | "not-seen" | "continue";
28
30
  }
29
- export interface WalletMutationPublishResult {
30
- state: WalletStateV1;
31
- mutation: PendingMutationRecord;
32
- status: PendingMutationStatus;
33
- }
34
- export interface WalletMutationPublishRpcClient extends Pick<WalletMutationRpcClient, "lockUnspent"> {
35
- getBlockchainInfo(): Promise<{
36
- blocks: number;
37
- }>;
38
- sendRawTransaction(hex: string): Promise<string>;
39
- }
40
31
  export interface WalletMutationRuntimeOptions<TRpc extends WalletMutationRpcClient> {
41
32
  dataDir: string;
42
33
  databasePath: string;
@@ -124,12 +115,6 @@ export interface WalletMutationOperationSpec<TOperation extends {
124
115
  prepared: TPrepared | null;
125
116
  }): TResult;
126
117
  }
127
- export declare function persistWalletMutationState(options: {
128
- state: WalletStateV1;
129
- provider: WalletSecretProvider;
130
- nowUnixMs: number;
131
- paths: WalletRuntimePaths;
132
- }): Promise<WalletStateV1>;
133
118
  export declare function resolveExistingWalletMutation<TRpc extends Pick<WalletMutationRpcClient, "getMempoolEntry" | "getTransaction" | "getRawTransaction">, TResult>(options: {
134
119
  existingMutation: PendingMutationRecord | null;
135
120
  execution: {
@@ -149,28 +134,9 @@ export declare function resolveExistingWalletMutation<TRpc extends Pick<WalletMu
149
134
  replacementFixedInputs: FixedWalletInput[] | null;
150
135
  result: TResult | null;
151
136
  }>;
152
- export declare function publishWalletMutation<TRpc extends WalletMutationPublishRpcClient>(options: {
153
- rpc: TRpc;
154
- walletName: string;
155
- snapshotHeight: number | null;
156
- built: BuiltWalletMutationTransaction;
157
- mutation: PendingMutationRecord;
158
- state: WalletStateV1;
159
- provider: WalletSecretProvider;
160
- nowUnixMs: number;
161
- paths: WalletRuntimePaths;
162
- errorPrefix: string;
163
- afterAccepted?(options: {
164
- state: WalletStateV1;
165
- broadcastingMutation: PendingMutationRecord;
166
- built: BuiltWalletMutationTransaction;
167
- nowUnixMs: number;
168
- }): Promise<{
169
- state: WalletStateV1;
170
- mutation: PendingMutationRecord;
171
- status: PendingMutationStatus;
172
- }>;
173
- }): Promise<WalletMutationPublishResult>;
137
+ export { persistWalletMutationState } from "./state-persist.js";
138
+ export { publishWalletMutation } from "./publish.js";
139
+ export type { WalletMutationPublishResult, WalletMutationPublishRpcClient, } from "./publish.js";
174
140
  export declare function executeWalletMutationOperation<TOperation extends {
175
141
  state: WalletStateV1;
176
142
  }, TRpc extends WalletMutationRpcClient, TPrepared, TBuilt extends BuiltWalletMutationTransaction, TResult>(options: WalletMutationRuntimeOptions<TRpc> & WalletMutationOperationSpec<TOperation, TRpc, TPrepared, TBuilt, TResult>): Promise<WalletMutationExecutionResult<TResult, TBuilt>>;
@@ -4,22 +4,11 @@ import { acquireFileLock } from "../fs/lock.js";
4
4
  import { openWalletReadContext, } from "../read/index.js";
5
5
  import { resolveWalletRuntimePathsForTesting, } from "../runtime.js";
6
6
  import { createDefaultWalletSecretProvider, } from "../state/provider.js";
7
- import { createBuiltWalletMutationFeeSummary, isAlreadyAcceptedError, isBroadcastUnknownError, pauseMiningForWalletMutation, resolvePendingMutationReuseDecision, resolveWalletMutationFeeSelection, saveWalletStatePreservingUnlock, unlockTemporaryBuilderLocks, updateMutationRecord, } from "./common.js";
7
+ import { createBuiltWalletMutationFeeSummary, resolveWalletMutationFeeSelection, } from "./fee.js";
8
+ import { pauseMiningForWalletMutation } from "./mining-preemption.js";
9
+ import { resolvePendingMutationReuseDecision } from "./reconcile.js";
10
+ import { persistWalletMutationState, unlockTemporaryBuilderLocks } from "./state-persist.js";
8
11
  import { findPendingMutationByIntent, upsertPendingMutation, } from "./journal.js";
9
- export async function persistWalletMutationState(options) {
10
- const nextState = {
11
- ...options.state,
12
- stateRevision: options.state.stateRevision + 1,
13
- lastWrittenAtUnixMs: options.nowUnixMs,
14
- };
15
- await saveWalletStatePreservingUnlock({
16
- state: nextState,
17
- provider: options.provider,
18
- nowUnixMs: options.nowUnixMs,
19
- paths: options.paths,
20
- });
21
- return nextState;
22
- }
23
12
  export async function resolveExistingWalletMutation(options) {
24
13
  if (options.existingMutation === null) {
25
14
  throw new Error("wallet_mutation_existing_required");
@@ -58,91 +47,8 @@ export async function resolveExistingWalletMutation(options) {
58
47
  result: null,
59
48
  };
60
49
  }
61
- export async function publishWalletMutation(options) {
62
- let nextState = options.state;
63
- const broadcastingMutation = updateMutationRecord(options.mutation, "broadcasting", options.nowUnixMs, {
64
- attemptedTxid: options.built.txid,
65
- attemptedWtxid: options.built.wtxid,
66
- temporaryBuilderLockedOutpoints: options.built.temporaryBuilderLockedOutpoints,
67
- });
68
- nextState = await persistWalletMutationState({
69
- state: upsertPendingMutation(nextState, broadcastingMutation),
70
- provider: options.provider,
71
- nowUnixMs: options.nowUnixMs,
72
- paths: options.paths,
73
- });
74
- if (options.snapshotHeight !== null
75
- && options.snapshotHeight !== (await options.rpc.getBlockchainInfo()).blocks) {
76
- await unlockTemporaryBuilderLocks(options.rpc, options.walletName, options.built.temporaryBuilderLockedOutpoints);
77
- throw new Error(`${options.errorPrefix}_tip_mismatch`);
78
- }
79
- try {
80
- await options.rpc.sendRawTransaction(options.built.rawHex);
81
- }
82
- catch (error) {
83
- if (!isAlreadyAcceptedError(error)) {
84
- if (isBroadcastUnknownError(error)) {
85
- const unknownMutation = updateMutationRecord(broadcastingMutation, "broadcast-unknown", options.nowUnixMs, {
86
- attemptedTxid: options.built.txid,
87
- attemptedWtxid: options.built.wtxid,
88
- temporaryBuilderLockedOutpoints: options.built.temporaryBuilderLockedOutpoints,
89
- });
90
- nextState = await persistWalletMutationState({
91
- state: upsertPendingMutation(nextState, unknownMutation),
92
- provider: options.provider,
93
- nowUnixMs: options.nowUnixMs,
94
- paths: options.paths,
95
- });
96
- throw new Error(`${options.errorPrefix}_broadcast_unknown`);
97
- }
98
- await unlockTemporaryBuilderLocks(options.rpc, options.walletName, options.built.temporaryBuilderLockedOutpoints);
99
- const canceledMutation = updateMutationRecord(broadcastingMutation, "canceled", options.nowUnixMs, {
100
- attemptedTxid: options.built.txid,
101
- attemptedWtxid: options.built.wtxid,
102
- temporaryBuilderLockedOutpoints: [],
103
- });
104
- nextState = await persistWalletMutationState({
105
- state: upsertPendingMutation(nextState, canceledMutation),
106
- provider: options.provider,
107
- nowUnixMs: options.nowUnixMs,
108
- paths: options.paths,
109
- });
110
- throw error;
111
- }
112
- }
113
- await unlockTemporaryBuilderLocks(options.rpc, options.walletName, options.built.temporaryBuilderLockedOutpoints);
114
- const accepted = options.afterAccepted === undefined
115
- ? {
116
- state: upsertPendingMutation(nextState, updateMutationRecord(broadcastingMutation, "live", options.nowUnixMs, {
117
- attemptedTxid: options.built.txid,
118
- attemptedWtxid: options.built.wtxid,
119
- temporaryBuilderLockedOutpoints: [],
120
- })),
121
- mutation: updateMutationRecord(broadcastingMutation, "live", options.nowUnixMs, {
122
- attemptedTxid: options.built.txid,
123
- attemptedWtxid: options.built.wtxid,
124
- temporaryBuilderLockedOutpoints: [],
125
- }),
126
- status: "live",
127
- }
128
- : await options.afterAccepted({
129
- state: nextState,
130
- broadcastingMutation,
131
- built: options.built,
132
- nowUnixMs: options.nowUnixMs,
133
- });
134
- const persistedState = await persistWalletMutationState({
135
- state: accepted.state,
136
- provider: options.provider,
137
- nowUnixMs: options.nowUnixMs,
138
- paths: options.paths,
139
- });
140
- return {
141
- state: persistedState,
142
- mutation: accepted.mutation,
143
- status: accepted.status,
144
- };
145
- }
50
+ export { persistWalletMutationState } from "./state-persist.js";
51
+ export { publishWalletMutation } from "./publish.js";
146
52
  export async function executeWalletMutationOperation(options) {
147
53
  const provider = options.provider ?? createDefaultWalletSecretProvider();
148
54
  const nowUnixMs = options.nowUnixMs ?? Date.now();
@@ -0,0 +1,30 @@
1
+ import type { PendingMutationRecord } from "../types.js";
2
+ import type { BuiltWalletMutationTransaction, WalletMutationRpcClient } from "./types.js";
3
+ export declare const DEFAULT_WALLET_MUTATION_FEE_RATE_SAT_VB = 10;
4
+ export declare const NEXT_BLOCK_FEE_CONFIRM_TARGET = 1;
5
+ export type WalletMutationFeeSelectionSource = "custom-satvb" | "estimated-next-block-plus-one" | "fallback-default";
6
+ export interface WalletMutationFeeSelection {
7
+ feeRateSatVb: number;
8
+ source: WalletMutationFeeSelectionSource;
9
+ }
10
+ export interface WalletMutationFeeSummary extends WalletMutationFeeSelection {
11
+ feeSats: string | null;
12
+ }
13
+ export declare function formatSatVb(value: number): string;
14
+ export declare function createWalletMutationFeeMetadata(selection: WalletMutationFeeSelection): {
15
+ selectedFeeRateSatVb: number;
16
+ feeSelectionSource: WalletMutationFeeSelectionSource;
17
+ };
18
+ export declare function resolveWalletMutationFeeSelection(options: {
19
+ rpc: Pick<WalletMutationRpcClient, "estimateSmartFee">;
20
+ feeRateSatVb?: number | null;
21
+ }): Promise<WalletMutationFeeSelection>;
22
+ export declare function createWalletMutationFeeSummary(selection: WalletMutationFeeSelection, feeSats: string | null): WalletMutationFeeSummary;
23
+ export declare function createBuiltWalletMutationFeeSummary(options: {
24
+ selection: WalletMutationFeeSelection;
25
+ built: BuiltWalletMutationTransaction;
26
+ }): WalletMutationFeeSummary;
27
+ export declare function resolvePendingMutationFeeSummary(options: {
28
+ rpc: Pick<WalletMutationRpcClient, "getMempoolEntry">;
29
+ mutation: PendingMutationRecord;
30
+ }): Promise<WalletMutationFeeSummary>;
@@ -0,0 +1,98 @@
1
+ export const DEFAULT_WALLET_MUTATION_FEE_RATE_SAT_VB = 10;
2
+ export const NEXT_BLOCK_FEE_CONFIRM_TARGET = 1;
3
+ function btcNumberToSats(value) {
4
+ return BigInt(Math.round(value * 100_000_000));
5
+ }
6
+ function normalizeSatVb(value) {
7
+ return Number.parseFloat(value.toFixed(8));
8
+ }
9
+ function satVbFromBtcPerKvB(value) {
10
+ return normalizeSatVb((value * 100_000_000) / 1_000);
11
+ }
12
+ function feeRateFromMempoolEntry(entry) {
13
+ if (!Number.isFinite(entry.vsize) || entry.vsize <= 0) {
14
+ return null;
15
+ }
16
+ const feeSats = Number(btcNumberToSats(entry.fees.base));
17
+ if (!Number.isFinite(feeSats) || feeSats <= 0) {
18
+ return null;
19
+ }
20
+ return normalizeSatVb(feeSats / entry.vsize);
21
+ }
22
+ export function formatSatVb(value) {
23
+ return normalizeSatVb(value).toString();
24
+ }
25
+ export function createWalletMutationFeeMetadata(selection) {
26
+ return {
27
+ selectedFeeRateSatVb: selection.feeRateSatVb,
28
+ feeSelectionSource: selection.source,
29
+ };
30
+ }
31
+ export async function resolveWalletMutationFeeSelection(options) {
32
+ if (typeof options.feeRateSatVb === "number") {
33
+ return {
34
+ feeRateSatVb: normalizeSatVb(options.feeRateSatVb),
35
+ source: "custom-satvb",
36
+ };
37
+ }
38
+ if (options.rpc.estimateSmartFee !== undefined) {
39
+ try {
40
+ const estimate = await options.rpc.estimateSmartFee(NEXT_BLOCK_FEE_CONFIRM_TARGET, "conservative");
41
+ const estimatedSatVb = typeof estimate.feerate === "number"
42
+ ? satVbFromBtcPerKvB(estimate.feerate)
43
+ : null;
44
+ if (estimatedSatVb !== null && Number.isFinite(estimatedSatVb) && estimatedSatVb > 0) {
45
+ return {
46
+ feeRateSatVb: normalizeSatVb(estimatedSatVb + 1),
47
+ source: "estimated-next-block-plus-one",
48
+ };
49
+ }
50
+ }
51
+ catch {
52
+ // Fall through to the compatibility default.
53
+ }
54
+ }
55
+ return {
56
+ feeRateSatVb: DEFAULT_WALLET_MUTATION_FEE_RATE_SAT_VB,
57
+ source: "fallback-default",
58
+ };
59
+ }
60
+ export function createWalletMutationFeeSummary(selection, feeSats) {
61
+ return {
62
+ feeRateSatVb: selection.feeRateSatVb,
63
+ feeSats,
64
+ source: selection.source,
65
+ };
66
+ }
67
+ export function createBuiltWalletMutationFeeSummary(options) {
68
+ return createWalletMutationFeeSummary(options.selection, btcNumberToSats(options.built.funded.fee).toString());
69
+ }
70
+ export async function resolvePendingMutationFeeSummary(options) {
71
+ const source = options.mutation.feeSelectionSource ?? "fallback-default";
72
+ const selectedFeeRateSatVb = typeof options.mutation.selectedFeeRateSatVb === "number"
73
+ && Number.isFinite(options.mutation.selectedFeeRateSatVb)
74
+ && options.mutation.selectedFeeRateSatVb > 0
75
+ ? normalizeSatVb(options.mutation.selectedFeeRateSatVb)
76
+ : DEFAULT_WALLET_MUTATION_FEE_RATE_SAT_VB;
77
+ if (options.mutation.attemptedTxid !== null && options.rpc.getMempoolEntry !== undefined) {
78
+ try {
79
+ const entry = await options.rpc.getMempoolEntry(options.mutation.attemptedTxid);
80
+ const feeRateSatVb = feeRateFromMempoolEntry(entry);
81
+ if (feeRateSatVb !== null) {
82
+ return {
83
+ feeRateSatVb,
84
+ feeSats: btcNumberToSats(entry.fees.base).toString(),
85
+ source,
86
+ };
87
+ }
88
+ }
89
+ catch {
90
+ // Fall back to stored metadata or the historical default.
91
+ }
92
+ }
93
+ return {
94
+ feeRateSatVb: selectedFeeRateSatVb,
95
+ feeSats: null,
96
+ source,
97
+ };
98
+ }
@@ -0,0 +1,11 @@
1
+ import type { WalletPrompter } from "../../lifecycle.js";
2
+ declare function confirmYesNo(prompter: WalletPrompter, message: string, errorCode: string, options: {
3
+ assumeYes?: boolean;
4
+ requiresTtyErrorCode: string;
5
+ }): Promise<void>;
6
+ declare function confirmTyped(prompter: WalletPrompter, expected: string, prompt: string, errorCode: string, options: {
7
+ assumeYes?: boolean;
8
+ requiresTtyErrorCode: string;
9
+ typedAckRequiredErrorCode: string;
10
+ }): Promise<void>;
11
+ export { confirmTyped, confirmYesNo };
@@ -0,0 +1,19 @@
1
+ import { confirmTypedAcknowledgement as confirmSharedTypedAcknowledgement, confirmYesNo as confirmSharedYesNo, } from "../confirm.js";
2
+ async function confirmYesNo(prompter, message, errorCode, options) {
3
+ await confirmSharedYesNo(prompter, message, {
4
+ assumeYes: options.assumeYes,
5
+ errorCode,
6
+ requiresTtyErrorCode: options.requiresTtyErrorCode,
7
+ });
8
+ }
9
+ async function confirmTyped(prompter, expected, prompt, errorCode, options) {
10
+ await confirmSharedTypedAcknowledgement(prompter, {
11
+ assumeYes: options.assumeYes,
12
+ expected,
13
+ prompt,
14
+ errorCode,
15
+ requiresTtyErrorCode: options.requiresTtyErrorCode,
16
+ typedAckRequiredErrorCode: options.typedAckRequiredErrorCode,
17
+ });
18
+ }
19
+ export { confirmTyped, confirmYesNo };
@@ -0,0 +1,23 @@
1
+ import type { WalletRuntimePaths } from "../../runtime.js";
2
+ import type { WalletSecretProvider } from "../../state/provider.js";
3
+ import type { PendingMutationRecord, WalletStateV1 } from "../../types.js";
4
+ import type { WalletReadContext } from "../../read/index.js";
5
+ import { findDomainField } from "../../read/index.js";
6
+ import type { FieldDraftMutationOptions, FieldRpcClient } from "./types.js";
7
+ export declare function createStandaloneFieldMutation(options: FieldDraftMutationOptions): PendingMutationRecord;
8
+ export declare function findActiveFieldCreateMutationByDomain(state: WalletStateV1, domainName: string, intentFingerprintHex: string): PendingMutationRecord | null;
9
+ export declare function getObservedFieldState(context: WalletReadContext, domainName: string, fieldName: string): ReturnType<typeof findDomainField>;
10
+ export declare function reconcilePendingFieldMutation(options: {
11
+ state: WalletStateV1;
12
+ mutation: PendingMutationRecord;
13
+ provider: WalletSecretProvider;
14
+ nowUnixMs: number;
15
+ paths: WalletRuntimePaths;
16
+ rpc: FieldRpcClient;
17
+ walletName: string;
18
+ context: WalletReadContext;
19
+ }): Promise<{
20
+ state: WalletStateV1;
21
+ mutation: PendingMutationRecord;
22
+ resolution: "confirmed" | "live" | "repair-required" | "not-seen" | "continue";
23
+ }>;