bitget-wallet by bitget-wallet-ai-lab/bitget-wallet-skill
npx skills add https://github.com/bitget-wallet-ai-lab/bitget-wallet-skill --skill bitget-wallethttps://bopenapi.bgwapi.ioBGW_API_KEY / BGW_API_SECRET 环境变量覆盖以使用您自己的密钥。bgw_swap_public(用于交换端点)为了正确使用这些工具,您需要了解的超出命令语法的知识。这些是跨命令的约束、常见陷阱以及 CLI README 未涵盖的命令间关系。
此技能使用基于日期的版本控制(YYYY.M.DD)。每个版本都包含一个顺序后缀:YYYY.M.DD-1、 等。当前版本位于前面的 frontmatter 中。完整历史记录请参见 。
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
YYYY.M.DD-2CHANGELOG.md每日首次使用版本检查:
在每周首次使用时(最多每 7 天一次),将已安装版本(来自 frontmatter)与存储库中的最新可用版本进行比较:
versionhttps://raw.githubusercontent.com/bitget-wallet-ai-lab/bitget-wallet-skill/main/CHANGELOG.md 获取最新的 CHANGELOG.md如果有新版本可用,通知用户:
🔄 Bitget Wallet 技能有更新可用
• 已安装: [已安装版本]
• 最新: [最新版本]
• 变更: [来自 CHANGELOG 的单行摘要]
• 安全相关: [是/否 — 如果存在安全部分则高亮显示]
是否升级? [是/否]
如果用户确认升级:
从 https://github.com/bitget-wallet-ai-lab/bitget-wallet-skill 存储库的 main 分支重新安装技能。用最新版本替换所有本地技能文件,然后重新读取 SKILL.md 以加载更新后的领域知识。
升级后安全检查:
bitget_api.py — 向用户总结变更如果版本匹配: 无需通知,正常进行。
检查频率: 最多每 7 天一次。代理应跟踪上次检查日期,如果少于 7 天则跳过。
当用户首次请求交换或任何签名操作时,检查是否已配置钱包。如果没有,引导他们完成设置:
路径 1:创建新钱包
mnemonic、bip_utils 或等效库)。路径 2:仅查询(无钱包)
如果用户只想进行价格查询、代币信息和安全检查 — 则无需钱包设置。完全跳过此流程。签名操作将不可用。
密钥管理规则:
签名流程(密钥如何流动):
安全存储(助记词) → 派生私钥(内存中) → 签名交易 → 丢弃密钥
派生路径:
| 链 | 路径 | 曲线 | 备注 |
|---|---|---|---|
| EVM (ETH/BNB/Base/...) | m/44'/60'/0'/0/0 | secp256k1 | 所有 EVM 链共享一个密钥 |
| Solana | m/44'/501'/0'/0' | Ed25519 (SLIP-0010) | 与 EVM 不同的密钥 |
用户首次发起交换时,在执行之前,引导他们完成这些一次性偏好设置:
交易截止时间 — 链上交易保持有效的时间:
120 秒(在波动市场中更好地防止三明治攻击)300 秒(平衡 — 适合大多数用户)600 秒(用于缓慢的签名工作流,例如硬件钱包或多签)自动安全检查 — 是否在交换前审计不熟悉的代币:
security保存偏好 — 存储在代理的内存/配置中供未来交换使用
提醒用户 他们可以随时更新(例如,"更新我的交换设置" 或 "更改我的默认截止时间")
如果用户拒绝配置,则使用合理的默认值:deadline=300,security=always。
所有 BGW API 的输入和输出都使用人类可读的值,而不是最小的链上单位(wei、lamports、satoshi)。
| ✅ 正确 | ❌ 错误 |
|---|---|
--amount 0.1 (0.1 USDT) | --amount 100000000000000000 (100 千万亿 USDT!) |
--amount 1 (1 SOL) | --amount 1000000000 (10 亿 SOL!) |
这适用于:swap-quote、swap-calldata、swap-send 以及响应中的所有 toAmount / fromAmount 值。响应中的 decimals 字段仅用于提供信息 — 不要将其用于转换。
对于原生代币(ETH、SOL、BNB 等),使用空字符串 "" 作为合约地址。这是一个常见的错误来源 — 查询原生代币信息时,不要传递包装代币地址(例如 WETH、WSOL)。
始终使用这些经过验证的地址处理 USDT/USDC。 不要猜测或从内存生成合约地址 — 错误的地址将导致 API 错误(error_code: 80000,"获取代币信息失败")。
USDT 与 USDT0: Tether 已开始在某些链上将 USDT 迁移到 USDT0(通过 LayerZero 的全链版本)。在 Arbitrum 上,相同的合约地址现在代表 USDT0 而不是旧的 USDT。合约地址保持不变,并且与 BGW API 工作方式相同 — 无需特殊处理。当用户要求交换 "USDT" 时,使用下面的地址,无论该链是否已迁移到 USDT0。
| 链(代码) | USDT (USDT0) | USDC |
|---|---|---|
Ethereum (eth) | 0xdAC17F958D2ee523a2206206994597C13D831ec7 | 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 |
BNB Chain (bnb) | 0x55d398326f99059fF775485246999027B3197955 | 0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d |
Base (base) | 0xfde4C96c8593536E31F229EA8f37b2ADa2699bb2 | 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 |
Arbitrum (arbitrum) | 0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9 | 0xaf88d065e77c8cC2239327C5EDb3A432268e5831 |
Optimism (optimism) | 0x94b008aA00579c1307B0EF2c499aD98a8ce58e58 | 0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85 |
Polygon (matic) | 0xc2132D05D31c914a87C6611C10748AEb04B58e8F | 0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359 |
Solana (sol) | Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB | EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v |
Morph (morph) | 0xe7cd86e13AC4309349F30B3435a9d337750fC82D | — (尚未可用) |
| 链 | 合约 |
|---|---|
Ethereum (eth) | 0x54D2252757e1672EEaD234D27B1270728fF90581 |
Morph (morph) | 0x389C08Bc23A7317000a1FD76c7c5B0cb0b4640b5 |
对于其他代币,在调用交换端点之前,请使用 token-info 或区块浏览器验证合约地址。
以下领域知识模块是按需加载的。当任务需要时,请阅读相关文件。
| 模块 | 文件 | 何时加载 |
|---|---|---|
| 钱包与签名 | docs/wallet-signing.md | 密钥管理、BIP-39/44、签名交易、多链签名 |
| 市场数据 | docs/market-data.md | 安全审计、K线、交易信息、代币发现、风险代币识别 |
| 交易 | docs/trading.md | 交换执行(订单模式默认,Calldata 模式旧版)、无 gas 费、跨链、滑点、gas、授权 |
| x402 支付 | docs/x402-payments.md | HTTP 402 支付协议、使用 USDC 支付 API、EIP-3009、Permit2、Solana 部分签名 |
sol 而不是 solana,bnb 而不是 bsc。请参见下面的链标识符表。batch-token-info 使用 --tokens "sol:<addr1>,eth:<addr2>" — 链和地址用冒号分隔,对之间用逗号分隔。liquidity 命令返回池信息,包括 LP 锁定百分比。100% 锁定的 LP 通常是积极信号;0% 意味着创建者可以提取流动性。docs/trading.md 中的 "EVM 代币授权"。所有脚本都在 scripts/ 目录下,并使用 Python 3.11+。无需外部凭证设置 — 演示 API 密钥已内置。
scripts/bitget_api.py — 统一 API 客户端# 代币信息(价格、供应量、持有者、社交信息)
python3 scripts/bitget_api.py token-info --chain sol --contract <address>
# 仅代币价格
python3 scripts/bitget_api.py token-price --chain sol --contract <address>
# 批量代币信息(逗号分隔)
python3 scripts/bitget_api.py batch-token-info --tokens "sol:<addr1>,eth:<addr2>"
# K线数据
python3 scripts/bitget_api.py kline --chain sol --contract <address> --period 1h --size 24
# 代币交易信息(5分钟/1小时/4小时/24小时交易量、买家、卖家)
python3 scripts/bitget_api.py tx-info --chain sol --contract <address>
# 批量交易信息
python3 scripts/bitget_api.py batch-tx-info --tokens "sol:<addr1>,eth:<addr2>"
# 代币排名(topGainers / topLosers)
python3 scripts/bitget_api.py rankings --name topGainers
# 代币流动性池
python3 scripts/bitget_api.py liquidity --chain sol --contract <address>
# 历史代币(发现新代币)
python3 scripts/bitget_api.py historical-coins --create-time <datetime> --limit 20
# 安全审计
python3 scripts/bitget_api.py security --chain sol --contract <address>
# 交换报价(金额是人类可读的)
python3 scripts/bitget_api.py swap-quote --from-chain sol --from-contract <addr> --to-contract <addr> --amount 1
# 交换调用数据(返回用于签名的交易数据;--slippage 是可选的,如果省略则系统自动计算)
python3 scripts/bitget_api.py swap-calldata --from-chain sol --from-contract <addr> --to-contract <addr> --amount 1 --from-address <wallet> --to-address <wallet> --market <market> --slippage 2
# 交换发送(广播已签名的交易)
python3 scripts/bitget_api.py swap-send --chain sol --raw-transaction <signed_hex>
# --- 订单模式(跨链 + 无 gas 费) ---
# 订单报价(支持跨链:fromChain != toChain)
python3 scripts/bitget_api.py order-quote \
--from-chain base --from-contract 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 \
--to-chain bnb --to-contract 0x55d398326f99059fF775485246999027B3197955 \
--amount 2.0 --from-address <wallet>
# 订单创建(返回未签名的交易数据;使用 --feature no_gas 实现无 gas 费)
python3 scripts/bitget_api.py order-create \
--from-chain base --from-contract 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 \
--to-chain bnb --to-contract 0x55d398326f99059fF775485246999027B3197955 \
--amount 2.0 --from-address <wallet> --to-address <wallet> \
--market bkbridgev3.liqbridge --slippage 3.0 --feature no_gas
# 订单提交(提交已签名的交易)
python3 scripts/bitget_api.py order-submit \
--order-id <orderId> --signed-txs "0x<signed_hex>"
# 订单状态(轮询订单完成情况)
python3 scripts/bitget_api.py order-status --order-id <orderId>
scripts/x402_pay.py — x402 支付客户端# 签署 EIP-3009 支付(Base 上的 USDC)
python3 scripts/x402_pay.py sign-eip3009 \
--private-key <hex> --token 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 \
--chain-id 8453 --to <payTo_address> --amount 10000
# 部分签署 Solana x402 交易
python3 scripts/x402_pay.py sign-solana \
--private-key <hex> --transaction <base64_tx>
# 完整的 HTTP 402 流程(自动检测、签名、支付)
python3 scripts/x402_pay.py pay --url https://api.example.com/data --private-key <hex>
| 链 | ID | 代码 |
|---|---|---|
| Ethereum | 1 | eth |
| Solana | 100278 | sol |
| BNB Chain | 56 | bnb |
| Base | 8453 | base |
| Arbitrum | 42161 | arbitrum |
| Tron | 6 | trx |
| Ton | 100280 | ton |
| Sui | 100281 | suinet |
| Optimism | 10 | optimism |
| Polygon | 137 | matic |
对于原生代币(ETH、SOL、BNB 等),使用空字符串 ""。
Partner-Code: bgw_swap_public 头部(在脚本中硬编码)每周安装次数
47
仓库
GitHub 星标数
112
首次出现
11 天前
安全审计
安装于
opencode47
gemini-cli47
github-copilot47
codex47
amp47
kimi-cli47
https://bopenapi.bgwapi.ioBGW_API_KEY / BGW_API_SECRET env vars for your own keys.bgw_swap_public (for swap endpoints)What you need to know beyond command syntax to use these tools correctly. These are cross-command constraints, common pitfalls, and the relationships between commands that the CLI README alone doesn't cover.
This skill uses date-based versioning (YYYY.M.DD). Each release includes a sequential suffix: YYYY.M.DD-1, YYYY.M.DD-2, etc. The current version is in the frontmatter above. See CHANGELOG.md for full history.
Daily first-use version check:
On the first use of the week (at most once every 7 days), compare the installed version (from frontmatter) against the latest version available from the repository:
version from frontmatter abovehttps://raw.githubusercontent.com/bitget-wallet-ai-lab/bitget-wallet-skill/main/CHANGELOG.mdIf a new version is available , inform the user:
🔄 Bitget Wallet Skill update available
• Installed: [installed version]
• Latest: [latest version]
• Changes: [one-line summary from CHANGELOG]
• Security-related: [yes/no — highlight if Security section exists]
Upgrade? [yes/no]
If the user confirms upgrade:
Re-install the skill from the main branch of the repository at https://github.com/bitget-wallet-ai-lab/bitget-wallet-skill. Replace all local skill files with the latest versions, then re-read SKILL.md to load the updated Domain Knowledge.
Post-upgrade security check:
bitget_api.py — summarize changes to the userIf versions match: No announcement needed, proceed normally.
Check frequency: At most once every 7 days. The agent should track the last check date and skip if fewer than 7 days have passed.
When a user first requests a swap or any signing operation, check if a wallet is already configured. If not, guide them through setup:
Path 1: Create a new wallet
mnemonic, bip_utils, or equivalent).Path 2: Query only (no wallet)
If the user only wants price queries, token info, and security checks — no wallet setup needed. Skip this flow entirely. Signing operations will be unavailable.
Key management rules:
Signing pipeline (how keys flow):
Secure storage (mnemonic) → derive private key (in memory) → sign transaction → discard key
Derivation paths:
| Chain | Path | Curve | Notes |
|---|---|---|---|
| EVM (ETH/BNB/Base/...) | m/44'/60'/0'/0/0 | secp256k1 | All EVM chains share one key |
| Solana | m/44'/501'/0'/0' | Ed25519 (SLIP-0010) | Different key from EVM |
The first time a user initiates a swap, before executing , guide them through these one-time preferences:
Transaction deadline — how long the on-chain transaction remains valid:
120 seconds (better protection against sandwich attacks in volatile markets)300 seconds (balanced — suitable for most users)600 seconds (for slow signing workflows, e.g., hardware wallets or multi-sig)Automatic security check — whether to audit unfamiliar tokens before swaps:
security automatically before swapSave preferences — store in the agent's memory/config for future swaps
Remind user they can update anytime (e.g., "update my swap settings" or "change my default deadline")
If the user declines configuration, use sensible defaults: deadline=300, security=always.
All BGW API inputs and outputs use human-readable values , NOT smallest chain units (wei, lamports, satoshi).
| ✅ Correct | ❌ Wrong |
|---|---|
--amount 0.1 (0.1 USDT) | --amount 100000000000000000 (100 quadrillion USDT!) |
--amount 1 (1 SOL) | --amount 1000000000 (1 billion SOL!) |
This applies to: swap-quote, swap-calldata, swap-send, and all toAmount / fromAmount values in responses. The decimals field in responses is informational only — do not use it for conversion.
Use empty string "" as the contract address for native tokens (ETH, SOL, BNB, etc.). This is a common source of errors — do not pass the wrapped token address (e.g., WETH, WSOL) when querying native token info.
Always use these verified addresses for USDT/USDC. Do not guess or generate contract addresses from memory — incorrect addresses will cause API errors (error_code: 80000, "get token info failed").
USDT vs USDT0: Tether has begun migrating USDT to USDT0 (omnichain version via LayerZero) on some chains. On Arbitrum, the same contract address now represents USDT0 instead of legacy USDT. The contract addresses remain unchanged and work identically with the BGW API — no special handling is needed. When a user asks to swap "USDT", use the address below regardless of whether the chain has migrated to USDT0.
| Chain (code) | USDT (USDT0) | USDC |
|---|---|---|
Ethereum (eth) | 0xdAC17F958D2ee523a2206206994597C13D831ec7 | 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 |
BNB Chain (bnb) | 0x55d398326f99059fF775485246999027B3197955 | 0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d |
Base (base) |
| Chain | Contract |
|---|---|
Ethereum (eth) | 0x54D2252757e1672EEaD234D27B1270728fF90581 |
Morph (morph) | 0x389C08Bc23A7317000a1FD76c7c5B0cb0b4640b5 |
For other tokens, use token-info or a block explorer to verify the contract address before calling swap endpoints.
The following domain knowledge modules are loaded on-demand. Read the relevant file when the task requires it.
| Module | File | When to Load |
|---|---|---|
| Wallet & Signing | docs/wallet-signing.md | Key management, BIP-39/44, signing transactions, multi-chain signing |
| Market Data | docs/market-data.md | Security audits, K-line, tx info, token discovery, risky token identification |
| Trading | docs/trading.md | Swap execution (Order Mode default, Calldata Mode legacy), gasless, cross-chain, slippage, gas, approvals |
| x402 Payments |
sol not solana, bnb not bsc. See the Chain Identifiers table below.batch-token-info uses --tokens "sol:<addr1>,eth:<addr2>" — chain and address are colon-separated, pairs are comma-separated.liquidity command returns pool info including LP lock percentage. 100% locked LP is generally a positive signal; 0% means the creator can pull liquidity.All scripts are in scripts/ and use Python 3.11+. No external credential setup needed — demo API keys are built in.
scripts/bitget_api.py — Unified API Client# Token info (price, supply, holders, socials)
python3 scripts/bitget_api.py token-info --chain sol --contract <address>
# Token price only
python3 scripts/bitget_api.py token-price --chain sol --contract <address>
# Batch token info (comma-separated)
python3 scripts/bitget_api.py batch-token-info --tokens "sol:<addr1>,eth:<addr2>"
# K-line data
python3 scripts/bitget_api.py kline --chain sol --contract <address> --period 1h --size 24
# Token transaction info (5m/1h/4h/24h volume, buyers, sellers)
python3 scripts/bitget_api.py tx-info --chain sol --contract <address>
# Batch transaction info
python3 scripts/bitget_api.py batch-tx-info --tokens "sol:<addr1>,eth:<addr2>"
# Token rankings (topGainers / topLosers)
python3 scripts/bitget_api.py rankings --name topGainers
# Token liquidity pools
python3 scripts/bitget_api.py liquidity --chain sol --contract <address>
# Historical coins (discover new tokens)
python3 scripts/bitget_api.py historical-coins --create-time <datetime> --limit 20
# Security audit
python3 scripts/bitget_api.py security --chain sol --contract <address>
# Swap quote (amount is human-readable)
python3 scripts/bitget_api.py swap-quote --from-chain sol --from-contract <addr> --to-contract <addr> --amount 1
# Swap calldata (returns tx data for signing; --slippage is optional, system auto-calculates if omitted)
python3 scripts/bitget_api.py swap-calldata --from-chain sol --from-contract <addr> --to-contract <addr> --amount 1 --from-address <wallet> --to-address <wallet> --market <market> --slippage 2
# Swap send (broadcast signed transaction)
python3 scripts/bitget_api.py swap-send --chain sol --raw-transaction <signed_hex>
# --- Order Mode (cross-chain + gasless) ---
# Order quote (supports cross-chain: fromChain != toChain)
python3 scripts/bitget_api.py order-quote \
--from-chain base --from-contract 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 \
--to-chain bnb --to-contract 0x55d398326f99059fF775485246999027B3197955 \
--amount 2.0 --from-address <wallet>
# Order create (returns unsigned tx data; use --feature no_gas for gasless)
python3 scripts/bitget_api.py order-create \
--from-chain base --from-contract 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 \
--to-chain bnb --to-contract 0x55d398326f99059fF775485246999027B3197955 \
--amount 2.0 --from-address <wallet> --to-address <wallet> \
--market bkbridgev3.liqbridge --slippage 3.0 --feature no_gas
# Order submit (submit signed transaction)
python3 scripts/bitget_api.py order-submit \
--order-id <orderId> --signed-txs "0x<signed_hex>"
# Order status (poll order completion)
python3 scripts/bitget_api.py order-status --order-id <orderId>
scripts/x402_pay.py — x402 Payment Client# Sign EIP-3009 payment (USDC on Base)
python3 scripts/x402_pay.py sign-eip3009 \
--private-key <hex> --token 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 \
--chain-id 8453 --to <payTo_address> --amount 10000
# Partially sign Solana x402 transaction
python3 scripts/x402_pay.py sign-solana \
--private-key <hex> --transaction <base64_tx>
# Full HTTP 402 flow (auto-detect, sign, pay)
python3 scripts/x402_pay.py pay --url https://api.example.com/data --private-key <hex>
| Chain | ID | Code |
|---|---|---|
| Ethereum | 1 | eth |
| Solana | 100278 | sol |
| BNB Chain | 56 | bnb |
| Base | 8453 | base |
| Arbitrum | 42161 | arbitrum |
| Tron | 6 | trx |
| Ton | 100280 | ton |
| Sui | 100281 | suinet |
| Optimism | 10 | optimism |
| Polygon | 137 | matic |
Use empty string "" for native tokens (ETH, SOL, BNB, etc.).
Partner-Code: bgw_swap_public header (hardcoded in script)Weekly Installs
47
Repository
GitHub Stars
112
First Seen
11 days ago
Security Audits
Gen Agent Trust HubPassSocketPassSnykWarn
Installed on
opencode47
gemini-cli47
github-copilot47
codex47
amp47
kimi-cli47
xdrop 文件传输脚本:Bun 环境下安全上传下载工具,支持加密分享
40,400 周安装
Bun Nuxt 快速开发指南:使用 Bun 运行 Nuxt 3 提升开发效率与性能
13 周安装
Bun FFI 教程:JavaScript 调用 C/C++ 原生库的完整指南
12 周安装
Bun HTTP Server 高性能服务器教程 - Bun.serve() 快速搭建与请求处理指南
13 周安装
Bun Macros 宏使用指南 - 构建时 JavaScript 代码内联与优化
12 周安装
n8n工作流自动化设计:具备重试、日志、审核队列的稳健流程
85 周安装
Bun Shell 教程:Bun.js Shell 脚本与进程管理 API 完整指南
11 周安装
0xfde4C96c8593536E31F229EA8f37b2ADa2699bb2 |
0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 |
Arbitrum (arbitrum) | 0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9 | 0xaf88d065e77c8cC2239327C5EDb3A432268e5831 |
Optimism (optimism) | 0x94b008aA00579c1307B0EF2c499aD98a8ce58e58 | 0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85 |
Polygon (matic) | 0xc2132D05D31c914a87C6611C10748AEb04B58e8F | 0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359 |
Solana (sol) | Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB | EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v |
Morph (morph) | 0xe7cd86e13AC4309349F30B3435a9d337750fC82D | — (not yet available) |
docs/x402-payments.md| HTTP 402 payment protocol, paying for APIs with USDC, EIP-3009, Permit2, Solana partial-sign |