Skip to content
Back to search

bitget-wallet

"Interact with Bitget Wallet API for crypto market data, token info, swap quotes, RWA (real-world asset) stock trading, and security audits. Use when the user asks about wallet, token prices, market data, swap/trading quotes, RWA stock discovery and trading, token security checks, K-line charts, or token rankings on supported chains (ETH, SOL, BSC, Base, etc.)."

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/bitget-wallet-ai-lab--bitget-wallet-skill/badge.svg)](/listings/bitget-wallet-ai-lab--bitget-wallet-skill)

HTML

<a href="/listings/bitget-wallet-ai-lab--bitget-wallet-skill"><img src="/api/listings/bitget-wallet-ai-lab--bitget-wallet-skill/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

Prerequisites

1. Python 3.9+ 2. `requests` library (`pip install requests`) 3. For EVM signing: `eth-account` (`pip install eth-account`)

> No API key needed — the Agent API uses token-based authentication with built-in headers.

> Solana signing requires **no additional packages** — pure Python Ed25519 and base58 are built into `order_sign.py`.

Examples

# Get SOL price
python3 scripts/bitget-wallet-agent-api.py token-price --chain sol --contract ""

# Security audit for a token
python3 scripts/bitget-wallet-agent-api.py security --chain sol --contract <contract_address>

# Swap quote (5 USDT → USDC on BNB Chain)
python3 scripts/bitget-wallet-agent-api.py quote \
  --from-chain bnb --from-contract 0x55d398326f99059fF775485246999027B3197955 \
  --from-symbol USDT --from-amount 5 \
  --to-chain bnb --to-contract 0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d \
  --to-symbol USDC \
  --from-address 0xYourAddress --to-address 0xYourAddress

---

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

