Interface IContractDiscoveryProvider
- Namespace
- NArk.Abstractions.Recovery
- Assembly
- NArk.Abstractions.dll
Probes a single derivation index of an HD wallet to determine whether any
contract derivable from that index has ever been used. Each implementation
answers from a different source of truth (arkd indexer, on-chain UTXO set,
swap history, etc.) and they are aggregated by
HdWalletRecoveryService using a logical OR — if any provider sees
usage at an index, the index counts as used and the gap counter resets.
public interface IContractDiscoveryProvider
Remarks
Providers are stateless and may be queried concurrently for different indices (and concurrently with each other for the same index).
As a rule, providers SHOULD return reconstructed contracts via Contracts and let the orchestrator persist them once recovery completes — this keeps the orchestrator the single writer and lets it dedupe across providers.
The deliberate exception is when a provider already has a richer import
path of its own that produces metadata the orchestrator cannot reconstruct
— one that writes the contract together with a row linking it to whatever
the provider discovered, in a single transaction. Returning those contracts
back through the orchestrator would either lose that linkage or duplicate
the write. Such providers set Used to
true and leave Contracts empty, so the
orchestrator does not re-import what they already persisted.
No in-tree provider takes that path today; the one that did went with the swaps package. The rule is kept rather than retired because it is what Used exists for — a provider reporting a hit it has already persisted itself.
Properties
Name
Short identifier used in log lines and the recovery report
(e.g. "indexer", "boarding").
string Name { get; }
Property Value
Methods
DiscoverAsync(ArkWalletInfo, OutputDescriptor, int, CancellationToken)
Probe whether any contract derivable from userDescriptor
at index has ever been used.
Task<DiscoveryResult> DiscoverAsync(ArkWalletInfo wallet, OutputDescriptor userDescriptor, int index, CancellationToken cancellationToken = default)
Parameters
walletArkWalletInfoThe HD wallet being recovered.
userDescriptorOutputDescriptorThe output descriptor at the given index — concrete (no remaining
/*), already derived fromwallet.AccountDescriptor.indexintThe derivation index being probed.
cancellationTokenCancellationTokenCancellation token.
Returns
- Task<DiscoveryResult>
A DiscoveryResult describing whether the index was used and, if so, the reconstructed contracts to persist.