@bsv/wallet-toolbox-client 2.4.22 → 2.6.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.
@@ -93,7 +93,7 @@ interface OutPoint {
93
93
  */
94
94
  vout: number;
95
95
  }
96
- type Chain = 'main' | 'test' | 'ttn' | 'tstn' | 'mock';
96
+ type Chain = 'main' | 'test' | 'stn' | 'ttn' | 'tstn' | 'mock';
97
97
  /**
98
98
  * Initial status (attempts === 0):
99
99
  *
@@ -814,6 +814,17 @@ interface ChaintracksInfoApi {
814
814
  bulkIngestors: string[];
815
815
  liveIngestors: string[];
816
816
  packages: ChaintracksPackageInfoApi[];
817
+ /** Last observed source state. Additive and omitted by older services. */
818
+ sources?: ChaintracksSourceStatusApi[];
819
+ }
820
+ /** @public */
821
+ interface ChaintracksSourceStatusApi {
822
+ name: string;
823
+ role: 'bulk' | 'live';
824
+ state: 'unknown' | 'healthy' | 'degraded';
825
+ lastSuccess?: string;
826
+ lastFailure?: string;
827
+ error?: string;
817
828
  }
818
829
  /**
819
830
  * Chaintracks client API excluding events and callbacks
@@ -2094,6 +2105,7 @@ interface FindProvenTxReqsArgs extends FindSincePagedArgs {
2094
2105
  }
2095
2106
  interface FindProvenTxsArgs extends FindSincePagedArgs {
2096
2107
  partial: Partial<TableProvenTx>;
2108
+ txids?: string[];
2097
2109
  }
2098
2110
  interface FindStaleMerkleRootsArgs {
2099
2111
  height: number;
@@ -2604,7 +2616,8 @@ declare class ScriptTemplateBRC29 implements ScriptTemplate {
2604
2616
  getKeyID(): string;
2605
2617
  getKeyDeriver(privKey: PrivateKey | HexString): KeyDeriverApi;
2606
2618
  lock(lockerPrivKey: string, unlockerPubKey: string): LockingScript;
2607
- unlock(unlockerPrivKey: string, lockerPubKey: string, sourceSatoshis?: number, lockingScript?: Script): ScriptTemplateUnlock;
2619
+ unlock(unlockerPrivKey: PrivateKey | HexString, lockerPubKey: PublicKey | string, sourceSatoshis?: number, lockingScript?: Script): ScriptTemplateUnlock;
2620
+ unlockWithDerivedPrivateKey(derivedPrivateKey: PrivateKey, sourceSatoshis?: number, lockingScript?: Script): ScriptTemplateUnlock;
2608
2621
  /**
2609
2622
  * P2PKH unlock estimateLength is a constant
2610
2623
  */
