Under Squire, pick the Writ number and sign one message (EIP-191, no gas). It binds margrav.xyz, the March, the Writ and today’s UTC date.
The server creates a fresh key, stores it encrypted (AES-256-GCM) and shows you the Squire address and an API key starting with mgv_, once. Only its SHA-256 is kept.
Issue the Writ to the Squire address, set its caps and pool floor, and send it a little ETH for gas (0.0005 ETH covers many swaps).
Prefer your own key? Skip the Squire. Act tools return the unsigned transaction; sign it yourself and broadcast with send_signed_transaction.
03 · Perimeter
What a Writ enforces
Agent and expiry. One address per Writ. After expiry or revokeWrit it can do nothing.
Caps per token. Per transaction, per rolling 24 h (the window starts at the first spend), and a lifetime cap (0 = none).
Pools and a price floor. Only pools you allow, never pools with hooks. Each direction needs a floor; a swap that would sell below it reverts. A stolen agent key can never sell below your floor or past your caps.
Recipients. Transfers only to wallets you list. A recipient can never be the agent itself.
Output stays home. Swap output always lands back in the March, never in the agent’s wallet.
Blackout. One owner transaction freezes every Writ on the March.
When a Squire action would break any rule, the server does not send it and answers stopped_at_perimeter with the reason. If something slips past the server, the contract reverts it anyway.
04 · Tools
Tools in four groups
read
No key needed. Chain, tokens, pool and March state.
network_info
get_balance
get_token_balance
token_info
token_allowance
wallet_info
get_transaction
get_receipt
get_block
contract_code
read_contract
get_logs
estimate_gas
gas_price
pool_price_eth_usdg
swap_quote
pool_id
march_info
writ_info
remaining_today
chronicle
marches_of_owner
stats
simulate
Dry runs with eth_call. Plain-words result, revert reason and risk flags. Nothing is sent.
simulate_call
decode_calldata
decode_error
simulate_march_swap
simulate_march_transfer
prepare
For the owner. Returns an unsigned transaction and a summary; the server never signs owner actions.
prepare_open_march
prepare_deposit_eth
prepare_issue_writ
prepare_set_limit
prepare_set_total
prepare_allow_pool
prepare_remove_pool
prepare_set_floor
prepare_allow_recipient
prepare_remove_recipient
prepare_revoke_writ
prepare_blackout_on
prepare_blackout_off
prepare_withdraw
prepare_fund_squire
act
For the agent. With a Squire key the server checks the perimeter, simulates, then signs and sends. Without one you get the unsigned tx for your own key.