Documentation Index
Fetch the complete documentation index at: https://docs.story.foundation/llms.txt
Use this file to discover all available pages before exploring further.
Observer
TheObserver sub-client is always available, even without a walletClient. It provides read-only access to CDR and DKG state.
maxEncryptedDataSize, operational threshold) over the EVM publicClient, and
DKG state (active round, global public key, threshold, validators,
attestations) over the Story-API REST endpoint configured by apiUrl.
Round-keyed DKG snapshots are cached for the lifetime of the Observer for
rounds in the stable Active and Ended stages, with in-flight request
deduplication.
getActiveRound() always re-fetches, since the active round
can transition at any time.Methods
- getVault
- getAllocateFee
- getWriteFee
- getReadFee
- getMaxEncryptedDataSize
- getOperationalThreshold
- getActiveRound
- getGlobalPubKey
- getParticipantCount
- getThreshold
- getThresholdAt
- getRegisteredValidators
- getValidatorAttestations
getVault
Fetch a vault’s on-chain data by UUID.| Method | Type |
|---|---|
getVault | (uuid: number) => Promise<Vault> |
uuid: The vault’s unique identifier (uint32)
Example
Vault
getAllocateFee
Returns the current fee (in wei) required to allocate a new vault.| Method | Type |
|---|---|
getAllocateFee | () => Promise<bigint> |
Example
getWriteFee
Returns the current fee (in wei) required to write data to a vault.| Method | Type |
|---|---|
getWriteFee | () => Promise<bigint> |
Example
getReadFee
Returns the current fee (in wei) required to submit a read request.| Method | Type |
|---|---|
getReadFee | () => Promise<bigint> |
Example
getMaxEncryptedDataSize
Returns the maximum encrypted payload size (in bytes) supported by the on-chain vault path. The CDR contract treats this as a constant, so it is cached for the lifetime of the Observer.| Method | Type |
|---|---|
getMaxEncryptedDataSize | () => Promise<bigint> |
Example
getOperationalThreshold
Returns the DKG operational threshold as a basis-points constant read from the DKG contract (e.g.,667 = 66.7%).
| Method | Type |
|---|---|
getOperationalThreshold | () => Promise<bigint> |
Example
getActiveRound
Returns the currently active DKG round number. Always hits the Story-API REST endpoint — the active round can transition at any time, so it is never served from cache.| Method | Type |
|---|---|
getActiveRound | () => Promise<number> |
Example
getGlobalPubKey
Returns the DKG global public key from the active round, used for TDH2 encryption. This is an Ed25519 point with a 2-byte curve-code prefix (0x043f),
34 bytes total, so it can be passed directly to the WASM TDH2 functions.
| Method | Type |
|---|---|
getGlobalPubKey | () => Promise<Uint8Array> |
Example
getParticipantCount
Returns the number of validators selected to participate in the active DKG round.| Method | Type |
|---|---|
getParticipantCount | () => Promise<number> |
Example
getThreshold
Returns the absolute threshold for the currently active DKG round — the minimum number of partial decryptions needed to combine. IfminThresholdRatio is set
on the client, the effective value is
max(network.threshold, ceil(participants * minThresholdRatio)).
| Method | Type |
|---|---|
getThreshold | () => Promise<number> |
Example
Use this for UI / status display. Do not use it to validate a specific
partial-decryption bucket from
collectPartials — a bucket carries its own
round, which can differ from the active round during DKG rollover. Use
getThresholdAt for that.getThresholdAt
Returns the absolute threshold for a specific DKG round, computed against that round’s own participant total. Used internally bycollectPartials so a DKG
rollover mid-poll does not measure a bucket against the wrong round.
| Method | Type |
|---|---|
getThresholdAt | (round: number) => Promise<number> |
round: The DKG round number to compute the threshold for
Example
getRegisteredValidators
Returns a map of validator address →commPubKey bytes for the given DKG round
(defaults to the active round). Only includes validators with Finalized
status. The commPubKey is the secp256k1 public key the validator’s TEE uses to
sign partial decryption responses.
| Method | Type |
|---|---|
getRegisteredValidators | (params?: { round?: number }) => Promise<Map<string, Uint8Array>> |
params.round(optional): DKG round number. Defaults to the active round.
Example
getValidatorAttestations
Returns a map of validator address →enclaveReport (raw SGX quote bytes) for
the given DKG round (defaults to the active round). Only includes validators
with Finalized status. Shares a per-round cache with getRegisteredValidators.
| Method | Type |
|---|---|
getValidatorAttestations | (params?: { round?: number }) => Promise<Map<string, Uint8Array>> |
params.round(optional): DKG round number. Defaults to the active round.
Example
Use with
verifyAttestation() to verify each validator’s TEE enclave before
trusting their partial decryptions.