@@ -3167,8 +3180,9 @@ declare class EntityProvenTx extends EntityBase<TableProvenTx> {
3167
3180
  /**
3168
3181
  * @returns desirialized `MerklePath` object, value is cached.
3169
3182
  */
3170
- getMerklePath(): MerklePath;
3183
+ getMerklePath(validateRoots?: boolean): MerklePath;
3171
3184
  _mp?: MerklePath;
3185
+ _mpUnchecked?: MerklePath;
3172
3186
  get provenTxId(): number;
3173
3187
  set provenTxId(v: number);
3174
3188
  get created_at(): Date;
@@ -3874,6 +3888,9 @@ declare abstract class StorageReaderWriter extends StorageReader {
3874
3888
  }
3875
3889
  interface StorageReaderWriterOptions extends StorageReaderOptions {}
3876
3890
  //#endregion
3891
+ //#region ../src/storage/methods/availableManagedChange.d.ts
3892
+ type ManagedChangeInputCandidate = Pick<TableOutput, 'outputId' | 'transactionId' | 'satoshis' | 'txid' | 'vout'>;
3893
+ //#endregion
3877
3894
  //#region ../src/storage/StorageProvider.d.ts
3878
3895
  declare abstract class StorageProvider extends StorageReaderWriter implements WalletStorageProvider {
3879
3896
  isDirty: boolean;
@@ -3900,11 +3917,30 @@ declare abstract class StorageProvider extends StorageReaderWriter implements Wa
3900
3917
  abstract allocateChangeInput(userId: number, basketId: number, targetSatoshis: number, exactSatoshis: number | undefined, excludeSending: boolean, transactionId: number): Promise<TableOutput | undefined>;
3901
3918
  /** Mark a planned set of change inputs spent within the caller's transaction. */
3902
3919
  markChangeInputsSpent(outputIds: number[], transactionId: number, trx: TrxToken): Promise<number>;
3920
+ /**
3921
+ * Insert outputs that do not need their generated ids returned to the
3922
+ * caller. Engines with a multi-row insert override this common-path helper;
3923
+ * the fallback preserves existing storage implementations unchanged.
3924
+ */
3925
+ insertOutputs(outputs: TableOutput[], trx?: TrxToken): Promise<void>;
3903
3926
  /** Return unreserved wallet-managed outputs eligible for automatic funding. */
3904
3927
  findAvailableManagedChangeInputs(userId: number, basketId: number, excludeSending: boolean, trx?: TrxToken): Promise<TableOutput[]>;
3928
+ /** Read only the fields needed by the in-memory funding planner. */
3929
+ findAvailableManagedChangeInputCandidates(userId: number, basketId: number, excludeSending: boolean, trx?: TrxToken): Promise<ManagedChangeInputCandidate[]>;
3905
3930
  /** Read the current status of a set of source transactions without loading raw transaction bytes. */
3906
3931
  findTransactionStatusesByIds(userId: number, transactionIds: number[], trx?: TrxToken): Promise<Map<number, TransactionStatus>>;
3932
+ /**
3933
+ * Lock and return the selected funding rows whose source transaction and
3934
+ * action-batch reservation state still permit allocation.
3935
+ */
3936
+ findFundingOutputsForUpdate(userId: number, outputIds: number[], statuses: TransactionStatus[], trx: TrxToken): Promise<Record<number, TableOutput>>;
3907
3937
  abstract getProvenOrRawTx(txid: string, trx?: TrxToken): Promise<ProvenOrRawTx>;
3938
+ /**
3939
+ * Resolve several transaction proofs in one storage operation when the
3940
+ * backend supports it. The default preserves compatibility for custom
3941
+ * providers; SQL and IndexedDB providers override this hot path.
3942
+ */
3943
+ getProvenOrRawTxs(txids: string[], trx?: TrxToken): Promise<Map<string, ProvenOrRawTx>>;
3908
3944
  abstract getRawTxOfKnownValidTransaction(txid?: string, offset?: number, length?: number, trx?: TrxToken): Promise<number[] | undefined>;
3909
3945
  abstract getLabelsForTransactionId(transactionId?: number, trx?: TrxToken): Promise<TableTxLabel[]>;
3910
3946
  abstract getTagsForOutputId(outputId: number, trx?: TrxToken): Promise<TableOutputTag[]>;
@@ -3928,6 +3964,8 @@ declare abstract class StorageProvider extends StorageReaderWriter implements Wa
3928
3964
  deleteActionBatchBlobRecords(_actionBatchId: number, _trx?: TrxToken): Promise<void>;
3929
3965
  getCapabilities(): Promise<StorageCapabilities>;
3930
3966
  protected supportsActionBatchPersistence(): boolean;
3967
+ /** Custom providers may require physical expiry cleanup before reservations are queried. */
3968
+ protected requiresActionBatchCleanupBeforeCreateAction(): boolean;
3931
3969
  beginActionBatch(auth: AuthId, args: BeginActionBatchArgs): Promise<BeginActionBatchResult>;
3932
3970
  extendActionBatch(auth: AuthId, args: ExtendActionBatchArgs): Promise<ExtendActionBatchResult>;
3933
3971
  renewActionBatch(auth: AuthId, batchId: string): Promise<RenewActionBatchResult>;
@@ -4038,6 +4076,7 @@ declare abstract class StorageProvider extends StorageReaderWriter implements Wa
4038
4076
  private handleProvenTxBranch;
4039
4077
  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>;
4040
4078
  getBeefForTransaction(txid: string, options: StorageGetBeefOptions): Promise<Beef>;
4079
+ getBeefForTransactions(txids: string[], options: StorageGetBeefOptions): Promise<Beef>;
4041
4080
  findMonitorEventById(id: number, trx?: TrxToken): Promise<TableMonitorEvent | undefined>;
4042
4081
  relinquishCertificate(auth: AuthId, args: RelinquishCertificateArgs): Promise<number>;
4043
4082
  relinquishOutput(auth: AuthId, args: RelinquishOutputArgs): Promise<number>;
@@ -4580,6 +4619,7 @@ declare class StorageIdb extends StorageProvider implements WalletStorageProvide
4580
4619
  db?: IDBPDatabase<StorageIdbSchema>;
4581
4620
  constructor(options: StorageIdbOptions);
4582
4621
  protected supportsActionBatchPersistence(): boolean;
4622
+ protected requiresActionBatchCleanupBeforeCreateAction(): boolean;
4583
4623
  /**
4584
4624
  * This method must be called at least once before any other method accesses the database,
4585
4625
  * and each time the schema may have updated.
@@ -4647,6 +4687,7 @@ declare class StorageIdb extends StorageProvider implements WalletStorageProvide
4647
4687
  */
4648
4688
  allocateChangeInput(userId: number, basketId: number, targetSatoshis: number, exactSatoshis: number | undefined, excludeSending: boolean, transactionId: number): Promise<TableOutput | undefined>;
4649
4689
  getProvenOrRawTx(txid: string, trx?: TrxToken): Promise<ProvenOrRawTx>;
4690
+ getProvenOrRawTxs(txids: string[], trx?: TrxToken): Promise<Map<string, ProvenOrRawTx>>;
4650
4691
  getRawTxOfKnownValidTransaction(txid?: string, offset?: number, length?: number, trx?: TrxToken): Promise<number[] | undefined>;
4651
4692
  private getRawTxForSlice;
4652
4693
  private getRawTxFull;
@@ -6152,7 +6193,7 @@ interface ChaintracksStorageApi extends ChaintracksStorageQueryApi, ChaintracksS
6152
6193
  //#region ../src/services/chaintracker/chaintracks/Api/BulkIngestorApi.d.ts
6153
6194
  interface BulkIngestorBaseOptions {
6154
6195
  /**
6155
- * The target chain: "main" or "test"
6196
+ * The target chain.
6156
6197
  */
6157
6198
  chain: Chain;
6158
6199
  /**
@@ -6383,6 +6424,7 @@ declare class Chaintracks implements ChaintracksManagementApi {
6383
6424
  private lastPresentHeightMsecs;
6384
6425
  private readonly lastPresentHeightMaxAge;
6385
6426
  private readonly lock;
6427
+ private readonly sourceStatus;
6386
6428
  constructor(options: ChaintracksOptions);
6387
6429
  getChain(): Promise<Chain>;
6388
6430
  /**
@@ -6442,6 +6484,9 @@ declare class Chaintracks implements ChaintracksManagementApi {
6442
6484
  private syncBulkStorage;
6443
6485
  private syncBulkStorageNoLock;
6444
6486
  private runBulkSyncRound;
6487
+ private sourceName;
6488
+ private markSourceSuccess;
6489
+ private markSourceFailure;
6445
6490
  private getMissingBlockHeader;
6446
6491
  private invalidInsertHeaderResult;
6447
6492
  private addLiveHeader;
@@ -6515,6 +6560,12 @@ interface GoChaintracksServiceClientOptions {
6515
6560
  */
6516
6561
  apiPrefix?: string;
6517
6562
  fetch?: typeof fetch;
6563
+ /** Timeout for HTTP requests and the initial SSE handshake. */
6564
+ requestTimeoutMsecs?: number;
6565
+ /** Initial delay before reconnecting a closed or failed SSE stream. */
6566
+ reconnectWaitMsecs?: number;
6567
+ /** Maximum SSE reconnect delay. */
6568
+ reconnectWaitMaxMsecs?: number;
6518
6569
  }
6519
6570
  /**
6520
6571
  * Client for go-chaintracks compatible HTTP services, including Arcade's
@@ -6526,6 +6577,9 @@ declare class GoChaintracksServiceClient implements ChaintracksClientApi {
6526
6577
  chain: Chain;
6527
6578
  private readonly baseUrl;
6528
6579
  private readonly fetcher;
6580
+ private readonly requestTimeoutMsecs;
6581
+ private readonly reconnectWaitMsecs;
6582
+ private readonly reconnectWaitMaxMsecs;
6529
6583
  private readonly subscriptions;
6530
6584
  private nextSubscriptionId;
6531
6585
  constructor(chain: Chain, serviceUrl: string, options?: GoChaintracksServiceClientOptions);
@@ -6548,11 +6602,14 @@ declare class GoChaintracksServiceClient implements ChaintracksClientApi {
6548
6602
  subscribeReorgs(listener: ReorgListener): Promise<string>;
6549
6603
  unsubscribe(subscriptionId: string): Promise<boolean>;
6550
6604
  private subscribe;
6605
+ private runSseWithReconnect;
6606
+ private waitForReconnect;
6551
6607
  private runSse;
6552
6608
  private processSseBuffer;
6553
6609
  private getJson;
6554
6610
  private getJsonOrUndefined;
6555
6611
  private getBinary;
6612
+ private fetchWithTimeout;
6556
6613
  private url;
6557
6614
  private normalizeChain;
6558
6615
  }
@@ -7065,8 +7122,14 @@ declare function validateScriptHash(output: string, outputFormat?: GetUtxoStatus
7065
7122
  declare function toBinaryBaseBlockHeader(header: BaseBlockHeader): number[];
7066
7123
  //#endregion
7067
7124
  //#region ../src/services/providers/WhatsOnChain.d.ts
7125
+ interface WalletToolboxWhatsOnChainConfig extends WhatsOnChainConfig {
7126
+ /** Optional request-start gate used by ChainTracks' shared public-rate scheduler. */
7127
+ requestGate?: () => Promise<void>;
7128
+ }
7068
7129
  declare class WhatsOnChainNoServices extends SdkWhatsOnChain {
7069
- constructor(chain?: Chain, config?: WhatsOnChainConfig);
7130
+ private readonly requestGate?;
7131
+ constructor(chain?: Chain, config?: WalletToolboxWhatsOnChainConfig);
7132
+ private requestWithAnonymousAuthFallback;
7070
7133
  /**
7071
7134
  * POST
7072
7135
  * https://api.whatsonchain.com/v1/bsv/main/txs/status
@@ -7152,7 +7215,7 @@ declare class WhatsOnChainNoServices extends SdkWhatsOnChain {
7152
7215
  */
7153
7216
  declare class WhatsOnChain extends WhatsOnChainNoServices {
7154
7217
  services: Services;
7155
- constructor(chain?: Chain, config?: WhatsOnChainConfig, services?: Services);
7218
+ constructor(chain?: Chain, config?: WalletToolboxWhatsOnChainConfig, services?: Services);
7156
7219
  /**
7157
7220
  * @param txid
7158
7221
  * @returns
@@ -7188,14 +7251,14 @@ declare function parseFileLink(file: string): {
7188
7251
  } | undefined;
7189
7252
  interface WhatsOnChainServicesOptions {
7190
7253
  /**
7191
- * Which chain is being tracked: main, test, or stn.
7254
+ * Which chain is being tracked. The public WhatsOnChain fallback is only
7255
+ * configured automatically for mainnet and testnet.
7192
7256
  */
7193
7257
  chain: Chain;
7194
7258
  /**
7195
- * WhatsOnChain.com API Key
7196
- * https://docs.taal.com/introduction/get-an-api-key
7197
- * If unknown or empty, maximum request rate is limited.
7198
- * https://developers.whatsonchain.com/#rate-limits
7259
+ * Optional WhatsOnChain API key. ChainTracks works without one and limits
7260
+ * anonymous traffic to the documented public rate.
7261
+ * https://docs.whatsonchain.com/
7199
7262
  */
7200
7263
  apiKey?: string;
7201
7264
  /**
@@ -7214,6 +7277,8 @@ interface WhatsOnChainServicesOptions {
7214
7277
  * How long chainInfo is considered still valid before updating (msecs).
7215
7278
  */
7216
7279
  chainInfoMsecs: number;
7280
+ /** Minimum interval between keyless API request starts. Defaults below 3 requests/second. */
7281
+ minRequestIntervalMsecs?: number;
7217
7282
  }
7218
7283
  declare class WhatsOnChainServices {
7219
7284
  options: WhatsOnChainServicesOptions;
@@ -7221,6 +7286,9 @@ declare class WhatsOnChainServices {
7221
7286
  static readonly chainInfo: Array<WocChainInfo | undefined>;
7222
7287
  static readonly chainInfoTime: Array<Date | undefined>;
7223
7288
  static readonly chainInfoMsecs: number[];
7289
+ static readonly chainInfoPromise: Partial<Record<Chain, Promise<WocChainInfo>>>;
7290
+ private static requestTail;
7291
+ private static nextRequestMsecs;
7224
7292
  chain: Chain;
7225
7293
  woc: WhatsOnChain;
7226
7294
  constructor(options: WhatsOnChainServicesOptions);
@@ -7234,6 +7302,7 @@ declare class WhatsOnChainServices {
7234
7302
  */
7235
7303
  getHeaders(fetch?: ChaintracksFetchApi): Promise<WocGetHeadersHeader[]>;
7236
7304
  getHeaderByteFileLinks(neededRange: HeightRange, fetch?: ChaintracksFetchApi): Promise<GetHeaderByteFileLinksResult[]>;
7305
+ private waitForRateLimit;
7237
7306
  }
7238
7307
  interface WocGetHeaderByteFileLinks {
7239
7308
  files: string[];
@@ -7320,6 +7389,28 @@ declare class BulkIngestorWhatsOnChainCdn extends BulkIngestorBase {
7320
7389
  fetchHeaders(before: HeightRanges, fetchRange: HeightRange, bulkRange: HeightRange, priorLiveHeaders: BlockHeader[]): Promise<BlockHeader[]>;
7321
7390
  }
7322
7391
  //#endregion
7392
+ //#region ../src/services/chaintracker/chaintracks/Ingest/BulkIngestorChaintracks.d.ts
7393
+ interface BulkIngestorChaintracksOptions extends BulkIngestorBaseOptions {
7394
+ chain: Chain;
7395
+ chaintracks: ChaintracksClientApi;
7396
+ /** Maximum headers requested from the upstream service at once. */
7397
+ maxHeadersPerRequest?: number;
7398
+ }
7399
+ /**
7400
+ * Uses a go-chaintracks/Arcade-compatible service as a validated bulk source.
7401
+ * Retrieved bytes still pass through ChainTracks' local serialization, hash,
7402
+ * continuity, and genesis checks before storage.
7403
+ */
7404
+ declare class BulkIngestorChaintracks extends BulkIngestorBase {
7405
+ private readonly chaintracks;
7406
+ private readonly maxHeadersPerRequest;
7407
+ private networkChecked;
7408
+ constructor(options: BulkIngestorChaintracksOptions);
7409
+ getPresentHeight(): Promise<number>;
7410
+ fetchHeaders(_before: HeightRanges, fetchRange: HeightRange, bulkRange: HeightRange, priorLiveHeaders: BlockHeader[]): Promise<BlockHeader[]>;
7411
+ private ensureNetwork;
7412
+ }
7413
+ //#endregion
7323
7414
  //#region ../src/services/chaintracker/chaintracks/Ingest/LiveIngestorWhatsOnChainPoll.d.ts
7324
7415
  interface LiveIngestorWhatsOnChainOptions extends LiveIngestorBaseOptions, WhatsOnChainServicesOptions {
7325
7416
  /**
@@ -7433,6 +7524,9 @@ interface ChaintracksStorageNoDbOptions extends ChaintracksStorageBaseOptions {}
7433
7524
  declare class ChaintracksStorageNoDb extends ChaintracksStorageBase {
7434
7525
  static readonly mainData: ChaintracksNoDbData;
7435
7526
  static readonly testData: ChaintracksNoDbData;
7527
+ static readonly stnData: ChaintracksNoDbData;
7528
+ static readonly ttnData: ChaintracksNoDbData;
7529
+ static readonly tstnData: ChaintracksNoDbData;
7436
7530
  constructor(options: ChaintracksStorageNoDbOptions);
7437
7531
  destroy(): Promise<void>;
7438
7532
  getData(): Promise<ChaintracksNoDbData>;
@@ -7545,8 +7639,67 @@ interface ChaintracksStorageIdbSchema {
7545
7639
  }
7546
7640
  //#endregion
7547
7641
  //#region ../src/services/chaintracker/chaintracks/configureChaintracksIngestors.d.ts
7548
- type ChaintracksArgumentsTail = [whatsonchainApiKey?: string, maxPerFile?: number, maxRetained?: number, fetch?: ChaintracksFetchApi, cdnUrl?: string, liveHeightThreshold?: number, reorgHeightThreshold?: number, bulkMigrationChunkSize?: number, batchInsertLimit?: number, addLiveRecursionLimit?: number];
7642
+ interface ChaintracksSourceOptions {
7643
+ /** Preferred go-chaintracks or Arcade source. */
7644
+ chaintracks?: ChaintracksClientApi;
7645
+ /** Disable the credential-free public Arcade default. */
7646
+ disableChaintracks?: boolean;
7647
+ /** Maximum number of headers requested from the remote source at once. */
7648
+ remoteMaxHeadersPerRequest?: number;
7649
+ /** Disable the configured CDN source without changing its URL. */
7650
+ disableCdn?: boolean;
7651
+ /** Disable the keyless WhatsOnChain fallback on mainnet/testnet. */
7652
+ disableWhatsOnChain?: boolean;
7653
+ }
7654
+ type ChaintracksArgumentsTail = [whatsonchainApiKey?: string, maxPerFile?: number, maxRetained?: number, fetch?: ChaintracksFetchApi, cdnUrl?: string, liveHeightThreshold?: number, reorgHeightThreshold?: number, bulkMigrationChunkSize?: number, batchInsertLimit?: number, addLiveRecursionLimit?: number, sources?: ChaintracksSourceOptions];
7549
7655
  type DefaultChaintracksArguments = [chain: Chain, ...options: ChaintracksArgumentsTail];
7656
+ /**
7657
+ * Shared parameters for configuring Chaintracks ingestors.
7658
+ */
7659
+ interface ChaintracksIngestorParams {
7660
+ chain: Chain;
7661
+ whatsonchainApiKey: string;
7662
+ maxPerFile: number;
7663
+ fetch: ChaintracksFetchApi;
7664
+ cdnUrl: string;
7665
+ addLiveRecursionLimit: number;
7666
+ sources: ChaintracksSourceOptions;
7667
+ }
7668
+ interface ResolvedDefaultChaintracksParams extends ChaintracksIngestorParams {
7669
+ maxRetained: number;
7670
+ liveHeightThreshold: number;
7671
+ reorgHeightThreshold: number;
7672
+ bulkMigrationChunkSize: number;
7673
+ batchInsertLimit: number;
7674
+ }
7675
+ interface CreatedChaintracks<TStorage extends ChaintracksOptions['storage']> {
7676
+ chain: Chain;
7677
+ maxPerFile: number;
7678
+ fetch: ChaintracksFetchApi;
7679
+ storage: TStorage;
7680
+ chaintracks: Chaintracks;
7681
+ available: Promise<void>;
7682
+ }
7683
+ declare function resolveDefaultChaintracksArguments(args: DefaultChaintracksArguments): ResolvedDefaultChaintracksParams;
7684
+ declare function toDefaultChaintracksArguments(params: ResolvedDefaultChaintracksParams): DefaultChaintracksArguments;
7685
+ declare function createDefaultBulkFileDataManager(params: ResolvedDefaultChaintracksParams): BulkFileDataManager;
7686
+ declare function createDefaultChaintracksStorageOptions(params: ResolvedDefaultChaintracksParams): {
7687
+ chain: Chain;
7688
+ bulkFileDataManager: BulkFileDataManager;
7689
+ liveHeightThreshold: number;
7690
+ reorgHeightThreshold: number;
7691
+ bulkMigrationChunkSize: number;
7692
+ batchInsertLimit: number;
7693
+ };
7694
+ declare function startChaintracks<TStorage extends ChaintracksOptions['storage']>(params: ResolvedDefaultChaintracksParams, options: ChaintracksOptions): CreatedChaintracks<TStorage>;
7695
+ declare function createAndStartDefaultChaintracks<TStorage extends ChaintracksOptions['storage']>(args: DefaultChaintracksArguments, createOptions: (...args: DefaultChaintracksArguments) => ChaintracksOptions): CreatedChaintracks<TStorage>;
7696
+ /**
7697
+ * Builds the shared portion of ChaintracksOptions that all storage backends
7698
+ * (Knex, Idb, NoDb) have in common: the options shell and bulk/live ingestors.
7699
+ *
7700
+ * The caller is responsible for providing the storage implementation.
7701
+ */
7702
+ declare function buildChaintracksOptionsWithIngestors(params: ChaintracksIngestorParams, storage: ChaintracksOptions['storage']): ChaintracksOptions;
7550
7703
  //#endregion
7551
7704
  //#region ../src/services/chaintracker/chaintracks/createDefaultNoDbChaintracksOptions.d.ts
7552
7705
  declare function createDefaultNoDbChaintracksOptions(...args: DefaultChaintracksArguments): ChaintracksOptions;
@@ -8265,9 +8418,9 @@ interface WalletArgs {
8265
8418
  */
8266
8419
  makeLogger?: MakeWalletLogger;
8267
8420
  /**
8268
- * Internal Wallet Toolbox optimization policy. `auto` negotiates the optional
8269
- * action-batch storage capability; `legacy` always uses per-action storage.
8270
- * This does not change the BRC-100 wallet interface.
8421
+ * Internal Wallet Toolbox optimization policy. `auto` (the default)
8422
+ * negotiates the optional action-batch storage capability; `legacy` always
8423
+ * uses per-action storage. This does not change the BRC-100 wallet interface.
8271
8424
  */
8272
8425
  actionBatchMode?: ActionBatchMode;
8273
8426
  /**
@@ -8858,7 +9011,7 @@ interface UMPTokenInteractor {
8858
9011
  *
8859
9012
  * @param hash The hash of the presentation key.
8860
9013
  * @returns The UMP token if found; otherwise, undefined.
8861
- * @throws Implementations should throw when absence cannot be established authoritatively.
9014
+ * @throws Implementations should throw when no verified token or clean empty response is available.
8862
9015
  */
8863
9016
  findByPresentationKeyHash: (hash: number[]) => Promise<UMPToken | undefined>;
8864
9017
  /**
@@ -8867,7 +9020,7 @@ interface UMPTokenInteractor {
8867
9020
  *
8868
9021
  * @param hash The hash of the recovery key.
8869
9022
  * @returns The UMP token if found; otherwise, undefined.
8870
- * @throws Implementations should throw when absence cannot be established authoritatively.
9023
+ * @throws Implementations should throw when no verified token or clean empty response is available.
8871
9024
  */
8872
9025
  findByRecoveryKeyHash: (hash: number[]) => Promise<UMPToken | undefined>;
8873
9026
  /**
@@ -8895,7 +9048,7 @@ interface UMPTokenLookupDiagnostics {
8895
9048
  }
8896
9049
  type UMPTokenLookupFailureReason = 'lookup-unavailable' | 'lookup-incomplete' | 'token-malformed' | 'token-ambiguous';
8897
9050
  /**
8898
- * Raised when UMP absence cannot be established authoritatively.
9051
+ * Raised when a UMP lookup yields neither a verified token nor a clean empty response.
8899
9052
  *
8900
9053
  * Callers must offer retry/recovery rather than treating this error as a new
8901
9054
  * account. Diagnostics contain counts only and never hashes, keys, or tokens.
@@ -8955,9 +9108,37 @@ declare class OverlayUMPTokenInteractor implements UMPTokenInteractor {
8955
9108
  */
8956
9109
  findByRecoveryKeyHash(hash: number[]): Promise<UMPToken | undefined>;
8957
9110
  private findToken;
9111
+ /**
9112
+ * Picks the newest rendition among distinct verified tokens, when possible.
9113
+ *
9114
+ * The on-chain UMP protocol expresses token updates by consumption: the
9115
+ * transaction creating a new rendition spends the previous rendition's
9116
+ * outpoint (there is no rendition counter field in the current format).
9117
+ * A candidate is therefore superseded when any other candidate's ancestry
9118
+ * (available from its BEEF) spends the candidate's outpoint.
9119
+ *
9120
+ * @returns The single unsuperseded candidate, or undefined when supersession
9121
+ * cannot be established for every stale candidate (e.g. forked tokens).
9122
+ */
9123
+ private resolveNewestToken;
9124
+ /**
9125
+ * Whether `tx` spends an input whose source output (available in the BEEF)
9126
+ * decodes as a UMP token sharing the candidate's presentation or recovery
9127
+ * hash — on-chain proof that the candidate is an update of a same-identity
9128
+ * predecessor rather than an independently minted token.
9129
+ */
9130
+ private consumesSameIdentityToken;
9131
+ /**
9132
+ * Accumulates every outpoint spent by `tx` and by the ancestor transactions
9133
+ * embedded in its BEEF, so supersession is detected even when intermediate
9134
+ * renditions are absent from the lookup answer. Iterative so arbitrarily
9135
+ * long update chains cannot exhaust the call stack.
9136
+ */
9137
+ private collectSpentOutpoints;
8958
9138
  private emptyLookupDiagnostics;
8959
9139
  private toLookupDiagnostics;
8960
9140
  private lookupDiagnosticAttributes;
9141
+ private captureLookupCompleted;
8961
9142
  private captureLookupFailure;
8962
9143
  /**
8963
9144
  * Creates or updates (replaces) a UMP token on-chain. If `oldTokenToConsume` is provided,
@@ -9266,6 +9447,11 @@ declare class CWIStyleWalletManager implements WalletInterface {
9266
9447
  }
9267
9448
  //#endregion
9268
9449
  //#region ../src/services/createDefaultWalletServicesOptions.d.ts
9450
+ /**
9451
+ * Returns the credential-free default ChainTracks client for a supported
9452
+ * public network, or an operator-configured client for stn/tstn.
9453
+ */
9454
+ declare function createDefaultChaintracksClient(chain: Exclude<Chain, 'mock'>): ChaintracksClientApi;
9269
9455
  declare function createDefaultWalletServicesOptions(...[chain, arcCallbackUrl, arcCallbackToken, taalArcApiKey, gorillaPoolArcApiKey, bitailsApiKey, deploymentId, chaintracks, arcadeUrl, arcadeApiKey, arcadeCallbackToken]: [chain: Chain, arcCallbackUrl?: string, arcCallbackToken?: string, taalArcApiKey?: string, gorillaPoolArcApiKey?: string, bitailsApiKey?: string, deploymentId?: string, chaintracks?: ChaintracksClientApi,
9270
9456
  /**
9271
9457
  * Optional Arcade endpoint. When provided (or when a default exists for the chain via
@@ -9282,7 +9468,7 @@ arcadeApiKey?: string,
9282
9468
  arcadeCallbackToken?: string]): WalletServicesOptions;
9283
9469
  /**
9284
9470
  * Default Arcade (bsv-blockchain/arcade) endpoint per chain.
9285
- * Returns undefined when no public default is known for the chain (e.g. testnet not yet deployed).
9471
+ * Returns undefined when no public default is known for the chain.
9286
9472
  */
9287
9473
  declare function arcadeDefaultUrl(chain: Chain): string | undefined;
9288
9474
  declare function arcDefaultUrl(chain: Chain): string;
@@ -10783,5 +10969,5 @@ declare class WalletPermissionsManager implements WalletInterface {
10783
10969
  private buildActiveRequestKey;
10784
10970
  }
10785
10971
  //#endregion
10786
- export { ARGON2ID_DEFAULT_HASH_LENGTH, ARGON2ID_DEFAULT_ITERATIONS, ARGON2ID_DEFAULT_MEMORY_KIB, ARGON2ID_DEFAULT_PARALLELISM, ARGON2ID_MAX_ITERATIONS, ARGON2ID_MAX_MEMORY_KIB, ARGON2ID_MAX_PARALLELISM, ActionBatchStatus, AdminStatsResult, AnyBlockHeader, AuthMethodInteractor, AuthPayload, BHServiceClient, BRC38ImportOptions, BRC38ImportResult, BRC38Tables, BRC38WalletData, BRC39Options, type BaseBlockHeader, type BlockHeader, BulkFileDataManager, BulkFileDataManagerMergeResult, BulkFileDataManagerOptions, BulkFileDataReader, BulkFilesReader, BulkFilesReaderFs, BulkFilesReaderStorage, BulkIngestorApi, BulkIngestorBase, BulkIngestorBaseOptions, BulkIngestorCDN, BulkIngestorCDNBabbage, BulkIngestorCDNOptions, BulkIngestorWhatsOnChainCdn, BulkIngestorWhatsOnChainOptions, BulkStorageApi, BulkStorageBase, BulkStorageBaseOptions, BulkSyncResult, ByteEncoding, ByteInput, CWIStyleWalletManager, Certifier, type Chain, Chaintracks, ChaintracksAppendableFileApi, ChaintracksChainTracker, ChaintracksChainTrackerOptions, ChaintracksFetch, ChaintracksFetchApi, ChaintracksFetchError, ChaintracksFsApi, ChaintracksManagementApi, ChaintracksOptions, ChaintracksReadableFileApi, ChaintracksServiceClient, ChaintracksServiceClientOptions, ChaintracksStorageApi, ChaintracksStorageBase, ChaintracksStorageBaseOptions, ChaintracksStorageBulkFileApi, ChaintracksStorageIdb, ChaintracksStorageIdbOptions, ChaintracksStorageIdbSchema, ChaintracksStorageIngestApi, ChaintracksStorageNoDb, ChaintracksStorageNoDbOptions, ChaintracksStorageQueryApi, ChaintracksWritableFileApi, CompleteAuthResponse, ContactRecord, ContactSource, CounterpartyPermissionEventHandler, CounterpartyPermissionRequest, CounterpartyPermissions, DEFAULT_PROFILE_ID, DEFAULT_SETTINGS, DeactivedHeader, DevConsoleInteractor, EnqueueHandler, EntityBase, EntityCertificate, EntityCertificateField, EntityCommission, EntityOutput, EntityOutputBasket, EntityOutputTag, EntityOutputTagMap, EntityProvenTx, EntityProvenTxReq, EntityStorage, EntitySyncMap, EntitySyncState, EntityTransaction, EntityTxLabel, EntityTxLabelMap, EntityUser, ErrorHandler, GetHeaderByteFileLinksResult, GoChaintracksServiceClient, GoChaintracksServiceClientOptions, GroupedPermissionEventHandler, GroupedPermissionRequest, GroupedPermissions, HeightRange, HeightRangeApi, HeightRanges, InsertHeaderResult, KDF_MAX_HASH_LENGTH, KdfConfig, KeyPairAddress, LineItemType, ListActionsSpecOp, ListOutputsSpecOp, LiveBlockHeader, LiveIngestorApi, LiveIngestorBase, LiveIngestorBaseOptions, LiveIngestorChaintracksSSE, LiveIngestorChaintracksSSEOptions, LiveIngestorWhatsOnChainOptions, LiveIngestorWhatsOnChainPoll, MAX_STATE_SNAPSHOT_BYTES, MergeEntity, Monitor, MonitorOptions, MonitorStartupTaskMode, MonitorStorage, OverlayUMPTokenInteractor, PBKDF2_MAX_ITERATIONS, PBKDF2_NUM_ROUNDS, ParsedBrc114ActionTimeLabels, PendingSignAction, PendingStorageInput, PermissionEventHandler, PermissionRequest, PermissionToken, PermissionsManagerConfig, PermissionsModule, PersonaIDInteractor, PrivilegedKeyManager, Profile, ProvenTxFromTxidResult, ProvenTxReqHistory, ProvenTxReqHistorySummaryApi, ProvenTxReqNotify, ScriptTemplateBRC29, ScriptTemplateParamsBRC29, SecurityLevel, Services, SetupClient, SetupClientWalletArgs, SetupClientWalletClientArgs, SetupWallet, SetupWalletClient, SetupWalletIdb, SetupWalletIdbArgs, SimpleWalletManager, StartAuthResponse, StorageAdminStats, StorageClient, StorageIdb, StorageIdbOptions, StorageProvider, StorageProviderOptions, StorageSyncReader, SyncError, SyncMap, TESTNET_DEFAULT_SETTINGS, TableActionBatch, TableActionBatchBlob, TableActionBatchOutput, TableAuthSession, TableCertificate, TableCertificateField, TableCertificateX, TableCommission, TableMonitorEvent, TableOutput, TableOutputBasket, TableOutputTag, TableOutputTagMap, TableOutputX, TableProvenTx, TableProvenTxReq, TableProvenTxReqDynamics, TableSettings, TableSyncState, TableTransaction, TableTxLabel, TableTxLabelMap, TableUser, TrustSettings, TscMerkleProofApi, TwilioPhoneInteractor, TxScriptOffsets, UMPToken, UMPTokenInteractor, UMPTokenLookupDiagnostics, UMPTokenLookupError, UMPTokenLookupFailureReason, VerifyAndRepairBeefResult, WABAccountContinuityError, WABClient, WABClientError, WABClientErrorCode, WABClientErrorOptions, WABClientOptions, WABFaucetResponse, WABOperationResponse, WABRequestOptions, WABServerInfo, WABTransport, WABTransportOptions, Wallet, WalletArgs, WalletAuthenticationManager, WalletAuthenticationManagerOptions, WalletLogger, WalletLoggerArgs, WalletLoggerLevel, WalletPermissionsManager, WalletPermissionsManagerCallbacks, WalletSettings, WalletSettingsManager, WalletSettingsManagerConfig, WalletSigner, WalletStorageManager, WalletTheme, WhatsOnChainServices, WhatsOnChainServicesOptions, WocGetHeaderByteFileLinks, WocGetHeadersHeader, arcDefaultUrl, arcGorillaPoolUrl, arcadeDefaultUrl, arraysEqual, asArray, asBsvSdkPrivateKey, asBsvSdkPublickKey, asBsvSdkScript, asBsvSdkTx, asString, asUint8Array, brc29ProtocolID, convertProofToMerklePath, createDefaultIdbChaintracksOptions, createDefaultNoDbChaintracksOptions, createDefaultWalletServicesOptions, createIdbChaintracks, createNoDbChaintracks, createSyncMap, decryptBRC39, doubleSha256BE, doubleSha256LE, encryptBRC39, exportBRC38, exportBRC38Json, exportBRC39, getIdentityKey, getLabelToSpecOp, getListOutputsSpecOp, importBRC38, importBRC39, isAutoSpendableChangeOutput, isBaseBlockHeader, isBlockHeader, isLive, isLiveBlockHeader, isManagedChangeOutput, logCreateActionArgs, logWalletError, logger, makeAtomicBeef, makeBrc114ActionTimeLabel, managedChangeOutputFields, maxDate, optionalArraysEqual, outputColumnsWithoutLockingScript, parseBRC38Json, parseBrc114ActionTimeLabels, parseFileLink, parseTxScriptOffsets, partitionActionLabels, randomBytes, randomBytesBase64, randomBytesHex, index_d_exports as sdk, selectBulkHeaderFiles, sha256Hash, stampLog, stampLogFormat, tableAuthSessionToPeerSession, throwDummyReviewActions, toBinaryBaseBlockHeader, toLookupNetworkPreset, toWalletNetwork, transactionColumnsWithoutRawTx, blockHeaderUtilities_d_exports as utils, validateScriptHash, validateSecondsSinceEpoch, validateStorageFeeModel, verifyHexString, verifyId, verifyInteger, verifyNumber, verifyOne, verifyOneOrNone, verifyOptionalHexString, verifyTruthy, wait, wocGetHeadersHeaderToBlockHeader };
10972
+ export { ARGON2ID_DEFAULT_HASH_LENGTH, ARGON2ID_DEFAULT_ITERATIONS, ARGON2ID_DEFAULT_MEMORY_KIB, ARGON2ID_DEFAULT_PARALLELISM, ARGON2ID_MAX_ITERATIONS, ARGON2ID_MAX_MEMORY_KIB, ARGON2ID_MAX_PARALLELISM, ActionBatchStatus, AdminStatsResult, AnyBlockHeader, AuthMethodInteractor, AuthPayload, BHServiceClient, BRC38ImportOptions, BRC38ImportResult, BRC38Tables, BRC38WalletData, BRC39Options, type BaseBlockHeader, type BlockHeader, BulkFileDataManager, BulkFileDataManagerMergeResult, BulkFileDataManagerOptions, BulkFileDataReader, BulkFilesReader, BulkFilesReaderFs, BulkFilesReaderStorage, BulkIngestorApi, BulkIngestorBase, BulkIngestorBaseOptions, BulkIngestorCDN, BulkIngestorCDNBabbage, BulkIngestorCDNOptions, BulkIngestorChaintracks, BulkIngestorChaintracksOptions, BulkIngestorWhatsOnChainCdn, BulkIngestorWhatsOnChainOptions, BulkStorageApi, BulkStorageBase, BulkStorageBaseOptions, BulkSyncResult, ByteEncoding, ByteInput, CWIStyleWalletManager, Certifier, type Chain, Chaintracks, ChaintracksApi, ChaintracksAppendableFileApi, ChaintracksArgumentsTail, ChaintracksChainTracker, ChaintracksChainTrackerOptions, ChaintracksClientApi, ChaintracksFetch, ChaintracksFetchApi, ChaintracksFetchError, ChaintracksFsApi, ChaintracksInfoApi, ChaintracksIngestorParams, ChaintracksManagementApi, ChaintracksOptions, ChaintracksPackageInfoApi, ChaintracksReadableFileApi, ChaintracksServiceClient, ChaintracksServiceClientOptions, ChaintracksSourceOptions, ChaintracksSourceStatusApi, ChaintracksStorageApi, ChaintracksStorageBase, ChaintracksStorageBaseOptions, ChaintracksStorageBulkFileApi, ChaintracksStorageIdb, ChaintracksStorageIdbOptions, ChaintracksStorageIdbSchema, ChaintracksStorageIngestApi, ChaintracksStorageNoDb, ChaintracksStorageNoDbOptions, ChaintracksStorageQueryApi, ChaintracksWritableFileApi, CompleteAuthResponse, ContactRecord, ContactSource, CounterpartyPermissionEventHandler, CounterpartyPermissionRequest, CounterpartyPermissions, CreatedChaintracks, DEFAULT_PROFILE_ID, DEFAULT_SETTINGS, DeactivedHeader, DefaultChaintracksArguments, DevConsoleInteractor, EnqueueHandler, EntityBase, EntityCertificate, EntityCertificateField, EntityCommission, EntityOutput, EntityOutputBasket, EntityOutputTag, EntityOutputTagMap, EntityProvenTx, EntityProvenTxReq, EntityStorage, EntitySyncMap, EntitySyncState, EntityTransaction, EntityTxLabel, EntityTxLabelMap, EntityUser, ErrorHandler, GetHeaderByteFileLinksResult, GoChaintracksServiceClient, GoChaintracksServiceClientOptions, GroupedPermissionEventHandler, GroupedPermissionRequest, GroupedPermissions, HeaderListener, HeightRange, HeightRangeApi, HeightRanges, InsertHeaderResult, KDF_MAX_HASH_LENGTH, KdfConfig, KeyPairAddress, LineItemType, ListActionsSpecOp, ListOutputsSpecOp, LiveBlockHeader, LiveIngestorApi, LiveIngestorBase, LiveIngestorBaseOptions, LiveIngestorChaintracksSSE, LiveIngestorChaintracksSSEOptions, LiveIngestorWhatsOnChainOptions, LiveIngestorWhatsOnChainPoll, MAX_STATE_SNAPSHOT_BYTES, MergeEntity, Monitor, MonitorOptions, MonitorStartupTaskMode, MonitorStorage, OverlayUMPTokenInteractor, PBKDF2_MAX_ITERATIONS, PBKDF2_NUM_ROUNDS, ParsedBrc114ActionTimeLabels, PendingSignAction, PendingStorageInput, PermissionEventHandler, PermissionRequest, PermissionToken, PermissionsManagerConfig, PermissionsModule, PersonaIDInteractor, PrivilegedKeyManager, Profile, ProvenTxFromTxidResult, ProvenTxReqHistory, ProvenTxReqHistorySummaryApi, ProvenTxReqNotify, ReorgListener, ResolvedDefaultChaintracksParams, ScriptTemplateBRC29, ScriptTemplateParamsBRC29, SecurityLevel, Services, SetupClient, SetupClientWalletArgs, SetupClientWalletClientArgs, SetupWallet, SetupWalletClient, SetupWalletIdb, SetupWalletIdbArgs, SimpleWalletManager, StartAuthResponse, StorageAdminStats, StorageClient, StorageIdb, StorageIdbOptions, StorageProvider, StorageProviderOptions, StorageSyncReader, SyncError, SyncMap, TESTNET_DEFAULT_SETTINGS, TableActionBatch, TableActionBatchBlob, TableActionBatchOutput, TableAuthSession, TableCertificate, TableCertificateField, TableCertificateX, TableCommission, TableMonitorEvent, TableOutput, TableOutputBasket, TableOutputTag, TableOutputTagMap, TableOutputX, TableProvenTx, TableProvenTxReq, TableProvenTxReqDynamics, TableSettings, TableSyncState, TableTransaction, TableTxLabel, TableTxLabelMap, TableUser, TrustSettings, TscMerkleProofApi, TwilioPhoneInteractor, TxScriptOffsets, UMPToken, UMPTokenInteractor, UMPTokenLookupDiagnostics, UMPTokenLookupError, UMPTokenLookupFailureReason, VerifyAndRepairBeefResult, WABAccountContinuityError, WABClient, WABClientError, WABClientErrorCode, WABClientErrorOptions, WABClientOptions, WABFaucetResponse, WABOperationResponse, WABRequestOptions, WABServerInfo, WABTransport, WABTransportOptions, Wallet, WalletArgs, WalletAuthenticationManager, WalletAuthenticationManagerOptions, WalletLogger, WalletLoggerArgs, WalletLoggerLevel, WalletPermissionsManager, WalletPermissionsManagerCallbacks, WalletSettings, WalletSettingsManager, WalletSettingsManagerConfig, WalletSigner, WalletStorageManager, WalletTheme, WhatsOnChainServices, WhatsOnChainServicesOptions, WocGetHeaderByteFileLinks, WocGetHeadersHeader, arcDefaultUrl, arcGorillaPoolUrl, arcadeDefaultUrl, arraysEqual, asArray, asBsvSdkPrivateKey, asBsvSdkPublickKey, asBsvSdkScript, asBsvSdkTx, asString, asUint8Array, brc29ProtocolID, buildChaintracksOptionsWithIngestors, convertProofToMerklePath, createAndStartDefaultChaintracks, createDefaultBulkFileDataManager, createDefaultChaintracksClient, createDefaultChaintracksStorageOptions, createDefaultIdbChaintracksOptions, createDefaultNoDbChaintracksOptions, createDefaultWalletServicesOptions, createIdbChaintracks, createNoDbChaintracks, createSyncMap, decryptBRC39, doubleSha256BE, doubleSha256LE, encryptBRC39, exportBRC38, exportBRC38Json, exportBRC39, getIdentityKey, getLabelToSpecOp, getListOutputsSpecOp, importBRC38, importBRC39, isAutoSpendableChangeOutput, isBaseBlockHeader, isBlockHeader, isLive, isLiveBlockHeader, isManagedChangeOutput, logCreateActionArgs, logWalletError, logger, makeAtomicBeef, makeBrc114ActionTimeLabel, managedChangeOutputFields, maxDate, optionalArraysEqual, outputColumnsWithoutLockingScript, parseBRC38Json, parseBrc114ActionTimeLabels, parseFileLink, parseTxScriptOffsets, partitionActionLabels, randomBytes, randomBytesBase64, randomBytesHex, resolveDefaultChaintracksArguments, index_d_exports as sdk, selectBulkHeaderFiles, sha256Hash, stampLog, stampLogFormat, startChaintracks, tableAuthSessionToPeerSession, throwDummyReviewActions, toBinaryBaseBlockHeader, toDefaultChaintracksArguments, toLookupNetworkPreset, toWalletNetwork, transactionColumnsWithoutRawTx, blockHeaderUtilities_d_exports as utils, validateScriptHash, validateSecondsSinceEpoch, validateStorageFeeModel, verifyHexString, verifyId, verifyInteger, verifyNumber, verifyOne, verifyOneOrNone, verifyOptionalHexString, verifyTruthy, wait, wocGetHeadersHeaderToBlockHeader };
10787
10973
  //# sourceMappingURL=index.client.d.cts.map