@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.
@@ -92,7 +92,7 @@ interface OutPoint {
92
92
  */
93
93
  vout: number;
94
94
  }
95
- type Chain = 'main' | 'test' | 'ttn' | 'tstn' | 'mock';
95
+ type Chain = 'main' | 'test' | 'stn' | 'ttn' | 'tstn' | 'mock';
96
96
  /**
97
97
  * Initial status (attempts === 0):
98
98
  *
@@ -813,6 +813,17 @@ interface ChaintracksInfoApi {
813
813
  bulkIngestors: string[];
814
814
  liveIngestors: string[];
815
815
  packages: ChaintracksPackageInfoApi[];
816
+ /** Last observed source state. Additive and omitted by older services. */
817
+ sources?: ChaintracksSourceStatusApi[];
818
+ }
819
+ /** @public */
820
+ interface ChaintracksSourceStatusApi {
821
+ name: string;
822
+ role: 'bulk' | 'live';
823
+ state: 'unknown' | 'healthy' | 'degraded';
824
+ lastSuccess?: string;
825
+ lastFailure?: string;
826
+ error?: string;
816
827
  }
817
828
  /**
818
829
  * Chaintracks client API excluding events and callbacks
@@ -2093,6 +2104,7 @@ interface FindProvenTxReqsArgs extends FindSincePagedArgs {
2093
2104
  }
2094
2105
  interface FindProvenTxsArgs extends FindSincePagedArgs {
2095
2106
  partial: Partial<TableProvenTx>;
2107
+ txids?: string[];
2096
2108
  }
2097
2109
  interface FindStaleMerkleRootsArgs {
2098
2110
  height: number;
@@ -2603,7 +2615,8 @@ declare class ScriptTemplateBRC29 implements ScriptTemplate {
2603
2615
  getKeyID(): string;
2604
2616
  getKeyDeriver(privKey: PrivateKey | HexString): KeyDeriverApi;
2605
2617
  lock(lockerPrivKey: string, unlockerPubKey: string): LockingScript;
2606
- unlock(unlockerPrivKey: string, lockerPubKey: string, sourceSatoshis?: number, lockingScript?: Script): ScriptTemplateUnlock;
2618
+ unlock(unlockerPrivKey: PrivateKey | HexString, lockerPubKey: PublicKey | string, sourceSatoshis?: number, lockingScript?: Script): ScriptTemplateUnlock;
2619
+ unlockWithDerivedPrivateKey(derivedPrivateKey: PrivateKey, sourceSatoshis?: number, lockingScript?: Script): ScriptTemplateUnlock;
2607
2620
  /**
2608
2621
  * P2PKH unlock estimateLength is a constant
2609
2622
  */
