write.account.automations
Set an account's DeFi automations from intents and get an unsigned transaction that enables listed automations and disables omitted ones.
Instructions
Configure an account's automations from a list of intents and return the unsigned setAssetManagers transaction. 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.
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.
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.
Intents:
compound_fees: reinvest earned fees/rewards back into the LP. Optional 'tokens' scopes it per yielding token. A staked reward that is not a pool token is swapped in via CowSwap automatically.
claim_rewards: claim yield out. config.mode as_earned pays the tokens as-is, convert_to swaps them to config.buy_token via CowSwap. config.convert_tokens converts only a subset and claims the rest as-earned. config.destination account or wallet.
add_to_lp: fold idle pool-token balances (deposits, rebalance leftovers) back into the LP. Opt-in per token.
claim_merkl: auto-claim Merkl incentive rewards. Independent of the compounder/claimer/cowswapper triad and needs no position context.
rebalance: reposition the LP. strategy out_of_range (default), take_profit (runs on the dedicated profit-taker contract), or protocol_owned_liquidity.
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.
Rules the backend enforces (a violation is returned as an error, never written on-chain):
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.
A wallet or custom-recipient payout requires a pure as-earned claim: nothing converted, and every yielding token claimed. Converts settle in the account.
convert_tokens must be a subset of the claimed tokens, and buy_token cannot be a compounded token, a converted token, or an add_to_lp folded token.
Each intent kind may appear only once, and a token list must not be empty or name a token the position does not yield.
Returns { 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. 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). Call read.asset_manager.intents first to see which intents this account can enable.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | No | 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. | save |
| owner | No | Account owner EOA. Used to resolve wallet payout targets. | |
| token0 | No | Pool token0 address. | |
| token1 | No | Pool token1 address. | |
| intents | Yes | Complete desired automation state. In save mode anything omitted is disabled, so include every automation to keep. A single intent with enabled: false disables all automations. | |
| chain_id | No | Chain ID: 8453 (Base), 130 (Unichain), or 10 (Optimism) | |
| protocol | No | Position's DEX protocol. Only needed when position_id is omitted. Accepts the dex_protocol values the read tools return (slipstream, staked_slipstream_v3, uniV3, ...), which imply is_staked, as well as the canonical slipstream_v1 / uniswap_v3 spellings. | |
| is_staked | No | Whether the LP position is staked. Implied by a staked_* protocol value. | |
| position_id | No | LP position (NFT) id, as listed in assets[] by read.account.info. Supply this and the backend fetches protocol, staked flag, tokens and reward tokens for you. Strongly preferred over passing the position fields by hand. | |
| reward_tokens | No | Staking reward token addresses. | |
| account_address | Yes | Arcadia account address |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| diff | No | ||
| plan | Yes | ||
| valid | Yes | ||
| errors | Yes | ||
| warnings | Yes | ||
| description | Yes | ||
| transaction | No | ||
| preview_only | No | ||
| human_summary | Yes | ||
| simulation_url | No | ||
| no_changes_needed | No | ||
| tenderly_sim_status | No |