Instructions
This skill provides account creation functionality for Consortium AI.
It calls an external API that creates a custodial wallet account on Consortium AI.
How to run (implementation)
From the skill directory, you can call the API either by making HTTP requests (see API Reference) or by running the bundled script:
node scripts/create-account.js <WALLET_ADDRESS>
or
npm run create-account -- <WALLET_ADDRESS>
Example: INLINECODE2
The script requires TRADING_ANALYSIS_API_KEY to be set. It prints the API response as JSON to stdout on success, or error JSON to stderr and exits non-zero on failure.
Setup
Set the API key as an environment variable before using this skill:
CODEBLOCK0
To get an API key, contact Consortium AI on X.
API Reference
Backend API base URL: INLINECODE4
Endpoint: POST https://api.consortiumai.org/api/custodial-wallet/create-with-api-key
Creates a new custodial wallet account.
Authentication
API key only (no JWT). Send the key in one of:
- - Header: INLINECODE6
- Header: INLINECODE7
Request Body
CODEBLOCK1
Success response (201 Created)
CODEBLOCK2
Error responses
| Status | When | Body (example) |
|---|
| 400 | Missing walletAddress | INLINECODE8 |
| 401 |
Missing or wrong API key |
{ "success": false, "message": "Invalid or missing API key" } |
|
404 | User not found for wallet address |
{ "error": "User not found for the provided wallet address" } |
Available Functions
createCustodialWallet(walletAddress)
Purpose
Create a new custodial wallet account on Consortium AI.
Parameters
- -
walletAddress (string): The user's wallet address.
Expected Behavior
- - Sends a POST request to INLINECODE12
- Authenticates with
x-api-key using INLINECODE14 - Returns the created wallet details.
Returns
- - Wallet ID
- Generated Custodial Wallet Address
- User ID
- Creation timestamp
说明
本技能为Consortium AI提供账户创建功能。
它调用一个外部API,在Consortium AI上创建一个托管钱包账户。
运行方式(实现)
在技能目录下,您可以通过发送HTTP请求(参见API参考)或运行捆绑脚本来调用API:
node scripts/create-account.js <钱包地址>
或 npm run create-account -- <钱包地址>
示例:node scripts/create-account.js 5h4...3k1
该脚本需要设置TRADINGANALYSISAPI_KEY。成功时,它会将API响应以JSON格式打印到标准输出;失败时,将错误JSON打印到标准错误输出并以非零状态退出。
设置
使用本技能前,请将API密钥设置为环境变量:
bash
export TRADINGANALYSISAPI_KEY=您的密钥
如需获取API密钥,请联系Consortium AI的X账号。
API参考
后端API基础URL: https://api.consortiumai.org
端点: POST https://api.consortiumai.org/api/custodial-wallet/create-with-api-key
创建一个新的托管钱包账户。
认证
仅使用API密钥(无JWT)。通过以下方式之一发送密钥:
- - 请求头: x-api-key: ANALYSISAPIKEY>
- 请求头: Authorization: Bearer ANALYSISAPIKEY>
请求体
json
{
walletAddress: 5h4...您的钱包地址...3k1
}
成功响应(201 Created)
json
{
message: 托管钱包创建成功,
data: {
id: 钱包UUID,
wallet_address: 生成的托管钱包地址,
user_id: 用户UUID,
created_at: 2024-03-20T10:00:00.000Z,
updated_at: 2024-03-20T10:00:00.000Z
}
}
错误响应
| 状态码 | 触发条件 | 响应体(示例) |
|---|
| 400 | 缺少walletAddress | { error: 缺少钱包地址 } |
| 401 |
API密钥缺失或错误 | { success: false, message: API密钥无效或缺失 } |
|
404 | 未找到该钱包地址对应的用户 | { error: 未找到该钱包地址对应的用户 } |
可用函数
createCustodialWallet(walletAddress)
用途
在Consortium AI上创建一个新的托管钱包账户。
参数
- - walletAddress(字符串):用户的钱包地址。
预期行为
- - 向https://api.consortiumai.org/api/custodial-wallet/create-with-api-key发送POST请求
- 使用TRADINGANALYSISAPI_KEY通过x-api-key进行认证
- 返回创建的钱包详情。
返回值