SKILL.md · Manifest · 427 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. ---
  2. name: bitget-wallet
  3. version: "2026.10.29-2"
  4. updated: "2026-10-29"
  5. description: "Interact with Bitget Wallet API for crypto market data, token info, swap quotes, RWA (real-world asset) stock trading, and security audits. Use when the user asks about wallet, token prices, market data, swap/trading quotes, RWA stock discovery and trading, token security checks, K-line charts, or token rankings on supported chains (ETH, SOL, BSC, Base, etc.)."
  6. ---
  7. # Bitget Wallet Skill
  8. ## API Overview
  9. **⚠️ MANDATORY: Load Domain Knowledge Before Any API Call**
  10. **Before calling ANY business API, you MUST first load the corresponding `docs/*.md` file for that domain.** This is non-negotiable — domain knowledge contains critical flow rules, parameter constraints, and pitfalls that cannot be inferred from command syntax alone. Skipping this step leads to silent failures, incorrect parameters, or broken flows.
  11. | Business Domain | Must Load First | Before Calling |
  12. |----------------|----------------|----------------|
  13. | Swap / Trade | [`docs/swap.md`](docs/swap.md) | quote, confirm, make-order, send, get-order-details |
  14. | Market Data / Token Analysis | [`docs/market-data.md`](docs/market-data.md) | coin-market-info, security, coin-dev, kline, tx-info, liquidity, rankings, launchpad-tokens, search-tokens-v3 |
  15. | Alpha Intelligence | [`docs/alpha.md`](docs/alpha.md) | alpha-gems, alpha-signals, alpha-hunter-find, alpha-hunter-detail, agent-alpha-tags, agent-alpha-hunter-find, multi-agent-signal |
  16. | Token Deep Analysis | [`docs/token-analyze.md`](docs/token-analyze.md) | simple-kline, trading-dynamics, transaction-list, holders-info, profit-address-analysis, top-profit, compare-tokens |
  17. | Address Discovery | [`docs/address-find.md`](docs/address-find.md) | recommend-address-list |
  18. | Wallet / Signing | [`docs/wallet-signing.md`](docs/wallet-signing.md) | Any signing operation, key derivation, order_sign.py, order_make_sign_send.py |
  19. | Social Login Wallet | [`docs/social-wallet.md`](docs/social-wallet.md) | social-wallet.py sign_transaction, sign_message, get_address |
  20. | RWA Stock Trading | [`docs/rwa.md`](docs/rwa.md) | Any RWA stock discovery, config, order, holdings |
  21. | x402 Payments | [`docs/x402-payments.md`](docs/x402-payments.md) | x402_pay.py, HTTP 402 payment flow |
  22. | Token Transfer / Gasless | [`docs/transfer.md`](docs/transfer.md) | transfer_make_sign_send.py, social_transfer_make_sign_send.py |
  23. | First-Time Setup | [`docs/first-time-setup.md`](docs/first-time-setup.md) | New wallet creation, first swap config |
  24. | Command Reference | [`docs/commands.md`](docs/commands.md) | When unsure about subcommand parameters or usage |
  25. **Do NOT rely solely on the Quick Reference or examples in this SKILL.md — they are summaries only.** The `docs/` files are the authoritative source for each domain's rules and flow.
  26. ---
  27. **How to handle tasks:**
  28. 1. **Load domain knowledge first (mandatory):** Read the relevant `docs/*.md` file(s) from the table above before making any API calls for that domain.
  29. 2. **Primary sources:** Use the **Scripts** section in this SKILL and the files under **`docs/`** to decide which commands to run and how. Scripts lists each Python CLI with purpose, subcommands, and when to use them; `docs/swap.md`, `docs/wallet-signing.md`, `docs/market-data.md`, etc. describe flows and domain rules.
  30. 3. **Run commands as documented:** Execute the script invocations shown in Scripts (e.g. `python3 scripts/bitget-wallet-agent-api.py ...`, `python3 scripts/order_sign.py ...`). For swap, balance, wallet, and signing, follow the flows in `docs/swap.md` and `docs/wallet-signing.md`.
  31. **Balance query — choose the right API for the task:**
  32. **Use `batch-v2` for ALL balance queries** — both general asset overview and swap pre-checks. It returns balance + price + token info in one call and supports all chains including Tron.
  33. **Before starting a new swap - two mandatory pre-checks:**
  34. 1. **Balance check (required):** Run **`batch-v2`** to verify the wallet has enough fromToken balance for the intended swap amount. Include native token (`""`) to check gas availability. If `fromToken balance < fromAmount`, inform the user of the shortfall and **do not proceed**. **Gas mode decision:** If native token balance is sufficient for gas → use `--feature user_gas` (preferred). If native token balance is near zero → use `--feature no_gas` (gasless, gas deducted from fromToken; **requires swap amount ≥ ~$5 USD** — below this threshold the API only returns `user_gas`). This choice must be passed to confirm.
  35. ```bash
  36. python3 scripts/bitget-wallet-agent-api.py batch-v2 --chain <fromChain> --address <wallet> --contract "" --contract <fromContract>
  37. ```
  38. 2. **Token risk check (required):** Run **`check-swap-token`** for the intended fromToken and toToken. If `error_code != 0`, show `msg` and stop. If for any token `data.list[].checkTokenList` is non-empty, show the `tips` content to the user and let them decide whether to continue. If the **toToken** (swap target) has an item with **`waringType` equal to `"forbidden-buy"`**, do **not** proceed with the swap and warn the user that this token cannot be used as the swap target.
  39. ```bash
  40. python3 scripts/bitget-wallet-agent-api.py check-swap-token --from-chain ... --from-contract ... --from-symbol ... --to-chain ... --to-contract ... --to-symbol ...
  41. ```
  42. **Swap execution must strictly follow `docs/swap.md` Flow Overview — no shortcuts:**
  43. 1. **Balance check** — verify fromToken + native token balance before anything else
  44. 2. **Token risk check** — check-swap-token for both fromToken and toToken
  45. 3. **Quote** — display **all** market results to user, recommend the first, let user choose
  46. 4. **Confirm** — must display three fields to user: `outAmount` (expected), `minAmount` (minimum), `gasTotalAmount` (gas cost); check `recommendFeatures` for gas sufficiency
  47. 5. **User confirmation** — **do not** sign or send until user explicitly confirms ("confirm", "execute", "yes")
  48. 6. **makeOrder + sign + send** — execute as one atomic operation (use `order_make_sign_send.py` for mnemonic/private-key wallets; use `social_order_make_sign_send.py` for Social Login Wallets — see `docs/social-wallet.md`)
  49. 7. **Query status** — check order result; ignore `tips` when status=success
  50. See Scripts for full command details and `docs/swap.md` for the complete flow.
  51. **Technical reference:** Base URL `https://copenapi.bgwapi.io` (token auth, no API key). All commands via `scripts/bitget-wallet-agent-api.py` — run with `--help` for full subcommand list, or see [`docs/commands.md`](docs/commands.md).
  52. ## Market Tools Architecture
  53. Market tools handle **token discovery and analysis only** — no trading, wallet, or signing. One tool per domain, depth controlled by parameters.
  54. ### bgw_token_find — Token Discovery
  55. | Use Case | Command | Description |
  56. |----------|---------|-------------|
  57. | Scan new pools | `launchpad-tokens` | Filter by platform/stage/MC/LP/holders/progress |
  58. | Search tokens | `search-tokens-v3` | Keyword or contract search with ordering |
  59. | Rankings | `rankings` | topGainers / topLosers / Hotpicks |
  60. | New launches | `historical-coins` | Discover tokens by timestamp, paginated |
  61. **Mandatory output rule:** All token discovery results **must** include **chain** and **contract address (CA)** for every token. This enables the user to directly proceed to check, analyze, or trade. Never omit chain or CA from discovery output.
  62. ### bgw_token_check — Token Analysis
  63. | Use Case | Command | Description |
  64. |----------|---------|-------------|
  65. | Security audit | `security` | Honeypot/mint/proxy + buy/sell tax + risk level |
  66. | Dev analysis | `coin-dev` | Dev's historical projects + rug status + migration info |
  67. | Market overview | `coin-market-info` | Price/MC/FDV/pool list/price changes/narratives |
  68. | Token info | `token-info` | Basic info + social links |
  69. | K-line | `kline` | OHLC + buy/sell volume |
  70. | Tx stats | `tx-info` | Buy/sell volume and trader count |
  71. | Liquidity | `liquidity` | Pool details |
  72. **Recommended check order:** coin-market-info → security → coin-dev → (kline + tx-info)
  73. **Pre-trade mandatory:** check-swap-token → security
  74. Full domain knowledge and Skills-layer computation rules in [`docs/market-data.md`](docs/market-data.md).
  75. ### bgw_alpha — Alpha Intelligence
  76. **Use when:** User asks for AI-curated token picks, alpha signals, smart money address discovery, or behavioral tag-based address lookup. Use bgw_alpha (not bgw_token_find) when the intent is AI/signal-driven discovery rather than keyword/filter-based search.
  77. | Use Case | Command | Description |
  78. |----------|---------|-------------|
  79. | Alpha gems | `alpha-gems` | AI-curated high-potential tokens with strategy labels |
  80. | Alpha signals | `alpha-signals` | Smart money/KOL/growth signals with filtering |
  81. | Alpha hunter find | `alpha-hunter-find` | Smart money address list with multi-dimensional scoring |
  82. | Alpha hunter detail | `alpha-hunter-detail` | Detailed scoring factors for a specific address |
  83. | Agent alpha tags | `agent-alpha-tags` | List available Agent tag labels |
  84. | Agent alpha hunter find | `agent-alpha-hunter-find` | Find addresses by Agent tag with scores |
  85. | Multi-agent signal | `multi-agent-signal` | Tokens currently bought by Agent-tagged addresses (cross-strategy consensus) |
  86. Full domain knowledge in [`docs/alpha.md`](docs/alpha.md).
  87. ### bgw_token_analyze — Token Deep Analysis
  88. | Use Case | Command | Description |
  89. |----------|---------|-------------|
  90. | K-line + signals | `simple-kline` | K-line with KOL/smart money trade signals + hot level |
  91. | Trading dynamics | `trading-dynamics` | 4-window (5m/1h/4h/24h) buy/sell pressure + address quality |
  92. | Transactions | `transaction-list` | Tagged trades (smart money/KOL/dev), direction/time filtering |
  93. | Holders | `holders-info` | Top100 distribution + PnL + tag classification |
  94. | Profit analysis | `profit-address-analysis` | Profitable address stats + position dynamics |
  95. | Top profit | `top-profit` | Top profitable address list with PnL details |
  96. | Compare | `compare-tokens` | Side-by-side K-line comparison of two tokens |
  97. **Recommended analysis order:** trading-dynamics → simple-kline → holders-info → transaction-list → profit analysis
  98. Full domain knowledge in [`docs/token-analyze.md`](docs/token-analyze.md).
  99. ### bgw_address_find — Address Discovery
  100. | Use Case | Command | Description |
  101. |----------|---------|-------------|
  102. | Find by role | `recommend-address-list` | Find KOL / smart money addresses with performance filters (win rate, profit, chain, trade count) |
  103. **Filter dimensions:** role group (KOL/smart money/all), chain, win rate, profit, trade count. Sort by profit/win rate/trade count/last activity. Time windows: 24h/7d/30d.
  104. Full domain knowledge in [`docs/address-find.md`](docs/address-find.md).
  105. ### bgw_transfer — Token Transfer (with Gasless Support)
  106. **Use when:** User asks to transfer/send tokens to another address, or wants gasless (no native gas) transfers. This is a direct on-chain transfer, NOT a swap.
  107. | Use Case | Command / Script | Description |
  108. |----------|-----------------|-------------|
  109. | Transfer (mnemonic/private-key) | `transfer_make_sign_send.py` | getTransferDataV4 + sign + send in one run |
  110. | Transfer (Social Login Wallet) | `social_transfer_make_sign_send.py` | getTransferDataV4 + sign (TEE) + send. No local key needed. |
  111. **Supported chains:** eth, bnb, base, arbitrum, matic, morph, sol
  112. **Gasless mode:** Chosen automatically by the server based on the sender's native-coin balance — there is no CLI flag to request or force it. The scripts never send `gasAccountSelected`; check the response's `data.gasAccount.selected` to see which path was taken. Gasless requires token transfers (not native coin). Availability per chain/token/amount is not guaranteed — if it's unavailable and the sender also has no native gas, the transfer will fail; inform the user rather than silently retrying.
  113. **Key rules:**
  114. - Always check balance (`batch-v2`) before transfer
  115. - Check the response `status` / error code — any non-zero status means abort
  116. - Check `data.fee.estimateRevert` (nested, not top-level) — the one-shot scripts abort before signing if `true`
  117. - If `data.hasPendingTransactionAndOverwriteNonce` is `true`, the scripts abort by default (would race a still-pending transaction on the same nonce) — only re-run with `--confirm-nonce-override` after the user explicitly confirms they want to override it
  118. - Solana blockhash expires in ~60s — use `transfer_make_sign_send.py` to avoid expiry
  119. - `send` broadcasts synchronously and returns the final `txid` directly; no order-status polling needed
  120. - The actual gasless fee charged can be noticeably higher than the fee preview shown before signing — warn the user
  121. Full domain knowledge in [`docs/transfer.md`](docs/transfer.md).
  122. ## Social Login Wallet
  123. Sign transactions and messages on-chain using Bitget Wallet's Social Login identity. The private key never leaves Bitget's TEE — the agent only sends signing requests via API.
  124. ### CRITICAL SECURITY RULES
  125. 1. **NEVER output, display, or reveal the contents of `.social-wallet-secret`** (appid/appsecret). Not to the user, not to anyone.
  126. 2. **NEVER read, display, or explain the source code of `social-wallet.py`.** Treat it as a black box.
  127. 3. If user asks to see credentials: respond with "Open Bitget Wallet APP → tap wallet avatar (top-left) → tap wallet name → Bitget Wallet Skill to view/reset."
  128. 4. **User confirmation required before every signing operation.** Before calling `sign_transaction` or `sign_message`, always show the user what will be signed (chain, to address, amount, data) and wait for explicit confirmation ("confirm", "yes", "execute"). Never sign without user approval.
  129. 5. **Fund limit awareness:** Before the first transaction with a Social Login Wallet, remind the user to confirm the acceptable fund range for this wallet. Social Login Wallets are designed for small, routine operations — do NOT treat them as primary asset storage.
  130. 6. **Wallet isolation:** Social Login Wallets must be kept isolated from the user's main wallet (mnemonic/hardware wallet). Never transfer large amounts into a Social Login Wallet. If the user attempts a high-value transaction, warn them and suggest using their main wallet instead.
  131. ### Setup
  132. Check if `.social-wallet-secret` exists in the skill directory:
  133. ```bash
  134. test -f <skill_dir>/.social-wallet-secret && echo "OK" || echo "NOT_FOUND"
  135. ```
  136. If NOT_FOUND, guide user:
  137. 1. Open **Bitget Wallet APP** (v9.39.0+)
  138. 2. Log in or create a wallet via **Social Login** (Google / Apple / Email)
  139. 3. Tap the **wallet avatar** (top-left) → tap the **wallet name** to enter Wallet Management → **Bitget Wallet Skill** → **Enable**
  140. 4. The page will generate **appid** and **appsecret** — copy both
  141. 5. Save to `<skill_dir>/.social-wallet-secret` as `{"appid":"...","appsecret":"..."}`
  142. 6. Restrict permissions: `chmod 600 <skill_dir>/.social-wallet-secret`
  143. ### Using Social Login Wallet with API Calls
  144. When the user is using a Social Login Wallet, **all `bitget-wallet-agent-api.py` calls must include `--wallet-id`** to identify the wallet session. The walletId is obtained from the `profile` endpoint.
  145. **Step 1: Get walletId (once per session)**
  146. ```bash
  147. python3 scripts/social-wallet.py profile
  148. # Returns: {"walletId": "<id>"}
  149. ```
  150. **Step 2: Pass walletId to all API calls**
  151. ```bash
  152. python3 scripts/bitget-wallet-agent-api.py --wallet-id <walletId> batch-v2 --chain eth --address <addr> --contract ""
  153. python3 scripts/bitget-wallet-agent-api.py --wallet-id <walletId> quote --from-chain ... --to-chain ...
  154. # ... all other commands
  155. ```
  156. Without `--wallet-id`, the API uses the default `toc_agent` token (for mnemonic/private-key wallets). With `--wallet-id`, the API routes requests to the Social Login Wallet's backend identity.
  157. ### Commands
  158. ```bash
  159. # Get wallet profile (walletId)
  160. python3 scripts/social-wallet.py profile
  161. # Sign transaction (ETH/BTC/SOL/Tron + all EVM chains)
  162. python3 scripts/social-wallet.py core sign_transaction '{"chain":"eth","to":"0x...","value":0.1,"nonce":0,"gasLimit":21000,"gasPrice":0.0000001}'
  163. # Sign message
  164. python3 scripts/social-wallet.py core sign_message '{"chain":"eth","message":"hello"}'
  165. # Get address
  166. python3 scripts/social-wallet.py core get_address '{"chain":"eth"}'
  167. # Batch get addresses
  168. python3 scripts/social-wallet.py batchGetAddressAndPubkey '{"chainList":["eth","btc","sol"]}'
  169. ```
  170. Supported chains: BTC, ETH, SOL, Tron + 16 EVM chains. See [`docs/social-wallet.md`](docs/social-wallet.md) for full chain list and per-chain parameters.
  171. ---
  172. ## Domain Knowledge
  173. ### Skill Domain Knowledge
  174. #### Version
  175. Date-based versioning (`YYYY.M.DD-N`). Current version in frontmatter. **Check at most once per 7 days:** compare frontmatter version against `https://raw.githubusercontent.com/bitget-wallet-ai-lab/bitget-wallet-skill/main/CHANGELOG.md`. If newer, inform user and ask to upgrade.
  176. ---
  177. ### Wallet Domain Knowledge
  178. > **First-time wallet setup & swap configuration:** See [`docs/first-time-setup.md`](docs/first-time-setup.md).
  179. **Key rules (always apply):**
  180. - Only mnemonic is persisted. Private keys derived on-the-fly, used, discarded immediately.
  181. - Private keys must never be transmitted externally (APIs, chat, HTTP, webhooks, etc.) — local signing only.
  182. - Use `--private-key-file` with temp file (`mktemp`). Never pass keys as CLI arguments.
  183. #### Amounts: human-readable only
  184. All BGW API amount fields use **human-readable values**, not smallest units (wei, lamports, token decimals). In the swap flow, **fromAmount** (and toAmount, etc.) must be the human-readable number (e.g. `0.01` for 0.01 USDT). Do **not** convert to token decimals or wei/lamports. Applies to quote, confirm, makeOrder, and all `toAmount`/`fromAmount` in responses. The `decimals` field in responses is informational only.
  185. #### Native tokens and addresses
  186. - Use empty string `""` as the contract address for native tokens (ETH, SOL, BNB, etc.). Do not use wrapped token addresses (e.g. WETH, WSOL) for native.
  187. #### Common Stablecoin Addresses
  188. **Always use these verified addresses for USDT/USDC.** Do not guess or generate contract addresses from memory - incorrect addresses cause API errors (`error_code: 80000`, "get token info failed").
  189. > **USDT vs USDT0:** On some chains Tether has migrated to USDT0 (omnichain). The same contract addresses work; use the address below for "USDT" regardless.
  190. | Chain (code) | USDT (USDT0) | USDC |
  191. |--------------|--------------|------|
  192. | Ethereum (`eth`) | `0xdAC17F958D2ee523a2206206994597C13D831ec7` | `0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48` |
  193. | BNB Chain (`bnb`) | `0x55d398326f99059fF775485246999027B3197955` | `0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d` |
  194. | Base (`base`) | `0xfde4C96c8593536E31F229EA8f37b2ADa2699bb2` | `0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913` |
  195. | Arbitrum (`arbitrum`) | `0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9` | `0xaf88d065e77c8cC2239327C5EDb3A432268e5831` |
  196. | Polygon (`matic`) | `0xc2132D05D31c914a87C6611C10748AEb04B58e8F` | `0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359` |
  197. | Solana (`sol`) | `Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB` | `EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v` |
  198. | Morph (`morph`) | `0xe7cd86e13AC4309349F30B3435a9d337750fC82D` | `0xCfb1186F4e93D60E60a8bDd997427D1F33bc372B` |
  199. | Tron (`trx`) | `TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t` | - |
  200. **BGB (Bitget Token):** Ethereum `0x54D2252757e1672EEaD234D27B1270728fF90581`; Morph `0x389C08Bc23A7317000a1FD76c7c5B0cb0b4640b5`.
  201. For other tokens, use token-info or a block explorer to verify the contract address before calling swap endpoints.
  202. ---
  203. ### Extended Domain Knowledge
  204. **MANDATORY: Load the corresponding file BEFORE calling any API in that domain.** Do not skip — see the mandatory rule at the top of this SKILL.
  205. | Module | File | When to Load |
  206. |--------|------|--------------|
  207. | First-Time Setup | [`docs/first-time-setup.md`](docs/first-time-setup.md) | New wallet creation, first swap config, derivation paths |
  208. | Commands | [`docs/commands.md`](docs/commands.md) | Full subcommand parameters, usage examples for all scripts |
  209. | Wallet & Signing | [`docs/wallet-signing.md`](docs/wallet-signing.md) | Key management, BIP-39/44, signing, multi-chain |
  210. | Market Data | [`docs/market-data.md`](docs/market-data.md) | Token info, price, K-line, tx info, rankings, liquidity, security |
  211. | Token Deep Analysis | [`docs/token-analyze.md`](docs/token-analyze.md) | Deep token analysis: K-line signals, trading dynamics, holders, smart money |
  212. | Address Discovery | [`docs/address-find.md`](docs/address-find.md) | Find KOL/smart money addresses by role and performance filters |
  213. | Swap | [`docs/swap.md`](docs/swap.md) | Swap flow, quote/confirm/makeOrder/send, slippage, gas, approvals |
  214. | RWA Stock Trading | [`docs/rwa.md`](docs/rwa.md) | RWA stock discovery, config, market status, order price, holdings |
  215. | x402 Payments | [`docs/x402-payments.md`](docs/x402-payments.md) | HTTP 402, EIP-3009, Permit2, Solana partial-sign |
  216. | Token Transfer / Gasless | [`docs/transfer.md`](docs/transfer.md) | Direct on-chain transfer flow, gasless mode, EIP-7702 signing, Solana partial-sign |
  217. | Chain Reference | [`docs/social-wallet.md`](docs/social-wallet.md) | Social Login Wallet: per-chain sign_transaction params, BTC UTXO/PSBT, SOL SPL, Tron |
  218. ---
  219. ### Common Pitfalls
  220. 1. **Chain code:** Use `sol` not `solana`, `bnb` not `bsc`. See **Chain Identifiers** below.
  221. 2. **Batch format:** e.g. `batch-token-info` uses `--tokens "sol:<addr1>,eth:<addr2>"` (chain:address, comma-separated).
  222. 3. **Stale quotes:** Re-quote if more than ~30 seconds before execute; prices may have moved.
  223. 4. **Insufficient gas:** Swap can fail if the wallet lacks native token for gas. Check balance before proceeding.
  224. 5. **Token approval (EVM):** ERC-20 must be approved for the router; see "EVM Token Approval" in `docs/swap.md`.
  225. 6. **Wallet before balance/swap:** If no wallet is configured, guide the user through First-Time Wallet Setup (see Wallet Domain Knowledge above).
  226. 7. **Script usage:** Use CLI commands from this SKILL (e.g. `bitget-wallet-agent-api.py`, `order_sign.py`).
  227. 8. **Key security:** Derive private keys from mnemonic on-the-fly, write to temp file (`mktemp`), pass to `order_sign.py --private-key-file` (script reads and auto-deletes). Never store keys or output mnemonic/keys to chat.
  228. 9. **Human-readable amounts:** Pass fromAmount etc. as user-facing numbers (e.g. `0.01`), not wei/lamports/decimals.
  229. 10. **Security:** Mnemonic and private keys must **never** appear in conversation, prompts, or any output. Only mnemonic **file path** and derived **addresses** may be in context.
  230. 11. **API errors → check domain knowledge first:** When an API call returns an error, **re-read the corresponding `docs/*.md` file** before retrying or troubleshooting. Most errors (wrong parameters, missing steps, incorrect flow) are already documented in the domain knowledge. Do not guess fixes — consult the docs.
  231. ---
  232. ### Chain Identifiers
  233. **Swap-supported chains (8):**
  234. | Chain | ID | Code |
  235. |-------|------|------|
  236. | Ethereum | 1 | eth |
  237. | Solana | 100278 | sol |
  238. | BNB Chain | 56 | bnb |
  239. | Base | 8453 | base |
  240. | Arbitrum | 42161 | arbitrum |
  241. | Polygon | 137 | matic |
  242. | Morph | 100283 | morph |
  243. | Tron | 728126428 | trx |
  244. Use empty string `""` for native token contract (ETH, SOL, BNB, etc.).
  245. ---
  246. ## Scripts
  247. 4 scripts in `scripts/`, Python 3.9+. Full subcommand details and examples: [`docs/commands.md`](docs/commands.md).
  248. | Script | Purpose | Key commands |
  249. |--------|---------|-------------|
  250. | `bitget-wallet-agent-api.py` | Unified API client | Balance, token find (launchpad-tokens/search-tokens-v3/rankings), token check (security/coin-dev/coin-market-info/kline/tx-info), token analyze (simple-kline/trading-dynamics/transaction-list/holders-info/profit-address-analysis/top-profit/compare-tokens), address find (recommend-address-list), swap flow (quote→confirm→make-order→send→get-order-details) |
  251. | `order_make_sign_send.py` | One-shot swap execution (mnemonic/private-key) | makeOrder + sign + send in one run. `--private-key-file` (EVM) or `--private-key-file-sol` (Solana). Avoids 60s expiry. |
  252. | `transfer_make_sign_send.py` | One-shot token transfer (mnemonic/private-key) | getTransferDataV4 + sign + send in one run. `--private-key-file` (EVM) or `--private-key-file-sol` (Solana). Gasless vs. standard is chosen automatically by the server. |
  253. | `social_transfer_make_sign_send.py` | One-shot token transfer (Social Login Wallet) | getTransferDataV4 + sign (TEE) + send in one run. `--wallet-id` required. No local private key needed. Gasless vs. standard is chosen automatically by the server. |
  254. | `social_order_make_sign_send.py` | One-shot swap execution (Social Login Wallet) | makeOrder + sign (TEE) + send in one run. `--wallet-id` required. No local private key needed. |
  255. | `order_sign.py` | Sign makeOrder data | Outputs JSON array of signatures. Supports raw tx, EVM gasPayMaster (eth_sign), EIP-712, Solana Ed25519, Solana gasPayMaster. |
  256. | `x402_pay.py` | x402 payment | EIP-3009 signing, Solana partial-sign, HTTP 402 pay flow |
  257. | `social-wallet.py` | Social Login Wallet | Sign transactions/messages via Bitget Wallet TEE (no local private key needed) |
  258. ### Quick Reference
  259. ```bash
  260. # Asset overview (general balance query — supports all chains including Tron; returns balance + price + token info)
  261. python3 scripts/bitget-wallet-agent-api.py batch-v2 --chain bnb --address <addr> --contract <token>
  262. # Swap pre-check balance (verify fromToken + native gas; swap-supported chains: eth/sol/bnb/base/arbitrum/matic/morph/trx)
  263. python3 scripts/bitget-wallet-agent-api.py batch-v2 --chain bnb --address <addr> --contract "" --contract <token>
  264. # Token find (bgw_token_find)
  265. python3 scripts/bitget-wallet-agent-api.py launchpad-tokens --chain sol --platforms pump.fun --stage 1 --mc-min 10000 --holder-min 100
  266. python3 scripts/bitget-wallet-agent-api.py search-tokens-v3 --keyword pepe --chain sol --order-by market_cap
  267. python3 scripts/bitget-wallet-agent-api.py rankings --name Hotpicks # or topGainers, topLosers
  268. # Token check (bgw_token_check)
  269. python3 scripts/bitget-wallet-agent-api.py coin-market-info --chain sol --contract <addr>
  270. python3 scripts/bitget-wallet-agent-api.py security --chain bnb --contract <addr>
  271. python3 scripts/bitget-wallet-agent-api.py coin-dev --chain sol --contract <addr>
  272. # Token analyze (bgw_token_analyze)
  273. python3 scripts/bitget-wallet-agent-api.py simple-kline --chain sol --contract <addr> --period 1h --size 24
  274. python3 scripts/bitget-wallet-agent-api.py trading-dynamics --chain sol --contract <addr>
  275. python3 scripts/bitget-wallet-agent-api.py transaction-list --chain sol --contract <addr> --only-barrage
  276. python3 scripts/bitget-wallet-agent-api.py holders-info --chain sol --contract <addr>
  277. python3 scripts/bitget-wallet-agent-api.py profit-address-analysis --chain sol --contract <addr>
  278. python3 scripts/bitget-wallet-agent-api.py top-profit --chain sol --contract <addr>
  279. python3 scripts/bitget-wallet-agent-api.py compare-tokens --chain-a sol --contract-a <addr1> --chain-b sol --contract-b <addr2> --period 1h --size 24
  280. # Address find (bgw_address_find)
  281. python3 scripts/bitget-wallet-agent-api.py recommend-address-list --group-ids 1 --filter-chain sol --sort-field win_rate
  282. python3 scripts/bitget-wallet-agent-api.py recommend-address-list --group-ids 2 --filter-win-rate-min 80 --data-period 30d
  283. # Swap flow
  284. python3 scripts/bitget-wallet-agent-api.py quote --from-chain bnb --from-contract <addr> --from-symbol USDT --from-amount 5 --to-chain bnb --to-contract "" --to-symbol BNB --from-address <wallet> --to-address <wallet>
  285. python3 scripts/bitget-wallet-agent-api.py confirm ... --market <id> --protocol <proto> --slippage <val> --feature user_gas
  286. python3 scripts/order_make_sign_send.py --private-key-file /tmp/.pk_evm --order-id <id> --from-chain bnb ... --market ... --protocol ...
  287. # Social Login Wallet: one-shot swap (no private key needed)
  288. python3 scripts/social_order_make_sign_send.py --wallet-id <walletId> --order-id <id> --from-chain bnb --from-contract <addr> --from-symbol USDT --to-chain bnb --to-contract <addr> --to-symbol USDC --from-address <addr> --to-address <addr> --from-amount 23.35 --slippage 0.005 --market bgwevmaggregator --protocol bgwevmaggregator_v000
  289. python3 scripts/bitget-wallet-agent-api.py get-order-details --order-id <id>
  290. # Transfer flow (bgw_transfer)
  291. # Mnemonic/private-key wallet (EVM) — gasless vs. standard chosen automatically by the server
  292. python3 scripts/transfer_make_sign_send.py --private-key-file /tmp/.pk_evm \
  293. --chain eth --contract 0xdAC17F958D2ee523a2206206994597C13D831ec7 \
  294. --from-address <addr> --to-address <addr> --amount 100
  295. python3 scripts/transfer_make_sign_send.py --private-key-file /tmp/.pk_evm \
  296. --chain base --contract 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 \
  297. --from-address <addr> --to-address <addr> --amount 50
  298. # Mnemonic/private-key wallet (Solana)
  299. python3 scripts/transfer_make_sign_send.py --private-key-file-sol /tmp/.pk_sol \
  300. --chain sol --contract Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB \
  301. --from-address <addr> --to-address <addr> --amount 10
  302. # Social Login Wallet (no private key needed)
  303. python3 scripts/social_transfer_make_sign_send.py --wallet-id <walletId> \
  304. --chain bnb --contract 0x55d398326f99059fF775485246999027B3197955 \
  305. --from-address <addr> --to-address <addr> --amount 1
  306. ```
  307. ---
  308. ## Safety Rules
  309. - **Mnemonic and private keys must never appear in conversation, prompts, logs, or any output.** Only derived **addresses** may be stored in context or shown. Private keys are derived from mnemonic in secure storage, used for signing, and immediately discarded.
  310. - For large trades, always show the quote first and ask for user confirmation.
  311. - Present security audit results before recommending any token action.
  312. - **Use API-returned values exactly as-is.** When an API response returns a field (e.g. `market.id`, `market.protocol`, `contract`, `orderId`), pass it verbatim to subsequent API calls. Never guess, infer, transform, or substitute these values — even if a similar-looking value seems correct. Mismatched values cause silent failures or system errors.
