@cogcoin/client 1.1.15 → 1.1.16

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.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # `@cogcoin/client`
2
2
 
3
- `@cogcoin/client@1.1.15` is the reference Cogcoin client package for applications that want a local wallet, durable SQLite-backed state, and a managed Bitcoin Core integration around `@cogcoin/indexer`. It publishes the reusable client APIs, the SQLite adapter, the managed `bitcoind` integration, and the first-party `cogcoin` CLI in one package.
3
+ `@cogcoin/client@1.1.16` is the reference Cogcoin client package for applications that want a local wallet, durable SQLite-backed state, and a managed Bitcoin Core integration around `@cogcoin/indexer`. It publishes the reusable client APIs, the SQLite adapter, the managed `bitcoind` integration, and the first-party `cogcoin` CLI in one package.
4
4
 
5
5
  Use Node 22 or newer.
6
6
 
@@ -12,11 +12,6 @@ Install Cogcoin:
12
12
  curl -fsSL https://cogcoin.org/install.sh | bash
13
13
  # or on Windows PowerShell:
14
14
  powershell -NoProfile -ExecutionPolicy Bypass -Command "irm https://cogcoin.org/install.ps1 | iex"
15
-
16
- # The installer provisions and uses a Cogcoin-managed Node.js runtime.
17
- # On macOS, Homebrew is only used if it is already installed and bootstrap tools are missing.
18
- # `cogcoin init` starts automatically in an interactive terminal and continues into sync.
19
- # If macOS Command Line Tools are still installing, the installer prints an exact resume command.
20
15
  cogcoin address # Send 0.0015 BTC to address
21
16
  cogcoin register <domainname> # 6+ character domain for 0.001 BTC
22
17
  cogcoin anchor <domainname> # You can leave a founding message permanently on Bitcoin!
@@ -24,6 +19,20 @@ cogcoin mine setup
24
19
  cogcoin mine # Use remaining ~0.0005 BTC for mining tx, ~1000 sats per entry (0.00001 BTC)
25
20
  ```
26
21
 
22
+ ### What The Installer Does
23
+
24
+ - Installs and uses a Cogcoin-managed Node.js runtime.
25
+ - Updates PATH for future shells so the managed `cogcoin` command stays available.
26
+ - Installs `@cogcoin/client` into a Cogcoin-managed global npm prefix.
27
+ - Starts `cogcoin init` automatically only when the installer is running in an interactive terminal.
28
+
29
+ ### If The Installer Pauses Or Exits Early
30
+
31
+ - On macOS, Homebrew is only used if it is already installed and bootstrap tools are missing.
32
+ - If the installer is noninteractive, it finishes by printing one exact `cogcoin init` follow-up command.
33
+ - If you set `COGCOIN_SKIP_INIT=1`, the installer skips `cogcoin init` and prints the exact manual command to run later.
34
+ - If macOS Command Line Tools are still installing, the installer either waits and retries automatically or prints the exact resume command.
35
+
27
36
  ## Preview
28
37
 
29
38
  ```bash
@@ -43,6 +43,24 @@ export function createInsufficientFundsMiningPublishWaitingNote() {
43
43
  export function createInsufficientFundsMiningPublishErrorMessage() {
44
44
  return "Bitcoin Core could not fund the next mining publish with safe BTC.";
45
45
  }
46
+ function clearAutoReconciledMiningPublish(state, currentPublishDecision) {
47
+ return {
48
+ ...state,
49
+ miningState: {
50
+ ...clearMiningPublishState(state.miningState),
51
+ currentPublishDecision,
52
+ },
53
+ };
54
+ }
55
+ async function hasConfirmedWalletConflict(options) {
56
+ for (const txid of options.conflictTxids) {
57
+ const conflictTx = await options.rpc.getTransaction(options.walletName, txid).catch(() => null);
58
+ if (conflictTx !== null && conflictTx.confirmations > 0) {
59
+ return true;
60
+ }
61
+ }
62
+ return false;
63
+ }
46
64
  function createMiningFundingProbeCandidate(options) {
47
65
  const referencedBlockHashInternal = Buffer.from(displayToInternalBlockhash(options.referencedBlockHashDisplay), "hex");
48
66
  const bip39WordIndices = deriveMiningWordIndices(referencedBlockHashInternal, options.domain.domainId);
@@ -193,6 +211,9 @@ export async function reconcileLiveMiningState(options) {
193
211
  };
194
212
  const currentTxid = state.miningState.currentTxid;
195
213
  if (currentTxid === null || !miningPublishMayStillExist(state.miningState)) {
214
+ if (state.miningState.state === "repair-required") {
215
+ state = clearAutoReconciledMiningPublish(state, "repair-auto-cleared-empty-publish");
216
+ }
196
217
  await reconcilePersistentPolicyLocks({
197
218
  rpc: options.rpc,
198
219
  walletName: state.managedCoreWallet.walletName,
@@ -266,6 +287,24 @@ export async function reconcileLiveMiningState(options) {
266
287
  };
267
288
  }
268
289
  if ((walletTx?.walletconflicts?.length ?? 0) > 0) {
290
+ const confirmedConflict = await hasConfirmedWalletConflict({
291
+ rpc: options.rpc,
292
+ walletName,
293
+ conflictTxids: walletTx?.walletconflicts ?? [],
294
+ });
295
+ if (confirmedConflict) {
296
+ state = clearAutoReconciledMiningPublish(state, "repair-auto-cleared-confirmed-conflict");
297
+ await reconcilePersistentPolicyLocks({
298
+ rpc: options.rpc,
299
+ walletName: state.managedCoreWallet.walletName,
300
+ state,
301
+ fixedInputs: [],
302
+ });
303
+ return {
304
+ state,
305
+ recentWin: null,
306
+ };
307
+ }
269
308
  state = defaultMiningStatePatch(state, {
270
309
  state: "repair-required",
271
310
  pauseReason: state.miningState.currentPublishState === "broadcast-unknown"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cogcoin/client",
3
- "version": "1.1.15",
3
+ "version": "1.1.16",
4
4
  "description": "Store-backed Cogcoin client with wallet flows, SQLite persistence, and managed Bitcoin Core integration.",
5
5
  "license": "MIT",
6
6
  "type": "module",