wallet-integration
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseWallet Integration (Para)
钱包集成(Para)
This skill covers adding wallet + authentication to the frontend of a Monad project using Para and the CLI ().
para@getpara/cliPara gives users embedded MPC wallets — they sign in with email, phone, passkey, or a social provider (Google, Apple, Twitter, Discord, Facebook, Farcaster) and instantly have a wallet, no browser extension required. It also supports connecting external wallets (MetaMask, Coinbase, WalletConnect, Rainbow, Zerion, Rabby) for users who already have one. The same handles both flows.
ParaProviderThis skill assumes the frontend already exists (typically scaffolded by the skill into ). It does not scaffold a new app — Para's template is intentionally out of scope here, since the project scaffold is handled elsewhere.
scaffold/web/para create本技能介绍如何使用Para和 CLI()为Monad项目的前端添加钱包+认证功能。
para@getpara/cliPara为用户提供内置MPC钱包——用户通过邮箱、手机号、密钥或社交服务商(Google、Apple、Twitter、Discord、Facebook、Farcaster)登录后即可立即拥有钱包,无需浏览器扩展。它还支持连接用户已有的外部钱包(MetaMask、Coinbase、WalletConnect、Rainbow、Zerion、Rabby)。同一个可处理这两种流程。
ParaProvider本技能假设前端已存在(通常由技能搭建在目录下)。它不会搭建新应用——Para的模板不在本技能范围内,因为项目搭建由其他技能负责。
scaffold/web/para createWhen to fetch this skill
何时使用本技能
- The user wants any wallet connect / sign-in flow on their frontend, on Monad mainnet or testnet.
- The user wants embedded wallets, social login, email/SMS login, or passkey login.
- The user has an existing frontend (Next.js or Vite) and wants to add Para to it (+
para init+ParaProvider).para doctor - The user wants to manage Para API keys, environments, webhooks, branding, or auth methods from the CLI.
- The user wants to debug a wallet integration that isn't working ().
para doctor
- 用户希望在Monad主网或测试网的前端实现任意钱包连接/登录流程。
- 用户需要内置钱包、社交登录、邮箱/短信登录或密钥登录功能。
- 用户已有一个前端(Next.js或Vite),希望将Para集成进去(+
para init+ParaProvider)。para doctor - 用户希望通过CLI管理Para的API密钥、环境、Webhook、品牌标识或认证方式。
- 用户需要调试无法正常工作的钱包集成()。
para doctor
Monad on Para
Monad与Para的适配
Para's flag supports . Monad mainnet and Monad testnet are EVM chains, so they fit the EVM template — but Para doesn't ship Monad as a built-in chain object. After , you import and from and pass them through on the (v2 stores the chain list there — there is no separate and no prop). See for the exact code edits.
--networksevmpara initmonadmonadTestnetwagmi/chainsexternalWalletConfig.evmConnector.config.{chains,transports}ParaProviderwagmi.tscreateConfigdefaultChainreferences/para-monad-wiring.mdPara的标志支持。Monad主网和测试网均为EVM链,符合EVM模板——但Para并未将Monad作为内置链对象。执行后,你需要从导入和,并将其传入的(v2版本将链列表存储在此处——没有单独的 ,也没有属性)。具体代码修改可参考。
--networksevmpara initwagmi/chainsmonadmonadTestnetParaProviderexternalWalletConfig.evmConnector.config.{chains,transports}wagmi.tscreateConfigdefaultChainreferences/para-monad-wiring.mdv2 SDK shape — read before editing the provider
v2 SDK结构——修改Provider前必读
If you're updating an existing Para integration, the props are not a flat . v2 splits them into four config objects:
ParaProviderapiKey={...}- — credentials and environment (
paraClientConfig={{ apiKey, env: Environment.BETA }}/BETA).PRODUCTION - — app metadata.
config={{ appName }} - — client-side modal controls (which IDP buttons render, phone toggle, recovery step). Empty
paraModalConfig={{ oAuthMethods, disablePhoneLogin, recoverySecretStepEnabled, ... }}hides all social login.oAuthMethods: [] - — chain list, RPC transports, and which external-wallet tiles appear.
externalWalletConfig={{ evmConnector: { config: { chains, transports } }, wallets: ['METAMASK', ...] }}
Default chain = first entry in . There is no top-level prop. Full example in → step 7.
externalWalletConfig.evmConnector.config.chainsdefaultChainreferences/para-workflows.md如果你正在更新现有的Para集成,的属性不是扁平化的。v2版本将其拆分为四个配置对象:
ParaProviderapiKey={...}- —— 凭证和环境(
paraClientConfig={{ apiKey, env: Environment.BETA }}/BETA)。PRODUCTION - —— 应用元数据。
config={{ appName }} - —— 客户端弹窗控制(显示哪些身份提供商按钮、手机号登录开关、恢复步骤)。若
paraModalConfig={{ oAuthMethods, disablePhoneLogin, recoverySecretStepEnabled, ... }}则隐藏所有社交登录选项。oAuthMethods: [] - —— 链列表、RPC传输方式,以及显示哪些外部钱包选项。
externalWalletConfig={{ evmConnector: { config: { chains, transports } }, wallets: ['METAMASK', ...] }}
默认链为中的第一个条目。没有顶层的属性。完整示例可查看 → 步骤7。
externalWalletConfig.evmConnector.config.chainsdefaultChainreferences/para-workflows.mdPrerequisites
前置条件
Before any command will work, the user must have all of these in place:
para- installed globally:
@getpara/cli(ornpm install -g @getpara/cli, or run viapnpm add -g @getpara/cli).npx @getpara/cli@latest - logged in:
para(browser OAuth flow — only the user can complete it).para login - A Para organization and project selected as active context. After , the CLI auto-selects the first org and project; switch with
para login/para orgs switchif needed.para projects switch
The monskills hook gates commands on install + login. If a prereq is missing, the hook denies the tool call with the exact missing piece — surface that message to the user and wait.
para在执行任何命令前,用户必须完成以下所有操作:
para- 全局安装:
@getpara/cli(或npm install -g @getpara/cli,或通过pnpm add -g @getpara/cli运行)。npx @getpara/cli@latest - 登录:
para(浏览器OAuth流程——仅用户本人可完成)。para login - 选择Para组织和项目作为当前上下文。登录后,CLI会自动选择第一个组织和项目;如需切换,可使用/
para orgs switch。para projects switch
monskills钩子会在执行命令前检查安装和登录状态。若缺少前置条件,钩子会拒绝工具调用并告知具体缺失项——请将该信息告知用户并等待操作完成。
paraWhat NOT to do
禁止操作
- Do not install the CLI for the user. If is missing, tell them the exact command and wait.
@getpara/cli - Do not run for the user. It opens a browser tab and only the user can complete the OAuth flow. (
para loginexists for headless setups, but monskills is for interactive use — let the user choose.)--no-browser - Do not create a Para account or API key for the user via the web portal. The CLI handles project + key creation — guide them through it.
- Do not run . Project scaffolding is handled by the
para createskill; this skill only integrates Para into a frontend that already exists.scaffold/
- 不要为用户安装CLI。若缺少,请告知用户具体命令并等待。
@getpara/cli - 不要为用户执行。该命令会打开浏览器标签页,仅用户本人可完成OAuth流程。(
para login适用于无头环境,但monskills用于交互式场景——请让用户自行选择。)--no-browser - 不要通过网页门户为用户创建Para账号或API密钥。CLI会处理项目和密钥创建——引导用户完成即可。
- 不要执行。项目搭建由
para create技能负责;本技能仅将Para集成到已有的前端中。scaffold/
Integrate Para into the existing frontend
将Para集成到现有前端
bash
cd web # or wherever the frontend lives
para initpara init.pararcParaProviderpara doctorIn a sandboxed or headless terminal (no real TTY), will exit with — re-run as and it will use the active org/project/env from global config instead of prompting.
para initTTY initialization failed: uv_tty_init returned EINVALpara init --no-inputSee → "Integrate Para into the existing frontend" for the exact code edits, package list, and debugging loop.
references/para-workflows.mdpara doctorbash
cd web # 或前端所在的其他目录
para initpara init.pararcParaProviderpara doctor在沙盒或无头终端(无真实TTY)中,会因退出——请以重新运行,它会使用全局配置中的当前组织/项目/环境,而非提示用户输入。
para initTTY initialization failed: uv_tty_init returned EINVALpara init --no-input具体代码修改、包列表和调试流程可参考 → "将Para集成到现有前端"。
para doctorreferences/para-workflows.mdWhere to look next
后续参考
Reference files — fetch on demand:
- Workflow recipes — opinionated sequences for: integrating Para into the existing frontend, rotating an API key, configuring auth methods/branding/webhooks via , debugging with
para keys config.para doctor - CLI reference — every command grouped by area (auth, config, orgs/projects, keys, diagnostics) with notes on flags and gotchas.
para - Monad wiring — the exact post-edits to add Monad mainnet + testnet to the wagmi config that Para's provider consumes. Apply this after every Para integration.
para init
Start with the workflow recipe that matches the user's goal. Drop into the CLI reference only when you need a flag or subcommand not covered there.
按需获取以下参考文件:
- 工作流指南 —— 针对以下场景的标准化流程:将Para集成到现有前端、轮换API密钥、通过配置认证方式/品牌标识/Webhook、使用
para keys config调试。para doctor - CLI参考 —— 按领域(认证、配置、组织/项目、密钥、诊断)分组的所有命令,包含标志说明和注意事项。
para - Monad配置 —— 执行后,为Para的Provider添加Monad主网+测试网到wagmi配置的具体修改步骤。每次集成Para后都需执行此操作。
para init
请从匹配用户目标的工作流指南开始。仅当需要指南中未涵盖的标志或子命令时,再查看CLI参考。
Exit-code contract
退出码约定
Every command follows the same convention — check exit codes, not just stdout:
para| Exit code | Meaning | How to react |
|---|---|---|
| Success | Continue |
| User error (bad args, not logged in, unknown project, | Read stderr, fix the input, retry |
| API/server error | Not the user's fault. Retry once; if it persists, tell the user and stop. |
para doctor --json所有命令遵循相同约定——请检查退出码,而非仅查看标准输出:
para| 退出码 | 含义 | 处理方式 |
|---|---|---|
| 成功 | 继续执行 |
| 用户错误(参数错误、未登录、未知项目、 | 读取stderr,修正输入后重试 |
| API/服务器错误 | 非用户问题。重试一次;若仍失败,告知用户并停止操作 |
para doctor --jsonSecrets hygiene
密钥安全规范
- and
para keys get --show-secretprint/copy the secret API key. Never echo the value back to the user in your response, and never paste it into a file you commit. The public key (no flag) is fine to include inpara keys get --copy-secretunder a.env.local(or framework-equivalent) prefix.NEXT_PUBLIC_PARA_API_KEY - Always check the env-var prefix matches the framework before writing the key: for Next.js,
NEXT_PUBLIC_for Vite.VITE_flags mismatches.para doctor - is safe to commit (it only stores org/project IDs and environment, no secrets).
.pararc/.envshould be in.env.local..gitignore
- 和
para keys get --show-secret会打印/复制私密API密钥。切勿在回复中向用户回显该值,也切勿将其粘贴到需提交的文件中。公钥(无标志)可安全地添加到para keys get --copy-secret中,前缀为.env.local(或对应框架的等效前缀)。NEXT_PUBLIC_PARA_API_KEY - 在写入密钥前,请始终检查环境变量前缀是否与框架匹配:Next.js使用,Vite使用
NEXT_PUBLIC_。VITE_会标记不匹配的情况。para doctor - 可安全提交(仅存储组织/项目ID和环境,无敏感信息)。
.pararc/.env应添加到.env.local中。.gitignore
Official docs
官方文档
- CLI overview: https://docs.getpara.com/v2/cli/overview
- Installation: https://docs.getpara.com/v2/cli/installation
- Command reference: https://docs.getpara.com/v2/cli/commands