Engineering
fx-sdk-agent avatar

fx-sdk-agent

TypeScript SDK agent for FX Protocol: manage leveraged positions, perform cross-chain bridges between Base and Ethereum, and interact with fxSAVE yield-bearing stablecoin features.

Introduction

The fx-sdk-agent skill enables AI assistants to seamlessly integrate with the FX Protocol, a decentralized on-chain trading platform. This agent provides a comprehensive toolkit for developers and automated systems to manage complex DeFi workflows, ranging from leveraged position lifecycle management on Ethereum and Base to cross-chain liquidity transfers and yield optimization via fxSAVE. Users can leverage this skill to generate transaction execution code, troubleshoot SDK parameters, and validate trading workflows directly from their development environment.

  • Perform read-only queries for market data, including getPositions, getFxSaveConfig, getFxSaveBalance, and getFxSaveClaimable to monitor portfolio status.

  • Execute transaction-producing operations such as increasePosition, reducePosition, and adjustPositionLeverage to manage trading exposure.

  • Handle bridge operations between Ethereum Mainnet and Base using LayerZero V2 protocols with automated quote generation and transaction construction.

  • Manage fxSAVE operations including deposit, withdraw, and claim, with automatic handling of cooldowns and instant redemption logic.

  • Support for depositAndMint and repayAndWithdraw operations specific to long pools in the FX Protocol.

  • Ensure all monetary inputs are provided as BigInt in wei-like units; strings from external tool payloads must be converted prior to SDK invocation.

  • Adhere to strict slippage requirements (0 < slippage < 100) and ensure tokens match market-specific constraints (e.g., ETH, stETH, weth, wstETH, usdc, fxUSD).

  • Follow a sequential transaction execution pattern: utilize SDK-provided transaction arrays, maintain nonce ordering, and wait for receipt confirmation before triggering subsequent actions.

  • Monitor on-chain state lags by implementing a one-block delay after transaction confirmation before re-querying balances or position states.

  • Utilize specific token addresses provided by the SDK constants for Ethereum and Base to ensure compatibility with core protocol contracts.

  • For bridging operations, verify source and destination chain IDs (1 for Ethereum, 8453 for Base) and confirm that the user has performed necessary token approvals before execution.

Repository Stats

Stars
1
Forks
2
Open Issues
3
Language
TypeScript
Default Branch
main
Sync Status
Idle
Last Synced
May 3, 2026, 11:06 PM
View on GitHub