← 返回
未分类 中文

spanDEX Trader

Trade tokens on Base using spanDEX, the open-source meta-aggregator. Supports market swaps (races 6 providers for best price with automatic fallback), limit...
在 Base 上使用 spanDEX(开源元聚合器)交易代币,支持市价交易(对比 6 家供应商获取最佳价格并自动兜底)以及限价交易。
axiom89 axiom89 来源
未分类 clawhub v1.0.0 1 版本 100000 Key: 无需
★ 0
Stars
📥 196
下载
💾 0
安装
1
版本
#latest

概述

spanDEX Trader

Trade on Base chain using spanDEX — the free, open-source meta-aggregator by @_nonlinear / Fabric.

Races 6 DEX aggregators (Fabric, KyberSwap, Odos, Velora, LI.FI, Relay) per swap, simulates on-chain, picks the winner, and executes with automatic fallback if the best-priced provider fails.

Setup

Prerequisites: Node.js 18+, npm

# Install dependencies (run once in skill directory)
cd <skill-dir>/scripts && npm init -y && npm i viem @spandex/core

Required env vars:

VarPurpose
--------------
BASE_RPC_URLBase chain RPC endpoint (Alchemy, Infura, dRPC, etc.)
SPANDEX_PRIVATE_KEYWallet private key (hex). OR use SPANDEX_KEY_PATH for file-based key

Optional env vars:

VarDefaultPurpose
-----------------------
SPANDEX_KEY_PATHPath to file containing private key (alternative to raw key)
SPANDEX_APP_IDspandex-trader-skillApp identifier for provider APIs
SPANDEX_STRATEGYbestPriceDefault quote strategy
SPANDEX_PRIORITY_GWEI0.03Priority fee floor (gwei) for Base sequencer
SPANDEX_SKIP_LOCKSet 1 to disable anti-double-execution lock
SPANDEX_DEBUGEnable debug logging

Commands

All output is JSON. TOKEN can be a contract address or alias (USDC, WETH, ETH, DAI, USDT).

# Compare prices across all 6 providers
node scripts/spandex_trade.mjs quote --sell USDC --buy 0xTOKEN --amount 50

# Execute swap (best price, automatic fallback)
node scripts/spandex_trade.mjs swap --sell USDC --buy 0xTOKEN --amount 50
node scripts/spandex_trade.mjs swap --sell USDC --buy 0xTOKEN --amount 50 --slippage 500 --dry-run

# KyberSwap limit orders (gasless EIP-712)
node scripts/spandex_trade.mjs limit --sell 0xTOKEN --buy USDC --sell-amount 1000000 --buy-amount 50 --expiry 7d
node scripts/spandex_trade.mjs orders --status active
node scripts/spandex_trade.mjs cancel-order --order-id 123

# Wallet
node scripts/spandex_trade.mjs balance
node scripts/spandex_trade.mjs balance --token 0xTOKEN
node scripts/spandex_trade.mjs providers

Slippage defaults

Auto-applied based on token pair:

  • Major ↔ Major (USDC/WETH/ETH): 0.5% (50 bps)
  • Major ↔ Microcap: 3% (300 bps)
  • Microcap ↔ Microcap: 5% (500 bps)

Override with --slippage .

Execution flow

  1. getQuotes() — fetch + simulate from all 6 providers in parallel
  2. sortQuotesByPerformance() — rank by output amount (best first)
  3. For each quote: buildCalls()sendTransaction() with priority fee → if fail, try next provider
  4. netOutputs() — extract actual output from TX receipt logs
  5. Final balance verification

Key behaviors

  • Anti-double-execution: 120s lockfile per token prevents accidental duplicate swaps
  • Fallback routing: If best-price provider fails execution, automatically tries next
  • V4/DERC20 compatible: Uses buildCalls() for proper Clanker V4 and Flaunch DERC20 settlement
  • No API keys needed: All 6 providers work without registration

Token compatibility by provider

ProviderStandard ERC-20Clanker V4Flaunch DERC20
------------------------------------------------------
KyberSwap
LI.FI
Fabric⚠️⚠️
Odos
Velora
Relay⚠️⚠️

For detailed integration notes and architecture, see references/INTEGRATION.md.

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-05-12 06:19 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

professional

Stock Analysis

udiedrichsen
{"answer":"基于雅虎财经数据,分析股票与加密货币。支持投资组合管理、自选股预警、股息分析、8维评分、热门趋势扫描及传闻/早期信号探测。适用于股票分析、持仓追踪、财报异动、加密监控、热门股追踪或提前发掘非主流传闻。"}
★ 276 📥 57,395
professional

Stock Market Pro

kys42
Yahoo Finance (yfinance) 驱动的股票分析技能:行情报价、基本面、ASCII 趋势图、高分辨率图表(RSI/MACD/BB/VWAP/ATR),以及可选的网络...
★ 162 📥 39,989
professional

A股量化 AkShare

mbpz
A股量化数据分析工具,基于AkShare库获取A股行情、财务数据、板块信息等。用于回答关于A股股票查询、行情数据、财务分析、选股等问题。
★ 185 📥 61,817