wallet-integration

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Wallet Integration (Para)

钱包集成(Para)

This skill covers adding wallet + authentication to the frontend of a Monad project using Para and the
para
CLI (
@getpara/cli
).
Para 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
ParaProvider
handles both flows.
This skill assumes the frontend already exists (typically scaffolded by the
scaffold/
skill into
web/
). It does not scaffold a new app — Para's
para create
template is intentionally out of scope here, since the project scaffold is handled elsewhere.
本技能介绍如何使用Para
para
CLI(
@getpara/cli
)为Monad项目的前端添加钱包+认证功能。
Para为用户提供内置MPC钱包——用户通过邮箱、手机号、密钥或社交服务商(Google、Apple、Twitter、Discord、Facebook、Farcaster)登录后即可立即拥有钱包,无需浏览器扩展。它还支持连接用户已有的外部钱包(MetaMask、Coinbase、WalletConnect、Rainbow、Zerion、Rabby)。同一个
ParaProvider
可处理这两种流程。
本技能假设前端已存在(通常由
scaffold/
技能搭建在
web/
目录下)。它不会搭建新应用——Para的
para create
模板不在本技能范围内,因为项目搭建由其他技能负责。

When 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
--networks
flag supports
evm
. 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
para init
, you import
monad
and
monadTestnet
from
wagmi/chains
and pass them through
externalWalletConfig.evmConnector.config.{chains,transports}
on the
ParaProvider
(v2 stores the chain list there — there is no separate
wagmi.ts
createConfig
and no
defaultChain
prop). See
references/para-monad-wiring.md
for the exact code edits.
Para的
--networks
标志支持
evm
。Monad主网和测试网均为EVM链,符合EVM模板——但Para并未将Monad作为内置链对象。执行
para init
后,你需要从
wagmi/chains
导入
monad
monadTestnet
,并将其传入
ParaProvider
externalWalletConfig.evmConnector.config.{chains,transports}
(v2版本将链列表存储在此处——没有单独的
wagmi.ts
createConfig
,也没有
defaultChain
属性)。具体代码修改可参考
references/para-monad-wiring.md

v2 SDK shape — read before editing the provider

v2 SDK结构——修改Provider前必读

If you're updating an existing Para integration, the
ParaProvider
props are not a flat
apiKey={...}
. v2 splits them into four config objects:
  • paraClientConfig={{ apiKey, env: Environment.BETA }}
    — credentials and environment (
    BETA
    /
    PRODUCTION
    ).
  • config={{ appName }}
    — app metadata.
  • paraModalConfig={{ oAuthMethods, disablePhoneLogin, recoverySecretStepEnabled, ... }}
    client-side modal controls (which IDP buttons render, phone toggle, recovery step). Empty
    oAuthMethods: []
    hides all social login.
  • externalWalletConfig={{ evmConnector: { config: { chains, transports } }, wallets: ['METAMASK', ...] }}
    — chain list, RPC transports, and which external-wallet tiles appear.
Default chain = first entry in
externalWalletConfig.evmConnector.config.chains
. There is no top-level
defaultChain
prop. Full example in
references/para-workflows.md
→ step 7.
如果你正在更新现有的Para集成,
ParaProvider
的属性不是扁平化的
apiKey={...}
。v2版本将其拆分为四个配置对象:
  • paraClientConfig={{ apiKey, env: Environment.BETA }}
    —— 凭证和环境(
    BETA
    /
    PRODUCTION
    )。
  • config={{ appName }}
    —— 应用元数据。
  • paraModalConfig={{ oAuthMethods, disablePhoneLogin, recoverySecretStepEnabled, ... }}
    —— 客户端弹窗控制(显示哪些身份提供商按钮、手机号登录开关、恢复步骤)。若
    oAuthMethods: []
    则隐藏所有社交登录选项。
  • externalWalletConfig={{ evmConnector: { config: { chains, transports } }, wallets: ['METAMASK', ...] }}
    —— 链列表、RPC传输方式,以及显示哪些外部钱包选项。
默认链为
externalWalletConfig.evmConnector.config.chains
中的第一个条目。没有顶层的
defaultChain
属性。完整示例可查看
references/para-workflows.md
→ 步骤7。

Prerequisites

前置条件

Before any
para
command will work, the user must have all of these in place:
  1. @getpara/cli
    installed globally:
    npm install -g @getpara/cli
    (or
    pnpm add -g @getpara/cli
    , or run via
    npx @getpara/cli@latest
    ).
  2. para
    logged in:
    para login
    (browser OAuth flow — only the user can complete it).
  3. A Para organization and project selected as active context. After
    para login
    , the CLI auto-selects the first org and project; switch with
    para orgs switch
    /
    para projects switch
    if needed.
The monskills hook gates
para
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
命令前,用户必须完成以下所有操作:
  1. 全局安装
    @getpara/cli
    npm install -g @getpara/cli
    (或
    pnpm add -g @getpara/cli
    ,或通过
    npx @getpara/cli@latest
    运行)。
  2. 登录
    para
    para login
    (浏览器OAuth流程——仅用户本人可完成)。
  3. 选择Para组织和项目作为当前上下文。登录后,CLI会自动选择第一个组织和项目;如需切换,可使用
    para orgs switch
    /
    para projects switch
monskills钩子会在执行
para
命令前检查安装和登录状态。若缺少前置条件,钩子会拒绝工具调用并告知具体缺失项——请将该信息告知用户并等待操作完成。

What NOT to do

