@bsv/wallet-toolbox 2.3.3 → 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 (82) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/README.md +4 -0
  3. package/docs/client.md +232 -74
  4. package/docs/managed-change-policy.md +79 -0
  5. package/docs/services.md +11 -0
  6. package/docs/storage.md +86 -29
  7. package/docs/wallet.md +207 -62
  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/WalletPermissionsManager.d.ts +19 -0
  13. package/out/src/WalletPermissionsManager.d.ts.map +1 -1
  14. package/out/src/WalletPermissionsManager.js +55 -0
  15. package/out/src/WalletPermissionsManager.js.map +1 -1
  16. package/out/src/monitor/tasks/TaskArcSSE.d.ts.map +1 -1
  17. package/out/src/monitor/tasks/TaskArcSSE.js +39 -15
  18. package/out/src/monitor/tasks/TaskArcSSE.js.map +1 -1
  19. package/out/src/sdk/types.d.ts +9 -0
  20. package/out/src/sdk/types.d.ts.map +1 -1
  21. package/out/src/sdk/types.js +16 -2
  22. package/out/src/sdk/types.js.map +1 -1
  23. package/out/src/services/chaintracker/ChaintracksChainTracker.d.ts +1 -0
  24. package/out/src/services/chaintracker/ChaintracksChainTracker.d.ts.map +1 -1
  25. package/out/src/services/chaintracker/ChaintracksChainTracker.js +9 -6
  26. package/out/src/services/chaintracker/ChaintracksChainTracker.js.map +1 -1
  27. package/out/src/services/chaintracker/chaintracks/ChaintracksServiceClient.d.ts.map +1 -1
  28. package/out/src/services/chaintracker/chaintracks/ChaintracksServiceClient.js +8 -0
  29. package/out/src/services/chaintracker/chaintracks/ChaintracksServiceClient.js.map +1 -1
  30. package/out/src/services/providers/Arcade.d.ts +1 -0
  31. package/out/src/services/providers/Arcade.d.ts.map +1 -1
  32. package/out/src/services/providers/Arcade.js +40 -13
  33. package/out/src/services/providers/Arcade.js.map +1 -1
  34. package/out/src/signer/methods/buildSignableTransaction.d.ts +54 -0
  35. package/out/src/signer/methods/buildSignableTransaction.d.ts.map +1 -1
  36. package/out/src/signer/methods/buildSignableTransaction.js +118 -2
  37. package/out/src/signer/methods/buildSignableTransaction.js.map +1 -1
  38. package/out/src/signer/methods/internalizeAction.d.ts +6 -4
  39. package/out/src/signer/methods/internalizeAction.d.ts.map +1 -1
  40. package/out/src/signer/methods/internalizeAction.js +12 -7
  41. package/out/src/signer/methods/internalizeAction.js.map +1 -1
  42. package/out/src/storage/StorageIdb.d.ts +2 -1
  43. package/out/src/storage/StorageIdb.d.ts.map +1 -1
  44. package/out/src/storage/StorageIdb.js +12 -5
  45. package/out/src/storage/StorageIdb.js.map +1 -1
  46. package/out/src/storage/StorageKnex.d.ts +2 -1
  47. package/out/src/storage/StorageKnex.d.ts.map +1 -1
  48. package/out/src/storage/StorageKnex.js +27 -2
  49. package/out/src/storage/StorageKnex.js.map +1 -1
  50. package/out/src/storage/index.all.d.ts +1 -0
  51. package/out/src/storage/index.all.d.ts.map +1 -1
  52. package/out/src/storage/index.all.js +1 -0
  53. package/out/src/storage/index.all.js.map +1 -1
  54. package/out/src/storage/index.client.d.ts +1 -0
  55. package/out/src/storage/index.client.d.ts.map +1 -1
  56. package/out/src/storage/index.client.js +1 -0
  57. package/out/src/storage/index.client.js.map +1 -1
  58. package/out/src/storage/methods/ListOutputsSpecOp.d.ts +2 -0
  59. package/out/src/storage/methods/ListOutputsSpecOp.d.ts.map +1 -1
  60. package/out/src/storage/methods/ListOutputsSpecOp.js +13 -1
  61. package/out/src/storage/methods/ListOutputsSpecOp.js.map +1 -1
  62. package/out/src/storage/methods/createAction.d.ts.map +1 -1
  63. package/out/src/storage/methods/createAction.js +6 -6
  64. package/out/src/storage/methods/createAction.js.map +1 -1
  65. package/out/src/storage/methods/internalizeAction.d.ts +6 -4
  66. package/out/src/storage/methods/internalizeAction.d.ts.map +1 -1
  67. package/out/src/storage/methods/internalizeAction.js +23 -12
  68. package/out/src/storage/methods/internalizeAction.js.map +1 -1
  69. package/out/src/storage/methods/listOutputsIdb.d.ts.map +1 -1
  70. package/out/src/storage/methods/listOutputsIdb.js +21 -3
  71. package/out/src/storage/methods/listOutputsIdb.js.map +1 -1
  72. package/out/src/storage/methods/listOutputsKnex.d.ts.map +1 -1
  73. package/out/src/storage/methods/listOutputsKnex.js +14 -0
  74. package/out/src/storage/methods/listOutputsKnex.js.map +1 -1
  75. package/out/src/storage/methods/managedChange.d.ts +26 -0
  76. package/out/src/storage/methods/managedChange.d.ts.map +1 -0
  77. package/out/src/storage/methods/managedChange.js +43 -0
  78. package/out/src/storage/methods/managedChange.js.map +1 -0
  79. package/out/src/storage/methods/processAction.d.ts.map +1 -1
  80. package/out/src/storage/methods/processAction.js +38 -1
  81. package/out/src/storage/methods/processAction.js.map +1 -1
  82. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -6,6 +6,17 @@ 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
