> ## Documentation Index
> Fetch the complete documentation index at: https://docs.testnet.dev.adipredictstreet.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Co-sign a NegRisk position convert (NO-basket → USDC)

> NegRisk-only collapse of a NO-basket back to collateral. Routes through NegRiskAdapter on-chain rather than the vault CTF path.



## OpenAPI

````yaml /api-reference/openapi.json post /api/vault/convert-signature
openapi: 3.1.0
info:
  title: PredictStreet core-api
  description: >-
    Client-facing HTTP gateway for the PredictStreet prediction-market platform.
    This spec is hand-written against the NestJS controllers and DTOs in
    core-api/src/modules/. For the source-of-truth live spec, run
    `./scripts/pull-openapi.sh` against a running core-api (NestJS exposes it at
    /api/docs-json). **Partner kinds.** Every authenticated endpoint resolves a
    request's *effective wallet* from the partner row. `single_wallet` partners
    bind to one `associatedWallet` set at creation. `multi_wallet` partners
    declare the actor on every request via an `X-User-Wallet: 0x<40-hex>`
    header. See the [Partner kinds](/auth/api-keys#partner-kinds) doc for the
    full contract.
  version: '2026-06-16'
  contact:
    name: PredictStreet partners
    email: partners@predictstreet.com
servers:
  - url: https://core.api.dev.predictstreet.sde.adifoundation.ai
    description: Testnet (partner integrator API — final domain TBD)
security: []
tags:
  - name: Deposits
    description: >-
      Gasless USDC deposit relay - submit a signed EIP-2612 permit and the
      platform broadcasts the on-chain deposit for you (no gas).
  - name: Events
    description: >-
      Polymarket-style event grouping with football metadata (group, stage,
      teams, tags).
  - name: Tags
    description: Curated tag taxonomy used to filter events.
  - name: Markets
    description: 'Public market data: list, detail, orderbook, trades, OHLC.'
  - name: Orders
    description: >-
      Signed-order place / cancel / read. Requires `X-Api-Key` with
      `orders:read` / `orders:write` scope; every write additionally requires an
      EIP-712 signature over the order.
  - name: Portfolio
    description: >-
      Balances, positions, trades, fees, vault info for the key's
      `associatedWallet`. Requires `X-Api-Key` with `portfolio:read` scope.
  - name: Matches
    description: >-
      admin.matches aggregate — groups several events into one fixture/card (1X2
      + first-scorer + over-under under one matchup).
  - name: Vault
    description: >-
      Backend co-signatures for ERC-1155 split / merge, and recovery for
      off-chain locks when the corresponding chain tx never confirmed. Requires
      `X-Api-Key` with `vault:write` scope plus an EIP-712 signature over the
      operation.
  - name: Leaderboard
    description: Public ranked leaderboard across PnL / volume buckets.
  - name: Search
    description: Global search across users, events, and matches.
  - name: Withdrawal Security
    description: >-
      Self-service withdrawal 2FA (TOTP) and withdrawal-address whitelist. Same
      endpoints serve the frontend (Privy JWT) and API-key integrators.
      Mutations need `vault:write`, reads `portfolio:read`. Both are opt-in per
      wallet and only gate withdrawals once the platform enables
      withdrawal-security enforcement.
paths:
  /api/vault/convert-signature:
    post:
      tags:
        - Vault
      summary: Co-sign a NegRisk position convert (NO-basket → USDC)
      description: >-
        NegRisk-only collapse of a NO-basket back to collateral. Routes through
        NegRiskAdapter on-chain rather than the vault CTF path.
      operationId: VaultController_requestConvertSignature
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ConvertSignatureDto'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConvertSignatureResp'
      security:
        - ApiKey: []
        - access: []
components:
  schemas:
    ConvertSignatureDto:
      type: object
      properties:
        marketId:
          type: string
          description: >-
            Off-chain market symbol (admin-issued), e.g.
            "PM-WC26-WIN-FRA-WC26-1910V2". Server resolves to the on-chain
            bytes32 NegRisk marketId via
            `admin.market_deployments.confirmed_ids_json->>"marketId"` —
            NegRisk-only lookup, binary markets fail closed with
            `market_not_found`.
          example: PM-WC26-WIN-FRA-WC26-1910V2
        indexSet:
          type: string
          description: >-
            uint256 indexSet bitmap over outcomes to collapse, decimal string.
            Each bit set marks an outcome whose NO position is being burned.
            Server converts to bigint at the EIP-712 boundary. Example: a
            4-outcome market collapsing NO_1 + NO_2 + NO_3 → indexSet = 0b1110 =
            14. Empty (0) and full-universe (every outcome) sets are rejected.
          example: '14'
        amount:
          type: string
          description: >-
            uint256 base-units (decimal string) — burned per outcome bit set in
            `indexSet`. NOT human-decimal: pass raw uint256 since CTF outcome
            tokens already mint 1:1 against 6-decimal USDC. Empty / zero
            rejected.
          example: '1000000'
      required:
        - marketId
        - indexSet
        - amount
    ConvertSignatureResp:
      type: object
      properties:
        signedOpId:
          type: string
          description: Server-side convert correlation id — `exchange.signed_ops.id` UUID.
        digest:
          type: string
          description: >-
            EIP-712 digest the user must sign with their EOA private key. The
            returned `backendSig` is over this exact digest; both signatures are
            submitted on-chain to `vault.convertPositions(...)`.
        backendSig:
          type: string
          description: 0x-hex backend EIP-712 signature over `digest`.
        salt:
          type: string
          description: uint256 EIP-712 salt (decimal string).
        deadline:
          type: number
          description: uint256 EIP-712 deadline (Unix seconds).
        marketId:
          type: string
          description: >-
            bytes32 NegRisk on-chain marketId — the value the contract expects
            in `convertPositions(marketId, ...)`. Distinct from the off-chain
            `marketSymbol` in the request: this is the resolved on-chain
            identifier.
        indexSet:
          type: string
          description: uint256 indexSet bitmap (decimal string), echoed back.
        amount:
          type: string
          description: uint256 base units echoed back.
        vaultAddress:
          type: string
          description: Per-user vault address (EIP-712 verifyingContract).
        tokenIds:
          description: >-
            Ordered list (ascending outcome index) of decimal-string tokenIds
            the convert will BURN. Lets clients preview/display the operation
            without re-deriving the indexSet → tokenId mapping.
          example:
            - 89348190...
            - 15823942...
            - 60912834...
          type: array
          items:
            type: string
      required:
        - signedOpId
        - digest
        - backendSig
        - salt
        - deadline
        - marketId
        - indexSet
        - amount
        - vaultAddress
        - tokenIds

````