FX SDK Agent Skill for Openclaw

A specialized skill for building AI agent integrations with the FX Protocol TypeScript SDK to manage leverage positions, cross-chain bridging, and yield-bearing fxSAVE assets.

huwangtao123
v1.0.1
Mar 27, 2026
0
693
0

Install & Download

1. ClawHub CLI

The fastest way to install a skill directly from the registry.

npx clawhub@latest install fx-sdk-agent

2. Manual Installation

Copy the skill folder to one of these locations

Global
~/.openclaw/skills/
Workspace
<project>/skills/

Priority: Workspace > Local > Bundled

3. Prompt Installation

Copy this prompt to OpenClaw to install it automatically.

Help me install fx-sdk-agent using Clawhub. If Clawhub is not installed, install it first (npm i -g clawhub).

Prefer to download?

Get the raw skill files in a ZIP archive.

What is FX SDK Agent Skill?

The FX SDK Agent Skill is designed to empower developers and AI agents to interact seamlessly with the FX Protocol. By leveraging the @aladdindao/fx-sdk, this skill enables automated querying of debt and collateral positions, execution of complex leverage operations, and management of fxSAVE assets across Ethereum and Base networks. It serves as a technical bridge for Openclaw Skills users who need to automate decentralized finance workflows with high precision.

This skill ensures that AI agents can handle on-chain transactions safely by following strict sequential execution patterns and block-wait confirmation logic. Whether you are building a trading bot or a portfolio management tool, this Openclaw Skills resource provides the canonical imports, method maps, and error-handling strategies required for robust DeFi automation.

FX SDK Agent Skill Use Cases

  • Automating leverage adjustments for ETH or BTC positions based on market volatility.
  • Implementing cross-chain token bridging between Ethereum and Base using LayerZero V2.
  • Managing fxSAVE deposits, withdrawals, and yield claims within an autonomous agent framework.
  • Generating runnable TypeScript scripts for complex multi-step DeFi transactions like increasePosition or repayAndWithdraw.
  • Troubleshooting SDK parameter validation and interpreting on-chain state lag during agent operations.

How FX SDK Agent Skill Works

  1. Intent Analysis: The skill identifies if the request is a read-only query (e.g., getting positions) or a state-changing transaction (e.g., adjusting leverage).
  2. Input Collection: It gathers essential parameters such as market type (ETH/BTC), positionId, token addresses, and bigInt amounts in wei-like units.
  3. SDK Initialization: A singleton instance of the FxSdk is created, ensuring consistent RPC connections across the workflow.
  4. Plan Generation: The skill calls the relevant SDK method (like increasePosition) to generate a transaction plan or bridge quote.
  5. Sequential Execution: It produces a transaction loop that respects nonce order, ensuring each transaction is confirmed before the next is sent.
  6. State Validation: After execution, the skill implements a one-block wait period before re-querying balances to ensure the on-chain state has synchronized.

FX SDK Agent Skill Setup

To integrate this skill into your project, install the core SDK and initialize it within your agent logic. Use the following setup for Openclaw Skills development:

npm install @aladdindao/fx-sdk
import { FxSdk, tokens } from '@aladdindao/fx-sdk';

// Initialize for Ethereum Mainnet
const sdk = new FxSdk({ 
  rpcUrl: 'YOUR_RPC_URL', 
  chainId: 1 
});

FX SDK Agent Skill Data Schema & Taxonomy

The skill organizes data primarily through the PositionInfo interface and structured transaction arrays. Below is the metadata taxonomy for position queries:

Property Type Description
positionId number Unique identifier for the debt position
rawColls bigint Raw collateral amount in wei
rawDebts bigint Raw debt amount in wei
currentLeverage number The calculated leverage ratio
rawCollsToken string The address of the collateral token

For fxSAVE operations, the skill tracks totalSupplyWei, cooldownPeriodSeconds, and isCooldownComplete to manage redemption lifecycles.

FX SDK Agent Skill Advanced Features

  • Multi-Chain Bridging: Built-in support for LayerZero V2 OFT bridge operations between Base (8453) and Ethereum (1).
  • Dry-Run Mode: Supports planOnly execution to return SDK routes and fee quotes without committing gas.
  • Sequential Transaction Pipeline: Automatically handles the approve and deposit flow for fxSAVE, ensuring valid dependency chains.
  • Intelligent Slippage Protection: Enforces strict validation for slippage parameters to prevent front-running and failed trades.
  • Agent Adapter Interop: Specifically designed to parse agent-tools.json payloads and convert string-based amounts into safe bigint types.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0

Featured*