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

# Store FOK swap trigger

> Submit wallet.create_fok_swap_trigger over the authenticated Relay WebSocket.

Send `wallet.create_fok_swap_trigger` with a connection-local `id` over `wss://relay.testnet.kuru.io/relay/ws?account_id=<accountId>` (or the mainnet host) and a wallet-bound JWT in the upgrade `Authorization` header. The request uses the same exact payload and signature rules as the [REST method](/api/relay/reference/create-fok-swap-trigger); omit the REST `wallet` and `requestId` fields. Use the signed trading account ID as the required upgrade `account_id`.

<Warning>Automated triggers, including TP/SL, are **not implemented** as a live feature and remain work in progress. This method only stores an instruction where enabled; it does not monitor or execute a trigger.</Warning>

This is a slow operational request. Its bounded RPC simulation can hold later submissions on the same ordered WebSocket; use REST or a separate connection for latency-sensitive trading. `BROADCAST` only indicates asynchronous scheduling. Relay automatically sends `transaction.outcome` on this connection with the original `id`; no explicit subscription or client acknowledgement is required. Verify the intended on-chain state or events after a terminal outcome.


## AsyncAPI

````yaml api/relay/asyncapi.yaml createFokSwapTrigger
id: createFokSwapTrigger
title: wallet.create_fok_swap_trigger
description: Opt-in slow operational method; exact simulation precedes signer submission.
servers:
  - id: mainnet
    protocol: wss
    host: relay.mainnet.kuru.io
    bindings: []
    variables: []
  - id: testnet
    protocol: wss
    host: relay.testnet.kuru.io
    bindings: []
    variables: []
address: /relay/ws
parameters: []
bindings:
  - protocol: ws
    version: 0.1.0
    value:
      method: GET
      query:
        type: object
        required:
          - account_id
        properties:
          account_id:
            type: string
            pattern: ^[1-9][0-9]*$
            maxLength: 13
            description: >-
              Exactly one canonical positive uint40 Kuru trading account ID (1
              through 1099511627775), without leading zero, sign, or whitespace.
            examples: &ref_0
              - '123'
    schemaProperties:
      - name: method
        type: string
        description: GET
        required: false
      - name: query
        type: object
        required: false
        properties:
          - name: account_id
            type: string
            description: >-
              Exactly one canonical positive uint40 Kuru trading account ID (1
              through 1099511627775), without leading zero, sign, or whitespace.
            examples: *ref_0
            required: true
