Heurist Logo
Back to Skill Marketplace
gate

gate-dex-trade

VerifiedCryptoaccess level:high

Gate DEX trading comprehensive skill. Supports MCP and OpenAPI dual modes: MCP mode calls through gate-wallet service (requires authentication), OpenAPI mode calls directly through AK/SK. Use when users mention swap, exchange, buy, sell, quote, trade. Automatically select the most suitable calling method based on environment.

Install

npx @heurist-network/skills add gate-dex-trade

Installs

2

Stars

10

Timeline

Updated Mar 16, 2026

Created Mar 14, 2026

Source

Verification

Reviewed and verified

SHA256: 791cc511adab8263...

Approved Mar 16, 2026 by admin

Access Level

high

Files (4)

CHANGELOG.md

README.md

SKILL.md

install.sh

Summary

updated
2026-03-12
version
2026.3.12-1

SKILL.md

Gate DEX Trade

Trading Comprehensive Skill β€” MCP + OpenAPI dual mode support, intelligent routing selects optimal trading method

Trigger Scenarios: Use when users mention "swap", "exchange", "buy", "sell", "trade", "quote" and other related operations.


🎯 Dual Mode Architecture

ModeConnection MethodAdvantagesUse Cases
πŸ”— MCP Modegate-wallet MCP ServerUnified authentication, wallet ecosystem integrationComplete trading process, cross-Skill collaboration
⚑ OpenAPI ModeAK/SK direct callsIndependent execution, complete lifecycleFast trading, full chain control

πŸ“‹ Smart Routing Rules

System automatically selects calling mode based on following priorities:

PriorityConditionSelected ModeRouting Target
1Explicitly mentions "OpenAPI", "AK/SK"⚑ OpenAPIreferences/openapi.md
2Exists ~/.gate-dex-openapi/config.json⚑ OpenAPIreferences/openapi.md
3From wallet Skills cross-Skill callsπŸ”— MCPCurrent SKILL.md main process
4Default scenarioπŸ”— MCPCurrent SKILL.md main process

User Preferences:

  • Pursue complete ecosystem integration β†’ MCP mode
  • Pursue independent fast execution β†’ OpenAPI mode

MCP Server Connection Detection

First Session Detection

Before first MCP tool call in session, perform one connection probe to confirm Gate Wallet MCP Server availability. No need to repeat detection for subsequent operations.

CallMcpTool(server="gate-wallet", toolName="chain.config", arguments={chain: "eth"})
ResultHandling
SuccessMCP Server available, subsequent operations directly call business tools, no need to probe again
FailureDisplay configuration guidance based on error type (see error handling below)

Runtime Error Fallback

If business tool calls fail during subsequent operations (returning connection errors, timeouts etc.), handle according to following rules:

Error TypeKeywordsHandling
MCP Server not configuredserver not found, unknown serverDisplay MCP Server configuration guidance
Remote service unreachableconnection refused, timeout, DNS errorPrompt to check server status and network connection
Authentication failed401, unauthorized, x-api-keyPrompt to contact administrator for API Key

Authentication Description

All operations in MCP mode require mcp_token. Must confirm user is logged in before calling any tool.

  • If currently no mcp_token β†’ Guide to gate-dex-wallet/references/auth to complete login then return
  • If mcp_token expired (MCP Server returns token expired error) β†’ First try auth.refresh_token silent refresh, guide re-login if failed

MCP Tool Call Specification (Main Process)

1. tx.quote β€” Get Swap Quote

Get Swap quote from input token to output token.

FieldDescription
Tool Nametx.quote
Parameters{ chain_id_in: string, chain_id_out: string, token_in: string, token_out: string, amount: string, slippage?: number, user_wallet: string, native_in?: boolean, native_out?: boolean, mcp_token: string }
ReturnQuote details including exchange rate, slippage, routing path, estimated Gas etc

2. tx.swap β€” Execute Swap

One-shot Swap execution (Quote→Build→Sign→Submit single call).

FieldDescription
Tool Nametx.swap
ParametersSame as tx.quote + account_id
ReturnTransaction result

3. tx.swap_detail β€” Query Swap Status

(Other MCP tool specifications...)


Sub-module Routing

Route to specific implementation based on mode detection result and user intent:

Routing ConditionTargetDescription
OpenAPI environment + related intentreferences/openapi.mdComplete OpenAPI call specification
MCP environment + trading intentCurrent SKILL.md main processMCP tool calls and three-step confirmation process

Operation Process

Process A: Smart Mode Selection

First session detection (if needed)
  ↓
Environment detection:
  1. Check ~/.gate-dex-openapi/config.json
  2. Check gate-wallet MCP Server
  ↓
Select calling mode based on detection result:
  β†’ OpenAPI mode: references/openapi.md
  β†’ MCP mode: Current main process

Process B: MCP Swap Execution (Main Process)

Authentication check β†’ Balance verification β†’ Trading pair confirmation 
  β†’ tx.quote β†’ Quote display β†’ Signature authorization confirmation 
    β†’ tx.swap β†’ tx.swap_detail

Cross-Skill Collaboration

CallerScenarioTool Used
gate-dex-walletUser views balance then wants to exchange tokensMCP mode call
gate-dex-marketUser views market then wants to buy certain tokenMCP mode call

Supported Chains

Chain IDNetwork NameMCP SupportOpenAPI Support
eth / 1Ethereumβœ…βœ…
bsc / 56BNB Smart Chainβœ…βœ…
polygon / 137Polygonβœ…βœ…
arbitrum / 42161Arbitrum Oneβœ…βœ…
optimism / 10Optimismβœ…βœ…
avax / 43114Avalancheβœ…βœ…
base / 8453Baseβœ…βœ…
sol / 501Solanaβœ…βœ…

Security Rules

  1. Mode selection transparency: Clearly inform users of current calling mode and reason
  2. Authentication isolation: MCP mode uses mcp_token, OpenAPI mode uses AK/SK
  3. Three-step confirmation gating: MCP mode includes trading pair confirmation β†’ quote display β†’ signature authorization confirmation
  4. Balance verification: Mandatory check asset sufficiency before trading
  5. Risk alerts: Mandatory warning when price difference > 5%, high slippage MEV risk alerts