Skip to content

morph-l2/morph-skill

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Morph Skill

Overview

An AI Agent skill for interacting with the Morph L2 blockchain, enabling natural-language-driven wallet operations, on-chain data queries, DEX swaps, and cross-chain bridge swaps.

Core Capabilities

Capability Description Example
Wallet Create Generate ETH key pair locally "Create a new wallet"
Balance Query Native ETH and ERC20 token balances "How much ETH do I have?"
Token Transfer Send ETH or ERC20 tokens "Send 10 USDT to 0x..."
Transaction Lookup Receipt and detailed tx info "What happened in this tx?"
Address Info On-chain address summary "Show me this wallet's activity"
Transaction History List transactions for an address "Recent txs for 0x..."
Token Holdings All token balances for an address "What tokens does this wallet hold?"
Token Search Find tokens by name or symbol "Find the USDT contract address"
Contract Info Contract source code, ABI, proxy info "Is this contract verified?"
Token Transfers Recent transfer history for a token or address "Show recent USDT transfers"
Token Info Token details: supply, holders, transfers "How many holders does USDT have?"
DEX Quote Best-route swap quote + calldata (Morph only) "How much USDT for 1 ETH?"
DEX Send Sign and broadcast swap transaction (Morph only) Complete the swap on-chain
Bridge Quote Cross-chain swap quote across 6 chains "How much to bridge USDC from Base to Morph?"
Bridge Swap One-step cross-chain swap: create, sign, and submit "Bridge 10 USDT from Morph to Base"
Bridge Order Track cross-chain swap order status "Check my bridge order status"
Bridge Balance Token balance + USD price on any supported chain "What's my USDC balance on Base?"
Alt-Fee Tokens List supported alt-fee tokens "What tokens can I use to pay gas?"
Alt-Fee Token Info Fee token details (scale, rate) "Get info for fee token 5"
Alt-Fee Estimate Estimate gas cost in alt token "How much USDT to cover gas?"
Alt-Fee Send Send tx paying gas with alt token "Transfer ETH, pay gas with USDT"

Amounts are human-readable — pass 0.1 for 0.1 ETH, NOT 100000000000000000 wei.

Data Sources

Query endpoints are public — no API keys required. Bridge order management requires JWT authentication via bridge-login.

Source Base URL Auth
Morph RPC https://rpc.morph.network/ None
Explorer API (Blockscout) https://explorer-api.morph.network/api/v2 None
DEX / Bridge API https://api.bulbaswap.io None (queries) / JWT (orders)

Architecture

Natural Language Input
    ↓
AI Agent (Claude Code / Cursor / OpenClaw / Custom)
    ↓  ← loads skill from skills/ (wallet, explorer, dex, bridge, altfee)
morph_api.py (Python 3.11+)
    ↓  ← No API keys for queries; JWT for bridge orders
Direct RPC / Explorer / DEX / Bridge API calls
    ↓
Structured JSON → Agent interprets → Natural language response

Security by Design:

  • No API keys required for queries — all Morph RPC, Explorer, and DEX quote endpoints are public
  • Bridge order management uses JWT authentication (obtained via local EIP-191 wallet signature, valid 24h)
  • Send commands (transfer, transfer-token, dex-send, altfee-send, bridge-make-order, bridge-submit-order, bridge-swap) only sign and broadcast; the agent must confirm with the user before executing
  • Private keys are used locally for signing only — never sent to any API
  • create-wallet is purely offline — no network call

Agent Use Cases

1. Portfolio Tracker

"What's my total balance on Morph?"

  • Query ETH balance + all token holdings in one go
  • For: DeFi users, fund managers

2. On-Chain Research Assistant

"Show me recent transactions for this address and what tokens they hold."

  • Address info + transaction history + token holdings combined
  • For: researchers, analysts

3. Trading Assistant

"Swap 1 ETH for USDT on Morph"

  • DEX quote (with --recipient) → show price and route → user confirms → dex-send (sign & broadcast)
  • Human-in-the-loop — the agent cannot sign without the user's private key
  • For: active traders wanting an AI assistant

4. Token Discovery

"What new tokens are on Morph? Is this token safe?"

  • Token list + token search for discovery
  • For: alpha hunters, community managers

Quick Start

Installation

git clone https://github.com/morph-l2/morph-skill.git
cd morph-skill
pip install requests eth_account

That's it — no API keys needed for queries. Bridge orders require JWT via bridge-login. Python 3.11+ required.

Examples

