mirror of
https://github.com/GMGNAI/gmgn-skills.git
synced 2026-08-24 05:28:06 +00:00
breaking(portfolio): upgrade wallet_holdings to critical auth
Align CLI with server-side breaking change: GET /v1/user/wallet_holdings was upgraded from authExistMW to authCriticalMW on the openapi-service. - OpenApiClient: switch getWalletHoldings to authSignedRequest - SKILL.md: split rate-limit table by auth level; update Notes section - CLAUDE.md: move portfolio holdings from Normal to Critical auth row Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
a65d5fd1cb
commit
2f76b375c5
@@ -93,8 +93,8 @@ EOF
|
|||||||
|
|
||||||
| Mode | Commands | Requirements |
|
| Mode | Commands | Requirements |
|
||||||
|------|----------|--------------|
|
|------|----------|--------------|
|
||||||
| Normal | token / market / portfolio / track kol / track smartmoney | `GMGN_API_KEY` only, no signature |
|
| Normal | token / market / portfolio (except holdings) / track kol / track smartmoney | `GMGN_API_KEY` only, no signature |
|
||||||
| Critical | swap / order / track follow-wallet | `GMGN_API_KEY` + `GMGN_PRIVATE_KEY` — CLI handles signing automatically |
|
| Critical | swap / order / portfolio holdings / track follow-wallet | `GMGN_API_KEY` + `GMGN_PRIVATE_KEY` — CLI handles signing automatically |
|
||||||
|
|
||||||
## SKILL.md Authoring Rules
|
## SKILL.md Authoring Rules
|
||||||
|
|
||||||
|
|||||||
@@ -54,10 +54,17 @@ Use the `gmgn-cli` tool to query wallet portfolio data based on the user's reque
|
|||||||
|
|
||||||
All portfolio routes used by this skill go through GMGN's leaky-bucket limiter with `rate=20` and `capacity=20`. Sustained throughput is roughly `20 ÷ weight` requests/second, and the max burst is roughly `floor(20 ÷ weight)` when the bucket is full.
|
All portfolio routes used by this skill go through GMGN's leaky-bucket limiter with `rate=20` and `capacity=20`. Sustained throughput is roughly `20 ÷ weight` requests/second, and the max burst is roughly `floor(20 ÷ weight)` when the bucket is full.
|
||||||
|
|
||||||
|
**Critical auth** (`GMGN_API_KEY` + `GMGN_PRIVATE_KEY` required):
|
||||||
|
|
||||||
|
| Command | Route | Weight |
|
||||||
|
|---------|-------|--------|
|
||||||
|
| `portfolio holdings` | `GET /v1/user/wallet_holdings` | 5 |
|
||||||
|
|
||||||
|
**Exist auth** (`GMGN_API_KEY` only):
|
||||||
|
|
||||||
| Command | Route | Weight |
|
| Command | Route | Weight |
|
||||||
|---------|-------|--------|
|
|---------|-------|--------|
|
||||||
| `portfolio info` | `GET /v1/user/info` | 1 |
|
| `portfolio info` | `GET /v1/user/info` | 1 |
|
||||||
| `portfolio holdings` | `GET /v1/user/wallet_holdings` | 2 |
|
|
||||||
| `portfolio activity` | `GET /v1/user/wallet_activity` | 3 |
|
| `portfolio activity` | `GET /v1/user/wallet_activity` | 3 |
|
||||||
| `portfolio stats` | `GET /v1/user/wallet_stats` | 3 |
|
| `portfolio stats` | `GET /v1/user/wallet_stats` | 3 |
|
||||||
| `portfolio token-balance` | `GET /v1/user/wallet_token_balance` | 1 |
|
| `portfolio token-balance` | `GET /v1/user/wallet_token_balance` | 1 |
|
||||||
@@ -360,7 +367,7 @@ Show the `[Identity: ...]` line only if `common` is present in the response. For
|
|||||||
|
|
||||||
## Notes
|
## Notes
|
||||||
|
|
||||||
- All portfolio commands use exist auth (API Key only, no signature required)
|
- `portfolio holdings` uses **critical auth** (`GMGN_API_KEY` + `GMGN_PRIVATE_KEY` required — CLI signs the request automatically). All other portfolio commands use exist auth (API Key only, no signature required).
|
||||||
- `portfolio stats` supports multiple `--wallet` flags for batch queries
|
- `portfolio stats` supports multiple `--wallet` flags for batch queries
|
||||||
- Use `--raw` to get single-line JSON for further processing
|
- Use `--raw` to get single-line JSON for further processing
|
||||||
- **Input validation** — Wallet and token addresses are validated against the expected chain format at runtime (sol: base58 32–44 chars; bsc/base/eth: `0x` + 40 hex digits). The CLI exits with an error on invalid input.
|
- **Input validation** — Wallet and token addresses are validated against the expected chain format at runtime (sol: base58 32–44 chars; bsc/base/eth: `0x` + 40 hex digits). The CLI exits with an error on invalid input.
|
||||||
|
|||||||
@@ -241,18 +241,18 @@ export class OpenApiClient {
|
|||||||
return this.authExistRequest("GET", "/v1/market/token_kline", query);
|
return this.authExistRequest("GET", "/v1/market/token_kline", query);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---- Portfolio endpoints (exist auth) ----
|
// ---- Portfolio endpoints ----
|
||||||
|
|
||||||
async getWalletHoldings(
|
async getWalletHoldings(
|
||||||
chain: string,
|
chain: string,
|
||||||
walletAddress: string,
|
walletAddress: string,
|
||||||
extra: Record<string, string | number> = {}
|
extra: Record<string, string | number> = {}
|
||||||
): Promise<unknown> {
|
): Promise<unknown> {
|
||||||
return this.authExistRequest("GET", "/v1/user/wallet_holdings", {
|
return this.authSignedRequest("GET", "/v1/user/wallet_holdings", {
|
||||||
chain,
|
chain,
|
||||||
wallet_address: walletAddress,
|
wallet_address: walletAddress,
|
||||||
...extra,
|
...extra,
|
||||||
});
|
}, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
async getWalletActivity(
|
async getWalletActivity(
|
||||||
@@ -419,7 +419,7 @@ export class OpenApiClient {
|
|||||||
body: unknown
|
body: unknown
|
||||||
): Promise<unknown> {
|
): Promise<unknown> {
|
||||||
if (!this.privateKeyPem) {
|
if (!this.privateKeyPem) {
|
||||||
throw new Error("GMGN_PRIVATE_KEY is required for critical-auth commands (swap, order, and follow-wallet commands)");
|
throw new Error("GMGN_PRIVATE_KEY is required for critical-auth commands (swap, order, follow-wallet, and portfolio holdings commands)");
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.executePreparedRequest(() => {
|
return this.executePreparedRequest(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user