# Jupiter Perps limit entry

`jupiter_perps.build_limit` prepares a funded limit-entry request for SOL, ETH or BTC on Solana mainnet. The agent owns its Solana key. The hosted API verifies the provider transaction and returns it without creating an owner signature or broadcasting.

Limit entry uses three signers: owner, keeper, and the pinned Jupiter API keeper. The provider supplies a valid API-keeper signature. `jupiter-perps sign` adds only the owner's signature locally. An explicit `jupiter-perps submit` sends those exact bytes to Jupiter's fixed co-sign-and-broadcast endpoint. Generic `wallet sign` and `tx submit` retain their separate signer rules and do not accept this artifact.

## Inputs and scope

| Field | Meaning |
| --- | --- |
| `walletAddress` | Public address of the locally controlled Solana wallet. |
| `asset` | `SOL`, `ETH`, or `BTC`. |
| `side` | `long` or `short`. |
| `inputAmount` | Positive raw collateral units: native SOL has 9 decimals, supported ETH/BTC tokens have 8, USDC has 6. |
| `sizeUsdDelta` | Positive position notional, raw USD with 6 decimals. |
| `triggerPriceUsd` | Positive trigger price, raw USD with 6 decimals. |
| `allowUnboundedExecutionPrice` | Must be `true`. A trigger threshold is not a guaranteed execution price. |
| `maxNetworkFeeLamports` | Positive cap on the verified transaction fee, including priority fee. |
| `maxRentLamports` | Nonnegative cap on upfront account rent, including temporary accounts. |

Longs require the corresponding asset as collateral; shorts require USDC. SOL long funding wraps the exact input and closes the funding WSOL account. A nonzero existing WSOL account is rejected to prevent unexpectedly consuming or closing existing wrapped holdings. An absent or empty canonical WSOL account is supported. Other collateral must already exist in the owner's initialized, unfrozen, undelegated classic SPL associated token account.

A long trigger is at or below the threshold; a short trigger is at or above. The resulting request has no separate execution-price bound. Exact input, notional and trigger are encoded in the signed message. Fee and rent ceilings are checked offchain against current mainnet state and are rechecked before signing and submission.

Cross-collateral limit funding, referral accounts, automatic leverage sizing, instant market trades and arbitrary provider instructions are outside this policy. Provider minimum collateral, trigger placement and existing-position requirements remain in force; preparation fails when those conditions or the unsigned simulation fail.

## Review, sign and submit

Use `AGENT_CRYPTO_URL`, a gateway key with `prepare` scope, and `AGENT_CRYPTO_WALLET_PASSWORD` supplied through your secret manager. The wallet file remains local. Prepare `limit-intent.json` with your public address and independently selected amounts and ceilings using the schema above.

```sh
umask 077
block-cli call jupiter_perps build_limit --file limit-intent.json > limit-prepared.json
block-cli jupiter-perps inspect --file limit-prepared.json --out limit-review.json
```

Review the exact owner, market, direction, input, notional, trigger, derived request/position accounts, provider and oracle signature checks, fee, rent and simulation. Retain `data.verification.positionRequest` from the preparation response. Independently approve the displayed digest; do not automatically copy it into an approval step without evaluating those fields.

The next command uses explicit environment values chosen by that review. USD amounts and raw input amounts retain the units listed above. Set each value before running it; the shell refuses an absent value.

```sh
block-cli jupiter-perps sign \
  --file "${LOCAL_WALLET_FILE:?Set the local encrypted wallet path}" \
  --review limit-review.json \
  --approve "${REVIEWED_LIMIT_DIGEST:?Set the independently approved digest}" \
  --max-fee "${LIMIT_MAX_FEE_LAMPORTS:?Set the independent fee ceiling}" \
  --max-rent "${LIMIT_MAX_RENT_LAMPORTS:?Set the independent rent ceiling}" \
  --max-input-amount "${LIMIT_MAX_INPUT_RAW:?Set the independent collateral ceiling}" \
  --max-size-usd "${LIMIT_MAX_NOTIONAL_USD6:?Set the independent notional ceiling}" \
  --out limit-signed.json

block-cli jupiter-perps submit --file limit-signed.json
block-cli jupiter-perps status --file limit-signed.json
```

