@cogcoin/client 0.5.5 → 0.5.7
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 +11 -2
- package/dist/bitcoind/bootstrap/chainstate.d.ts +2 -1
- package/dist/bitcoind/bootstrap/chainstate.js +4 -1
- package/dist/bitcoind/bootstrap/controller.d.ts +4 -1
- package/dist/bitcoind/bootstrap/controller.js +42 -5
- package/dist/bitcoind/bootstrap/getblock-archive.d.ts +39 -0
- package/dist/bitcoind/bootstrap/getblock-archive.js +548 -0
- package/dist/bitcoind/bootstrap/headers.d.ts +12 -0
- package/dist/bitcoind/bootstrap/headers.js +95 -10
- package/dist/bitcoind/bootstrap.d.ts +1 -0
- package/dist/bitcoind/bootstrap.js +1 -0
- package/dist/bitcoind/client/factory.js +91 -28
- package/dist/bitcoind/client/managed-client.d.ts +1 -1
- package/dist/bitcoind/client/managed-client.js +4 -3
- package/dist/bitcoind/client/sync-engine.js +55 -13
- package/dist/bitcoind/errors.js +18 -0
- package/dist/bitcoind/indexer-daemon-main.js +78 -0
- package/dist/bitcoind/indexer-daemon.d.ts +10 -1
- package/dist/bitcoind/indexer-daemon.js +44 -28
- package/dist/bitcoind/node.js +2 -0
- package/dist/bitcoind/processing-start-height.d.ts +7 -0
- package/dist/bitcoind/processing-start-height.js +9 -0
- package/dist/bitcoind/progress/constants.d.ts +1 -0
- package/dist/bitcoind/progress/constants.js +1 -0
- package/dist/bitcoind/progress/controller.d.ts +22 -0
- package/dist/bitcoind/progress/controller.js +49 -23
- package/dist/bitcoind/progress/formatting.js +29 -1
- package/dist/bitcoind/progress/render-policy.d.ts +35 -0
- package/dist/bitcoind/progress/render-policy.js +81 -0
- package/dist/bitcoind/retryable-rpc.d.ts +11 -0
- package/dist/bitcoind/retryable-rpc.js +30 -0
- package/dist/bitcoind/service-paths.js +2 -6
- package/dist/bitcoind/service.d.ts +21 -2
- package/dist/bitcoind/service.js +274 -122
- package/dist/bitcoind/testing.d.ts +2 -2
- package/dist/bitcoind/testing.js +2 -2
- package/dist/bitcoind/types.d.ts +36 -1
- package/dist/cli/commands/follow.js +11 -0
- package/dist/cli/commands/getblock-archive-restart.d.ts +5 -0
- package/dist/cli/commands/getblock-archive-restart.js +15 -0
- package/dist/cli/commands/mining-admin.js +4 -0
- package/dist/cli/commands/mining-read.js +8 -5
- package/dist/cli/commands/mining-runtime.js +4 -0
- package/dist/cli/commands/service-runtime.js +150 -134
- package/dist/cli/commands/status.js +2 -0
- package/dist/cli/commands/sync.js +11 -0
- package/dist/cli/commands/wallet-admin.js +106 -24
- package/dist/cli/commands/wallet-mutation.js +57 -4
- package/dist/cli/commands/wallet-read.js +2 -0
- package/dist/cli/context.js +8 -4
- package/dist/cli/mutation-command-groups.d.ts +2 -1
- package/dist/cli/mutation-command-groups.js +5 -0
- package/dist/cli/mutation-json.d.ts +18 -2
- package/dist/cli/mutation-json.js +49 -0
- package/dist/cli/mutation-success.d.ts +1 -0
- package/dist/cli/mutation-success.js +2 -2
- package/dist/cli/output.js +86 -1
- package/dist/cli/parse.d.ts +1 -1
- package/dist/cli/parse.js +133 -3
- package/dist/cli/preview-json.d.ts +10 -1
- package/dist/cli/preview-json.js +32 -0
- package/dist/cli/prompt.js +1 -1
- package/dist/cli/runner.js +4 -0
- package/dist/cli/types.d.ts +15 -5
- package/dist/cli/types.js +1 -1
- package/dist/cli/wallet-format.js +140 -14
- package/dist/wallet/lifecycle.d.ts +21 -1
- package/dist/wallet/lifecycle.js +252 -116
- package/dist/wallet/mining/visualizer.d.ts +11 -6
- package/dist/wallet/mining/visualizer.js +32 -15
- package/dist/wallet/read/context.js +10 -4
- package/dist/wallet/reset.d.ts +61 -2
- package/dist/wallet/reset.js +246 -89
- package/dist/wallet/root-resolution.d.ts +20 -0
- package/dist/wallet/root-resolution.js +37 -0
- package/dist/wallet/runtime.d.ts +13 -1
- package/dist/wallet/runtime.js +54 -11
- package/dist/wallet/state/crypto.d.ts +3 -0
- package/dist/wallet/state/crypto.js +3 -0
- package/dist/wallet/state/provider.d.ts +1 -0
- package/dist/wallet/state/provider.js +119 -3
- package/dist/wallet/state/seed-index.d.ts +43 -0
- package/dist/wallet/state/seed-index.js +151 -0
- package/dist/wallet/state/storage.d.ts +7 -1
- package/dist/wallet/state/storage.js +39 -0
- package/dist/wallet/tx/anchor.d.ts +22 -0
- package/dist/wallet/tx/anchor.js +215 -8
- package/dist/wallet/tx/index.d.ts +1 -1
- package/dist/wallet/tx/index.js +1 -1
- package/dist/wallet/types.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { parseUnlockDurationToMs } from "../../wallet/lifecycle.js";
|
|
2
|
-
import { buildInitMutationData, buildResetMutationData, buildRestoreMutationData, buildUnlockMutationData, buildRepairMutationData, buildWalletExportMutationData, buildWalletImportMutationData, buildWalletLockMutationData, } from "../mutation-json.js";
|
|
2
|
+
import { buildInitMutationData, buildResetMutationData, buildRestoreMutationData, buildWalletDeleteMutationData, buildUnlockMutationData, buildRepairMutationData, buildWalletExportMutationData, buildWalletImportMutationData, buildWalletLockMutationData, } from "../mutation-json.js";
|
|
3
3
|
import { buildResetPreviewData, buildRepairPreviewData, buildWalletLockPreviewData, } from "../preview-json.js";
|
|
4
4
|
import { writeLine } from "../io.js";
|
|
5
5
|
import { createTerminalPrompter } from "../prompt.js";
|
|
@@ -21,8 +21,68 @@ function getResetWarnings(result) {
|
|
|
21
21
|
? ["Some existing Cogcoin secret-provider entries could not be discovered from the remaining local wallet artifacts and may need manual cleanup."]
|
|
22
22
|
: [];
|
|
23
23
|
}
|
|
24
|
+
function getResetNextSteps(result) {
|
|
25
|
+
return result.walletAction === "deleted" || result.walletAction === "not-present"
|
|
26
|
+
? ["Run `cogcoin init` to create a new wallet."]
|
|
27
|
+
: ["Run `cogcoin sync` to bootstrap assumeutxo and the managed Bitcoin/indexer state."];
|
|
28
|
+
}
|
|
29
|
+
function formatResetBitcoinDataDirStatus(result) {
|
|
30
|
+
if (result.bitcoinDataDir.status === "outside-reset-scope") {
|
|
31
|
+
return "preserved (outside reset scope)";
|
|
32
|
+
}
|
|
33
|
+
return result.bitcoinDataDir.status;
|
|
34
|
+
}
|
|
35
|
+
function resetTextEntry(label, value, ok) {
|
|
36
|
+
return {
|
|
37
|
+
text: `${label}: ${value}`,
|
|
38
|
+
ok,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function formatResetSection(header, entries) {
|
|
42
|
+
return [header, ...entries.map((entry) => `${entry.ok ? "✓" : "✗"} ${entry.text}`)].join("\n");
|
|
43
|
+
}
|
|
44
|
+
function formatResetResultText(result) {
|
|
45
|
+
const warnings = getResetWarnings(result);
|
|
46
|
+
const nextStep = getResetNextSteps(result)[0] ?? null;
|
|
47
|
+
const secretCleanupOk = result.secretCleanupStatus !== "unknown" && result.secretCleanupStatus !== "failed";
|
|
48
|
+
const managedCleanupOk = result.stoppedProcesses.survivors === 0;
|
|
49
|
+
const outcomeEntries = [
|
|
50
|
+
resetTextEntry("Wallet action", result.walletAction, true),
|
|
51
|
+
resetTextEntry("Snapshot", result.bootstrapSnapshot.status, true),
|
|
52
|
+
resetTextEntry("Bitcoin datadir", formatResetBitcoinDataDirStatus(result), true),
|
|
53
|
+
resetTextEntry("Secret cleanup", result.secretCleanupStatus, secretCleanupOk),
|
|
54
|
+
];
|
|
55
|
+
if (result.walletAction !== "retain-mnemonic" && result.walletOldRootId !== null) {
|
|
56
|
+
outcomeEntries.push(resetTextEntry("Previous wallet root", result.walletOldRootId, true));
|
|
57
|
+
}
|
|
58
|
+
if (result.walletAction !== "retain-mnemonic" && result.walletNewRootId !== null) {
|
|
59
|
+
outcomeEntries.push(resetTextEntry("New wallet root", result.walletNewRootId, true));
|
|
60
|
+
}
|
|
61
|
+
const sections = [
|
|
62
|
+
formatResetSection("Paths", [
|
|
63
|
+
resetTextEntry("Data root", result.dataRoot, true),
|
|
64
|
+
]),
|
|
65
|
+
formatResetSection("Reset Outcome", outcomeEntries),
|
|
66
|
+
formatResetSection("Managed Cleanup", [
|
|
67
|
+
resetTextEntry("Managed bitcoind processes stopped", String(result.stoppedProcesses.managedBitcoind), managedCleanupOk),
|
|
68
|
+
resetTextEntry("Indexer daemons stopped", String(result.stoppedProcesses.indexerDaemon), managedCleanupOk),
|
|
69
|
+
resetTextEntry("Background miners stopped", String(result.stoppedProcesses.backgroundMining), managedCleanupOk),
|
|
70
|
+
]),
|
|
71
|
+
];
|
|
72
|
+
if (warnings.length > 0) {
|
|
73
|
+
sections.push(formatResetSection("Warnings", warnings.map((warning) => resetTextEntry("Warning", warning, false))));
|
|
74
|
+
}
|
|
75
|
+
const parts = [
|
|
76
|
+
"\n⛭ Cogcoin Reset ⛭",
|
|
77
|
+
...sections,
|
|
78
|
+
];
|
|
79
|
+
if (nextStep !== null) {
|
|
80
|
+
parts.push(`Next step: ${nextStep}`);
|
|
81
|
+
}
|
|
82
|
+
return parts.join("\n\n");
|
|
83
|
+
}
|
|
24
84
|
export async function runWalletAdminCommand(parsed, context) {
|
|
25
|
-
const runtimePaths = context.resolveWalletRuntimePaths();
|
|
85
|
+
const runtimePaths = context.resolveWalletRuntimePaths(parsed.seedName);
|
|
26
86
|
const stopWatcher = createOwnedLockCleanupSignalWatcher(context.signalSource, context.forceExit, [
|
|
27
87
|
runtimePaths.walletControlLockPath,
|
|
28
88
|
runtimePaths.miningControlLockPath,
|
|
@@ -31,14 +91,15 @@ export async function runWalletAdminCommand(parsed, context) {
|
|
|
31
91
|
]);
|
|
32
92
|
try {
|
|
33
93
|
const outcome = await waitForCompletionOrStop((async () => {
|
|
34
|
-
const dataDir = parsed.dataDir ?? context.resolveDefaultBitcoindDataDir();
|
|
35
94
|
const provider = context.walletSecretProvider;
|
|
36
95
|
if (parsed.command === "init" || parsed.command === "wallet-init") {
|
|
96
|
+
const dataDir = parsed.dataDir ?? context.resolveDefaultBitcoindDataDir();
|
|
37
97
|
const prompter = createCommandPrompter(parsed, context);
|
|
38
98
|
const result = await context.initializeWallet({
|
|
39
99
|
dataDir,
|
|
40
100
|
provider,
|
|
41
101
|
prompter,
|
|
102
|
+
paths: runtimePaths,
|
|
42
103
|
});
|
|
43
104
|
const nextSteps = getInitNextSteps();
|
|
44
105
|
if (parsed.outputMode === "json") {
|
|
@@ -59,11 +120,13 @@ export async function runWalletAdminCommand(parsed, context) {
|
|
|
59
120
|
return 0;
|
|
60
121
|
}
|
|
61
122
|
if (parsed.command === "restore" || parsed.command === "wallet-restore") {
|
|
123
|
+
const dataDir = parsed.dataDir ?? context.resolveDefaultBitcoindDataDir();
|
|
62
124
|
const prompter = createCommandPrompter(parsed, context);
|
|
63
125
|
const result = await context.restoreWalletFromMnemonic({
|
|
64
126
|
dataDir,
|
|
65
127
|
provider,
|
|
66
128
|
prompter,
|
|
129
|
+
paths: runtimePaths,
|
|
67
130
|
});
|
|
68
131
|
const nextSteps = getRestoreNextSteps();
|
|
69
132
|
const explanations = ["Managed Bitcoin/indexer bootstrap is deferred until you run `cogcoin sync`."];
|
|
@@ -75,7 +138,7 @@ export async function runWalletAdminCommand(parsed, context) {
|
|
|
75
138
|
}));
|
|
76
139
|
return 0;
|
|
77
140
|
}
|
|
78
|
-
writeLine(context.stdout,
|
|
141
|
+
writeLine(context.stdout, `Wallet seed "${result.seedName}" restored from mnemonic.`);
|
|
79
142
|
writeLine(context.stdout, `Wallet root: ${result.walletRootId}`);
|
|
80
143
|
writeLine(context.stdout, `Funding address: ${result.fundingAddress}`);
|
|
81
144
|
writeLine(context.stdout, `Unlocked until: ${new Date(result.unlockUntilUnixMs).toISOString()}`);
|
|
@@ -88,12 +151,40 @@ export async function runWalletAdminCommand(parsed, context) {
|
|
|
88
151
|
}
|
|
89
152
|
return 0;
|
|
90
153
|
}
|
|
154
|
+
if (parsed.command === "wallet-delete") {
|
|
155
|
+
const dataDir = parsed.dataDir ?? context.resolveDefaultBitcoindDataDir();
|
|
156
|
+
const prompter = createCommandPrompter(parsed, context);
|
|
157
|
+
const result = await context.deleteImportedWalletSeed({
|
|
158
|
+
dataDir,
|
|
159
|
+
provider,
|
|
160
|
+
prompter,
|
|
161
|
+
assumeYes: parsed.assumeYes,
|
|
162
|
+
paths: runtimePaths,
|
|
163
|
+
});
|
|
164
|
+
if (parsed.outputMode === "json") {
|
|
165
|
+
writeJsonValue(context.stdout, createMutationSuccessEnvelope(resolveStableMutationJsonSchema(parsed), describeCanonicalCommand(parsed), "deleted", buildWalletDeleteMutationData(result)));
|
|
166
|
+
return 0;
|
|
167
|
+
}
|
|
168
|
+
writeLine(context.stdout, `Imported wallet seed "${result.seedName}" deleted.`);
|
|
169
|
+
writeLine(context.stdout, `Wallet root: ${result.walletRootId}`);
|
|
170
|
+
return 0;
|
|
171
|
+
}
|
|
172
|
+
if (parsed.command === "wallet-show-mnemonic") {
|
|
173
|
+
const prompter = createCommandPrompter(parsed, context);
|
|
174
|
+
await context.showWalletMnemonic({
|
|
175
|
+
provider,
|
|
176
|
+
prompter,
|
|
177
|
+
paths: runtimePaths,
|
|
178
|
+
});
|
|
179
|
+
return 0;
|
|
180
|
+
}
|
|
91
181
|
const dbPath = parsed.dbPath ?? context.resolveDefaultClientDatabasePath();
|
|
92
182
|
if (parsed.command === "unlock" || parsed.command === "wallet-unlock") {
|
|
93
183
|
const durationMs = parseUnlockDurationToMs(parsed.unlockFor);
|
|
94
184
|
const result = await context.unlockWallet({
|
|
95
185
|
provider,
|
|
96
186
|
unlockDurationMs: durationMs,
|
|
187
|
+
paths: runtimePaths,
|
|
97
188
|
});
|
|
98
189
|
if (parsed.outputMode === "json") {
|
|
99
190
|
writeJsonValue(context.stdout, createMutationSuccessEnvelope(resolveStableMutationJsonSchema(parsed), describeCanonicalCommand(parsed), "unlocked", buildUnlockMutationData(result)));
|
|
@@ -105,6 +196,7 @@ export async function runWalletAdminCommand(parsed, context) {
|
|
|
105
196
|
return 0;
|
|
106
197
|
}
|
|
107
198
|
if (parsed.command === "reset") {
|
|
199
|
+
const dataDir = parsed.dataDir ?? context.resolveDefaultBitcoindDataDir();
|
|
108
200
|
if (parsed.outputMode === "preview-json") {
|
|
109
201
|
const preview = await context.previewResetWallet({
|
|
110
202
|
dataDir,
|
|
@@ -122,32 +214,15 @@ export async function runWalletAdminCommand(parsed, context) {
|
|
|
122
214
|
if (parsed.outputMode === "json") {
|
|
123
215
|
writeJsonValue(context.stdout, createMutationSuccessEnvelope(resolveStableMutationJsonSchema(parsed), describeCanonicalCommand(parsed), "completed", buildResetMutationData(result), {
|
|
124
216
|
warnings: getResetWarnings(result),
|
|
125
|
-
nextSteps: result
|
|
126
|
-
? ["Run `cogcoin init` to create a new wallet."]
|
|
127
|
-
: ["Run `cogcoin status` to inspect the reset local state."],
|
|
217
|
+
nextSteps: getResetNextSteps(result),
|
|
128
218
|
}));
|
|
129
219
|
return 0;
|
|
130
220
|
}
|
|
131
|
-
writeLine(context.stdout,
|
|
132
|
-
writeLine(context.stdout, `Data root: ${result.dataRoot}`);
|
|
133
|
-
writeLine(context.stdout, `Wallet action: ${result.walletAction}`);
|
|
134
|
-
writeLine(context.stdout, `Snapshot: ${result.bootstrapSnapshot.status}`);
|
|
135
|
-
writeLine(context.stdout, `Secret cleanup: ${result.secretCleanupStatus}`);
|
|
136
|
-
writeLine(context.stdout, `Managed bitcoind processes stopped: ${result.stoppedProcesses.managedBitcoind}`);
|
|
137
|
-
writeLine(context.stdout, `Indexer daemons stopped: ${result.stoppedProcesses.indexerDaemon}`);
|
|
138
|
-
writeLine(context.stdout, `Background miners stopped: ${result.stoppedProcesses.backgroundMining}`);
|
|
139
|
-
if (result.walletOldRootId !== null) {
|
|
140
|
-
writeLine(context.stdout, `Previous wallet root: ${result.walletOldRootId}`);
|
|
141
|
-
}
|
|
142
|
-
if (result.walletNewRootId !== null) {
|
|
143
|
-
writeLine(context.stdout, `New wallet root: ${result.walletNewRootId}`);
|
|
144
|
-
}
|
|
145
|
-
for (const warning of getResetWarnings(result)) {
|
|
146
|
-
writeLine(context.stdout, `Warning: ${warning}`);
|
|
147
|
-
}
|
|
221
|
+
writeLine(context.stdout, formatResetResultText(result));
|
|
148
222
|
return 0;
|
|
149
223
|
}
|
|
150
224
|
if (parsed.command === "wallet-export") {
|
|
225
|
+
const dataDir = parsed.dataDir ?? context.resolveDefaultBitcoindDataDir();
|
|
151
226
|
const prompter = createCommandPrompter(parsed, context);
|
|
152
227
|
const result = await context.exportWallet({
|
|
153
228
|
archivePath: parsed.args[0],
|
|
@@ -155,6 +230,7 @@ export async function runWalletAdminCommand(parsed, context) {
|
|
|
155
230
|
databasePath: dbPath,
|
|
156
231
|
provider,
|
|
157
232
|
prompter,
|
|
233
|
+
paths: runtimePaths,
|
|
158
234
|
});
|
|
159
235
|
if (parsed.outputMode === "json") {
|
|
160
236
|
writeJsonValue(context.stdout, createMutationSuccessEnvelope(resolveStableMutationJsonSchema(parsed), describeCanonicalCommand(parsed), "exported", buildWalletExportMutationData(result)));
|
|
@@ -166,6 +242,7 @@ export async function runWalletAdminCommand(parsed, context) {
|
|
|
166
242
|
return 0;
|
|
167
243
|
}
|
|
168
244
|
if (parsed.command === "wallet-import") {
|
|
245
|
+
const dataDir = parsed.dataDir ?? context.resolveDefaultBitcoindDataDir();
|
|
169
246
|
const prompter = createCommandPrompter(parsed, context);
|
|
170
247
|
const result = await context.importWallet({
|
|
171
248
|
archivePath: parsed.args[0],
|
|
@@ -173,6 +250,7 @@ export async function runWalletAdminCommand(parsed, context) {
|
|
|
173
250
|
databasePath: dbPath,
|
|
174
251
|
provider,
|
|
175
252
|
prompter,
|
|
253
|
+
paths: runtimePaths,
|
|
176
254
|
});
|
|
177
255
|
if (parsed.outputMode === "json") {
|
|
178
256
|
writeJsonValue(context.stdout, createMutationSuccessEnvelope(resolveStableMutationJsonSchema(parsed), describeCanonicalCommand(parsed), "imported", buildWalletImportMutationData(result)));
|
|
@@ -185,9 +263,11 @@ export async function runWalletAdminCommand(parsed, context) {
|
|
|
185
263
|
return 0;
|
|
186
264
|
}
|
|
187
265
|
if (parsed.command === "wallet-lock") {
|
|
266
|
+
const dataDir = parsed.dataDir ?? context.resolveDefaultBitcoindDataDir();
|
|
188
267
|
const result = await context.lockWallet({
|
|
189
268
|
dataDir,
|
|
190
269
|
provider,
|
|
270
|
+
paths: runtimePaths,
|
|
191
271
|
});
|
|
192
272
|
if (parsed.outputMode === "preview-json") {
|
|
193
273
|
writeJsonValue(context.stdout, createPreviewSuccessEnvelope(resolvePreviewJsonSchema(parsed), describeCanonicalCommand(parsed), "locked", buildWalletLockPreviewData(result)));
|
|
@@ -202,11 +282,13 @@ export async function runWalletAdminCommand(parsed, context) {
|
|
|
202
282
|
return 0;
|
|
203
283
|
}
|
|
204
284
|
if (parsed.command === "repair") {
|
|
285
|
+
const dataDir = parsed.dataDir ?? context.resolveDefaultBitcoindDataDir();
|
|
205
286
|
const result = await context.repairWallet({
|
|
206
287
|
dataDir,
|
|
207
288
|
databasePath: dbPath,
|
|
208
289
|
provider,
|
|
209
290
|
assumeYes: parsed.assumeYes,
|
|
291
|
+
paths: runtimePaths,
|
|
210
292
|
});
|
|
211
293
|
if (parsed.outputMode === "preview-json") {
|
|
212
294
|
writeJsonValue(context.stdout, createPreviewSuccessEnvelope(resolvePreviewJsonSchema(parsed), describeCanonicalCommand(parsed), "completed", buildRepairPreviewData(result), {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { parseCogAmountToCogtoshi, } from "../../wallet/tx/index.js";
|
|
2
|
-
import { buildAnchorMutationData, buildCogMutationData, buildDomainAdminMutationData, buildDomainMarketMutationData, buildFieldMutationData, buildRegisterMutationData, buildReputationMutationData, } from "../mutation-json.js";
|
|
3
|
-
import { buildAnchorPreviewData, buildCogPreviewData, buildDomainAdminPreviewData, buildDomainMarketPreviewData, buildFieldPreviewData, buildRegisterPreviewData, buildReputationPreviewData, } from "../preview-json.js";
|
|
4
|
-
import { isAnchorMutationCommand, isBuyMutationCommand, isClaimMutationCommand, isReclaimMutationCommand, isRegisterMutationCommand, isReputationMutationCommand, isSellOrUnsellMutationCommand, isSendMutationCommand, isTransferMutationCommand, isUnsellMutationCommand, isWalletMutationCommand, } from "../mutation-command-groups.js";
|
|
2
|
+
import { buildAnchorMutationData, buildAnchorClearMutationData, buildCogMutationData, buildDomainAdminMutationData, buildDomainMarketMutationData, buildFieldMutationData, buildRegisterMutationData, buildReputationMutationData, } from "../mutation-json.js";
|
|
3
|
+
import { buildAnchorPreviewData, buildAnchorClearPreviewData, buildCogPreviewData, buildDomainAdminPreviewData, buildDomainMarketPreviewData, buildFieldPreviewData, buildRegisterPreviewData, buildReputationPreviewData, } from "../preview-json.js";
|
|
4
|
+
import { isAnchorClearMutationCommand, isAnchorMutationCommand, isBuyMutationCommand, isClaimMutationCommand, isReclaimMutationCommand, isRegisterMutationCommand, isReputationMutationCommand, isSellOrUnsellMutationCommand, isSendMutationCommand, isTransferMutationCommand, isUnsellMutationCommand, isWalletMutationCommand, } from "../mutation-command-groups.js";
|
|
5
5
|
import { commandMutationNextSteps, workflowMutationNextSteps, writeMutationCommandSuccess, } from "../mutation-success.js";
|
|
6
6
|
import { writeLine } from "../io.js";
|
|
7
7
|
import { formatBuyBuyerSummary, formatBuySellerSummary, formatBuySettlementSummary, formatCogClaimPath, formatCogSenderSummary, formatDomainAdminEffect, formatDomainAdminPayloadSummary, formatDomainAdminSenderSummary, formatDomainAdminTargetSummary, formatDomainMarketEconomicEffect, formatDomainMarketRecipientSummary, formatDomainMarketSenderSummary, formatFieldEffect, formatFieldPath, formatFieldSenderSummary, formatFieldValueSummary, formatRegisterEconomicEffect, formatRegisterSenderSummary, formatReputationEffect, formatReputationReviewSummary, formatReputationSenderSummary, } from "../mutation-text-format.js";
|
|
@@ -31,7 +31,7 @@ function createCommandPrompter(parsed, context) {
|
|
|
31
31
|
: context.createPrompter();
|
|
32
32
|
}
|
|
33
33
|
export async function runWalletMutationCommand(parsed, context) {
|
|
34
|
-
const runtimePaths = context.resolveWalletRuntimePaths();
|
|
34
|
+
const runtimePaths = context.resolveWalletRuntimePaths(parsed.seedName);
|
|
35
35
|
const stopWatcher = createOwnedLockCleanupSignalWatcher(context.signalSource, context.forceExit, [
|
|
36
36
|
runtimePaths.walletControlLockPath,
|
|
37
37
|
runtimePaths.miningControlLockPath,
|
|
@@ -47,6 +47,38 @@ export async function runWalletMutationCommand(parsed, context) {
|
|
|
47
47
|
const dataDir = parsed.dataDir ?? context.resolveDefaultBitcoindDataDir();
|
|
48
48
|
const dbPath = parsed.dbPath ?? context.resolveDefaultClientDatabasePath();
|
|
49
49
|
const prompter = createCommandPrompter(parsed, context);
|
|
50
|
+
if (isAnchorClearMutationCommand(parsed.command)) {
|
|
51
|
+
const result = await context.clearPendingAnchor({
|
|
52
|
+
domainName: parsed.args[0],
|
|
53
|
+
dataDir,
|
|
54
|
+
databasePath: dbPath,
|
|
55
|
+
provider: context.walletSecretProvider,
|
|
56
|
+
prompter,
|
|
57
|
+
assumeYes: parsed.assumeYes,
|
|
58
|
+
paths: runtimePaths,
|
|
59
|
+
});
|
|
60
|
+
const nextSteps = result.cleared
|
|
61
|
+
? workflowMutationNextSteps([`cogcoin show ${result.domainName}`, `cogcoin anchor ${result.domainName}`])
|
|
62
|
+
: commandMutationNextSteps(`cogcoin show ${result.domainName}`);
|
|
63
|
+
return writeMutationCommandSuccess(parsed, context, {
|
|
64
|
+
data: buildAnchorClearMutationData(result),
|
|
65
|
+
previewData: buildAnchorClearPreviewData(result),
|
|
66
|
+
reusedExisting: false,
|
|
67
|
+
reusedMessage: "",
|
|
68
|
+
outcome: result.cleared ? "cleared" : "noop",
|
|
69
|
+
nextSteps,
|
|
70
|
+
text: {
|
|
71
|
+
heading: result.cleared ? "Pending anchor cleared." : "No pending anchor to clear.",
|
|
72
|
+
fields: [
|
|
73
|
+
{ label: "Domain", value: result.domainName },
|
|
74
|
+
{ label: "Cleared", value: result.cleared ? "yes" : "no" },
|
|
75
|
+
{ label: "Previous status", value: result.previousFamilyStatus ?? "", when: result.previousFamilyStatus !== null },
|
|
76
|
+
{ label: "Previous step", value: result.previousFamilyStep ?? "", when: result.previousFamilyStep !== null },
|
|
77
|
+
{ label: "Released dedicated index", value: String(result.releasedDedicatedIndex), when: result.releasedDedicatedIndex !== null },
|
|
78
|
+
],
|
|
79
|
+
},
|
|
80
|
+
});
|
|
81
|
+
}
|
|
50
82
|
if (isAnchorMutationCommand(parsed.command)) {
|
|
51
83
|
const result = await context.anchorDomain({
|
|
52
84
|
domainName: parsed.args[0],
|
|
@@ -55,6 +87,7 @@ export async function runWalletMutationCommand(parsed, context) {
|
|
|
55
87
|
databasePath: dbPath,
|
|
56
88
|
provider: context.walletSecretProvider,
|
|
57
89
|
prompter,
|
|
90
|
+
paths: runtimePaths,
|
|
58
91
|
});
|
|
59
92
|
const nextSteps = getAnchorNextSteps(result.domainName);
|
|
60
93
|
return writeMutationCommandSuccess(parsed, context, {
|
|
@@ -89,6 +122,7 @@ export async function runWalletMutationCommand(parsed, context) {
|
|
|
89
122
|
provider: context.walletSecretProvider,
|
|
90
123
|
prompter,
|
|
91
124
|
assumeYes: parsed.assumeYes,
|
|
125
|
+
paths: runtimePaths,
|
|
92
126
|
});
|
|
93
127
|
const nextSteps = getRegisterNextSteps(result.domainName, result.registerKind);
|
|
94
128
|
return writeMutationCommandSuccess(parsed, context, {
|
|
@@ -126,6 +160,7 @@ export async function runWalletMutationCommand(parsed, context) {
|
|
|
126
160
|
provider: context.walletSecretProvider,
|
|
127
161
|
prompter,
|
|
128
162
|
assumeYes: parsed.assumeYes,
|
|
163
|
+
paths: runtimePaths,
|
|
129
164
|
});
|
|
130
165
|
return writeMutationCommandSuccess(parsed, context, {
|
|
131
166
|
data: buildDomainMarketMutationData(result, {
|
|
@@ -162,6 +197,7 @@ export async function runWalletMutationCommand(parsed, context) {
|
|
|
162
197
|
provider: context.walletSecretProvider,
|
|
163
198
|
prompter,
|
|
164
199
|
assumeYes: parsed.assumeYes,
|
|
200
|
+
paths: runtimePaths,
|
|
165
201
|
});
|
|
166
202
|
return writeMutationCommandSuccess(parsed, context, {
|
|
167
203
|
data: buildDomainMarketMutationData(result, {
|
|
@@ -200,6 +236,7 @@ export async function runWalletMutationCommand(parsed, context) {
|
|
|
200
236
|
provider: context.walletSecretProvider,
|
|
201
237
|
prompter,
|
|
202
238
|
assumeYes: parsed.assumeYes,
|
|
239
|
+
paths: runtimePaths,
|
|
203
240
|
})
|
|
204
241
|
: await context.clearDomainEndpoint({
|
|
205
242
|
domainName: parsed.args[0],
|
|
@@ -208,6 +245,7 @@ export async function runWalletMutationCommand(parsed, context) {
|
|
|
208
245
|
provider: context.walletSecretProvider,
|
|
209
246
|
prompter,
|
|
210
247
|
assumeYes: parsed.assumeYes,
|
|
248
|
+
paths: runtimePaths,
|
|
211
249
|
});
|
|
212
250
|
return writeMutationCommandSuccess(parsed, context, {
|
|
213
251
|
data: buildDomainAdminMutationData(result, {
|
|
@@ -242,6 +280,7 @@ export async function runWalletMutationCommand(parsed, context) {
|
|
|
242
280
|
provider: context.walletSecretProvider,
|
|
243
281
|
prompter,
|
|
244
282
|
assumeYes: parsed.assumeYes,
|
|
283
|
+
paths: runtimePaths,
|
|
245
284
|
})
|
|
246
285
|
: await context.clearDomainDelegate({
|
|
247
286
|
domainName: parsed.args[0],
|
|
@@ -250,6 +289,7 @@ export async function runWalletMutationCommand(parsed, context) {
|
|
|
250
289
|
provider: context.walletSecretProvider,
|
|
251
290
|
prompter,
|
|
252
291
|
assumeYes: parsed.assumeYes,
|
|
292
|
+
paths: runtimePaths,
|
|
253
293
|
});
|
|
254
294
|
return writeMutationCommandSuccess(parsed, context, {
|
|
255
295
|
data: buildDomainAdminMutationData(result, {
|
|
@@ -284,6 +324,7 @@ export async function runWalletMutationCommand(parsed, context) {
|
|
|
284
324
|
provider: context.walletSecretProvider,
|
|
285
325
|
prompter,
|
|
286
326
|
assumeYes: parsed.assumeYes,
|
|
327
|
+
paths: runtimePaths,
|
|
287
328
|
})
|
|
288
329
|
: await context.clearDomainMiner({
|
|
289
330
|
domainName: parsed.args[0],
|
|
@@ -292,6 +333,7 @@ export async function runWalletMutationCommand(parsed, context) {
|
|
|
292
333
|
provider: context.walletSecretProvider,
|
|
293
334
|
prompter,
|
|
294
335
|
assumeYes: parsed.assumeYes,
|
|
336
|
+
paths: runtimePaths,
|
|
295
337
|
});
|
|
296
338
|
return writeMutationCommandSuccess(parsed, context, {
|
|
297
339
|
data: buildDomainAdminMutationData(result, {
|
|
@@ -324,6 +366,7 @@ export async function runWalletMutationCommand(parsed, context) {
|
|
|
324
366
|
provider: context.walletSecretProvider,
|
|
325
367
|
prompter,
|
|
326
368
|
assumeYes: parsed.assumeYes,
|
|
369
|
+
paths: runtimePaths,
|
|
327
370
|
});
|
|
328
371
|
return writeMutationCommandSuccess(parsed, context, {
|
|
329
372
|
data: buildDomainAdminMutationData(result, {
|
|
@@ -363,6 +406,7 @@ export async function runWalletMutationCommand(parsed, context) {
|
|
|
363
406
|
provider: context.walletSecretProvider,
|
|
364
407
|
prompter,
|
|
365
408
|
assumeYes: parsed.assumeYes,
|
|
409
|
+
paths: runtimePaths,
|
|
366
410
|
});
|
|
367
411
|
return writeMutationCommandSuccess(parsed, context, {
|
|
368
412
|
data: buildFieldMutationData(result),
|
|
@@ -399,6 +443,7 @@ export async function runWalletMutationCommand(parsed, context) {
|
|
|
399
443
|
provider: context.walletSecretProvider,
|
|
400
444
|
prompter,
|
|
401
445
|
assumeYes: parsed.assumeYes,
|
|
446
|
+
paths: runtimePaths,
|
|
402
447
|
});
|
|
403
448
|
return writeMutationCommandSuccess(parsed, context, {
|
|
404
449
|
data: buildFieldMutationData(result),
|
|
@@ -429,6 +474,7 @@ export async function runWalletMutationCommand(parsed, context) {
|
|
|
429
474
|
provider: context.walletSecretProvider,
|
|
430
475
|
prompter,
|
|
431
476
|
assumeYes: parsed.assumeYes,
|
|
477
|
+
paths: runtimePaths,
|
|
432
478
|
});
|
|
433
479
|
return writeMutationCommandSuccess(parsed, context, {
|
|
434
480
|
data: buildFieldMutationData(result),
|
|
@@ -459,6 +505,7 @@ export async function runWalletMutationCommand(parsed, context) {
|
|
|
459
505
|
provider: context.walletSecretProvider,
|
|
460
506
|
prompter,
|
|
461
507
|
assumeYes: parsed.assumeYes,
|
|
508
|
+
paths: runtimePaths,
|
|
462
509
|
});
|
|
463
510
|
return writeMutationCommandSuccess(parsed, context, {
|
|
464
511
|
data: buildCogMutationData(result, {
|
|
@@ -497,6 +544,7 @@ export async function runWalletMutationCommand(parsed, context) {
|
|
|
497
544
|
provider: context.walletSecretProvider,
|
|
498
545
|
prompter,
|
|
499
546
|
assumeYes: parsed.assumeYes,
|
|
547
|
+
paths: runtimePaths,
|
|
500
548
|
});
|
|
501
549
|
return writeMutationCommandSuccess(parsed, context, {
|
|
502
550
|
data: buildCogMutationData(result, {
|
|
@@ -536,6 +584,7 @@ export async function runWalletMutationCommand(parsed, context) {
|
|
|
536
584
|
databasePath: dbPath,
|
|
537
585
|
provider: context.walletSecretProvider,
|
|
538
586
|
prompter,
|
|
587
|
+
paths: runtimePaths,
|
|
539
588
|
});
|
|
540
589
|
return writeMutationCommandSuccess(parsed, context, {
|
|
541
590
|
data: buildCogMutationData(result, {
|
|
@@ -569,6 +618,7 @@ export async function runWalletMutationCommand(parsed, context) {
|
|
|
569
618
|
databasePath: dbPath,
|
|
570
619
|
provider: context.walletSecretProvider,
|
|
571
620
|
prompter,
|
|
621
|
+
paths: runtimePaths,
|
|
572
622
|
});
|
|
573
623
|
return writeMutationCommandSuccess(parsed, context, {
|
|
574
624
|
data: buildCogMutationData(result, {
|
|
@@ -607,6 +657,7 @@ export async function runWalletMutationCommand(parsed, context) {
|
|
|
607
657
|
provider: context.walletSecretProvider,
|
|
608
658
|
prompter,
|
|
609
659
|
assumeYes: parsed.assumeYes,
|
|
660
|
+
paths: runtimePaths,
|
|
610
661
|
})
|
|
611
662
|
: await context.revokeReputation({
|
|
612
663
|
sourceDomainName: parsed.args[0],
|
|
@@ -618,6 +669,7 @@ export async function runWalletMutationCommand(parsed, context) {
|
|
|
618
669
|
provider: context.walletSecretProvider,
|
|
619
670
|
prompter,
|
|
620
671
|
assumeYes: parsed.assumeYes,
|
|
672
|
+
paths: runtimePaths,
|
|
621
673
|
});
|
|
622
674
|
return writeMutationCommandSuccess(parsed, context, {
|
|
623
675
|
data: buildReputationMutationData(result),
|
|
@@ -649,6 +701,7 @@ export async function runWalletMutationCommand(parsed, context) {
|
|
|
649
701
|
provider: context.walletSecretProvider,
|
|
650
702
|
prompter,
|
|
651
703
|
assumeYes: parsed.assumeYes,
|
|
704
|
+
paths: runtimePaths,
|
|
652
705
|
});
|
|
653
706
|
return writeMutationCommandSuccess(parsed, context, {
|
|
654
707
|
data: buildDomainMarketMutationData(result, {
|
|
@@ -39,11 +39,13 @@ function emitJson(context, parsed, schema, result) {
|
|
|
39
39
|
export async function runWalletReadCommand(parsed, context) {
|
|
40
40
|
const dbPath = parsed.dbPath ?? context.resolveDefaultClientDatabasePath();
|
|
41
41
|
const dataDir = parsed.dataDir ?? context.resolveDefaultBitcoindDataDir();
|
|
42
|
+
const runtimePaths = context.resolveWalletRuntimePaths(parsed.seedName);
|
|
42
43
|
await context.ensureDirectory(dirname(dbPath));
|
|
43
44
|
const readContext = await context.openWalletReadContext({
|
|
44
45
|
dataDir,
|
|
45
46
|
databasePath: dbPath,
|
|
46
47
|
secretProvider: context.walletSecretProvider,
|
|
48
|
+
paths: runtimePaths,
|
|
47
49
|
});
|
|
48
50
|
try {
|
|
49
51
|
switch (parsed.command) {
|
package/dist/cli/context.js
CHANGED
|
@@ -6,15 +6,15 @@ import { resolveDefaultBitcoindDataDirForTesting, resolveDefaultClientDatabasePa
|
|
|
6
6
|
import { openManagedBitcoindClient } from "../bitcoind/index.js";
|
|
7
7
|
import { inspectPassiveClientStatus } from "../passive-status.js";
|
|
8
8
|
import { openSqliteStore } from "../sqlite/index.js";
|
|
9
|
-
import { exportWallet, importWallet, initializeWallet, lockWallet, previewResetWallet, repairWallet, resetWallet, restoreWalletFromMnemonic, unlockWallet, } from "../wallet/lifecycle.js";
|
|
9
|
+
import { exportWallet, importWallet, initializeWallet, deleteImportedWalletSeed, lockWallet, previewResetWallet, repairWallet, resetWallet, restoreWalletFromMnemonic, showWalletMnemonic, unlockWallet, } from "../wallet/lifecycle.js";
|
|
10
10
|
import { resolveWalletRuntimePathsForTesting } from "../wallet/runtime.js";
|
|
11
11
|
import { openWalletReadContext } from "../wallet/read/index.js";
|
|
12
12
|
import { loadWalletExplicitLock } from "../wallet/state/explicit-lock.js";
|
|
13
13
|
import { loadUnlockSession } from "../wallet/state/session.js";
|
|
14
|
-
import { loadWalletState } from "../wallet/state/storage.js";
|
|
14
|
+
import { loadRawWalletStateEnvelope, loadWalletState } from "../wallet/state/storage.js";
|
|
15
15
|
import { disableMiningHooks, enableMiningHooks, followMiningLog, inspectMiningControlPlane, readMiningLog, runForegroundMining, setupBuiltInMining, startBackgroundMining, stopBackgroundMining, } from "../wallet/mining/index.js";
|
|
16
16
|
import { createLazyDefaultWalletSecretProvider } from "../wallet/state/provider.js";
|
|
17
|
-
import { anchorDomain, buyDomain, claimCogLock, clearDomainDelegate, clearDomainEndpoint, clearDomainMiner, clearField, createField, giveReputation, lockCogToDomain, registerDomain, reclaimCogLock, revokeReputation, sendCog, setField, setDomainCanonical, setDomainDelegate, setDomainEndpoint, setDomainMiner, sellDomain, transferDomain, } from "../wallet/tx/index.js";
|
|
17
|
+
import { anchorDomain, clearPendingAnchor, buyDomain, claimCogLock, clearDomainDelegate, clearDomainEndpoint, clearDomainMiner, clearField, createField, giveReputation, lockCogToDomain, registerDomain, reclaimCogLock, revokeReputation, sendCog, setField, setDomainCanonical, setDomainDelegate, setDomainEndpoint, setDomainMiner, sellDomain, transferDomain, } from "../wallet/tx/index.js";
|
|
18
18
|
import { createTerminalPrompter } from "./prompt.js";
|
|
19
19
|
export async function readPackageVersionFromDisk() {
|
|
20
20
|
const raw = await readFile(new URL("../../package.json", import.meta.url), "utf8");
|
|
@@ -39,10 +39,13 @@ export function createDefaultContext(overrides = {}) {
|
|
|
39
39
|
previewResetWallet: overrides.previewResetWallet ?? previewResetWallet,
|
|
40
40
|
exportWallet: overrides.exportWallet ?? exportWallet,
|
|
41
41
|
importWallet: overrides.importWallet ?? importWallet,
|
|
42
|
+
deleteImportedWalletSeed: overrides.deleteImportedWalletSeed ?? deleteImportedWalletSeed,
|
|
43
|
+
showWalletMnemonic: overrides.showWalletMnemonic ?? showWalletMnemonic,
|
|
42
44
|
unlockWallet: overrides.unlockWallet ?? unlockWallet,
|
|
43
45
|
lockWallet: overrides.lockWallet ?? lockWallet,
|
|
44
46
|
registerDomain: overrides.registerDomain ?? registerDomain,
|
|
45
47
|
anchorDomain: overrides.anchorDomain ?? anchorDomain,
|
|
48
|
+
clearPendingAnchor: overrides.clearPendingAnchor ?? clearPendingAnchor,
|
|
46
49
|
transferDomain: overrides.transferDomain ?? transferDomain,
|
|
47
50
|
sellDomain: overrides.sellDomain ?? sellDomain,
|
|
48
51
|
buyDomain: overrides.buyDomain ?? buyDomain,
|
|
@@ -88,10 +91,11 @@ export function createDefaultContext(overrides = {}) {
|
|
|
88
91
|
stopIndexerDaemonService: overrides.stopIndexerDaemonService ?? stopIndexerDaemonService,
|
|
89
92
|
readPackageVersion: overrides.readPackageVersion ?? readPackageVersionFromDisk,
|
|
90
93
|
loadWalletState: overrides.loadWalletState ?? loadWalletState,
|
|
94
|
+
loadRawWalletStateEnvelope: overrides.loadRawWalletStateEnvelope ?? loadRawWalletStateEnvelope,
|
|
91
95
|
loadUnlockSession: overrides.loadUnlockSession ?? loadUnlockSession,
|
|
92
96
|
loadWalletExplicitLock: overrides.loadWalletExplicitLock ?? loadWalletExplicitLock,
|
|
93
97
|
resolveDefaultBitcoindDataDir: overrides.resolveDefaultBitcoindDataDir ?? resolveDefaultBitcoindDataDirForTesting,
|
|
94
98
|
resolveDefaultClientDatabasePath: overrides.resolveDefaultClientDatabasePath ?? resolveDefaultClientDatabasePathForTesting,
|
|
95
|
-
resolveWalletRuntimePaths: overrides.resolveWalletRuntimePaths ?? resolveWalletRuntimePathsForTesting,
|
|
99
|
+
resolveWalletRuntimePaths: overrides.resolveWalletRuntimePaths ?? ((seedName) => resolveWalletRuntimePathsForTesting({ seedName })),
|
|
96
100
|
};
|
|
97
101
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { CommandName } from "./types.js";
|
|
2
|
-
export declare const walletMutationCommands: readonly ["anchor", "domain-anchor", "register", "domain-register", "transfer", "domain-transfer", "sell", "domain-sell", "unsell", "domain-unsell", "buy", "domain-buy", "domain-endpoint-set", "domain-endpoint-clear", "domain-delegate-set", "domain-delegate-clear", "domain-miner-set", "domain-miner-clear", "domain-canonical", "field-create", "field-set", "field-clear", "send", "cog-send", "claim", "cog-claim", "reclaim", "cog-reclaim", "cog-lock", "rep-give", "rep-revoke"];
|
|
2
|
+
export declare const walletMutationCommands: readonly ["anchor", "anchor-clear", "domain-anchor", "domain-anchor-clear", "register", "domain-register", "transfer", "domain-transfer", "sell", "domain-sell", "unsell", "domain-unsell", "buy", "domain-buy", "domain-endpoint-set", "domain-endpoint-clear", "domain-delegate-set", "domain-delegate-clear", "domain-miner-set", "domain-miner-clear", "domain-canonical", "field-create", "field-set", "field-clear", "send", "cog-send", "claim", "cog-claim", "reclaim", "cog-reclaim", "cog-lock", "rep-give", "rep-revoke"];
|
|
3
3
|
export type WalletMutationCommand = (typeof walletMutationCommands)[number];
|
|
4
4
|
export declare function isWalletMutationCommand(command: CommandName | null): command is WalletMutationCommand;
|
|
5
5
|
export declare function isAnchorMutationCommand(command: CommandName | null): command is "anchor" | "domain-anchor";
|
|
6
|
+
export declare function isAnchorClearMutationCommand(command: CommandName | null): command is "anchor-clear" | "domain-anchor-clear";
|
|
6
7
|
export declare function isRegisterMutationCommand(command: CommandName | null): command is "register" | "domain-register";
|
|
7
8
|
export declare function isTransferMutationCommand(command: CommandName | null): command is "transfer" | "domain-transfer";
|
|
8
9
|
export declare function isSellMutationCommand(command: CommandName | null): command is "sell" | "domain-sell";
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export const walletMutationCommands = [
|
|
2
2
|
"anchor",
|
|
3
|
+
"anchor-clear",
|
|
3
4
|
"domain-anchor",
|
|
5
|
+
"domain-anchor-clear",
|
|
4
6
|
"register",
|
|
5
7
|
"domain-register",
|
|
6
8
|
"transfer",
|
|
@@ -39,6 +41,9 @@ export function isWalletMutationCommand(command) {
|
|
|
39
41
|
export function isAnchorMutationCommand(command) {
|
|
40
42
|
return command === "anchor" || command === "domain-anchor";
|
|
41
43
|
}
|
|
44
|
+
export function isAnchorClearMutationCommand(command) {
|
|
45
|
+
return command === "anchor-clear" || command === "domain-anchor-clear";
|
|
46
|
+
}
|
|
42
47
|
export function isRegisterMutationCommand(command) {
|
|
43
48
|
return command === "register" || command === "domain-register";
|
|
44
49
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { AnchorDomainResult, CogMutationResult, DomainAdminMutationResult, DomainMarketMutationResult, FieldMutationResult, RegisterDomainResult, ReputationMutationResult } from "../wallet/tx/index.js";
|
|
2
|
-
import type { WalletInitializationResult, WalletExportResult, WalletImportResult, WalletRepairResult, WalletResetResult, WalletRestoreResult, WalletUnlockResult } from "../wallet/lifecycle.js";
|
|
1
|
+
import type { AnchorDomainResult, ClearPendingAnchorResult, CogMutationResult, DomainAdminMutationResult, DomainMarketMutationResult, FieldMutationResult, RegisterDomainResult, ReputationMutationResult } from "../wallet/tx/index.js";
|
|
2
|
+
import type { WalletInitializationResult, WalletExportResult, WalletImportResult, WalletDeleteResult, WalletRepairResult, WalletResetResult, WalletRestoreResult, WalletUnlockResult } from "../wallet/lifecycle.js";
|
|
3
3
|
export declare function buildSingleTxMutationData(options: {
|
|
4
4
|
kind: string;
|
|
5
5
|
localStatus: string;
|
|
@@ -222,6 +222,15 @@ export declare function buildAnchorMutationData(result: AnchorDomainResult, opti
|
|
|
222
222
|
};
|
|
223
223
|
intent: Record<string, unknown>;
|
|
224
224
|
};
|
|
225
|
+
export declare function buildAnchorClearMutationData(result: ClearPendingAnchorResult): {
|
|
226
|
+
resultType: "state-change";
|
|
227
|
+
stateChange: {
|
|
228
|
+
kind: string;
|
|
229
|
+
before: Record<string, unknown> | null;
|
|
230
|
+
after: Record<string, unknown> | null;
|
|
231
|
+
};
|
|
232
|
+
state: Record<string, unknown>;
|
|
233
|
+
};
|
|
225
234
|
export declare function buildResetMutationData(result: WalletResetResult): {
|
|
226
235
|
resultType: "operation";
|
|
227
236
|
operation: {
|
|
@@ -229,6 +238,13 @@ export declare function buildResetMutationData(result: WalletResetResult): {
|
|
|
229
238
|
};
|
|
230
239
|
state: Record<string, unknown> | null;
|
|
231
240
|
};
|
|
241
|
+
export declare function buildWalletDeleteMutationData(result: WalletDeleteResult): {
|
|
242
|
+
resultType: "operation";
|
|
243
|
+
operation: {
|
|
244
|
+
kind: string;
|
|
245
|
+
};
|
|
246
|
+
state: Record<string, unknown> | null;
|
|
247
|
+
};
|
|
232
248
|
export declare function buildDomainAdminMutationData(result: DomainAdminMutationResult, options: {
|
|
233
249
|
commandKind: "domain-endpoint-set" | "domain-endpoint-clear" | "domain-delegate-set" | "domain-delegate-clear" | "domain-miner-set" | "domain-miner-clear" | "domain-canonical";
|
|
234
250
|
}): {
|