operations:
  - &ref_3
    id: receiveCreateFokSwapTriggerRequest
    title: Receive create fok swap trigger request
    type: receive
    messages:
      - &ref_4
        id: request
        contentType: application/json
        payload:
          - allOf: &ref_1
              - type: object
                additionalProperties: false
                required:
                  - id
                  - method
                  - payload
                properties:
                  id:
                    type: string
                    minLength: 1
                    maxLength: 128
                    description: Correlation ID unique within this connection.
                    x-parser-schema-id: <anonymous-schema-1>
                  method:
                    type: string
                    x-parser-schema-id: <anonymous-schema-2>
                  payload:
                    type: object
                    x-parser-schema-id: <anonymous-schema-3>
                  authorization7702:
                    oneOf:
                      - type: object
                        x-parser-schema-id: <anonymous-schema-5>
                      - type: 'null'
                        x-parser-schema-id: <anonymous-schema-6>
                    default: null
                    x-parser-schema-id: <anonymous-schema-4>
                x-parser-schema-id: BaseRequest
              - type: object
                properties:
                  method:
                    type: string
                    const: wallet.create_fok_swap_trigger
                    x-parser-schema-id: <anonymous-schema-55>
                  payload:
                    type: object
                    additionalProperties: false
                    required:
                      - header
                      - triggerExpiry
                      - conditionSchema
                      - condition
                      - conditionHash
                      - order
                      - signature
                    description: >-
                      Storage only. Relay verifies schema/hash and discards
                      condition bytes; no monitor or scheduler is registered.
                    properties:
                      header:
                        type: object
                        additionalProperties: false
                        required:
                          - accountId
                          - market
                          - authNonce
                          - nonce
                          - deadline
                          - clientOrderId
                          - builder
                          - builderFeePps
                        description: >-
                          Wallet-v2 signed header. Use the current AccountCore
                          authorization epoch and a fresh wallet nonce.
                        properties:
                          accountId:
                            type: string
                            pattern: ^[1-9][0-9]*$
                            description: Positive uint40 trading account ID.
                            x-parser-schema-id: <anonymous-schema-31>
                          market:
                            type: string
                            description: Enabled market address.
                            x-parser-schema-id: <anonymous-schema-32>
                          authNonce:
                            type: string
                            pattern: ^(0|[1-9][0-9]*)$
                            description: AccountCore authorization epoch.
                            x-parser-schema-id: <anonymous-schema-33>
                          nonce:
                            type: string
                            pattern: ^[1-9][0-9]*$
                            description: Wallet intent nonce.
                            x-parser-schema-id: <anonymous-schema-34>
                          deadline:
                            type: string
                            pattern: ^[1-9][0-9]*$
                            description: Unix seconds.
                            x-parser-schema-id: <anonymous-schema-35>
                          clientOrderId:
                            type: string
                            description: Signed bytes32 batch-level correlation ID.
                            x-parser-schema-id: <anonymous-schema-36>
                          builder:
                            type: string
                            description: Zero address for cancellation methods.
                            x-parser-schema-id: <anonymous-schema-37>
                          builderFeePps:
                            type: string
                            pattern: ^(0|[1-9][0-9]*)$
                            description: Zero for cancellation methods.
                            x-parser-schema-id: <anonymous-schema-38>
                        x-parser-schema-id: OperationalHeader
                      triggerExpiry:
                        type: string
                        pattern: ^[1-9][0-9]*$
                        x-parser-schema-id: <anonymous-schema-56>
                      conditionSchema:
                        type: string
                        pattern: ^[1-9][0-9]*$
                        x-parser-schema-id: <anonymous-schema-57>
                      condition:
                        type: string
                        description: >-
                          Hex bytes with four-byte big-endian schema prefix;
                          retain client-side.
                        x-parser-schema-id: <anonymous-schema-58>
                      conditionHash:
                        type: string
                        description: Hash committed by the signed wallet intent.
                        x-parser-schema-id: <anonymous-schema-59>
                      order:
                        type: object
                        additionalProperties: false
                        required:
                          - side
                          - quantity
                          - limitPrice
                        properties:
                          side:
                            type: string
                            enum:
                              - BUY
                              - SELL
                            x-parser-schema-id: <anonymous-schema-49>
                          quantity:
                            type: string
                            pattern: ^[1-9][0-9]*$
                            description: Base quantity in native size precision.
                            x-parser-schema-id: <anonymous-schema-50>
                          limitPrice:
                            type: string
                            pattern: ^[1-9][0-9]*$
                            description: Protection price in native price precision.
                            x-parser-schema-id: <anonymous-schema-51>
                        x-parser-schema-id: OperationalFokOrder
                      signature:
                        type: string
                        x-parser-schema-id: <anonymous-schema-60>
                    x-parser-schema-id: CreateFokSwapTriggerPayload
                x-parser-schema-id: <anonymous-schema-54>
            not: &ref_2
              required:
                - authorization7702
              x-parser-schema-id: <anonymous-schema-61>
            x-parser-schema-id: CreateFokSwapTriggerRequest
            name: wallet.create_fok_swap_trigger
        headers: []
        jsonPayloadSchema:
          allOf: *ref_1
          not: *ref_2
          x-parser-schema-id: CreateFokSwapTriggerRequest
        title: wallet.create_fok_swap_trigger
        example: |-
          {
            "id": "createfokswaptrigger-1",
            "method": "wallet.create_fok_swap_trigger",
            "payload": {
              "header": {
                "accountId": "123",
                "market": "0x0A082280e4eA3D822E23Ec1186685477241A039d",
                "authNonce": "1",
                "nonce": "1792480000001",
                "deadline": "1792500000",
                "clientOrderId": "0x0000000000000000000000000000000000000000000000000000000000000001",
                "builder": "0x0000000000000000000000000000000000000000",
                "builderFeePps": "0"
              },
              "triggerExpiry": "1792503600",
              "conditionSchema": "1",
              "condition": "0x00000001...",
              "conditionHash": "0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
              "order": {
                "side": "BUY",
                "quantity": "10000000000",
                "limitPrice": "30000000"
              },
              "signature": "0x..."
            }
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: request
    bindings: []
    extensions:
      - id: x-parser-unique-object-id
        value: createFokSwapTrigger
sendOperations:
  - *ref_3
receiveOperations: []
sendMessages:
  - *ref_4
receiveMessages: []
extensions:
  - id: x-parser-unique-object-id
    value: createFokSwapTrigger
securitySchemes:
  - id: bearerAuth
    name: bearerAuth
    type: http
    description: Wallet-bound JWT supplied in the WebSocket upgrade Authorization header.
    scheme: bearer
    bearerFormat: JWT
    extensions: []

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.