@arcadia-finance/mcp-server 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -0
- package/dist/abis/account.json +23 -0
- package/dist/abis/account_v4.json +23 -0
- package/dist/abis/index.js +0 -1
- package/dist/clients/api.js +10 -4
- package/dist/clients/chain.js +0 -1
- package/dist/config/addresses.js +0 -1
- package/dist/config/chains.js +0 -1
- package/dist/index.js +1 -2
- package/dist/tools/advanced/account-metadata.js +4 -31
- package/dist/tools/advanced/add-liquidity.js +41 -39
- package/dist/tools/advanced/close-position.js +34 -32
- package/dist/tools/advanced/format-response.js +0 -1
- package/dist/tools/advanced/position-actions.js +12 -10
- package/dist/tools/advanced/remove-liquidity.js +15 -13
- package/dist/tools/advanced/repay-with-collateral.js +14 -12
- package/dist/tools/advanced/swap.js +13 -11
- package/dist/tools/index.js +0 -1
- package/dist/tools/read/accounts.js +79 -46
- package/dist/tools/read/allowances.js +17 -37
- package/dist/tools/read/assets.js +16 -14
- package/dist/tools/read/balances.js +14 -34
- package/dist/tools/read/guides.js +7 -5
- package/dist/tools/read/points.js +5 -3
- package/dist/tools/read/pools.js +15 -19
- package/dist/tools/read/protocol.js +27 -22
- package/dist/tools/write/approve.js +23 -44
- package/dist/tools/write/borrow.js +14 -12
- package/dist/tools/write/configure-asset-manager.js +55 -65
- package/dist/tools/write/create-account.js +20 -18
- package/dist/tools/write/deposit.js +25 -32
- package/dist/tools/write/repay.js +15 -13
- package/dist/tools/write/set-asset-manager.js +15 -25
- package/dist/tools/write/sign-and-send.js +13 -10
- package/dist/tools/write/withdraw.js +25 -32
- package/dist/types/api.js +0 -1
- package/dist/utils/attribution.js +0 -1
- package/dist/utils/validation.js +0 -1
- package/package.json +7 -6
- /package/{dist/skills → skills}/clamm-liquidity/SKILL.md +0 -0
- /package/{dist/skills → skills}/clamm-liquidity/automation.md +0 -0
- /package/{dist/skills → skills}/clamm-liquidity/selection.md +0 -0
- /package/{dist/skills → skills}/clamm-liquidity/strategies.md +0 -0
package/README.md
CHANGED
|
@@ -1,9 +1,20 @@
|
|
|
1
1
|
# Arcadia Finance MCP Server
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/@arcadia-finance/mcp-server)
|
|
4
|
+
[](https://smithery.ai/server/@arcadia-finance/mcp-server)
|
|
5
|
+
[](LICENSE.md)
|
|
6
|
+
[](https://www.typescriptlang.org/)
|
|
7
|
+
[](https://modelcontextprotocol.io/)
|
|
8
|
+
|
|
3
9
|
MCP server for [Arcadia Finance](https://arcadia.finance), a platform to manage concentrated liquidity positions with built-in leverage, automated rebalancing, and yield optimization. Read protocol data and build unsigned transactions for LP management, borrowing, deposits, and more.
|
|
4
10
|
|
|
5
11
|
Designed for AI agents (Claude, Cursor, etc.) to interact with Arcadia onchain.
|
|
6
12
|
|
|
13
|
+
## Install
|
|
14
|
+
|
|
15
|
+
[](https://vscode.dev/redirect/mcp/install?name=arcadia-finance&config=%7B%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40arcadia-finance%2Fmcp-server%22%5D%7D)
|
|
16
|
+
[](https://cursor.com/en/install-mcp?name=arcadia-finance&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBhcmNhZGlhLWZpbmFuY2UvbWNwLXNlcnZlciJdfQ==)
|
|
17
|
+
|
|
7
18
|
## Tools
|
|
8
19
|
|
|
9
20
|
### Read Tools
|
|
@@ -132,6 +143,12 @@ yarn build
|
|
|
132
143
|
}
|
|
133
144
|
```
|
|
134
145
|
|
|
146
|
+
**Claude Code:**
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
claude mcp add arcadia-finance -- npx -y @arcadia-finance/mcp-server
|
|
150
|
+
```
|
|
151
|
+
|
|
135
152
|
**From source** (local development):
|
|
136
153
|
|
|
137
154
|
```json
|
package/dist/abis/account.json
CHANGED
|
@@ -653,6 +653,29 @@
|
|
|
653
653
|
"outputs": [],
|
|
654
654
|
"stateMutability": "nonpayable"
|
|
655
655
|
},
|
|
656
|
+
{
|
|
657
|
+
"type": "function",
|
|
658
|
+
"name": "setAssetManagers",
|
|
659
|
+
"inputs": [
|
|
660
|
+
{
|
|
661
|
+
"name": "assetManagers",
|
|
662
|
+
"type": "address[]",
|
|
663
|
+
"internalType": "address[]"
|
|
664
|
+
},
|
|
665
|
+
{
|
|
666
|
+
"name": "statuses",
|
|
667
|
+
"type": "bool[]",
|
|
668
|
+
"internalType": "bool[]"
|
|
669
|
+
},
|
|
670
|
+
{
|
|
671
|
+
"name": "datas",
|
|
672
|
+
"type": "bytes[]",
|
|
673
|
+
"internalType": "bytes[]"
|
|
674
|
+
}
|
|
675
|
+
],
|
|
676
|
+
"outputs": [],
|
|
677
|
+
"stateMutability": "nonpayable"
|
|
678
|
+
},
|
|
656
679
|
{
|
|
657
680
|
"type": "function",
|
|
658
681
|
"name": "setNumeraire",
|
|
@@ -663,6 +663,29 @@
|
|
|
663
663
|
"outputs": [],
|
|
664
664
|
"stateMutability": "nonpayable"
|
|
665
665
|
},
|
|
666
|
+
{
|
|
667
|
+
"type": "function",
|
|
668
|
+
"name": "setAssetManagers",
|
|
669
|
+
"inputs": [
|
|
670
|
+
{
|
|
671
|
+
"name": "assetManagers",
|
|
672
|
+
"type": "address[]",
|
|
673
|
+
"internalType": "address[]"
|
|
674
|
+
},
|
|
675
|
+
{
|
|
676
|
+
"name": "statuses",
|
|
677
|
+
"type": "bool[]",
|
|
678
|
+
"internalType": "bool[]"
|
|
679
|
+
},
|
|
680
|
+
{
|
|
681
|
+
"name": "datas",
|
|
682
|
+
"type": "bytes[]",
|
|
683
|
+
"internalType": "bytes[]"
|
|
684
|
+
}
|
|
685
|
+
],
|
|
686
|
+
"outputs": [],
|
|
687
|
+
"stateMutability": "nonpayable"
|
|
688
|
+
},
|
|
666
689
|
{
|
|
667
690
|
"type": "function",
|
|
668
691
|
"name": "setNumeraire",
|
package/dist/abis/index.js
CHANGED
|
@@ -23,4 +23,3 @@ export const stakedAeroAmAbi = load("staked_aero_am");
|
|
|
23
23
|
export const stakedSlipstreamAmAbi = load("staked_slipstream_am");
|
|
24
24
|
export const wrappedAeroAmAbi = load("wrapped_aero_am");
|
|
25
25
|
export const wrappedStakedSlipstreamAmAbi = load("wrapped_staked_slipstream_am");
|
|
26
|
-
//# sourceMappingURL=index.js.map
|
package/dist/clients/api.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import { dirname, join } from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
const pkg = JSON.parse(readFileSync(join(dirname(fileURLToPath(import.meta.url)), "..", "..", "package.json"), "utf-8"));
|
|
1
5
|
const DEFAULT_BASE_URL = "https://api.arcadia.finance";
|
|
2
6
|
const API_PREFIX = "/v1/api";
|
|
3
|
-
const DEFAULT_HEADERS = { "User-Agent":
|
|
7
|
+
const DEFAULT_HEADERS = { "User-Agent": `arcadia-mcp/${pkg.version}` };
|
|
4
8
|
export class ArcadiaApiClient {
|
|
5
9
|
baseUrl;
|
|
6
10
|
timeout;
|
|
@@ -116,8 +120,11 @@ export class ArcadiaApiClient {
|
|
|
116
120
|
async getPools(chainId) {
|
|
117
121
|
return this.get("/pools", { chain_id: chainId });
|
|
118
122
|
}
|
|
119
|
-
async getPoolsData(chainId) {
|
|
120
|
-
|
|
123
|
+
async getPoolsData(chainId, poolAddress) {
|
|
124
|
+
const params = { chain_id: chainId };
|
|
125
|
+
if (poolAddress)
|
|
126
|
+
params.pool_address = poolAddress;
|
|
127
|
+
return this.get("/pools_data", params);
|
|
121
128
|
}
|
|
122
129
|
async getPoolApyHistory(chainId, poolAddress, days = 14) {
|
|
123
130
|
return this.get("/pools/historic_apy", {
|
|
@@ -186,4 +193,3 @@ export class ArcadiaApiClient {
|
|
|
186
193
|
});
|
|
187
194
|
}
|
|
188
195
|
}
|
|
189
|
-
//# sourceMappingURL=api.js.map
|
package/dist/clients/chain.js
CHANGED
package/dist/config/addresses.js
CHANGED
package/dist/config/chains.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -19,11 +19,10 @@ const pkg = require("../package.json");
|
|
|
19
19
|
const server = new McpServer({
|
|
20
20
|
name: "arcadia-finance",
|
|
21
21
|
version: pkg.version,
|
|
22
|
-
description: "Arcadia Finance
|
|
22
|
+
description: "Arcadia Finance. Manage concentrated liquidity positions with leverage, automated rebalancing, and yield optimization on Base, Optimism, and Unichain.",
|
|
23
23
|
});
|
|
24
24
|
const apiClient = new ArcadiaApiClient();
|
|
25
25
|
const chainConfigs = getChainConfigs();
|
|
26
26
|
registerAllTools(server, apiClient, chainConfigs);
|
|
27
27
|
const transport = new StdioServerTransport();
|
|
28
28
|
await server.connect(transport);
|
|
29
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1,39 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
{
|
|
3
|
-
type: "function",
|
|
4
|
-
name: "owner",
|
|
5
|
-
inputs: [],
|
|
6
|
-
outputs: [{ type: "address" }],
|
|
7
|
-
stateMutability: "view",
|
|
8
|
-
},
|
|
9
|
-
];
|
|
10
|
-
const CREDITOR_ABI = [
|
|
11
|
-
{
|
|
12
|
-
type: "function",
|
|
13
|
-
name: "creditor",
|
|
14
|
-
inputs: [],
|
|
15
|
-
outputs: [{ type: "address" }],
|
|
16
|
-
stateMutability: "view",
|
|
17
|
-
},
|
|
18
|
-
];
|
|
19
|
-
const NUMERAIRE_ABI = [
|
|
20
|
-
{
|
|
21
|
-
type: "function",
|
|
22
|
-
name: "numeraire",
|
|
23
|
-
inputs: [],
|
|
24
|
-
outputs: [{ type: "address" }],
|
|
25
|
-
stateMutability: "view",
|
|
26
|
-
},
|
|
27
|
-
];
|
|
1
|
+
import { accountAbi } from "../../abis/index.js";
|
|
28
2
|
const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
29
3
|
// Reads owner, creditor, numeraire on-chain via multicall.
|
|
30
4
|
// Used as fallback when getAccountOverview fails.
|
|
31
5
|
export async function readAccountMetadata(client, accountAddress) {
|
|
32
6
|
const results = await client.multicall({
|
|
33
7
|
contracts: [
|
|
34
|
-
{ address: accountAddress, abi:
|
|
35
|
-
{ address: accountAddress, abi:
|
|
36
|
-
{ address: accountAddress, abi:
|
|
8
|
+
{ address: accountAddress, abi: accountAbi, functionName: "owner" },
|
|
9
|
+
{ address: accountAddress, abi: accountAbi, functionName: "creditor" },
|
|
10
|
+
{ address: accountAddress, abi: accountAbi, functionName: "numeraire" },
|
|
37
11
|
],
|
|
38
12
|
allowFailure: true,
|
|
39
13
|
});
|
|
@@ -43,4 +17,3 @@ export async function readAccountMetadata(client, accountAddress) {
|
|
|
43
17
|
numeraire: results[2].status === "success" ? results[2].result : ZERO_ADDRESS,
|
|
44
18
|
};
|
|
45
19
|
}
|
|
46
|
-
//# sourceMappingURL=account-metadata.js.map
|
|
@@ -3,48 +3,51 @@ import { getPublicClient } from "../../clients/chain.js";
|
|
|
3
3
|
import { readAccountMetadata } from "./account-metadata.js";
|
|
4
4
|
import { formatAdvancedResponse } from "./format-response.js";
|
|
5
5
|
export function registerAddLiquidityTool(server, api, chains) {
|
|
6
|
-
server.
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
.
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
.number()
|
|
6
|
+
server.registerTool("build_add_liquidity_tx", {
|
|
7
|
+
description: "Multi-step flash-action: atomically combines [deposit from wallet] + [use account collateral] + [swap to optimal ratio] + [mint LP] + [borrow if leveraged] in ONE transaction. Do NOT call build_deposit_tx separately. Capital sources: wallet tokens (deposits array), existing account collateral (use_account_assets=true), or both. Check allowances first (get_allowance), then approve if needed (build_approve_tx). Supports depositing multiple tokens and minting multiple LP positions in one tx. Works with both margin accounts (can leverage) and spot accounts (no leverage). For workflows, call get_guide('strategies'). The returned calldata is time-sensitive — sign and broadcast within 30 seconds. If the transaction reverts due to price movement, rebuild and sign again immediately (retry at least once before giving up). Response includes tenderly_sim_url and tenderly_sim_status for pre-broadcast validation.",
|
|
8
|
+
inputSchema: {
|
|
9
|
+
account_address: z.string().describe("Arcadia account address"),
|
|
10
|
+
wallet_address: z.string().describe("Wallet address of the account owner"),
|
|
11
|
+
positions: z
|
|
12
|
+
.array(z.object({
|
|
13
|
+
strategy_id: z.number().describe("From get_strategies tool"),
|
|
14
|
+
tick_lower: z
|
|
15
|
+
.number()
|
|
16
|
+
.optional()
|
|
17
|
+
.describe("Lower tick for concentrated range. Omit for full range."),
|
|
18
|
+
tick_upper: z
|
|
19
|
+
.number()
|
|
20
|
+
.optional()
|
|
21
|
+
.describe("Upper tick for concentrated range. Omit for full range."),
|
|
22
|
+
}))
|
|
23
|
+
.describe("LP positions to mint. For a single position, pass one entry."),
|
|
24
|
+
deposits: z
|
|
25
|
+
.array(z.object({
|
|
26
|
+
asset: z.string().describe("Token address to deposit from wallet"),
|
|
27
|
+
amount: z.string().describe("Amount in raw units"),
|
|
28
|
+
decimals: z
|
|
29
|
+
.number()
|
|
30
|
+
.optional()
|
|
31
|
+
.describe("Token decimals (e.g. 6 for USDC, 18 for WETH). Default 18."),
|
|
32
|
+
}))
|
|
14
33
|
.optional()
|
|
15
|
-
.describe("
|
|
16
|
-
|
|
17
|
-
.
|
|
34
|
+
.describe("Wallet tokens to deposit. Approve each token first (build_approve_tx). Omit to use only account collateral."),
|
|
35
|
+
use_account_assets: z
|
|
36
|
+
.boolean()
|
|
18
37
|
.optional()
|
|
19
|
-
.
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
deposits: z
|
|
23
|
-
.array(z.object({
|
|
24
|
-
asset: z.string().describe("Token address to deposit from wallet"),
|
|
25
|
-
amount: z.string().describe("Amount in raw units"),
|
|
26
|
-
decimals: z
|
|
38
|
+
.default(false)
|
|
39
|
+
.describe("If true, use ALL existing account collateral for LP minting. Fetched automatically."),
|
|
40
|
+
leverage: z
|
|
27
41
|
.number()
|
|
28
42
|
.optional()
|
|
29
|
-
.
|
|
30
|
-
|
|
31
|
-
.optional()
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
.describe("If true, use ALL existing account collateral for LP minting. Fetched automatically."),
|
|
38
|
-
leverage: z
|
|
39
|
-
.number()
|
|
40
|
-
.optional()
|
|
41
|
-
.default(0)
|
|
42
|
-
.describe("0 = no borrow, 2 = 2x leverage. Margin accounts only."),
|
|
43
|
-
slippage: z.number().optional().default(100).describe("Basis points, 100 = 1%"),
|
|
44
|
-
chain_id: z
|
|
45
|
-
.number()
|
|
46
|
-
.default(8453)
|
|
47
|
-
.describe("Chain ID: 8453 (Base), 10 (Optimism), or 130 (Unichain)"),
|
|
43
|
+
.default(0)
|
|
44
|
+
.describe("0 = no borrow, 2 = 2x leverage. Margin accounts only."),
|
|
45
|
+
slippage: z.number().optional().default(100).describe("Basis points, 100 = 1%"),
|
|
46
|
+
chain_id: z
|
|
47
|
+
.number()
|
|
48
|
+
.default(8453)
|
|
49
|
+
.describe("Chain ID: 8453 (Base), 10 (Optimism), or 130 (Unichain)"),
|
|
50
|
+
},
|
|
48
51
|
}, async ({ account_address, wallet_address, positions, deposits: walletDeposits, use_account_assets, leverage, slippage, chain_id, }) => {
|
|
49
52
|
try {
|
|
50
53
|
const hasDeposits = walletDeposits && walletDeposits.length > 0;
|
|
@@ -307,4 +310,3 @@ export function registerAddLiquidityTool(server, api, chains) {
|
|
|
307
310
|
}
|
|
308
311
|
});
|
|
309
312
|
}
|
|
310
|
-
//# sourceMappingURL=add-liquidity.js.map
|
|
@@ -3,7 +3,8 @@ import { getPublicClient } from "../../clients/chain.js";
|
|
|
3
3
|
import { readAccountMetadata } from "./account-metadata.js";
|
|
4
4
|
import { formatAdvancedResponse } from "./format-response.js";
|
|
5
5
|
export function registerClosePositionTool(server, api, chains) {
|
|
6
|
-
server.
|
|
6
|
+
server.registerTool("build_close_position_tx", {
|
|
7
|
+
description: `Atomic flash-action that closes an Arcadia account position in ONE transaction. Combines up to 3 steps atomically: [burn LP position] + [swap all tokens to a single target asset] + [repay debt]. Tokens remain in the account after closing — use build_withdraw_tx to send them to your wallet.
|
|
7
8
|
|
|
8
9
|
ALWAYS try this tool first when closing/exiting a position. Only fall back to individual tools (build_remove_liquidity_tx, build_swap_tx, build_repay_with_collateral_tx, build_withdraw_tx) if this tool fails.
|
|
9
10
|
|
|
@@ -11,37 +12,39 @@ Supports two modes:
|
|
|
11
12
|
- close_lp_only=true: Burns LP and leaves underlying tokens in the account. Use as step 1 if the full close fails, then call again with close_lp_only=false to swap+repay the remaining tokens.
|
|
12
13
|
- close_lp_only=false (default): Full atomic close — burns LP, swaps everything to receive_assets, repays debt. Remaining tokens stay in the account. Follow up with build_withdraw_tx to send to wallet. Supports multiple receive assets with custom distribution.
|
|
13
14
|
|
|
14
|
-
The returned calldata is time-sensitive — sign and broadcast within 30 seconds. If the transaction reverts due to price movement, rebuild and sign again immediately (retry at least once before giving up). Response includes tenderly_sim_url and tenderly_sim_status for pre-broadcast validation.`,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
15
|
+
The returned calldata is time-sensitive — sign and broadcast within 30 seconds. If the transaction reverts due to price movement, rebuild and sign again immediately (retry at least once before giving up). Response includes tenderly_sim_url and tenderly_sim_status for pre-broadcast validation.`,
|
|
16
|
+
inputSchema: {
|
|
17
|
+
account_address: z.string().describe("Arcadia account address"),
|
|
18
|
+
assets: z
|
|
19
|
+
.array(z.object({
|
|
20
|
+
asset_address: z.string().describe("Token or position manager address"),
|
|
21
|
+
asset_id: z.number().describe("NFT token ID (0 for ERC20 tokens)"),
|
|
22
|
+
amount: z.string().describe("Amount to sell (use '1' for NFT positions)"),
|
|
23
|
+
decimals: z.number().describe("Token decimals (use 1 for NFT positions)"),
|
|
24
|
+
}))
|
|
25
|
+
.describe("Assets to close/sell from the account. For LP positions: asset_address = position manager, asset_id = NFT ID, amount = '1', decimals = 1. For ERC20 tokens: asset_id = 0, amount = full balance, decimals = token decimals. Get these from get_account_info."),
|
|
26
|
+
receive_assets: z
|
|
27
|
+
.array(z.object({
|
|
28
|
+
asset_address: z.string().describe("Target token address (e.g. USDC, WETH)"),
|
|
29
|
+
decimals: z.number().describe("Token decimals of the target asset"),
|
|
30
|
+
distribution: z
|
|
31
|
+
.number()
|
|
32
|
+
.optional()
|
|
33
|
+
.describe("Fraction of proceeds (0-1). Defaults to equal split across all receive assets."),
|
|
34
|
+
}))
|
|
35
|
+
.optional()
|
|
36
|
+
.describe("Target assets to receive after closing. For a single target, pass one entry. Required when close_lp_only=false. Omit for close_lp_only=true."),
|
|
37
|
+
close_lp_only: z
|
|
38
|
+
.boolean()
|
|
30
39
|
.optional()
|
|
31
|
-
.
|
|
32
|
-
|
|
33
|
-
.optional()
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
.describe("true = only burn LP positions, leave underlying tokens in account. false = full close (burn + swap + repay)."),
|
|
40
|
-
slippage: z.number().optional().default(100).describe("Basis points, 100 = 1%"),
|
|
41
|
-
chain_id: z
|
|
42
|
-
.number()
|
|
43
|
-
.default(8453)
|
|
44
|
-
.describe("Chain ID: 8453 (Base), 10 (Optimism), or 130 (Unichain)"),
|
|
40
|
+
.default(false)
|
|
41
|
+
.describe("true = only burn LP positions, leave underlying tokens in account. false = full close (burn + swap + repay)."),
|
|
42
|
+
slippage: z.number().optional().default(100).describe("Basis points, 100 = 1%"),
|
|
43
|
+
chain_id: z
|
|
44
|
+
.number()
|
|
45
|
+
.default(8453)
|
|
46
|
+
.describe("Chain ID: 8453 (Base), 10 (Optimism), or 130 (Unichain)"),
|
|
47
|
+
},
|
|
45
48
|
}, async ({ account_address, assets, receive_assets, close_lp_only, slippage, chain_id }) => {
|
|
46
49
|
try {
|
|
47
50
|
const actionType = close_lp_only ? "account.closing-lp" : "account.closing-position";
|
|
@@ -205,4 +208,3 @@ The returned calldata is time-sensitive — sign and broadcast within 30 seconds
|
|
|
205
208
|
}
|
|
206
209
|
});
|
|
207
210
|
}
|
|
208
|
-
//# sourceMappingURL=close-position.js.map
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { formatAdvancedResponse } from "./format-response.js";
|
|
3
3
|
export function registerPositionActionsTool(server, api) {
|
|
4
|
-
server.
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
.number()
|
|
11
|
-
|
|
12
|
-
|
|
4
|
+
server.registerTool("build_position_action_tx", {
|
|
5
|
+
description: "Flash-action: stake, unstake, or claim rewards for an LP position in one atomic transaction. The stake/unstake direction is auto-detected from asset_address: pass the non-staked position manager to stake, or the staked position manager to unstake. The returned calldata is time-sensitive — sign and broadcast within 30 seconds. If the transaction reverts due to price movement, rebuild and sign again immediately (retry at least once before giving up).",
|
|
6
|
+
inputSchema: {
|
|
7
|
+
account_address: z.string().describe("Arcadia account address"),
|
|
8
|
+
action: z.enum(["stake", "unstake", "claim"]).describe("Action to perform"),
|
|
9
|
+
asset_address: z.string().describe("Position manager contract address"),
|
|
10
|
+
asset_id: z.number().describe("NFT token ID of the LP position"),
|
|
11
|
+
chain_id: z
|
|
12
|
+
.number()
|
|
13
|
+
.default(8453)
|
|
14
|
+
.describe("Chain ID: 8453 (Base), 10 (Optimism), or 130 (Unichain)"),
|
|
15
|
+
},
|
|
13
16
|
}, async ({ account_address, action, asset_address, asset_id, chain_id }) => {
|
|
14
17
|
try {
|
|
15
18
|
if (action === "claim") {
|
|
@@ -92,4 +95,3 @@ export function registerPositionActionsTool(server, api) {
|
|
|
92
95
|
}
|
|
93
96
|
});
|
|
94
97
|
}
|
|
95
|
-
//# sourceMappingURL=position-actions.js.map
|
|
@@ -1,21 +1,24 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { formatAdvancedResponse } from "./format-response.js";
|
|
3
3
|
export function registerRemoveLiquidityTool(server, api) {
|
|
4
|
-
server.
|
|
4
|
+
server.registerTool("build_remove_liquidity_tx", {
|
|
5
|
+
description: `Flash-action: PARTIALLY decreases liquidity from an LP position. The position remains open with reduced liquidity; underlying tokens stay in the account.
|
|
5
6
|
|
|
6
7
|
For FULL position exit (burn LP + swap + repay + withdraw), use build_close_position_tx instead — it batches everything into one atomic transaction.
|
|
7
8
|
|
|
8
|
-
The returned calldata is time-sensitive — sign and broadcast within 30 seconds. If the transaction reverts due to price movement, rebuild and sign again immediately (retry at least once before giving up). Response includes tenderly_sim_url and tenderly_sim_status for pre-broadcast validation.`,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
9
|
+
The returned calldata is time-sensitive — sign and broadcast within 30 seconds. If the transaction reverts due to price movement, rebuild and sign again immediately (retry at least once before giving up). Response includes tenderly_sim_url and tenderly_sim_status for pre-broadcast validation.`,
|
|
10
|
+
inputSchema: {
|
|
11
|
+
account_address: z.string().describe("Arcadia account address"),
|
|
12
|
+
asset_address: z.string().describe("Position manager contract"),
|
|
13
|
+
asset_id: z.number().describe("NFT token ID"),
|
|
14
|
+
adjustment: z
|
|
15
|
+
.string()
|
|
16
|
+
.describe("Liquidity amount to remove (raw uint128 value as string). Must be less than total liquidity — for full removal use build_close_position_tx."),
|
|
17
|
+
chain_id: z
|
|
18
|
+
.number()
|
|
19
|
+
.default(8453)
|
|
20
|
+
.describe("Chain ID: 8453 (Base), 10 (Optimism), or 130 (Unichain)"),
|
|
21
|
+
},
|
|
19
22
|
}, async ({ account_address, asset_address, asset_id, adjustment, chain_id }) => {
|
|
20
23
|
try {
|
|
21
24
|
const result = await api.getDecreaseLiquidityCalldata({
|
|
@@ -65,4 +68,3 @@ The returned calldata is time-sensitive — sign and broadcast within 30 seconds
|
|
|
65
68
|
}
|
|
66
69
|
});
|
|
67
70
|
}
|
|
68
|
-
//# sourceMappingURL=remove-liquidity.js.map
|
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { formatAdvancedResponse } from "./format-response.js";
|
|
3
3
|
export function registerRepayWithCollateralTool(server, api) {
|
|
4
|
-
server.
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
.number()
|
|
13
|
-
|
|
14
|
-
|
|
4
|
+
server.registerTool("build_repay_with_collateral_tx", {
|
|
5
|
+
description: "Multi-step flash-action: swaps account collateral to debt token and repays in one atomic transaction. To repay from wallet instead, use build_repay_tx. NOTE: If you are closing a position (remove LP + swap + repay + withdraw), prefer build_close_position_tx which batches everything atomically. Only use this tool for standalone repayment while keeping the position active. The returned calldata is time-sensitive — sign and broadcast within 30 seconds. If the transaction reverts due to price movement, rebuild and sign again immediately (retry at least once before giving up). Response includes tenderly_sim_url and tenderly_sim_status for pre-broadcast validation.",
|
|
6
|
+
inputSchema: {
|
|
7
|
+
account_address: z.string().describe("Arcadia account address"),
|
|
8
|
+
amount_in: z.string().describe("Collateral amount to sell"),
|
|
9
|
+
asset_from: z.string().describe("Collateral token to sell"),
|
|
10
|
+
numeraire: z.string().describe("Debt token address"),
|
|
11
|
+
creditor: z.string().describe("Lending pool address"),
|
|
12
|
+
slippage: z.number().optional().default(100).describe("Basis points, 100 = 1%"),
|
|
13
|
+
chain_id: z
|
|
14
|
+
.number()
|
|
15
|
+
.default(8453)
|
|
16
|
+
.describe("Chain ID: 8453 (Base), 10 (Optimism), or 130 (Unichain)"),
|
|
17
|
+
},
|
|
15
18
|
}, async ({ account_address, amount_in, asset_from, numeraire, creditor, slippage, chain_id }) => {
|
|
16
19
|
try {
|
|
17
20
|
const result = await api.getRepayCalldata({
|
|
@@ -63,4 +66,3 @@ export function registerRepayWithCollateralTool(server, api) {
|
|
|
63
66
|
}
|
|
64
67
|
});
|
|
65
68
|
}
|
|
66
|
-
//# sourceMappingURL=repay-with-collateral.js.map
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { formatAdvancedResponse } from "./format-response.js";
|
|
3
3
|
export function registerSwapTool(server, api) {
|
|
4
|
-
server.
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
.number()
|
|
12
|
-
|
|
13
|
-
|
|
4
|
+
server.registerTool("build_swap_tx", {
|
|
5
|
+
description: "Flash-action: swaps assets within an Arcadia account in one atomic transaction. The backend finds the optimal swap route. NOTE: If you are closing a position (swap + repay + withdraw), prefer build_close_position_tx which batches everything atomically. Only use this tool for standalone swaps within an active position. The returned calldata is time-sensitive — sign and broadcast within 30 seconds. If the transaction reverts due to price movement, rebuild and sign again immediately (retry at least once before giving up). Response includes tenderly_sim_url and tenderly_sim_status for pre-broadcast validation.",
|
|
6
|
+
inputSchema: {
|
|
7
|
+
account_address: z.string().describe("Arcadia account address"),
|
|
8
|
+
asset_from: z.string().describe("Token address to swap from"),
|
|
9
|
+
asset_to: z.string().describe("Token address to swap to"),
|
|
10
|
+
amount_in: z.string().describe("Raw units"),
|
|
11
|
+
slippage: z.number().optional().default(100).describe("Basis points, 100 = 1%"),
|
|
12
|
+
chain_id: z
|
|
13
|
+
.number()
|
|
14
|
+
.default(8453)
|
|
15
|
+
.describe("Chain ID: 8453 (Base), 10 (Optimism), or 130 (Unichain)"),
|
|
16
|
+
},
|
|
14
17
|
}, async ({ account_address, asset_from, asset_to, amount_in, slippage, chain_id }) => {
|
|
15
18
|
try {
|
|
16
19
|
const result = await api.getSwapCalldata({
|
|
@@ -61,4 +64,3 @@ export function registerSwapTool(server, api) {
|
|
|
61
64
|
}
|
|
62
65
|
});
|
|
63
66
|
}
|
|
64
|
-
//# sourceMappingURL=swap.js.map
|
package/dist/tools/index.js
CHANGED