禁止操作

  • Do not install the CLI for the user. If
    @getpara/cli
    is missing, tell them the exact command and wait.
  • Do not run
    para login
    for the user.
    It opens a browser tab and only the user can complete the OAuth flow. (
    --no-browser
    exists for headless setups, but monskills is for interactive use — let the user choose.)
  • 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
    para create
    .
    Project scaffolding is handled by the
    scaffold/
    skill; this skill only integrates Para into a frontend that already exists.
  • 不要为用户安装CLI。若缺少
    @getpara/cli
    ,请告知用户具体命令并等待。
  • 不要为用户执行
    para login
    。该命令会打开浏览器标签页,仅用户本人可完成OAuth流程。(
    --no-browser
    适用于无头环境,但monskills用于交互式场景——请让用户自行选择。)
  • 不要通过网页门户为用户创建Para账号或API密钥。CLI会处理项目和密钥创建——引导用户完成即可。
  • 不要执行
    para create
    。项目搭建由
    scaffold/
    技能负责;本技能仅将Para集成到已有的前端中。

Integrate Para into the existing frontend

将Para集成到现有前端

bash
cd web   # or wherever the frontend lives
para init
para init
writes
.pararc
(org + project + environment context), then you install the SDK packages, wrap the app in
ParaProvider
, and import Para's CSS. After wiring, run
para doctor
to verify nothing is missing.
In a sandboxed or headless terminal (no real TTY),
para init
will exit with
TTY initialization failed: uv_tty_init returned EINVAL
— re-run as
para init --no-input
and it will use the active org/project/env from global config instead of prompting.
See
references/para-workflows.md
→ "Integrate Para into the existing frontend" for the exact code edits, package list, and
para doctor
debugging loop.
bash
cd web   # 或前端所在的其他目录
para init
para init
会生成
.pararc
文件(包含组织+项目+环境上下文),之后你需要安装SDK包,用
ParaProvider
包裹应用,并导入Para的CSS。完成配置后,运行
para doctor
验证是否存在缺失项。
在沙盒或无头终端(无真实TTY)中,
para init
会因
TTY initialization failed: uv_tty_init returned EINVAL
退出——请以
para init --no-input
重新运行,它会使用全局配置中的当前组织/项目/环境,而非提示用户输入。
具体代码修改、包列表和
para doctor
调试流程可参考
references/para-workflows.md
→ "将Para集成到现有前端"。

Where 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
    para keys config
    , debugging with
    para doctor
    .
  • CLI reference — every
    para
    command grouped by area (auth, config, orgs/projects, keys, diagnostics) with notes on flags and gotchas.
  • Monad wiring — the exact post-
    para init
    edits to add Monad mainnet + testnet to the wagmi config that Para's provider consumes. Apply this after every Para integration.
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密钥、通过
    para keys config
    配置认证方式/品牌标识/Webhook、使用
    para doctor
    调试。
  • CLI参考 —— 按领域(认证、配置、组织/项目、密钥、诊断)分组的所有
    para
    命令,包含标志说明和注意事项。
  • Monad配置 —— 执行
    para init
    后,为Para的Provider添加Monad主网+测试网到wagmi配置的具体修改步骤。每次集成Para后都需执行此操作。
请从匹配用户目标的工作流指南开始。仅当需要指南中未涵盖的标志或子命令时,再查看CLI参考。

Exit-code contract

退出码约定

Every
para
command follows the same convention — check exit codes, not just stdout:
Exit codeMeaningHow to react
0
SuccessContinue
1
User error (bad args, not logged in, unknown project,
para doctor
found errors with
--json
)
Read stderr, fix the input, retry
2
API/server errorNot the user's fault. Retry once; if it persists, tell the user and stop.
para doctor --json
exits 1 when it finds errors — that's expected behaviour, not a CLI bug. Use it as the signal that the integration has issues.
所有
para
命令遵循相同约定——请检查退出码,而非仅查看标准输出:
退出码含义处理方式
0
成功继续执行
1
用户错误(参数错误、未登录、未知项目、
para doctor
通过
--json
发现错误)
读取stderr,修正输入后重试
2
API/服务器错误非用户问题。重试一次;若仍失败,告知用户并停止操作
para doctor --json
在发现错误时会返回退出码1——这是预期行为,并非CLI bug。可将其作为集成存在问题的信号。

Secrets hygiene

密钥安全规范

  • para keys get --show-secret
    and
    para keys get --copy-secret
    print/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 in
    .env.local
    under a
    NEXT_PUBLIC_PARA_API_KEY
    (or framework-equivalent) prefix.
  • Always check the env-var prefix matches the framework before writing the key:
    NEXT_PUBLIC_
    for Next.js,
    VITE_
    for Vite.
    para doctor
    flags mismatches.
  • .pararc
    is safe to commit (it only stores org/project IDs and environment, no secrets).
    .env
    /
    .env.local
    should be in
    .gitignore
    .
  • para keys get --show-secret
    para keys get --copy-secret
    会打印/复制私密API密钥。切勿在回复中向用户回显该值,也切勿将其粘贴到需提交的文件中。公钥(无标志)可安全地添加到
    .env.local
    中,前缀为
    NEXT_PUBLIC_PARA_API_KEY
    (或对应框架的等效前缀)。
  • 在写入密钥前,请始终检查环境变量前缀是否与框架匹配:Next.js使用
    NEXT_PUBLIC_
    ,Vite使用
    VITE_
    para doctor
    会标记不匹配的情况。
  • .pararc
    可安全提交(仅存储组织/项目ID和环境,无敏感信息)。
    .env
    /
    .env.local
    应添加到
    .gitignore
    中。

Official docs

官方文档