perp_open_long
Open a leveraged LONG perp position on Drift (non-custodial).
Returns an UNSIGNED base64 transaction for your wallet to sign + broadcast, plus entry/liquidation/margin estimates. market e.g. SOL-PERP. size_usd is notional USD; leverage up to the market max. TP/SL are informational in the build — place them as trigger orders after the position opens. The fee is charged on size_usd notional past the daily free tier (x402 payment_header).
jurisdiction: your ISO-3166-1 alpha-2
country code, self-declared -- perps are geo-gated (CFTC posture: no US
persons, unknown jurisdiction DENIED). Pass it once here (or via
declare_jurisdiction/trade_equity) and it is remembered for 90
days; every perps/short/leverage call is denied until declared.
idempotency_key (optional): a client-generated UUID.
Retrying with the same key + same args replays the original result instead
of re-opening the position. Reuse the SAME key across the build call and
its signed_transaction completion call -- the two legs
dedupe independently (the completion leg is namespaced under its own
storage key, matching jupiter_swap's build/broadcast pattern), so this
never raises IDEMPOTENCY_CONFLICT; a NEW key means a genuinely new order.
signed_transaction / verify (two-phase execution):
re-call this tool with the SIGNED base64 tx and Crank broadcasts it, then
awaits on-chain confirmation and re-reads the perp position -- the response
carries a real verification block ({confirmed, slot, post_state,
expected_vs_actual}). Gate follow-on decisions on verification.confirmed,
never on tx_signature alone. verify=false skips only the confirmation wait.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ip | No | ||
| market | Yes | ||
| verify | No | ||
| leverage | Yes | ||
| size_usd | Yes | ||
| caller_id | No | ||
| jurisdiction | No | ||
| pay_in_crank | No | ||
| payment_header | No | ||
| wallet_address | Yes | ||
| idempotency_key | No | ||
| stop_loss_price | No | ||
| allow_unverified | No | ||
| take_profit_price | No | ||
| signed_transaction | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||