Lighter requires the wallet to be a registered account before any trade/withdraw action.If the EOA has never deposited on Lighter, this endpoint will fail. First-time setup is a two-step prerequisite:
Deposit ≥ 5 USDC via /2/perp/payloads/deposit → Lighter creates an accountIndex on-chain once the bridge settles. (5 USDC is a Lighter requirement, not a Mobula limit.)
Read the Build Create-Account Payload page for the full setup flow including how to discover the accountIndex after a deposit.
Gains requires a one-time USDC approval per wallet. Gains’ Diamond proxy executes USDC.transferFrom(user, gainsVault, collateral) mid-trade. Without an approve(spender, …) granting it allowance, /2/perp/execute-v2 returns 400 with the on-chain revert:
ERC20: transfer amount exceeds allowance
Before the first Gains order on a wallet, send USDC.approve(payload.data.to, MaxUint256) (the spender is the to field from the build response). See Approval prerequisite in the cookbook for a copy-paste helper. Native USDC per chain — Arbitrum 0xaf88d065e77c8cC2239327C5EDb3A432268e5831, Base 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913.
Builds the canonical order payload used by /2/perp/execute-v2. The signer recovered from the signature field becomes the order’s user.
Request Body
string
required
Base token address, symbol, or Mobula asset id.
string
required
Quote token of the market. Semantics differ per DEX:
Lighter — pass the ERC-20 collateral symbol (USDC).
Gains — pass the synthetic quote (USD). Sending USDC returns "No market matching base/quote".
When unsure, pass marketId (e.g. gains-btc-usd, lighter-btc-usd) and the field is derived server-side.
number
required
Leverage multiplier (e.g., 10).
boolean
required
true for long, false for short.
boolean
required
true if the order must only reduce an existing position.
number
required
Collateral in quote units (e.g., USDC).
string
One of market, limit, stop_limit. Default market.
number
Trigger/limit price. Required for limit and stop_limit.
number
Take-profit price.
number
Stop-loss price.
number
Raw position size in base-token units. If omitted, derived from collateralAmount * leverage.
number
Max slippage in percent.
string[]
Routing hint, not a strict filter. The router prefers the requested chains but may fall back to another supported chain if the requested market is not deployed on any of them. Example: passing chainIds: ['evm:42161'] for a market that only exists on Base will silently return chainId: 'evm:8453'. Always trust the response chainId when broadcasting.Pass an explicit marketId (or rely on the response) for unambiguous routing.
string[]
Restrict routing to gains and/or lighter.
number
0 = cross, 1 = isolated (DEX-specific).
string
Referrer wallet address for fee sharing.
string
Force a specific Mobula market instead of routing.
Authentication
Every /2/perp/payloads/<action> endpoint verifies the caller by requiring two extra fields in the request body alongside the action parameters:
number
required
Unix timestamp in milliseconds. Must be within 30 seconds of server time. Older timestamps are rejected to prevent replay.
string
required
Hex signature (EIP-191 personal_sign) of the message `${endpoint}-${timestamp}`, where endpoint is the path of this endpoint without the leading slash (e.g., for this page: api/2/perp/payloads/<this-action>). The recovered signer address becomes the user for the request. Single-use — replay returns 403 signature already used.
Every /2/perp/payloads/<action> endpoint returns the same envelope shape. You pass these fields verbatim into POST /2/perp/execute-v2 to execute the action.
Top-level shape. Successful (2xx) responses return { data: { ... } }. A success: true flag is only present inside the body of execute-v2’s response, not on the payload-build endpoints. Parse defensively: read body.data, then check for the action-specific fields you need (e.g. data.payloadStr).
object
Show data
string
Canonical action name — one of withdraw, create-account, deposit, create-order, close-position, cancel-order, update-margin, edit-order.
string
gains or lighter.
string
Chain where the action lands (e.g., evm:42161, lighter:301).
string
Mobula market identifier. Present when the action targets a specific market.
string
offchain-api — server submits to the DEX off-chain API on the user’s behalf (Lighter trades, Lighter withdraw, Lighter create-account). evm-tx — server broadcasts a user-signed EVM transaction (Lighter deposit bridge route, Gains trade actions). The Gains case requires a top-level signedTx on execute-v2; the Lighter deposit case injects signed txs insidepayloadStr.
string
JSON-stringified canonical envelope. For most actions you forward this byte-for-byte into /2/perp/execute-v2. Mutations are required for: Lighter deposit (inject payload.signedTxs), Lighter withdraw (sign payload.MessageToSign → payload.L1Sig, delete MessageToSign), Lighter create-account (same as withdraw only if payload.MessageToSign is present). After mutation, re-stringify and sign execute-v2 over the new string. Never alter the envelope metadata (action, dex, chainId, transport, marketId) — execute-v2 cross-checks it.
Endpoint-specific errors
Status
message
500
could not build create-order payload — no DEX could build a payload for the given parameters
Full flow — open a position end-to-end
Single example covering both DEXes (Lighter offchain-api, Gains evm-tx). The flow branches on data.transport.
import { ethers } from 'ethers';// 1. Auth-sign + fetch the create-order payloadconst endpoint = 'api/2/perp/payloads/create-order';const ts = Date.now();const authSig = await wallet.signMessage(`${endpoint}-${ts}`);const { data } = await fetch(`https://api.mobula.io/${endpoint}`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ timestamp: ts, signature: authSig, baseToken: 'BTC', quote: 'USDC', // Lighter quote. For Gains: 'USD' (synthetic) — or omit and pass `marketId`. long: true, reduceOnly: false, leverage: 10, collateralAmount: 100, // 100 USDC of collateral orderType: 'market', maxSlippageP: 0.5, dexes: ['lighter'], // or ['gains'], or omit to let routing pick }),}).then(r => r.json());// 2. Branch on transportlet signedTx;const finalPayloadStr = data.payloadStr;if (data.transport === 'evm-tx') { // Gains: sign the single EVM tx and pass as top-level signedTx. // Read nonce / feeData from a real chain RPC — NOT an embedded-wallet // provider, which can return stale or default-to-0 nonce. const txData = JSON.parse(data.payloadStr).payload.data; const provider = new ethers.JsonRpcProvider(rpcUrlFor(txData.chainId)); const [nonce, feeData] = await Promise.all([ provider.getTransactionCount(wallet.address, 'pending'), provider.getFeeData(), ]); signedTx = await wallet.signTransaction({ to: txData.to, data: txData.callData, // calldata field is `callData`, not `data` value: txData.value ? BigInt(txData.value) : 0n, from: wallet.address, chainId: txData.chainId, nonce: txData.nonce ?? nonce, // Gains Diamond proxy under-reports estimateGas (~28 k vs ~270 k real burn); // use a floor of 1.5 M or take max(estimate * 2, 1_500_000n). gasLimit: txData.gas ? BigInt(txData.gas) : 1_500_000n, // Bump 3x to absorb base-fee drift across the build → execute roundtrip. maxFeePerGas: txData.maxFeePerGas ? BigInt(txData.maxFeePerGas) : (feeData.maxFeePerGas ?? 0n) * 3n, maxPriorityFeePerGas: txData.maxPriorityFeePerGas ? BigInt(txData.maxPriorityFeePerGas) : (feeData.maxPriorityFeePerGas ?? 0n), type: 2, });}// Lighter offchain-api: nothing to sign here// 3. Sign + submit execute-v2const execTs = Date.now();const execSig = await wallet.signMessage( `api/2/perp/execute-v2-${execTs}-${finalPayloadStr}`,);const execRes = await fetch('https://api.mobula.io/api/2/perp/execute-v2', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ action: data.action, dex: data.dex, chainId: data.chainId, marketId: data.marketId, transport: data.transport, payloadStr: finalPayloadStr, timestamp: execTs, signature: execSig, ...(signedTx && { signedTx }), }),}).then(r => r.json());
Body
application/json
timestamp
number
required
signature
string
required
baseToken
string
required
quote
string
required
leverage
number
required
long
boolean
required
reduceOnly
boolean
required
collateralAmount
number
required
orderType
enum<string>
Available options:
market,
limit,
stop_limit
openPrice
number
tp
number
sl
number
amountRaw
number
maxSlippageP
number
chainIds
string[]
dexes
enum<string>[]
Available options:
gains,
lighter
marginMode
number
referrer
string
marketId
string
Response
200 - application/json
Canonical payload envelope
success
boolean
required
data
object
required
Show child attributes
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Mobula API","colors":{"primary":"#5C7DF9","light":"#5C7DF9","dark":"#000000"},"logo":{"light":"https://mintcdn.com/mobulalabs/i4_lXsPzQR8eheLT/images/logo/light-logo.svg?fit=max\u0026auto=format\u0026n=i4_lXsPzQR8eheLT\u0026q=85\u0026s=f5099f8a6b3dd6665a32fe40d9288d81","dark":"https://mintcdn.com/mobulalabs/i4_lXsPzQR8eheLT/images/logo/dark-logo.svg?fit=max\u0026auto=format\u0026n=i4_lXsPzQR8eheLT\u0026q=85\u0026s=b1e6703d769cfe27914c2db40b46b332"},"favicon":"https://mintlify.s3.us-west-1.amazonaws.com/mobulalabs/favicon.png","api":{"openapi":["rest-api-reference/openapi.yaml"],"asyncapi":["asyncapi.yaml"]},"background":{"color":{"light":"#f5f5f5","dark":"#111524"}},"navbar":{"links":[{"href":"https://admin.mobula.io","label":"Generate free API key"}],"primary":{"type":"button","label":"Dashboard","href":"https://admin.mobula.io"}},"footer":{"socials":{"twitter":"https://x.com/mobulaio","telegram":"https://t.me/mobuladevelopers"}},"integrations":{"mixpanel":{"projectToken":"792afbf66aa630430016bdbd59c52ba7"}},"contextual":{"options":["copy","view","chatgpt","claude"],"display":"header"},"styling":{"latex":true},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"mobulalabs","hasAudioNarration":false,"actualSubdomain":"mobulalabs","customDomains":["docs.mobula.io"],"gitSource":{"type":"github","owner":"fomo-family","repo":"mobula-monorepo","deployBranch":"dev","contentDirectory":"docs/mobula-api-docs","isPrivate":true,"mountPath":"","label":"","_id":"6b10a22c9ffae5051c3f8beb"},"entitlements":{"AI_CHAT":{"status":"DISABLED"},"WEB_MCP":{"status":"DISABLED"},"NARRATION":{"status":"DISABLED"}},"buildId":"6b06f5c9c90834d233c7c690","clientVersion":"0.0.4424","searchFilterCounts":[{"language":"default","tag":"Changelog","count":105},{"language":"default","tag":"2026","count":103},{"language":"default","tag":"Chains","count":97},{"language":"default","tag":"Supported Chains","count":96},{"language":"default","tag":"Overview","count":80},{"language":"default","tag":"Data","count":70},{"language":"default","tag":"Guides","count":67},{"language":"default","tag":"Spot","count":51},{"language":"default","tag":"Streams","count":46},{"language":"default","tag":"Perps","count":26}]},"assistantConfig":{},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"starter-pricing","enabled":true,"variant":{"name":"control","enabled":true,"payload":{"type":"string","value":"control"},"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"auth-vite-origin","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"starterQuestions":[],"googleFontsInlined":false,"authValue":{"auth":{}}},"customCss":[{"filePath":"custom.css","content":"img[src*=\"util-badge\"]{width:32px;height:16px;min-width:32px;min-height:16px}"}]}
{"page":{"pagePath":"exec/perps/perp-payload-create-order","slug":"/exec/perps/perp-payload-create-order","pageMetadata":{"public":true,"title":"Build Create-Order Payload","openapi":"POST /2/perp/payloads/create-order","description":"Build a signed canonical payload to open a new perpetual position on Gains Network or Lighter. The response is submitted as-is to /2/perp/execute-v2.","href":"/exec/perps/perp-payload-create-order"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Build a signed canonical payload to open a new perpetual position on Gains Network or Lighter. The response is submitted as-is to /2/perp/execute-v2.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,li:`li`,ol:`ol`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,tbody:`tbody`,td:`td`,th:`th`,thead:`thead`,tr:`tr`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,Expandable,Heading,Note,ParamField,ResponseField,Table,Warning}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Expandable)_missingMdxReference(`Expandable`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Note)_missingMdxReference(`Note`,true);if(!ParamField)_missingMdxReference(`ParamField`,true);if(!ResponseField)_missingMdxReference(`ResponseField`,true);if(!Table)_missingMdxReference(`Table`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsxs(Warning,{children:[_jsx(_components.p,{children:_jsx(_components.strong,{children:`Lighter requires the wallet to be a registered account before any trade/withdraw action.`})}),_jsx(_components.p,{children:`If the EOA has never deposited on Lighter, this endpoint will fail. First-time setup is a two-step prerequisite:`}),_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Deposit ≥ 5 USDC`}),` via `,_jsx(_components.a,{href:`/rest-api-reference/endpoint/perp-payload-deposit`,children:_jsx(_components.code,{children:`/2/perp/payloads/deposit`})}),` → Lighter creates an `,_jsx(_components.code,{children:`accountIndex`}),` on-chain once the bridge settles. (5 USDC is a Lighter requirement, not a Mobula limit.)`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Provision API key + auth token`}),` via `,_jsx(_components.a,{href:`/rest-api-reference/endpoint/perp-payload-create-account`,children:_jsx(_components.code,{children:`/2/perp/payloads/create-account`})}),` using that `,_jsx(_components.code,{children:`accountIndex`}),`.`]}),`\n`]}),_jsxs(_components.p,{children:[`Read the `,_jsx(_components.a,{href:`/rest-api-reference/endpoint/perp-payload-create-account`,children:`Build Create-Account Payload`}),` page for the full setup flow including how to discover the `,_jsx(_components.code,{children:`accountIndex`}),` after a deposit.`]})]}),`\n`,_jsxs(Warning,{children:[_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Gains requires a one-time USDC approval per wallet.`}),` Gains’ Diamond proxy executes `,_jsx(_components.code,{children:`USDC.transferFrom(user, gainsVault, collateral)`}),` mid-trade. Without an `,_jsx(_components.code,{children:`approve(spender, …)`}),` granting it allowance, `,_jsx(_components.code,{children:`/2/perp/execute-v2`}),` returns `,_jsx(_components.code,{children:`400`}),` with the on-chain revert:`]}),_jsx(CodeBlock,{numberOfLines:`2`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`2`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`ERC20: transfer amount exceeds allowance`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),_jsxs(_components.p,{children:[`Before the first Gains order on a wallet, send `,_jsx(_components.code,{children:`USDC.approve(payload.data.to, MaxUint256)`}),` (the `,_jsx(_components.code,{children:`spender`}),` is the `,_jsx(_components.code,{children:`to`}),` field from the build response). See `,_jsx(_components.a,{href:`/cookbooks/perp-execution-flow#gains-usdc-allowance-on-the-trading-proxy`,children:`Approval prerequisite`}),` in the cookbook for a copy-paste helper. Native USDC per chain — Arbitrum `,_jsx(_components.code,{children:`0xaf88d065e77c8cC2239327C5EDb3A432268e5831`}),`, Base `,_jsx(_components.code,{children:`0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913`}),`.`]})]}),`\n`,_jsxs(_components.p,{children:[`Builds the canonical order payload used by `,_jsx(_components.code,{children:`/2/perp/execute-v2`}),`. The signer recovered from the `,_jsx(_components.code,{children:`signature`}),` field becomes the order’s `,_jsx(_components.code,{children:`user`}),`.`]}),`\n`,_jsx(Heading,{level:`3`,id:`request-body`,children:`Request Body`}),`\n`,_jsx(ParamField,{body:`baseToken`,type:`string`,required:true,id:`param-base-token`,children:_jsx(_components.p,{children:`Base token address, symbol, or Mobula asset id.`})}),`\n`,_jsxs(ParamField,{body:`quote`,type:`string`,required:true,id:`param-quote`,children:[_jsx(_components.p,{children:`Quote token of the market. Semantics differ per DEX:`}),_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Lighter`}),` — pass the ERC-20 collateral symbol (`,_jsx(_components.code,{children:`USDC`}),`).`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Gains`}),` — pass the synthetic quote (`,_jsx(_components.code,{children:`USD`}),`). Sending `,_jsx(_components.code,{children:`USDC`}),` returns `,_jsx(_components.code,{children:`\"No market matching base/quote\"`}),`.`]}),`\n`]}),_jsxs(_components.p,{children:[`When unsure, pass `,_jsx(_components.code,{children:`marketId`}),` (e.g. `,_jsx(_components.code,{children:`gains-btc-usd`}),`, `,_jsx(_components.code,{children:`lighter-btc-usd`}),`) and the field is derived server-side.`]})]}),`\n`,_jsx(ParamField,{body:`leverage`,type:`number`,required:true,id:`param-leverage`,children:_jsxs(_components.p,{children:[`Leverage multiplier (e.g., `,_jsx(_components.code,{children:`10`}),`).`]})}),`\n`,_jsx(ParamField,{body:`long`,type:`boolean`,required:true,id:`param-long`,children:_jsxs(_components.p,{children:[_jsx(_components.code,{children:`true`}),` for long, `,_jsx(_components.code,{children:`false`}),` for short.`]})}),`\n`,_jsx(ParamField,{body:`reduceOnly`,type:`boolean`,required:true,id:`param-reduce-only`,children:_jsxs(_components.p,{children:[_jsx(_components.code,{children:`true`}),` if the order must only reduce an existing position.`]})}),`\n`,_jsx(ParamField,{body:`collateralAmount`,type:`number`,required:true,id:`param-collateral-amount`,children:_jsxs(_components.p,{children:[`Collateral in `,_jsx(_components.code,{children:`quote`}),` units (e.g., USDC).`]})}),`\n`,_jsx(ParamField,{body:`orderType`,type:`string`,id:`param-order-type`,children:_jsxs(_components.p,{children:[`One of `,_jsx(_components.code,{children:`market`}),`, `,_jsx(_components.code,{children:`limit`}),`, `,_jsx(_components.code,{children:`stop_limit`}),`. Default `,_jsx(_components.code,{children:`market`}),`.`]})}),`\n`,_jsx(ParamField,{body:`openPrice`,type:`number`,id:`param-open-price`,children:_jsxs(_components.p,{children:[`Trigger/limit price. Required for `,_jsx(_components.code,{children:`limit`}),` and `,_jsx(_components.code,{children:`stop_limit`}),`.`]})}),`\n`,_jsx(ParamField,{body:`tp`,type:`number`,id:`param-tp`,children:`Take-profit price.`}),`\n`,_jsx(ParamField,{body:`sl`,type:`number`,id:`param-sl`,children:`Stop-loss price.`}),`\n`,_jsx(ParamField,{body:`amountRaw`,type:`number`,id:`param-amount-raw`,children:_jsxs(_components.p,{children:[`Raw position size in base-token units. If omitted, derived from `,_jsx(_components.code,{children:`collateralAmount * leverage`}),`.`]})}),`\n`,_jsx(ParamField,{body:`maxSlippageP`,type:`number`,id:`param-max-slippage-p`,children:`Max slippage in percent.`}),`\n`,_jsxs(ParamField,{body:`chainIds`,type:`string[]`,id:`param-chain-ids`,children:[_jsxs(_components.p,{children:[`Routing `,_jsx(_components.strong,{children:`hint`}),`, not a strict filter. The router prefers the requested chains but may fall back to another supported chain if the requested market is not deployed on any of them. Example: passing `,_jsx(_components.code,{children:`chainIds: ['evm:42161']`}),` for a market that only exists on Base will silently return `,_jsx(_components.code,{children:`chainId: 'evm:8453'`}),`. `,_jsxs(_components.strong,{children:[`Always trust the response `,_jsx(_components.code,{children:`chainId`})]}),` when broadcasting.`]}),_jsxs(_components.p,{children:[`Pass an explicit `,_jsx(_components.code,{children:`marketId`}),` (or rely on the response) for unambiguous routing.`]})]}),`\n`,_jsxs(ParamField,{body:`dexes`,type:`string[]`,id:`param-dexes`,children:[`Restrict routing to `,_jsx(_components.code,{children:`gains`}),` and/or `,_jsx(_components.code,{children:`lighter`}),`.`]}),`\n`,_jsxs(ParamField,{body:`marginMode`,type:`number`,id:`param-margin-mode`,children:[_jsx(_components.code,{children:`0`}),` = cross, `,_jsx(_components.code,{children:`1`}),` = isolated (DEX-specific).`]}),`\n`,_jsx(ParamField,{body:`referrer`,type:`string`,id:`param-referrer`,children:`Referrer wallet address for fee sharing.`}),`\n`,_jsx(ParamField,{body:`marketId`,type:`string`,id:`param-market-id`,children:`Force a specific Mobula market instead of routing.`}),`\n`,_jsx(Heading,{level:`3`,id:`authentication`,children:`Authentication`}),`\n`,_jsxs(_components.p,{children:[`Every `,_jsx(_components.code,{children:`/2/perp/payloads/\u003caction>`}),` endpoint verifies the caller by requiring two extra fields in the request body alongside the action parameters:`]}),`\n`,_jsx(ParamField,{body:`timestamp`,type:`number`,required:true,id:`param-timestamp`,children:_jsx(_components.p,{children:`Unix timestamp in milliseconds. Must be within 30 seconds of server time. Older timestamps are rejected to prevent replay.`})}),`\n`,_jsx(ParamField,{body:`signature`,type:`string`,required:true,id:`param-signature`,children:_jsxs(_components.p,{children:[`Hex signature (EIP-191 `,_jsx(_components.code,{children:`personal_sign`}),`) of the message `,_jsx(_components.code,{children:\"`${endpoint}-${timestamp}`\"}),`, where `,_jsx(_components.code,{children:`endpoint`}),` is the path `,_jsx(_components.strong,{children:`of this endpoint`}),` without the leading slash (e.g., for this page: `,_jsx(_components.code,{children:`api/2/perp/payloads/\u003cthis-action>`}),`). The recovered signer address becomes the `,_jsx(_components.code,{children:`user`}),` for the request. Single-use — replay returns `,_jsx(_components.code,{children:`403 signature already used`}),`.`]})}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`14`,language:`javascript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`javascript`,children:_jsxs(_components.code,{language:`javascript`,numberOfLines:`14`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:\"// Replace `\u003caction>` with the action of THIS page (e.g. create-account, deposit, …)\"})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` endpoint`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'api/2/perp/payloads/\u003caction>'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` timestamp`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` Date`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`now`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`();`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` signature`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` wallet`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`signMessage`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\"`\"}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:\"${\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`endpoint`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`-`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:\"${\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`timestamp`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\"`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` fetch`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\"`https://api.mobula.io/\"}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:\"${\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`endpoint`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\"`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` method:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'POST'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` headers:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'Content-Type'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'application/json'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` body:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` JSON`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`stringify`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` timestamp`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` signature`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // ...action-specific fields below`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }),`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`authentication-errors`,children:`Authentication errors`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Status`}),_jsx(_components.th,{children:_jsx(_components.code,{children:`message`})})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{\"data-numeric\":`true`,children:`403`}),_jsxs(_components.td,{children:[_jsx(_components.code,{children:`timestamp expired`}),` — timestamp older than 30s`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{\"data-numeric\":`true`,children:`403`}),_jsxs(_components.td,{children:[_jsx(_components.code,{children:`signature already used`}),` — replay attempt`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{\"data-numeric\":`true`,children:`400`}),_jsxs(_components.td,{children:[_jsx(_components.code,{children:`zod validation failed`}),` — `,_jsx(_components.code,{children:`timestamp`}),`/`,_jsx(_components.code,{children:`signature`}),` shape invalid`]})]})]})]}),`\n`,_jsx(Heading,{level:`3`,id:`response-envelope`,children:`Response envelope`}),`\n`,_jsxs(_components.p,{children:[`Every `,_jsx(_components.code,{children:`/2/perp/payloads/\u003caction>`}),` endpoint returns the same envelope shape. You pass these fields verbatim into `,_jsx(_components.code,{children:`POST /2/perp/execute-v2`}),` to execute the action.`]}),`\n`,_jsx(Note,{children:_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Top-level shape.`}),` Successful (2xx) responses return `,_jsx(_components.code,{children:`{ data: { ... } }`}),`. A `,_jsx(_components.code,{children:`success: true`}),` flag is only present inside the body of `,_jsx(_components.code,{children:`execute-v2`}),`’s response, not on the payload-build endpoints. Parse defensively: read `,_jsx(_components.code,{children:`body.data`}),`, then check for the action-specific fields you need (e.g. `,_jsx(_components.code,{children:`data.payloadStr`}),`).`]})}),`\n`,_jsx(ResponseField,{name:`data`,type:`object`,id:`param-data`,children:_jsxs(Expandable,{title:`data`,children:[_jsx(ResponseField,{name:`action`,type:`string`,id:`param-action`,children:_jsxs(_components.p,{children:[`Canonical action name — one of `,_jsx(_components.code,{children:`withdraw`}),`, `,_jsx(_components.code,{children:`create-account`}),`, `,_jsx(_components.code,{children:`deposit`}),`, `,_jsx(_components.code,{children:`create-order`}),`, `,_jsx(_components.code,{children:`close-position`}),`, `,_jsx(_components.code,{children:`cancel-order`}),`, `,_jsx(_components.code,{children:`update-margin`}),`, `,_jsx(_components.code,{children:`edit-order`}),`.`]})}),_jsxs(ResponseField,{name:`dex`,type:`string`,id:`param-dex`,children:[_jsx(_components.code,{children:`gains`}),` or `,_jsx(_components.code,{children:`lighter`}),`.`]}),_jsxs(ResponseField,{name:`chainId`,type:`string`,id:`param-chain-id`,children:[`Chain where the action lands (e.g., `,_jsx(_components.code,{children:`evm:42161`}),`, `,_jsx(_components.code,{children:`lighter:301`}),`).`]}),_jsx(ResponseField,{name:`marketId`,type:`string`,id:`param-market-id-1`,children:`Mobula market identifier. Present when the action targets a specific market.`}),_jsx(ResponseField,{name:`transport`,type:`string`,id:`param-transport`,children:_jsxs(_components.p,{children:[_jsx(_components.code,{children:`offchain-api`}),` — server submits to the DEX off-chain API on the user’s behalf (Lighter trades, Lighter `,_jsx(_components.code,{children:`withdraw`}),`, Lighter `,_jsx(_components.code,{children:`create-account`}),`).`,_jsx(`br`,{}),`\n`,_jsx(_components.code,{children:`evm-tx`}),` — server broadcasts a user-signed EVM transaction (Lighter `,_jsx(_components.code,{children:`deposit`}),` bridge route, Gains trade actions). The Gains case requires a top-level `,_jsx(_components.code,{children:`signedTx`}),` on execute-v2; the Lighter `,_jsx(_components.code,{children:`deposit`}),` case injects signed txs `,_jsx(_components.strong,{children:`inside`}),` `,_jsx(_components.code,{children:`payloadStr`}),`.`]})}),_jsx(ResponseField,{name:`payloadStr`,type:`string`,id:`param-payload-str`,children:_jsxs(_components.p,{children:[`JSON-stringified canonical envelope. For most actions you forward this byte-for-byte into `,_jsx(_components.code,{children:`/2/perp/execute-v2`}),`. Mutations are required for: Lighter `,_jsx(_components.code,{children:`deposit`}),` (inject `,_jsx(_components.code,{children:`payload.signedTxs`}),`), Lighter `,_jsx(_components.code,{children:`withdraw`}),` (sign `,_jsx(_components.code,{children:`payload.MessageToSign`}),` → `,_jsx(_components.code,{children:`payload.L1Sig`}),`, delete `,_jsx(_components.code,{children:`MessageToSign`}),`), Lighter `,_jsx(_components.code,{children:`create-account`}),` (same as `,_jsx(_components.code,{children:`withdraw`}),` only if `,_jsx(_components.code,{children:`payload.MessageToSign`}),` is present). After mutation, re-stringify and sign execute-v2 over the `,_jsx(_components.strong,{children:`new`}),` string. Never alter the envelope metadata (`,_jsx(_components.code,{children:`action`}),`, `,_jsx(_components.code,{children:`dex`}),`, `,_jsx(_components.code,{children:`chainId`}),`, `,_jsx(_components.code,{children:`transport`}),`, `,_jsx(_components.code,{children:`marketId`}),`) — execute-v2 cross-checks it.`]})})]})}),`\n`,_jsx(Heading,{level:`3`,id:`endpoint-specific-errors`,children:`Endpoint-specific errors`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Status`}),_jsx(_components.th,{children:_jsx(_components.code,{children:`message`})})]})}),_jsx(_components.tbody,{children:_jsxs(_components.tr,{children:[_jsx(_components.td,{\"data-numeric\":`true`,children:`500`}),_jsxs(_components.td,{children:[_jsx(_components.code,{children:`could not build create-order payload`}),` — no DEX could build a payload for the given parameters`]})]})})]}),`\n`,_jsx(Heading,{level:`3`,id:`full-flow-—-open-a-position-end-to-end`,children:`Full flow — open a position end-to-end`}),`\n`,_jsxs(_components.p,{children:[`Single example covering both DEXes (Lighter offchain-api, Gains evm-tx). The flow branches on `,_jsx(_components.code,{children:`data.transport`}),`.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`83`,language:`javascript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`javascript`,children:_jsxs(_components.code,{language:`javascript`,numberOfLines:`83`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`ethers`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'ethers'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// 1. Auth-sign + fetch the create-order payload`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` endpoint`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'api/2/perp/payloads/create-order'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` ts`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` Date`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`now`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`();`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` authSig`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` wallet`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`signMessage`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\"`\"}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:\"${\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`endpoint`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`-`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:\"${\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`ts`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\"`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`data`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` fetch`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\"`https://api.mobula.io/\"}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:\"${\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`endpoint`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\"`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` method:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'POST'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` headers:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'Content-Type'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'application/json'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` body:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` JSON`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`stringify`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` timestamp:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` ts`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` signature:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` authSig`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` baseToken:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'BTC'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` quote:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'USDC'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:\"// Lighter quote. For Gains: 'USD' (synthetic) — or omit and pass `marketId`.\"})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` long:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` true`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` reduceOnly:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` false`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` leverage:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 10`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` collateralAmount:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 100`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// 100 USDC of collateral`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` orderType:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'market'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` maxSlippageP:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 0.5`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` dexes:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'lighter'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`], `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// or ['gains'], or omit to let routing pick`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }),`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}).`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`then`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`r`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` =>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` r`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`json`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`());`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// 2. Branch on transport`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`let`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` signedTx`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` finalPayloadStr`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` data`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`payloadStr`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`data`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`transport`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` ===`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'evm-tx'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) {`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // Gains: sign the single EVM tx and pass as top-level signedTx.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // Read nonce / feeData from a real chain RPC — NOT an embedded-wallet`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // provider, which can return stale or default-to-0 nonce.`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` txData`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` JSON`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`parse`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`data`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`payloadStr`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`).`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`payload`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`data`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` provider`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` new`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` ethers`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`JsonRpcProvider`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`rpcUrlFor`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`txData`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`chainId`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`));`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` [`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`nonce`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`feeData`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`] `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` Promise`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`all`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`([`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` provider`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`getTransactionCount`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`wallet`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`address`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'pending'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`),`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` provider`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`getFeeData`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(),`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ]);`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` signedTx`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` wallet`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`signTransaction`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` to:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` txData`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`to`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` data:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` txData`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`callData`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:\"// calldata field is `callData`, not `data`\"})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` value:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` txData`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`value`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` ?`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` BigInt`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`txData`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`value`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 0`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`n`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` from:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` wallet`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`address`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` chainId:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` txData`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`chainId`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` nonce:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` txData`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`nonce`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` ??`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` nonce`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // Gains Diamond proxy under-reports estimateGas (~28 k vs ~270 k real burn);`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // use a floor of 1.5 M or take max(estimate * 2, 1_500_000n).`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` gasLimit:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` txData`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`gas`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` ?`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` BigInt`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`txData`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`gas`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 1_500_000`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`n`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // Bump 3x to absorb base-fee drift across the build → execute roundtrip.`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` maxFeePerGas:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` txData`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`maxFeePerGas`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` ?`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` BigInt`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`txData`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`maxFeePerGas`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` :`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`feeData`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`maxFeePerGas`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` ??`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 0`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`n`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`*`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 3`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`n`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` maxPriorityFeePerGas:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` txData`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`maxPriorityFeePerGas`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` ?`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` BigInt`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`txData`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`maxPriorityFeePerGas`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` :`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`feeData`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`maxPriorityFeePerGas`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` ??`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 0`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`n`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`),`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` type:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 2`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` });`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// Lighter offchain-api: nothing to sign here`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// 3. Sign + submit execute-v2`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` execTs`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` Date`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`now`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`();`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` execSig`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` wallet`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`signMessage`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\" `api/2/perp/execute-v2-\"}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:\"${\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`execTs`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`-`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:\"${\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`finalPayloadStr`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\"`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` execRes`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` fetch`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'https://api.mobula.io/api/2/perp/execute-v2'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` method:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'POST'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` headers:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'Content-Type'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'application/json'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` body:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` JSON`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`stringify`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` action:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` data`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`action`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` dex:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` data`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`dex`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` chainId:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` data`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`chainId`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` marketId:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` data`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`marketId`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` transport:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` data`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`transport`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` payloadStr:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` finalPayloadStr`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` timestamp:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` execTs`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` signature:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` execSig`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` ...`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`signedTx`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` \u0026\u0026`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`signedTx`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }),`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }),`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}).`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`then`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`r`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` =>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` r`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`json`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`());`})]}),`\n`]})})})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"public":true,"title":"Build Create-Order Payload","openapi":"POST /2/perp/payloads/create-order","description":"Build a signed canonical payload to open a new perpetual position on Gains Network or Lighter. The response is submitted as-is to /2/perp/execute-v2.","href":"/exec/perps/perp-payload-create-order"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Request Body","slug":"request-body","depth":3,"children":[]},{"title":"Authentication","slug":"authentication","depth":3,"children":[]},{"title":"Authentication errors","slug":"authentication-errors","depth":3,"children":[]},{"title":"Response envelope","slug":"response-envelope","depth":3,"children":[]},{"title":"Endpoint-specific errors","slug":"endpoint-specific-errors","depth":3,"children":[]},{"title":"Full flow — open a position end-to-end","slug":"full-flow-—-open-a-position-end-to-end","depth":3,"children":[]}],"codeExamples":{}},"jsLinks":[],"openApiReferenceData":{"operation":{"tags":["V2 - Perps"],"summary":"Build create-order payload","description":"Build a signed canonical payload to open a new perpetual position on Gains Network or Lighter. The response is submitted as-is to /2/perp/execute-v2.","requestBody":"0ab14bc3-e1ec-4a93-ba9b-861c14dbdde0","responses":{"200":"7f5b241e-bba0-4fa6-96cd-3b2e89e4db1c"},"method":"post","type":"path","servers":["c25b9009-8f4e-492f-b743-eb62a864816a","34680ce8-88e4-4b86-942f-2cc9fb5ef9e7"],"security":[],"path":"/2/perp/payloads/create-order","baseUrlOptions":["https://demo-api.mobula.io/api/","https://api.mobula.io/api/"],"title":"Build create-order payload","codeSamples":[],"requiredOnlyExamples":false,"requestExampleType":"generated","responseExampleType":"generated"},"dependencies":{"parameters":{},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"timestamp":{"type":"number","isRequired":true,"uniqueKey":"timestamp","typeLabel":"number"},"signature":{"type":"string","isRequired":true,"uniqueKey":"signature","typeLabel":"string"},"baseToken":{"type":"string","isRequired":true,"uniqueKey":"baseToken","typeLabel":"string"},"quote":{"type":"string","isRequired":true,"uniqueKey":"quote","typeLabel":"string"},"leverage":{"type":"number","isRequired":true,"uniqueKey":"leverage","typeLabel":"number"},"long":{"type":"boolean","isRequired":true,"uniqueKey":"long","typeLabel":"boolean"},"reduceOnly":{"type":"boolean","isRequired":true,"uniqueKey":"reduceOnly","typeLabel":"boolean"},"collateralAmount":{"type":"number","isRequired":true,"uniqueKey":"collateralAmount","typeLabel":"number"},"orderType":{"type":"string","enum":["market","limit","stop_limit"],"uniqueKey":"orderType","typeLabel":"enum\u003cstring>"},"openPrice":{"type":"number","uniqueKey":"openPrice","typeLabel":"number"},"tp":{"type":"number","uniqueKey":"tp","typeLabel":"number"},"sl":{"type":"number","uniqueKey":"sl","typeLabel":"number"},"amountRaw":{"type":"number","uniqueKey":"amountRaw","typeLabel":"number"},"maxSlippageP":{"type":"number","uniqueKey":"maxSlippageP","typeLabel":"number"},"chainIds":{"type":"array","items":{"type":"string","uniqueKey":"chainIds.items.[INDEX]","typeLabel":"string"},"uniqueKey":"chainIds","typeLabel":"string[]"},"dexes":{"type":"array","items":{"type":"string","enum":["gains","lighter"],"uniqueKey":"dexes.items.[INDEX]","typeLabel":"enum\u003cstring>"},"uniqueKey":"dexes","typeLabel":"enum\u003cstring>[]"},"marginMode":{"type":"number","uniqueKey":"marginMode","typeLabel":"number"},"referrer":{"type":"string","uniqueKey":"referrer","typeLabel":"string"},"marketId":{"type":"string","uniqueKey":"marketId","typeLabel":"string"}},"required":["timestamp","signature","baseToken","quote","leverage","long","reduceOnly","collateralAmount"],"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"timestamp":123,"signature":"\u003cstring>","baseToken":"\u003cstring>","quote":"\u003cstring>","leverage":123,"long":true,"reduceOnly":true,"collateralAmount":123,"openPrice":123,"tp":123,"sl":123,"amountRaw":123,"maxSlippageP":123,"chainIds":["\u003cstring>"],"dexes":[],"marginMode":123,"referrer":"\u003cstring>","marketId":"\u003cstring>"}}},"exampleType":"generated"}},"exampleType":"generated"},"responses":{"7f5b241e-bba0-4fa6-96cd-3b2e89e4db1c":{"description":"Canonical payload envelope","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","isRequired":true,"uniqueKey":"success","typeLabel":"boolean"},"data":{"type":"object","properties":{"action":{"type":"string","isRequired":true,"uniqueKey":"data.action","typeLabel":"string"},"dex":{"type":"string","isRequired":true,"uniqueKey":"data.dex","typeLabel":"string"},"chainId":{"type":"string","isRequired":true,"uniqueKey":"data.chainId","typeLabel":"string"},"transport":{"type":"string","enum":["offchain-api","evm-tx"],"isRequired":true,"uniqueKey":"data.transport","typeLabel":"enum\u003cstring>"},"payloadStr":{"type":"string","isRequired":true,"uniqueKey":"data.payloadStr","typeLabel":"string"},"marketId":{"type":"string","uniqueKey":"data.marketId","typeLabel":"string"}},"required":["action","dex","chainId","transport","payloadStr"],"isRequired":true,"uniqueKey":"data","typeLabel":"object"}},"required":["success","data"],"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"success":true,"data":{"action":"\u003cstring>","dex":"\u003cstring>","chainId":"\u003cstring>","transport":"offchain-api","payloadStr":"\u003cstring>","marketId":"\u003cstring>"}}}},"exampleType":"generated"}},"exampleType":"generated"}},"security":{},"servers":{"c25b9009-8f4e-492f-b743-eb62a864816a":{"url":"https://demo-api.mobula.io/api/","description":"Demo API (rate limited, for testing only)"},"34680ce8-88e4-4b86-942f-2cc9fb5ef9e7":{"url":"https://api.mobula.io/api/","description":"Production API (requires API key)"}}},"originalFileLocation":"rest-api-reference/openapi.yaml"},"subdomain":"docs.mobula.io","siteName":"Mobula API","title":"Build Create-Order Payload - Mobula API","contextualStarterQuestions":[],"navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-11-14T12:21:07.536Z","originalFileLocation":"exec/perps/perp-payload-create-order.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Build a signed canonical payload to open a new perpetual position on Gains Network or Lighter. The response is submitted as-is to /2/perp/execute-v2.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Mobula API\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/mobulalabs/HNvOu2NIIIAI8gec/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/mobulalabs/HNvOu2NIIIAI8gec/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/mobulalabs/HNvOu2NIIIAI8gec/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/mobulalabs/HNvOu2NIIIAI8gec/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/mobulalabs/HNvOu2NIIIAI8gec/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/mobulalabs/HNvOu2NIIIAI8gec/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/mobulalabs/HNvOu2NIIIAI8gec/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/mobulalabs/HNvOu2NIIIAI8gec/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/mobulalabs/HNvOu2NIIIAI8gec/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Build Create-Order Payload - Mobula API\">\u003cmeta data-mint-head property=\"og:description\" content=\"Build a signed canonical payload to open a new perpetual position on Gains Network or Lighter. The response is submitted as-is to /2/perp/execute-v2.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Mobula API\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.mobula.io/exec/perps/perp-payload-create-order\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://mobulalabs.mintlify.io/_mintlify/api/og/v2?division=Execution\u0026amp;title=Build+Create-Order+Payload\u0026amp;description=Build+a+signed+canonical+payload+to+open+a+new+perpetual+position+on+Gains+Network+or+Lighter.+The+response+is+submitted+as-is+to+%2F2%2Fperp%2Fexecute-v2.\u0026amp;theme=b31399aac8a2a0583f71b753\u0026amp;signature=5f4785dc03b72920fecda1f47a458085f9b0fd3137bb700118d8a892760c547e\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Build Create-Order Payload - Mobula API\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Build a signed canonical payload to open a new perpetual position on Gains Network or Lighter. The response is submitted as-is to /2/perp/execute-v2.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://mobulalabs.mintlify.io/_mintlify/api/og/v2?division=Execution\u0026amp;title=Build+Create-Order+Payload\u0026amp;description=Build+a+signed+canonical+payload+to+open+a+new+perpetual+position+on+Gains+Network+or+Lighter.+The+response+is+submitted+as-is+to+%2F2%2Fperp%2Fexecute-v2.\u0026amp;theme=b31399aac8a2a0583f71b753\u0026amp;signature=5f4785dc03b72920fecda1f47a458085f9b0fd3137bb700118d8a892760c547e\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/mobulalabs/HNvOu2NIIIAI8gec/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Mobula API\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#5C7DF9\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.mobula.io/exec/perps/perp-payload-create-order\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/exec/perps/perp-payload-create-order.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.mobula.io/#organization\",\"name\":\"Mobula API\",\"url\":\"https://docs.mobula.io\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/mobulalabs/i4_lXsPzQR8eheLT/images/logo/light-logo.svg?fit=max\u0026auto=format\u0026n=i4_lXsPzQR8eheLT\u0026q=85\u0026s=f5099f8a6b3dd6665a32fe40d9288d81\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.mobula.io#website\",\"name\":\"Mobula API\",\"url\":\"https://docs.mobula.io\",\"publisher\":{\"@id\":\"https://docs.mobula.io/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.mobula.io/exec/perps/perp-payload-create-order#webpage\",\"url\":\"https://docs.mobula.io/exec/perps/perp-payload-create-order\",\"name\":\"Build Create-Order Payload\",\"description\":\"Build a signed canonical payload to open a new perpetual position on Gains Network or Lighter. The response is submitted as-is to /2/perp/execute-v2.\",\"dateModified\":\"2026-11-14T12:21:07.536Z\",\"isPartOf\":{\"@id\":\"https://docs.mobula.io#website\"},\"breadcrumb\":{\"@id\":\"https://docs.mobula.io/exec/perps/perp-payload-create-order#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.mobula.io/exec/perps/perp-payload-create-order#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Execution\",\"item\":\"https://docs.mobula.io/exec/perps/perp-quote\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Build Create-Order Payload\",\"item\":\"https://docs.mobula.io/exec/perps/perp-payload-create-order\"}]},{\"@type\":[\"TechArticle\",\"APIReference\"],\"@id\":\"https://docs.mobula.io/exec/perps/perp-payload-create-order#apireference\",\"headline\":\"Build Create-Order Payload\",\"name\":\"Build Create-Order Payload\",\"description\":\"Build a signed canonical payload to open a new perpetual position on Gains Network or Lighter. The response is submitted as-is to /2/perp/execute-v2.\",\"url\":\"https://docs.mobula.io/exec/perps/perp-payload-create-order\",\"mainEntityOfPage\":{\"@id\":\"https://docs.mobula.io/exec/perps/perp-payload-create-order#webpage\"},\"dateModified\":\"2026-11-14T12:21:07.536Z\",\"publisher\":{\"@id\":\"https://docs.mobula.io/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.mobula.io#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Mobula API\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"Mobula API\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/exec/perps/perp-payload-create-order.md","siteName":"Mobula API","nav":{"global":null,"tabs":[{"tab":"Overview","pages":[{"title":"Overview","href":"/introduction"}]},{"tab":"Data","pages":[{"title":"Data","href":"/data-introduction"}]},{"tab":"Streams","pages":[{"title":"Streams","href":"/indexing-stream/stream-introduction"}]},{"tab":"Spot","pages":[{"title":"Spot","href":"/spot-introduction"}]},{"tab":"Perps","groups":[{"group":"Introduction","pages":[{"title":"Perpetuals APIs","icon":"chart-mixed","href":"/perps-introduction"},{"title":"Perp Fees","sidebarTitle":"Fees","icon":"coins","href":"/perps-fees"}]},{"group":"Data","pages":[{"title":"Get Perp Pairs","openapi":"GET /2/perp/pairs","href":"/data/perps/perp-pairs"},{"title":"Get Perp Positions","openapi":"GET /2/wallet/positions/perp/open","href":"/data/perps/wallet-perp-positions"},{"title":"Get Perp Unfilled Orders","openapi":"GET /2/wallet/positions/perp/unfilled","href":"/data/perps/wallet-perp-orders"},{"title":"Get Funding Rate","openapi":"get /1/market/cefi/funding-rate","href":"/data/perps/market-cefi-funding-rate"},{"title":"Get Perp Chart","openapi":"GET /2/perp/ohlcv-history","href":"/data/perps/perp-chart"},{"title":"Generate Perp Chart Image","openapi":"POST /2/perp/chart","href":"/data/perps/perp-chart-image"},{"title":"Get Perp DEX Status","openapi":"GET /2/perp/dex-status","href":"/data/perps/perp-dex-status"}]},{"group":"Execution","pages":[{"title":"Get Perp Quote","openapi":"POST /2/perp/quote","href":"/exec/perps/perp-quote"},{"title":"Build Create-Account Payload","openapi":"POST /2/perp/payloads/create-account","href":"/exec/perps/perp-payload-create-account"},{"title":"Build Deposit Payload","openapi":"POST /2/perp/payloads/deposit","href":"/exec/perps/perp-payload-deposit"},{"title":"Build Withdraw Payload","openapi":"POST /2/perp/payloads/withdraw","description":"Build a signed canonical payload to withdraw USDC collateral from a perpetual DEX account back to the user's wallet.","href":"/exec/perps/perp-payload-withdraw"},{"public":true,"title":"Build Create-Order Payload","openapi":"POST /2/perp/payloads/create-order","href":"/exec/perps/perp-payload-create-order"},{"title":"Build Close-Position Payload","openapi":"POST /2/perp/payloads/close-position","description":"Build a signed canonical payload to close (fully or partially) an open perpetual position on Gains Network or Lighter.","href":"/exec/perps/perp-payload-close-position"},{"title":"Build Cancel-Order Payload","openapi":"POST /2/perp/payloads/cancel-order","href":"/exec/perps/perp-payload-cancel-order"},{"title":"Build Edit-Order Payload","openapi":"POST /2/perp/payloads/edit-order","href":"/exec/perps/perp-payload-edit-order"},{"title":"Build Update-Margin Payload","openapi":"POST /2/perp/payloads/update-margin","href":"/exec/perps/perp-payload-update-margin"},{"title":"Execute Perp Action","openapi":"POST /2/perp/execute-v2","href":"/exec/perps/perp-execute"},{"title":"Check Perp Process","openapi":"GET /2/perp/check-process","href":"/exec/perps/perp-check-process"}]},{"group":"Cookbook","pages":[{"title":"Execute Perp Trades End-to-End","href":"/cookbooks/perp-execution-flow"},{"title":"Retrieve All Perp Markets","href":"/cookbooks/retrieve-perp-markets"}]},{"group":"Streams","pages":[{"title":"Perp Positions Stream","asyncapi":"streams/asyncapi.yaml perpPositions","href":"/streams/wss-perp-positions"},{"title":"Perp Events Stream","asyncapi":"streams/asyncapi.yaml perpEvents","href":"/streams/wss-perp-events"},{"title":"Funding Stream","asyncapi":"streams/asyncapi.yaml funding","href":"/streams/wss-funding"}]},{"group":"Reference","pages":[{"title":"Perpetuals (Perps)","href":"/indexing-stream/stream/data-model/perps-data-model"}]}]},{"tab":"Chains","pages":[{"title":"Chains","href":"/blockchains/intro-blockchains"}]},{"tab":"Cookbooks","pages":[{"title":"Cookbooks","href":"/cookbooks/introduction"}]},{"tab":"Almanac","pages":[{"title":"Almanac","href":"/almanac/understanding-trade-fees"}]},{"tab":"Changelog","pages":[{"title":"Changelog","href":"/changelog/introduction"}]}]},"basePath":"","title":"Build Create-Order Payload - Mobula API","deploymentId":"dpl_DCQc66XHNxkoUwtUo4heUXG9JN3R","buildId":"dpl_DCQc66XHNxkoUwtUo4heUXG9JN3R","dynamics":["c2aa737661","2b790eda92","b0f84f53ff","a9bb46feb3"],"chunks":["OpenApiReferenceProvider-B00R6m2w.js","snippetPresets-CqLrAt3u.js","utils-C6SyY4vr.js","style-to-object-BY3JEAdk.js","utils-DcM7X3d8.js","v4-DIgz8zy6.js","addTypeLabelsToSchema-wg6O_GGT.js","conditional-requirements-CFM0id0Q.js","cloneDeep-D1M_mEva.js","_Uint8Array-4XVPvAlA.js","isObject-FP1Yky1u.js","ApiExamples-Bnkv8klP.js","usePlaygroundInputsStore-CdxKaS-b.js","shallow-Dpku_zG5.js","isEqual-CVatu-Y4.js","CodeSnippets-C8QOaQsB.js","CodeSnippet-BI8c3Wcx.js","use-playground-group-access-BlXnD1_t.js","Page-DX7PVqUY.js","api-description-markdown-DyQ5oUAN.js","DynamicMarkdown-Dlqtvbwe.js","SectionHeading-CawHzc2U.js","MethodPill-CWsLcBdE.js","getPastedJson-DbC5ZvdO.js","Check2Icon-CeU_Q_BR.js","axios-CsQoIw0U.js","Markdown-UXPM-iKA.js","AssistantPageLink-DzGY38qP.js","dist-BqIp7CX0.js","lib-DMeTj1gb.js","lib-B8HbPgcC.js","katex-Dbtb6Wk7.js","html-void-elements-mCSPHezU.js","marked.esm-CZWythHk.js"]}