{"openapi":"3.1.0","info":{"title":"RailX API","version":"0.4.0","description":"V0 developer API for canonical Robinhood Chain assets, normalized prices, portfolio context, quotes, transaction plans, and simulation. Test-environment keys are served by a deterministic sandbox. Every response to an admitted request includes environment, plan, minute-limit, and monthly-allowance headers."},"servers":[{"url":"/api/v0"}],"security":[{"bearerAuth":[]}],"tags":[{"name":"System"},{"name":"Assets"},{"name":"Prices"},{"name":"Corporate actions"},{"name":"Portfolios"},{"name":"Quotes"},{"name":"Trades"},{"name":"Simulation"}],"paths":{"/":{"get":{"operationId":"getIndex","tags":["System"],"summary":"Read API identity and the endpoint map","security":[],"responses":{"200":{"description":"API index","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IndexEnvelope"}}}}},"x-railx-contract":{"status":200}}},"/health":{"get":{"operationId":"getHealth","tags":["System"],"summary":"Read service and upstream configuration status","security":[],"responses":{"200":{"description":"Health report","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HealthEnvelope"}}}}},"x-railx-contract":{"status":200}}},"/assets":{"get":{"operationId":"listAssets","tags":["Assets"],"summary":"List canonical market assets","parameters":[{"name":"status","in":"query","schema":{"enum":["active","inactive","all"]}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":250}},{"name":"after","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"Asset page","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssetListEnvelope"}}}},"400":{"description":"Structured failure","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"x-railx-contract":{"status":200,"scope":"market:read","query":{"limit":2}}}},"/assets/{symbol}":{"get":{"operationId":"getAsset","tags":["Assets"],"summary":"Resolve a symbol to its canonical asset","parameters":[{"name":"symbol","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Canonical asset","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssetEnvelope"}}}},"404":{"description":"Structured failure","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"x-railx-contract":{"status":200,"scope":"market:read","path":{"symbol":"NVDA"}}}},"/prices/{symbol}":{"get":{"operationId":"getPrice","tags":["Prices"],"summary":"Get raw-underlying and multiplier-adjusted token prices","parameters":[{"name":"symbol","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Price observation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PriceEnvelope"}}}},"404":{"description":"Structured failure","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"x-railx-contract":{"status":200,"scope":"market:read","path":{"symbol":"NVDA"}}}},"/corporate-actions":{"get":{"operationId":"listCorporateActions","tags":["Corporate actions"],"summary":"List normalized Robinhood Stock Token corporate actions","parameters":[{"name":"symbol","in":"query","schema":{"type":"string"}},{"name":"type","in":"query","schema":{"$ref":"#/components/schemas/CorporateActionType"}},{"name":"status","in":"query","schema":{"$ref":"#/components/schemas/CorporateActionStatus"}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":250}}],"responses":{"200":{"description":"Corporate action list","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CorporateActionListEnvelope"}}}},"400":{"description":"Structured failure","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"x-railx-contract":{"status":200,"scope":"market:read","query":{"symbol":"NVDA","limit":10}}}},"/portfolios/{wallet}":{"get":{"operationId":"getPortfolio","tags":["Portfolios"],"summary":"Read native and ERC-20 balances for a wallet","parameters":[{"name":"wallet","in":"path","required":true,"schema":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$"}},{"name":"symbols","in":"query","schema":{"type":"string"}},{"name":"includeZero","in":"query","schema":{"type":"boolean"}}],"responses":{"200":{"description":"Portfolio","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PortfolioEnvelope"}}}},"400":{"description":"Structured failure","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"x-railx-contract":{"status":200,"scope":"portfolio:read","path":{"wallet":"0x0000000000000000000000000000000000000001"},"query":{"symbols":"USDG,NVDA"}}}},"/quotes":{"post":{"operationId":"createQuote","tags":["Quotes"],"summary":"Request an exact-input or exact-output Uniswap quote","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TradeRequest"}}}},"responses":{"200":{"description":"Normalized quote","content":{"application/json":{"schema":{"$ref":"#/components/schemas/QuoteEnvelope"}}}},"400":{"description":"Structured failure","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"Structured failure","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"x-railx-contract":{"status":200,"scope":"trade:plan","body":{"wallet":"0x0000000000000000000000000000000000000001","intent":{"type":"exact_output","tokenIn":"USDG","tokenOut":"NVDA","amountOut":"2"}}}}},"/trades/plan":{"post":{"operationId":"createTradePlan","tags":["Trades"],"summary":"Build, order, and simulate unsigned trade transactions","parameters":[{"name":"Idempotency-Key","in":"header","required":false,"description":"A 16–128 character URL-safe key. Reusing it with the same request returns the original plan; reusing it with a different request returns 409.","schema":{"type":"string","minLength":16,"maxLength":128,"pattern":"^[A-Za-z0-9._~-]+$"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TradeRequest"}}}},"responses":{"201":{"description":"Trade plan","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TradePlanEnvelope"}}}},"400":{"description":"Structured failure","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"Structured failure","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"422":{"description":"Structured failure","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"x-railx-contract":{"status":201,"scope":"trade:plan","body":{"wallet":"0x0000000000000000000000000000000000000001","intent":{"type":"exact_input","tokenIn":"USDG","tokenOut":"NVDA","amountIn":"500"},"slippageTolerance":0.5}}}},"/trade-plans/{planId}":{"get":{"operationId":"getTradePlan","tags":["Trades"],"summary":"Retrieve a durable trade plan in the current environment","parameters":[{"name":"planId","in":"path","required":true,"schema":{"type":"string","minLength":16,"maxLength":128}}],"responses":{"200":{"description":"Trade plan","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TradePlanEnvelope"}}}},"404":{"description":"Structured failure","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"410":{"description":"Structured failure","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"x-railx-contract":{"status":404,"scope":"trade:plan","path":{"planId":"00000000-0000-4000-8000-000000000000"},"expectedError":{"code":"PLAN_NOT_FOUND","message":"Trade plan not found"}}}},"/transactions/simulate":{"post":{"operationId":"simulateTransactions","tags":["Simulation"],"summary":"Simulate one or more unsigned transactions","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SimulateRequest"}}}},"responses":{"200":{"description":"Simulation result","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SimulationEnvelope"}}}},"400":{"description":"Structured failure","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"x-railx-contract":{"status":200,"scope":"transaction:simulate","body":{"wallet":"0x0000000000000000000000000000000000000001","transactions":[{"to":"0x0000000000000000000000000000000000000002","data":"0x","value":"0"}]}}}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"A project key beginning with railx_test_ or railx_live_"}},"schemas":{"Meta":{"type":"object","required":["requestId","version","generatedAt"],"properties":{"requestId":{"type":"string"},"version":{"type":"string","const":"v0"},"generatedAt":{"type":"string","format":"date-time"}}},"ErrorEnvelope":{"type":"object","required":["error","meta"],"properties":{"error":{"type":"object","required":["code","message","retryable","details"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"retryable":{"type":"boolean"},"details":{}}},"meta":{"$ref":"#/components/schemas/Meta"}}},"TradeRequest":{"oneOf":[{"$ref":"#/components/schemas/IntentTradeRequest"},{"$ref":"#/components/schemas/LegacyTradeRequest"}]},"IntentTradeRequest":{"type":"object","required":["wallet","intent"],"properties":{"wallet":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$","description":"EVM wallet address"},"intent":{"oneOf":[{"type":"object","additionalProperties":false,"required":["type","tokenOut","amountIn"],"properties":{"type":{"type":"string","const":"exact_input"},"tokenIn":{"type":"string","default":"USDG"},"tokenOut":{"type":"string","example":"NVDA"},"amountIn":{"type":"string","pattern":"^(?:0|[1-9]\\d*)(?:\\.\\d{1,18})?$","description":"Exact decimal string","example":"500"}}},{"type":"object","additionalProperties":false,"required":["type","tokenOut","amountOut"],"properties":{"type":{"type":"string","const":"exact_output"},"tokenIn":{"type":"string","default":"USDG"},"tokenOut":{"type":"string","example":"NVDA"},"amountOut":{"type":"string","pattern":"^(?:0|[1-9]\\d*)(?:\\.\\d{1,18})?$","description":"Exact decimal string","example":"2"}}}]},"slippageTolerance":{"type":"number","minimum":0.01,"maximum":5,"default":0.5}}},"LegacyTradeRequest":{"type":"object","required":["wallet","tokenOut","input"],"properties":{"wallet":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$","description":"EVM wallet address"},"tokenOut":{"type":"string","example":"NVDA"},"input":{"type":"object","required":["amount"],"properties":{"tokenIn":{"type":"string","default":"USDG"},"amount":{"type":"string","pattern":"^(?:0|[1-9]\\d*)(?:\\.\\d{1,18})?$","description":"Exact decimal string","example":"500"}}},"slippageTolerance":{"type":"number","minimum":0.01,"maximum":5,"default":0.5}}},"SimulateRequest":{"type":"object","required":["transactions"],"properties":{"wallet":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$"},"transactions":{"type":"array","minItems":1,"maxItems":8,"items":{"$ref":"#/components/schemas/UnsignedTransactionInput"}}}},"UnsignedTransactionInput":{"type":"object","required":["to"],"properties":{"chainId":{"type":"integer","const":4663},"from":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$"},"to":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$"},"data":{"type":"string","pattern":"^0x(?:[0-9a-fA-F]{2})*$"},"value":{"type":"string","default":"0"},"gasLimit":{"type":"string"},"gasPrice":{"type":"string"},"maxFeePerGas":{"type":"string"},"maxPriorityFeePerGas":{"type":"string"}}},"UnsignedTransaction":{"type":"object","required":["chainId","from","to","data","value"],"properties":{"chainId":{"type":"integer","const":4663},"from":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$"},"to":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$"},"data":{"type":"string","pattern":"^0x(?:[0-9a-fA-F]{2})*$"},"value":{"type":"string"},"gasLimit":{"type":"string"},"gasPrice":{"type":"string"},"maxFeePerGas":{"type":"string"},"maxPriorityFeePerGas":{"type":"string"}}},"Index":{"type":"object","required":["name","version","chainId","documentation","endpoints"],"properties":{"name":{"type":"string"},"version":{"type":"string","const":"v0"},"chainId":{"type":"integer","const":4663},"documentation":{"type":"string"},"endpoints":{"type":"object","additionalProperties":{"type":"string"}}}},"Health":{"type":"object","required":["status","chainId","services"],"properties":{"status":{"enum":["ok","degraded"]},"chainId":{"type":"integer","const":4663},"services":{"type":"object","required":["robinhoodAssets","robinhoodPrices","robinhoodRpc","uniswapTradingApi","platformDatabase","railxApiAuthentication"],"properties":{"robinhoodAssets":{"$ref":"#/components/schemas/ConfiguredFlag"},"robinhoodPrices":{"$ref":"#/components/schemas/ConfiguredFlag"},"robinhoodRpc":{"type":"object","required":["configured","provider"],"properties":{"configured":{"type":"boolean"},"provider":{"type":"string"}}},"uniswapTradingApi":{"$ref":"#/components/schemas/ConfiguredFlag"},"platformDatabase":{"type":"object","required":["configured","schema"],"properties":{"configured":{"type":"boolean"},"schema":{"enum":["current","behind","not_configured"]}}},"railxApiAuthentication":{"type":"object","required":["enabled","mode","keyVerifierConfigured"],"properties":{"enabled":{"type":"boolean"},"mode":{"enum":["project_keys","disabled"]},"keyVerifierConfigured":{"type":"boolean"}}}}}}},"ConfiguredFlag":{"type":"object","required":["configured"],"properties":{"configured":{"type":"boolean"}}},"CanonicalAsset":{"type":"object","required":["id","symbol","name","status","currentMultiplier","pendingMultiplier","pendingMultiplierEffectiveTime","deployments","logoUrl","tradingCapabilities","provenance"],"properties":{"id":{"type":"string"},"symbol":{"type":"string"},"name":{"type":"string"},"status":{"enum":["active","inactive","unspecified"]},"currentMultiplier":{"type":"string","pattern":"^(?:0|[1-9]\\d*)(?:\\.\\d{1,18})?$","description":"Exact decimal string"},"pendingMultiplier":{"type":["string","null"]},"pendingMultiplierEffectiveTime":{"type":["string","null"]},"deployments":{"type":"array","items":{"type":"object","required":["chainId","contractAddress"],"properties":{"chainId":{"type":"integer"},"contractAddress":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$"}}}},"logoUrl":{"type":["string","null"]},"tradingCapabilities":{"type":["object","null"]},"provenance":{"type":"object","required":["source","sourceUrl","retrievedAt"],"properties":{"source":{"type":"string","const":"robinhood"},"sourceUrl":{"type":"string"},"retrievedAt":{"type":"string","format":"date-time"}}}}},"AssetList":{"type":"object","required":["assets","next","total"],"properties":{"assets":{"type":"array","items":{"$ref":"#/components/schemas/CanonicalAsset"}},"next":{"type":["string","null"]},"total":{"type":"integer","minimum":0}}},"CorporateActionType":{"type":"string","enum":["forward_split","reverse_split","cash_dividend","stock_dividend","spin_off","cash_merger","stock_merger","stock_and_cash_merger","redemption","name_change","worthless_removal","rights_distribution","unit_split","unspecified"]},"CorporateActionStatus":{"type":"string","enum":["in_progress","completed","unspecified"]},"CorporateAction":{"type":"object","required":["id","type","sourceType","status","processDate","asset","details","provenance"],"properties":{"id":{"type":"string"},"type":{"$ref":"#/components/schemas/CorporateActionType"},"sourceType":{"type":"string"},"status":{"$ref":"#/components/schemas/CorporateActionStatus"},"processDate":{"type":["string","null"],"format":"date"},"asset":{"type":"object","required":["symbol","deployments"],"properties":{"symbol":{"type":"string"},"deployments":{"type":"array","items":{"type":"object","required":["chainId","contractAddress"],"properties":{"chainId":{"type":"integer"},"contractAddress":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$"}}}}}},"details":{"type":"object"},"provenance":{"type":"object","required":["source","sourceUrl","retrievedAt"],"properties":{"source":{"type":"string","const":"robinhood"},"sourceUrl":{"type":"string"},"retrievedAt":{"type":"string","format":"date-time"}}}}},"CorporateActionList":{"type":"object","required":["actions","total"],"properties":{"actions":{"type":"array","items":{"$ref":"#/components/schemas/CorporateAction"}},"total":{"type":"integer","minimum":0}}},"SystemToken":{"type":"object","additionalProperties":false,"required":["kind","symbol","name","address","decimals","chainId"],"properties":{"kind":{"type":"string","const":"system"},"symbol":{"type":"string"},"name":{"type":"string"},"address":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$"},"decimals":{"type":"integer","minimum":0,"maximum":255},"chainId":{"type":"integer","const":4663}}},"MarketToken":{"type":"object","additionalProperties":false,"required":["kind","symbol","name","address","decimals","chainId","asset"],"properties":{"kind":{"type":"string","const":"market"},"symbol":{"type":"string"},"name":{"type":"string"},"address":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$"},"decimals":{"type":"integer","minimum":0,"maximum":255},"chainId":{"type":"integer","const":4663},"asset":{"$ref":"#/components/schemas/CanonicalAsset"}}},"ResolvedToken":{"oneOf":[{"$ref":"#/components/schemas/SystemToken"},{"$ref":"#/components/schemas/MarketToken"}]},"PriceObservation":{"type":"object","required":["asset","currency","rawUnderlying","tokenEquivalent","isTradingHalt","dailyTradingVolume","generatedAt","retrievedAt"],"properties":{"asset":{"type":"object","required":["id","symbol","name","status"],"properties":{"id":{"type":"string"},"symbol":{"type":"string"},"name":{"type":"string"},"status":{"enum":["active","inactive","unspecified"]}}},"currency":{"type":"string"},"rawUnderlying":{"type":"object","required":["bid","ask","mid","source"],"properties":{"bid":{"type":"string","pattern":"^(?:0|[1-9]\\d*)(?:\\.\\d{1,18})?$","description":"Exact decimal string"},"ask":{"type":"string","pattern":"^(?:0|[1-9]\\d*)(?:\\.\\d{1,18})?$","description":"Exact decimal string"},"mid":{"type":"string","pattern":"^(?:0|[1-9]\\d*)(?:\\.\\d{1,18})?$","description":"Exact decimal string"},"source":{"type":"string","const":"robinhood-rest"}}},"tokenEquivalent":{"type":"object","required":["bid","ask","mid","multiplier","calculation"],"properties":{"bid":{"type":"string","pattern":"^(?:0|[1-9]\\d*)(?:\\.\\d{1,18})?$","description":"Exact decimal string"},"ask":{"type":"string","pattern":"^(?:0|[1-9]\\d*)(?:\\.\\d{1,18})?$","description":"Exact decimal string"},"mid":{"type":"string","pattern":"^(?:0|[1-9]\\d*)(?:\\.\\d{1,18})?$","description":"Exact decimal string"},"multiplier":{"type":"string","pattern":"^(?:0|[1-9]\\d*)(?:\\.\\d{1,18})?$","description":"Exact decimal string"},"calculation":{"type":"string","const":"underlying_price_x_current_multiplier"}}},"isTradingHalt":{"type":"boolean"},"dailyTradingVolume":{"type":"string"},"generatedAt":{"type":"string"},"retrievedAt":{"type":"string","format":"date-time"}}},"Portfolio":{"type":"object","required":["wallet","chainId","blockNumber","nativeBalance","positions","scannedAssets","partial","warning"],"properties":{"wallet":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$"},"chainId":{"type":"integer","const":4663},"blockNumber":{"type":"string","pattern":"^0x[0-9a-fA-F]+$"},"nativeBalance":{"type":"object","required":["symbol","raw","formatted"],"properties":{"symbol":{"type":"string","const":"ETH"},"raw":{"type":"string","pattern":"^\\d+$","description":"Unsigned integer as a decimal string"},"formatted":{"type":"string"}}},"positions":{"type":"array","items":{"type":"object","required":["asset","balance","underlyingQuantity"],"properties":{"asset":{"type":"object","required":["kind","symbol","name","contractAddress","decimals"],"properties":{"kind":{"enum":["system","market"]},"symbol":{"type":"string"},"name":{"type":"string"},"contractAddress":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$"},"decimals":{"type":"integer"}}},"balance":{"type":"object","required":["raw","formatted"],"properties":{"raw":{"type":"string","pattern":"^\\d+$","description":"Unsigned integer as a decimal string"},"formatted":{"type":"string"}}},"underlyingQuantity":{"type":["string","null"]}}}},"scannedAssets":{"type":"integer","minimum":0},"partial":{"type":"boolean"},"warning":{"type":["string","null"]}}},"Quote":{"type":"object","required":["id","requestType","routing","tokenIn","tokenOut","amountIn","amountInBaseUnits","amountOut","amountOutBaseUnits","slippageTolerance","receivedAt","expiresAt","provider","providerRequestId","rawQuote","permitData"],"properties":{"id":{"type":"string"},"requestType":{"enum":["exact_input","exact_output"]},"routing":{"type":"string"},"tokenIn":{"$ref":"#/components/schemas/ResolvedToken"},"tokenOut":{"$ref":"#/components/schemas/ResolvedToken"},"amountIn":{"type":"string","pattern":"^(?:0|[1-9]\\d*)(?:\\.\\d{1,18})?$","description":"Exact decimal string"},"amountInBaseUnits":{"type":"string","pattern":"^\\d+$","description":"Unsigned integer as a decimal string"},"amountOut":{"type":["string","null"]},"amountOutBaseUnits":{"type":["string","null"],"pattern":"^\\d+$"},"slippageTolerance":{"type":"number"},"receivedAt":{"type":"string","format":"date-time"},"expiresAt":{"type":"string","format":"date-time"},"provider":{"type":"string","const":"uniswap-trading-api"},"providerRequestId":{"type":["string","null"]},"rawQuote":{"type":"object"},"permitData":{"type":["object","null"]}}},"SimulationResult":{"type":"object","required":["status","mode","blockNumber","calls","warning"],"properties":{"status":{"enum":["passed","failed","partial"]},"mode":{"enum":["sequential","independent"]},"blockNumber":{"type":"string","pattern":"^0x[0-9a-fA-F]+$"},"calls":{"type":"array","items":{"type":"object","required":["index","status","gasUsed","returnData","error"],"properties":{"index":{"type":"integer","minimum":0},"status":{"enum":["passed","failed","not_run"]},"gasUsed":{"type":["string","null"]},"returnData":{"type":["string","null"]},"error":{"type":["string","null"]}}}},"warning":{"type":["string","null"]}}},"PolicyCheck":{"type":"object","required":["source","verdict","code","message","evidence"],"properties":{"source":{"enum":["rail_safety","project_policy","project_configuration"]},"verdict":{"enum":["allow","warn","block"]},"code":{"type":"string"},"message":{"type":"string"},"evidence":{"type":"object"}}},"TradePlanVerdict":{"type":"object","required":["outcome","policyVersion","checks"],"properties":{"outcome":{"enum":["allow","warn","block"]},"policyVersion":{"oneOf":[{"type":"object","required":["id","version","schemaVersion"],"properties":{"id":{"type":"string"},"version":{"type":"integer","minimum":1},"schemaVersion":{"type":"integer","const":1}}},{"type":"null"}]},"checks":{"type":"array","items":{"$ref":"#/components/schemas/PolicyCheck"},"minItems":2}}},"TradePlan":{"type":"object","required":["id","status","chainId","wallet","createdAt","expiresAt","intent","quote","walletContext","steps","simulation","verdict","signing"],"properties":{"id":{"type":"string"},"status":{"enum":["ready","review_required","blocked"]},"chainId":{"type":"integer","const":4663},"wallet":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$"},"createdAt":{"type":"string","format":"date-time"},"expiresAt":{"type":"string","format":"date-time"},"intent":{"oneOf":[{"type":"object","required":["type","tokenIn","tokenOut","amountIn"],"properties":{"type":{"type":"string","const":"swap_exact_input"},"tokenIn":{"type":"string"},"tokenOut":{"type":"string"},"amountIn":{"type":"string","pattern":"^(?:0|[1-9]\\d*)(?:\\.\\d{1,18})?$","description":"Exact decimal string"}}},{"type":"object","required":["type","tokenIn","tokenOut","amountOut"],"properties":{"type":{"type":"string","const":"swap_exact_output"},"tokenIn":{"type":"string"},"tokenOut":{"type":"string"},"amountOut":{"type":"string","pattern":"^(?:0|[1-9]\\d*)(?:\\.\\d{1,18})?$","description":"Exact decimal string"}}}]},"quote":{"$ref":"#/components/schemas/Quote"},"walletContext":{"type":"object","required":["inputBalance","sufficientBalance"],"properties":{"inputBalance":{"type":"object","required":["raw","formatted","decimals"],"properties":{"raw":{"type":"string","pattern":"^\\d+$","description":"Unsigned integer as a decimal string"},"formatted":{"type":"string"},"decimals":{"type":"integer"}}},"sufficientBalance":{"type":"boolean","const":true}}},"steps":{"type":"array","items":{"type":"object","required":["index","kind","transaction"],"properties":{"index":{"type":"integer","minimum":0},"kind":{"enum":["cancel_approval","approve","swap"]},"transaction":{"$ref":"#/components/schemas/UnsignedTransaction"}}}},"simulation":{"$ref":"#/components/schemas/SimulationResult"},"verdict":{"$ref":"#/components/schemas/TradePlanVerdict"},"signing":{"type":"object","required":["mode","submittedByRail","unsignedTransactions"],"properties":{"mode":{"type":"string","const":"wallet_controlled"},"submittedByRail":{"type":"boolean","const":false},"unsignedTransactions":{"type":"array","items":{"$ref":"#/components/schemas/UnsignedTransaction"}}}}}},"IndexEnvelope":{"type":"object","required":["data","meta"],"properties":{"data":{"$ref":"#/components/schemas/Index"},"meta":{"$ref":"#/components/schemas/Meta"}}},"HealthEnvelope":{"type":"object","required":["data","meta"],"properties":{"data":{"$ref":"#/components/schemas/Health"},"meta":{"$ref":"#/components/schemas/Meta"}}},"AssetListEnvelope":{"type":"object","required":["data","meta"],"properties":{"data":{"$ref":"#/components/schemas/AssetList"},"meta":{"$ref":"#/components/schemas/Meta"}}},"AssetEnvelope":{"type":"object","required":["data","meta"],"properties":{"data":{"$ref":"#/components/schemas/CanonicalAsset"},"meta":{"$ref":"#/components/schemas/Meta"}}},"CorporateActionListEnvelope":{"type":"object","required":["data","meta"],"properties":{"data":{"$ref":"#/components/schemas/CorporateActionList"},"meta":{"$ref":"#/components/schemas/Meta"}}},"PriceEnvelope":{"type":"object","required":["data","meta"],"properties":{"data":{"$ref":"#/components/schemas/PriceObservation"},"meta":{"$ref":"#/components/schemas/Meta"}}},"PortfolioEnvelope":{"type":"object","required":["data","meta"],"properties":{"data":{"$ref":"#/components/schemas/Portfolio"},"meta":{"$ref":"#/components/schemas/Meta"}}},"QuoteEnvelope":{"type":"object","required":["data","meta"],"properties":{"data":{"$ref":"#/components/schemas/Quote"},"meta":{"$ref":"#/components/schemas/Meta"}}},"TradePlanEnvelope":{"type":"object","required":["data","meta"],"properties":{"data":{"$ref":"#/components/schemas/TradePlan"},"meta":{"$ref":"#/components/schemas/Meta"}}},"SimulationEnvelope":{"type":"object","required":["data","meta"],"properties":{"data":{"$ref":"#/components/schemas/SimulationResult"},"meta":{"$ref":"#/components/schemas/Meta"}}}}}}