Reading data
All reads go through one or more RPC endpoints via client.reader (a
NetworkReader). They consume no network fees and no credits.
NetworkReader
Build it via client.reader, or directly with new NetworkReader(network).
Prism state
| Method | Returns |
|---|---|
getPrismOwner(cloudId) | Address |
getPrismTokens(cloudId) | bigint (DPC balance) |
getPrismInfo(cloudId) | PrismInfo, the above in one parallel call |
Slot payloads
Raw, still-encrypted slot values:
| Method | Returns | Note |
|---|---|---|
getData(cloudId, dataId) | Payload | raw payload |
getDataWithTimestamp(cloudId, dataId) | { payload, timestamp } | plus the write timestamp |
getDataFrom(cloudId, dataIds[]) | Payload[] | several in one call |
dataExists(cloudId, dataId) | boolean |
Account metadata
getNonce(account) returns the account's current request nonce, used by the
signing layer for delegated execution.
Paginated enumerations
For lists whose size is unpredictable (a prism can hold millions of files), never load everything at once. Each list comes in three forms: load-all (convenience), by-slice, and streaming iterator.
| List | load all | by slice | streaming |
|---|---|---|---|
| user's prisms | getUserPrisms(user) | getUserPrismsSlice(user, offset, limit) | iterateUserPrisms(user, sliceSize?) |
| data keys | getDataKeys(cloudId) | getDataKeysSlice(cloudId, offset, limit) | iterateDataKeys(cloudId, sliceSize?) |
| writers | getWriters(cloudId) | getWritersSlice(cloudId, offset, limit) | iterateWriters(cloudId, sliceSize?) |
The raw *Count / *ByIndex getters (for example getDataCount,
getDataKeyByIndex) are also available.
A slice is:
interface Slice<T> { items: T[]; offset: number; limit: number; total: bigint; hasMore: boolean }The iterators (iterate*) are async generators that walk the whole list
across several requests (default sliceSize = 200), reading each window in
parallel, without holding it all in memory.
for await (const dataId of client.reader.iterateDataKeys(cloudId)) {
// process one key at a time
}Decrypted reads (CloudReader)
The NetworkReader returns ciphertext. To read a slot and decrypt it in
one step, pair a CloudStandard (which holds the key) with a
SlotSource and a cloudId. Build it via std.reader(source, cloudId);
source is anything with a getData(cloudId, dataId) method, and
NetworkReader satisfies it.
const view = std.reader(client.reader, cloudId);
const keySlot = await view.key(); // clear
const enc = await view.encryption(); // clear
const metadata = await view.metadata(); // decrypted
const providers = await view.providers(); // decrypted
const fileIndex = await view.file("report.pdf"); // decrypted
const ciphertext = await view.raw(dataId); // raw payload| Method | Returns | Encrypted? |
|---|---|---|
key() | KeySlot | clear |
encryption() | EncryptionConfig | clear |
metadata() | MetadataSlot | decrypted |
providers() | ProvidersSlot | decrypted |
file(name) | FileIndex | decrypted |
raw(dataId) | Hex | raw ciphertext |
A public-only key reads the clear slots fine but throws on the sealed
ones; this is the access-control boundary. The SlotSource interface also
accepts optional getDataFrom and dataExists methods for richer sources.

