feat(mcp-hyperliquid): leverage_cap + testnet resolver + environment_info
This commit is contained in:
@@ -37,7 +37,7 @@ def http(mock_client):
|
||||
"ot": Principal("observer", {"observer"}),
|
||||
}
|
||||
)
|
||||
app = create_app(client=mock_client, token_store=store)
|
||||
app = create_app(client=mock_client, token_store=store, creds={"max_leverage": 3})
|
||||
return TestClient(app)
|
||||
|
||||
|
||||
@@ -128,18 +128,8 @@ def test_place_order_observer_forbidden(http):
|
||||
assert r.status_code == 403
|
||||
|
||||
|
||||
def test_place_order_notional_cap_enforced(http):
|
||||
"""CER-016: HL reject amount*price > 200."""
|
||||
r = http.post(
|
||||
"/tools/place_order",
|
||||
headers={"Authorization": "Bearer ct"},
|
||||
json={"instrument": "ETH", "side": "buy", "amount": 0.1, "price": 3350},
|
||||
)
|
||||
assert r.status_code == 403
|
||||
assert r.json()["error"]["code"] == "HARD_PROHIBITION"
|
||||
|
||||
|
||||
def test_place_order_leverage_cap_enforced_hl(http):
|
||||
"""Reject leverage > max_leverage (da secret, default 3)."""
|
||||
r = http.post(
|
||||
"/tools/place_order",
|
||||
headers={"Authorization": "Bearer ct"},
|
||||
@@ -152,6 +142,10 @@ def test_place_order_leverage_cap_enforced_hl(http):
|
||||
},
|
||||
)
|
||||
assert r.status_code == 403
|
||||
body = r.json()
|
||||
err = body["error"]
|
||||
assert err["code"] == "LEVERAGE_CAP_EXCEEDED"
|
||||
assert err["details"]["exchange"] == "hyperliquid"
|
||||
|
||||
|
||||
def test_cancel_order_core_ok(http):
|
||||
|
||||
Reference in New Issue
Block a user