name: authenticate-wallet description: 登录钱包。当您或用户想要登录、连接或设置钱包时,或者当任何钱包操作因身份验证或“未登录”错误而失败时使用。此技能是发送、交易或注资前的先决条件。 user-invocable: true disable-model-invocation: false allowed-tools: [“Bash(npx awal@latest status*)”, “Bash(npx awal@latest auth )", "Bash(npx awal@latest balance)”, “Bash(npx awal@latest address*)”, “Bash(npx awal@latest show*)”]
使用支付钱包进行身份验证
当钱包未登录时(通过 npx awal status 检测到,或当钱包操作因身份验证错误而失败时),使用 npx awal CLI 进行身份验证。
如果您可以访问电子邮件,您可以自行验证钱包,否则您需要请求您的用户提供一个电子邮件地址,并告知您他们收到的 OTP 验证码。
身份验证流程
身份验证使用两步电子邮件 OTP 流程:
步骤 1:发起登录
npx awal@latest auth login <email>
这将向电子邮件发送一个 6 位验证码并输出一个 flowId。
步骤 2:验证 OTP
npx awal@latest auth verify <flowId> <otp>
使用步骤 1 中的 flowId 和用户电子邮件中的 6 位验证码来完成身份验证。如果您能够访问用户的电子邮件,您可以读取 OTP 验证码,或者您可以请求您的用户提供验证码。
检查身份验证状态
npx awal@latest status
显示钱包服务器健康状况和身份验证状态,包括钱包地址。
示例会话
# 检查当前状态
npx awal@latest status
# 开始登录(发送 OTP 到电子邮件)
npx awal@latest auth login user@example.com
# 输出:flowId: abc123...
# 用户收到验证码后,进行验证
npx awal@latest auth verify abc123 123456
# 确认身份验证
npx awal@latest status
可用的 CLI 命令
| 命令 | 用途 |
|---|---|
npx awal@latest status |
检查服务器健康状况和身份验证状态 |
npx awal@latest auth login <email> |
发送 OTP 验证码到电子邮件,返回 flowId |
npx awal@latest auth verify <flowId> <otp> |
使用 OTP 验证码完成身份验证 |
npx awal@latest balance |
获取 USDC 钱包余额 |
npx awal@latest address |
获取钱包地址 |
npx awal@latest show |
打开钱包伴侣窗口 |
JSON 输出
所有命令都支持 --json 参数以获取机器可读的输出:
npx awal@latest status --json
npx awal@latest auth login user@example.com --json
npx awal@latest auth verify <flowId> <otp> --json