Repository navigation
docs(perps): explain Lighter API key slots for local setup - #36980
Conversation
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
PR template — items to address before "Ready for review"Warnings — informational, address before merging:
See docs/readme/ready-for-review.md for the full Definition of Ready for Review. |
Smart E2E Test SelectionAI Confidence: 98 E2E reasoningExpand to readThis PR contains only two files, both of which are documentation/comment-only changes with zero functional impact on the app:
No app source code, test infrastructure, controllers, hooks, components, navigation, or CI workflows were modified. No E2E smoke tests or performance tests are warranted. Performance reasoningExpand to readNo app code was changed. Both files are documentation/comment-only. The .js.env.example change is a comment clarification (cosmetic). The docs/perps/lighter-api-keys.md is a new developer documentation file. Neither affects any runtime behavior, rendering path, or performance scenario. |
|



Description
Lighter orders are signed by a trading key (Lighter's "API key") that the embedded signer registers in a numbered slot of the account, with one
personal_signfrom the wallet. A key only works on the device that created it, so simulators, devices and scripts sharing an account need different slots. When the configured slot already holds another device's key, the app stops with "Lighter API key slot N already contains a different key", which is hard to understand without context.This adds
docs/perps/lighter-api-keys.md(what a slot is, local setup, how to check a free slot, the error and its fix, testnet resets) and points theMM_PERPS_LIGHTER_API_KEY_INDEXcomment in.js.env.exampleto it. The perps-controller README gets the same explanation in MetaMask/core#10559.Changelog
CHANGELOG entry: null
Related issues
Refs: MetaMask/core#10559
Manual testing steps
N/A: documentation only. The fix it describes was checked on an iOS simulator against Lighter testnet: with the configured slot held by another device's key the app stopped with the error above, and with
MM_PERPS_LIGHTER_API_KEY_INDEXset to a free slot the app registered its own key there.Screenshots/Recordings
N/A: documentation only.
Pre-merge author checklist
Performance checks (if applicable)
trace()for usage andaddTokenfor an exampleFor performance guidelines and tooling, see the Performance Guide.
Pre-merge reviewer checklist
Note
Low Risk
Documentation and env example comments only; no runtime or security logic changes.
Overview
Adds
docs/perps/lighter-api-keys.mdso developers understand Lighter trading key slots: how signing works vs the wallet, local env setup (MM_PERPS_LIGHTER_PROVIDER_ENABLED,MM_PERPS_LIGHTER_API_KEY_INDEX, account index), one slot per device/simulator/script, curl checks for free slots, what to do when "Lighter API key slot N already contains a different key" appears, and account index behavior after testnet resets.Updates the
MM_PERPS_LIGHTER_API_KEY_INDEXcomment in.js.env.exampleto call it a Lighter trading key slot, note the controller default (7), and link to the new doc.Reviewed by Cursor Bugbot for commit ec3ad2a. Bugbot is set up for automated code reviews on this repo. Configure here.