+
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.
19
+
9
20
  - Release prep for `2.3.3`: add Arcade-first wallet service wiring, go-chaintracks
10
21
  live client/SSE support, resilient ARC/Arcade status handling, monitor
11
22
  rebroadcast safeguards, and callback-token redaction for Arcade SSE logs.
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
@@ -1341,6 +1341,7 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
1341
1341
  ```ts
1342
1342
  export interface ChaintracksChainTrackerOptions {
1343
1343
  maxRetries?: number;
1344
+ retryDelayMs?: number;
1344
1345
  }
1345
1346
  ```
1346
1347
 
@@ -3846,6 +3847,7 @@ export interface ListOutputsSpecOp {
3846
3847
  includeOutputScripts?: boolean;
3847
3848
  includeSpent?: boolean;
3848
3849
  totalOutputsIsSumOfSatoshis?: boolean;
3850
+ managedChangeOnly?: boolean;
3849
3851
  resultFromTags?: (s: StorageProvider, auth: AuthId, vargs: Validation.ValidListOutputsArgs, specOpTags: string[]) => Promise<ListOutputsResult>;
3850
3852
  resultFromOutputs?: (s: StorageProvider, auth: AuthId, vargs: Validation.ValidListOutputsArgs, specOpTags: string[], outputs: TableOutput[]) => Promise<ListOutputsResult>;
3851
3853
  filterOutputs?: (s: StorageProvider, auth: AuthId, vargs: Validation.ValidListOutputsArgs, specOpTags: string[], outputs: TableOutput[]) => Promise<TableOutput[]>;
@@ -3856,6 +3858,14 @@ export interface ListOutputsSpecOp {
3856
3858
 
3857
3859
  See also: [AuthId](./client.md#interface-authid), [StorageProvider](./storage.md#class-storageprovider), [TableOutput](./storage.md#interface-tableoutput)
3858
3860
 
3861
+ ###### Property managedChangeOnly
3862
+
3863
+ Restrict the operation to wallet-managed, BRC-29-signable change.
3864
+
3865
+ ```ts
3866
+ managedChangeOnly?: boolean
3867
+ ```
3868
+
3859
3869
  ###### Property tagsParamsCount
3860
3870
 
3861
3871
  How many positional tags to intercept.
@@ -14020,7 +14030,8 @@ Proceeds in three stages:
14020
14030
  3. Find an output that comes as close to funding as possible (targetSatoshis).
14021
14031
  4. Return undefined if no output is found.
14022
14032
 
14023
- 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.
14024
14035
  Their corresponding transaction must have status of 'completed', 'unproven', or 'sending' (if excludeSending is false).
14025
14036
 
14026
14037
  ```ts
@@ -15800,6 +15811,10 @@ sum of output satoshis
15800
15811
  Uses `listOutputs` to iterate over chunks of up to 1000 outputs to
15801
15812
  compute the sum of output satoshis.
15802
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
+
15803
15818
  ```ts
15804
15819
  async balanceAndUtxos(basket: string = "default"): Promise<WalletBalance>
15805
15820
  ```
@@ -17175,15 +17190,15 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
17175
17190
 
17176
17191
  | | | |
17177
17192
  | --- | --- | --- |
17178
- | [WalletErrorFromJson](#function-walleterrorfromjson) | [importBRC38](#function-importbrc38) | [selectBulkHeaderFiles](#function-selectbulkheaderfiles) |
17179
- | [WocHeadersBulkListener](#function-wocheadersbulklistener) | [importBRC39](#function-importbrc39) | [serializeBaseBlockHeader](#function-serializebaseblockheader) |
17180
- | [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) |
17181
17196
  | [WocHeadersLiveListener](#function-wocheaderslivelistener) | [internalizeAction](#function-internalizeaction) | [setDisableDoubleSpendCheckForTest](#function-setdisabledoublespendcheckfortest) |
17182
- | [WocHeadersLiveListener_test](#function-wocheaderslivelistener_test) | [internalizeAction](#function-internalizeaction) | [sha256Hash](#function-sha256hash) |
17183
- | [acquireDirectCertificate](#function-acquiredirectcertificate) | [isArcAcceptedTxStatus](#function-isarcacceptedtxstatus) | [sha256HashOfBinaryFile](#function-sha256hashofbinaryfile) |
17184
- | [addWork](#function-addwork) | [isArcDoubleSpendTxStatus](#function-isarcdoublespendtxstatus) | [shareReqsWithWorld](#function-sharereqswithworld) |
17185
- | [arcDefaultUrl](#function-arcdefaulturl) | [isArcInvalidTxStatus](#function-isarcinvalidtxstatus) | [signAction](#function-signaction) |
17186
- | [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) |
17187
17202
  | [arcadeDefaultUrl](#function-arcadedefaulturl) | [isBaseBlockHeader](#function-isbaseblockheader) | [stampLog](#function-stamplog) |
17188
17203
  | [arraysEqual](#function-arraysequal) | [isBlockHeader](#function-isblockheader) | [stampLogFormat](#function-stamplogformat) |
17189
17204
  | [asArray](#function-asarray) | [isCreateActionSpecOp](#function-iscreateactionspecop) | [subWork](#function-subwork) |
@@ -17192,62 +17207,63 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
17192
17207
  | [asBsvSdkScript](#function-asbsvsdkscript) | [isListOutputsSpecOp](#function-islistoutputsspecop) | [toBinaryBaseBlockHeader](#function-tobinarybaseblockheader) |
17193
17208
  | [asBsvSdkTx](#function-asbsvsdktx) | [isLive](#function-islive) | [toLookupNetworkPreset](#function-tolookupnetworkpreset) |
17194
17209
  | [asString](#function-asstring) | [isLiveBlockHeader](#function-isliveblockheader) | [toWalletNetwork](#function-towalletnetwork) |
17195
- | [asUint8Array](#function-asuint8array) | [isMoreWork](#function-ismorework) | [transactionInputSize](#function-transactioninputsize) |
17196
- | [attemptToPostReqsToNetwork](#function-attempttopostreqstonetwork) | [keyOffsetToHashedSecret](#function-keyoffsettohashedsecret) | [transactionOutputSize](#function-transactionoutputsize) |
17197
- | [blockHash](#function-blockhash) | [listActionsIdb](#function-listactionsidb) | [transactionSize](#function-transactionsize) |
17198
- | [buildBeefForOutpoints](#function-buildbeefforoutpoints) | [listCertificates](#function-listcertificates) | [updateChaintracksFiatExchangeRates](#function-updatechaintracksfiatexchangerates) |
17199
- | [buildChaintracksOptionsWithIngestors](#function-buildchaintracksoptionswithingestors) | [listOutputsIdb](#function-listoutputsidb) | [updateExchangeratesapi](#function-updateexchangeratesapi) |
17200
- | [buildSignableTransaction](#function-buildsignabletransaction) | [lockScriptWithKeyOffsetFromPubKey](#function-lockscriptwithkeyoffsetfrompubkey) | [updateReqsFromAggregateResults](#function-updatereqsfromaggregateresults) |
17201
- | [classifyMerklePathResponse](#function-classifymerklepathresponse) | [logCreateActionArgs](#function-logcreateactionargs) | [upgradeAllStoresV1](#function-upgradeallstoresv1) |
17202
- | [classifyReqStatus](#function-classifyreqstatus) | [logWalletError](#function-logwalleterror) | [upgradeCertificateFields](#function-upgradecertificatefields) |
17203
- | [completeSignedTransaction](#function-completesignedtransaction) | [makeAtomicBeef](#function-makeatomicbeef) | [upgradeCertificates](#function-upgradecertificates) |
17204
- | [computeMerklePath](#function-computemerklepath) | [makeBrc114ActionTimeLabel](#function-makebrc114actiontimelabel) | [upgradeCommissions](#function-upgradecommissions) |
17205
- | [computeMerkleRoot](#function-computemerkleroot) | [makeChangeLock](#function-makechangelock) | [upgradeMonitorEvents](#function-upgrademonitorevents) |
17206
- | [convertBitsToTarget](#function-convertbitstotarget) | [makeMerklePathNote](#function-makemerklepathnote) | [upgradeOutputBaskets](#function-upgradeoutputbaskets) |
17207
- | [convertBitsToWork](#function-convertbitstowork) | [markStaleInputsAsSpent](#function-markstaleinputsasspent) | [upgradeOutputTags](#function-upgradeoutputtags) |
17208
- | [convertBufferToUint32](#function-convertbuffertouint32) | [markUserInputsSpent](#function-markuserinputsspent) | [upgradeOutputTagsMap](#function-upgradeoutputtagsmap) |
17209
- | [convertProofToMerklePath](#function-convertprooftomerklepath) | [matchesCertificateFieldPartial](#function-matchescertificatefieldpartial) | [upgradeOutputs](#function-upgradeoutputs) |
17210
- | [convertUint32ToBuffer](#function-convertuint32tobuffer) | [matchesCertificatePartial](#function-matchescertificatepartial) | [upgradeProvenTxReqs](#function-upgradeproventxreqs) |
17211
- | [convertWocToBlockHeaderHex](#function-convertwoctoblockheaderhex) | [matchesCommissionPartial](#function-matchescommissionpartial) | [upgradeProvenTxs](#function-upgradeproventxs) |
17212
- | [createAction](#function-createaction) | [matchesMonitorEventPartial](#function-matchesmonitoreventpartial) | [upgradeSyncStates](#function-upgradesyncstates) |
17213
- | [createAction](#function-createaction) | [matchesOutputBasketPartial](#function-matchesoutputbasketpartial) | [upgradeTransactions](#function-upgradetransactions) |
17214
- | [createCoinbaseTransaction](#function-createcoinbasetransaction) | [matchesOutputPartial](#function-matchesoutputpartial) | [upgradeTxLabels](#function-upgradetxlabels) |
17215
- | [createDefaultIdbChaintracksOptions](#function-createdefaultidbchaintracksoptions) | [matchesOutputTagMapPartial](#function-matchesoutputtagmappartial) | [upgradeTxLabelsMap](#function-upgradetxlabelsmap) |
17216
- | [createDefaultNoDbChaintracksOptions](#function-createdefaultnodbchaintracksoptions) | [matchesOutputTagPartial](#function-matchesoutputtagpartial) | [upgradeUsers](#function-upgradeusers) |
17217
- | [createDefaultWalletServicesOptions](#function-createdefaultwalletservicesoptions) | [matchesProvenTxPartial](#function-matchesproventxpartial) | [validBulkHeaderFilesByFileHash](#function-validbulkheaderfilesbyfilehash) |
17218
- | [createIdbChaintracks](#function-createidbchaintracks) | [matchesProvenTxReqPartial](#function-matchesproventxreqpartial) | [validateAgainstDirtyHashes](#function-validateagainstdirtyhashes) |
17219
- | [createNoDbChaintracks](#function-createnodbchaintracks) | [matchesSyncStatePartial](#function-matchessyncstatepartial) | [validateBufferOfHeaders](#function-validatebufferofheaders) |
17220
- | [createStorageServiceChargeScript](#function-createstorageservicechargescript) | [matchesTransactionPartial](#function-matchestransactionpartial) | [validateBulkFileData](#function-validatebulkfiledata) |
17221
- | [createSyncMap](#function-createsyncmap) | [matchesTxLabelMapPartial](#function-matchestxlabelmappartial) | [validateDate](#function-validatedate) |
17222
- | [dateMatches](#function-datematches) | [matchesTxLabelPartial](#function-matchestxlabelpartial) | [validateEntities](#function-validateentities) |
17223
- | [decryptBRC39](#function-decryptbrc39) | [maxDate](#function-maxdate) | [validateEntity](#function-validateentity) |
17224
- | [deserializeBaseBlockHeader](#function-deserializebaseblockheader) | [mergeInputBeefs](#function-mergeinputbeefs) | [validateGenerateChangeSdkParams](#function-validategeneratechangesdkparams) |
17225
- | [deserializeBaseBlockHeaders](#function-deserializebaseblockheaders) | [mergeInputsIntoBeef](#function-mergeinputsintobeef) | [validateGenerateChangeSdkResult](#function-validategeneratechangesdkresult) |
17226
- | [deserializeBlockHeader](#function-deserializeblockheader) | [notifyTransactionsOfProof](#function-notifytransactionsofproof) | [validateGenesisHeader](#function-validategenesisheader) |
17227
- | [deserializeBlockHeaders](#function-deserializeblockheaders) | [offsetPrivKey](#function-offsetprivkey) | [validateHeaderDifficulty](#function-validateheaderdifficulty) |
17228
- | [doubleSha256BE](#function-doublesha256be) | [offsetPubKey](#function-offsetpubkey) | [validateHeaderFormat](#function-validateheaderformat) |
17229
- | [doubleSha256LE](#function-doublesha256le) | [optionalArraysEqual](#function-optionalarraysequal) | [validateScriptHash](#function-validatescripthash) |
17230
- | [encryptBRC39](#function-encryptbrc39) | [parseBRC38Json](#function-parsebrc38json) | [validateSecondsSinceEpoch](#function-validatesecondssinceepoch) |
17231
- | [exportBRC38](#function-exportbrc38) | [parseBrc114ActionTimeLabels](#function-parsebrc114actiontimelabels) | [validateStorageFeeModel](#function-validatestoragefeemodel) |
17232
- | [exportBRC38Json](#function-exportbrc38json) | [parseOutpoint](#function-parseoutpoint) | [validateSyncChunkEntities](#function-validatesyncchunkentities) |
17233
- | [exportBRC39](#function-exportbrc39) | [parseResults$](#function-parseresults$) | [varUintSize](#function-varuintsize) |
17234
- | [fundWalletFromP2PKHOutpoints](#function-fundwalletfromp2pkhoutpoints) | [parseTxAndAssertId](#function-parsetxandassertid) | [verifyHexString](#function-verifyhexstring) |
17235
- | [generateChangeSdk](#function-generatechangesdk) | [parseTxScriptOffsets](#function-parsetxscriptoffsets) | [verifyId](#function-verifyid) |
17236
- | [generateChangeSdkMakeStorage](#function-generatechangesdkmakestorage) | [partitionActionLabels](#function-partitionactionlabels) | [verifyInteger](#function-verifyinteger) |
17237
- | [genesisBuffer](#function-genesisbuffer) | [populateUtxoDetails](#function-populateutxodetails) | [verifyNumber](#function-verifynumber) |
17238
- | [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) |
17239
17254
  | [getBeefForTransaction](#function-getbeeffortransaction) | [processAction](#function-processaction) | [verifyOneOrNone](#function-verifyoneornone) |
17240
- | [getBeefForTxid](#function-getbeeffortxid) | [proveCertificate](#function-provecertificate) | [verifyOptionalHexString](#function-verifyoptionalhexstring) |
17241
- | [getExchangeRatesIo](#function-getexchangeratesio) | [purgeDataIdb](#function-purgedataidb) | [verifyP2PKHOwnership](#function-verifyp2pkhownership) |
17242
- | [getIdentityKey](#function-getidentitykey) | [randomBytes](#function-randombytes) | [verifyTruthy](#function-verifytruthy) |
17243
- | [getListOutputsSpecOp](#function-getlistoutputsspecop) | [randomBytesBase64](#function-randombytesbase64) | [verifyUnlockScripts](#function-verifyunlockscripts) |
17244
- | [getProofs](#function-getproofs) | [randomBytesHex](#function-randombyteshex) | [wait](#function-wait) |
17245
- | [getSyncChunk](#function-getsyncchunk) | [readUInt32BE](#function-readuint32be) | [wocGetHeadersHeaderToBlockHeader](#function-wocgetheadersheadertoblockheader) |
17246
- | [getWhatsOnChainBlockHeaderByHash](#function-getwhatsonchainblockheaderbyhash) | [readUInt32LE](#function-readuint32le) | [workBNtoBuffer](#function-workbntobuffer) |
17247
- | [handlePostRawTxErrorResponse](#function-handlepostrawtxerrorresponse) | [redeemServiceCharges](#function-redeemservicecharges) | [writeUInt32BE](#function-writeuint32be) |
17248
- | [handleScriptHashHistoryCatch](#function-handlescripthashhistorycatch) | [resolveAutoSigned](#function-resolveautosigned) | [writeUInt32LE](#function-writeuint32le) |
17249
- | [handleScriptHashHistoryResponse](#function-handlescripthashhistoryresponse) | [restoreInputsToSpendable](#function-restoreinputstospendable) | |
17250
- | [handleUtxoConnReset](#function-handleutxoconnreset) | [reviewStatusIdb](#function-reviewstatusidb) | |
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) | |
17251
17267
 
17252
17268
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
17253
17269
 
@@ -18551,12 +18567,14 @@ When the transaction already exists, the description is updated. The isOutgoing
18551
18567
 
18552
18568
  "basket insertion" Merge Rules:
18553
18569
  1. The "default" basket may not be specified as the insertion basket.
18554
- 2. A change output in the "default" basket may not be target of an insertion into a different basket.
18555
- 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".
18556
18572
 
18557
18573
  "wallet payment" Merge Rules:
18558
- 1. Targetting an existing change "default" basket output results in a no-op. No error. No alterations made.
18559
- 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.
18560
18578
 
18561
18579
  ```ts
18562
18580
  export async function internalizeAction(wallet: Wallet, auth: AuthId, args: InternalizeActionArgs): Promise<StorageInternalizeActionResult>
@@ -18599,12 +18617,14 @@ When the transaction already exists, the description is updated. The isOutgoing
18599
18617
 
18600
18618
  "basket insertion" Merge Rules:
18601
18619
  1. The "default" basket may not be specified as the insertion basket.
18602
- 2. A change output in the "default" basket may not be target of an insertion into a different basket.
18603
- 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".
18604
18622
 
18605
18623
  "wallet payment" Merge Rules:
18606
- 1. Targetting an existing change "default" basket output results in a no-op. No error. No alterations made.
18607
- 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.
18608
18628
 
18609
18629
  ```ts
18610
18630
  export async function internalizeAction(storage: StorageProvider, auth: AuthId, args: InternalizeActionArgs): Promise<StorageInternalizeActionResult>
@@ -18650,6 +18670,19 @@ export function isArcServiceErrorStatus(status: number | undefined, detail?: str
18650
18670
 
18651
18671
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
18652
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
+
18653
18686
  ---
18654
18687
  ##### Function: isBaseBlockHeader
18655
18688
 
@@ -18811,6 +18844,22 @@ See also: [AnyBlockHeader](./services.md#type-anyblockheader), [LiveBlockHeader]
18811
18844
 
18812
18845
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
18813
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
+
18814
18863
  ---
18815
18864
  ##### Function: isMoreWork
18816
18865
 
@@ -20500,6 +20549,37 @@ export function verifyP2PKHOwnership(lockingScript: LockingScript, publicKey: Pu
20500
20549
 
20501
20550
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
20502
20551
 
20552
+ ---
20553
+ ##### Function: verifyRequestedOutputsUnchanged
20554
+
20555
+ Verify that the outputs returned by storage for caller-specified outputs match
20556
+ exactly what the caller requested in `args.outputs`.
20557
+
20558
+ The storage response (`StorageCreateActionResult.outputs`) is ordered, by
20559
+ contract, as: the caller's `args.outputs` in their original order, followed by
20560
+ the optional commission output, followed by storage-provided change outputs.
20561
+ Only the `vout` field is randomized when `randomizeOutputs` is set; the array
20562
+ order is stable. Therefore array index `i` (for `i < args.outputs.length`)
20563
+ corresponds to `args.outputs[i]`.
20564
+
20565
+ Because the locking script that is ultimately signed is taken from the storage
20566
+ response, an untrusted storage provider must not be allowed to alter the
20567
+ recipient script (or amount) of a caller-specified output. Any mismatch is a
20568
+ hard error. (GHSA-36f9-7rg5-cpf8)
20569
+
20570
+ ```ts
20571
+ export function verifyRequestedOutputsUnchanged(storageOutputs: StorageCreateTransactionSdkOutput[], args: Validation.ValidCreateActionArgs): void
20572
+ ```
20573
+
20574
+ See also: [StorageCreateTransactionSdkOutput](./client.md#interface-storagecreatetransactionsdkoutput)
20575
+
20576
+ Throws
20577
+
20578
+ WERR_INVALID_PARAMETER if storage omitted, reclassified, or modified
20579
+ any caller-specified output.
20580
+
20581
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
20582
+
20503
20583
  ---
20504
20584
  ##### Function: verifyTruthy
20505
20585
 
@@ -20533,6 +20613,42 @@ WERR_INVALID_PARAMETER if any unlocking script is invalid, if sourceTXID is inva
20533
20613
 
20534
20614
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
20535
20615
 
20616
+ ---
20617
+ ##### Function: verifyUnrequestedOutputsAreChangeOrCommission
20618
+
20619
+ Verify that every storage output beyond the caller's requested outputs is
20620
+ either a change output or the (single, bounded) commission output.
20621
+
20622
+ The storage response is ordered `[caller outputs][commission?][change...]`;
20623
+ `verifyRequestedOutputsUnchanged` already validates the caller region (indices
20624
+ `< args.outputs.length`). This checks the remainder.
20625
+
20626
+ Change outputs (`providedBy: 'storage', purpose: 'change'`) are safe at any
20627
+ amount: `buildSignableTransaction` ignores the storage-supplied script and
20628
+ re-derives it client-side (`makeChangeLock` / BRC-29 under the client's own
20629
+ change key), so a change output can only ever pay the client. A change output
20630
+ mislabeled by storage is therefore harmless.
20631
+
20632
+ The commission output's script, by contrast, is taken verbatim from storage
20633
+ and cannot be verified client-side. A malicious storage could inject an extra
20634
+ output — or relabel one as commission — to redirect funds to an attacker while
20635
+ the caller/UI only sees the requested recipients. To bound that, at most one
20636
+ commission output is allowed and its amount must not exceed `maxCommission`.
20637
+ Any other unrecognized output is rejected outright.
20638
+
20639
+ ```ts
20640
+ export function verifyUnrequestedOutputsAreChangeOrCommission(storageOutputs: StorageCreateTransactionSdkOutput[], args: Validation.ValidCreateActionArgs, maxCommission: number = MAX_STORAGE_COMMISSION_SATOSHIS): void
20641
+ ```
20642
+
20643
+ See also: [MAX_STORAGE_COMMISSION_SATOSHIS](./client.md#variable-max_storage_commission_satoshis), [StorageCreateTransactionSdkOutput](./client.md#interface-storagecreatetransactionsdkoutput)
20644
+
20645
+ Throws
20646
+
20647
+ WERR_INVALID_PARAMETER if storage returned an unrecognized output, more
20648
+ than one commission output, or a commission exceeding `maxCommission`.
20649
+
20650
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
20651
+
20536
20652
  ---
20537
20653
  ##### Function: wait
20538
20654
 
@@ -21109,21 +21225,31 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
21109
21225
 
21110
21226
  | | | |
21111
21227
  | --- | --- | --- |
21228
+ | [ARCADE_POST_BEEF_CONCURRENCY](#variable-arcade_post_beef_concurrency) | [TESTNET_DEFAULT_SETTINGS](#variable-testnet_default_settings) | [queryOverlay](#variable-queryoverlay) |
21112
21229
  | [ARGON2ID_DEFAULT_HASH_LENGTH](#variable-argon2id_default_hash_length) | [aggregateActionResults](#variable-aggregateactionresults) | [specOpFailedActions](#variable-specopfailedactions) |
21113
21230
  | [ARGON2ID_DEFAULT_ITERATIONS](#variable-argon2id_default_iterations) | [brc29ProtocolID](#variable-brc29protocolid) | [specOpInvalidChange](#variable-specopinvalidchange) |
21114
21231
  | [ARGON2ID_DEFAULT_MEMORY_KIB](#variable-argon2id_default_memory_kib) | [dirtyHashes](#variable-dirtyhashes) | [specOpNoSendActions](#variable-specopnosendactions) |
21115
21232
  | [ARGON2ID_DEFAULT_PARALLELISM](#variable-argon2id_default_parallelism) | [getLabelToSpecOp](#variable-getlabeltospecop) | [specOpSetWalletChangeParams](#variable-specopsetwalletchangeparams) |
21116
21233
  | [DEFAULT_PROFILE_ID](#variable-default_profile_id) | [logger](#variable-logger) | [specOpThrowReviewActions](#variable-specopthrowreviewactions) |
21117
- | [DEFAULT_SETTINGS](#variable-default_settings) | [maxChangeOutputsPerTransaction](#variable-maxchangeoutputspertransaction) | [specOpWalletBalance](#variable-specopwalletbalance) |
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) |
21118
21236
  | [PBKDF2_NUM_ROUNDS](#variable-pbkdf2_num_rounds) | [maxPossibleSatoshis](#variable-maxpossiblesatoshis) | [transactionColumnsWithoutRawTx](#variable-transactioncolumnswithoutrawtx) |
21119
21237
  | [ProvenTxReqNonTerminalStatus](#variable-proventxreqnonterminalstatus) | [outputColumnsWithoutLockingScript](#variable-outputcolumnswithoutlockingscript) | [transformVerifiableCertificatesWithTrust](#variable-transformverifiablecertificateswithtrust) |
21120
21238
  | [ProvenTxReqTerminalStatus](#variable-proventxreqterminalstatus) | [parseResults](#variable-parseresults) | [validBulkHeaderFiles](#variable-validbulkheaderfiles) |
21121
- | [TESTNET_DEFAULT_SETTINGS](#variable-testnet_default_settings) | [queryOverlay](#variable-queryoverlay) | |
21122
21239
 
21123
21240
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
21124
21241
 
21125
21242
  ---
21126
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
+ ---
21127
21253
  ##### Variable: ARGON2ID_DEFAULT_HASH_LENGTH
21128
21254
 
21129
21255
  ```ts
@@ -21201,6 +21327,15 @@ See also: [WalletSettings](./client.md#interface-walletsettings)
21201
21327
 
21202
21328
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
21203
21329
 
21330
+ ---
21331
+ ##### Variable: MAX_STORAGE_COMMISSION_SATOSHIS
21332
+
21333
+ ```ts
21334
+ MAX_STORAGE_COMMISSION_SATOSHIS = 500000
21335
+ ```
21336
+
21337
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
21338
+
21204
21339
  ---
21205
21340
  ##### Variable: PBKDF2_NUM_ROUNDS
21206
21341
 
@@ -21413,6 +21548,20 @@ logger = (message: string, ...optionalParams: any[]): void => {
21413
21548
 
21414
21549
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
21415
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
+
21416
21565
  ---
21417
21566
  ##### Variable: maxChangeOutputsPerTransaction
21418
21567
 
@@ -21558,6 +21707,15 @@ specOpWalletBalance = "893b7646de0e1c9f741bd6e9169b76a8847ae34adef7bef1e6a285371
21558
21707
 
21559
21708
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
21560
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
+
21561
21719
  ---
21562
21720
  ##### Variable: transactionColumnsWithoutRawTx
21563
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
@@ -999,6 +999,7 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
999
999
  ```ts
1000
1000
  export interface ChaintracksChainTrackerOptions {
1001
1001
  maxRetries?: number;
1002
+ retryDelayMs?: number;
1002
1003
  }
1003
1004
  ```
1004
1005
 
@@ -6466,6 +6467,7 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
6466
6467
 
6467
6468
  | |
6468
6469
  | --- |
6470
+ | [ARCADE_POST_BEEF_CONCURRENCY](#variable-arcade_post_beef_concurrency) |
6469
6471
  | [ChaintracksFs](#variable-chaintracksfs) |
6470
6472
  | [dirtyHashes](#variable-dirtyhashes) |
6471
6473
  | [validBulkHeaderFiles](#variable-validbulkheaderfiles) |
@@ -6474,6 +6476,15 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
6474
6476
 
6475
6477
  ---
6476
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
+ ---
6477
6488
  ##### Variable: ChaintracksFs
6478
6489
 
6479
6490
  ```ts