bankr-x402-sdk---job-management by bankrbot/claude-plugins
npx skills add https://github.com/bankrbot/claude-plugins --skill 'Bankr x402 SDK - Job Management'管理异步任务:提交、轮询、检查状态、取消和批量操作。
| 方法 | 描述 | 使用场景 |
|---|---|---|
promptAndWait() | 提交并等待结果 | 推荐用于大多数情况 |
prompt() | 提交,立即返回 | 后台处理 |
pollJob() | 轮询直到任务完成 | 手动任务跟踪 |
getJobStatus() | 检查一次状态 | 自定义轮询逻辑 |
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
cancelJob() | 取消待处理/处理中的任务 | 停止不需要的任务 |
pending → processing → completed
↘ failed
↘ cancelled
| 状态 | 可取消 | 描述 |
|---|---|---|
| pending | 是 | 等待处理中 |
| processing | 是 | 正在积极处理 |
| completed | 否 | 成功完成 |
| failed | 否 | 遇到错误 |
| cancelled | 否 | 被用户取消 |
const result = await client.promptAndWait({
prompt: "Swap 0.1 ETH to USDC",
timeout: 60000,
});
if (result.status === "completed") {
console.log(result.response);
}
// 提交但不等待
const { jobId } = await client.prompt({ prompt: "What are trending tokens?" });
// 稍后检查状态
const status = await client.getJobStatus(jobId);
// 或轮询直到完成
const result = await client.pollJob({ jobId, timeout: 60000 });
const { jobId } = await client.prompt({ prompt: "..." });
await client.cancelJob(jobId);
const prompts = ["Price of ETH", "Price of BTC", "Price of SOL"];
// 并行提交所有任务
const jobs = await Promise.all(
prompts.map(prompt => client.prompt({ prompt }))
);
// 等待所有任务完成
const results = await Promise.all(
jobs.map(job => client.pollJob({ jobId: job.jobId }))
);
| 操作 | 典型时间 | 推荐超时时间 |
|---|---|---|
| 价格查询 | 2-5秒 | 15秒 |
| 余额检查 | 2-5秒 | 15秒 |
| 代币兑换 | 5-15秒 | 60秒 |
| 跨链桥接 | 10-30秒 | 120秒 |
| NFT 操作 | 5-15秒 | 60秒 |
每周安装量
0
仓库
GitHub 星标数
70
首次出现
1970年1月1日
Manage asynchronous jobs: submit, poll, check status, cancel, and batch operations.
| Method | Description | Use Case |
|---|---|---|
promptAndWait() | Submit and wait for result | Recommended for most cases |
prompt() | Submit, return immediately | Background processing |
pollJob() | Poll until job completes | Manual job tracking |
getJobStatus() | Check status once | Custom polling logic |
cancelJob() | Cancel pending/processing job | Stop unwanted jobs |
pending → processing → completed
↘ failed
↘ cancelled
| State | Cancellable | Description |
|---|---|---|
| pending | Yes | Awaiting processing |
| processing | Yes | Actively processing |
| completed | No | Finished successfully |
| failed | No | Encountered error |
| cancelled | No | Cancelled by user |
const result = await client.promptAndWait({
prompt: "Swap 0.1 ETH to USDC",
timeout: 60000,
});
if (result.status === "completed") {
console.log(result.response);
}
// Submit without waiting
const { jobId } = await client.prompt({ prompt: "What are trending tokens?" });
// Check status later
const status = await client.getJobStatus(jobId);
// Or poll until complete
const result = await client.pollJob({ jobId, timeout: 60000 });
const { jobId } = await client.prompt({ prompt: "..." });
await client.cancelJob(jobId);
const prompts = ["Price of ETH", "Price of BTC", "Price of SOL"];
// Submit all in parallel
const jobs = await Promise.all(
prompts.map(prompt => client.prompt({ prompt }))
);
// Wait for all to complete
const results = await Promise.all(
jobs.map(job => client.pollJob({ jobId: job.jobId }))
);
| Operation | Typical Time | Recommended Timeout |
|---|---|---|
| Price queries | 2-5s | 15s |
| Balance checks | 2-5s | 15s |
| Token swaps | 5-15s | 60s |
| Cross-chain bridges | 10-30s | 120s |
| NFT operations | 5-15s | 60s |
Weekly Installs
0
Repository
GitHub Stars
70
First Seen
Jan 1, 1970
通过 LiteLLM 代理让 Claude Code 对接 GitHub Copilot 运行 | 高级变通方案指南
31,600 周安装