Elsa official openclaw

From jiayaoqijia/cryptoskill · View interactive version

Elsa official openclaw is an AI agent skill from the GitHub repository jiayaoqijia/cryptoskill. DeFi tools for portfolio analysis, token search, and swap execution via Elsa API with x402 micropayments

How to use this skill

Skill file

Elsa x402 DeFi Tools

This skill provides access to the Elsa DeFi API for portfolio management, token analysis, and swap execution using x402 micropayments.

Standard Operating Procedure

Budget Controls

Recommended Swap Flow (OpenClaw)

When executing swaps, follow this 4-step flow:

┌─────────────────────┐     ┌─────────────────────┐     ┌─────────────┐     ┌─────────────────────┐
│ 1. Get Quote        │ ──▶ │ 2. Dry Run          │ ──▶ │ 3. Confirm  │ ──▶ │ 4. Execute Pipeline │
│ elsa_get_swap_quote │     │ elsa_execute_swap_  │     │ [User says  │     │ elsa_pipeline_run_  │
│                     │     │ dry_run             │     │  "yes"]     │     │ and_wait            │
└─────────────────────┘     └─────────────────────┘     └─────────────┘     └─────────────────────┘

Step 1: Get Quote - Show user what they'll receive

npx tsx scripts/index.ts elsa_get_swap_quote '{
  "from_chain": "base", "from_token": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
  "from_amount": "10", "to_chain": "base", "to_token": "0x4200000000000000000000000000000000000006",
  "wallet_address": "0x...", "slippage": 0.5
}'

Step 2: Dry Run - Create pipeline, get pipeline_id

npx tsx scripts/index.ts elsa_execute_swap_dry_run '{...same params...}'
# Returns: { "pipeline_id": "abc-123", "confirmation_token": "..." }

Step 3: User Confirmation - Present results and wait for explicit "yes"

Step 4: Execute Pipeline - Sign and broadcast transactions

ELSA_ENABLE_EXECUTION_TOOLS=true npx tsx scripts/index.ts elsa_pipeline_run_and_wait '{
  "pipeline_id": "abc-123",
  "timeout_seconds": 180,
  "poll_interval_seconds": 3,
  "mode": "local_signer"
}'
# Automatically: signs approve tx → submits → signs swap tx → submits → returns tx hashes

Required Environment Variables

# For x402 API payments
PAYMENT_PRIVATE_KEY=0x...

# For signing swap transactions (optional - falls back to PAYMENT_PRIVATE_KEY)
TRADE_PRIVATE_KEY=0x...

# Enable execution tools
ELSA_ENABLE_EXECUTION_TOOLS=true

Critical Rules

Tool Catalog

Read-Only Tools (Always Available)

elsa_search_token

Search for tokens across supported blockchains.

npx tsx scripts/index.ts elsa_search_token '{"query": "USDC", "limit": 5}'

Input:


elsa_get_token_price

Get current price for a token.

npx tsx scripts/index.ts elsa_get_token_price '{"token_address": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", "chain": "base"}'

Input:


elsa_get_balances

Get token balances for a wallet.

npx tsx scripts/index.ts elsa_get_balances '{"wallet_address": "0x..."}'

Input:


elsa_get_portfolio

Get comprehensive portfolio analysis.

npx tsx scripts/index.ts elsa_get_portfolio '{"wallet_address": "0x..."}'

Input:


elsa_analyze_wallet

Get wallet behavior and risk assessment.

npx tsx scripts/index.ts elsa_analyze_wallet '{"wallet_address": "0x..."}'

Input:


elsa_get_swap_quote

Get a swap quote with optimal routing.

npx tsx scripts/index.ts elsa_get_swap_quote '{
  "from_chain": "base",
  "from_token": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
  "from_amount": "100",
  "to_chain": "base",
  "to_token": "0x4200000000000000000000000000000000000006",
  "wallet_address": "0x...",
  "slippage": 0.5
}'

Input:


elsa_execute_swap_dry_run

Simulate a swap without execution. Returns a confirmation token for subsequent confirmed execution.

npx tsx scripts/index.ts elsa_execute_swap_dry_run '{
  "from_chain": "base",
  "from_token": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
  "from_amount": "100",
  "to_chain": "base",
  "to_token": "0x4200000000000000000000000000000000000006",
  "wallet_address": "0x...",
  "slippage": 0.5
}'

Output includes:


