@cogcoin/client 0.5.15 → 1.0.1
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 +80 -25
- package/dist/app-paths.d.ts +5 -6
- package/dist/app-paths.js +8 -16
- package/dist/art/balance.txt +10 -0
- package/dist/art/welcome.txt +16 -0
- package/dist/bitcoind/bootstrap/controller.d.ts +1 -0
- package/dist/bitcoind/bootstrap/controller.js +53 -1
- package/dist/bitcoind/client/follow-block-times.d.ts +1 -0
- package/dist/bitcoind/client/follow-block-times.js +1 -1
- package/dist/bitcoind/client/internal-types.d.ts +7 -3
- package/dist/bitcoind/client/managed-client.d.ts +4 -2
- package/dist/bitcoind/client/managed-client.js +14 -0
- package/dist/bitcoind/client/sync-engine.js +72 -11
- package/dist/bitcoind/hash-order.d.ts +4 -0
- package/dist/bitcoind/hash-order.js +13 -0
- package/dist/bitcoind/indexer-daemon-main.js +11 -3
- package/dist/bitcoind/normalize.js +3 -2
- package/dist/bitcoind/processing-start-height.d.ts +5 -0
- package/dist/bitcoind/processing-start-height.js +7 -0
- package/dist/bitcoind/progress/constants.d.ts +4 -0
- package/dist/bitcoind/progress/constants.js +4 -0
- package/dist/bitcoind/progress/controller.d.ts +2 -1
- package/dist/bitcoind/progress/controller.js +3 -3
- package/dist/bitcoind/progress/follow-scene.d.ts +6 -2
- package/dist/bitcoind/progress/follow-scene.js +29 -6
- package/dist/bitcoind/progress/formatting.d.ts +1 -0
- package/dist/bitcoind/progress/formatting.js +6 -0
- package/dist/bitcoind/progress/train-scene.js +37 -18
- package/dist/bitcoind/progress/tty-renderer.d.ts +6 -1
- package/dist/bitcoind/progress/tty-renderer.js +8 -4
- package/dist/bitcoind/rpc.d.ts +2 -1
- package/dist/bitcoind/rpc.js +3 -0
- package/dist/bitcoind/types.d.ts +6 -0
- package/dist/bytes.d.ts +1 -0
- package/dist/bytes.js +3 -0
- package/dist/cli/art.d.ts +2 -0
- package/dist/cli/art.js +37 -0
- package/dist/cli/commands/client-admin.d.ts +2 -0
- package/dist/cli/commands/client-admin.js +91 -0
- package/dist/cli/commands/follow.js +0 -2
- package/dist/cli/commands/mining-admin.js +6 -47
- package/dist/cli/commands/mining-read.js +11 -50
- package/dist/cli/commands/mining-runtime.js +142 -5
- package/dist/cli/commands/service-runtime.js +0 -2
- package/dist/cli/commands/status.js +8 -2
- package/dist/cli/commands/sync.js +49 -92
- package/dist/cli/commands/wallet-admin.js +142 -136
- package/dist/cli/commands/wallet-mutation.js +91 -79
- package/dist/cli/commands/wallet-read.js +15 -18
- package/dist/cli/context.js +5 -14
- package/dist/cli/mining-format.d.ts +0 -1
- package/dist/cli/mining-format.js +5 -37
- package/dist/cli/mining-json.d.ts +0 -18
- package/dist/cli/mining-json.js +0 -35
- package/dist/cli/mutation-command-groups.d.ts +1 -2
- package/dist/cli/mutation-command-groups.js +0 -5
- package/dist/cli/mutation-json.d.ts +24 -145
- package/dist/cli/mutation-json.js +30 -136
- package/dist/cli/mutation-resolved-json.d.ts +0 -7
- package/dist/cli/mutation-resolved-json.js +4 -10
- package/dist/cli/mutation-success.d.ts +2 -0
- package/dist/cli/mutation-success.js +11 -1
- package/dist/cli/mutation-text-format.js +1 -3
- package/dist/cli/output.d.ts +1 -1
- package/dist/cli/output.js +254 -231
- package/dist/cli/parse.d.ts +1 -1
- package/dist/cli/parse.js +93 -122
- package/dist/cli/preview-json.d.ts +17 -120
- package/dist/cli/preview-json.js +14 -97
- package/dist/cli/prompt.js +8 -13
- package/dist/cli/read-json.d.ts +15 -37
- package/dist/cli/read-json.js +44 -140
- package/dist/cli/runner.js +10 -13
- package/dist/cli/sync-progress.d.ts +6 -0
- package/dist/cli/sync-progress.js +91 -0
- package/dist/cli/types.d.ts +9 -17
- package/dist/cli/types.js +0 -2
- package/dist/cli/wallet-format.d.ts +1 -0
- package/dist/cli/wallet-format.js +208 -144
- package/dist/cli/workflow-hints.d.ts +3 -3
- package/dist/cli/workflow-hints.js +11 -8
- package/dist/client/default-client.d.ts +3 -1
- package/dist/client/default-client.js +45 -2
- package/dist/client/factory.js +1 -1
- package/dist/client/initialization.js +23 -0
- package/dist/client/persistence.js +5 -5
- package/dist/client/store-adapter.js +1 -0
- package/dist/sqlite/checkpoints.d.ts +1 -0
- package/dist/sqlite/checkpoints.js +7 -0
- package/dist/sqlite/store.js +14 -1
- package/dist/types.d.ts +1 -0
- package/dist/wallet/coin-control.d.ts +41 -12
- package/dist/wallet/coin-control.js +100 -428
- package/dist/wallet/descriptor-normalization.d.ts +1 -3
- package/dist/wallet/descriptor-normalization.js +0 -16
- package/dist/wallet/lifecycle.d.ts +7 -99
- package/dist/wallet/lifecycle.js +513 -968
- package/dist/wallet/managed-core-wallet.d.ts +13 -0
- package/dist/wallet/managed-core-wallet.js +20 -0
- package/dist/wallet/mining/constants.d.ts +5 -12
- package/dist/wallet/mining/constants.js +5 -12
- package/dist/wallet/mining/control.d.ts +1 -13
- package/dist/wallet/mining/control.js +45 -349
- package/dist/wallet/mining/index.d.ts +4 -5
- package/dist/wallet/mining/index.js +2 -3
- package/dist/wallet/mining/runner.d.ts +123 -13
- package/dist/wallet/mining/runner.js +899 -511
- package/dist/wallet/mining/runtime-artifacts.js +23 -3
- package/dist/wallet/mining/sentence-protocol.d.ts +44 -0
- package/dist/wallet/mining/sentence-protocol.js +123 -0
- package/dist/wallet/mining/sentences.d.ts +4 -8
- package/dist/wallet/mining/sentences.js +3 -52
- package/dist/wallet/mining/state.d.ts +11 -6
- package/dist/wallet/mining/state.js +7 -6
- package/dist/wallet/mining/types.d.ts +2 -30
- package/dist/wallet/mining/visualizer.d.ts +31 -3
- package/dist/wallet/mining/visualizer.js +135 -13
- package/dist/wallet/read/context.d.ts +0 -2
- package/dist/wallet/read/context.js +119 -140
- package/dist/wallet/read/filter.js +2 -11
- package/dist/wallet/read/index.d.ts +1 -1
- package/dist/wallet/read/project.js +24 -77
- package/dist/wallet/read/types.d.ts +10 -25
- package/dist/wallet/reset.d.ts +0 -1
- package/dist/wallet/reset.js +60 -138
- package/dist/wallet/root-resolution.d.ts +1 -5
- package/dist/wallet/root-resolution.js +0 -18
- package/dist/wallet/runtime.d.ts +0 -6
- package/dist/wallet/runtime.js +0 -8
- package/dist/wallet/state/client-password-agent.js +208 -0
- package/dist/wallet/state/client-password.d.ts +65 -0
- package/dist/wallet/state/client-password.js +952 -0
- package/dist/wallet/state/crypto.d.ts +1 -20
- package/dist/wallet/state/crypto.js +0 -63
- package/dist/wallet/state/provider.d.ts +23 -11
- package/dist/wallet/state/provider.js +248 -290
- package/dist/wallet/state/storage.d.ts +2 -2
- package/dist/wallet/state/storage.js +48 -16
- package/dist/wallet/tx/anchor.d.ts +3 -28
- package/dist/wallet/tx/anchor.js +349 -1250
- package/dist/wallet/tx/bitcoin-transfer.d.ts +35 -0
- package/dist/wallet/tx/bitcoin-transfer.js +200 -0
- package/dist/wallet/tx/cog.d.ts +5 -1
- package/dist/wallet/tx/cog.js +149 -185
- package/dist/wallet/tx/common.d.ts +61 -8
- package/dist/wallet/tx/common.js +266 -146
- package/dist/wallet/tx/domain-admin.d.ts +3 -1
- package/dist/wallet/tx/domain-admin.js +61 -99
- package/dist/wallet/tx/domain-market.d.ts +5 -1
- package/dist/wallet/tx/domain-market.js +221 -228
- package/dist/wallet/tx/field.d.ts +4 -10
- package/dist/wallet/tx/field.js +83 -924
- package/dist/wallet/tx/identity-selector.d.ts +9 -3
- package/dist/wallet/tx/identity-selector.js +17 -35
- package/dist/wallet/tx/index.d.ts +3 -1
- package/dist/wallet/tx/index.js +2 -1
- package/dist/wallet/tx/register.d.ts +3 -1
- package/dist/wallet/tx/register.js +62 -220
- package/dist/wallet/tx/reputation.d.ts +3 -1
- package/dist/wallet/tx/reputation.js +58 -95
- package/dist/wallet/types.d.ts +8 -122
- package/package.json +5 -5
- package/dist/wallet/archive.d.ts +0 -4
- package/dist/wallet/archive.js +0 -41
- package/dist/wallet/mining/hook-protocol.d.ts +0 -47
- package/dist/wallet/mining/hook-protocol.js +0 -161
- package/dist/wallet/mining/hook-runner.js +0 -52
- package/dist/wallet/mining/hooks.d.ts +0 -38
- package/dist/wallet/mining/hooks.js +0 -520
- package/dist/wallet/state/explicit-lock.d.ts +0 -4
- package/dist/wallet/state/explicit-lock.js +0 -19
- package/dist/wallet/state/session.d.ts +0 -12
- package/dist/wallet/state/session.js +0 -23
- /package/dist/wallet/{mining/hook-runner.d.ts → state/client-password-agent.d.ts} +0 -0
|
@@ -16,23 +16,7 @@ export function buildSingleTxMutationData(options) {
|
|
|
16
16
|
intentFingerprintHex: options.intentFingerprintHex ?? null,
|
|
17
17
|
},
|
|
18
18
|
transaction: normalizeTxSummary(options.txid, options.wtxid),
|
|
19
|
-
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
export function buildFamilyMutationData(options) {
|
|
23
|
-
return {
|
|
24
|
-
resultType: "family-mutation",
|
|
25
|
-
family: {
|
|
26
|
-
kind: options.familyKind,
|
|
27
|
-
localStatus: options.familyStatus,
|
|
28
|
-
reusedExisting: options.reusedExisting,
|
|
29
|
-
currentStep: options.currentStep ?? null,
|
|
30
|
-
intentFingerprintHex: options.intentFingerprintHex ?? null,
|
|
31
|
-
},
|
|
32
|
-
transactions: {
|
|
33
|
-
tx1: normalizeTxSummary(options.tx1Txid, options.tx1Wtxid),
|
|
34
|
-
tx2: normalizeTxSummary(options.tx2Txid, options.tx2Wtxid),
|
|
35
|
-
},
|
|
19
|
+
fees: options.fees,
|
|
36
20
|
intent: options.intent,
|
|
37
21
|
};
|
|
38
22
|
}
|
|
@@ -57,6 +41,22 @@ export function buildOperationData(options) {
|
|
|
57
41
|
state: options.state ?? null,
|
|
58
42
|
};
|
|
59
43
|
}
|
|
44
|
+
export function buildBitcoinTransferData(result) {
|
|
45
|
+
return buildOperationData({
|
|
46
|
+
kind: "bitcoin-transfer",
|
|
47
|
+
state: null,
|
|
48
|
+
operation: {
|
|
49
|
+
amountSats: result.amountSats.toString(),
|
|
50
|
+
feeSats: result.feeSats.toString(),
|
|
51
|
+
senderAddress: result.senderAddress,
|
|
52
|
+
recipientAddress: result.recipientAddress,
|
|
53
|
+
recipientScriptPubKeyHex: result.recipientScriptPubKeyHex,
|
|
54
|
+
changeAddress: result.changeAddress,
|
|
55
|
+
txid: result.txid,
|
|
56
|
+
wtxid: result.wtxid,
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
60
|
export function buildRegisterMutationData(result, options) {
|
|
61
61
|
return {
|
|
62
62
|
...buildSingleTxMutationData({
|
|
@@ -64,11 +64,11 @@ export function buildRegisterMutationData(result, options) {
|
|
|
64
64
|
localStatus: result.status,
|
|
65
65
|
txid: result.txid,
|
|
66
66
|
reusedExisting: result.reusedExisting,
|
|
67
|
+
fees: result.fees,
|
|
67
68
|
intent: {
|
|
68
69
|
domainName: result.domainName,
|
|
69
70
|
registerKind: result.registerKind,
|
|
70
71
|
forceRace: options.forceRace,
|
|
71
|
-
fromIdentitySelector: options.fromIdentity,
|
|
72
72
|
},
|
|
73
73
|
}),
|
|
74
74
|
resolved: buildRegisterResolvedJson(result),
|
|
@@ -80,14 +80,12 @@ export function buildDomainMarketMutationData(result, options) {
|
|
|
80
80
|
listedPriceCogtoshi: decimalOrNull(result.listedPriceCogtoshi),
|
|
81
81
|
recipientScriptPubKeyHex: result.recipientScriptPubKeyHex ?? null,
|
|
82
82
|
};
|
|
83
|
-
if (options.commandKind === "buy") {
|
|
84
|
-
intent.fromIdentitySelector = options.fromIdentity ?? null;
|
|
85
|
-
}
|
|
86
83
|
const data = buildSingleTxMutationData({
|
|
87
84
|
kind: options.commandKind,
|
|
88
85
|
localStatus: result.status,
|
|
89
86
|
txid: result.txid,
|
|
90
87
|
reusedExisting: result.reusedExisting,
|
|
88
|
+
fees: result.fees,
|
|
91
89
|
intent,
|
|
92
90
|
journalKind: result.kind,
|
|
93
91
|
});
|
|
@@ -108,12 +106,12 @@ export function buildCogMutationData(result, options) {
|
|
|
108
106
|
localStatus: result.status,
|
|
109
107
|
txid: result.txid,
|
|
110
108
|
reusedExisting: result.reusedExisting,
|
|
109
|
+
fees: result.fees,
|
|
111
110
|
intent: {
|
|
112
111
|
amountCogtoshi: decimalOrNull(result.amountCogtoshi),
|
|
113
112
|
recipientScriptPubKeyHex: result.recipientScriptPubKeyHex ?? null,
|
|
114
113
|
recipientDomainName: result.recipientDomainName ?? null,
|
|
115
114
|
lockId: result.lockId ?? null,
|
|
116
|
-
fromIdentitySelector: options.fromIdentity,
|
|
117
115
|
timeoutBlocksOrDuration: options.timeoutBlocksOrDuration ?? null,
|
|
118
116
|
timeoutHeight: options.timeoutHeight ?? null,
|
|
119
117
|
conditionHex: options.conditionHex ?? null,
|
|
@@ -126,50 +124,18 @@ export function buildCogMutationData(result, options) {
|
|
|
126
124
|
};
|
|
127
125
|
}
|
|
128
126
|
export function buildAnchorMutationData(result, options) {
|
|
129
|
-
return
|
|
130
|
-
|
|
131
|
-
|
|
127
|
+
return buildSingleTxMutationData({
|
|
128
|
+
kind: "anchor",
|
|
129
|
+
localStatus: result.status,
|
|
130
|
+
txid: result.txid,
|
|
132
131
|
reusedExisting: result.reusedExisting,
|
|
133
|
-
|
|
134
|
-
tx1Txid: result.tx1Txid,
|
|
135
|
-
tx2Txid: result.tx2Txid,
|
|
132
|
+
fees: result.fees,
|
|
136
133
|
intent: {
|
|
137
134
|
domainName: result.domainName,
|
|
138
|
-
dedicatedIndex: result.dedicatedIndex,
|
|
139
135
|
foundingMessageIncluded: options.foundingMessageText !== null,
|
|
140
136
|
},
|
|
141
137
|
});
|
|
142
138
|
}
|
|
143
|
-
export function buildAnchorClearMutationData(result) {
|
|
144
|
-
const before = result.cleared
|
|
145
|
-
? {
|
|
146
|
-
localAnchorIntent: "reserved",
|
|
147
|
-
dedicatedIndex: result.releasedDedicatedIndex,
|
|
148
|
-
familyStatus: result.previousFamilyStatus,
|
|
149
|
-
familyStep: result.previousFamilyStep,
|
|
150
|
-
}
|
|
151
|
-
: null;
|
|
152
|
-
const after = result.cleared
|
|
153
|
-
? {
|
|
154
|
-
localAnchorIntent: "none",
|
|
155
|
-
dedicatedIndex: null,
|
|
156
|
-
familyStatus: "canceled",
|
|
157
|
-
familyStep: result.previousFamilyStep,
|
|
158
|
-
}
|
|
159
|
-
: null;
|
|
160
|
-
return buildStateChangeData({
|
|
161
|
-
kind: "anchor-clear",
|
|
162
|
-
state: {
|
|
163
|
-
domainName: result.domainName,
|
|
164
|
-
cleared: result.cleared,
|
|
165
|
-
previousFamilyStatus: result.previousFamilyStatus,
|
|
166
|
-
previousFamilyStep: result.previousFamilyStep,
|
|
167
|
-
releasedDedicatedIndex: result.releasedDedicatedIndex,
|
|
168
|
-
},
|
|
169
|
-
before,
|
|
170
|
-
after,
|
|
171
|
-
});
|
|
172
|
-
}
|
|
173
139
|
export function buildResetMutationData(result) {
|
|
174
140
|
return buildOperationData({
|
|
175
141
|
kind: "reset",
|
|
@@ -222,6 +188,7 @@ export function buildDomainAdminMutationData(result, options) {
|
|
|
222
188
|
localStatus: result.status,
|
|
223
189
|
txid: result.txid,
|
|
224
190
|
reusedExisting: result.reusedExisting,
|
|
191
|
+
fees: result.fees,
|
|
225
192
|
intent: {
|
|
226
193
|
domainName: result.domainName,
|
|
227
194
|
recipientScriptPubKeyHex: result.recipientScriptPubKeyHex ?? null,
|
|
@@ -238,32 +205,13 @@ export function buildDomainAdminMutationData(result, options) {
|
|
|
238
205
|
};
|
|
239
206
|
}
|
|
240
207
|
export function buildFieldMutationData(result) {
|
|
241
|
-
if (result.family) {
|
|
242
|
-
return {
|
|
243
|
-
...buildFamilyMutationData({
|
|
244
|
-
familyKind: "field",
|
|
245
|
-
familyStatus: result.status,
|
|
246
|
-
reusedExisting: result.reusedExisting,
|
|
247
|
-
currentStep: result.status === "confirmed" ? "confirmed" : "submitted",
|
|
248
|
-
tx1Txid: result.tx1Txid ?? null,
|
|
249
|
-
tx2Txid: result.tx2Txid ?? null,
|
|
250
|
-
intent: {
|
|
251
|
-
domainName: result.domainName,
|
|
252
|
-
fieldName: result.fieldName,
|
|
253
|
-
expectedFieldId: result.fieldId,
|
|
254
|
-
permanent: result.permanent,
|
|
255
|
-
format: result.format,
|
|
256
|
-
},
|
|
257
|
-
}),
|
|
258
|
-
resolved: buildFieldResolvedJson(result),
|
|
259
|
-
};
|
|
260
|
-
}
|
|
261
208
|
return {
|
|
262
209
|
...buildSingleTxMutationData({
|
|
263
210
|
kind: result.kind,
|
|
264
211
|
localStatus: result.status,
|
|
265
212
|
txid: result.txid,
|
|
266
213
|
reusedExisting: result.reusedExisting,
|
|
214
|
+
fees: result.fees,
|
|
267
215
|
intent: {
|
|
268
216
|
domainName: result.domainName,
|
|
269
217
|
fieldName: result.fieldName,
|
|
@@ -281,6 +229,7 @@ export function buildReputationMutationData(result) {
|
|
|
281
229
|
localStatus: result.status,
|
|
282
230
|
txid: result.txid,
|
|
283
231
|
reusedExisting: result.reusedExisting,
|
|
232
|
+
fees: result.fees,
|
|
284
233
|
intent: {
|
|
285
234
|
sourceDomainName: result.sourceDomainName,
|
|
286
235
|
targetDomainName: result.targetDomainName,
|
|
@@ -293,24 +242,13 @@ export function buildReputationMutationData(result) {
|
|
|
293
242
|
resolved: buildReputationResolvedJson(result),
|
|
294
243
|
};
|
|
295
244
|
}
|
|
296
|
-
export function buildWalletLockMutationData(result) {
|
|
297
|
-
const after = {
|
|
298
|
-
walletRootId: result.walletRootId,
|
|
299
|
-
locked: true,
|
|
300
|
-
};
|
|
301
|
-
return buildStateChangeData({
|
|
302
|
-
kind: "wallet-lock",
|
|
303
|
-
state: after,
|
|
304
|
-
after,
|
|
305
|
-
});
|
|
306
|
-
}
|
|
307
245
|
export function buildInitMutationData(result) {
|
|
308
246
|
const after = {
|
|
309
247
|
seedName: "main",
|
|
248
|
+
passwordAction: result.passwordAction,
|
|
249
|
+
walletAction: result.walletAction,
|
|
310
250
|
walletRootId: result.walletRootId,
|
|
311
251
|
fundingAddress: result.fundingAddress,
|
|
312
|
-
unlockUntilUnixMs: result.unlockUntilUnixMs,
|
|
313
|
-
locked: false,
|
|
314
252
|
};
|
|
315
253
|
return buildStateChangeData({
|
|
316
254
|
kind: "init",
|
|
@@ -324,8 +262,6 @@ export function buildRestoreMutationData(result) {
|
|
|
324
262
|
seedName: result.seedName ?? null,
|
|
325
263
|
walletRootId: result.walletRootId,
|
|
326
264
|
fundingAddress: result.fundingAddress,
|
|
327
|
-
unlockUntilUnixMs: result.unlockUntilUnixMs,
|
|
328
|
-
locked: false,
|
|
329
265
|
};
|
|
330
266
|
return buildStateChangeData({
|
|
331
267
|
kind: "restore",
|
|
@@ -333,48 +269,6 @@ export function buildRestoreMutationData(result) {
|
|
|
333
269
|
after,
|
|
334
270
|
});
|
|
335
271
|
}
|
|
336
|
-
export function buildUnlockMutationData(result) {
|
|
337
|
-
const after = {
|
|
338
|
-
walletRootId: result.state.walletRootId,
|
|
339
|
-
locked: false,
|
|
340
|
-
unlockUntilUnixMs: result.unlockUntilUnixMs,
|
|
341
|
-
fundingAddress: result.state.funding.address,
|
|
342
|
-
source: result.source,
|
|
343
|
-
};
|
|
344
|
-
return buildStateChangeData({
|
|
345
|
-
kind: "unlock",
|
|
346
|
-
state: after,
|
|
347
|
-
after,
|
|
348
|
-
});
|
|
349
|
-
}
|
|
350
|
-
export function buildWalletExportMutationData(result) {
|
|
351
|
-
const state = {
|
|
352
|
-
walletRootId: result.walletRootId,
|
|
353
|
-
archivePath: result.archivePath,
|
|
354
|
-
};
|
|
355
|
-
return buildOperationData({
|
|
356
|
-
kind: "wallet-export",
|
|
357
|
-
state,
|
|
358
|
-
operation: {
|
|
359
|
-
walletRootId: result.walletRootId,
|
|
360
|
-
archivePath: result.archivePath,
|
|
361
|
-
exportMode: "trusted-quiescent",
|
|
362
|
-
},
|
|
363
|
-
});
|
|
364
|
-
}
|
|
365
|
-
export function buildWalletImportMutationData(result) {
|
|
366
|
-
const after = {
|
|
367
|
-
walletRootId: result.walletRootId,
|
|
368
|
-
archivePath: result.archivePath,
|
|
369
|
-
fundingAddress: result.fundingAddress,
|
|
370
|
-
unlockUntilUnixMs: result.unlockUntilUnixMs,
|
|
371
|
-
};
|
|
372
|
-
return buildStateChangeData({
|
|
373
|
-
kind: "wallet-import",
|
|
374
|
-
state: after,
|
|
375
|
-
after,
|
|
376
|
-
});
|
|
377
|
-
}
|
|
378
272
|
export function buildRepairMutationData(result) {
|
|
379
273
|
const after = {
|
|
380
274
|
walletRootId: result.walletRootId,
|
|
@@ -94,15 +94,8 @@ export declare function buildFieldResolvedJson(result: FieldMutationResult): {
|
|
|
94
94
|
byteLength: number;
|
|
95
95
|
} | null;
|
|
96
96
|
effect: {
|
|
97
|
-
kind: "create-and-initialize-field";
|
|
98
|
-
tx1BurnCogtoshi: "100";
|
|
99
|
-
tx2AdditionalBurnCogtoshi: "1";
|
|
100
|
-
burnCogtoshi?: undefined;
|
|
101
|
-
} | {
|
|
102
97
|
kind: "create-empty-field" | "write-field-value" | "clear-field-value";
|
|
103
98
|
burnCogtoshi: "0" | "1" | "100";
|
|
104
|
-
tx1BurnCogtoshi?: undefined;
|
|
105
|
-
tx2AdditionalBurnCogtoshi?: undefined;
|
|
106
99
|
};
|
|
107
100
|
} | null;
|
|
108
101
|
export declare function buildReputationResolvedJson(result: ReputationMutationResult): {
|
|
@@ -98,16 +98,10 @@ export function buildFieldResolvedJson(result) {
|
|
|
98
98
|
format: result.resolved.value.format,
|
|
99
99
|
byteLength: result.resolved.value.byteLength,
|
|
100
100
|
},
|
|
101
|
-
effect:
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
tx2AdditionalBurnCogtoshi: result.resolved.effect.tx2AdditionalBurnCogtoshi,
|
|
106
|
-
}
|
|
107
|
-
: {
|
|
108
|
-
kind: result.resolved.effect.kind,
|
|
109
|
-
burnCogtoshi: result.resolved.effect.burnCogtoshi,
|
|
110
|
-
},
|
|
101
|
+
effect: {
|
|
102
|
+
kind: result.resolved.effect.kind,
|
|
103
|
+
burnCogtoshi: result.resolved.effect.burnCogtoshi,
|
|
104
|
+
},
|
|
111
105
|
};
|
|
112
106
|
}
|
|
113
107
|
export function buildReputationResolvedJson(result) {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type WalletMutationFeeSummary } from "../wallet/tx/common.js";
|
|
1
2
|
import { type MutationTextField } from "./mutation-text-write.js";
|
|
2
3
|
import type { ParsedCliArgs, RequiredCliRunnerContext } from "./types.js";
|
|
3
4
|
export interface MutationSuccessNextSteps {
|
|
@@ -11,6 +12,7 @@ export declare function writeMutationCommandSuccess(parsed: ParsedCliArgs, conte
|
|
|
11
12
|
previewData?: unknown;
|
|
12
13
|
reusedExisting: boolean;
|
|
13
14
|
reusedMessage: string;
|
|
15
|
+
fees?: WalletMutationFeeSummary | null;
|
|
14
16
|
interactive?: boolean;
|
|
15
17
|
explorerTxid?: string | null;
|
|
16
18
|
nextSteps: MutationSuccessNextSteps;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { formatSatVb, } from "../wallet/tx/common.js";
|
|
1
2
|
import { createPreviewSuccessEnvelope, createMutationSuccessEnvelope, describeCanonicalCommand, resolvePreviewJsonSchema, resolveStableMutationJsonSchema, writeJsonValue, } from "./output.js";
|
|
2
3
|
import { writeMutationTextResult, } from "./mutation-text-write.js";
|
|
3
4
|
import { formatNextStepLines } from "./workflow-hints.js";
|
|
@@ -19,6 +20,15 @@ function mutationOutcome(reusedExisting) {
|
|
|
19
20
|
function reuseExplanation(reusedExisting, message) {
|
|
20
21
|
return reusedExisting ? [message] : [];
|
|
21
22
|
}
|
|
23
|
+
function feeFields(fees) {
|
|
24
|
+
if (fees == null) {
|
|
25
|
+
return [];
|
|
26
|
+
}
|
|
27
|
+
return [
|
|
28
|
+
{ label: "Fee rate", value: `${formatSatVb(fees.feeRateSatVb)} sat/vB` },
|
|
29
|
+
{ label: "Fee", value: `${fees.feeSats} sats`, when: fees.feeSats !== null },
|
|
30
|
+
];
|
|
31
|
+
}
|
|
22
32
|
export function writeMutationCommandSuccess(parsed, context, options) {
|
|
23
33
|
if (parsed.outputMode === "preview-json") {
|
|
24
34
|
writeJsonValue(context.stdout, createPreviewSuccessEnvelope(resolvePreviewJsonSchema(parsed), describeCanonicalCommand(parsed), options.outcome ?? mutationOutcome(options.reusedExisting), options.previewData ?? options.data, {
|
|
@@ -38,7 +48,7 @@ export function writeMutationCommandSuccess(parsed, context, options) {
|
|
|
38
48
|
}
|
|
39
49
|
writeMutationTextResult(context.stdout, {
|
|
40
50
|
heading: options.text.heading,
|
|
41
|
-
fields: options.text.fields,
|
|
51
|
+
fields: [...options.text.fields, ...feeFields(options.fees)],
|
|
42
52
|
reusedExisting: options.reusedExisting,
|
|
43
53
|
reusedMessage: options.reusedMessage,
|
|
44
54
|
trailerLines: options.nextSteps.text,
|
|
@@ -6,7 +6,7 @@ export function formatRegisterEconomicEffect(result) {
|
|
|
6
6
|
if (result.resolved.economicEffect.kind === "treasury-payment") {
|
|
7
7
|
return `send ${result.resolved.economicEffect.amount.toString()} sats to the Cogcoin treasury`;
|
|
8
8
|
}
|
|
9
|
-
return `burn ${formatCogAmount(result.resolved.economicEffect.amount)} from the parent
|
|
9
|
+
return `burn ${formatCogAmount(result.resolved.economicEffect.amount)} from the parent owner`;
|
|
10
10
|
}
|
|
11
11
|
export function formatBuyBuyerSummary(result) {
|
|
12
12
|
if (result.resolvedBuyer === null || result.resolvedBuyer === undefined) {
|
|
@@ -130,8 +130,6 @@ export function formatFieldEffect(result) {
|
|
|
130
130
|
switch (effect.kind) {
|
|
131
131
|
case "create-empty-field":
|
|
132
132
|
return `burn ${effect.burnCogtoshi} cogtoshi to create an empty field`;
|
|
133
|
-
case "create-and-initialize-field":
|
|
134
|
-
return `burn ${effect.tx1BurnCogtoshi} cogtoshi in Tx1 and ${effect.tx2AdditionalBurnCogtoshi} additional cogtoshi in Tx2`;
|
|
135
133
|
case "write-field-value":
|
|
136
134
|
return `burn ${effect.burnCogtoshi} cogtoshi to write the field value`;
|
|
137
135
|
case "clear-field-value":
|
package/dist/cli/output.d.ts
CHANGED
|
@@ -163,7 +163,7 @@ export declare function classifyCliError(error: unknown): {
|
|
|
163
163
|
message: string;
|
|
164
164
|
};
|
|
165
165
|
export declare function formatCliTextError(error: unknown): string[] | null;
|
|
166
|
-
export declare function createCliErrorPresentation(errorCode: string, fallbackMessage: string): {
|
|
166
|
+
export declare function createCliErrorPresentation(errorCode: string, fallbackMessage: string, error?: unknown): {
|
|
167
167
|
what: string;
|
|
168
168
|
why: string | null;
|
|
169
169
|
next: string | null;
|