بنقرة واحدة
context-build-account-setup-flow
Build the wallet connect → approve → deposit → ready-to-trade UI flow
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Build the wallet connect → approve → deposit → ready-to-trade UI flow
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Create, cancel, or manage multiple orders in a single batch
Place and manage prediction market orders on Context Markets
Build an embeddable single-market prediction widget with buy/sell buttons
Build a portfolio dashboard showing positions, P&L, balances, and claimable winnings
Build prediction market frontends with the Context React SDK
Scaffold a full prediction market trading UI with market list, orders, and portfolio
| name | context-build-account-setup-flow |
| description | Build the wallet connect → approve → deposit → ready-to-trade UI flow |
Build the onboarding flow that takes a user from wallet connection to ready-to-trade: connect wallet, approve contracts, deposit USDC.
The user wants to build the account setup UI — the first thing a new user sees before they can trade.
Wallet connection — use wagmi's useConnect() and useAccount():
const { connect, connectors } = useConnect()
const { address, isConnected } = useAccount()
Check account status — useAccountStatus() returns whether approvals and deposits are needed:
const { data: status } = useAccountStatus()
// status.isReady — true if account is fully set up
// status.needsUsdcApproval — needs USDC spend approval
// status.needsOperatorApproval — needs operator approval
One-click setup — useAccountSetup() handles both approvals in one call:
const { mutate: setup, isPending } = useAccountSetup()
// On testnet: gasless (no ETH needed)
// On mainnet: on-chain transactions (requires ETH for gas)
Granular approvals (optional) — for UIs that want separate steps:
useApproveUsdc() — approve USDC spendinguseApproveOperator() — approve the settlement contract as operatorDeposit USDC — useDeposit() to fund the trading account:
const { mutate: deposit } = useDeposit()
deposit(100) // deposit 100 USDC
Show ready state — once status.isReady is true and balance > 0, the user can trade.
useAccountSetup uses signature-based approvals (no ETH needed). On mainnet, it sends on-chain transactions requiring ETH for gas.useApproveUsdc and useApproveOperator for granular control. Use these if your UI wants separate approval steps with progress indicators. useAccountSetup combines both.useSwitchChain() to prompt switching to Base (mainnet) or Base Sepolia (testnet).ContextWalletError. Import from context-markets-react — it covers user rejection, wrong chain, and insufficient funds with structured error types.status.isReady or status.needsUsdcApproval before showing the deposit button.useBalance() and status.isReady is true.