# Create a new wallet
python3 scripts/morph_api.py create-wallet

# Check ETH balance
python3 scripts/morph_api.py balance --address 0xYourAddress

# Check USDT0 balance (symbol resolved automatically)
python3 scripts/morph_api.py token-balance --address 0xYourAddress --token USDT0

# Address info from explorer
python3 scripts/morph_api.py address-info --address 0xYourAddress

# Search for a token
python3 scripts/morph_api.py token-search --query "USDC"

# DEX swap quote (1 ETH → USDT0)
python3 scripts/morph_api.py dex-quote --amount 1 --token-in ETH --token-out USDT0

# Send ETH
python3 scripts/morph_api.py transfer --to 0xRecipient --amount 0.01 --private-key 0xYourKey

# List fee tokens (alt-fee: pay gas with non-ETH tokens)
python3 scripts/morph_api.py altfee-tokens

# Estimate gas cost in USDT0 (fee token ID 5)
python3 scripts/morph_api.py altfee-estimate --id 5 --gas-limit 21000

Commands

Wallet (RPC)

Command Description
create-wallet Generate a new ETH key pair locally
balance Query native ETH balance
token-balance Query ERC20 token balance
transfer Send ETH to an address
transfer-token Send ERC20 tokens to an address
tx-receipt Query transaction receipt

Explorer (Blockscout)

Command Description
address-info Address summary (balance, tx count, type)
address-txs Transaction history for an address
address-tokens All token holdings for an address
tx-detail Full transaction details (decoded input, token transfers)
token-search Search tokens by name or symbol
contract-info Smart contract source code, ABI, verification status
token-transfers Recent token transfers by token or address
token-info Token details (supply, holders, transfers, market data)
token-list List top tracked tokens from the explorer (single page)

DEX (Morph Only)

Command Description
dex-quote Get a swap quote (with --recipient for calldata)
dex-send Sign and broadcast swap tx using calldata from dex-quote

Bridge (Cross-Chain, 6 Chains)

Command Description
bridge-chains List supported chains for cross-chain swap
bridge-tokens List available tokens (optionally filter by chain)
bridge-token-search Search tokens by symbol or address across chains
bridge-quote Get cross-chain or same-chain swap quote
bridge-balance Token balance + USD price on any supported chain
bridge-login Sign in with EIP-191 signature, get JWT (valid 24h)
bridge-make-order Create swap order, returns unsigned txs to sign
bridge-submit-order Submit signed transactions for a swap order
bridge-swap One-step cross-chain swap: create order, sign, and submit
bridge-order Query swap order status
bridge-history Query historical swap orders

Alt-Fee (Alternative Gas Payment)

Command Description
altfee-tokens List supported fee tokens from TokenRegistry
altfee-token-info Get fee token details (scale, feeRate, decimals)
altfee-estimate Estimate feeLimit for paying gas with alt token
altfee-send Send transaction paying gas with alt fee token (0x7f)

Run python3 scripts/morph_api.py <command> --help for detailed usage.


Compatible Platforms

Should Work (file system + Python + network access)

Platform Type How to Use
Claude Code CLI Agent Install as plugin via .claude-plugin/
Cursor IDE Agent Install as plugin via .cursor-plugin/
Windsurf IDE Agent Clone into project workspace
Cline VS Code Agent Clone into project workspace
OpenClaw Agent Platform Native skill support
Dify Workflow Platform Use as Code node or external API Tool
LangChain / CrewAI Frameworks Wrap morph_api.py as a Tool

Compatibility Rule

Any AI agent that can read files + run Python + access the internet should work with this skill.


For AI Agents

See SKILL.md for the unified agent reference, or use individual skill modules:

Skill Description
morph-wallet Wallet operations (create, balance, transfer)
morph-explorer On-chain data queries (address, tx, token info)
morph-dex DEX swap on Morph (quote + send)
morph-bridge Cross-chain swap across 6 chains (quote, order, JWT auth)
morph-altfee Alt-fee gas payment (0x7f tx type)

Security

  • Query endpoints are public — no API keys needed
  • Bridge order management uses JWT authentication (local EIP-191 signature, never sends private keys)
  • No eval() / exec() or dynamic code execution
  • Private keys are only used locally for transaction signing
  • Send commands require explicit user confirmation (human-in-the-loop)
  • No data collection, telemetry, or analytics
  • Dependencies: requests, eth_account (stdlib: json, argparse, decimal)
  • We recommend auditing the source yourself before use

License

MIT

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages