@bsv/wallet-toolbox 2.4.0 → 2.4.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.
Files changed (67) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/README.md +4 -0
  3. package/docs/client.md +160 -79
  4. package/docs/managed-change-policy.md +79 -0
  5. package/docs/services.md +10 -0
  6. package/docs/storage.md +86 -29
  7. package/docs/wallet.md +140 -74
  8. package/out/src/Wallet.d.ts +4 -0
  9. package/out/src/Wallet.d.ts.map +1 -1
  10. package/out/src/Wallet.js +6 -1
  11. package/out/src/Wallet.js.map +1 -1
  12. package/out/src/monitor/tasks/TaskArcSSE.d.ts.map +1 -1
  13. package/out/src/monitor/tasks/TaskArcSSE.js +39 -15
  14. package/out/src/monitor/tasks/TaskArcSSE.js.map +1 -1
  15. package/out/src/sdk/types.d.ts +9 -0
  16. package/out/src/sdk/types.d.ts.map +1 -1
  17. package/out/src/sdk/types.js +16 -2
  18. package/out/src/sdk/types.js.map +1 -1
  19. package/out/src/services/chaintracker/chaintracks/ChaintracksServiceClient.d.ts.map +1 -1
  20. package/out/src/services/chaintracker/chaintracks/ChaintracksServiceClient.js +8 -0
  21. package/out/src/services/chaintracker/chaintracks/ChaintracksServiceClient.js.map +1 -1
  22. package/out/src/services/providers/Arcade.d.ts +1 -0
  23. package/out/src/services/providers/Arcade.d.ts.map +1 -1
  24. package/out/src/services/providers/Arcade.js +40 -13
  25. package/out/src/services/providers/Arcade.js.map +1 -1
  26. package/out/src/signer/methods/internalizeAction.d.ts +6 -4
  27. package/out/src/signer/methods/internalizeAction.d.ts.map +1 -1
  28. package/out/src/signer/methods/internalizeAction.js +12 -7
  29. package/out/src/signer/methods/internalizeAction.js.map +1 -1
  30. package/out/src/storage/StorageIdb.d.ts +2 -1
  31. package/out/src/storage/StorageIdb.d.ts.map +1 -1
  32. package/out/src/storage/StorageIdb.js +12 -5
  33. package/out/src/storage/StorageIdb.js.map +1 -1
  34. package/out/src/storage/StorageKnex.d.ts +2 -1
  35. package/out/src/storage/StorageKnex.d.ts.map +1 -1
  36. package/out/src/storage/StorageKnex.js +27 -2
  37. package/out/src/storage/StorageKnex.js.map +1 -1
  38. package/out/src/storage/index.all.d.ts +1 -0
  39. package/out/src/storage/index.all.d.ts.map +1 -1
  40. package/out/src/storage/index.all.js +1 -0
  41. package/out/src/storage/index.all.js.map +1 -1
  42. package/out/src/storage/index.client.d.ts +1 -0
  43. package/out/src/storage/index.client.d.ts.map +1 -1
  44. package/out/src/storage/index.client.js +1 -0
  45. package/out/src/storage/index.client.js.map +1 -1
  46. package/out/src/storage/methods/ListOutputsSpecOp.d.ts +2 -0
  47. package/out/src/storage/methods/ListOutputsSpecOp.d.ts.map +1 -1
  48. package/out/src/storage/methods/ListOutputsSpecOp.js +13 -1
  49. package/out/src/storage/methods/ListOutputsSpecOp.js.map +1 -1
  50. package/out/src/storage/methods/createAction.d.ts.map +1 -1
  51. package/out/src/storage/methods/createAction.js +6 -6
  52. package/out/src/storage/methods/createAction.js.map +1 -1
  53. package/out/src/storage/methods/internalizeAction.d.ts +6 -4
  54. package/out/src/storage/methods/internalizeAction.d.ts.map +1 -1
  55. package/out/src/storage/methods/internalizeAction.js +23 -12
  56. package/out/src/storage/methods/internalizeAction.js.map +1 -1
  57. package/out/src/storage/methods/listOutputsIdb.d.ts.map +1 -1
  58. package/out/src/storage/methods/listOutputsIdb.js +21 -3
  59. package/out/src/storage/methods/listOutputsIdb.js.map +1 -1
  60. package/out/src/storage/methods/listOutputsKnex.d.ts.map +1 -1
  61. package/out/src/storage/methods/listOutputsKnex.js +14 -0
  62. package/out/src/storage/methods/listOutputsKnex.js.map +1 -1
  63. package/out/src/storage/methods/managedChange.d.ts +26 -0
  64. package/out/src/storage/methods/managedChange.d.ts.map +1 -0
  65. package/out/src/storage/methods/managedChange.js +43 -0
  66. package/out/src/storage/methods/managedChange.js.map +1 -0
  67. package/package.json +3 -3
package/CHANGELOG.md CHANGED
@@ -6,6 +6,15 @@ attention to changes that materially alter behavior or extend functionality.
6
6
 
7
7
  ## wallet-toolbox (unreleased)
8
8
 
9
+ - Release prep for `2.4.1`: define one managed-change policy across Knex and IndexedDB allocation,
10
+ counting, default balance reporting, `balanceAndUtxos`, and `noSendChange`.
11
+ Only complete BRC-29 signer metadata is eligible; custom rows remain visible
12
+ through raw default-basket listing for recovery. `internalizeAction` now
13
+ rejects basket insertion into `default`, prevents managed change from being
14
+ reclassified, promotes verified legacy BRC-29 rows through `wallet payment`,
15
+ and permits incompatible custom rows to be swept to non-default baskets
16
+ without changing wallet balance.
17
+
9
18
  - Release prep for `2.4.0`: security fix for `GHSA-36f9-7rg5-cpf8`. `buildSignableTransaction` now verifies that storage-returned outputs match the caller's requested `args.outputs` before signing (rejects substituted/altered/reclassified/missing outputs), and rejects any unrequested output that isn't client-derived change or a single commission output bounded by `MAX_STORAGE_COMMISSION_SATOSHIS`. `WalletPermissionsManager.createAction` independently verifies requested outputs are present in the signable transaction before authorizing, as defense-in-depth. Protects against a malicious or compromised `StorageClient` operator substituting or injecting outputs that would be signed and broadcast without the caller's knowledge.
10
19
 
11
20
  - Release prep for `2.3.3`: add Arcade-first wallet service wiring, go-chaintracks
package/README.md CHANGED
@@ -75,6 +75,10 @@ const result = await wallet.createAction({
75
75
 
76
76
  [Full API documentation](https://bsv-blockchain.github.io/wallet-toolbox) is available on GitHub Pages.
77
77
 
78
+ See [Managed change, sweeping, and recovery](./docs/managed-change-policy.md)
79
+ for the default-basket invariant, automatic funding policy, and supported
80
+ `internalizeAction` repair paths.
81
+
78
82
  The codebase has detailed JSDoc annotations throughout — these will surface inline in editors like VS Code.
79
83
 
80
84
  ## Development
package/docs/client.md CHANGED
@@ -3847,6 +3847,7 @@ export interface ListOutputsSpecOp {
3847
3847
  includeOutputScripts?: boolean;
3848
3848
  includeSpent?: boolean;
3849
3849
  totalOutputsIsSumOfSatoshis?: boolean;
3850
+ managedChangeOnly?: boolean;
3850
3851
  resultFromTags?: (s: StorageProvider, auth: AuthId, vargs: Validation.ValidListOutputsArgs, specOpTags: string[]) => Promise<ListOutputsResult>;
3851
3852
  resultFromOutputs?: (s: StorageProvider, auth: AuthId, vargs: Validation.ValidListOutputsArgs, specOpTags: string[], outputs: TableOutput[]) => Promise<ListOutputsResult>;
3852
3853
  filterOutputs?: (s: StorageProvider, auth: AuthId, vargs: Validation.ValidListOutputsArgs, specOpTags: string[], outputs: TableOutput[]) => Promise<TableOutput[]>;
@@ -3857,6 +3858,14 @@ export interface ListOutputsSpecOp {
3857
3858
 
3858
3859
  See also: [AuthId](./client.md#interface-authid), [StorageProvider](./storage.md#class-storageprovider), [TableOutput](./storage.md#interface-tableoutput)
3859
3860
 
3861
+ ###### Property managedChangeOnly
3862
+
3863
+ Restrict the operation to wallet-managed, BRC-29-signable change.
3864
+
3865
+ ```ts
3866
+ managedChangeOnly?: boolean
3867
+ ```
3868
+
3860
3869
  ###### Property tagsParamsCount
3861
3870
 
3862
3871
  How many positional tags to intercept.
@@ -14021,7 +14030,8 @@ Proceeds in three stages:
14021
14030
  3. Find an output that comes as close to funding as possible (targetSatoshis).
14022
14031
  4. Return undefined if no output is found.
14023
14032
 
14024
- Outputs must belong to userId and basketId and have spendable true.
14033
+ Outputs must belong to userId and basketId and satisfy the wallet-managed
14034
+ BRC-29 change policy.
14025
14035
  Their corresponding transaction must have status of 'completed', 'unproven', or 'sending' (if excludeSending is false).
14026
14036
 
14027
14037
  ```ts
@@ -15801,6 +15811,10 @@ sum of output satoshis
15801
15811
  Uses `listOutputs` to iterate over chunks of up to 1000 outputs to
15802
15812
  compute the sum of output satoshis.
15803
15813
 
15814
+ For `default`, only wallet-managed BRC-29 change is included. Raw
15815
+ administrative `listOutputs({ basket: 'default' })` remains available to
15816
+ discover legacy incompatible rows for recovery.
15817
+
15804
15818
  ```ts
15805
15819
  async balanceAndUtxos(basket: string = "default"): Promise<WalletBalance>
15806
15820
  ```
@@ -17176,15 +17190,15 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
17176
17190
 
17177
17191
  | | | |
17178
17192
  | --- | --- | --- |
17179
- | [WalletErrorFromJson](#function-walleterrorfromjson) | [importBRC38](#function-importbrc38) | [selectBulkHeaderFiles](#function-selectbulkheaderfiles) |
17180
- | [WocHeadersBulkListener](#function-wocheadersbulklistener) | [importBRC39](#function-importbrc39) | [serializeBaseBlockHeader](#function-serializebaseblockheader) |
17181
- | [WocHeadersBulkListener_test](#function-wocheadersbulklistener_test) | [importSingleOutpoint](#function-importsingleoutpoint) | [serializeBaseBlockHeaders](#function-serializebaseblockheaders) |
17193
+ | [WalletErrorFromJson](#function-walleterrorfromjson) | [importBRC39](#function-importbrc39) | [selectBulkHeaderFiles](#function-selectbulkheaderfiles) |
17194
+ | [WocHeadersBulkListener](#function-wocheadersbulklistener) | [importSingleOutpoint](#function-importsingleoutpoint) | [serializeBaseBlockHeader](#function-serializebaseblockheader) |
17195
+ | [WocHeadersBulkListener_test](#function-wocheadersbulklistener_test) | [internalizeAction](#function-internalizeaction) | [serializeBaseBlockHeaders](#function-serializebaseblockheaders) |
17182
17196
  | [WocHeadersLiveListener](#function-wocheaderslivelistener) | [internalizeAction](#function-internalizeaction) | [setDisableDoubleSpendCheckForTest](#function-setdisabledoublespendcheckfortest) |
17183
- | [WocHeadersLiveListener_test](#function-wocheaderslivelistener_test) | [internalizeAction](#function-internalizeaction) | [sha256Hash](#function-sha256hash) |
17184
- | [acquireDirectCertificate](#function-acquiredirectcertificate) | [isArcAcceptedTxStatus](#function-isarcacceptedtxstatus) | [sha256HashOfBinaryFile](#function-sha256hashofbinaryfile) |
17185
- | [addWork](#function-addwork) | [isArcDoubleSpendTxStatus](#function-isarcdoublespendtxstatus) | [shareReqsWithWorld](#function-sharereqswithworld) |
17186
- | [arcDefaultUrl](#function-arcdefaulturl) | [isArcInvalidTxStatus](#function-isarcinvalidtxstatus) | [signAction](#function-signaction) |
17187
- | [arcGorillaPoolUrl](#function-arcgorillapoolurl) | [isArcServiceErrorStatus](#function-isarcserviceerrorstatus) | [signAndComplete](#function-signandcomplete) |
17197
+ | [WocHeadersLiveListener_test](#function-wocheaderslivelistener_test) | [isArcAcceptedTxStatus](#function-isarcacceptedtxstatus) | [sha256Hash](#function-sha256hash) |
17198
+ | [acquireDirectCertificate](#function-acquiredirectcertificate) | [isArcDoubleSpendTxStatus](#function-isarcdoublespendtxstatus) | [sha256HashOfBinaryFile](#function-sha256hashofbinaryfile) |
17199
+ | [addWork](#function-addwork) | [isArcInvalidTxStatus](#function-isarcinvalidtxstatus) | [shareReqsWithWorld](#function-sharereqswithworld) |
17200
+ | [arcDefaultUrl](#function-arcdefaulturl) | [isArcServiceErrorStatus](#function-isarcserviceerrorstatus) | [signAction](#function-signaction) |
17201
+ | [arcGorillaPoolUrl](#function-arcgorillapoolurl) | [isAutoSpendableChangeOutput](#function-isautospendablechangeoutput) | [signAndComplete](#function-signandcomplete) |
17188
17202
  | [arcadeDefaultUrl](#function-arcadedefaulturl) | [isBaseBlockHeader](#function-isbaseblockheader) | [stampLog](#function-stamplog) |
17189
17203
  | [arraysEqual](#function-arraysequal) | [isBlockHeader](#function-isblockheader) | [stampLogFormat](#function-stamplogformat) |
17190
17204
  | [asArray](#function-asarray) | [isCreateActionSpecOp](#function-iscreateactionspecop) | [subWork](#function-subwork) |
@@ -17193,62 +17207,63 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
17193
17207
  | [asBsvSdkScript](#function-asbsvsdkscript) | [isListOutputsSpecOp](#function-islistoutputsspecop) | [toBinaryBaseBlockHeader](#function-tobinarybaseblockheader) |
17194
17208
  | [asBsvSdkTx](#function-asbsvsdktx) | [isLive](#function-islive) | [toLookupNetworkPreset](#function-tolookupnetworkpreset) |
17195
17209
  | [asString](#function-asstring) | [isLiveBlockHeader](#function-isliveblockheader) | [toWalletNetwork](#function-towalletnetwork) |
17196
- | [asUint8Array](#function-asuint8array) | [isMoreWork](#function-ismorework) | [transactionInputSize](#function-transactioninputsize) |
17197
- | [attemptToPostReqsToNetwork](#function-attempttopostreqstonetwork) | [keyOffsetToHashedSecret](#function-keyoffsettohashedsecret) | [transactionOutputSize](#function-transactionoutputsize) |
17198
- | [blockHash](#function-blockhash) | [listActionsIdb](#function-listactionsidb) | [transactionSize](#function-transactionsize) |
17199
- | [buildBeefForOutpoints](#function-buildbeefforoutpoints) | [listCertificates](#function-listcertificates) | [updateChaintracksFiatExchangeRates](#function-updatechaintracksfiatexchangerates) |
17200
- | [buildChaintracksOptionsWithIngestors](#function-buildchaintracksoptionswithingestors) | [listOutputsIdb](#function-listoutputsidb) | [updateExchangeratesapi](#function-updateexchangeratesapi) |
17201
- | [buildSignableTransaction](#function-buildsignabletransaction) | [lockScriptWithKeyOffsetFromPubKey](#function-lockscriptwithkeyoffsetfrompubkey) | [updateReqsFromAggregateResults](#function-updatereqsfromaggregateresults) |
17202
- | [classifyMerklePathResponse](#function-classifymerklepathresponse) | [logCreateActionArgs](#function-logcreateactionargs) | [upgradeAllStoresV1](#function-upgradeallstoresv1) |
17203
- | [classifyReqStatus](#function-classifyreqstatus) | [logWalletError](#function-logwalleterror) | [upgradeCertificateFields](#function-upgradecertificatefields) |
17204
- | [completeSignedTransaction](#function-completesignedtransaction) | [makeAtomicBeef](#function-makeatomicbeef) | [upgradeCertificates](#function-upgradecertificates) |
17205
- | [computeMerklePath](#function-computemerklepath) | [makeBrc114ActionTimeLabel](#function-makebrc114actiontimelabel) | [upgradeCommissions](#function-upgradecommissions) |
17206
- | [computeMerkleRoot](#function-computemerkleroot) | [makeChangeLock](#function-makechangelock) | [upgradeMonitorEvents](#function-upgrademonitorevents) |
17207
- | [convertBitsToTarget](#function-convertbitstotarget) | [makeMerklePathNote](#function-makemerklepathnote) | [upgradeOutputBaskets](#function-upgradeoutputbaskets) |
17208
- | [convertBitsToWork](#function-convertbitstowork) | [markStaleInputsAsSpent](#function-markstaleinputsasspent) | [upgradeOutputTags](#function-upgradeoutputtags) |
17209
- | [convertBufferToUint32](#function-convertbuffertouint32) | [markUserInputsSpent](#function-markuserinputsspent) | [upgradeOutputTagsMap](#function-upgradeoutputtagsmap) |
17210
- | [convertProofToMerklePath](#function-convertprooftomerklepath) | [matchesCertificateFieldPartial](#function-matchescertificatefieldpartial) | [upgradeOutputs](#function-upgradeoutputs) |
17211
- | [convertUint32ToBuffer](#function-convertuint32tobuffer) | [matchesCertificatePartial](#function-matchescertificatepartial) | [upgradeProvenTxReqs](#function-upgradeproventxreqs) |
17212
- | [convertWocToBlockHeaderHex](#function-convertwoctoblockheaderhex) | [matchesCommissionPartial](#function-matchescommissionpartial) | [upgradeProvenTxs](#function-upgradeproventxs) |
17213
- | [createAction](#function-createaction) | [matchesMonitorEventPartial](#function-matchesmonitoreventpartial) | [upgradeSyncStates](#function-upgradesyncstates) |
17214
- | [createAction](#function-createaction) | [matchesOutputBasketPartial](#function-matchesoutputbasketpartial) | [upgradeTransactions](#function-upgradetransactions) |
17215
- | [createCoinbaseTransaction](#function-createcoinbasetransaction) | [matchesOutputPartial](#function-matchesoutputpartial) | [upgradeTxLabels](#function-upgradetxlabels) |
17216
- | [createDefaultIdbChaintracksOptions](#function-createdefaultidbchaintracksoptions) | [matchesOutputTagMapPartial](#function-matchesoutputtagmappartial) | [upgradeTxLabelsMap](#function-upgradetxlabelsmap) |
17217
- | [createDefaultNoDbChaintracksOptions](#function-createdefaultnodbchaintracksoptions) | [matchesOutputTagPartial](#function-matchesoutputtagpartial) | [upgradeUsers](#function-upgradeusers) |
17218
- | [createDefaultWalletServicesOptions](#function-createdefaultwalletservicesoptions) | [matchesProvenTxPartial](#function-matchesproventxpartial) | [validBulkHeaderFilesByFileHash](#function-validbulkheaderfilesbyfilehash) |
17219
- | [createIdbChaintracks](#function-createidbchaintracks) | [matchesProvenTxReqPartial](#function-matchesproventxreqpartial) | [validateAgainstDirtyHashes](#function-validateagainstdirtyhashes) |
17220
- | [createNoDbChaintracks](#function-createnodbchaintracks) | [matchesSyncStatePartial](#function-matchessyncstatepartial) | [validateBufferOfHeaders](#function-validatebufferofheaders) |
17221
- | [createStorageServiceChargeScript](#function-createstorageservicechargescript) | [matchesTransactionPartial](#function-matchestransactionpartial) | [validateBulkFileData](#function-validatebulkfiledata) |
17222
- | [createSyncMap](#function-createsyncmap) | [matchesTxLabelMapPartial](#function-matchestxlabelmappartial) | [validateDate](#function-validatedate) |
17223
- | [dateMatches](#function-datematches) | [matchesTxLabelPartial](#function-matchestxlabelpartial) | [validateEntities](#function-validateentities) |
17224
- | [decryptBRC39](#function-decryptbrc39) | [maxDate](#function-maxdate) | [validateEntity](#function-validateentity) |
17225
- | [deserializeBaseBlockHeader](#function-deserializebaseblockheader) | [mergeInputBeefs](#function-mergeinputbeefs) | [validateGenerateChangeSdkParams](#function-validategeneratechangesdkparams) |
17226
- | [deserializeBaseBlockHeaders](#function-deserializebaseblockheaders) | [mergeInputsIntoBeef](#function-mergeinputsintobeef) | [validateGenerateChangeSdkResult](#function-validategeneratechangesdkresult) |
17227
- | [deserializeBlockHeader](#function-deserializeblockheader) | [notifyTransactionsOfProof](#function-notifytransactionsofproof) | [validateGenesisHeader](#function-validategenesisheader) |
17228
- | [deserializeBlockHeaders](#function-deserializeblockheaders) | [offsetPrivKey](#function-offsetprivkey) | [validateHeaderDifficulty](#function-validateheaderdifficulty) |
17229
- | [doubleSha256BE](#function-doublesha256be) | [offsetPubKey](#function-offsetpubkey) | [validateHeaderFormat](#function-validateheaderformat) |
17230
- | [doubleSha256LE](#function-doublesha256le) | [optionalArraysEqual](#function-optionalarraysequal) | [validateScriptHash](#function-validatescripthash) |
17231
- | [encryptBRC39](#function-encryptbrc39) | [parseBRC38Json](#function-parsebrc38json) | [validateSecondsSinceEpoch](#function-validatesecondssinceepoch) |
17232
- | [exportBRC38](#function-exportbrc38) | [parseBrc114ActionTimeLabels](#function-parsebrc114actiontimelabels) | [validateStorageFeeModel](#function-validatestoragefeemodel) |
17233
- | [exportBRC38Json](#function-exportbrc38json) | [parseOutpoint](#function-parseoutpoint) | [validateSyncChunkEntities](#function-validatesyncchunkentities) |
17234
- | [exportBRC39](#function-exportbrc39) | [parseResults$](#function-parseresults$) | [varUintSize](#function-varuintsize) |
17235
- | [fundWalletFromP2PKHOutpoints](#function-fundwalletfromp2pkhoutpoints) | [parseTxAndAssertId](#function-parsetxandassertid) | [verifyHexString](#function-verifyhexstring) |
17236
- | [generateChangeSdk](#function-generatechangesdk) | [parseTxScriptOffsets](#function-parsetxscriptoffsets) | [verifyId](#function-verifyid) |
17237
- | [generateChangeSdkMakeStorage](#function-generatechangesdkmakestorage) | [partitionActionLabels](#function-partitionactionlabels) | [verifyInteger](#function-verifyinteger) |
17238
- | [genesisBuffer](#function-genesisbuffer) | [populateUtxoDetails](#function-populateutxodetails) | [verifyNumber](#function-verifynumber) |
17239
- | [genesisHeader](#function-genesisheader) | [processAction](#function-processaction) | [verifyOne](#function-verifyone) |
17210
+ | [asUint8Array](#function-asuint8array) | [isManagedChangeOutput](#function-ismanagedchangeoutput) | [transactionInputSize](#function-transactioninputsize) |
17211
+ | [attemptToPostReqsToNetwork](#function-attempttopostreqstonetwork) | [isMoreWork](#function-ismorework) | [transactionOutputSize](#function-transactionoutputsize) |
17212
+ | [blockHash](#function-blockhash) | [keyOffsetToHashedSecret](#function-keyoffsettohashedsecret) | [transactionSize](#function-transactionsize) |
17213
+ | [buildBeefForOutpoints](#function-buildbeefforoutpoints) | [listActionsIdb](#function-listactionsidb) | [updateChaintracksFiatExchangeRates](#function-updatechaintracksfiatexchangerates) |
17214
+ | [buildChaintracksOptionsWithIngestors](#function-buildchaintracksoptionswithingestors) | [listCertificates](#function-listcertificates) | [updateExchangeratesapi](#function-updateexchangeratesapi) |
17215
+ | [buildSignableTransaction](#function-buildsignabletransaction) | [listOutputsIdb](#function-listoutputsidb) | [updateReqsFromAggregateResults](#function-updatereqsfromaggregateresults) |
17216
+ | [classifyMerklePathResponse](#function-classifymerklepathresponse) | [lockScriptWithKeyOffsetFromPubKey](#function-lockscriptwithkeyoffsetfrompubkey) | [upgradeAllStoresV1](#function-upgradeallstoresv1) |
17217
+ | [classifyReqStatus](#function-classifyreqstatus) | [logCreateActionArgs](#function-logcreateactionargs) | [upgradeCertificateFields](#function-upgradecertificatefields) |
17218
+ | [completeSignedTransaction](#function-completesignedtransaction) | [logWalletError](#function-logwalleterror) | [upgradeCertificates](#function-upgradecertificates) |
17219
+ | [computeMerklePath](#function-computemerklepath) | [makeAtomicBeef](#function-makeatomicbeef) | [upgradeCommissions](#function-upgradecommissions) |
17220
+ | [computeMerkleRoot](#function-computemerkleroot) | [makeBrc114ActionTimeLabel](#function-makebrc114actiontimelabel) | [upgradeMonitorEvents](#function-upgrademonitorevents) |
17221
+ | [convertBitsToTarget](#function-convertbitstotarget) | [makeChangeLock](#function-makechangelock) | [upgradeOutputBaskets](#function-upgradeoutputbaskets) |
17222
+ | [convertBitsToWork](#function-convertbitstowork) | [makeMerklePathNote](#function-makemerklepathnote) | [upgradeOutputTags](#function-upgradeoutputtags) |
17223
+ | [convertBufferToUint32](#function-convertbuffertouint32) | [markStaleInputsAsSpent](#function-markstaleinputsasspent) | [upgradeOutputTagsMap](#function-upgradeoutputtagsmap) |
17224
+ | [convertProofToMerklePath](#function-convertprooftomerklepath) | [markUserInputsSpent](#function-markuserinputsspent) | [upgradeOutputs](#function-upgradeoutputs) |
17225
+ | [convertUint32ToBuffer](#function-convertuint32tobuffer) | [matchesCertificateFieldPartial](#function-matchescertificatefieldpartial) | [upgradeProvenTxReqs](#function-upgradeproventxreqs) |
17226
+ | [convertWocToBlockHeaderHex](#function-convertwoctoblockheaderhex) | [matchesCertificatePartial](#function-matchescertificatepartial) | [upgradeProvenTxs](#function-upgradeproventxs) |
17227
+ | [createAction](#function-createaction) | [matchesCommissionPartial](#function-matchescommissionpartial) | [upgradeSyncStates](#function-upgradesyncstates) |
17228
+ | [createAction](#function-createaction) | [matchesMonitorEventPartial](#function-matchesmonitoreventpartial) | [upgradeTransactions](#function-upgradetransactions) |
17229
+ | [createCoinbaseTransaction](#function-createcoinbasetransaction) | [matchesOutputBasketPartial](#function-matchesoutputbasketpartial) | [upgradeTxLabels](#function-upgradetxlabels) |
17230
+ | [createDefaultIdbChaintracksOptions](#function-createdefaultidbchaintracksoptions) | [matchesOutputPartial](#function-matchesoutputpartial) | [upgradeTxLabelsMap](#function-upgradetxlabelsmap) |
17231
+ | [createDefaultNoDbChaintracksOptions](#function-createdefaultnodbchaintracksoptions) | [matchesOutputTagMapPartial](#function-matchesoutputtagmappartial) | [upgradeUsers](#function-upgradeusers) |
17232
+ | [createDefaultWalletServicesOptions](#function-createdefaultwalletservicesoptions) | [matchesOutputTagPartial](#function-matchesoutputtagpartial) | [validBulkHeaderFilesByFileHash](#function-validbulkheaderfilesbyfilehash) |
17233
+ | [createIdbChaintracks](#function-createidbchaintracks) | [matchesProvenTxPartial](#function-matchesproventxpartial) | [validateAgainstDirtyHashes](#function-validateagainstdirtyhashes) |
17234
+ | [createNoDbChaintracks](#function-createnodbchaintracks) | [matchesProvenTxReqPartial](#function-matchesproventxreqpartial) | [validateBufferOfHeaders](#function-validatebufferofheaders) |
17235
+ | [createStorageServiceChargeScript](#function-createstorageservicechargescript) | [matchesSyncStatePartial](#function-matchessyncstatepartial) | [validateBulkFileData](#function-validatebulkfiledata) |
17236
+ | [createSyncMap](#function-createsyncmap) | [matchesTransactionPartial](#function-matchestransactionpartial) | [validateDate](#function-validatedate) |
17237
+ | [dateMatches](#function-datematches) | [matchesTxLabelMapPartial](#function-matchestxlabelmappartial) | [validateEntities](#function-validateentities) |
17238
+ | [decryptBRC39](#function-decryptbrc39) | [matchesTxLabelPartial](#function-matchestxlabelpartial) | [validateEntity](#function-validateentity) |
17239
+ | [deserializeBaseBlockHeader](#function-deserializebaseblockheader) | [maxDate](#function-maxdate) | [validateGenerateChangeSdkParams](#function-validategeneratechangesdkparams) |
17240
+ | [deserializeBaseBlockHeaders](#function-deserializebaseblockheaders) | [mergeInputBeefs](#function-mergeinputbeefs) | [validateGenerateChangeSdkResult](#function-validategeneratechangesdkresult) |
17241
+ | [deserializeBlockHeader](#function-deserializeblockheader) | [mergeInputsIntoBeef](#function-mergeinputsintobeef) | [validateGenesisHeader](#function-validategenesisheader) |
17242
+ | [deserializeBlockHeaders](#function-deserializeblockheaders) | [notifyTransactionsOfProof](#function-notifytransactionsofproof) | [validateHeaderDifficulty](#function-validateheaderdifficulty) |
17243
+ | [doubleSha256BE](#function-doublesha256be) | [offsetPrivKey](#function-offsetprivkey) | [validateHeaderFormat](#function-validateheaderformat) |
17244
+ | [doubleSha256LE](#function-doublesha256le) | [offsetPubKey](#function-offsetpubkey) | [validateScriptHash](#function-validatescripthash) |
17245
+ | [encryptBRC39](#function-encryptbrc39) | [optionalArraysEqual](#function-optionalarraysequal) | [validateSecondsSinceEpoch](#function-validatesecondssinceepoch) |
17246
+ | [exportBRC38](#function-exportbrc38) | [parseBRC38Json](#function-parsebrc38json) | [validateStorageFeeModel](#function-validatestoragefeemodel) |
17247
+ | [exportBRC38Json](#function-exportbrc38json) | [parseBrc114ActionTimeLabels](#function-parsebrc114actiontimelabels) | [validateSyncChunkEntities](#function-validatesyncchunkentities) |
17248
+ | [exportBRC39](#function-exportbrc39) | [parseOutpoint](#function-parseoutpoint) | [varUintSize](#function-varuintsize) |
17249
+ | [fundWalletFromP2PKHOutpoints](#function-fundwalletfromp2pkhoutpoints) | [parseResults$](#function-parseresults$) | [verifyHexString](#function-verifyhexstring) |
17250
+ | [generateChangeSdk](#function-generatechangesdk) | [parseTxAndAssertId](#function-parsetxandassertid) | [verifyId](#function-verifyid) |
17251
+ | [generateChangeSdkMakeStorage](#function-generatechangesdkmakestorage) | [parseTxScriptOffsets](#function-parsetxscriptoffsets) | [verifyInteger](#function-verifyinteger) |
17252
+ | [genesisBuffer](#function-genesisbuffer) | [partitionActionLabels](#function-partitionactionlabels) | [verifyNumber](#function-verifynumber) |
17253
+ | [genesisHeader](#function-genesisheader) | [populateUtxoDetails](#function-populateutxodetails) | [verifyOne](#function-verifyone) |
17240
17254
  | [getBeefForTransaction](#function-getbeeffortransaction) | [processAction](#function-processaction) | [verifyOneOrNone](#function-verifyoneornone) |
17241
- | [getBeefForTxid](#function-getbeeffortxid) | [proveCertificate](#function-provecertificate) | [verifyOptionalHexString](#function-verifyoptionalhexstring) |
17242
- | [getExchangeRatesIo](#function-getexchangeratesio) | [purgeDataIdb](#function-purgedataidb) | [verifyP2PKHOwnership](#function-verifyp2pkhownership) |
17243
- | [getIdentityKey](#function-getidentitykey) | [randomBytes](#function-randombytes) | [verifyRequestedOutputsUnchanged](#function-verifyrequestedoutputsunchanged) |
17244
- | [getListOutputsSpecOp](#function-getlistoutputsspecop) | [randomBytesBase64](#function-randombytesbase64) | [verifyTruthy](#function-verifytruthy) |
17245
- | [getProofs](#function-getproofs) | [randomBytesHex](#function-randombyteshex) | [verifyUnlockScripts](#function-verifyunlockscripts) |
17246
- | [getSyncChunk](#function-getsyncchunk) | [readUInt32BE](#function-readuint32be) | [verifyUnrequestedOutputsAreChangeOrCommission](#function-verifyunrequestedoutputsarechangeorcommission) |
17247
- | [getWhatsOnChainBlockHeaderByHash](#function-getwhatsonchainblockheaderbyhash) | [readUInt32LE](#function-readuint32le) | [wait](#function-wait) |
17248
- | [handlePostRawTxErrorResponse](#function-handlepostrawtxerrorresponse) | [redeemServiceCharges](#function-redeemservicecharges) | [wocGetHeadersHeaderToBlockHeader](#function-wocgetheadersheadertoblockheader) |
17249
- | [handleScriptHashHistoryCatch](#function-handlescripthashhistorycatch) | [resolveAutoSigned](#function-resolveautosigned) | [workBNtoBuffer](#function-workbntobuffer) |
17250
- | [handleScriptHashHistoryResponse](#function-handlescripthashhistoryresponse) | [restoreInputsToSpendable](#function-restoreinputstospendable) | [writeUInt32BE](#function-writeuint32be) |
17251
- | [handleUtxoConnReset](#function-handleutxoconnreset) | [reviewStatusIdb](#function-reviewstatusidb) | [writeUInt32LE](#function-writeuint32le) |
17255
+ | [getBeefForTxid](#function-getbeeffortxid) | [processAction](#function-processaction) | [verifyOptionalHexString](#function-verifyoptionalhexstring) |
17256
+ | [getExchangeRatesIo](#function-getexchangeratesio) | [proveCertificate](#function-provecertificate) | [verifyP2PKHOwnership](#function-verifyp2pkhownership) |
17257
+ | [getIdentityKey](#function-getidentitykey) | [purgeDataIdb](#function-purgedataidb) | [verifyRequestedOutputsUnchanged](#function-verifyrequestedoutputsunchanged) |
17258
+ | [getListOutputsSpecOp](#function-getlistoutputsspecop) | [randomBytes](#function-randombytes) | [verifyTruthy](#function-verifytruthy) |
17259
+ | [getProofs](#function-getproofs) | [randomBytesBase64](#function-randombytesbase64) | [verifyUnlockScripts](#function-verifyunlockscripts) |
17260
+ | [getSyncChunk](#function-getsyncchunk) | [randomBytesHex](#function-randombyteshex) | [verifyUnrequestedOutputsAreChangeOrCommission](#function-verifyunrequestedoutputsarechangeorcommission) |
17261
+ | [getWhatsOnChainBlockHeaderByHash](#function-getwhatsonchainblockheaderbyhash) | [readUInt32BE](#function-readuint32be) | [wait](#function-wait) |
17262
+ | [handlePostRawTxErrorResponse](#function-handlepostrawtxerrorresponse) | [readUInt32LE](#function-readuint32le) | [wocGetHeadersHeaderToBlockHeader](#function-wocgetheadersheadertoblockheader) |
17263
+ | [handleScriptHashHistoryCatch](#function-handlescripthashhistorycatch) | [redeemServiceCharges](#function-redeemservicecharges) | [workBNtoBuffer](#function-workbntobuffer) |
17264
+ | [handleScriptHashHistoryResponse](#function-handlescripthashhistoryresponse) | [resolveAutoSigned](#function-resolveautosigned) | [writeUInt32BE](#function-writeuint32be) |
17265
+ | [handleUtxoConnReset](#function-handleutxoconnreset) | [restoreInputsToSpendable](#function-restoreinputstospendable) | [writeUInt32LE](#function-writeuint32le) |
17266
+ | [importBRC38](#function-importbrc38) | [reviewStatusIdb](#function-reviewstatusidb) | |
17252
17267
 
17253
17268
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
17254
17269
 
@@ -18552,12 +18567,14 @@ When the transaction already exists, the description is updated. The isOutgoing
18552
18567
 
18553
18568
  "basket insertion" Merge Rules:
18554
18569
  1. The "default" basket may not be specified as the insertion basket.
18555
- 2. A change output in the "default" basket may not be target of an insertion into a different basket.
18556
- 3. These baskets do not affect the wallet's balance and are typed "custom".
18570
+ 2. Managed change may not be reclassified as a basket insertion.
18571
+ 3. Basket insertions do not affect wallet balance and are typed "custom".
18557
18572
 
18558
18573
  "wallet payment" Merge Rules:
18559
- 1. Targetting an existing change "default" basket output results in a no-op. No error. No alterations made.
18560
- 2. Targetting a previously "custom" non-change output converts it into a change output. This alters the transaction's `amount`, and the wallet balance.
18574
+ 1. Targeting an existing managed output is idempotent.
18575
+ 2. Targeting a custom output converts it to managed BRC-29 change after
18576
+ the locking script is verified. This is the only supported in-place
18577
+ recovery path for a misclassified BRC-29 payment.
18561
18578
 
18562
18579
  ```ts
18563
18580
  export async function internalizeAction(wallet: Wallet, auth: AuthId, args: InternalizeActionArgs): Promise<StorageInternalizeActionResult>
@@ -18600,12 +18617,14 @@ When the transaction already exists, the description is updated. The isOutgoing
18600
18617
 
18601
18618
  "basket insertion" Merge Rules:
18602
18619
  1. The "default" basket may not be specified as the insertion basket.
18603
- 2. A change output in the "default" basket may not be target of an insertion into a different basket.
18604
- 3. These baskets do not affect the wallet's balance and are typed "custom".
18620
+ 2. Managed change may not be reclassified as a basket insertion.
18621
+ 3. Basket insertions do not affect wallet balance and are typed "custom".
18605
18622
 
18606
18623
  "wallet payment" Merge Rules:
18607
- 1. Targetting an existing change "default" basket output results in a no-op. No error. No alterations made.
18608
- 2. Targetting a previously "custom" non-change output converts it into a change output. This alters the transaction's `satoshis`, and the wallet balance.
18624
+ 1. Targeting an existing managed output is idempotent.
18625
+ 2. Targeting an existing custom output converts it to managed BRC-29
18626
+ change and increases wallet balance. This includes verified recovery of
18627
+ a legacy custom row that was incorrectly placed in the default basket.
18609
18628
 
18610
18629
  ```ts
18611
18630
  export async function internalizeAction(storage: StorageProvider, auth: AuthId, args: InternalizeActionArgs): Promise<StorageInternalizeActionResult>
@@ -18651,6 +18670,19 @@ export function isArcServiceErrorStatus(status: number | undefined, detail?: str
18651
18670
 
18652
18671
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
18653
18672
 
18673
+ ---
18674
+ ##### Function: isAutoSpendableChangeOutput
18675
+
18676
+ True when managed change is currently eligible for automatic allocation.
18677
+
18678
+ ```ts
18679
+ export function isAutoSpendableChangeOutput(output: TableOutput | undefined): output is TableOutput
18680
+ ```
18681
+
18682
+ See also: [TableOutput](./storage.md#interface-tableoutput)
18683
+
18684
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
18685
+
18654
18686
  ---
18655
18687
  ##### Function: isBaseBlockHeader
18656
18688
 
@@ -18812,6 +18844,22 @@ See also: [AnyBlockHeader](./services.md#type-anyblockheader), [LiveBlockHeader]
18812
18844
 
18813
18845
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
18814
18846
 
18847
+ ---
18848
+ ##### Function: isManagedChangeOutput
18849
+
18850
+ True when an output has all metadata required to use the wallet-managed
18851
+ BRC-29 signing path. `senderIdentityKey` is optional: wallet-created change
18852
+ uses the client's change public key when it is absent, while received
18853
+ BRC-29 payments record the sender's identity key.
18854
+
18855
+ ```ts
18856
+ export function isManagedChangeOutput(output: TableOutput | undefined): output is TableOutput
18857
+ ```
18858
+
18859
+ See also: [TableOutput](./storage.md#interface-tableoutput)
18860
+
18861
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
18862
+
18815
18863
  ---
18816
18864
  ##### Function: isMoreWork
18817
18865
 
@@ -21177,13 +21225,14 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
21177
21225
 
21178
21226
  | | | |
21179
21227
  | --- | --- | --- |
21180
- | [ARGON2ID_DEFAULT_HASH_LENGTH](#variable-argon2id_default_hash_length) | [TESTNET_DEFAULT_SETTINGS](#variable-testnet_default_settings) | [queryOverlay](#variable-queryoverlay) |
21181
- | [ARGON2ID_DEFAULT_ITERATIONS](#variable-argon2id_default_iterations) | [aggregateActionResults](#variable-aggregateactionresults) | [specOpFailedActions](#variable-specopfailedactions) |
21182
- | [ARGON2ID_DEFAULT_MEMORY_KIB](#variable-argon2id_default_memory_kib) | [brc29ProtocolID](#variable-brc29protocolid) | [specOpInvalidChange](#variable-specopinvalidchange) |
21183
- | [ARGON2ID_DEFAULT_PARALLELISM](#variable-argon2id_default_parallelism) | [dirtyHashes](#variable-dirtyhashes) | [specOpNoSendActions](#variable-specopnosendactions) |
21184
- | [DEFAULT_PROFILE_ID](#variable-default_profile_id) | [getLabelToSpecOp](#variable-getlabeltospecop) | [specOpSetWalletChangeParams](#variable-specopsetwalletchangeparams) |
21185
- | [DEFAULT_SETTINGS](#variable-default_settings) | [logger](#variable-logger) | [specOpThrowReviewActions](#variable-specopthrowreviewactions) |
21186
- | [MAX_STORAGE_COMMISSION_SATOSHIS](#variable-max_storage_commission_satoshis) | [maxChangeOutputsPerTransaction](#variable-maxchangeoutputspertransaction) | [specOpWalletBalance](#variable-specopwalletbalance) |
21228
+ | [ARCADE_POST_BEEF_CONCURRENCY](#variable-arcade_post_beef_concurrency) | [TESTNET_DEFAULT_SETTINGS](#variable-testnet_default_settings) | [queryOverlay](#variable-queryoverlay) |
21229
+ | [ARGON2ID_DEFAULT_HASH_LENGTH](#variable-argon2id_default_hash_length) | [aggregateActionResults](#variable-aggregateactionresults) | [specOpFailedActions](#variable-specopfailedactions) |
21230
+ | [ARGON2ID_DEFAULT_ITERATIONS](#variable-argon2id_default_iterations) | [brc29ProtocolID](#variable-brc29protocolid) | [specOpInvalidChange](#variable-specopinvalidchange) |
21231
+ | [ARGON2ID_DEFAULT_MEMORY_KIB](#variable-argon2id_default_memory_kib) | [dirtyHashes](#variable-dirtyhashes) | [specOpNoSendActions](#variable-specopnosendactions) |
21232
+ | [ARGON2ID_DEFAULT_PARALLELISM](#variable-argon2id_default_parallelism) | [getLabelToSpecOp](#variable-getlabeltospecop) | [specOpSetWalletChangeParams](#variable-specopsetwalletchangeparams) |
21233
+ | [DEFAULT_PROFILE_ID](#variable-default_profile_id) | [logger](#variable-logger) | [specOpThrowReviewActions](#variable-specopthrowreviewactions) |
21234
+ | [DEFAULT_SETTINGS](#variable-default_settings) | [managedChangeOutputFields](#variable-managedchangeoutputfields) | [specOpWalletBalance](#variable-specopwalletbalance) |
21235
+ | [MAX_STORAGE_COMMISSION_SATOSHIS](#variable-max_storage_commission_satoshis) | [maxChangeOutputsPerTransaction](#variable-maxchangeoutputspertransaction) | [specOpWalletManagedUtxos](#variable-specopwalletmanagedutxos) |
21187
21236
  | [PBKDF2_NUM_ROUNDS](#variable-pbkdf2_num_rounds) | [maxPossibleSatoshis](#variable-maxpossiblesatoshis) | [transactionColumnsWithoutRawTx](#variable-transactioncolumnswithoutrawtx) |
21188
21237
  | [ProvenTxReqNonTerminalStatus](#variable-proventxreqnonterminalstatus) | [outputColumnsWithoutLockingScript](#variable-outputcolumnswithoutlockingscript) | [transformVerifiableCertificatesWithTrust](#variable-transformverifiablecertificateswithtrust) |
21189
21238
  | [ProvenTxReqTerminalStatus](#variable-proventxreqterminalstatus) | [parseResults](#variable-parseresults) | [validBulkHeaderFiles](#variable-validbulkheaderfiles) |
@@ -21192,6 +21241,15 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
21192
21241
 
21193
21242
  ---
21194
21243
 
21244
+ ##### Variable: ARCADE_POST_BEEF_CONCURRENCY
21245
+
21246
+ ```ts
21247
+ ARCADE_POST_BEEF_CONCURRENCY = 4
21248
+ ```
21249
+
21250
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
21251
+
21252
+ ---
21195
21253
  ##### Variable: ARGON2ID_DEFAULT_HASH_LENGTH
21196
21254
 
21197
21255
  ```ts
@@ -21490,6 +21548,20 @@ logger = (message: string, ...optionalParams: any[]): void => {
21490
21548
 
21491
21549
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
21492
21550
 
21551
+ ---
21552
+ ##### Variable: managedChangeOutputFields
21553
+
21554
+ ```ts
21555
+ managedChangeOutputFields = {
21556
+ type: "P2PKH",
21557
+ change: true,
21558
+ providedBy: "storage",
21559
+ purpose: "change"
21560
+ } as const
21561
+ ```
21562
+
21563
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
21564
+
21493
21565
  ---
21494
21566
  ##### Variable: maxChangeOutputsPerTransaction
21495
21567
 
@@ -21635,6 +21707,15 @@ specOpWalletBalance = "893b7646de0e1c9f741bd6e9169b76a8847ae34adef7bef1e6a285371
21635
21707
 
21636
21708
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
21637
21709
 
21710
+ ---
21711
+ ##### Variable: specOpWalletManagedUtxos
21712
+
21713
+ ```ts
21714
+ specOpWalletManagedUtxos = "284570a6213a74ba861c38b1cf790e1e400d9cf9324454b76ea98860b6031c1a"
21715
+ ```
21716
+
21717
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
21718
+
21638
21719
  ---
21639
21720
  ##### Variable: transactionColumnsWithoutRawTx
21640
21721
 
@@ -0,0 +1,79 @@
1
+ # Managed change, sweeping, and recovery
2
+
3
+ The default basket is the wallet's funding pool. An output being physically
4
+ stored in that basket is not, by itself, proof that the wallet can spend it.
5
+ Automatic funding and wallet balance therefore use the managed-change policy
6
+ below instead of trusting basket membership or the locking script alone.
7
+
8
+ ## Output classes
9
+
10
+ A **managed change output** has all of the following metadata:
11
+
12
+ - `type: 'P2PKH'`
13
+ - `change: true`
14
+ - `providedBy: 'storage'`
15
+ - `purpose: 'change'`
16
+ - non-empty `derivationPrefix` and `derivationSuffix`
17
+
18
+ Here, `type: 'P2PKH'` is an operational signer type, not merely a description
19
+ of the script. It selects the BRC-29 unlocking path. A raw P2PKH output without
20
+ matching derivation metadata is not managed change and must not be selected by
21
+ the wallet automatically.
22
+
23
+ A **custom output** belongs to an application-defined protocol. It is normally
24
+ stored outside the default basket with `type: 'custom'`, `change: false`, and
25
+ `providedBy: 'you'`. Custom outputs are discoverable and may be explicitly
26
+ spent by application logic, but are not wallet balance and are never automatic
27
+ fee inputs.
28
+
29
+ ## Enforcement
30
+
31
+ The same managed-change predicate is applied to:
32
+
33
+ - change-input counting and allocation in Knex/SQLite/MySQL and IndexedDB;
34
+ - the default wallet balance and `balanceAndUtxos()` results; and
35
+ - validation of `noSendChange` inputs.
36
+
37
+ Raw administrative `listOutputs({ basket: 'default' })` remains unfiltered on
38
+ purpose. This makes incompatible legacy rows visible for diagnosis and recovery
39
+ without allowing them into balance or automatic funding.
40
+
41
+ ## `internalizeAction` rules
42
+
43
+ | Request | New output | Existing custom output | Existing managed change |
44
+ | --- | --- | --- | --- |
45
+ | `wallet payment` | Store as managed change in `default` | Promote to managed change after BRC-29 script verification | Idempotent when already in `default` |
46
+ | `basket insertion` to a non-default basket | Store as custom | Move/update as custom; no wallet-balance adjustment | Reject; managed change cannot be reclassified |
47
+ | `basket insertion` to `default` | Reject | Reject | Reject |
48
+
49
+ The wallet signer verifies that `paymentRemittance` derives the transaction
50
+ output's locking script before storage can promote it. This is the supported
51
+ way to repair a genuine BRC-29 payment that was previously classified as
52
+ custom. Merely recognizing a P2PKH locking script is not enough.
53
+
54
+ ## Sweeping and recovery
55
+
56
+ "Sweep" means moving an incompatible custom row out of the default basket with
57
+ a `basket insertion` into a named, non-default recovery basket. This is a
58
+ metadata repair: the output remains custom and wallet balance does not change.
59
+
60
+ There are two valid recovery choices for a legacy custom row in `default`:
61
+
62
+ 1. If it is a genuine payment to this wallet under BRC-29, internalize it as a
63
+ `wallet payment` with the correct derivation prefix, derivation suffix, and
64
+ sender identity key. Successful verification promotes it to managed change
65
+ and adds its value to wallet balance.
66
+ 2. Otherwise, sweep it to a non-default basket. The application can then apply
67
+ its own unlocking and lifecycle rules explicitly.
68
+
69
+ Do not repair rows by directly changing `type`, `change`, or derivation fields.
70
+ That bypasses the BRC-29 ownership check and can make balance appear spendable
71
+ when the wallet does not possess the required key path.
72
+
73
+ ## BRC-29 remittance module
74
+
75
+ `Brc29RemittanceModule` always accepts settlements through the `wallet payment`
76
+ protocol. The deprecated `internalizeProtocol: 'basket insertion'` setting is
77
+ rejected because it supplied no insertion remittance and would classify a
78
+ recipient payment as a custom application output instead of spendable wallet
79
+ balance.
package/docs/services.md CHANGED
@@ -6467,6 +6467,7 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
6467
6467
 
6468
6468
  | |
6469
6469
  | --- |
6470
+ | [ARCADE_POST_BEEF_CONCURRENCY](#variable-arcade_post_beef_concurrency) |
6470
6471
  | [ChaintracksFs](#variable-chaintracksfs) |
6471
6472
  | [dirtyHashes](#variable-dirtyhashes) |
6472
6473
  | [validBulkHeaderFiles](#variable-validbulkheaderfiles) |
@@ -6475,6 +6476,15 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
6475
6476
 
6476
6477
  ---
6477
6478
 
6479
+ ##### Variable: ARCADE_POST_BEEF_CONCURRENCY
6480
+
6481
+ ```ts
6482
+ ARCADE_POST_BEEF_CONCURRENCY = 4
6483
+ ```
6484
+
6485
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
6486
+
6487
+ ---
6478
6488
  ##### Variable: ChaintracksFs
6479
6489
 
6480
6490
  ```ts