elsa_budget_status

Check current budget usage and remaining limits.

npx tsx scripts/index.ts elsa_budget_status '{}'

Output:


elsa_get_limit_orders

Get all limit orders for a wallet.

npx tsx scripts/index.ts elsa_get_limit_orders '{"wallet_address": "0x...", "chain": "base"}'

Input:

Output:


elsa_get_perp_positions

Get perpetual positions for a wallet.

npx tsx scripts/index.ts elsa_get_perp_positions '{"wallet_address": "0x..."}'

Input:

Output:


elsa_get_transaction_history

Get transaction history for a wallet.

npx tsx scripts/index.ts elsa_get_transaction_history '{"wallet_address": "0x...", "chain": "base", "limit": 20}'

Input:

Output:


Execution Tools (Requires ELSA_ENABLE_EXECUTION_TOOLS=true)

elsa_execute_swap_confirmed

Execute a confirmed swap. Requires prior dry-run and confirmation token.

npx tsx scripts/index.ts elsa_execute_swap_confirmed '{
  "from_chain": "base",
  "from_token": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
  "from_amount": "100",
  "to_chain": "base",
  "to_token": "0x4200000000000000000000000000000000000006",
  "wallet_address": "0x...",
  "slippage": 0.5,
  "confirmation_token": "abc123..."
}'

elsa_pipeline_get_status

Check status of a pipeline/transaction.

npx tsx scripts/index.ts elsa_pipeline_get_status '{"pipeline_id": "pip_123456789"}'

elsa_pipeline_submit_tx_hash

Submit a signed transaction hash to the pipeline.

npx tsx scripts/index.ts elsa_pipeline_submit_tx_hash '{"task_id": "task_123", "tx_hash": "0x..."}'

elsa_pipeline_run_and_wait

Orchestrate full pipeline execution with automatic signing and submission.

npx tsx scripts/index.ts elsa_pipeline_run_and_wait '{
  "pipeline_id": "pip_123456789",
  "timeout_seconds": 120,
  "poll_interval_seconds": 2,
  "mode": "local_signer"
}'

Modes:


elsa_create_limit_order

Create a limit order to execute when price reaches target.

ELSA_ENABLE_EXECUTION_TOOLS=true npx tsx scripts/index.ts elsa_create_limit_order '{
  "wallet_address": "0x...",
  "chain": "base",
  "from_token": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
  "to_token": "0x4200000000000000000000000000000000000006",
  "from_amount": "100",
  "limit_price": "0.0004",
  "expiry_hours": 24
}'

Input:


elsa_cancel_limit_order

Cancel an existing limit order.

ELSA_ENABLE_EXECUTION_TOOLS=true npx tsx scripts/index.ts elsa_cancel_limit_order '{
  "wallet_address": "0x...",
  "order_id": "order_123",
  "chain": "base"
}'

Input:


elsa_open_perp_position

Open a perpetual futures position.

ELSA_ENABLE_EXECUTION_TOOLS=true npx tsx scripts/index.ts elsa_open_perp_position '{
  "wallet_address": "0x...",
  "market": "ETH-USD",
  "side": "long",
  "size_usd": "100",
  "leverage": 5,
  "take_profit": "4000",
  "stop_loss": "2800"
}'

Input:


elsa_close_perp_position

Close an open perpetual position.

ELSA_ENABLE_EXECUTION_TOOLS=true npx tsx scripts/index.ts elsa_close_perp_position '{
  "wallet_address": "0x...",
  "position_id": "pos_123",
  "close_percentage": 100
}'

Input:

Supported Chains

API Costs

| Tool | Estimated Cost |

|------|----------------|

| elsa_search_token | $0.002 |

| elsa_get_token_price | $0.002 |

| elsa_get_balances | $0.002 |

| elsa_get_portfolio | $0.002 |

| elsa_analyze_wallet | $0.005 |

| elsa_get_swap_quote | $0.002 |

| elsa_execute_swap_dry_run | $0.005 |

| elsa_get_limit_orders | $0.002 |

| elsa_get_perp_positions | $0.002 |

| elsa_get_transaction_history | $0.002 |

| elsa_create_limit_order | $0.05 |

| elsa_cancel_limit_order | $0.01 |

| elsa_open_perp_position | $0.05 |

| elsa_close_perp_position | $0.05 |

| elsa_execute_swap_confirmed | $0.05 |

Coming Soon

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.