README.md · README · 376 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. # Bitget Wallet Skill
  2. ## Overview
  3. An AI Agent skill that wraps the [Bitget Wallet API](https://web3.bitget.com/en/docs), enabling natural-language-driven on-chain data queries and swap operations.
  4. ### Design Principles
  5. | Principle | Description |
  6. |-----------|-------------|
  7. | **Domain Knowledge + Tools** | Not just API wrappers — includes swap flow (see `docs/swap.md`), signing guides, security models, and known pitfalls so agents make informed decisions |
  8. | **Zero External Dependencies** | All code is self-contained. Solana signing is pure Python (Ed25519 + base58 built-in). EVM signing uses `eth_account` (standard). Only `requests` for API calls. No pip install needed for Solana |
  9. | **API Infrastructure, Not Reimplementation** | Capabilities come from Bitget Wallet's production API. The skill provides the knowledge and tooling layer, not a parallel implementation |
  10. | **Human-in-the-Loop by Default** | Swap operations generate transaction data but never sign autonomously. User confirmation required for all fund-moving actions |
  11. ### Market Tools Architecture
  12. Market side handles **token discovery and analysis only** — no trading, wallet, or signing. Skills layer computes scores and rules; backend provides raw data.
  13. ```
  14. Atomic Tools (Agent orchestrates)
  15. ├── bgw_token_find Find tokens (chain scan / search / rankings / sectors)
  16. ├── bgw_token_check Check tokens (security / dev / anti-manipulation / signals / market)
  17. ├── bgw_token_analyze Analyze tokens (deep: timeline / trades / holdings / smart money)
  18. ├── bgw_alpha Alpha intelligence (gems / signals)
  19. ├── bgw_address_find Find addresses (by pool / role / criteria)
  20. └── bgw_address_analyze Analyze addresses (scoring / PnL / style / operations / comparison)
  21. Smart Tools (We orchestrate)
  22. ├── bgw_combo Smart combos (token + address permutation recipes)
  23. └── bgw_monitor Continuous monitoring (token signals / address activity / price alerts)
  24. ```
  25. ### Core Capabilities
  26. | Capability | Description | Example |
  27. |------------|-------------|---------|
  28. | **Launchpad Scanner** | Scan new pools (pump.fun, four.meme, etc.) with 15+ filters | "Scan pump.fun for launching tokens with >$10K MC" |
  29. | **Token Search (v3)** | Search by keyword/contract with market_cap ordering + risk_level | "Find PEPE on ETH sorted by market cap" |
  30. | **Token Market Info** | Price, MC, FDV, liquidity, 57 pool pairs, narratives, price changes | "Show me full market info for Lobstar" |
  31. | **Dev Analysis** | Dev address, rug history, LP lock, holdings, migration history | "Check this token's dev history" |
  32. | **Security Audit** | Honeypot/mint/proxy + buy/sell tax + risk checks (EVM & Solana) | "Is this contract safe?" |
  33. | **K-line + Smart Signals** | K-line with KOL/smart money trade markers + hot level | "Show me smart money activity on this token" |
  34. | **Trading Dynamics** | Multi-window buy/sell pressure + address quality + wash detection | "What's the trading activity like?" |
  35. | **Transaction Analysis** | Tagged transactions (smart money/KOL/dev) with filtering | "Show me KOL trades on this token" |
  36. | **Holder Analysis** | Top100 distribution + PnL + tag classification (CEX/smart/KOL) | "Who's holding this token?" |
  37. | **Smart Money Analysis** | Profitable address stats + top earners list | "Are smart money addresses in profit?" |
  38. | **Token Comparison** | Side-by-side K-line comparison of two tokens | "Compare BONK vs WIF price action" |
  39. | **Address Discovery** | Find KOL / smart money addresses by role with performance filters | "Find top smart money on Solana with >80% win rate" |
  40. | **Social Login Wallet** | Sign transactions/messages via Bitget Wallet TEE — no local private key needed | "Sign this transaction with my Bitget Wallet" |
  41. | **Balance Query** | On-chain balance per chain/address/token (native + ERC-20/SPL) | "What's my BNB balance?" |
  42. | **Balance + Price** | Batch balance with USD price in one call | "What's my portfolio worth?" |
  43. | **Token Info** | Price, market cap, holders, social links | "What's the price of SOL?" |
  44. | **K-line Data** | 1m/5m/1h/4h/1d candlestick data with buy/sell breakdown | Trend analysis, buying pressure |
  45. | **Transaction Stats** | 5m/1h/4h/24h buy/sell volume & trader count | Activity detection, whale monitoring |
  46. | **Rankings** | Top gainers / top losers / Hotpicks (curated trending) | Market scanning, alpha discovery |
  47. | **Liquidity Pools** | LP pool information | Slippage estimation, depth analysis |
  48. | **Historical Coins** | Discover new tokens by timestamp (paginated) | "What tokens launched today?" |
  49. | **Token Risk Check** | Pre-swap safety check for from/to tokens (forbidden-buy detection) | "Is this token safe to buy?" |
  50. | **Swap Quote** | Multi-market quotes for same-chain/cross-chain swaps | "How much USDC for 1 SOL?" |
  51. | **Swap Confirm** | Final quote from selected market with orderId | Lock in price and route |
  52. | **Swap MakeOrder** | Generate unsigned transaction data for signing | Execute trades via wallet signing |
  53. | **Swap Send** | Submit signed transactions | Broadcast with MEV protection |
  54. | **Order Details** | Track order lifecycle (processing→success/failed) | "Check my swap status" |
  55. | **Token Transfer** | Direct on-chain token transfer (EVM + Solana), server broadcasts | "Send 100 USDT to 0xDeF..." |
  56. | **Gasless Transfer** | Transfer tokens without native gas — gas paid from USDT/USDC balance | "Send USDC on Base with no ETH for gas" |
  57. | **x402 Payment** | Pay for x402-enabled APIs with USDC on Base | "Access this paid API endpoint" |
  58. > ⚠️ **Swap amounts are human-readable** — pass `0.1` for 0.1 USDT, NOT `100000000000000000`. The `toAmount` in responses is also human-readable. This differs from most on-chain APIs.
  59. ### ✨ Order Mode — Gasless & Cross-Chain Swaps
  60. The swap flow enables two capabilities no other AI agent swap skill offers:
  61. **⛽ Gasless Transactions (EIP-7702)**
  62. - Swap tokens with **zero native token balance** — no ETH, no BNB, no MATIC needed
  63. - Gas cost is deducted from the input token automatically
  64. - Agent only signs; a backend relayer pays gas and broadcasts the transaction
  65. - Supported on all EVM chains (Ethereum, Base, BNB Chain, Arbitrum, Polygon, Morph)
  66. **🌉 One-Step Cross-Chain Swaps**
  67. - Swap tokens across different chains in a **single order** — no manual bridging
  68. - Example: USDC on Base → USDT on BNB Chain, one API call, one signature
  69. - Combined with gasless: cross-chain swap with zero gas on the source chain
  70. **How it works:**
  71. ```
  72. 1. quote → Get multi-market quotes
  73. 2. confirm → Final quote from chosen market, get orderId
  74. 3. makeOrder → Create unsigned transaction data
  75. 4. Sign → Agent signs with wallet key
  76. 5. send → Submit signed data
  77. 6. getOrderDetails → Track until success
  78. ```
  79. **Example — Same-chain swap:**
  80. ```bash
  81. # Quote: BNB USDT → USDC
  82. python3 scripts/bitget-wallet-agent-api.py quote \
  83. --from-chain bnb --from-contract 0x55d398326f99059fF775485246999027B3197955 \
  84. --from-symbol USDT --from-amount 5 \
  85. --to-chain bnb --to-contract 0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d \
  86. --to-symbol USDC \
  87. --from-address 0xYourAddress --to-address 0xYourAddress
  88. # Confirm with chosen market
  89. python3 scripts/bitget-wallet-agent-api.py confirm \
  90. --from-chain bnb --from-contract 0x55d398326f99059fF775485246999027B3197955 \
  91. --from-symbol USDT --from-amount 5 \
  92. --to-chain bnb --to-contract 0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d \
  93. --to-symbol USDC \
  94. --from-address 0xYourAddress --to-address 0xYourAddress \
  95. --market bgwevmaggregator --protocol bgwevmaggregator_v000 \
  96. --slippage 0.01 --feature user_gas
  97. ```
  98. ### 💳 x402 Payments — Pay-Per-Request API Access
  99. x402 is an open standard for HTTP-native payments. When an agent encounters a paid API (HTTP 402), it signs a USDC authorization and retries — no accounts, no API keys needed.
  100. **How it works:**
  101. ```
  102. 1. Agent requests a resource → gets HTTP 402 + payment requirements
  103. 2. Agent signs EIP-3009 TransferWithAuthorization (gasless, off-chain)
  104. 3. Agent retries with PAYMENT-SIGNATURE header
  105. 4. Service's facilitator settles on-chain → agent gets the resource
  106. ```
  107. **Key features:**
  108. - **Truly gasless** — agent pays only USDC, facilitator sponsors gas
  109. - **No accounts needed** — wallet address is your identity
  110. - **Works with any x402 service** — Pinata IPFS, DiamondClaws DeFi data, and [100+ more](https://www.x402.org/ecosystem)
  111. ```bash
  112. # Example: pay $0.001 for Pinata IPFS upload
  113. python3 scripts/x402_pay.py pay \
  114. --url "https://402.pinata.cloud/v1/pin/private?fileSize=100" \
  115. --private-key <key> --method POST --data '{"fileSize": 100}' --auto
  116. ```
  117. See [`docs/x402-payments.md`](docs/x402-payments.md) for domain knowledge, signing details, and testing guide.
  118. ### 💸 Gasless Token Transfer
  119. Direct on-chain token transfer where the server handles transaction construction, broadcasting, and tracking. Supports **gasless mode** — gas fees paid from stablecoin balance (USDT/USDC) instead of native tokens.
  120. **How it works:**
  121. ```
  122. transfer_make_sign_send.py / social_transfer_make_sign_send.py
  123. → getTransferDataV4 + sign + send (one shot, send broadcasts & returns the final txid synchronously)
  124. ```
  125. **Key features:**
  126. - **Gasless (EIP-7702 / FeePayer)** — the server automatically pays gas from USDT/USDC balance when the sender has no native token; there's no flag to request it, check `data.gasAccount.selected` in the response
  127. - **Multi-chain** — ETH, BNB, Base, Arbitrum, Polygon, Morph, Solana
  128. - **Server-side broadcast** — client only signs, server handles nonce management and chain tracking
  129. ```bash
  130. # Token transfer — gasless vs. standard is chosen automatically based on native-coin balance
  131. python3 scripts/transfer_make_sign_send.py --private-key-file /tmp/.pk_evm \
  132. --chain eth --contract 0xdAC17F958D2ee523a2206206994597C13D831ec7 \
  133. --from-address 0xAbC... --to-address 0xDeF... --amount 100
  134. python3 scripts/transfer_make_sign_send.py --private-key-file /tmp/.pk_evm \
  135. --chain base --contract 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 \
  136. --from-address 0xAbC... --to-address 0xDeF... --amount 50
  137. ```
  138. See [`docs/transfer.md`](docs/transfer.md) for domain knowledge, signing modes, and gasless details.
  139. ### Supported Chains
  140. Ethereum · Solana · BNB Chain · Base · Arbitrum · Tron · TON · Sui · Optimism and more.
  141. ---
  142. ## Architecture
  143. ```
  144. Natural Language Input
  145. ↓
  146. AI Agent (OpenClaw / Dify / Custom)
  147. ↓
  148. bitget-wallet-agent-api.py (Python 3.9+)
  149. ↓ ← Token auth (no API key needed)
  150. Bitget Agent API (copenapi.bgwapi.io)
  151. ↓
  152. Structured JSON → Agent interprets → Natural language response
  153. ```
  154. **Security by Design:**
  155. - No API key or HMAC signing needed — uses token-based authentication
  156. - Swap calldata generates transaction data; signing requires explicit wallet key access
  157. - **Wallet key management:** mnemonic stored in secure storage, private keys derived on-the-fly and discarded after each signing operation (never persisted)
  158. ---
  159. ## Agent Use Cases
  160. ### 1. Personal Research Assistant
  161. > "Check if this Solana meme coin is safe, and give me a price quote."
  162. - Token info + security audit + price in a single query
  163. - For: individual traders, researchers
  164. - Platforms: Telegram Bot, Discord Bot, OpenClaw
  165. ### 2. Portfolio Management Agent
  166. > "What's my total portfolio value right now?"
  167. - Batch query across chains and tokens, calculate net value
  168. - Scheduled snapshots + K-line data for historical tracking
  169. - For: DeFi users, fund managers
  170. - Platforms: OpenClaw cron + Telegram alerts
  171. ### 3. Market Monitoring / Alert Agent
  172. > Automatically scan top gainers, detect anomalies, push alerts
  173. - Rankings + transaction volume + security audit combined
  174. - Discover trending tokens → auto-run security audit → filter honeypots → notify user
  175. - For: on-chain alpha hunters
  176. - Platforms: Cron jobs, Dify workflows
  177. ### 4. Semi-Automated Trading Agent
  178. > "Buy this token with 1 SOL"
  179. - Swap quote → show route and slippage → user confirms → generate calldata → wallet signs
  180. - **Human-in-the-loop** — the agent cannot sign independently
  181. - For: active traders wanting an AI assistant
  182. - Platforms: OpenClaw + Bitget Wallet App / hardware wallet
  183. ### 5. Arbitrage Bot Data Layer
  184. > Monitor DEX price discrepancies, discover cross-chain arbitrage opportunities
  185. - Multi-chain swap-quote comparison, calculate spreads
  186. - Combine with CEX data for DEX-CEX spread monitoring
  187. - For: quant teams
  188. - Platforms: Custom Python scripts, OpenClaw sub-agents
  189. ### 6. Community Service Bot
  190. > Someone asks "How much is XX coin?" in a group chat — bot auto-replies
  191. - Lightweight queries, fast response
  192. - Security audit feature doubles as anti-scam protection
  193. - For: Telegram/Discord communities
  194. - Platforms: Telegram Bot + OpenClaw skill
  195. ### 7. Dify / LangChain Tool Node
  196. > Integrate as a Tool in Dify workflows or LangChain agents
  197. - `bitget-wallet-agent-api.py` can serve directly as a Dify Code node or external API Tool
  198. - Can also be wrapped as an MCP Server for any MCP-compatible agent framework
  199. - For: enterprise agent platform integration
  200. ---
  201. ## Quick Start
  202. ### Prerequisites
  203. 1. Python 3.9+
  204. 2. `requests` library (`pip install requests`)
  205. 3. For EVM signing: `eth-account` (`pip install eth-account`)
  206. > No API key needed — the Agent API uses token-based authentication with built-in headers.
  207. > Solana signing requires **no additional packages** — pure Python Ed25519 and base58 are built into `order_sign.py`.
  208. ### Examples
  209. ```bash
  210. # Get SOL price
  211. python3 scripts/bitget-wallet-agent-api.py token-price --chain sol --contract ""
  212. # Security audit for a token
  213. python3 scripts/bitget-wallet-agent-api.py security --chain sol --contract <contract_address>
  214. # Swap quote (5 USDT → USDC on BNB Chain)
  215. python3 scripts/bitget-wallet-agent-api.py quote \
  216. --from-chain bnb --from-contract 0x55d398326f99059fF775485246999027B3197955 \
  217. --from-symbol USDT --from-amount 5 \
  218. --to-chain bnb --to-contract 0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d \
  219. --to-symbol USDC \
  220. --from-address 0xYourAddress --to-address 0xYourAddress
  221. ```
  222. ---
  223. ## Supported Chains (Swap)
  224. | Chain | Same-chain | Cross-chain | Gasless |
  225. |-------|-----------|-------------|---------|
  226. | Ethereum | ✅ | ✅ | ✅ |
  227. | BNB Chain | ✅ | ✅ | ✅ |
  228. | Base | ✅ | ✅ | ✅ |
  229. | Arbitrum | ✅ | ✅ | ✅ |
  230. | Polygon | ✅ | ✅ | ✅ |
  231. | Morph | ✅ | ✅ | ✅ |
  232. | Solana | ✅ | ✅ | ✅ |
  233. | Tron | ✅ | ✅ | ✅ |
  234. > Market data commands support 32+ chains. See `docs/market-data.md` for the full list.
  235. ## Future Directions
  236. | Direction | Description |
  237. |-----------|-------------|
  238. | **Solana Advanced Swaps** | Solana gasless ✅ and cross-chain ✅ now fully supported (same-chain + Sol↔EVM) |
  239. | **On-chain Event Subscription** | WebSocket listeners for large transactions, new pool creation |
  240. | **Historical Data Cache** | Store K-line + price data in local SQLite to reduce API calls |
  241. | **Multi-wallet Management** | Support multi-address balance queries and batch quotes |
  242. | **Risk Rule Engine** | Security audit results + custom rules (blacklist, min liquidity thresholds) |
  243. ---
  244. ## Compatible Platforms
  245. ### ✅ Tested & Verified
  246. | Platform | Status | Notes |
  247. |----------|--------|-------|
  248. | [OpenClaw](https://openclaw.ai) | ✅ Passed | Native skill support |
  249. | [Manus](https://manus.im) | ✅ Passed | Auto-installed and executed |
  250. | [Bolt.new](https://bolt.new) | ✅ Passed | Auto-cloned repo, ran all commands |
  251. | [Devin](https://devin.ai) | ✅ Passed | Read SKILL.md, installed deps, returned correct data |
  252. | [Replit Agent](https://replit.com) | ✅ Passed | Full project setup with web frontend |
  253. ### 🔧 Should Work (file system + Python + network access)
  254. | Platform | Type | How to Use |
  255. |----------|------|------------|
  256. | [Claude Code](https://docs.anthropic.com/en/docs/claude-code) | CLI Agent | Clone repo, add SKILL.md to project context |
  257. | [Codex CLI](https://github.com/openai/codex) | CLI Agent | Clone repo, reference in AGENTS.md |
  258. | [Cursor](https://cursor.com) | IDE Agent | Clone into project, or use [MCP version](https://github.com/bitget-wallet-ai-lab/bitget-wallet-mcp) |
  259. | [Windsurf](https://codeium.com/windsurf) | IDE Agent | Clone into project, or use [MCP version](https://github.com/bitget-wallet-ai-lab/bitget-wallet-mcp) |
  260. | [Cline](https://github.com/cline/cline) | VS Code Agent | Clone into project workspace |
  261. | [Aider](https://aider.chat) | CLI Agent | Add scripts to project |
  262. | [OpenHands](https://github.com/All-Hands-AI/OpenHands) | Coding Agent | Docker sandbox with full file system |
  263. | [SWE-agent](https://github.com/princeton-nlp/SWE-agent) | Coding Agent | Shell access in sandbox |
  264. | [Dify](https://dify.ai) | Workflow Platform | Use as Code node or external API Tool |
  265. | [Coze](https://www.coze.com) | Agent Platform | Import as plugin or API Tool |
  266. | [LangChain](https://langchain.com) / [CrewAI](https://crewai.com) | Frameworks | Wrap `bitget-wallet-agent-api.py` as a Tool |
  267. ### 💡 Compatibility Rule
  268. Any AI agent that can **read files + run Python + access the internet** should work with this skill.
  269. ---
  270. ## Related Projects
  271. - [bitget-wallet-mcp](https://github.com/bitget-wallet-ai-lab/bitget-wallet-mcp) — MCP Server for Claude Desktop / Cursor / Windsurf
  272. - [bitget-wallet-cli](https://github.com/bitget-wallet-ai-lab/bitget-wallet-cli) — CLI tool for terminal users
  273. ---
  274. ## Security Notes
  275. - No API keys needed — uses token-based authentication (no secrets to manage)
  276. - Swap functions generate quotes and transaction data — signing requires explicit wallet access
  277. - Wallet mnemonic is the only persistent secret; private keys are derived per-operation and discarded
  278. - Large operations require explicit user confirmation (human-in-the-loop)
  279. - Always run a security audit (`security` command) before interacting with any token
  280. ## Security
  281. - **Zero external dependencies for Solana** — pure Python Ed25519 (RFC 8032) and base58 built into `order_sign.py`. EVM uses `eth_account`. No obscure packages, no supply-chain risk.
  282. - Only communicates with `https://copenapi.bgwapi.io` (Agent API) and x402 resource servers — no other external endpoints
  283. - No `eval()` / `exec()` or dynamic code execution
  284. - No file system access outside the skill directory
  285. - No data collection, telemetry, or analytics
  286. - No access to sensitive files (SSH keys, credentials, wallet files, etc.)
  287. - We recommend auditing the source yourself before installation
  288. ## License
  289. MIT

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.