[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6GWH4G664GZP4TN848A4X9D":3,"skill-same:01M6GWH4G664GZP4TN848A4X9D":76},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":16,"sourceHtmlUrl":17,"categories":18,"keywords":19,"publishedAt":34,"linkOnly":35,"markdownContent":36,"markdownBody":37,"frontMatter":38,"refName":39,"commitSha":40,"skillDirectory":41,"forksCount":42,"repositoryHtmlUrl":43,"repositoryHomepageUrl":6,"ownerHtmlUrl":44,"ownerBlogUrl":45,"ownerDescription":46,"updatedAt":47,"install":48,"resources":61},"01M6GWH4G664GZP4TN848A4X9D","gdex-authentication",null,"Managed-custody authentication — shared API key login, session keypair generation, encrypted computedData payloads, AES-256-CBC encryption, and secp256k1 trade signing","jiayaoqijia\u002Fcryptoskill","jiayaoqijia","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F1453879?v=4","01M6GMYTX7Q7S504VC6E756ENR","YQ","01M6GMYV1QKJ1CC75MTTGT9PR0",81,"MIT","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fmcp-servers\u002Fgemachdao-gdex-authentication\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fmcp-servers\u002Fgemachdao-gdex-authentication\u002FSKILL.md",[],[20,21,22,23,24,25,26,27,28,29,30,31,32,33],"authentication","gdex authentication","encryption","aes","api","payloads","session","trade","shared","generation","encrypted","signing","login","managed","2026-11-10 10:12:30",false,"---\nname: gdex-authentication\ndescription: Managed-custody authentication — shared API key login, session keypair generation, encrypted computedData payloads, AES-256-CBC encryption, and secp256k1 trade signing\n---\n\n# GDEX: Authentication\n\nAll GDEX trading uses **managed-custody wallets** with encrypted `computedData` payloads. This skill covers both the simple shared-API-key auth and the full managed-custody flow.\n\n## When to Use\n\n- Setting up authentication for any trading operation\n- Implementing managed-custody sign-in for a control wallet\n- Understanding the encryption and signing pipeline\n- Troubleshooting auth errors (401, 403, code 103)\n\n## Prerequisites\n\n```bash\nnpm install @gemachdao\u002Fgdex-skill\n```\n\n## 0. MCP Server: `gdex_connect` (no secrets in chat)\n\nMCP clients do not run this flow by hand. Call `gdex_connect` with a local key file\n(`{ keyFile: \"~\u002Fwallet.json\" }`) or `{ create: true }` for a new wallet; the server signs in,\nstores the keys under `~\u002F.gdex\u002Faccounts` (0600) and returns an `accountRef`. Pass `accountRef`\nto every trading tool instead of `apiKey` \u002F `walletAddress` \u002F `sessionPrivateKey` \u002F `data`.\n`gdex_accounts` lists connected accounts and `gdex_disconnect` forgets one.\n\nSDK users run the managed-custody sign-in below and pass `apiKey`, `walletAddress`\n(the control wallet) and `sessionPrivateKey` to each write call.\n\n## 1. Shared API Key Login (Simple)\n\nFor read-only access — no wallet signing required. Trading additionally needs the\nmanaged-custody session from section 2:\n\n```typescript\nimport { GdexSkill, GDEX_API_KEY_PRIMARY } from '@gemachdao\u002Fgdex-skill';\n\nconst skill = new GdexSkill();\nskill.loginWithApiKey(GDEX_API_KEY_PRIMARY);\n\u002F\u002F skill.isAuthenticated() → true\n```\n\n**Shared API Keys:**\n- Primary: `9b4e1c73-6a2f-4d88-b5c9-3e7a2f1d6c54`\n- Secondary: `2c8f0a91-5d34-4e7b-9a62-f1c3d8e4b705`\n\n> Read-only endpoints (`getTokenDetails`, `getTrendingTokens`, `getOHLCV`, `getTopTraders`) do not require any authentication.\n\n## 2. Managed-Custody Flow (Full Trading)\n\nFor trading operations, the full managed-custody flow is:\n\n```\nGenerate Session Keypair → Build Sign-In Message → Control Wallet Signs →\nEncrypt as computedData → POST \u002Fv1\u002Fsign_in → Resolve User → Trade\n```\n\n### Step-by-Step\n\n```typescript\nimport {\n  GdexSkill,\n  GDEX_API_KEY_PRIMARY,\n  generateGdexSessionKeyPair,\n  buildGdexSignInMessage,\n  buildGdexSignInComputedData,\n  buildGdexManagedTradeComputedData,\n  buildGdexUserSessionData,\n} from '@gemachdao\u002Fgdex-skill';\n\nconst skill = new GdexSkill();\nskill.loginWithApiKey(GDEX_API_KEY_PRIMARY);\nconst apiKey = GDEX_API_KEY_PRIMARY;\n\n\u002F\u002F Step 1: Generate a secp256k1 session keypair\nconst { sessionPrivateKey, sessionKey } = generateGdexSessionKeyPair();\n\u002F\u002F sessionKey = compressed public key (0x + 66 hex chars)\n\n\u002F\u002F Step 2: Build the sign-in message\nconst userId = '0xYourControlWalletAddress'; \u002F\u002F EVM address or Solana pubkey\nconst nonce = String(Math.floor(Date.now() \u002F 1000) + Math.floor(Math.random() * 1000));\nconst message = buildGdexSignInMessage(userId, nonce, sessionKey);\n\u002F\u002F → \"By signing, you agree to GDEX Trading Terms of Use...\"\n\n\u002F\u002F Step 3: Sign with control wallet\n\u002F\u002F   EVM:    wallet.signMessage(message) → EIP-191 personal_sign\n\u002F\u002F   Solana: nacl.sign.detached(Buffer.from(message)) → base58 encoded\nconst signature = '...'; \u002F\u002F your wallet's signature\n\n\u002F\u002F Step 4: Build encrypted computedData and POST to \u002Fv1\u002Fsign_in\nconst signInPayload = buildGdexSignInComputedData({\n  apiKey, userId, sessionKey, nonce, signature,\n});\nconst signInResult = await skill.signInWithComputedData({\n  computedData: signInPayload.computedData,\n  chainId: 1, \u002F\u002F 1 for EVM \u002F HyperLiquid, 622112261 for Solana (see \"ChainId for Sign-In Matters\")\n}, { sessionPrivateKey }); \u002F\u002F keeps the gdex_session cookie and signs \u002Fv1\u002Fuser (see \"Browser Session\")\n\n\u002F\u002F Step 5: Resolve user profile \u002F check managed wallet\nconst userData = buildGdexUserSessionData(sessionKey, apiKey);\nconst user = await skill.getManagedUser({ userId, data: userData, chainId: 622112261 }); \u002F\u002F Solana\n\u002F\u002F → { address: \"CFSi4YimeCbfSNqH2WmHwJKwj1YYG1cWBtQyVPB4sCe1\", chainId: \"622112261\", ... }\n```\n\n> **Critical: Solana chainId is `622112261` (`ChainId.SOLANA`), NOT `900`.** Using `900` returns the EVM managed address with `balance: null`. The `\u002Fv1\u002Fuser` endpoint returns a **different managed wallet address** per `chainId`:\n> - `chainId=1` → EVM managed: `0x9967179de55bd67e6b90fcc4f908556d93938c0f`\n> - `chainId=622112261` → Solana managed: `CFSi4YimeCbfSNqH2WmHwJKwj1YYG1cWBtQyVPB4sCe1` (base58)\n\n### Nonce Generation\n\nNonces are **client-generated** (not fetched from the server):\n\n```typescript\nconst nonce = String(Math.floor(Date.now() \u002F 1000) + Math.floor(Math.random() * 1000));\n```\n\n### Browser Session (required since 2026-10-28)\n\nThe backend now treats every client as a browser session (backend PR #382). The SDK (5.2.0+)\nhandles it; older SDKs fail every sign-in and trade with **403 `SESSION_ORIGIN_DENIED`**.\n\n- Every login, write and private read must send `X-Gdex-Client: web` and an allow-listed\n  `Origin` (default `https:\u002F\u002Fgdex.pro`, override with `new GdexSkill({ origin })`).\n- Sign-in sets an HttpOnly `gdex_session` cookie. The SDK captures it and sends it on every\n  later call. It is bound to that sign-in's session key, **idles out after 30 minutes unused**\n  and expires 8 hours after login. Signing in again replaces the session key and the cookie.\n- `GET \u002Fv1\u002Fuser` and private `\u002Fv1\u002Fagents\u002F*` routes also need a nonce signed with the session\n  private key. Pass `{ sessionPrivateKey }` to `signInWithComputedData` (or call\n  `skill.setSessionSigningKey(sessionPrivateKey)`); the key never leaves the process.\n\n**Saving a session for another process** (an hourly watcher, a separate trade script): store\n`skill.getBrowserSession()` next to the session key, both as secrets, and restore with\n`skill.setBrowserSession(saved)` + `skill.setSessionSigningKey(sessionPrivateKey)`. If more\nthan ~25 minutes have passed, or a call returns 401 `SESSION_INVALID`, sign in again instead.\nA session key alone, saved from before 2026-10-28, no longer works.\n\nThe MCP server does this automatically: `gdex_connect` stores the cookie with the account and\nre-signs in when it is stale.\n\n## 3. Encryption Details (AES-256-CBC)\n\nAll payloads use **deterministic** AES-256-CBC — no random IV:\n\n| Property | Derivation |\n|----------|------------|\n| **Key** | First 32 bytes of `SHA256(apiKey)` hex |\n| **IV** | First 16 bytes of `SHA256(SHA256(apiKey))` hex |\n\n```typescript\nimport { encryptGdexComputedData, decryptGdexComputedData, deriveGdexAesMaterial } from '@gemachdao\u002Fgdex-skill';\n\n\u002F\u002F Encrypt a JSON payload\nconst cipherHex = encryptGdexComputedData(JSON.stringify({ userId, data, signature, apiKey }), apiKey);\n\n\u002F\u002F Decrypt\nconst plaintext = decryptGdexComputedData(cipherHex, apiKey);\n\n\u002F\u002F Get raw key\u002FIV material\nconst { key, iv } = deriveGdexAesMaterial(apiKey);\n```\n\n**Important:**\n- Trade\u002Fsign-in payloads: `JSON.stringify(...)` → UTF-8 → encrypt → hex\n- Session key for `\u002Fv1\u002Fuser`: raw hex-decoded bytes → encrypt (NOT UTF-8 string; use `encryptGdexHexData`)\n- The API key is included **inside** the encrypted JSON payload, not just used for encryption\n- Do NOT use random IVs or `iv:ciphertext` format\n\n## 4. Trade Signing (secp256k1)\n\n**Spot trade signatures** use raw keccak256 + secp256k1 (no EIP-191 prefix):\n\n```typescript\nimport { signGdexTradeMessageWithSessionKey } from '@gemachdao\u002Fgdex-skill';\n\nconst signature = signGdexTradeMessageWithSessionKey(\n  'purchase',       \u002F\u002F action: 'purchase' or 'sell'\n  userId,           \u002F\u002F lowercase address\n  dataHex,          \u002F\u002F ABI-encoded trade data (without 0x prefix)\n  sessionPrivateKey,\n);\n\u002F\u002F Returns: r(64 hex) + s(64 hex) + v(2 hex) = 130 chars, no 0x prefix\n\u002F\u002F v = raw recoveryParam (00 or 01), NOT EIP-155 (1b\u002F1c)\n```\n\n**Sign-in** is the ONLY operation that uses EIP-191 `personal_sign` with the control wallet.\n\n### ABI Encoding Schemas\n\n| Operation | ABI Types | Fields |\n|-----------|-----------|--------|\n| **Sign-in** | `['bytes', 'string', 'string']` | `[sessionKey, nonce, refCode]` |\n| **Trade** | `['string', 'uint256', 'string']` | `[tokenAddress, amount, nonce]` |\n\n## 5. Building Trade Payloads\n\n```typescript\nimport { buildGdexManagedTradeComputedData } from '@gemachdao\u002Fgdex-skill';\n\nconst trade = buildGdexManagedTradeComputedData({\n  apiKey,\n  action: 'purchase',  \u002F\u002F or 'sell'\n  userId: '0xYourAddress',\n  tokenAddress: 'DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263',\n  amount: '100000',     \u002F\u002F in smallest unit\n  nonce: String(Math.floor(Date.now() \u002F 1000) + Math.floor(Math.random() * 1000)),\n  sessionPrivateKey,\n});\n\nconst result = await skill.submitManagedPurchase({\n  computedData: trade.computedData,\n  chainId: 622112261, \u002F\u002F Solana (ChainId.SOLANA), NOT 900\n  slippage: 1,\n});\n\n\u002F\u002F Poll trade status\nif (result.requestId) {\n  const status = await skill.getManagedTradeStatus(result.requestId);\n  console.log('Status:', status.status, 'Hash:', status.hash);\n}\n```\n\n## 6. Wallet-Based Auth (Advanced)\n\nFor user-owned wallets or browser extensions:\n\n```typescript\n\u002F\u002F EVM wallet\nawait skill.authenticate({\n  type: 'evm',\n  address: '0xYourAddress',\n  privateKey: '0xPrivateKey',\n});\n\n\u002F\u002F Solana wallet\nawait skill.authenticate({\n  type: 'solana',\n  address: 'YourSolanaAddress',\n  privateKey: 'base58EncodedPrivateKey',\n});\n\n\u002F\u002F Custom signer (MetaMask \u002F Phantom)\nawait skill.authenticate({\n  type: 'evm',\n  address: accounts[0],\n  signer: async (message) =>\n    window.ethereum.request({ method: 'personal_sign', params: [message, accounts[0]] }),\n});\n```\n\n## 7. SDK Configuration\n\n```typescript\nconst skill = new GdexSkill({\n  apiUrl:     'https:\u002F\u002Ftrade-api.gemach.io\u002Fv1', \u002F\u002F Default backend\n  timeout:    30000,                             \u002F\u002F Request timeout ms\n  maxRetries: 3,                                 \u002F\u002F Retry on 429\u002F503\n  debug:      false,                             \u002F\u002F Log requests\n});\n```\n\nHTTP headers MUST include a browser User-Agent (e.g., Chrome\u002F91) — non-browser UAs get 403 from Cloudflare. Use `Authorization: Bearer \u003CapiKey>` header, NOT `X-API-Key`.\n\n## Helper Functions Reference\n\n| Function | Purpose |\n|----------|---------|\n| `generateGdexSessionKeyPair()` | Generate secp256k1 session keypair |\n| `buildGdexSignInMessage(userId, nonce, sessionKey)` | Build sign-in message for wallet signing |\n| `buildGdexSignInComputedData({...})` | Build encrypted sign-in payload |\n| `buildGdexUserSessionData(sessionKey, apiKey)` | Encrypt session key for `\u002Fv1\u002Fuser` |\n| `buildGdexManagedTradeComputedData({...})` | Build encrypted trade payload |\n| `signGdexTradeMessageWithSessionKey(action, userId, data, privKey)` | Sign trade with session key |\n| `encryptGdexComputedData(plaintext, apiKey)` | AES-256-CBC encrypt UTF-8 |\n| `encryptGdexHexData(hexData, apiKey)` | AES-256-CBC encrypt raw hex bytes |\n| `decryptGdexComputedData(cipherHex, apiKey)` | AES-256-CBC decrypt |\n| `deriveGdexAesMaterial(apiKey)` | Get raw AES key\u002FIV |\n\n## Common Issues\n\n### 401 Unauthorized\n- API key not set or expired — call `skill.loginWithApiKey(apiKey)` first\n- Session expired — re-authenticate\n\n### 403 `SESSION_ORIGIN_DENIED` (\"Request origin denied\")\n- SDK older than 5.2.0: it does not send `X-Gdex-Client: web` \u002F `Origin`. Upgrade, then sign in again.\n- Raw HTTP callers must send both headers on `\u002Fv1\u002Fsign_in` and every private call.\n\n### 401 `SESSION_INVALID` (\"Please sign in again\")\n- The `gdex_session` cookie is missing, idled out (30 min) or expired (8 h), or a newer sign-in\n  rotated the session key. Sign in again; for a separate process, restore the cookie (see \"Browser Session\").\n\n### 403 Forbidden\n- Non-browser User-Agent header — the SDK handles this automatically\n- Using `X-API-Key` instead of `Authorization: Bearer`\n\n### 400 Unauthorized (code 103) on HL operations\n- **Most common cause:** Passing the **managed address** as `walletAddress` instead of the **control wallet address**.\n- During sign-in, the session key is registered for the control wallet address (the one that signed the sign-in message).\n- All HL write operations (`hlCreateOrder`, `perpDeposit`, `hlCloseAll`, etc.) sign the payload as `{action}-{walletAddress}-{data}` — if `walletAddress` doesn't match the sign-in `userId`, the signature verification fails.\n- **Fix:** Always set `walletAddress` to the control wallet address used during sign-in, NOT the managed address returned by `\u002Fv1\u002Fuser` or `\u002Fv1\u002Fsign_in`.\n\n```typescript\n\u002F\u002F ❌ WRONG — managed address causes code 103\nconst creds = { apiKey, walletAddress: user.address, sessionPrivateKey };\n\n\u002F\u002F ✅ CORRECT — use the control wallet that signed in\nconst creds = { apiKey, walletAddress: controlWallet.address, sessionPrivateKey };\n```\n\n### 400 Unauthorized (code 103) on HL operations\n- Wrong ABI encoding for the specific HL action — see **gdex-perp-trading** skill\n- Using `uint256` instead of `uint64` for chainId in `hl_deposit`\n- Wrong signature format (must be raw `v=00\u002F01`, not EIP-155 `v=1b\u002F1c`)\n\n## Autonomous Agent Notes (Live-Tested)\n\n### Complete Auth Flow — Verified Working\n\n```typescript\nimport { ethers } from 'ethers';\nimport {\n  GdexSkill, GDEX_API_KEY_PRIMARY,\n  generateGdexSessionKeyPair, buildGdexSignInMessage,\n  buildGdexSignInComputedData, buildGdexUserSessionData,\n} from '@gemachdao\u002Fgdex-skill';\n\nconst skill = new GdexSkill();\nskill.loginWithApiKey(GDEX_API_KEY_PRIMARY);\n\n\u002F\u002F 1. Generate session keypair\nconst { sessionPrivateKey, sessionKey } = generateGdexSessionKeyPair();\n\n\u002F\u002F 2. Sign in with control wallet\nconst wallet = ethers.Wallet.fromPhrase('your mnemonic phrase...');\nconst userId = wallet.address;\nconst nonce = String(Math.floor(Date.now() \u002F 1000) + Math.floor(Math.random() * 1000));\nconst message = buildGdexSignInMessage(userId, nonce, sessionKey);\nconst signature = await wallet.signMessage(message);\n\nconst signInPayload = buildGdexSignInComputedData({\n  apiKey: GDEX_API_KEY_PRIMARY, userId, sessionKey, nonce, signature,\n});\nawait skill.signInWithComputedData({\n  computedData: signInPayload.computedData,\n  chainId: 1,  \u002F\u002F EVM for HL\u002Fperps, 622112261 for Solana spot\n}, { sessionPrivateKey });\n\n\u002F\u002F 3. Resolve managed wallet\nconst data = buildGdexUserSessionData(sessionKey, GDEX_API_KEY_PRIMARY);\nconst user = await skill.getManagedUser({ userId, data, chainId: 622112261 });\n\u002F\u002F user.address = managed Solana wallet (base58)\n```\n\n### ChainId for Sign-In Matters\n\n| Operation | Sign-In ChainId | Why |\n|-----------|----------------|-----|\n| Solana spot\u002Flimit\u002Fcopy | `622112261` | Solana chain context |\n| HL perps, deposit, withdraw | `1` (EVM) | HL uses EVM wallets |\n| HL perp copy trading | `1` (EVM) | HL copy uses EVM |\n| Bridge | `1` (EVM) | Bridge uses EVM context |\n\n### Credentials to Keep Track Of\n\nAn autonomous agent must persist these across operations:\n- `sessionPrivateKey` — signs all trade payloads (one per sign-in session)\n- `sessionKey` — used to build encrypted `data` for read endpoints\n- `controlAddress` (=`userId`) — the wallet that signed in (used in all API calls)\n- `managedEvmAddress` — from `\u002Fv1\u002Fuser?chainId=1` (needed for `user_stats` only)\n- `managedSolanaAddress` — from `\u002Fv1\u002Fuser?chainId=622112261` (for on-chain queries only)\n\n## Google OAuth + Email Association Flow\n\nThe backend (`ServiceMain.oauthLogin` \u002F `ServiceMain.associateEmail`, v1.1.0)\nsupports a Google-only OAuth onboarding path mounted at `\u002Fv1\u002Fauth\u002F*`. **There\nis no `provider` field and no Apple\u002FGitHub\u002FTwitter branch** — only Google ID\ntokens are accepted, and **the client never sends a raw `email`**.\n\nFlow:\n\n1. **`associate_email` first** — links the caller's wallet to the email claim\n   carried inside the verified Google ID token. The backend extracts the\n   email server-side; the client only sends `{ computedData, idToken }`,\n   where `computedData` is a managed-custody payload built with\n   `buildAssociateEmailComputedData` (ABI `['associate_email', [nonce]]`,\n   sig msg `associate_email-${userId}-${data}`).\n2. **`oauth_login` with the same `idToken`** — body\n   `{ idToken, chainId? }`. If the wallet still has no `associatedEmail`\n   the backend responds 404 with internal code 108; re-run step 1 and retry.\n\n## Related Skills\n\n- **gdex-onboarding** — Platform overview and getting started\n- **gdex-spot-trading** — Buy\u002Fsell tokens (requires auth)\n- **gdex-perp-trading** — HyperLiquid perps (requires auth + HL-specific crypto)\n- **gdex-wallet-setup** — Generate control wallets for new users\n","# GDEX: Authentication\n\nAll GDEX trading uses **managed-custody wallets** with encrypted `computedData` payloads. This skill covers both the simple shared-API-key auth and the full managed-custody flow.\n\n## When to Use\n\n- Setting up authentication for any trading operation\n- Implementing managed-custody sign-in for a control wallet\n- Understanding the encryption and signing pipeline\n- Troubleshooting auth errors (401, 403, code 103)\n\n## Prerequisites\n\n```bash\nnpm install @gemachdao\u002Fgdex-skill\n```\n\n## 0. MCP Server: `gdex_connect` (no secrets in chat)\n\nMCP clients do not run this flow by hand. Call `gdex_connect` with a local key file\n(`{ keyFile: \"~\u002Fwallet.json\" }`) or `{ create: true }` for a new wallet; the server signs in,\nstores the keys under `~\u002F.gdex\u002Faccounts` (0600) and returns an `accountRef`. Pass `accountRef`\nto every trading tool instead of `apiKey` \u002F `walletAddress` \u002F `sessionPrivateKey` \u002F `data`.\n`gdex_accounts` lists connected accounts and `gdex_disconnect` forgets one.\n\nSDK users run the managed-custody sign-in below and pass `apiKey`, `walletAddress`\n(the control wallet) and `sessionPrivateKey` to each write call.\n\n## 1. Shared API Key Login (Simple)\n\nFor read-only access — no wallet signing required. Trading additionally needs the\nmanaged-custody session from section 2:\n\n```typescript\nimport { GdexSkill, GDEX_API_KEY_PRIMARY } from '@gemachdao\u002Fgdex-skill';\n\nconst skill = new GdexSkill();\nskill.loginWithApiKey(GDEX_API_KEY_PRIMARY);\n\u002F\u002F skill.isAuthenticated() → true\n```\n\n**Shared API Keys:**\n- Primary: `9b4e1c73-6a2f-4d88-b5c9-3e7a2f1d6c54`\n- Secondary: `2c8f0a91-5d34-4e7b-9a62-f1c3d8e4b705`\n\n> Read-only endpoints (`getTokenDetails`, `getTrendingTokens`, `getOHLCV`, `getTopTraders`) do not require any authentication.\n\n## 2. Managed-Custody Flow (Full Trading)\n\nFor trading operations, the full managed-custody flow is:\n\n```\nGenerate Session Keypair → Build Sign-In Message → Control Wallet Signs →\nEncrypt as computedData → POST \u002Fv1\u002Fsign_in → Resolve User → Trade\n```\n\n### Step-by-Step\n\n```typescript\nimport {\n  GdexSkill,\n  GDEX_API_KEY_PRIMARY,\n  generateGdexSessionKeyPair,\n  buildGdexSignInMessage,\n  buildGdexSignInComputedData,\n  buildGdexManagedTradeComputedData,\n  buildGdexUserSessionData,\n} from '@gemachdao\u002Fgdex-skill';\n\nconst skill = new GdexSkill();\nskill.loginWithApiKey(GDEX_API_KEY_PRIMARY);\nconst apiKey = GDEX_API_KEY_PRIMARY;\n\n\u002F\u002F Step 1: Generate a secp256k1 session keypair\nconst { sessionPrivateKey, sessionKey } = generateGdexSessionKeyPair();\n\u002F\u002F sessionKey = compressed public key (0x + 66 hex chars)\n\n\u002F\u002F Step 2: Build the sign-in message\nconst userId = '0xYourControlWalletAddress'; \u002F\u002F EVM address or Solana pubkey\nconst nonce = String(Math.floor(Date.now() \u002F 1000) + Math.floor(Math.random() * 1000));\nconst message = buildGdexSignInMessage(userId, nonce, sessionKey);\n\u002F\u002F → \"By signing, you agree to GDEX Trading Terms of Use...\"\n\n\u002F\u002F Step 3: Sign with control wallet\n\u002F\u002F   EVM:    wallet.signMessage(message) → EIP-191 personal_sign\n\u002F\u002F   Solana: nacl.sign.detached(Buffer.from(message)) → base58 encoded\nconst signature = '...'; \u002F\u002F your wallet's signature\n\n\u002F\u002F Step 4: Build encrypted computedData and POST to \u002Fv1\u002Fsign_in\nconst signInPayload = buildGdexSignInComputedData({\n  apiKey, userId, sessionKey, nonce, signature,\n});\nconst signInResult = await skill.signInWithComputedData({\n  computedData: signInPayload.computedData,\n  chainId: 1, \u002F\u002F 1 for EVM \u002F HyperLiquid, 622112261 for Solana (see \"ChainId for Sign-In Matters\")\n}, { sessionPrivateKey }); \u002F\u002F keeps the gdex_session cookie and signs \u002Fv1\u002Fuser (see \"Browser Session\")\n\n\u002F\u002F Step 5: Resolve user profile \u002F check managed wallet\nconst userData = buildGdexUserSessionData(sessionKey, apiKey);\nconst user = await skill.getManagedUser({ userId, data: userData, chainId: 622112261 }); \u002F\u002F Solana\n\u002F\u002F → { address: \"CFSi4YimeCbfSNqH2WmHwJKwj1YYG1cWBtQyVPB4sCe1\", chainId: \"622112261\", ... }\n```\n\n> **Critical: Solana chainId is `622112261` (`ChainId.SOLANA`), NOT `900`.** Using `900` returns the EVM managed address with `balance: null`. The `\u002Fv1\u002Fuser` endpoint returns a **different managed wallet address** per `chainId`:\n> - `chainId=1` → EVM managed: `0x9967179de55bd67e6b90fcc4f908556d93938c0f`\n> - `chainId=622112261` → Solana managed: `CFSi4YimeCbfSNqH2WmHwJKwj1YYG1cWBtQyVPB4sCe1` (base58)\n\n### Nonce Generation\n\nNonces are **client-generated** (not fetched from the server):\n\n```typescript\nconst nonce = String(Math.floor(Date.now() \u002F 1000) + Math.floor(Math.random() * 1000));\n```\n\n### Browser Session (required since 2026-10-28)\n\nThe backend now treats every client as a browser session (backend PR #382). The SDK (5.2.0+)\nhandles it; older SDKs fail every sign-in and trade with **403 `SESSION_ORIGIN_DENIED`**.\n\n- Every login, write and private read must send `X-Gdex-Client: web` and an allow-listed\n  `Origin` (default `https:\u002F\u002Fgdex.pro`, override with `new GdexSkill({ origin })`).\n- Sign-in sets an HttpOnly `gdex_session` cookie. The SDK captures it and sends it on every\n  later call. It is bound to that sign-in's session key, **idles out after 30 minutes unused**\n  and expires 8 hours after login. Signing in again replaces the session key and the cookie.\n- `GET \u002Fv1\u002Fuser` and private `\u002Fv1\u002Fagents\u002F*` routes also need a nonce signed with the session\n  private key. Pass `{ sessionPrivateKey }` to `signInWithComputedData` (or call\n  `skill.setSessionSigningKey(sessionPrivateKey)`); the key never leaves the process.\n\n**Saving a session for another process** (an hourly watcher, a separate trade script): store\n`skill.getBrowserSession()` next to the session key, both as secrets, and restore with\n`skill.setBrowserSession(saved)` + `skill.setSessionSigningKey(sessionPrivateKey)`. If more\nthan ~25 minutes have passed, or a call returns 401 `SESSION_INVALID`, sign in again instead.\nA session key alone, saved from before 2026-10-28, no longer works.\n\nThe MCP server does this automatically: `gdex_connect` stores the cookie with the account and\nre-signs in when it is stale.\n\n## 3. Encryption Details (AES-256-CBC)\n\nAll payloads use **deterministic** AES-256-CBC — no random IV:\n\n| Property | Derivation |\n|----------|------------|\n| **Key** | First 32 bytes of `SHA256(apiKey)` hex |\n| **IV** | First 16 bytes of `SHA256(SHA256(apiKey))` hex |\n\n```typescript\nimport { encryptGdexComputedData, decryptGdexComputedData, deriveGdexAesMaterial } from '@gemachdao\u002Fgdex-skill';\n\n\u002F\u002F Encrypt a JSON payload\nconst cipherHex = encryptGdexComputedData(JSON.stringify({ userId, data, signature, apiKey }), apiKey);\n\n\u002F\u002F Decrypt\nconst plaintext = decryptGdexComputedData(cipherHex, apiKey);\n\n\u002F\u002F Get raw key\u002FIV material\nconst { key, iv } = deriveGdexAesMaterial(apiKey);\n```\n\n**Important:**\n- Trade\u002Fsign-in payloads: `JSON.stringify(...)` → UTF-8 → encrypt → hex\n- Session key for `\u002Fv1\u002Fuser`: raw hex-decoded bytes → encrypt (NOT UTF-8 string; use `encryptGdexHexData`)\n- The API key is included **inside** the encrypted JSON payload, not just used for encryption\n- Do NOT use random IVs or `iv:ciphertext` format\n\n## 4. Trade Signing (secp256k1)\n\n**Spot trade signatures** use raw keccak256 + secp256k1 (no EIP-191 prefix):\n\n```typescript\nimport { signGdexTradeMessageWithSessionKey } from '@gemachdao\u002Fgdex-skill';\n\nconst signature = signGdexTradeMessageWithSessionKey(\n  'purchase',       \u002F\u002F action: 'purchase' or 'sell'\n  userId,           \u002F\u002F lowercase address\n  dataHex,          \u002F\u002F ABI-encoded trade data (without 0x prefix)\n  sessionPrivateKey,\n);\n\u002F\u002F Returns: r(64 hex) + s(64 hex) + v(2 hex) = 130 chars, no 0x prefix\n\u002F\u002F v = raw recoveryParam (00 or 01), NOT EIP-155 (1b\u002F1c)\n```\n\n**Sign-in** is the ONLY operation that uses EIP-191 `personal_sign` with the control wallet.\n\n### ABI Encoding Schemas\n\n| Operation | ABI Types | Fields |\n|-----------|-----------|--------|\n| **Sign-in** | `['bytes', 'string', 'string']` | `[sessionKey, nonce, refCode]` |\n| **Trade** | `['string', 'uint256', 'string']` | `[tokenAddress, amount, nonce]` |\n\n## 5. Building Trade Payloads\n\n```typescript\nimport { buildGdexManagedTradeComputedData } from '@gemachdao\u002Fgdex-skill';\n\nconst trade = buildGdexManagedTradeComputedData({\n  apiKey,\n  action: 'purchase',  \u002F\u002F or 'sell'\n  userId: '0xYourAddress',\n  tokenAddress: 'DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263',\n  amount: '100000',     \u002F\u002F in smallest unit\n  nonce: String(Math.floor(Date.now() \u002F 1000) + Math.floor(Math.random() * 1000)),\n  sessionPrivateKey,\n});\n\nconst result = await skill.submitManagedPurchase({\n  computedData: trade.computedData,\n  chainId: 622112261, \u002F\u002F Solana (ChainId.SOLANA), NOT 900\n  slippage: 1,\n});\n\n\u002F\u002F Poll trade status\nif (result.requestId) {\n  const status = await skill.getManagedTradeStatus(result.requestId);\n  console.log('Status:', status.status, 'Hash:', status.hash);\n}\n```\n\n## 6. Wallet-Based Auth (Advanced)\n\nFor user-owned wallets or browser extensions:\n\n```typescript\n\u002F\u002F EVM wallet\nawait skill.authenticate({\n  type: 'evm',\n  address: '0xYourAddress',\n  privateKey: '0xPrivateKey',\n});\n\n\u002F\u002F Solana wallet\nawait skill.authenticate({\n  type: 'solana',\n  address: 'YourSolanaAddress',\n  privateKey: 'base58EncodedPrivateKey',\n});\n\n\u002F\u002F Custom signer (MetaMask \u002F Phantom)\nawait skill.authenticate({\n  type: 'evm',\n  address: accounts[0],\n  signer: async (message) =>\n    window.ethereum.request({ method: 'personal_sign', params: [message, accounts[0]] }),\n});\n```\n\n## 7. SDK Configuration\n\n```typescript\nconst skill = new GdexSkill({\n  apiUrl:     'https:\u002F\u002Ftrade-api.gemach.io\u002Fv1', \u002F\u002F Default backend\n  timeout:    30000,                             \u002F\u002F Request timeout ms\n  maxRetries: 3,                                 \u002F\u002F Retry on 429\u002F503\n  debug:      false,                             \u002F\u002F Log requests\n});\n```\n\nHTTP headers MUST include a browser User-Agent (e.g., Chrome\u002F91) — non-browser UAs get 403 from Cloudflare. Use `Authorization: Bearer \u003CapiKey>` header, NOT `X-API-Key`.\n\n## Helper Functions Reference\n\n| Function | Purpose |\n|----------|---------|\n| `generateGdexSessionKeyPair()` | Generate secp256k1 session keypair |\n| `buildGdexSignInMessage(userId, nonce, sessionKey)` | Build sign-in message for wallet signing |\n| `buildGdexSignInComputedData({...})` | Build encrypted sign-in payload |\n| `buildGdexUserSessionData(sessionKey, apiKey)` | Encrypt session key for `\u002Fv1\u002Fuser` |\n| `buildGdexManagedTradeComputedData({...})` | Build encrypted trade payload |\n| `signGdexTradeMessageWithSessionKey(action, userId, data, privKey)` | Sign trade with session key |\n| `encryptGdexComputedData(plaintext, apiKey)` | AES-256-CBC encrypt UTF-8 |\n| `encryptGdexHexData(hexData, apiKey)` | AES-256-CBC encrypt raw hex bytes |\n| `decryptGdexComputedData(cipherHex, apiKey)` | AES-256-CBC decrypt |\n| `deriveGdexAesMaterial(apiKey)` | Get raw AES key\u002FIV |\n\n## Common Issues\n\n### 401 Unauthorized\n- API key not set or expired — call `skill.loginWithApiKey(apiKey)` first\n- Session expired — re-authenticate\n\n### 403 `SESSION_ORIGIN_DENIED` (\"Request origin denied\")\n- SDK older than 5.2.0: it does not send `X-Gdex-Client: web` \u002F `Origin`. Upgrade, then sign in again.\n- Raw HTTP callers must send both headers on `\u002Fv1\u002Fsign_in` and every private call.\n\n### 401 `SESSION_INVALID` (\"Please sign in again\")\n- The `gdex_session` cookie is missing, idled out (30 min) or expired (8 h), or a newer sign-in\n  rotated the session key. Sign in again; for a separate process, restore the cookie (see \"Browser Session\").\n\n### 403 Forbidden\n- Non-browser User-Agent header — the SDK handles this automatically\n- Using `X-API-Key` instead of `Authorization: Bearer`\n\n### 400 Unauthorized (code 103) on HL operations\n- **Most common cause:** Passing the **managed address** as `walletAddress` instead of the **control wallet address**.\n- During sign-in, the session key is registered for the control wallet address (the one that signed the sign-in message).\n- All HL write operations (`hlCreateOrder`, `perpDeposit`, `hlCloseAll`, etc.) sign the payload as `{action}-{walletAddress}-{data}` — if `walletAddress` doesn't match the sign-in `userId`, the signature verification fails.\n- **Fix:** Always set `walletAddress` to the control wallet address used during sign-in, NOT the managed address returned by `\u002Fv1\u002Fuser` or `\u002Fv1\u002Fsign_in`.\n\n```typescript\n\u002F\u002F ❌ WRONG — managed address causes code 103\nconst creds = { apiKey, walletAddress: user.address, sessionPrivateKey };\n\n\u002F\u002F ✅ CORRECT — use the control wallet that signed in\nconst creds = { apiKey, walletAddress: controlWallet.address, sessionPrivateKey };\n```\n\n### 400 Unauthorized (code 103) on HL operations\n- Wrong ABI encoding for the specific HL action — see **gdex-perp-trading** skill\n- Using `uint256` instead of `uint64` for chainId in `hl_deposit`\n- Wrong signature format (must be raw `v=00\u002F01`, not EIP-155 `v=1b\u002F1c`)\n\n## Autonomous Agent Notes (Live-Tested)\n\n### Complete Auth Flow — Verified Working\n\n```typescript\nimport { ethers } from 'ethers';\nimport {\n  GdexSkill, GDEX_API_KEY_PRIMARY,\n  generateGdexSessionKeyPair, buildGdexSignInMessage,\n  buildGdexSignInComputedData, buildGdexUserSessionData,\n} from '@gemachdao\u002Fgdex-skill';\n\nconst skill = new GdexSkill();\nskill.loginWithApiKey(GDEX_API_KEY_PRIMARY);\n\n\u002F\u002F 1. Generate session keypair\nconst { sessionPrivateKey, sessionKey } = generateGdexSessionKeyPair();\n\n\u002F\u002F 2. Sign in with control wallet\nconst wallet = ethers.Wallet.fromPhrase('your mnemonic phrase...');\nconst userId = wallet.address;\nconst nonce = String(Math.floor(Date.now() \u002F 1000) + Math.floor(Math.random() * 1000));\nconst message = buildGdexSignInMessage(userId, nonce, sessionKey);\nconst signature = await wallet.signMessage(message);\n\nconst signInPayload = buildGdexSignInComputedData({\n  apiKey: GDEX_API_KEY_PRIMARY, userId, sessionKey, nonce, signature,\n});\nawait skill.signInWithComputedData({\n  computedData: signInPayload.computedData,\n  chainId: 1,  \u002F\u002F EVM for HL\u002Fperps, 622112261 for Solana spot\n}, { sessionPrivateKey });\n\n\u002F\u002F 3. Resolve managed wallet\nconst data = buildGdexUserSessionData(sessionKey, GDEX_API_KEY_PRIMARY);\nconst user = await skill.getManagedUser({ userId, data, chainId: 622112261 });\n\u002F\u002F user.address = managed Solana wallet (base58)\n```\n\n### ChainId for Sign-In Matters\n\n| Operation | Sign-In ChainId | Why |\n|-----------|----------------|-----|\n| Solana spot\u002Flimit\u002Fcopy | `622112261` | Solana chain context |\n| HL perps, deposit, withdraw | `1` (EVM) | HL uses EVM wallets |\n| HL perp copy trading | `1` (EVM) | HL copy uses EVM |\n| Bridge | `1` (EVM) | Bridge uses EVM context |\n\n### Credentials to Keep Track Of\n\nAn autonomous agent must persist these across operations:\n- `sessionPrivateKey` — signs all trade payloads (one per sign-in session)\n- `sessionKey` — used to build encrypted `data` for read endpoints\n- `controlAddress` (=`userId`) — the wallet that signed in (used in all API calls)\n- `managedEvmAddress` — from `\u002Fv1\u002Fuser?chainId=1` (needed for `user_stats` only)\n- `managedSolanaAddress` — from `\u002Fv1\u002Fuser?chainId=622112261` (for on-chain queries only)\n\n## Google OAuth + Email Association Flow\n\nThe backend (`ServiceMain.oauthLogin` \u002F `ServiceMain.associateEmail`, v1.1.0)\nsupports a Google-only OAuth onboarding path mounted at `\u002Fv1\u002Fauth\u002F*`. **There\nis no `provider` field and no Apple\u002FGitHub\u002FTwitter branch** — only Google ID\ntokens are accepted, and **the client never sends a raw `email`**.\n\nFlow:\n\n1. **`associate_email` first** — links the caller's wallet to the email claim\n   carried inside the verified Google ID token. The backend extracts the\n   email server-side; the client only sends `{ computedData, idToken }`,\n   where `computedData` is a managed-custody payload built with\n   `buildAssociateEmailComputedData` (ABI `['associate_email', [nonce]]`,\n   sig msg `associate_email-${userId}-${data}`).\n2. **`oauth_login` with the same `idToken`** — body\n   `{ idToken, chainId? }`. If the wallet still has no `associatedEmail`\n   the backend responds 404 with internal code 108; re-run step 1 and retry.\n\n## Related Skills\n\n- **gdex-onboarding** — Platform overview and getting started\n- **gdex-spot-trading** — Buy\u002Fsell tokens (requires auth)\n- **gdex-perp-trading** — HyperLiquid perps (requires auth + HL-specific crypto)\n- **gdex-wallet-setup** — Generate control wallets for new users\n",{"name":5,"description":7},"main","3df1d0d67b30ff15236561f8c0f9f06d33f42dfd","skills\u002Fmcp-servers\u002Fgemachdao-gdex-authentication",17,"https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia","https:\u002F\u002Feth2030.com","Hardcore infra. Building @alt-research and applied cryptography.","2026-11-15 02:28:10",{"source":8,"skillName":5,"commands":49,"prompt":59,"zipAvailable":60},[50,53,56],{"tool":51,"command":52},"npx","npx skills add jiayaoqijia\u002Fcryptoskill --skill gdex-authentication",{"tool":54,"command":55},"bunx","bunx skills add jiayaoqijia\u002Fcryptoskill --skill gdex-authentication",{"tool":57,"command":58},"pnpm","pnpm dlx skills add jiayaoqijia\u002Fcryptoskill --skill gdex-authentication","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fmcp-servers\u002Fgemachdao-gdex-authentication\u002FSKILL.md",true,[62,66,72],{"path":63,"resourceType":63,"resourceTypeDesc":64,"sizeBytes":65,"sourceHtmlUrl":16},"LICENSE","许可证",1066,{"path":67,"resourceType":68,"resourceTypeDesc":69,"sizeBytes":70,"sourceHtmlUrl":71},"SOURCE.md","REFERENCE","参考文档",348,"https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fmcp-servers\u002Fgemachdao-gdex-authentication\u002FSOURCE.md",{"path":73,"resourceType":68,"resourceTypeDesc":69,"sizeBytes":74,"sourceHtmlUrl":75},"TRUST.auto.yaml",2182,"https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fmcp-servers\u002Fgemachdao-gdex-authentication\u002FTRUST.auto.yaml",[77,86,93,101,109,117],{"skillNo":78,"name":79,"nameZh":6,"description":80,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":81,"sourceHtmlUrl":82,"categories":83,"keywords":84,"publishedAt":85},"01M7DTKCERMV0RNX3HZJP4CZ26","troves","Deposit and withdraw from Troves DeFi yield vault strategies on Starknet. View available strategies, check positions, and manage vault deposits. Use this skill when the user mentions Troves, vault, yield vault, DeFi vault, strategy, yield farming, vault deposit, vault withdraw, earning yield through vaults, passive yield strategies, or wants to deposit into or withdraw from a yield strategy — even if they don't say \"Troves\" explicitly.","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fmcp-servers\u002Fahmetenesdur-troves\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fmcp-servers\u002Fahmetenesdur-troves\u002FSKILL.md",[],[],"2026-11-15 14:19:17",{"skillNo":87,"name":27,"nameZh":6,"description":88,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":89,"sourceHtmlUrl":90,"categories":91,"keywords":92,"publishedAt":85},"01M7DTK6CJSMGC8KCQHGNYFZBD","Swap tokens on Starknet via Fibrous DEX aggregator. Supports per-provider selection (avnu, ekubo, or auto to race all). Use this skill when the user wants to swap, exchange, trade, convert, buy, or sell one token for another on Starknet. Also use when the user asks about token prices, exchange rates, DEX routing, best swap route, or wants to check how much they would receive for a given amount — even if they don't explicitly say \"swap\".","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fmcp-servers\u002Fahmetenesdur-trade\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fmcp-servers\u002Fahmetenesdur-trade\u002FSKILL.md",[],[],{"skillNo":94,"name":95,"nameZh":6,"description":96,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":97,"sourceHtmlUrl":98,"categories":99,"keywords":100,"publishedAt":85},"01M7DTJZ6A0X4PAW3Y8W4J9K64","staking","Stake, unstake, claim, and compound rewards for STRK, WBTC, tBTC, SolvBTC, and LBTC on Starknet. View validators, pools, and staking positions. Use this skill when the user mentions staking, delegating, validators, staking pools, rewards, compounding, unstaking, earning yield, passive income on crypto, or wants to earn on their STRK or BTC tokens — even if they don't say \"stake\" explicitly.","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fmcp-servers\u002Fahmetenesdur-staking\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fmcp-servers\u002Fahmetenesdur-staking\u002FSKILL.md",[],[],{"skillNo":102,"name":103,"nameZh":6,"description":104,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":105,"sourceHtmlUrl":106,"categories":107,"keywords":108,"publishedAt":85},"01M7DTJSDZJKCDMW7GHRF4BRH5","send","Send STRK, ETH, or any ERC-20 token to a Starknet address. Supports simulation (dry-run) before execution. Use this skill when the user wants to send, transfer, pay, tip, or move tokens to another wallet address on Starknet. Also trigger when the user mentions sending funds to someone, making a payment, transferring assets, or moving crypto to a specific address — even if they just say \"pay 10 STRK to 0x...\".","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fmcp-servers\u002Fahmetenesdur-send\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fmcp-servers\u002Fahmetenesdur-send\u002FSKILL.md",[],[],{"skillNo":110,"name":111,"nameZh":6,"description":112,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":113,"sourceHtmlUrl":114,"categories":115,"keywords":116,"publishedAt":85},"01M7DTJG1E480D51ZQ7WKDQ26K","portfolio","View a comprehensive DeFi portfolio dashboard and optimize portfolio allocation via automated rebalancing. Use this skill when the user wants an overview, summary, dashboard, total value, net worth, portfolio rebalancing, target allocation, or wants to see all their DeFi positions across Starknet at once. Also trigger when the user asks \"what do I have\", \"show me everything\", \"how much am I worth\", \"my positions\", \"my investments\", \"rebalance my portfolio\", \"I want 50% ETH\", \"optimize my holdings\", or any request for a holistic view of their Starknet holdings — even if they don't explicitly say \"portfolio\".","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fmcp-servers\u002Fahmetenesdur-portfolio\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fmcp-servers\u002Fahmetenesdur-portfolio\u002FSKILL.md",[],[],{"skillNo":118,"name":119,"nameZh":6,"description":120,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":121,"sourceHtmlUrl":122,"categories":123,"keywords":124,"publishedAt":85},"01M7DTJ7M8TE9R2N36HFBZDGVD","multi-swap","Execute multiple token swaps in a single Starknet transaction via Fibrous (default). Supports per-provider selection (avnu, ekubo, or auto to race all). Supports 2-3 swap pairs bundled into one multicall. Use this skill when the user wants to swap multiple token pairs at once, do batch swaps, execute several trades simultaneously, perform parallel swaps, or do bulk trading in one transaction. Also trigger when the user mentions \"two swaps\", \"three swaps\", \"swap X and Y at the same time\", or wants to convert multiple tokens in a single call.","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fmcp-servers\u002Fahmetenesdur-multi-swap\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fmcp-servers\u002Fahmetenesdur-multi-swap\u002FSKILL.md",[],[]]