ScanClient

class ScanClient(baseUrl: String, http: OkHttpClient = OkHttpClient())

Read layer over a Super Validator's Scan API (.../api/scan).

Covers the reads a wallet needs from the network's public index: the DSO party, ANS name resolution (name-based sending), aggregated holdings from scan's server-side ACS snapshots, the AmuletRules fee configuration, open mining rounds (amulet price), and per-member synchronizer traffic status.

Note the base URL differs from TransferRegistryClient's: registry endpoints mount at the vhost root (/registry/...), scan endpoints under /api/scan.

Constructors

Link copied to clipboard
constructor(baseUrl: String, http: OkHttpClient = OkHttpClient())

Types

Link copied to clipboard
data class AnsEntry(val name: String, val party: String, val url: String, val description: String)

One ANS (Amulet Name Service) entry — a name bound to a party.

Link copied to clipboard
data class HoldingsSummary(val partyId: String, val totalUnlockedCoin: BigDecimal, val totalLockedCoin: BigDecimal, val totalCoinHoldings: BigDecimal)

Aggregate Amulet totals for one owner party in a scan ACS snapshot.

Link copied to clipboard
data class HoldingsSummaryResult(val recordTime: Instant, val migrationId: Long, val summaries: List<ScanClient.HoldingsSummary>)

Aggregated holdings answered from one server-side ACS snapshot.

Link copied to clipboard
data class MemberTrafficStatus(val totalConsumedBytes: Long, val totalLimitBytes: Long, val totalPurchasedBytes: Long)

A sequencer member's extra-traffic accounting, all in bytes. Purchased traffic becomes spendable once the sequencer incorporates it: totalLimitBytes catching up to totalPurchasedBytes means all purchases are live (either can briefly lead the other, as the two numbers come from the sequencer and scan's ledger ingestion respectively).

Link copied to clipboard
data class TransferPreapprovalInfo(val contractId: String, val receiver: String?, val provider: String?, val expiresAt: Instant?)

An active TransferPreapproval: senders can transfer to receiver directly.

Functions

Link copied to clipboard
suspend fun amuletRulesConfig(asOf: Instant? = null): AmuletRulesConfig

The AmuletRules configuration effective at asOf (/v0/amulet-rules): the USD transfer-fee schedule, synchronizer traffic pricing, and the active synchronizer id — the reads that feed TransferFeeEstimator and ValidatorClient.buyTraffic.

Link copied to clipboard
suspend fun dsoPartyId(): String

The party id of the DSO — the instrument admin for Amulet.

Link copied to clipboard
suspend fun holdingsSummary(ownerPartyIds: List<String>, asOf: Instant? = null, migrationId: Long? = null): ScanClient.HoldingsSummaryResult?

Server-side aggregated Amulet balances for ownerPartyIds (/v1/holdings/summary) — scan folds its ACS snapshot so apps don't fold the full ACS client-side.

Link copied to clipboard
suspend fun latestMigrationId(): Long

The network's latest synchronizer-migration id (/v0/migrations/last) — the id scan's ACS snapshots are addressed by. holdingsSummary resolves this automatically; fetch it yourself only to pin the id across many calls.

Link copied to clipboard
suspend fun listAnsEntries(pageSize: Int = 100, namePrefix: String? = null): List<ScanClient.AnsEntry>

Lists ANS entries, optionally filtered by a name prefix.

Link copied to clipboard

Resolves an ANS name to its entry, or null if unregistered.

Link copied to clipboard
suspend fun memberTrafficStatus(synchronizerId: String, memberId: String): ScanClient.MemberTrafficStatus?

The extra-traffic status of one sequencer member (/v0/domains/{id}/members/{member}/traffic-status) — the read that shows a ValidatorClient.buyTraffic purchase landing.

Link copied to clipboard

The currently open mining rounds (/v0/open-and-issuing-mining-rounds), in ascending round order. Each round carries the USD amulet price that taps and fee conversions use. Note the list includes rounds whose OpenMiningRound.opensAt is still in the future — pick the round a submission would execute against with latestUsable.

Link copied to clipboard
suspend fun partyParticipantId(synchronizerId: String, partyId: String): String?

The participant hosting partyId on synchronizerId (/v0/domains/{id}/parties/{party}/participant-id), as a sequencer member id (PAR::name::fingerprint) — the memberId that memberTrafficStatus expects. Null if scan doesn't know the party.

Link copied to clipboard

The active preapproval for partyId, or null if none — the signal that transfers to this party settle in one step ("direct") instead of the two-step offer flow.