The same feature at three levels
Every feature is available at several levels. Here is one feature - listing offers - at all three:- You pick a rung per feature, not per application. Rendering
<CheckoutContainer>while drivingpassage.offers.list()yourself is normal, not a compromise. The rungs are built from each other, so mixing them cannot desynchronize anything. - A feature may stop at a rung, but never skips one. A feature with a component always has the hooks and the namespace beneath it, so dropping a rung never leaves you without a way forward.
- Each rung exposes its entry points, not its parts. Per feature, the public surface is the root container (L3), the viewmodel behind it and the data hooks it is built from (L2), and the namespaces (L1). The views, steps and sub-screens a container composes are internal, so there is no supported way to render the SDK’s markup over your own logic: take the container, or build your UI on the viewmodel and hooks.
L2 and L3 are browser-only, because a backend renders nothing. L1 is the only level present everywhere, which is why
passage.offers.list() reads identically on your server and in your React tree. See the grid in the quickstart.Namespaces
The entire L1 surface is namespaces.passage.init() is the only top-level member on the browser client, because it is lifecycle rather than domain; PassageServer has none at all. So every operation you will ever want is passage.{something}.{verb}(), and finding it means picking the right noun.
Two naming rules tell you which noun:
- CoinList’s own capabilities are named after what they do:
auth,offers,requirements,wallets,erc20,tokenSale,tokens, and the browser-onlysupport. - A third party’s namespace is named after the provider:
superstate,ondo,centrifuge. Not after what it does. A second provider ships its own swap, sopassage.swapcould only ever have meant one of them - which is exactly why it was renamed in v0.11.0.
offers.list() rather than offers.listOffers():
Any method taking more than one argument takes a single params object. The exception is the app-level token on
PassageServer, an optional second argument to offers.listPage, offers.get, and requirements.forOffer. Most single-argument methods take the value directly. You never have to remember an argument order.
Outside passage.auth, API-backed methods throw NotAuthenticatedError without a session they accept. Most need a CoinList user, so a wallet sign-in session throws too: passage.offers, passage.wallets apart from the connect flow, passage.tokenSale apart from the execute flow, passage.superstate.allowWallet, and passage.requirements apart from forOffer. That means useOffers and useOfferDetails cannot load on a wallet session. The API-backed methods on passage.ondo and passage.centrifuge, and requirements.forOffer, also take a wallet session, which builds only for its own wallet and chain: CoinList answers 403 to any other. On PassageServer, passage.offers and requirements.forOffer also accept an app-level token from auth.clientCredentials(), which needs no session and is what reads offers for a wallet session. passage.tokens needs no session at all: it is public, reads a CDN, and works with a read-only server session store. On-chain reads (passage.erc20, the passage.superstate reads, and passage.centrifuge.readDepositPosition and readRedeemPosition) are not API-backed: they go through CoinList’s JSON-RPC proxy by default, which fails a logged-out read with a viem-wrapped 401, or through your own node via Config.rpc, which needs no session. On PassageServer, when the SDK cannot find out whether a session exists (the token refresh hit a 5xx or a network failure after the access token expired), these methods throw that underlying error instead of NotAuthenticatedError.
Package overview
The full table of namespaces and their methods, for looking one up.
Components
Every feature’s component is a container:CheckoutContainer, ClaimContainer, OffersGridContainer, RequirementsChecklistContainer, CoinListSignInCardContainer. You hand it input and config, and it owns everything else. The only other components are a few presentational pieces you lay out yourself: CoinListSignInButton, OfferAssetCard and OfferSaleCard. RequirementsChecklistView is also still exported, as a loading placeholder, but is due to be removed, and PassageStyleScope is the styling wrapper every SDK component already puts around itself.
Three habits will keep you out of trouble:
- Let the container decide for you.
<CheckoutContainer>routes onoffer.type(and on itssideprop for Ondo and Centrifuge), so a new provider is a version bump rather than your problem. The per-provider checkout containers are not exported. When you need your own UI for one provider, drop to L2 and render that product’s viewmodel, such asuseOndoBuyCheckoutViewModel(). For Ondo and Centrifuge,CheckoutContaineralso holds the checkout back until the session is settled, which your own UI does withuseCheckoutSessionViewModel(@alpha). - Optional
onXcallbacks are overrides, not wiring. They default to something sensible -RequirementsChecklistContainer’s action button already callspassage.requirements.handle. Omit them until a default is wrong for you. - You never need a style provider. Every exported component wraps its own output in a style scope, so it renders fully styled wherever you put it.
Hooks
State is a machine, not a pair of booleans. Loading, error and content are one discriminated union with machine-readablereason codes:
default branch to const exhaustive: never = state. A state added in a future release then becomes a compile error rather than a blank screen your users find first. The catalog hooks name the field after what it holds - offersState, requirementsState. Newer data hooks (useErc20Balance, useSwapQuote, the Ondo and Centrifuge hooks) return a plain state, and viewmodels return { state, onEvent }, apart from useCheckoutSessionViewModel, which has no events and returns { state }.
Two options recur, and both exist because of how React works rather than as conveniences:
datais how server rendering works. Pass data your backend already fetched withPassageServerand the hook uses it as-is, skipping the initial client fetch. Where arefetch()exists it still goes to the network: the seed answers the first render only. Worked example.enabledis how you turn a hook off. React forbids calling a hook conditionally, so a hook you cannot skip must instead go quiet:enabled: falsemeans no requests and no timers. Most hooks then report aDISABLEDstate, since no answer is coming. The catalog reads (useOffers,useOfferDetails,useRequirements) have noDISABLEDarm and stay inLOADINGunless they already hold data.useOptionAddressesreports an emptyCONTENT(or itsdataseed) while disabled.CheckoutContainertakesenabledtoo and forwards it to the checkout it mounts, to pause one that is mounted but not on screen yet.
Flows return, they don’t throw
Anything that drives a wallet -passage.superstate.execute, passage.ondo.prepareBuy, passage.tokenSale.execute, passage.centrifuge.buy, passage.centrifuge.sell, passage.wallets.connect - is a flow, and a flow is total. It does not throw. It returns a result tagged with the step that failed:
onProgress, a callback of named phases, so you can tell a user which wallet popup they are looking at.
passage.auth.signInWithWallet is a flow too, with one exception: without the walletSignIn prop on PassageProvider, it throws WalletSignInConfigRequiredError.
Let your wallet library’s own errors propagate out of your EvmWallet implementation. The SDK catches and classifies them into a typed WalletError, so you never parse a wallet error string. The one error to throw yourself is WalletDisconnectedError, from @passage-cl/react/universal, when a method is called after the wallet disconnected or the user switched accounts. The SDK then asks the user to reconnect rather than to retry. See Wallets and Disconnected wallets.
Next step
Set up OAuth authentication
Add
PassageProvider, a sign-in surface, callback handling, and server routes.