@@ -3166,8 +3179,9 @@ declare class EntityProvenTx extends EntityBase<TableProvenTx> {
3166
3179
  /**
3167
3180
  * @returns desirialized `MerklePath` object, value is cached.
3168
3181
  */
3169
- getMerklePath(): MerklePath;
3182
+ getMerklePath(validateRoots?: boolean): MerklePath;
3170
3183
  _mp?: MerklePath;
3184
+ _mpUnchecked?: MerklePath;
3171
3185
  get provenTxId(): number;
3172
3186
  set provenTxId(v: number);
3173
3187
  get created_at(): Date;
@@ -3873,6 +3887,9 @@ declare abstract class StorageReaderWriter extends StorageReader {
3873
3887
  }
3874
3888
  interface StorageReaderWriterOptions extends StorageReaderOptions {}
3875
3889
  //#endregion
3890
+ //#region ../src/storage/methods/availableManagedChange.d.ts
3891
+ type ManagedChangeInputCandidate = Pick<TableOutput, 'outputId' | 'transactionId' | 'satoshis' | 'txid' | 'vout'>;
3892
+ //#endregion
3876
3893
  //#region ../src/storage/StorageProvider.d.ts
3877
3894
  declare abstract class StorageProvider extends StorageReaderWriter implements WalletStorageProvider {
3878
3895
  isDirty: boolean;
@@ -3899,11 +3916,30 @@ declare abstract class StorageProvider extends StorageReaderWriter implements Wa
3899
3916
  abstract allocateChangeInput(userId: number, basketId: number, targetSatoshis: number, exactSatoshis: number | undefined, excludeSending: boolean, transactionId: number): Promise<TableOutput | undefined>;
3900
3917
  /** Mark a planned set of change inputs spent within the caller's transaction. */
3901
3918
  markChangeInputsSpent(outputIds: number[], transactionId: number, trx: TrxToken): Promise<number>;
3919
+ /**
3920
+ * Insert outputs that do not need their generated ids returned to the
3921
+ * caller. Engines with a multi-row insert override this common-path helper;
3922
+ * the fallback preserves existing storage implementations unchanged.
3923
+ */
3924
+ insertOutputs(outputs: TableOutput[], trx?: TrxToken): Promise<void>;
3902
3925
  /** Return unreserved wallet-managed outputs eligible for automatic funding. */
3903
3926
  findAvailableManagedChangeInputs(userId: number, basketId: number, excludeSending: boolean, trx?: TrxToken): Promise<TableOutput[]>;
3927
+ /** Read only the fields needed by the in-memory funding planner. */
3928
+ findAvailableManagedChangeInputCandidates(userId: number, basketId: number, excludeSending: boolean, trx?: TrxToken): Promise<ManagedChangeInputCandidate[]>;
3904
3929
  /** Read the current status of a set of source transactions without loading raw transaction bytes. */
3905
3930
  findTransactionStatusesByIds(userId: number, transactionIds: number[], trx?: TrxToken): Promise<Map<number, TransactionStatus>>;
3931
+ /**
3932
+ * Lock and return the selected funding rows whose source transaction and
3933
+ * action-batch reservation state still permit allocation.
3934
+ */
3935
+ findFundingOutputsForUpdate(userId: number, outputIds: number[], statuses: TransactionStatus[], trx: TrxToken): Promise<Record<number, TableOutput>>;
3906
3936
  abstract getProvenOrRawTx(txid: string, trx?: TrxToken): Promise<ProvenOrRawTx>;
3937
+ /**
3938
+ * Resolve several transaction proofs in one storage operation when the
3939
+ * backend supports it. The default preserves compatibility for custom
3940
+ * providers; SQL and IndexedDB providers override this hot path.
3941
+ */
3942
+ getProvenOrRawTxs(txids: string[], trx?: TrxToken): Promise<Map<string, ProvenOrRawTx>>;
3907
3943
  abstract getRawTxOfKnownValidTransaction(txid?: string, offset?: number, length?: number, trx?: TrxToken): Promise<number[] | undefined>;
3908
3944
  abstract getLabelsForTransactionId(transactionId?: number, trx?: TrxToken): Promise<TableTxLabel[]>;
3909
3945
  abstract getTagsForOutputId(outputId: number, trx?: TrxToken): Promise<TableOutputTag[]>;
@@ -3927,6 +3963,8 @@ declare abstract class StorageProvider extends StorageReaderWriter implements Wa
3927
3963
  deleteActionBatchBlobRecords(_actionBatchId: number, _trx?: TrxToken): Promise<void>;
3928
3964
  getCapabilities(): Promise<StorageCapabilities>;
3929
3965
  protected supportsActionBatchPersistence(): boolean;
3966
+ /** Custom providers may require physical expiry cleanup before reservations are queried. */
3967
+ protected requiresActionBatchCleanupBeforeCreateAction(): boolean;
3930
3968
  beginActionBatch(auth: AuthId, args: BeginActionBatchArgs): Promise<BeginActionBatchResult>;
3931
3969
  extendActionBatch(auth: AuthId, args: ExtendActionBatchArgs): Promise<ExtendActionBatchResult>;
3932
3970
  renewActionBatch(auth: AuthId, batchId: string): Promise<RenewActionBatchResult>;
@@ -4037,6 +4075,7 @@ declare abstract class StorageProvider extends StorageReaderWriter implements Wa
4037
4075
  private handleProvenTxBranch;
4038
4076
  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>;
4039
4077
  getBeefForTransaction(txid: string, options: StorageGetBeefOptions): Promise<Beef>;
4078
+ getBeefForTransactions(txids: string[], options: StorageGetBeefOptions): Promise<Beef>;
4040
4079
  findMonitorEventById(id: number, trx?: TrxToken): Promise<TableMonitorEvent | undefined>;
4041
4080
  relinquishCertificate(auth: AuthId, args: RelinquishCertificateArgs): Promise<number>;
4042
4081
  relinquishOutput(auth: AuthId, args: RelinquishOutputArgs): Promise<number>;
@@ -4579,6 +4618,7 @@ declare class StorageIdb extends StorageProvider implements WalletStorageProvide
4579
4618
  db?: IDBPDatabase<StorageIdbSchema>;
4580
4619
  constructor(options: StorageIdbOptions);
4581
4620
  protected supportsActionBatchPersistence(): boolean;
4621
+ protected requiresActionBatchCleanupBeforeCreateAction(): boolean;
4582
4622
  /**
4583
4623
  * This method must be called at least once before any other method accesses the database,
4584
4624
  * and each time the schema may have updated.
@@ -4646,6 +4686,7 @@ declare class StorageIdb extends StorageProvider implements WalletStorageProvide
4646
4686
  */
4647
4687
  allocateChangeInput(userId: number, basketId: number, targetSatoshis: number, exactSatoshis: number | undefined, excludeSending: boolean, transactionId: number): Promise<TableOutput | undefined>;
4648
4688
  getProvenOrRawTx(txid: string, trx?: TrxToken): Promise<ProvenOrRawTx>;
4689
+ getProvenOrRawTxs(txids: string[], trx?: TrxToken): Promise<Map<string, ProvenOrRawTx>>;
4649
4690
  getRawTxOfKnownValidTransaction(txid?: string, offset?: number, length?: number, trx?: TrxToken): Promise<number[] | undefined>;
4650
4691
  private getRawTxForSlice;
4651
4692
  private getRawTxFull;
@@ -6151,7 +6192,7 @@ interface ChaintracksStorageApi extends ChaintracksStorageQueryApi, ChaintracksS
6151
6192
  //#region ../src/services/chaintracker/chaintracks/Api/BulkIngestorApi.d.ts
6152
6193
  interface BulkIngestorBaseOptions {
6153
6194
  /**
6154
- * The target chain: "main" or "test"
6195
+ * The target chain.
6155
6196
  */
6156
6197
  chain: Chain;
6157
6198
  /**
@@ -6382,6 +6423,7 @@ declare class Chaintracks implements ChaintracksManagementApi {
6382
6423
  private lastPresentHeightMsecs;
6383
6424
  private readonly lastPresentHeightMaxAge;
6384
6425
  private readonly lock;
6426
+ private readonly sourceStatus;
6385
6427
  constructor(options: ChaintracksOptions);
6386
6428
  getChain(): Promise<Chain>;
6387
6429
  /**
@@ -6441,6 +6483,9 @@ declare class Chaintracks implements ChaintracksManagementApi {
6441
6483
  private syncBulkStorage;
6442
6484
  private syncBulkStorageNoLock;
6443
6485
  private runBulkSyncRound;
6486
+ private sourceName;
6487
+ private markSourceSuccess;
6488
+ private markSourceFailure;
6444
6489
  private getMissingBlockHeader;
6445
6490
  private invalidInsertHeaderResult;
6446
6491
  private addLiveHeader;
@@ -6514,6 +6559,12 @@ interface GoChaintracksServiceClientOptions {
6514
6559
  */
6515
6560
  apiPrefix?: string;
6516
6561
  fetch?: typeof fetch;
6562
+ /** Timeout for HTTP requests and the initial SSE handshake. */
6563
+ requestTimeoutMsecs?: number;
6564
+ /** Initial delay before reconnecting a closed or failed SSE stream. */
6565
+ reconnectWaitMsecs?: number;
6566
+ /** Maximum SSE reconnect delay. */
6567
+ reconnectWaitMaxMsecs?: number;
6517
6568
  }
6518
6569
  /**
6519
6570
  * Client for go-chaintracks compatible HTTP services, including Arcade's
@@ -6525,6 +6576,9 @@ declare class GoChaintracksServiceClient implements ChaintracksClientApi {
6525
6576
  chain: Chain;
6526
6577
  private readonly baseUrl;
6527
6578
  private readonly fetcher;
6579
+ private readonly requestTimeoutMsecs;
6580
+ private readonly reconnectWaitMsecs;
6581
+ private readonly reconnectWaitMaxMsecs;
6528
6582
  private readonly subscriptions;
6529
6583
  private nextSubscriptionId;
6530
6584
  constructor(chain: Chain, serviceUrl: string, options?: GoChaintracksServiceClientOptions);
@@ -6547,11 +6601,14 @@ declare class GoChaintracksServiceClient implements ChaintracksClientApi {
6547
6601
  subscribeReorgs(listener: ReorgListener): Promise<string>;
6548
6602
  unsubscribe(subscriptionId: string): Promise<boolean>;
6549
6603
  private subscribe;
6604
+ private runSseWithReconnect;
6605
+ private waitForReconnect;
6550
6606
  private runSse;
6551
6607
  private processSseBuffer;
6552
6608
  private getJson;
6553
6609
  private getJsonOrUndefined;
6554
6610
  private getBinary;
6611
+ private fetchWithTimeout;
6555
6612
  private url;
6556
6613
  private normalizeChain;
6557
6614
  }
@@ -7064,8 +7121,14 @@ declare function validateScriptHash(output: string, outputFormat?: GetUtxoStatus
7064
7121
  declare function toBinaryBaseBlockHeader(header: BaseBlockHeader): number[];
7065
7122
  //#endregion
7066
7123
  //#region ../src/services/providers/WhatsOnChain.d.ts
7124
+ interface WalletToolboxWhatsOnChainConfig extends WhatsOnChainConfig {
7125
+ /** Optional request-start gate used by ChainTracks' shared public-rate scheduler. */
7126
+ requestGate?: () => Promise<void>;
7127
+ }
7067
7128
  declare class WhatsOnChainNoServices extends SdkWhatsOnChain {
7068
- constructor(chain?: Chain, config?: WhatsOnChainConfig);
7129
+ private readonly requestGate?;
7130
+ constructor(chain?: Chain, config?: WalletToolboxWhatsOnChainConfig);
7131
+ private requestWithAnonymousAuthFallback;
7069
7132
  /**
7070
7133
  * POST
7071
7134
  * https://api.whatsonchain.com/v1/bsv/main/txs/status
@@ -7151,7 +7214,7 @@ declare class WhatsOnChainNoServices extends SdkWhatsOnChain {
7151
7214
  */
7152
7215
  declare class WhatsOnChain extends WhatsOnChainNoServices {
7153
7216
  services: Services;
7154
- constructor(chain?: Chain, config?: WhatsOnChainConfig, services?: Services);
7217
+ constructor(chain?: Chain, config?: WalletToolboxWhatsOnChainConfig, services?: Services);
7155
7218
  /**
7156
7219
  * @param txid
7157
7220
  * @returns
@@ -7187,14 +7250,14 @@ declare function parseFileLink(file: string): {
7187
7250
  } | undefined;
7188
7251
  interface WhatsOnChainServicesOptions {
7189
7252
  /**
7190
- * Which chain is being tracked: main, test, or stn.
7253
+ * Which chain is being tracked. The public WhatsOnChain fallback is only
7254
+ * configured automatically for mainnet and testnet.
7191
7255
  */
7192
7256
  chain: Chain;
7193
7257
  /**
7194
- * WhatsOnChain.com API Key
7195
- * https://docs.taal.com/introduction/get-an-api-key
7196
- * If unknown or empty, maximum request rate is limited.
7197
- * https://developers.whatsonchain.com/#rate-limits
7258
+ * Optional WhatsOnChain API key. ChainTracks works without one and limits
7259
+ * anonymous traffic to the documented public rate.
7260
+ * https://docs.whatsonchain.com/
7198
7261
  */
7199
7262
  apiKey?: string;
7200
7263
  /**
@@ -7213,6 +7276,8 @@ interface WhatsOnChainServicesOptions {
7213
7276
  * How long chainInfo is considered still valid before updating (msecs).
7214
7277
  */
7215
7278
  chainInfoMsecs: number;
7279
+ /** Minimum interval between keyless API request starts. Defaults below 3 requests/second. */
7280
+ minRequestIntervalMsecs?: number;
7216
7281
  }
7217
7282
  declare class WhatsOnChainServices {
7218
7283
  options: WhatsOnChainServicesOptions;
@@ -7220,6 +7285,9 @@ declare class WhatsOnChainServices {
7220
7285
  static readonly chainInfo: Array<WocChainInfo | undefined>;
7221
7286
  static readonly chainInfoTime: Array<Date | undefined>;
7222
7287
  static readonly chainInfoMsecs: number[];
7288
+ static readonly chainInfoPromise: Partial<Record<Chain, Promise<WocChainInfo>>>;
7289
+ private static requestTail;
7290
+ private static nextRequestMsecs;
7223
7291
  chain: Chain;
7224
7292
  woc: WhatsOnChain;
7225
7293
  constructor(options: WhatsOnChainServicesOptions);
@@ -7233,6 +7301,7 @@ declare class WhatsOnChainServices {
7233
7301
  */
7234
7302
  getHeaders(fetch?: ChaintracksFetchApi): Promise<WocGetHeadersHeader[]>;
7235
7303
  getHeaderByteFileLinks(neededRange: HeightRange, fetch?: ChaintracksFetchApi): Promise<GetHeaderByteFileLinksResult[]>;
7304
+ private waitForRateLimit;
7236
7305
  }
7237
7306
  interface WocGetHeaderByteFileLinks {
7238
7307
  files: string[];
@@ -7319,6 +7388,28 @@ declare class BulkIngestorWhatsOnChainCdn extends BulkIngestorBase {
7319
7388
  fetchHeaders(before: HeightRanges, fetchRange: HeightRange, bulkRange: HeightRange, priorLiveHeaders: BlockHeader[]): Promise<BlockHeader[]>;
7320
7389
  }
7321
7390
  //#endregion
7391
+ //#region ../src/services/chaintracker/chaintracks/Ingest/BulkIngestorChaintracks.d.ts
7392
+ interface BulkIngestorChaintracksOptions extends BulkIngestorBaseOptions {
7393
+ chain: Chain;
7394
+ chaintracks: ChaintracksClientApi;
7395
+ /** Maximum headers requested from the upstream service at once. */
7396
+ maxHeadersPerRequest?: number;
7397
+ }
7398
+ /**
7399
+ * Uses a go-chaintracks/Arcade-compatible service as a validated bulk source.
7400
+ * Retrieved bytes still pass through ChainTracks' local serialization, hash,
7401
+ * continuity, and genesis checks before storage.
7402
+ */
7403
+ declare class BulkIngestorChaintracks extends BulkIngestorBase {
7404
+ private readonly chaintracks;
7405
+ private readonly maxHeadersPerRequest;
7406
+ private networkChecked;
7407
+ constructor(options: BulkIngestorChaintracksOptions);
7408
+ getPresentHeight(): Promise<number>;
7409
+ fetchHeaders(_before: HeightRanges, fetchRange: HeightRange, bulkRange: HeightRange, priorLiveHeaders: BlockHeader[]): Promise<BlockHeader[]>;
7410
+ private ensureNetwork;
7411
+ }
7412
+ //#endregion
7322
7413
  //#region ../src/services/chaintracker/chaintracks/Ingest/LiveIngestorWhatsOnChainPoll.d.ts
7323
7414
  interface LiveIngestorWhatsOnChainOptions extends LiveIngestorBaseOptions, WhatsOnChainServicesOptions {
7324
7415
  /**
@@ -7432,6 +7523,9 @@ interface ChaintracksStorageNoDbOptions extends ChaintracksStorageBaseOptions {}
7432
7523
  declare class ChaintracksStorageNoDb extends ChaintracksStorageBase {
7433
7524
  static readonly mainData: ChaintracksNoDbData;
7434
7525
  static readonly testData: ChaintracksNoDbData;
7526
+ static readonly stnData: ChaintracksNoDbData;
7527
+ static readonly ttnData: ChaintracksNoDbData;
7528
+ static readonly tstnData: ChaintracksNoDbData;
7435
7529
  constructor(options: ChaintracksStorageNoDbOptions);
7436
7530
  destroy(): Promise<void>;
7437
7531
  getData(): Promise<ChaintracksNoDbData>;
@@ -7544,8 +7638,67 @@ interface ChaintracksStorageIdbSchema {
7544
7638
  }
7545
7639
  //#endregion
7546
7640
  //#region ../src/services/chaintracker/chaintracks/configureChaintracksIngestors.d.ts
7547
- type ChaintracksArgumentsTail = [whatsonchainApiKey?: string, maxPerFile?: number, maxRetained?: number, fetch?: ChaintracksFetchApi, cdnUrl?: string, liveHeightThreshold?: number, reorgHeightThreshold?: number, bulkMigrationChunkSize?: number, batchInsertLimit?: number, addLiveRecursionLimit?: number];
7641
+ interface ChaintracksSourceOptions {
7642
+ /** Preferred go-chaintracks or Arcade source. */
7643
+ chaintracks?: ChaintracksClientApi;
7644
+ /** Disable the credential-free public Arcade default. */
7645
+ disableChaintracks?: boolean;
7646
+ /** Maximum number of headers requested from the remote source at once. */
7647
+ remoteMaxHeadersPerRequest?: number;
7648
+ /** Disable the configured CDN source without changing its URL. */
7649
+ disableCdn?: boolean;
7650
+ /** Disable the keyless WhatsOnChain fallback on mainnet/testnet. */
7651
+ disableWhatsOnChain?: boolean;
7652
+ }
7653
+ type ChaintracksArgumentsTail = [whatsonchainApiKey?: string, maxPerFile?: number, maxRetained?: number, fetch?: ChaintracksFetchApi, cdnUrl?: string, liveHeightThreshold?: number, reorgHeightThreshold?: number, bulkMigrationChunkSize?: number, batchInsertLimit?: number, addLiveRecursionLimit?: number, sources?: ChaintracksSourceOptions];
7548
7654
  type DefaultChaintracksArguments = [chain: Chain, ...options: ChaintracksArgumentsTail];
7655
+ /**
7656
+ * Shared parameters for configuring Chaintracks ingestors.
7657
+ */
7658
+ interface ChaintracksIngestorParams {
7659
+ chain: Chain;
7660
+ whatsonchainApiKey: string;
7661
+ maxPerFile: number;
7662
+ fetch: ChaintracksFetchApi;
7663
+ cdnUrl: string;
7664
+ addLiveRecursionLimit: number;
7665
+ sources: ChaintracksSourceOptions;
7666
+ }
7667
+ interface ResolvedDefaultChaintracksParams extends ChaintracksIngestorParams {
7668
+ maxRetained: number;
7669
+ liveHeightThreshold: number;
7670
+ reorgHeightThreshold: number;
7671
+ bulkMigrationChunkSize: number;
7672
+ batchInsertLimit: number;
7673
+ }
7674
+ interface CreatedChaintracks<TStorage extends ChaintracksOptions['storage']> {
7675
+ chain: Chain;
7676
+ maxPerFile: number;
7677
+ fetch: ChaintracksFetchApi;
7678
+ storage: TStorage;
7679
+ chaintracks: Chaintracks;
7680
+ available: Promise<void>;
7681
+ }
7682
+ declare function resolveDefaultChaintracksArguments(args: DefaultChaintracksArguments): ResolvedDefaultChaintracksParams;
7683
+ declare function toDefaultChaintracksArguments(params: ResolvedDefaultChaintracksParams): DefaultChaintracksArguments;
7684
+ declare function createDefaultBulkFileDataManager(params: ResolvedDefaultChaintracksParams): BulkFileDataManager;
7685
+ declare function createDefaultChaintracksStorageOptions(params: ResolvedDefaultChaintracksParams): {
7686
+ chain: Chain;
7687
+ bulkFileDataManager: BulkFileDataManager;
7688
+ liveHeightThreshold: number;
7689
+ reorgHeightThreshold: number;
7690
+ bulkMigrationChunkSize: number;
7691
+ batchInsertLimit: number;
7692
+ };
7693
+ declare function startChaintracks<TStorage extends ChaintracksOptions['storage']>(params: ResolvedDefaultChaintracksParams, options: ChaintracksOptions): CreatedChaintracks<TStorage>;
7694
+ declare function createAndStartDefaultChaintracks<TStorage extends ChaintracksOptions['storage']>(args: DefaultChaintracksArguments, createOptions: (...args: DefaultChaintracksArguments) => ChaintracksOptions): CreatedChaintracks<TStorage>;
7695
+ /**
7696
+ * Builds the shared portion of ChaintracksOptions that all storage backends
7697
+ * (Knex, Idb, NoDb) have in common: the options shell and bulk/live ingestors.
7698
+ *
7699
+ * The caller is responsible for providing the storage implementation.
7700
+ */
7701
+ declare function buildChaintracksOptionsWithIngestors(params: ChaintracksIngestorParams, storage: ChaintracksOptions['storage']): ChaintracksOptions;
7549
7702
  //#endregion
7550
7703
  //#region ../src/services/chaintracker/chaintracks/createDefaultNoDbChaintracksOptions.d.ts
7551
7704
  declare function createDefaultNoDbChaintracksOptions(...args: DefaultChaintracksArguments): ChaintracksOptions;
@@ -8264,9 +8417,9 @@ interface WalletArgs {
8264
8417
  */
8265
8418
  makeLogger?: MakeWalletLogger;
8266
8419
  /**
8267
- * Internal Wallet Toolbox optimization policy. `auto` negotiates the optional
8268
- * action-batch storage capability; `legacy` always uses per-action storage.
8269
- * This does not change the BRC-100 wallet interface.
8420
+ * Internal Wallet Toolbox optimization policy. `auto` (the default)
8421
+ * negotiates the optional action-batch storage capability; `legacy` always
8422
+ * uses per-action storage. This does not change the BRC-100 wallet interface.
8270
8423
  */
8271
8424
  actionBatchMode?: ActionBatchMode;
8272
8425
  /**
@@ -8857,7 +9010,7 @@ interface UMPTokenInteractor {
8857
9010
  *
8858
9011
  * @param hash The hash of the presentation key.
8859
9012
  * @returns The UMP token if found; otherwise, undefined.
8860
- * @throws Implementations should throw when absence cannot be established authoritatively.
9013
+ * @throws Implementations should throw when no verified token or clean empty response is available.
8861
9014
  */
8862
9015
  findByPresentationKeyHash: (hash: number[]) => Promise<UMPToken | undefined>;
8863
9016
  /**
@@ -8866,7 +9019,7 @@ interface UMPTokenInteractor {
8866
9019
  *
8867
9020
  * @param hash The hash of the recovery key.
8868
9021
  * @returns The UMP token if found; otherwise, undefined.
8869
- * @throws Implementations should throw when absence cannot be established authoritatively.
9022
+ * @throws Implementations should throw when no verified token or clean empty response is available.
8870
9023
  */
8871
9024
  findByRecoveryKeyHash: (hash: number[]) => Promise<UMPToken | undefined>;
8872
9025
  /**
@@ -8894,7 +9047,7 @@ interface UMPTokenLookupDiagnostics {
8894
9047
  }
8895
9048
  type UMPTokenLookupFailureReason = 'lookup-unavailable' | 'lookup-incomplete' | 'token-malformed' | 'token-ambiguous';
8896
9049
  /**
8897
- * Raised when UMP absence cannot be established authoritatively.
9050
+ * Raised when a UMP lookup yields neither a verified token nor a clean empty response.
8898
9051
  *
8899
9052
  * Callers must offer retry/recovery rather than treating this error as a new
8900
9053
  * account. Diagnostics contain counts only and never hashes, keys, or tokens.
@@ -8954,9 +9107,37 @@ declare class OverlayUMPTokenInteractor implements UMPTokenInteractor {
8954
9107
  */
8955
9108
  findByRecoveryKeyHash(hash: number[]): Promise<UMPToken | undefined>;
8956
9109
  private findToken;
9110
+ /**
9111
+ * Picks the newest rendition among distinct verified tokens, when possible.
9112
+ *
9113
+ * The on-chain UMP protocol expresses token updates by consumption: the
9114
+ * transaction creating a new rendition spends the previous rendition's
9115
+ * outpoint (there is no rendition counter field in the current format).
9116
+ * A candidate is therefore superseded when any other candidate's ancestry
9117
+ * (available from its BEEF) spends the candidate's outpoint.
9118
+ *
9119
+ * @returns The single unsuperseded candidate, or undefined when supersession
9120
+ * cannot be established for every stale candidate (e.g. forked tokens).
9121
+ */
9122
+ private resolveNewestToken;
9123
+ /**
9124
+ * Whether `tx` spends an input whose source output (available in the BEEF)
9125
+ * decodes as a UMP token sharing the candidate's presentation or recovery
9126
+ * hash — on-chain proof that the candidate is an update of a same-identity
9127
+ * predecessor rather than an independently minted token.
9128
+ */
9129
+ private consumesSameIdentityToken;
9130
+ /**
9131
+ * Accumulates every outpoint spent by `tx` and by the ancestor transactions
9132
+ * embedded in its BEEF, so supersession is detected even when intermediate
9133
+ * renditions are absent from the lookup answer. Iterative so arbitrarily
9134
+ * long update chains cannot exhaust the call stack.
9135
+ */
9136
+ private collectSpentOutpoints;
8957
9137
  private emptyLookupDiagnostics;
8958
9138
  private toLookupDiagnostics;
8959
9139
  private lookupDiagnosticAttributes;
9140
+ private captureLookupCompleted;
8960
9141
  private captureLookupFailure;
8961
9142
  /**
8962
9143
  * Creates or updates (replaces) a UMP token on-chain. If `oldTokenToConsume` is provided,
@@ -9265,6 +9446,11 @@ declare class CWIStyleWalletManager implements WalletInterface {
9265
9446
  }
9266
9447
  //#endregion
9267
9448
  //#region ../src/services/createDefaultWalletServicesOptions.d.ts
9449
+ /**
9450
+ * Returns the credential-free default ChainTracks client for a supported
9451
+ * public network, or an operator-configured client for stn/tstn.
9452
+ */
9453
+ declare function createDefaultChaintracksClient(chain: Exclude<Chain, 'mock'>): ChaintracksClientApi;
9268
9454
  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,
9269
9455
  /**
9270
9456
  * Optional Arcade endpoint. When provided (or when a default exists for the chain via
@@ -9281,7 +9467,7 @@ arcadeApiKey?: string,
9281
9467
  arcadeCallbackToken?: string]): WalletServicesOptions;
9282
9468
  /**
9283
9469
  * Default Arcade (bsv-blockchain/arcade) endpoint per chain.
9284
- * Returns undefined when no public default is known for the chain (e.g. testnet not yet deployed).
9470
+ * Returns undefined when no public default is known for the chain.
9285
9471
  */
9286
9472
  declare function arcadeDefaultUrl(chain: Chain): string | undefined;
9287
9473
  declare function arcDefaultUrl(chain: Chain): string;
@@ -10782,5 +10968,5 @@ declare class WalletPermissionsManager implements WalletInterface {
10782
10968
  private buildActiveRequestKey;
10783
10969
  }
10784
10970
  //#endregion
10785
- 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 };
10971
+ 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 };
10786
10972
  //# sourceMappingURL=index.client.d.mts.map