EndstateProvider is the root of the React surface, imported from @endstate-sdk/web/react. It constructs one EndstatePublicClient for its lifetime, captures and verifies the landing redirect tap on mount (unless autoVerify is false), and, when a wallet is configured, provisions the customer’s wallet. Every hook - useSession, useWallet, useTap, useClaim, useTransfer, and useEndstateClient - reads from this one provider and throws if used outside it.
React is an optional peer dependency (^19), needed only for the /react subpath. The package root stays React-free.
Example
EndstateProvider renders in the browser. Mount it inside a Client Component ("use client"); capture, verify, and wallet provisioning all run in effects, so server rendering is a no-op.
Parameters
EndstatePublishableKey | (() => EndstatePublishableKey | Promise<EndstatePublishableKey>)
required
Your publishable key (
end_pk_...), or a function that returns one (sync or
async) when you resolve it at runtime. A secret key is rejected by the type
and again at runtime. Narrow and validate a string with
publishableKey() from core.EndstateWalletConfig
Configures the customer wallet. Omit it entirely on pages that do not
provision a wallet - the tap flow needs no wallet. When present, its
getIdentityToken callback supplies the identity credential and enabled
gates when provisioning starts. See the wallet fields below.readonly TapSource[]
Tap sources the client dispatches to. Defaults to
defaultTapSources() -
the landing redirect plus in-page Web NFC where the device supports it.boolean
default:"true"
When
true (the default), the provider captures the landing redirect tap and
verifies it on mount, so a page opened by a tap has a session ready without
any extra call. Set it to false to capture and verify yourself through
useSession().verify or
useTap.string
Overrides the API base URL the client calls. Leave it unset in product code;
it exists for testing against a non-default host.
ReactNode
required
The subtree that reads Endstate state through the hooks.
Wallet configuration
The optionalwallet prop takes an EndstateWalletConfig:
() => string | Promise<string>
required
Supplies the identity credential each wallet session is established from. It
is called fresh for every session establishment and must never return a cached
value - the credential is single-use and short-lived. Your own backend mints
it from your login; it is a placeholder function here (
getIdentityToken: () => mintIdentityToken()), never a fake fetch route. See the identity
credential and Bring your own
auth.boolean
default:"true"
Auth-readiness gate. Provisioning waits until this is
true, so pass your
sign-in state (enabled: isSignedIn) to defer wallet setup until the customer
is authenticated. Left at its default (true), provisioning starts at mount,
which preserves page-load setup timing for apps with no auth gate.HTMLElement
default:"document.body"
Where the hidden wallet frame is appended. Override only when
document.body
is not the right mount point.{ frameReadyMs?: number; sessionMs?: number }
Wait budgets in milliseconds.
frameReadyMs bounds the frame handshake
(default 5000); sessionMs bounds identity issuance and session
establishment (default 30000). A stage that exceeds its budget fails with
wallet.timeout.The wallet frame is provisioned only while
enabled is true. With enabled: false, useWallet().status reports
"idle" and no identity credential is requested; it flips to "provisioning"
the moment the gate opens.There is no
environment field. The wallet frame origin is compiled into the
package and is not configurable from the browser - a security property of the
design.Returns
A React element that provides Endstate context tochildren. Read state through
the hooks below.
See also
useSession
The verified item and session status from the landing tap.
useWallet
The provisioned account, status, and refresh.
useClaim
Claim ownership in a single call.
createEndstateClient
The vanilla client factory, for pages without React.

