/gmx-io:gmx-liquidityfrom gmx-io
Queries GMX GM pools and GLV vaults via GmxApiSdk for pool discovery, APY, earnings, and wallet reads on Arbitrum, Avalanche, and MegaETH. Also handles GM/GLV deposits, withdrawals, and pool shifts through current contracts.
Ships in gmx-io. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Use GmxApiSdk from @gmx-io/sdk/v2 for pool, token, APY, performance and wallet reads. Validated against published @gmx-io/[email protected] on 2026-10-13, and moved to @gmx-io/[email protected] (the v2.2.1 contracts) on 2026-11-25.
Liquidity writes still require contracts. This release has no GM/GLV deposit, withdrawal or shift preparation methods. Its buildSameChainDepositTxn() and cross-chain funding methods fund a GMX Account, not a GM pool or GLV vault. Do not substitute them for liquidity provision or invent an sdk.liquidity module.
Install the tested versions with npm install --save-exact --ignore-scripts --legacy-peer-deps @gmx-io/[email protected] [email protected]. --legacy-peer-deps skips the unused react-native peer tree and its high-severity audit findings. Keep the generated lockfile and use npm ci --ignore-scripts --legacy-peer-deps for repeat installs. Review npm audit findings before enabling signing; pins do not guarantee safe dependencies. Upgrade deliberately after reviewing package changes. Through 2.9.1, use .cjs for plain Node scripts or compile TypeScript to CommonJS because native Node ESM encounters extensionless SDK imports. Recheck installed types when upgrading.
| Network | Chain ID | API host |
|---|---|---|
| Arbitrum | 42161 | https://arbitrum.gmxapi.io |
| Avalanche | 43114 | https://avalanche.gmxapi.io |
| MegaETH | 4326 | https://megaeth.gmxapi.io |
A deployed GlvRouter alone does not mean a chain has an active, depositable GLV vault.
// Save as pools.cjs and run: node pools.cjs
const { GmxApiSdk } = require("@gmx-io/sdk/v2");
const { formatUnits, getAddress } = require("viem");
async function main() {
const sdk = new GmxApiSdk({ chainId: 42161 });
const [markets, values, apy] = await Promise.all([
sdk.fetchMarkets(),
sdk.fetchMarketsValues(),
sdk.fetchApy({ period: "7d" }),
]);
const apyByMarket = new Map(Object.entries(apy.markets).map(([address, entry]) => [getAddress(address), entry]));
const valueByMarket = new Map(values.map((v) => [getAddress(v.marketTokenAddress), v]));
console.table(markets.filter((m) => m.isListed).map((m) => {
const address = getAddress(m.marketTokenAddress);
const poolValue = valueByMarket.get(address)?.poolValueMax;
const marketApy = apyByMarket.get(address)?.apy;
return {
symbol: m.symbol,
address,
apy7d: marketApy === undefined ? "unknown" : `${(marketApy * 100).toFixed(2)}%`,
poolValueUsd: poolValue === undefined ? "unknown" : Number(formatUnits(poolValue, 30)).toFixed(0),
};
}));
}
main().catch((error) => { console.error(error); process.exitCode = 1; });
fetchMarketsInfo() returns RawMarketInfo[] (about 0.7 MB on Arbitrum), not the v1 { marketsInfoData, tokensData } object; fetch it only for the selected pool's details and never dump it into context. Match records by marketTokenAddress with getAddress() or viem isAddressEqual, never by lowercasing.fetchMarketsConfig() supplies pool caps and configuration. fetchMarketsValues() supplies changing state, poolValueMax/poolValueMin (30-decimal USD) and updatedAt; fetchTokensData() supplies token prices and decimals. Check disabled markets, deposit caps, reserves and withdrawal availability before quoting.fetchApy({ period }) returns markets and glvs keyed by address, with apy, baseApy, and bonusApr as fractions (0.0117 = 1.17%). glvs can be empty although GLVs exist on-chain; a missing entry means unknown yield, not zero. Prefer 7d/30d: performance routes reject 1d, and total currently returns HTTP 500 for fetchApy() and fetchGmPoolYieldPnl() on Arbitrum; treat such errors as unknown data. Yield/performance is historical, not a guaranteed return.fetchGmPoolYieldPnl() aligns fee APY and trader PnL to the same pool/window. Preserve missing (null) values. Trader PnL is from the trader's perspective; do not present positive trader PnL as LP profit.fetchGmUserEarnings({ account }) returns lifetime/recent fee earnings as decimal strings. fetchWalletBalances({ address }) returns catalog balances; use ERC-20 balanceOf for a GM/GLV token absent from that response.GM tokens represent one market's liquidity. GLV tokens represent a vault holding several GM markets. A pool's index token need not be its long collateral token; derive both pool tokens from the market data. Single-sided deposits can incur imbalance fees/impact and do not imply a generic automatic 50/50 swap.
| User intent | Router | Request |
|---|---|---|
| Deposit pool tokens for GM | ExchangeRouter | createDeposit |
| Burn GM for underlying tokens | ExchangeRouter | createWithdrawal |
| Move GM between compatible markets | ExchangeRouter | createShift |
| Deposit raw tokens or constituent GM for GLV | GlvRouter | createGlvDeposit |
| Burn GLV for underlying tokens through a constituent market | GlvRouter | createGlvWithdrawal |
Before a write, read liquidity operations. It covers ABI imports, live GLV discovery, gas parameters, quoting, atomic funding and request creation, and completion tracking. Use contract addresses and getContract() from the installed SDK rather than embedding old routers in scripts.
Confirm the selected pool/vault, inputs, minimum outputs, execution fee and recipient against the user's authorized intent. For ERC-20 inputs, approve only the authorized amount to SyntheticsRouter, then wait for a successful approval receipt. Send request funding and creation together in one router multicall. Request creation and keeper execution are separate transactions; report success only after the matching execution event and refreshed balances.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
2 skills in this plugin
npx claudepluginhub gmx-io/gmx-ai --plugin gmx-ioOther plugins' skills for the same job