Preparations are short-lived. The validator requires a valid blockhash, a request time no older than 60 seconds and a current signed oracle payload within the onchain feed-age policy, capped at 60 seconds. It repeats freshness checks after simulation and signing. An expired unsigned preparation needs a fresh preparation and a new digest review. Never use a fresh preparation to blindly replace a previously submitted or possibly submitted intent.

The signed artifact is private and contains a usable owner partial signature. Only the explicit submit call releases it to the co-signing service. Signing and submission validation simulate the original provider-only transaction; they never send the owner's signature to an RPC simulation service. Submit performs one bounded request, with redirects and automatic retries disabled.

## Outcomes and reconciliation

A successful co-sign response must acknowledge the locally derived owner-signature transaction ID and the expected action. It returns `state: "submitted"`, `confirmed: false`, `limitCreated: false`, `positionExecuted: false`, and `retrySafe: false`. A timeout, response mismatch or other submission uncertainty returns `state: "unknown"` with the same transaction ID. The service may have broadcast before an error reached the caller.

`jupiter-perps status` verifies the owner signature and exact message identity and reads this exact transaction ID on mainnet. It can return `unknown`, `pending`, `confirmed`, `finalized`, or `failed`. Confirmation is a transaction observation; this status command does not rerun the historical preparation policy or claim a filled position. `limitCreated` remains unknown for a successful transaction status. A processed or confirmed failure is not final; finalized failures may still incur fees.

Use `jupiter_perps.request_status` with the retained owner and request address to inspect program-owned request state. A missing account is ambiguous. A funded limit request is not an executed position. Reconcile the request, position and transaction history before another intent. Supported pending requests can be prepared for owner cancellation with `jupiter_perps.build_cancel_request`; cancellation uses the generic wallet-only review/sign/submit path and can race keeper execution.

## Verification evidence

The policy checks exact instruction order, account identities and privileges, position/request/ATA PDAs, lookup-table ownership and state, pinned programs and API-keeper signature, trusted Pyth signer membership and expiry, the cryptographic oracle signature, payload boundaries/feed/channel/price/exponent/freshness, and the canonical Doves aggregate. It verifies exact request escrow, new-position zero size/collateral, existing-position preservation, funding-account balances, fees and rent through unsigned simulation. Extra transfers, substitutions, unknown opcodes, blockhash replacement and excessive compute are rejected.

The current official transaction uses the canonical Doves aggregate in both historical oracle slots of `instantCreateLimitOrder`. This exact binding was independently corroborated by a successful public transaction and both unsigned live simulations. Arbitrary alternate oracle accounts are not accepted.

`jupiter-perps-limit-live-v0.12.0.json` (evidence record in the source checkout) records native-SOL long and USDC-funded SOL, ETH and BTC short preparations with successful unsigned simulations. No funded wallet signature or broadcast was created during testing. Automated tests use deterministic public test keys, a captured genuine Pyth signed payload, injected RPC state, and mock co-sign responses; they verify local partial signing and exact bytes sent. They do not establish live keeper availability or future fills.

Primary references: [official Perps API v2](https://perps-api.jup.ag/v2/docs), [official Jupiter CLI client](https://github.com/jup-ag/cli/blob/main/src/clients/PerpsClient.ts), [request account semantics](https://developers.jup.ag/docs/perps/position-request-account), and the current program-owned Anchor IDLs for the pinned Perps and Doves programs. The `jupiter-limit-oracle-review-v0.12.0.json` (evidence record in the source checkout) records the independent oracle-format checks.
