@arcadia-finance/mcp-server 0.5.2 → 0.6.0
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 +47 -42
- package/dist/clients/api.js +52 -5
- package/dist/clients/chain.js +1 -1
- package/dist/config/addresses.js +16 -3
- package/dist/index.js +36 -134
- package/dist/prompts/workflows.js +54 -18
- package/dist/resources/guides.js +1 -1
- package/dist/tools/aero.js +157 -0
- package/dist/tools/dev/send.js +4 -4
- package/dist/tools/index.js +6 -0
- package/dist/tools/output-schemas.js +103 -29
- package/dist/tools/read/account.js +13 -13
- package/dist/tools/read/aero-upgrade.js +53 -0
- package/dist/tools/read/asset-managers.js +9 -9
- package/dist/tools/read/assets.js +7 -7
- package/dist/tools/read/guides.js +4 -4
- package/dist/tools/read/points.js +4 -4
- package/dist/tools/read/pools.js +8 -8
- package/dist/tools/read/strategy.js +12 -12
- package/dist/tools/read/wallet.js +15 -15
- package/dist/tools/write/account/add-liquidity.js +9 -9
- package/dist/tools/write/account/aero-upgrade.js +124 -0
- package/dist/tools/write/account/borrow.js +5 -5
- package/dist/tools/write/account/close.js +8 -8
- package/dist/tools/write/account/create.js +3 -3
- package/dist/tools/write/account/deleverage.js +4 -4
- package/dist/tools/write/account/deposit.js +4 -4
- package/dist/tools/write/account/format-response.js +1 -1
- package/dist/tools/write/account/remove-liquidity.js +6 -6
- package/dist/tools/write/account/repay.js +4 -4
- package/dist/tools/write/account/stake.js +5 -5
- package/dist/tools/write/account/swap.js +4 -4
- package/dist/tools/write/account/withdraw.js +5 -5
- package/dist/tools/write/asset-managers/automations.js +14 -14
- package/dist/tools/write/asset-managers/intents.js +10 -7
- package/dist/tools/write/pool/deposit.js +5 -5
- package/dist/tools/write/pool/redeem.js +4 -4
- package/dist/tools/write/wallet/approve.js +4 -4
- package/dist/tools/write/wallet/upgrade-velo.js +76 -0
- package/dist/utils/analytics.js +68 -0
- package/dist/utils/http-config.js +4 -4
- package/llms-full.txt +83 -46
- package/llms.txt +47 -44
- package/package.json +8 -4
- package/server.json +4 -4
- package/skills/clamm-liquidity/SKILL.md +100 -82
- package/skills/clamm-liquidity/automation.md +14 -14
- package/skills/clamm-liquidity/selection.md +13 -13
- package/skills/clamm-liquidity/strategies.md +135 -53
- package/skills/openclaw/SKILL.md +3 -3
- package/skills/openclaw/arcadia.sh +24 -45
- package/skills/openclaw/contracts.md +11 -10
- package/dist/utils/tool-naming.js +0 -91
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { validateAddress } from "../../../utils/validation.js";
|
|
3
|
+
import { aeroErrorResult, formatUpgradePlan, simulationReverted, validateAeroChain, } from "../../aero.js";
|
|
4
|
+
import { AeroUpgradeOutput } from "../../output-schemas.js";
|
|
5
|
+
const BATCH_MAX_ACCOUNTS = 10;
|
|
6
|
+
const choiceSchema = z.object({
|
|
7
|
+
position_manager: z.string().describe("The position's source.position_manager"),
|
|
8
|
+
position_id: z.number().int().describe("The position's source.position_id"),
|
|
9
|
+
pool: z.string().describe("The chosen option's pool"),
|
|
10
|
+
});
|
|
11
|
+
function choiceStrings(choices) {
|
|
12
|
+
if (!choices || choices.length === 0)
|
|
13
|
+
return undefined;
|
|
14
|
+
return choices.map((c) => `${validateAddress(c.position_manager, "choices[].position_manager")}:${c.position_id}:${validateAddress(c.pool, "choices[].pool")}`);
|
|
15
|
+
}
|
|
16
|
+
export function registerAeroUpgradeTool(server, api) {
|
|
17
|
+
server.registerTool("write_account_aero_upgrade", {
|
|
18
|
+
annotations: {
|
|
19
|
+
title: "Build Aero Upgrade Transaction",
|
|
20
|
+
readOnlyHint: false,
|
|
21
|
+
destructiveHint: false,
|
|
22
|
+
idempotentHint: true,
|
|
23
|
+
openWorldHint: true,
|
|
24
|
+
},
|
|
25
|
+
outputSchema: AeroUpgradeOutput,
|
|
26
|
+
description: "Upgrade one Arcadia account to Aero (MetadexCL V1) in one flashAction: every Slipstream V1/V2/V3 position (dex_protocol slipstream*, staked or not, see read_account_info) moves to the Aero CL pool with the same pair and variant at the same range and tick spacing (when Aero has no pool at that tick spacing, the user picks another one), and every unit of old AERO (loose, in rewards, in an old-AERO pair) becomes the new AERO. Returns the plan and, when anything can go now, the unsigned transaction. Only the account owner can sign it. " +
|
|
27
|
+
"The backend decides what moves: report items[].status and items[].reason as given, never decide eligibility yourself. status ready: sign transaction. choices_required: some position has status choose with options[] (every Aero pool on its pair, with apy, tvl_usd, is_new, tick_spacing, range_widened, default and disabled_reason); ask the user to pick one whose disabled_reason is null, then call again with it in choices so one transaction moves everything. The transaction returned with choices_required moves only the ready items: sign it alone only when the user wants to leave the choose positions where they are. waiting: each item's reason says why (pool_not_on_aero, staking_not_open, target_price_mismatch, account_unhealthy, ...); a waiting item with an option whose disabled_reason is null can still move with that pick, so ask the user; do not retry in a loop. not_open: the AERO upgrade contract does not accept deposits at the moment. A 422 saying a pool is not selectable: drop that pick, call again without it and ask the user again. " +
|
|
28
|
+
"Pass accounts (up to 10) instead of account_address for one plan per account; the accounts share one AERO upgrade budget. multisends groups the accounts that got a transaction, in order: a Safe signs one MultiSend per group (each below max_gas_per_tx). After it confirms, reconnect managers_to_reconnect with write_account_automations and verify with read_account_info (next_steps). " +
|
|
29
|
+
"Spot and margin accounts can hold Aero positions, staked or not. Chains: 8453 (Base, default), 10 (Optimism) and 4663 (Robinhood, which has nothing to upgrade). Calldata is time-sensitive: sign promptly, rebuild on a price revert. After a transaction confirms, pass its block as min_block on the next call so the plan is not built on older state. When the transaction's simulation reverts the tool returns the plan with an error and no transaction; tenderly_sim_status unavailable means Tenderly did not answer: call once more before signing. A plan without a transaction can still show tenderly_sim_status failure: the account's health or a lending pool limit refused the move, and the items wait on account_unhealthy or exposure_limit; report those reasons and do not rebuild.",
|
|
30
|
+
inputSchema: z.object({
|
|
31
|
+
account_address: z
|
|
32
|
+
.string()
|
|
33
|
+
.optional()
|
|
34
|
+
.describe("Arcadia account to upgrade. Pass this or accounts, not both."),
|
|
35
|
+
accounts: z
|
|
36
|
+
.array(z.string())
|
|
37
|
+
.min(1)
|
|
38
|
+
.max(BATCH_MAX_ACCOUNTS)
|
|
39
|
+
.optional()
|
|
40
|
+
.describe(`Up to ${BATCH_MAX_ACCOUNTS} Arcadia accounts of one owner: one plan and transaction each`),
|
|
41
|
+
choices: z
|
|
42
|
+
.array(choiceSchema)
|
|
43
|
+
.optional()
|
|
44
|
+
.describe("Pool picks for positions with status choose (or waiting with a selectable option), from a previous call's options (disabled_reason null)"),
|
|
45
|
+
slippage: z
|
|
46
|
+
.number()
|
|
47
|
+
.int()
|
|
48
|
+
.min(1)
|
|
49
|
+
.max(1000)
|
|
50
|
+
.optional()
|
|
51
|
+
.describe("Price band the mint accepts, in bps. Omit for the backend default: 150, or 500 when the owner is a contract (a Safe)."),
|
|
52
|
+
min_block: z
|
|
53
|
+
.number()
|
|
54
|
+
.int()
|
|
55
|
+
.min(0)
|
|
56
|
+
.optional()
|
|
57
|
+
.describe("Block of the transaction you just confirmed, so the plan reads state at or after it"),
|
|
58
|
+
chain_id: z
|
|
59
|
+
.number()
|
|
60
|
+
.default(8453)
|
|
61
|
+
.describe("Chain ID: 8453 (Base), 10 (Optimism) or 4663 (Robinhood, nothing to upgrade)"),
|
|
62
|
+
}),
|
|
63
|
+
}, async ({ account_address, accounts, choices, slippage, min_block, chain_id }) => {
|
|
64
|
+
try {
|
|
65
|
+
if ((account_address === undefined) === (accounts === undefined)) {
|
|
66
|
+
throw new Error("Pass exactly one of account_address and accounts.");
|
|
67
|
+
}
|
|
68
|
+
if (accounts !== undefined &&
|
|
69
|
+
(accounts.length === 0 || accounts.length > BATCH_MAX_ACCOUNTS)) {
|
|
70
|
+
throw new Error(`accounts takes 1 to ${BATCH_MAX_ACCOUNTS} Arcadia accounts.`);
|
|
71
|
+
}
|
|
72
|
+
const chainId = validateAeroChain(chain_id);
|
|
73
|
+
const picks = choiceStrings(choices);
|
|
74
|
+
let response;
|
|
75
|
+
if (account_address !== undefined) {
|
|
76
|
+
const plan = await api.getAeroUpgradePlan({
|
|
77
|
+
chain_id: chainId,
|
|
78
|
+
account_address: validateAddress(account_address, "account_address"),
|
|
79
|
+
choices: picks,
|
|
80
|
+
slippage,
|
|
81
|
+
min_block,
|
|
82
|
+
});
|
|
83
|
+
response = formatUpgradePlan(plan, chainId);
|
|
84
|
+
if (plan.calls.length > 0 && simulationReverted(plan.simulation)) {
|
|
85
|
+
return {
|
|
86
|
+
content: [{ type: "text", text: JSON.stringify(response, null, 2) }],
|
|
87
|
+
isError: true,
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
const batch = await api.postAeroUpgradeBatch({
|
|
93
|
+
chain_id: chainId,
|
|
94
|
+
accounts: accounts.map((a) => validateAddress(a, "accounts[]")),
|
|
95
|
+
choices: picks,
|
|
96
|
+
slippage,
|
|
97
|
+
min_block,
|
|
98
|
+
});
|
|
99
|
+
const results = batch.results.map((result) => result.status === "error" ? result : formatUpgradePlan(result, chainId));
|
|
100
|
+
const withTx = new Set(results.filter((r) => "transaction" in r).map((r) => r.account_address));
|
|
101
|
+
const multisends = batch.multisends
|
|
102
|
+
.map((group) => group.filter((account) => withTx.has(account)))
|
|
103
|
+
.filter((group) => group.length > 0);
|
|
104
|
+
response = {
|
|
105
|
+
description: `Upgrade ${accounts.length} account${accounts.length === 1 ? "" : "s"} to Aero: ${withTx.size} transaction${withTx.size === 1 ? "" : "s"} to sign`,
|
|
106
|
+
chain_id: batch.chain_id,
|
|
107
|
+
max_gas_per_tx: batch.max_gas_per_tx,
|
|
108
|
+
multisends,
|
|
109
|
+
results,
|
|
110
|
+
next_steps: [
|
|
111
|
+
"Each result's transaction is a flashAction on its own account. multisends lists the accounts with a transaction in groups: a Safe signs one MultiSend per group, in order, with the transactions of that group's accounts. A result with status error or without a transaction is reported as is.",
|
|
112
|
+
],
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
return {
|
|
116
|
+
content: [{ type: "text", text: JSON.stringify(response, null, 2) }],
|
|
117
|
+
structuredContent: response,
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
catch (err) {
|
|
121
|
+
return aeroErrorResult(err);
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
}
|
|
@@ -6,7 +6,7 @@ import { appendDataSuffix } from "../../../utils/attribution.js";
|
|
|
6
6
|
import { validateAddress } from "../../../utils/validation.js";
|
|
7
7
|
import { SimpleTransactionOutput } from "../../output-schemas.js";
|
|
8
8
|
export function registerBorrowTool(server, _chains, api) {
|
|
9
|
-
server.registerTool("
|
|
9
|
+
server.registerTool("write_account_borrow", {
|
|
10
10
|
annotations: {
|
|
11
11
|
title: "Build Borrow Transaction",
|
|
12
12
|
readOnlyHint: false,
|
|
@@ -15,8 +15,8 @@ export function registerBorrowTool(server, _chains, api) {
|
|
|
15
15
|
openWorldHint: false,
|
|
16
16
|
},
|
|
17
17
|
outputSchema: SimpleTransactionOutput,
|
|
18
|
-
description: "Build an unsigned transaction to borrow from an Arcadia lending pool against account collateral. NOT needed for leveraged LP
|
|
19
|
-
inputSchema: {
|
|
18
|
+
description: "Build an unsigned transaction to borrow from an Arcadia lending pool against account collateral. NOT needed for leveraged LP: write_account_add_liquidity handles borrowing internally when leverage > 0. Only works with margin accounts (created with a creditor/lending pool). Spot accounts (no creditor) cannot borrow: the tool will validate this and reject. Before borrowing, verify the account has positive free margin via read_account_info: collateral_value must exceed used_margin.",
|
|
19
|
+
inputSchema: z.object({
|
|
20
20
|
pool_address: z
|
|
21
21
|
.string()
|
|
22
22
|
.describe("Lending pool: LP_WETH=0x803ea69c7e87D1d6C86adeB40CB636cC0E6B98E2, LP_USDC=0x3ec4a293Fb906DD2Cd440c20dECB250DeF141dF1, LP_CBBTC=0xa37E9b4369dc20940009030BfbC2088F09645e3B"),
|
|
@@ -24,7 +24,7 @@ export function registerBorrowTool(server, _chains, api) {
|
|
|
24
24
|
amount: z.string().describe("Amount in raw units"),
|
|
25
25
|
to: z.string().describe("Address to receive borrowed tokens"),
|
|
26
26
|
chain_id: z.number().default(8453).describe(CHAIN_ID_DESCRIPTION),
|
|
27
|
-
},
|
|
27
|
+
}),
|
|
28
28
|
}, async (params) => {
|
|
29
29
|
try {
|
|
30
30
|
const validAccount = validateAddress(params.account_address, "account_address");
|
|
@@ -38,7 +38,7 @@ export function registerBorrowTool(server, _chains, api) {
|
|
|
38
38
|
content: [
|
|
39
39
|
{
|
|
40
40
|
type: "text",
|
|
41
|
-
text: "Error: This account has no creditor (spot account) and cannot borrow. Create a margin account with a creditor (lending pool) using
|
|
41
|
+
text: "Error: This account has no creditor (spot account) and cannot borrow. Create a margin account with a creditor (lending pool) using write_account_create.",
|
|
42
42
|
},
|
|
43
43
|
],
|
|
44
44
|
isError: true,
|
|
@@ -6,7 +6,7 @@ import { formatBatchedResponse, isSimulationFailed } from "./format-response.js"
|
|
|
6
6
|
import { validateAddress, validateChainId } from "../../../utils/validation.js";
|
|
7
7
|
import { BatchedTransactionOutput } from "../../output-schemas.js";
|
|
8
8
|
export function registerCloseTool(server, api, chains) {
|
|
9
|
-
server.registerTool("
|
|
9
|
+
server.registerTool("write_account_close", {
|
|
10
10
|
annotations: {
|
|
11
11
|
title: "Build Close Position Transaction",
|
|
12
12
|
readOnlyHint: false,
|
|
@@ -15,16 +15,16 @@ export function registerCloseTool(server, api, chains) {
|
|
|
15
15
|
openWorldHint: true,
|
|
16
16
|
},
|
|
17
17
|
outputSchema: BatchedTransactionOutput,
|
|
18
|
-
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
|
|
18
|
+
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 write_account_withdraw to send them to your wallet.
|
|
19
19
|
|
|
20
|
-
ALWAYS try this tool first when closing/exiting a position. Only fall back to individual tools (
|
|
20
|
+
ALWAYS try this tool first when closing/exiting a position. Only fall back to individual tools (write_account_remove_liquidity, write_account_swap, write_account_deleverage, write_account_withdraw) if this tool fails.
|
|
21
21
|
|
|
22
22
|
Supports two modes:
|
|
23
23
|
- 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.
|
|
24
|
-
- close_lp_only=false (default): Full atomic close
|
|
24
|
+
- 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 write_account_withdraw to send to wallet. Supports multiple receive assets with custom distribution.
|
|
25
25
|
|
|
26
26
|
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.`,
|
|
27
|
-
inputSchema: {
|
|
27
|
+
inputSchema: z.object({
|
|
28
28
|
account_address: z.string().describe("Arcadia account address"),
|
|
29
29
|
assets: z
|
|
30
30
|
.array(z.object({
|
|
@@ -33,7 +33,7 @@ The returned calldata is time-sensitive — sign and broadcast within 30 seconds
|
|
|
33
33
|
amount: z.string().describe("Amount to sell (use '1' for NFT positions)"),
|
|
34
34
|
decimals: z.number().describe("Token decimals (use 1 for NFT positions)"),
|
|
35
35
|
}))
|
|
36
|
-
.describe("Assets to close/sell from the account. IMPORTANT: For LP positions (NFTs), always use amount='1' and decimals=1
|
|
36
|
+
.describe("Assets to close/sell from the account. IMPORTANT: For LP positions (NFTs), always use amount='1' and decimals=1: do NOT pass the liquidity amount. asset_address = position manager, asset_id = NFT token ID. For ERC20 tokens: asset_id = 0, amount = full balance in raw units, decimals = real token decimals. Get all values from read_account_info."),
|
|
37
37
|
receive_assets: z
|
|
38
38
|
.array(z.object({
|
|
39
39
|
asset_address: z.string().describe("Target token address (e.g. USDC, WETH)"),
|
|
@@ -52,7 +52,7 @@ The returned calldata is time-sensitive — sign and broadcast within 30 seconds
|
|
|
52
52
|
.describe("true = only burn LP positions, leave underlying tokens in account. false = full close (burn + swap + repay)."),
|
|
53
53
|
slippage: z.number().optional().default(100).describe("Basis points, 100 = 1%"),
|
|
54
54
|
chain_id: z.number().default(8453).describe(CHAIN_ID_DESCRIPTION),
|
|
55
|
-
},
|
|
55
|
+
}),
|
|
56
56
|
}, async ({ account_address, assets, receive_assets, close_lp_only, slippage, chain_id }) => {
|
|
57
57
|
try {
|
|
58
58
|
const validChainId = validateChainId(chain_id);
|
|
@@ -210,7 +210,7 @@ The returned calldata is time-sensitive — sign and broadcast within 30 seconds
|
|
|
210
210
|
catch (err) {
|
|
211
211
|
const msg = err instanceof Error ? err.message : String(err);
|
|
212
212
|
const hint = msg.includes("500") || msg.includes("Web3")
|
|
213
|
-
? " This usually means the position (asset_id) does not exist in the account. Verify with
|
|
213
|
+
? " This usually means the position (asset_id) does not exist in the account. Verify with read_account_info first."
|
|
214
214
|
: "";
|
|
215
215
|
return {
|
|
216
216
|
content: [{ type: "text", text: `Error: ${msg}${hint}` }],
|
|
@@ -27,7 +27,7 @@ export function computeAccountAddress(factoryAddress, userSalt, walletAddress, i
|
|
|
27
27
|
return getAddress(slice(raw, 12));
|
|
28
28
|
}
|
|
29
29
|
export function registerCreateTool(server, chains) {
|
|
30
|
-
server.registerTool("
|
|
30
|
+
server.registerTool("write_account_create", {
|
|
31
31
|
annotations: {
|
|
32
32
|
title: "Build Create Account Transaction",
|
|
33
33
|
readOnlyHint: false,
|
|
@@ -37,7 +37,7 @@ export function registerCreateTool(server, chains) {
|
|
|
37
37
|
},
|
|
38
38
|
outputSchema: SimpleTransactionOutput,
|
|
39
39
|
description: "Build an unsigned transaction to create a new Arcadia account via the Factory contract. account_version: 3 with creditor → V3 margin account (can borrow/leverage). account_version: 0 or 4 → V4 spot account (no borrowing, creditor is ignored, any ERC20 allowed). Returns the predicted account address (deterministic via CREATE2).",
|
|
40
|
-
inputSchema: {
|
|
40
|
+
inputSchema: z.object({
|
|
41
41
|
salt: z.number().describe("Unique salt (uint32) for deterministic account address"),
|
|
42
42
|
wallet_address: z
|
|
43
43
|
.string()
|
|
@@ -51,7 +51,7 @@ export function registerCreateTool(server, chains) {
|
|
|
51
51
|
.optional()
|
|
52
52
|
.describe("Lending pool address for V3 margin account. Ignored for V4 spot accounts (version 0 or 4)."),
|
|
53
53
|
chain_id: z.number().default(8453).describe(CHAIN_ID_DESCRIPTION),
|
|
54
|
-
},
|
|
54
|
+
}),
|
|
55
55
|
}, async (params) => {
|
|
56
56
|
try {
|
|
57
57
|
const validChainId = validateChainId(params.chain_id);
|
|
@@ -4,7 +4,7 @@ import { formatBatchedResponse, isSimulationFailed } from "./format-response.js"
|
|
|
4
4
|
import { validateAddress } from "../../../utils/validation.js";
|
|
5
5
|
import { BatchedTransactionOutput } from "../../output-schemas.js";
|
|
6
6
|
export function registerDeleverageTool(server, api) {
|
|
7
|
-
server.registerTool("
|
|
7
|
+
server.registerTool("write_account_deleverage", {
|
|
8
8
|
annotations: {
|
|
9
9
|
title: "Build Deleverage Transaction",
|
|
10
10
|
readOnlyHint: false,
|
|
@@ -13,8 +13,8 @@ export function registerDeleverageTool(server, api) {
|
|
|
13
13
|
openWorldHint: true,
|
|
14
14
|
},
|
|
15
15
|
outputSchema: BatchedTransactionOutput,
|
|
16
|
-
description: "Multi-step flash-action: sells account collateral to the debt token and repays in one atomic transaction
|
|
17
|
-
inputSchema: {
|
|
16
|
+
description: "Multi-step flash-action: sells account collateral to the debt token and repays in one atomic transaction: no wallet tokens needed. To repay from wallet tokens instead, use write_account_repay. NOTE: If you are closing a position (remove LP + swap + repay + withdraw), prefer write_account_close 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: if tenderly_sim_status is 'false', do NOT broadcast the transaction.",
|
|
17
|
+
inputSchema: z.object({
|
|
18
18
|
account_address: z.string().describe("Arcadia account address"),
|
|
19
19
|
amount_in: z.string().describe("Collateral amount to sell (raw units)"),
|
|
20
20
|
asset_from: z.string().describe("Collateral token to sell"),
|
|
@@ -22,7 +22,7 @@ export function registerDeleverageTool(server, api) {
|
|
|
22
22
|
creditor: z.string().describe("Lending pool address"),
|
|
23
23
|
slippage: z.number().optional().default(100).describe("Basis points, 100 = 1%"),
|
|
24
24
|
chain_id: z.number().default(8453).describe(CHAIN_ID_DESCRIPTION),
|
|
25
|
-
},
|
|
25
|
+
}),
|
|
26
26
|
}, async ({ account_address, amount_in, asset_from, numeraire, creditor, slippage, chain_id }) => {
|
|
27
27
|
try {
|
|
28
28
|
validateAddress(account_address, "account_address");
|
|
@@ -7,7 +7,7 @@ import { appendDataSuffix } from "../../../utils/attribution.js";
|
|
|
7
7
|
import { validateAddress, validateChainId } from "../../../utils/validation.js";
|
|
8
8
|
import { SimpleTransactionOutput } from "../../output-schemas.js";
|
|
9
9
|
export function registerDepositTool(server, chains) {
|
|
10
|
-
server.registerTool("
|
|
10
|
+
server.registerTool("write_account_deposit", {
|
|
11
11
|
annotations: {
|
|
12
12
|
title: "Build Deposit Transaction",
|
|
13
13
|
readOnlyHint: false,
|
|
@@ -16,8 +16,8 @@ export function registerDepositTool(server, chains) {
|
|
|
16
16
|
openWorldHint: false,
|
|
17
17
|
},
|
|
18
18
|
outputSchema: SimpleTransactionOutput,
|
|
19
|
-
description: "Build an unsigned transaction to deposit assets into an Arcadia account as collateral. Supports ERC20 tokens and ERC721 NFTs (LP positions). NOT needed before
|
|
20
|
-
inputSchema: {
|
|
19
|
+
description: "Build an unsigned transaction to deposit assets into an Arcadia account as collateral. Supports ERC20 tokens and ERC721 NFTs (LP positions). NOT needed before write_account_add_liquidity: that tool deposits from wallet atomically. Ensure the account is approved first (call read_wallet_allowances to check, then write_wallet_approve if needed). Account version is auto-detected on-chain (override with account_version if needed).",
|
|
20
|
+
inputSchema: z.object({
|
|
21
21
|
account_address: z.string().describe("Arcadia account address"),
|
|
22
22
|
asset_addresses: z.array(z.string()).describe("Token contract addresses to deposit"),
|
|
23
23
|
asset_amounts: z.array(z.string()).describe("Amounts in raw units/wei, one per asset"),
|
|
@@ -34,7 +34,7 @@ export function registerDepositTool(server, chains) {
|
|
|
34
34
|
.optional()
|
|
35
35
|
.describe("Override account version (3 or 4). Auto-detected on-chain if omitted."),
|
|
36
36
|
chain_id: z.number().default(8453).describe(CHAIN_ID_DESCRIPTION),
|
|
37
|
-
},
|
|
37
|
+
}),
|
|
38
38
|
}, async (params) => {
|
|
39
39
|
try {
|
|
40
40
|
if (params.asset_addresses.length !== params.asset_amounts.length) {
|
|
@@ -5,7 +5,7 @@ import { appendDataSuffix } from "../../../utils/attribution.js";
|
|
|
5
5
|
export function isSimulationFailed(status) {
|
|
6
6
|
return status === false || status === "false";
|
|
7
7
|
}
|
|
8
|
-
function normalizeSimStatus(status) {
|
|
8
|
+
export function normalizeSimStatus(status) {
|
|
9
9
|
if (status === true || status === "true")
|
|
10
10
|
return "success";
|
|
11
11
|
if (status === false || status === "false")
|
|
@@ -4,7 +4,7 @@ import { formatBatchedResponse, isSimulationFailed } from "./format-response.js"
|
|
|
4
4
|
import { validateAddress } from "../../../utils/validation.js";
|
|
5
5
|
import { BatchedTransactionOutput } from "../../output-schemas.js";
|
|
6
6
|
export function registerRemoveLiquidityTool(server, api) {
|
|
7
|
-
server.registerTool("
|
|
7
|
+
server.registerTool("write_account_remove_liquidity", {
|
|
8
8
|
annotations: {
|
|
9
9
|
title: "Build Remove Liquidity Transaction",
|
|
10
10
|
readOnlyHint: false,
|
|
@@ -15,18 +15,18 @@ export function registerRemoveLiquidityTool(server, api) {
|
|
|
15
15
|
outputSchema: BatchedTransactionOutput,
|
|
16
16
|
description: `Flash-action: PARTIALLY decreases liquidity from an LP position. The position remains open with reduced liquidity; underlying tokens stay in the account.
|
|
17
17
|
|
|
18
|
-
For FULL position exit (burn LP + swap + repay + withdraw), use
|
|
18
|
+
For FULL position exit (burn LP + swap + repay + withdraw), use write_account_close instead: it batches everything into one atomic transaction.
|
|
19
19
|
|
|
20
20
|
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.`,
|
|
21
|
-
inputSchema: {
|
|
21
|
+
inputSchema: z.object({
|
|
22
22
|
account_address: z.string().describe("Arcadia account address"),
|
|
23
23
|
asset_address: z.string().describe("Position manager contract"),
|
|
24
24
|
asset_id: z.number().describe("NFT token ID"),
|
|
25
25
|
adjustment: z
|
|
26
26
|
.string()
|
|
27
|
-
.describe("Liquidity amount to remove (raw uint128 value as string). Must be less than total liquidity
|
|
27
|
+
.describe("Liquidity amount to remove (raw uint128 value as string). Must be less than total liquidity: for full removal use write_account_close."),
|
|
28
28
|
chain_id: z.number().default(8453).describe(CHAIN_ID_DESCRIPTION),
|
|
29
|
-
},
|
|
29
|
+
}),
|
|
30
30
|
}, async ({ account_address, asset_address, asset_id, adjustment, chain_id }) => {
|
|
31
31
|
try {
|
|
32
32
|
validateAddress(account_address, "account_address");
|
|
@@ -70,7 +70,7 @@ The returned calldata is time-sensitive — sign and broadcast within 30 seconds
|
|
|
70
70
|
catch (err) {
|
|
71
71
|
const msg = err instanceof Error ? err.message : String(err);
|
|
72
72
|
const hint = msg.includes("500") || msg.includes("Web3")
|
|
73
|
-
? " This usually means the position (asset_id) does not exist in the account. Verify with
|
|
73
|
+
? " This usually means the position (asset_id) does not exist in the account. Verify with read_account_info first."
|
|
74
74
|
: "";
|
|
75
75
|
return {
|
|
76
76
|
content: [{ type: "text", text: `Error: ${msg}${hint}` }],
|
|
@@ -6,7 +6,7 @@ import { appendDataSuffix } from "../../../utils/attribution.js";
|
|
|
6
6
|
import { validateAddress } from "../../../utils/validation.js";
|
|
7
7
|
import { SimpleTransactionOutput } from "../../output-schemas.js";
|
|
8
8
|
export function registerRepayTool(server, _chains) {
|
|
9
|
-
server.registerTool("
|
|
9
|
+
server.registerTool("write_account_repay", {
|
|
10
10
|
annotations: {
|
|
11
11
|
title: "Build Repay Transaction",
|
|
12
12
|
readOnlyHint: false,
|
|
@@ -15,8 +15,8 @@ export function registerRepayTool(server, _chains) {
|
|
|
15
15
|
openWorldHint: false,
|
|
16
16
|
},
|
|
17
17
|
outputSchema: SimpleTransactionOutput,
|
|
18
|
-
description: "Repay debt to an Arcadia lending pool using tokens from the wallet (requires ERC20 allowance). To repay using account collateral instead (no wallet tokens needed), use
|
|
19
|
-
inputSchema: {
|
|
18
|
+
description: "Repay debt to an Arcadia lending pool using tokens from the wallet (requires ERC20 allowance). To repay using account collateral instead (no wallet tokens needed), use write_account_deleverage. Check allowance first (read_wallet_allowances), then approve the pool if needed (write_wallet_approve). Check outstanding debt with read_account_info.",
|
|
19
|
+
inputSchema: z.object({
|
|
20
20
|
pool_address: z
|
|
21
21
|
.string()
|
|
22
22
|
.describe("Lending pool address. Base: LP_WETH=0x803ea69c7e87D1d6C86adeB40CB636cC0E6B98E2, LP_USDC=0x3ec4a293Fb906DD2Cd440c20dECB250DeF141dF1, LP_CBBTC=0xa37E9b4369dc20940009030BfbC2088F09645e3B"),
|
|
@@ -25,7 +25,7 @@ export function registerRepayTool(server, _chains) {
|
|
|
25
25
|
.string()
|
|
26
26
|
.describe("Amount in raw units, or 'max_uint256' to repay all debt in full"),
|
|
27
27
|
chain_id: z.number().default(8453).describe(CHAIN_ID_DESCRIPTION),
|
|
28
|
-
},
|
|
28
|
+
}),
|
|
29
29
|
}, async (params) => {
|
|
30
30
|
try {
|
|
31
31
|
const validAccount = validateAddress(params.account_address, "account_address");
|
|
@@ -4,7 +4,7 @@ import { formatBatchedResponse, isSimulationFailed } from "./format-response.js"
|
|
|
4
4
|
import { validateAddress } from "../../../utils/validation.js";
|
|
5
5
|
import { BatchedTransactionOutput } from "../../output-schemas.js";
|
|
6
6
|
export function registerStakeTool(server, api) {
|
|
7
|
-
server.registerTool("
|
|
7
|
+
server.registerTool("write_account_stake", {
|
|
8
8
|
annotations: {
|
|
9
9
|
title: "Build Position Action Transaction",
|
|
10
10
|
readOnlyHint: false,
|
|
@@ -13,14 +13,14 @@ export function registerStakeTool(server, api) {
|
|
|
13
13
|
openWorldHint: true,
|
|
14
14
|
},
|
|
15
15
|
outputSchema: BatchedTransactionOutput,
|
|
16
|
-
description: "Flash-action: stake, unstake, or claim rewards for an LP position in one atomic transaction. Use the `action` parameter to select the operation. `asset_address` is the position manager contract
|
|
17
|
-
inputSchema: {
|
|
16
|
+
description: "Flash-action: stake, unstake, or claim rewards for an LP position in one atomic transaction. Use the `action` parameter to select the operation. `asset_address` is the position manager contract: pass the non-staked PM address when staking, or the staked PM address when unstaking. 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). Tenderly simulation may not be available for this endpoint. Verify the position exists with read_account_info before signing. Aero CL (metadexcl_v1): spot accounts stake through the Arcadia wrapper, margin accounts through the staked module, on Base, Optimism and Robinhood.",
|
|
17
|
+
inputSchema: z.object({
|
|
18
18
|
account_address: z.string().describe("Arcadia account address"),
|
|
19
19
|
action: z.enum(["stake", "unstake", "claim"]).describe("Action to perform"),
|
|
20
20
|
asset_address: z.string().describe("Position manager contract address"),
|
|
21
21
|
asset_id: z.number().describe("NFT token ID of the LP position"),
|
|
22
22
|
chain_id: z.number().default(8453).describe(CHAIN_ID_DESCRIPTION),
|
|
23
|
-
},
|
|
23
|
+
}),
|
|
24
24
|
}, async ({ account_address, action, asset_address, asset_id, chain_id }) => {
|
|
25
25
|
try {
|
|
26
26
|
validateAddress(account_address, "account_address");
|
|
@@ -99,7 +99,7 @@ export function registerStakeTool(server, api) {
|
|
|
99
99
|
catch (err) {
|
|
100
100
|
const msg = err instanceof Error ? err.message : String(err);
|
|
101
101
|
const hint = msg.includes("500") || msg.includes("Web3")
|
|
102
|
-
? " This usually means the position (asset_id) does not exist in the account. Verify with
|
|
102
|
+
? " This usually means the position (asset_id) does not exist in the account. Verify with read_account_info first."
|
|
103
103
|
: "";
|
|
104
104
|
return {
|
|
105
105
|
content: [{ type: "text", text: `Error: ${msg}${hint}` }],
|
|
@@ -4,7 +4,7 @@ import { formatBatchedResponse, isSimulationFailed } from "./format-response.js"
|
|
|
4
4
|
import { validateAddress } from "../../../utils/validation.js";
|
|
5
5
|
import { BatchedTransactionOutput } from "../../output-schemas.js";
|
|
6
6
|
export function registerSwapTool(server, api) {
|
|
7
|
-
server.registerTool("
|
|
7
|
+
server.registerTool("write_account_swap", {
|
|
8
8
|
annotations: {
|
|
9
9
|
title: "Build Swap Transaction",
|
|
10
10
|
readOnlyHint: false,
|
|
@@ -13,15 +13,15 @@ export function registerSwapTool(server, api) {
|
|
|
13
13
|
openWorldHint: true,
|
|
14
14
|
},
|
|
15
15
|
outputSchema: BatchedTransactionOutput,
|
|
16
|
-
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
|
|
17
|
-
inputSchema: {
|
|
16
|
+
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 write_account_close 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: if tenderly_sim_status is 'false', do NOT broadcast the transaction.",
|
|
17
|
+
inputSchema: z.object({
|
|
18
18
|
account_address: z.string().describe("Arcadia account address"),
|
|
19
19
|
asset_from: z.string().describe("Token address to swap from"),
|
|
20
20
|
asset_to: z.string().describe("Token address to swap to"),
|
|
21
21
|
amount_in: z.string().describe("Raw units"),
|
|
22
22
|
slippage: z.number().optional().default(100).describe("Basis points, 100 = 1%"),
|
|
23
23
|
chain_id: z.number().default(8453).describe(CHAIN_ID_DESCRIPTION),
|
|
24
|
-
},
|
|
24
|
+
}),
|
|
25
25
|
}, async ({ account_address, asset_from, asset_to, amount_in, slippage, chain_id }) => {
|
|
26
26
|
try {
|
|
27
27
|
validateAddress(account_address, "account_address");
|
|
@@ -7,7 +7,7 @@ import { appendDataSuffix } from "../../../utils/attribution.js";
|
|
|
7
7
|
import { validateAddress, validateChainId } from "../../../utils/validation.js";
|
|
8
8
|
import { SimpleTransactionOutput } from "../../output-schemas.js";
|
|
9
9
|
export function registerWithdrawTool(server, chains) {
|
|
10
|
-
server.registerTool("
|
|
10
|
+
server.registerTool("write_account_withdraw", {
|
|
11
11
|
annotations: {
|
|
12
12
|
title: "Build Withdraw Transaction",
|
|
13
13
|
readOnlyHint: false,
|
|
@@ -16,8 +16,8 @@ export function registerWithdrawTool(server, chains) {
|
|
|
16
16
|
openWorldHint: false,
|
|
17
17
|
},
|
|
18
18
|
outputSchema: SimpleTransactionOutput,
|
|
19
|
-
description: "Build an unsigned transaction to withdraw assets from an Arcadia account to the owner's wallet. Only the account owner can withdraw. Will revert if the account has debt and withdrawal would make it undercollateralized. Does not support max_uint256
|
|
20
|
-
inputSchema: {
|
|
19
|
+
description: "Build an unsigned transaction to withdraw assets from an Arcadia account to the owner's wallet. Only the account owner can withdraw. Will revert if the account has debt and withdrawal would make it undercollateralized. Does not support max_uint256: pass exact amounts from read_account_info. Account version is auto-detected on-chain (override with account_version if needed).",
|
|
20
|
+
inputSchema: z.object({
|
|
21
21
|
account_address: z.string().describe("Arcadia account address"),
|
|
22
22
|
asset_addresses: z.array(z.string()).describe("Token contract addresses to withdraw"),
|
|
23
23
|
asset_amounts: z.array(z.string()).describe("Amounts in raw units/wei, one per asset"),
|
|
@@ -34,7 +34,7 @@ export function registerWithdrawTool(server, chains) {
|
|
|
34
34
|
.optional()
|
|
35
35
|
.describe("Override account version (3 or 4). Auto-detected on-chain if omitted."),
|
|
36
36
|
chain_id: z.number().default(8453).describe(CHAIN_ID_DESCRIPTION),
|
|
37
|
-
},
|
|
37
|
+
}),
|
|
38
38
|
}, async (params) => {
|
|
39
39
|
try {
|
|
40
40
|
if (params.asset_amounts.some((a) => a === "max_uint256")) {
|
|
@@ -42,7 +42,7 @@ export function registerWithdrawTool(server, chains) {
|
|
|
42
42
|
content: [
|
|
43
43
|
{
|
|
44
44
|
type: "text",
|
|
45
|
-
text: 'Error:
|
|
45
|
+
text: 'Error: write_account_withdraw does not support "max_uint256". Pass exact amounts from read_account_info.',
|
|
46
46
|
},
|
|
47
47
|
],
|
|
48
48
|
isError: true,
|
|
@@ -12,7 +12,7 @@ const INTENT_REFERENCE = [
|
|
|
12
12
|
"- claim_merkl: auto-claim Merkl incentive rewards. Independent of the compounder/claimer/cowswapper triad and needs no position context.",
|
|
13
13
|
"- rebalance: reposition the LP. strategy out_of_range (default), take_profit (runs on the dedicated profit-taker contract), or protocol_owned_liquidity.",
|
|
14
14
|
].join("\n");
|
|
15
|
-
const CONTEXT_NOTE = "Pass position_id (from assets[] in
|
|
15
|
+
const CONTEXT_NOTE = "Pass position_id (from assets[] in read_account_info) and the backend fills in protocol, is_staked, token0, token1 and reward_tokens for you; anything you pass explicitly wins. claim_merkl needs no position context.";
|
|
16
16
|
const RULES_NOTE = [
|
|
17
17
|
"Rules the backend enforces (a violation is returned as an error, never written on-chain):",
|
|
18
18
|
"- Every yielding token must be assigned to exactly one of compound_fees or claim_rewards. Scoping one to a subset without covering the rest is rejected, and no token may be in both.",
|
|
@@ -126,7 +126,7 @@ function errorResult(err) {
|
|
|
126
126
|
};
|
|
127
127
|
}
|
|
128
128
|
export function registerAutomationsTools(server, api) {
|
|
129
|
-
server.registerTool("
|
|
129
|
+
server.registerTool("write_account_automations", {
|
|
130
130
|
annotations: {
|
|
131
131
|
title: "Configure Account Automations",
|
|
132
132
|
readOnlyHint: false,
|
|
@@ -137,7 +137,7 @@ export function registerAutomationsTools(server, api) {
|
|
|
137
137
|
description: "Configure an account's automations from a list of intents and return the unsigned setAssetManagers transaction. " +
|
|
138
138
|
"The backend resolves which asset managers each intent needs, validates that the combination is compatible, encodes the metadata and builds the calldata, so you describe the desired outcome rather than the contracts.\n\n" +
|
|
139
139
|
"With mode 'save' (the default) the intents array is the complete desired state: the backend diffs it against what is currently enabled, so any automation you leave out is DISABLED by the returned transaction. Pass a single intent with enabled: false to turn everything off.\n\n" +
|
|
140
|
-
"Mode 'preview' validates and resolves the intents WITHOUT reading chain state and returns no transaction, because its calldata carries no disable entries and would only partially apply the state. Use it to check a combination is legal or to show a plan; use 'save' to get something signable. To toggle one automation without restating the rest, use
|
|
140
|
+
"Mode 'preview' validates and resolves the intents WITHOUT reading chain state and returns no transaction, because its calldata carries no disable entries and would only partially apply the state. Use it to check a combination is legal or to show a plan; use 'save' to get something signable. To toggle one automation without restating the rest, use write_account_automations_delta.\n\n" +
|
|
141
141
|
INTENT_REFERENCE +
|
|
142
142
|
"\n\n" +
|
|
143
143
|
CONTEXT_NOTE +
|
|
@@ -145,9 +145,9 @@ export function registerAutomationsTools(server, api) {
|
|
|
145
145
|
RULES_NOTE +
|
|
146
146
|
"\n\nReturns { valid, errors, warnings, human_summary, plan, diff, transaction }. When a compatibility rule fires the call returns an error and no transaction: read errors[].reason, adjust the intents and retry. " +
|
|
147
147
|
"There is deliberately no transaction when the account already matches the request (no_changes_needed), when the Tenderly simulation predicts a revert (an error), or in preview mode (preview_only). " +
|
|
148
|
-
"Call
|
|
148
|
+
"Call read_asset_manager_intents first to see which intents this account can enable.",
|
|
149
149
|
outputSchema: AutomationsPlanOutput,
|
|
150
|
-
inputSchema: {
|
|
150
|
+
inputSchema: z.object({
|
|
151
151
|
account_address: z.string().describe("Arcadia account address"),
|
|
152
152
|
intents: z
|
|
153
153
|
.array(AUTOMATION_INTENT)
|
|
@@ -159,7 +159,7 @@ export function registerAutomationsTools(server, api) {
|
|
|
159
159
|
.describe("save diffs against on-chain state and returns a signable transaction that also disables anything omitted. preview resolves and validates only, returning a plan and no transaction."),
|
|
160
160
|
...POSITION_CONTEXT_SCHEMA,
|
|
161
161
|
chain_id: CHAIN_ID_SCHEMA,
|
|
162
|
-
},
|
|
162
|
+
}),
|
|
163
163
|
}, async (params) => {
|
|
164
164
|
try {
|
|
165
165
|
const chainId = validateChainId(params.chain_id);
|
|
@@ -175,7 +175,7 @@ export function registerAutomationsTools(server, api) {
|
|
|
175
175
|
return errorResult(err);
|
|
176
176
|
}
|
|
177
177
|
});
|
|
178
|
-
server.registerTool("
|
|
178
|
+
server.registerTool("write_account_automations_delta", {
|
|
179
179
|
annotations: {
|
|
180
180
|
title: "Change Account Automations (Delta)",
|
|
181
181
|
readOnlyHint: false,
|
|
@@ -184,15 +184,15 @@ export function registerAutomationsTools(server, api) {
|
|
|
184
184
|
openWorldHint: true,
|
|
185
185
|
},
|
|
186
186
|
description: "Apply an explicit change to an account's automations and return the unsigned setAssetManagers transaction. " +
|
|
187
|
-
"Unlike
|
|
188
|
-
"The enable array takes intents to switch on (same shapes as
|
|
187
|
+
"Unlike write_account_automations this is a delta, not a full desired state: automations you do not mention are left untouched. Use it to switch one automation on or off without restating the others.\n\n" +
|
|
188
|
+
"The enable array takes intents to switch on (same shapes as write_account_automations). To turn an automation OFF, call read_asset_manager_current, take the address of the manager serving it, and pass that address in the disable array: an intent with enabled: false in `enable` is rejected because the backend would ignore it. Superseded or unreadable managers still set on the account are force-disabled in the same transaction regardless.\n\n" +
|
|
189
189
|
INTENT_REFERENCE +
|
|
190
190
|
"\n\n" +
|
|
191
191
|
CONTEXT_NOTE +
|
|
192
192
|
"\n\n" +
|
|
193
193
|
RULES_NOTE,
|
|
194
194
|
outputSchema: AutomationsPlanOutput,
|
|
195
|
-
inputSchema: {
|
|
195
|
+
inputSchema: z.object({
|
|
196
196
|
account_address: z.string().describe("Arcadia account address"),
|
|
197
197
|
enable: z
|
|
198
198
|
.array(AUTOMATION_INTENT)
|
|
@@ -201,10 +201,10 @@ export function registerAutomationsTools(server, api) {
|
|
|
201
201
|
disable: z
|
|
202
202
|
.array(z.string())
|
|
203
203
|
.default([])
|
|
204
|
-
.describe("Asset-manager addresses to switch off, as returned by
|
|
204
|
+
.describe("Asset-manager addresses to switch off, as returned by read_asset_manager_current."),
|
|
205
205
|
...POSITION_CONTEXT_SCHEMA,
|
|
206
206
|
chain_id: CHAIN_ID_SCHEMA,
|
|
207
|
-
},
|
|
207
|
+
}),
|
|
208
208
|
}, async (params) => {
|
|
209
209
|
try {
|
|
210
210
|
const chainId = validateChainId(params.chain_id);
|
|
@@ -219,8 +219,8 @@ export function registerAutomationsTools(server, api) {
|
|
|
219
219
|
if (disabledEntries.length > 0) {
|
|
220
220
|
const kinds = disabledEntries.map((i) => i.kind).join(", ");
|
|
221
221
|
throw new Error(`enable[] cannot carry enabled: false (got ${kinds}); it would be ignored and change nothing. ` +
|
|
222
|
-
`To turn an automation off, call
|
|
223
|
-
`and pass that address in \`disable\`. Alternatively call
|
|
222
|
+
`To turn an automation off, call read_asset_manager_current, take the address of the manager serving it, ` +
|
|
223
|
+
`and pass that address in \`disable\`. Alternatively call write_account_automations with the full set of intents you want kept.`);
|
|
224
224
|
}
|
|
225
225
|
const disable = params.disable.map((a, i) => validateAddress(a, `disable[${i}]`));
|
|
226
226
|
const resp = await api.applyAutomationsDelta(account, chainId, {
|