VaultGate
Mock by default. Every example on this page runs against an in-memory CDR — no wallet, no chain, no testnet funds. Swap mockKit for config + apiUrl to go live on Aeneid.
Live preview
Press subscribe to run the full mock flow — condition check, payment, threshold key-share collection, and local decryption. It mirrors the real 2-step subscribeAndAccess path against the actual createMockCdrKit() from @cdr-kit/core.
import { CdrProvider, VaultGate } from "@cdr-kit/react";
import { createMockCdrKit } from "@cdr-kit/core";
export function SignalCard() {
return (
<CdrProvider mockKit={createMockCdrKit()}>
<VaultGate
uuid={4200}
fallback={<SubscribeButton price="5 $IP" />}
loading={<CdrSkeleton lines={3} />}>
{(data) => <pre>{new TextDecoder().decode(data)}</pre>}
</VaultGate>
</CdrProvider>
);
}Usage
The simplest gate: pass a uuid and a render-prop. With auto, VaultGate requests access on mount; without it, it waits for an imperative trigger from the access hook.
<VaultGate uuid={4200} auto fallback={<SubscribeButton />}>
{(data) => <SignalView bytes={data} />}
</VaultGate>Props
| Prop | Type | Default | Description |
|---|---|---|---|
| uuidrequired | number | — | The CDR vault id. Read it from the VaultCreated event — never predict it (it's a global counter). |
| childrenrequired | (data: Uint8Array) => ReactNode | — | Render-prop called with the decrypted bytes once the condition is satisfied. |
| auto | boolean | false | Request access on mount instead of waiting for an imperative trigger. |
| fallback | ReactNode | null | Rendered while the condition is unmet — typically your subscribe / pay button. |
| loading | ReactNode | <CdrSkeleton/> | Rendered during the ~15s threshold read while key shares are collected. |
| accessAuxData | Hex | "0x" | Optional ABI-encoded auxiliary data passed to the read condition (e.g. a tier-gate license tokenId). |
States
VaultGate is a thin wrapper over useAccessVault, whose discriminated status drives what renders:
idle/error— condition unmet → rendersfallback.collecting-partials— collecting key shares (the ~15s read) → rendersloading.ready— threshold met, decrypted → renderschildren(data).
Mock mode
Wrap your tree in a CdrProvider with a createMockCdrKit() and the entire component surface works with zero chain dependencies — ideal for Storybook, tests, and the previews on this page. Going live is a one-line swap:
// local / tests — no wallet, no chain
<CdrProvider mockKit={createMockCdrKit()}> … </CdrProvider>
// live on Aeneid — same children, real round-trip
<CdrProvider config={wagmiConfig} apiUrl={apiUrl}> … </CdrProvider>