mirror of
https://github.com/GMGNAI/gmgn-skills.git
synced 2026-08-25 14:08:06 +00:00
fix(track): switch follow-wallet to critical auth and fix signer array support
GET /v1/trade/follow_wallet requires X-Signature (critical auth) but was called via normalRequest (API Key only), causing HTTP 401 AUTH_INVALID with "missing signature". - OpenApiClient: getFollowWallet now calls criticalRequest; criticalRequest queryExtra type widened to accept string[] to support the --filter option - signer: buildMessage handles string[] values as sorted repeated k=v pairs, consistent with buildUrl / URLSearchParams serialization - config: update PRIVATE_KEY_REQUIRED_MSG to include follow-wallet - SKILL.md: prerequisites note GMGN_PRIVATE_KEY for follow-wallet; first-time setup now saves private key to ~/.config/gmgn/.env and removes /tmp copy; Notes section corrected to reflect split auth modes - CLAUDE.md: Auth Modes table updated — follow-wallet moved to Critical row Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
6ab9cb108b
commit
f19a1919da
@@ -307,7 +307,7 @@ export class OpenApiClient {
|
||||
}
|
||||
|
||||
async getFollowWallet(chain: string, extra: Record<string, string | number | string[]> = {}): Promise<unknown> {
|
||||
return this.normalRequest("GET", "/v1/trade/follow_wallet", { chain, ...extra });
|
||||
return this.criticalRequest("GET", "/v1/trade/follow_wallet", { chain, ...extra }, null);
|
||||
}
|
||||
|
||||
async getKol(chain?: string, limit?: number): Promise<unknown> {
|
||||
@@ -409,16 +409,16 @@ export class OpenApiClient {
|
||||
private async criticalRequest(
|
||||
method: string,
|
||||
subPath: string,
|
||||
queryExtra: Record<string, string | number>,
|
||||
queryExtra: Record<string, string | number | string[]>,
|
||||
body: unknown
|
||||
): Promise<unknown> {
|
||||
if (!this.privateKeyPem) {
|
||||
throw new Error("GMGN_PRIVATE_KEY is required for critical-auth commands (swap and all order commands)");
|
||||
throw new Error("GMGN_PRIVATE_KEY is required for critical-auth commands (swap, order, and follow-wallet commands)");
|
||||
}
|
||||
|
||||
return this.executePreparedRequest(() => {
|
||||
const { timestamp, client_id } = buildAuthQuery();
|
||||
const query: Record<string, string | number> = { ...queryExtra, timestamp, client_id };
|
||||
const query: Record<string, string | number | string[]> = { ...queryExtra, timestamp, client_id };
|
||||
const bodyStr = body !== null ? JSON.stringify(body) : "";
|
||||
const message = buildMessage(subPath, query, bodyStr, timestamp);
|
||||
const signature = sign(message, this.privateKeyPem!, detectAlgorithm(this.privateKeyPem!));
|
||||
|
||||
Reference in New Issue
Block a user