Expand description
Splice Scan’s HTTP API, asked directly or through a validator’s scan-proxy.
Scan is the service each Super Validator runs to publish what the DSO
decided and what happened on the network: the DSO party, the Amulet rules,
the mining rounds, traffic balances, the update history, snapshots of the
active contracts. The paths and payloads here come from Splice’s OpenAPI
documents, scan.yaml and scan-proxy.yaml (vendored under
testdata/openapi/), and the methods are named after what they return.
§Two ways in
ScanClient::newasks a Scan itself, at<scan>/api/scan. It serves everything here.ScanClient::through_validatorasks a validator’s scan-proxy, at<validator>/api/validator. The validator reads from several Super Validators’ Scans and answers when enough of them agree, and it authenticates every request, so this route needs a token (with_token,with_token_source). It serves the part of the API a wallet or an application backend needs, not the traffic, history and snapshot-page reads, which are refused before anything is sent; of the snapshot reads it serves onlyholdings_summary.
A Scan asked directly is one Super Validator’s word. This client does not compare several Scans; the scan-proxy is the route that does.
§Why an application needs it
Some choices take contracts the DSO owns: the AmuletRules, the open
mining round, a provider’s FeaturedAppRight. Creating a
TransferPreapproval is one such choice. The submitting party does not
see those contracts, so they are passed as disclosed contracts, and Scan
is where they are published. ScanClient::amulet_rules and
ScanClient::latest_open_mining_round return them with
disclosed, which is what a submission
attaches. ScanClient::featured_app_right returns its contract without
a synchronizer: disclose it on the rules’ one, with
ScanContract::disclosed.
§Splice versions
Written against the documents of Splice 0.10.3. On an older Scan or
validator: dso falls back to the /v0/dso every
release serves; the two snapshot page reads
(acs_snapshot,
holdings_state) need Splice 0.7.5, which
is where their /v2 paths appeared;
holdings_summary needs 0.6.3. Everything
else is served by Splice 0.6.0 and later.
§Stability
Splice tags each Scan endpoint external or internal. The external ones
are its public API. The internal ones may change in any Splice release,
and two of them are the only source of a contract an application may
need: featured_app_right and
transfer_preapproval_by_party.
Asked of a Scan directly, these are refused unless the client was built
with with_internal_endpoints,
which is the caller accepting that. Through a validator’s scan-proxy they
are part of the proxy’s own API and need no opt-in.
amulet_rules needs no opt-in either way:
the external API publishes the rules with the rest of the DSO’s contracts,
and that is where a Scan is asked for them. With the opt-in it asks the
internal endpoint, which returns the one contract and nothing else.
Contract payloads, choice arguments and results stay JSON
(serde_json::Value): they are Daml values of whatever template the
contract has, in the compact encoding the Ledger JSON API uses.
Structs§
- AcsSnapshot
- A page of a snapshot of the active contracts.
- Active
Contract - A contract in a snapshot.
- AnsEntry
- An entry in the Amulet Name Service.
- Contract
With State - A contract and the synchronizer it is assigned to.
- DsoInfo
- What the DSO is and the contracts that say how it runs.
- History
Position - A point in Scan’s history: everything up to and including it has been read. Pass it back to read on from there.
- Holdings
Summaries - What some parties held at a snapshot.
- Holdings
Summary - What one party held at a snapshot. Amounts are decimal strings, as Daml
JSON writes a
Decimal. - Mining
Rounds - The mining rounds that rewards can be registered in, and the ones whose rewards are being computed.
- Scan
Assignment - A contract arriving on a synchronizer.
- Scan
Client - A client for one Scan, or for one validator’s scan-proxy.
- Scan
Contract - A contract as Scan publishes it.
- Scan
Created Event - A contract’s creation.
- Scan
Event Item - One entry of the event history: an update, the mediator’s verdict on it, or both.
- Scan
Exercised Event - A choice exercised on a contract.
- Scan
Info - One Super Validator’s Scan.
- Scan
Reassignment - A contract leaving one synchronizer or arriving on another.
- Scan
Transaction - A transaction in the update history.
- Scan
Unassignment - A contract leaving a synchronizer.
- Snapshot
Request - Which snapshot of the active contracts to read, and which part of it.
- Synchronizer
Scans - The Scans the Super Validators run for one synchronizer.
- Traffic
Status - How much traffic a member has bought and used on a synchronizer.
Enums§
- Reassignment
Event - The two halves of a reassignment.
- Scan
Event - An event of a transaction.
- Scan
Update - One entry of the update history.