@bsv/wallet-toolbox-client 2.4.21 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/out/index.client.cjs +1459 -319
- package/out/index.client.cjs.map +1 -1
- package/out/index.client.d.cts +86 -9
- package/out/index.client.d.cts.map +1 -1
- package/out/index.client.d.mts +86 -9
- package/out/index.client.d.mts.map +1 -1
- package/out/index.client.mjs +1460 -320
- package/out/index.client.mjs.map +1 -1
- package/package.json +2 -2
package/out/index.client.d.mts
CHANGED
|
@@ -2093,6 +2093,7 @@ interface FindProvenTxReqsArgs extends FindSincePagedArgs {
|
|
|
2093
2093
|
}
|
|
2094
2094
|
interface FindProvenTxsArgs extends FindSincePagedArgs {
|
|
2095
2095
|
partial: Partial<TableProvenTx>;
|
|
2096
|
+
txids?: string[];
|
|
2096
2097
|
}
|
|
2097
2098
|
interface FindStaleMerkleRootsArgs {
|
|
2098
2099
|
height: number;
|
|
@@ -2603,7 +2604,8 @@ declare class ScriptTemplateBRC29 implements ScriptTemplate {
|
|
|
2603
2604
|
getKeyID(): string;
|
|
2604
2605
|
getKeyDeriver(privKey: PrivateKey | HexString): KeyDeriverApi;
|
|
2605
2606
|
lock(lockerPrivKey: string, unlockerPubKey: string): LockingScript;
|
|
2606
|
-
unlock(unlockerPrivKey:
|
|
2607
|
+
unlock(unlockerPrivKey: PrivateKey | HexString, lockerPubKey: PublicKey | string, sourceSatoshis?: number, lockingScript?: Script): ScriptTemplateUnlock;
|
|
2608
|
+
unlockWithDerivedPrivateKey(derivedPrivateKey: PrivateKey, sourceSatoshis?: number, lockingScript?: Script): ScriptTemplateUnlock;
|
|
2607
2609
|
/**
|
|
2608
2610
|
* P2PKH unlock estimateLength is a constant
|
|
2609
2611
|
*/
|
|
@@ -3166,8 +3168,9 @@ declare class EntityProvenTx extends EntityBase<TableProvenTx> {
|
|
|
3166
3168
|
/**
|
|
3167
3169
|
* @returns desirialized `MerklePath` object, value is cached.
|
|
3168
3170
|
*/
|
|
3169
|
-
getMerklePath(): MerklePath;
|
|
3171
|
+
getMerklePath(validateRoots?: boolean): MerklePath;
|
|
3170
3172
|
_mp?: MerklePath;
|
|
3173
|
+
_mpUnchecked?: MerklePath;
|
|
3171
3174
|
get provenTxId(): number;
|
|
3172
3175
|
set provenTxId(v: number);
|
|
3173
3176
|
get created_at(): Date;
|
|
@@ -3873,6 +3876,9 @@ declare abstract class StorageReaderWriter extends StorageReader {
|
|
|
3873
3876
|
}
|
|
3874
3877
|
interface StorageReaderWriterOptions extends StorageReaderOptions {}
|
|
3875
3878
|
//#endregion
|
|
3879
|
+
//#region ../src/storage/methods/availableManagedChange.d.ts
|
|
3880
|
+
type ManagedChangeInputCandidate = Pick<TableOutput, 'outputId' | 'transactionId' | 'satoshis' | 'txid' | 'vout'>;
|
|
3881
|
+
//#endregion
|
|
3876
3882
|
//#region ../src/storage/StorageProvider.d.ts
|
|
3877
3883
|
declare abstract class StorageProvider extends StorageReaderWriter implements WalletStorageProvider {
|
|
3878
3884
|
isDirty: boolean;
|
|
@@ -3897,7 +3903,32 @@ declare abstract class StorageProvider extends StorageReaderWriter implements Wa
|
|
|
3897
3903
|
}>;
|
|
3898
3904
|
abstract purgeData(params: PurgeParams, trx?: TrxToken): Promise<PurgeResults>;
|
|
3899
3905
|
abstract allocateChangeInput(userId: number, basketId: number, targetSatoshis: number, exactSatoshis: number | undefined, excludeSending: boolean, transactionId: number): Promise<TableOutput | undefined>;
|
|
3906
|
+
/** Mark a planned set of change inputs spent within the caller's transaction. */
|
|
3907
|
+
markChangeInputsSpent(outputIds: number[], transactionId: number, trx: TrxToken): Promise<number>;
|
|
3908
|
+
/**
|
|
3909
|
+
* Insert outputs that do not need their generated ids returned to the
|
|
3910
|
+
* caller. Engines with a multi-row insert override this common-path helper;
|
|
3911
|
+
* the fallback preserves existing storage implementations unchanged.
|
|
3912
|
+
*/
|
|
3913
|
+
insertOutputs(outputs: TableOutput[], trx?: TrxToken): Promise<void>;
|
|
3914
|
+
/** Return unreserved wallet-managed outputs eligible for automatic funding. */
|
|
3915
|
+
findAvailableManagedChangeInputs(userId: number, basketId: number, excludeSending: boolean, trx?: TrxToken): Promise<TableOutput[]>;
|
|
3916
|
+
/** Read only the fields needed by the in-memory funding planner. */
|
|
3917
|
+
findAvailableManagedChangeInputCandidates(userId: number, basketId: number, excludeSending: boolean, trx?: TrxToken): Promise<ManagedChangeInputCandidate[]>;
|
|
3918
|
+
/** Read the current status of a set of source transactions without loading raw transaction bytes. */
|
|
3919
|
+
findTransactionStatusesByIds(userId: number, transactionIds: number[], trx?: TrxToken): Promise<Map<number, TransactionStatus>>;
|
|
3920
|
+
/**
|
|
3921
|
+
* Lock and return the selected funding rows whose source transaction and
|
|
3922
|
+
* action-batch reservation state still permit allocation.
|
|
3923
|
+
*/
|
|
3924
|
+
findFundingOutputsForUpdate(userId: number, outputIds: number[], statuses: TransactionStatus[], trx: TrxToken): Promise<Record<number, TableOutput>>;
|
|
3900
3925
|
abstract getProvenOrRawTx(txid: string, trx?: TrxToken): Promise<ProvenOrRawTx>;
|
|
3926
|
+
/**
|
|
3927
|
+
* Resolve several transaction proofs in one storage operation when the
|
|
3928
|
+
* backend supports it. The default preserves compatibility for custom
|
|
3929
|
+
* providers; SQL and IndexedDB providers override this hot path.
|
|
3930
|
+
*/
|
|
3931
|
+
getProvenOrRawTxs(txids: string[], trx?: TrxToken): Promise<Map<string, ProvenOrRawTx>>;
|
|
3901
3932
|
abstract getRawTxOfKnownValidTransaction(txid?: string, offset?: number, length?: number, trx?: TrxToken): Promise<number[] | undefined>;
|
|
3902
3933
|
abstract getLabelsForTransactionId(transactionId?: number, trx?: TrxToken): Promise<TableTxLabel[]>;
|
|
3903
3934
|
abstract getTagsForOutputId(outputId: number, trx?: TrxToken): Promise<TableOutputTag[]>;
|
|
@@ -3921,6 +3952,8 @@ declare abstract class StorageProvider extends StorageReaderWriter implements Wa
|
|
|
3921
3952
|
deleteActionBatchBlobRecords(_actionBatchId: number, _trx?: TrxToken): Promise<void>;
|
|
3922
3953
|
getCapabilities(): Promise<StorageCapabilities>;
|
|
3923
3954
|
protected supportsActionBatchPersistence(): boolean;
|
|
3955
|
+
/** Custom providers may require physical expiry cleanup before reservations are queried. */
|
|
3956
|
+
protected requiresActionBatchCleanupBeforeCreateAction(): boolean;
|
|
3924
3957
|
beginActionBatch(auth: AuthId, args: BeginActionBatchArgs): Promise<BeginActionBatchResult>;
|
|
3925
3958
|
extendActionBatch(auth: AuthId, args: ExtendActionBatchArgs): Promise<ExtendActionBatchResult>;
|
|
3926
3959
|
renewActionBatch(auth: AuthId, batchId: string): Promise<RenewActionBatchResult>;
|
|
@@ -3939,7 +3972,7 @@ declare abstract class StorageProvider extends StorageReaderWriter implements Wa
|
|
|
3939
3972
|
findOutputsByOutpointsForUpdate(userId: number, outpoints: Array<{
|
|
3940
3973
|
txid: string;
|
|
3941
3974
|
vout: number;
|
|
3942
|
-
}>, trx: TrxToken): Promise<Record<string, TableOutput>>;
|
|
3975
|
+
}>, trx: TrxToken, _noScript?: boolean): Promise<Record<string, TableOutput>>;
|
|
3943
3976
|
findOrInsertOutputBasketsBulk(userId: number, names: string[], trx?: TrxToken): Promise<Record<string, TableOutputBasket>>;
|
|
3944
3977
|
findOrInsertOutputTagsBulk(userId: number, tags: string[], trx?: TrxToken): Promise<Record<string, TableOutputTag>>;
|
|
3945
3978
|
findOrInsertTxLabelsBulk(userId: number, labels: string[], trx?: TrxToken): Promise<Record<string, TableTxLabel>>;
|
|
@@ -4031,6 +4064,7 @@ declare abstract class StorageProvider extends StorageReaderWriter implements Wa
|
|
|
4031
4064
|
private handleProvenTxBranch;
|
|
4032
4065
|
getValidBeefForTxid(...[txid, mergeToBeef, trustSelf, knownTxids, trx, requiredLevels, chainTracker, skipInvalidProofs]: [txid: string, mergeToBeef?: Beef, trustSelf?: TrustSelf, knownTxids?: string[], trx?: TrxToken, requiredLevels?: number, chainTracker?: ChainTracker, skipInvalidProofs?: boolean]): Promise<Beef | undefined>;
|
|
4033
4066
|
getBeefForTransaction(txid: string, options: StorageGetBeefOptions): Promise<Beef>;
|
|
4067
|
+
getBeefForTransactions(txids: string[], options: StorageGetBeefOptions): Promise<Beef>;
|
|
4034
4068
|
findMonitorEventById(id: number, trx?: TrxToken): Promise<TableMonitorEvent | undefined>;
|
|
4035
4069
|
relinquishCertificate(auth: AuthId, args: RelinquishCertificateArgs): Promise<number>;
|
|
4036
4070
|
relinquishOutput(auth: AuthId, args: RelinquishOutputArgs): Promise<number>;
|
|
@@ -4464,6 +4498,8 @@ interface StorageIdbSchema {
|
|
|
4464
4498
|
value: TableOutput;
|
|
4465
4499
|
indexes: {
|
|
4466
4500
|
userId: number;
|
|
4501
|
+
userId_basketId: [number, number];
|
|
4502
|
+
txid_vout_userId: [string, number, number];
|
|
4467
4503
|
transactionId: number;
|
|
4468
4504
|
basketId: number;
|
|
4469
4505
|
spentBy: string;
|
|
@@ -4571,6 +4607,7 @@ declare class StorageIdb extends StorageProvider implements WalletStorageProvide
|
|
|
4571
4607
|
db?: IDBPDatabase<StorageIdbSchema>;
|
|
4572
4608
|
constructor(options: StorageIdbOptions);
|
|
4573
4609
|
protected supportsActionBatchPersistence(): boolean;
|
|
4610
|
+
protected requiresActionBatchCleanupBeforeCreateAction(): boolean;
|
|
4574
4611
|
/**
|
|
4575
4612
|
* This method must be called at least once before any other method accesses the database,
|
|
4576
4613
|
* and each time the schema may have updated.
|
|
@@ -4638,6 +4675,7 @@ declare class StorageIdb extends StorageProvider implements WalletStorageProvide
|
|
|
4638
4675
|
*/
|
|
4639
4676
|
allocateChangeInput(userId: number, basketId: number, targetSatoshis: number, exactSatoshis: number | undefined, excludeSending: boolean, transactionId: number): Promise<TableOutput | undefined>;
|
|
4640
4677
|
getProvenOrRawTx(txid: string, trx?: TrxToken): Promise<ProvenOrRawTx>;
|
|
4678
|
+
getProvenOrRawTxs(txids: string[], trx?: TrxToken): Promise<Map<string, ProvenOrRawTx>>;
|
|
4641
4679
|
getRawTxOfKnownValidTransaction(txid?: string, offset?: number, length?: number, trx?: TrxToken): Promise<number[] | undefined>;
|
|
4642
4680
|
private getRawTxForSlice;
|
|
4643
4681
|
private getRawTxFull;
|
|
@@ -4646,6 +4684,16 @@ declare class StorageIdb extends StorageProvider implements WalletStorageProvide
|
|
|
4646
4684
|
listActions(auth: AuthId, vargs: Validation.ValidListActionsArgs): Promise<ListActionsResult>;
|
|
4647
4685
|
listOutputs(auth: AuthId, vargs: Validation.ValidListOutputsArgs): Promise<ListOutputsResult>;
|
|
4648
4686
|
countChangeInputs(userId: number, basketId: number, excludeSending: boolean): Promise<number>;
|
|
4687
|
+
findTransactionStatusesByIds(userId: number, transactionIds: number[], trx?: TrxToken): Promise<Map<number, TransactionStatus>>;
|
|
4688
|
+
private findOutputsByOutpointsInternal;
|
|
4689
|
+
findOutputsByOutpoints(userId: number, outpoints: Array<{
|
|
4690
|
+
txid: string;
|
|
4691
|
+
vout: number;
|
|
4692
|
+
}>, trx?: TrxToken): Promise<Record<string, TableOutput>>;
|
|
4693
|
+
findOutputsByOutpointsForUpdate(userId: number, outpoints: Array<{
|
|
4694
|
+
txid: string;
|
|
4695
|
+
vout: number;
|
|
4696
|
+
}>, trx: TrxToken, noScript?: boolean): Promise<Record<string, TableOutput>>;
|
|
4649
4697
|
findCertificatesAuth(auth: AuthId, args: FindCertificatesArgs): Promise<TableCertificateX[]>;
|
|
4650
4698
|
findOutputBasketsAuth(auth: AuthId, args: FindOutputBasketsArgs): Promise<TableOutputBasket[]>;
|
|
4651
4699
|
findOutputsAuth(auth: AuthId, args: FindOutputsArgs): Promise<TableOutput[]>;
|
|
@@ -4738,6 +4786,7 @@ declare class StorageIdb extends StorageProvider implements WalletStorageProvide
|
|
|
4738
4786
|
filterOutputBaskets(args: FindOutputBasketsArgs, filtered: (v: TableOutputBasket) => void): Promise<void>;
|
|
4739
4787
|
findOutputBaskets(args: FindOutputBasketsArgs): Promise<TableOutputBasket[]>;
|
|
4740
4788
|
private openOutputsCursor;
|
|
4789
|
+
private eligibleOutputTransactionIds;
|
|
4741
4790
|
filterOutputs(args: FindOutputsArgs, filtered: (v: TableOutput) => void, tagIds?: number[], isQueryModeAll?: boolean): Promise<void>;
|
|
4742
4791
|
private outputMatchesTags;
|
|
4743
4792
|
findOutputs(args: FindOutputsArgs, tagIds?: number[], isQueryModeAll?: boolean): Promise<TableOutput[]>;
|
|
@@ -8245,9 +8294,9 @@ interface WalletArgs {
|
|
|
8245
8294
|
*/
|
|
8246
8295
|
makeLogger?: MakeWalletLogger;
|
|
8247
8296
|
/**
|
|
8248
|
-
* Internal Wallet Toolbox optimization policy. `auto`
|
|
8249
|
-
* action-batch storage capability; `legacy` always
|
|
8250
|
-
* This does not change the BRC-100 wallet interface.
|
|
8297
|
+
* Internal Wallet Toolbox optimization policy. `auto` (the default)
|
|
8298
|
+
* negotiates the optional action-batch storage capability; `legacy` always
|
|
8299
|
+
* uses per-action storage. This does not change the BRC-100 wallet interface.
|
|
8251
8300
|
*/
|
|
8252
8301
|
actionBatchMode?: ActionBatchMode;
|
|
8253
8302
|
/**
|
|
@@ -8838,7 +8887,7 @@ interface UMPTokenInteractor {
|
|
|
8838
8887
|
*
|
|
8839
8888
|
* @param hash The hash of the presentation key.
|
|
8840
8889
|
* @returns The UMP token if found; otherwise, undefined.
|
|
8841
|
-
* @throws Implementations should throw when
|
|
8890
|
+
* @throws Implementations should throw when no verified token or clean empty response is available.
|
|
8842
8891
|
*/
|
|
8843
8892
|
findByPresentationKeyHash: (hash: number[]) => Promise<UMPToken | undefined>;
|
|
8844
8893
|
/**
|
|
@@ -8847,7 +8896,7 @@ interface UMPTokenInteractor {
|
|
|
8847
8896
|
*
|
|
8848
8897
|
* @param hash The hash of the recovery key.
|
|
8849
8898
|
* @returns The UMP token if found; otherwise, undefined.
|
|
8850
|
-
* @throws Implementations should throw when
|
|
8899
|
+
* @throws Implementations should throw when no verified token or clean empty response is available.
|
|
8851
8900
|
*/
|
|
8852
8901
|
findByRecoveryKeyHash: (hash: number[]) => Promise<UMPToken | undefined>;
|
|
8853
8902
|
/**
|
|
@@ -8875,7 +8924,7 @@ interface UMPTokenLookupDiagnostics {
|
|
|
8875
8924
|
}
|
|
8876
8925
|
type UMPTokenLookupFailureReason = 'lookup-unavailable' | 'lookup-incomplete' | 'token-malformed' | 'token-ambiguous';
|
|
8877
8926
|
/**
|
|
8878
|
-
* Raised when UMP
|
|
8927
|
+
* Raised when a UMP lookup yields neither a verified token nor a clean empty response.
|
|
8879
8928
|
*
|
|
8880
8929
|
* Callers must offer retry/recovery rather than treating this error as a new
|
|
8881
8930
|
* account. Diagnostics contain counts only and never hashes, keys, or tokens.
|
|
@@ -8935,9 +8984,37 @@ declare class OverlayUMPTokenInteractor implements UMPTokenInteractor {
|
|
|
8935
8984
|
*/
|
|
8936
8985
|
findByRecoveryKeyHash(hash: number[]): Promise<UMPToken | undefined>;
|
|
8937
8986
|
private findToken;
|
|
8987
|
+
/**
|
|
8988
|
+
* Picks the newest rendition among distinct verified tokens, when possible.
|
|
8989
|
+
*
|
|
8990
|
+
* The on-chain UMP protocol expresses token updates by consumption: the
|
|
8991
|
+
* transaction creating a new rendition spends the previous rendition's
|
|
8992
|
+
* outpoint (there is no rendition counter field in the current format).
|
|
8993
|
+
* A candidate is therefore superseded when any other candidate's ancestry
|
|
8994
|
+
* (available from its BEEF) spends the candidate's outpoint.
|
|
8995
|
+
*
|
|
8996
|
+
* @returns The single unsuperseded candidate, or undefined when supersession
|
|
8997
|
+
* cannot be established for every stale candidate (e.g. forked tokens).
|
|
8998
|
+
*/
|
|
8999
|
+
private resolveNewestToken;
|
|
9000
|
+
/**
|
|
9001
|
+
* Whether `tx` spends an input whose source output (available in the BEEF)
|
|
9002
|
+
* decodes as a UMP token sharing the candidate's presentation or recovery
|
|
9003
|
+
* hash — on-chain proof that the candidate is an update of a same-identity
|
|
9004
|
+
* predecessor rather than an independently minted token.
|
|
9005
|
+
*/
|
|
9006
|
+
private consumesSameIdentityToken;
|
|
9007
|
+
/**
|
|
9008
|
+
* Accumulates every outpoint spent by `tx` and by the ancestor transactions
|
|
9009
|
+
* embedded in its BEEF, so supersession is detected even when intermediate
|
|
9010
|
+
* renditions are absent from the lookup answer. Iterative so arbitrarily
|
|
9011
|
+
* long update chains cannot exhaust the call stack.
|
|
9012
|
+
*/
|
|
9013
|
+
private collectSpentOutpoints;
|
|
8938
9014
|
private emptyLookupDiagnostics;
|
|
8939
9015
|
private toLookupDiagnostics;
|
|
8940
9016
|
private lookupDiagnosticAttributes;
|
|
9017
|
+
private captureLookupCompleted;
|
|
8941
9018
|
private captureLookupFailure;
|
|
8942
9019
|
/**
|
|
8943
9020
|
* Creates or updates (replaces) a UMP token on-chain. If `oldTokenToConsume` is provided,
|