Skip to main content

Crate quai_browser

Crate quai_browser 

Source
Expand description

Native-independent browser boundaries plus wasm-only Fetch and injected Quai adapters.

Browser APIs require an application-selected endpoint/provider. Construction performs no network requests and never prompts for accounts. Heavy derivation and persistent wallet storage remain separate worker/storage responsibilities.

Structs§

BrowserConfig
Browser resource limits. Concurrent calls fail fast when capacity is exhausted.
BrowserFetchTransport
Browser Fetch transport with streaming response limits, CORS and credential omission.
BrowserResourceFetch
Window/worker resource backend with streamed decoded-body limits and abort on drop. Browser CORS/header/compression policies apply. Opaque redirects reject; callers must explicitly supply a resolved URL rather than requesting auto-follow.
BrowserSnapshot
Monotonic snapshot revision and opaque bytes. A tombstone retains its revision, preventing stale tabs from recreating deleted state with an old revision.
BrowserSnapshotStore
IndexedDB snapshots with atomic compare-and-exchange across tabs and workers. The caller owns snapshot serialization and encryption. No plaintext secret origin belongs in this store. A cancelled write may already have committed; read the current revision before deciding whether to retry.
BrowserSnapshotUpdate
One entry in an atomic multi-journal commit. Bytes must be public or encrypted.
BrowserSocketConfig
Browser WebSocket request and notification resource limits.
BrowserStorageScope
Exact network and wallet namespace. Bind it as associated data when encrypting the snapshot: database names alone do not authenticate ciphertext ownership.
BrowserSubscription
One bounded subscription. Queue overflow is explicit and requires backfill; receipt of a notification is never a canonicality or finality assertion. Drop attempts bounded unsubscribe; if cleanup capacity is exhausted it closes the shared session. Use explicit unsubscribe when completion matters.
BrowserWaitConfig
Explicit browser transaction-wait limits. Milliseconds must be positive and fit a browser timer; polling attempts are independently bounded. No implicit defaults.
BrowserWebSocketTransport
One explicit browser/worker WebSocket connection. Clones share bounded requests and subscriptions. No reconnect, retry, chain inference or write replay occurs. Last-owner drop closes the socket; an active subscription also owns the session.
InjectedProvider
Explicit adapter for an application-selected Quai EIP-1193 provider object.
InjectedSubmissionTransport
Explicit transport capability for canonical, already-signed Quai/Qi payloads. Compose with quai_provider::Provider to retain its expected transaction ID, acknowledgement validation and ambiguous-submission errors. All other wallet signing/permission/sending methods remain unavailable through Transport.
TypedData
An immutable, validated EIP-712 RPC document with its cached signing hash.
WalletSendAcknowledgement
Structurally valid wallet acknowledgement, pending independent transaction verification. Unlike raw submission, there was no locally signed payload from which to compute its ID.
WalletSendIdentity
Original request identity to retain before awaiting a wallet-mediated send. The signing digest is NOT a transaction ID. A wallet can change fields in its approval flow; after an unknown outcome this identity alone cannot prove reuse safe.
WalletSendObservation
Independently verified transaction bytes and explicit comparison to the request.

Enums§

BrowserError
Sanitized browser failures. No provider strings, payloads, keys or URLs are retained.
BrowserReceiptWaitError
Wait failure never cancels a transaction or authorizes releasing its claims.
DomainPolicy
Explicit policy for typed-data domains that omit a chain identifier.
WalletSendError
Whether the adapter failed before dispatch or after submission could occur.

Functions§

compare_exchange_snapshots
Commit 1..=128 distinct namespaces in one IndexedDB transaction, with a combined 16 MiB payload limit. Any conflict/error aborts every update. Returns revisions in input order. Cross-database updates and duplicate keys reject. Cancellation after dispatch may commit all entries: re-read before retrying.
fill_random
Fill at most 65,536 bytes using secure-context Web Crypto, with no fallback PRNG. No wallet key storage or generation is performed automatically.
wait_for_account_transaction
Wait for a verified original or unregistered same-sender/nonce competitor. Uses the same portable page tracker as native waiting and window/worker monotonic timers. max_polls bounds completed pages/idle observations; an overall deadline also covers stalled reads. No Send requirement, custody adoption, claim release or submission. Missing history never advances the cursor; changed anchors return an error requiring explicit restart at a trusted height. Browser suspension may delay timeout delivery but cannot allow success after observed expiry. Dropping the future clears timers and the active read future.
wait_for_contract_code
Wait under an observable monotonic deadline and completed-observation budget. Empty code or changed anchors remain pending; mismatched genesis/runtime or other source errors stop. Suspension can delay notification but cannot permit success after observed expiry. Drop clears timers and active reads. No Send bound, hidden deployment, binding mutation or finality assertion is involved.
wait_for_receipt
Wait using portable confirmation checks and window/worker monotonic timers. At most two timers are held; drop clears them and drops the active read future. Non-Send transports are supported. The deadline covers RPCs and polling delays; delayed background callbacks cannot return success after observed clock expiry. Browser scheduling is not real-time and confirmations do not prove finality. Execution-failed receipts remain explicit successful observations.
wait_for_transaction
Wait for rechecked transaction inclusion, including Qi without receipts. Explicit monotonic deadline covers stalled RPCs; max_polls bounds completed observations. Browser suspension can delay delivery but not permit success after observed expiry. Drop clears timers and active reads. No submission, signature verification, replacement adoption or release of custody claims.

Type Aliases§

BrowserAccountWaitError
Account replacement waits share bounded timer/observation error information.
BrowserTransactionWaitError
Shared deadline, completed-observation and provider-error information.