Path: Learning Path > 11 UI Reference
UI-specific setup notes also live in /reading/ui-readme.
- Install Slush Wallet in your browser.
- Create a new key or import a key you have generated.
The UI lives in packages/ui and is a static-exported Next.js app (output: "export") that renders the shop, listings, discounts, and checkout flows.
- Network + contract IDs are read from
packages/ui/src/app/config/network.ts. - Use
.env.localinsidepackages/ui(or env vars):NEXT_PUBLIC_LOCALNET_CONTRACT_PACKAGE_ID=0x... NEXT_PUBLIC_LOCALNET_SHOP_ID=0x... NEXT_PUBLIC_TESTNET_CONTRACT_PACKAGE_ID=0x... NEXT_PUBLIC_TESTNET_SHOP_ID=0x...
Optional UI metadata:
NEXT_PUBLIC_APP_NAMENEXT_PUBLIC_APP_DESCRIPTION
- On localnet, the UI signs in the wallet and executes via the app’s local RPC client.
- Localnet RPC is locked to
http://127.0.0.1:9000and guarded to only allow localhost. - The buy flow refreshes local mock Pyth feeds in the same PTB (so UI buys don’t require manual
mock:update-prices).
Key implementation notes:
- The network selection is app-driven (not wallet-driven):
useSuiClientContext()supplies the appnetwork, and the buy flow chooses the execution path whennetwork === localnet. - The localnet guards live in
packages/ui/src/app/helpers/localnet.tsandpackages/ui/src/app/config/network.ts. - For localnet you'll see a
Unable to process transaction No data returned for operationApproveTransactionQuery, got error(s): Variable "$input" got invalid value "localnet" at "input.signTransaction.network"; Value "localnet" does not exist in "Network" enum.error message this is because the wallet can not be configured for localnet but it can be ignored as the execution is app-driven and will go through
Why this matters:
- Wallet Standard distinguishes sign-only from sign+execute. Using
signTransactionkeeps the wallet from choosing an RPC endpoint. - For localnet, we must ensure all reads + writes target the same local node; otherwise you can sign on localnet but accidentally execute against devnet/testnet.
Where to look in the UI code:
- The buy flow is implemented in
packages/ui/src/app/components/BuyFlowModal.tsx.- Localnet uses
useSignTransaction+SuiClient.executeTransactionBlock. - Non-local networks keep
useSignAndExecuteTransaction.
- Localnet uses
Run from the repo root with pnpm ui ...:
pnpm ui dev- Starts the Next.js dev server (default
http://localhost:3000). - Use this after localnet is running and you have set
NEXT_PUBLIC_*IDs for the network you want to view.
- Starts the Next.js dev server (default
pnpm ui build- Creates a static export of the site into
packages/ui/dist. - Required before any of the deployment scripts.
- Creates a static export of the site into
pnpm ui start- Runs
next startfor production-mode preview.
- Runs
pnpm ui lint- Runs ESLint across the UI codebase.
pnpm ui format- Formats
packages/ui/srcwith Prettier.
- Formats
- Previous: 17 PTBs + Gas + Fees
- Next: 12 Buyer Flow + UI
- Back to map: Learning Path Map