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

# funding

Subscribe to real-time funding events.

**WebSocket URL:** `wss://api.hotstuff.trade/ws`

**Channel:** `fundingPayments`

## Parameters

| Parameter | Type | Required | Description | Example |
| - | - | - | - | - |
| `jsonrpc` | string | Yes | JSON-RPC version | `"2.0"` |
| `id` | string | Yes | Request identifier for tracking | `"1"` |
| `method` | string | Yes | Action to perform | `"subscribe"` or `"unsubscribe"` |
| `channel` | string | Yes | Channel name | `"fundingPayments"` |
| `user` | string | Yes | User wallet address | `"0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"` |

## Supported Methods

* `subscribe` - Subscribe to user order updates
* `unsubscribe` - Unsubscribe from user order updates

## Authentication

This endpoint requires a valid user wallet address to receive account-specific order updates.

## Example Request

```json theme={null}
{
  "jsonrpc": "2.0",
  "id": "1",
  "method": "subscribe",
  "params": {
    "channel": "fundingPayments",
    "user": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"
  }
}
```

## WebSocket Client Examples

### Python

```python theme={null}
import websocket
import json

def on_message(ws, message):
    print(f"Received: {message}")

def on_open(ws):
    subscribe_msg = {
        "jsonrpc": "2.0",
        "id": "1",
        "method": "subscribe",
        "params": {
            "channel": "fundingPayments",
            "user": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"
        }
    }
    ws.send(json.dumps(subscribe_msg))

ws = websocket.WebSocketApp("wss://api.hotstuff.trade/ws",
                          on_message=on_message,
                          on_open=on_open)
ws.run_forever()
```

### JavaScript

```javascript theme={null}
const ws = new WebSocket("wss://api.hotstuff.trade/ws");

ws.onopen = function () {
  const subscribeMsg = {
    jsonrpc: "2.0",
    id: "1",
    method: "subscribe",
    params: {
      channel: "fundingPayments",
      user: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",
    },
  };
  ws.send(JSON.stringify(subscribeMsg));
};

ws.onmessage = function (event) {
  console.log("Received:", event.data);
};
```


## AsyncAPI

````yaml asyncapi/ws-subscriptions.json funding
id: funding
title: Funding
description: ''
servers:
  - id: production
    protocol: wss
    host: api.hotstuff.trade/ws
    bindings: []
    variables: []
address: /
parameters: []
bindings: []
operations:
  - &ref_6
    id: funding_sendSubscribe
    title: Funding_send subscribe
    type: receive
    messages:
      - &ref_8
        id: a_subscribeRequest
        contentType: application/json
        payload:
          - name: Subscription request
            description: Send subscribe/unsubscribe request
            type: object
            properties:
              - name: jsonrpc
                type: string
                description: JSON-RPC version
                examples: &ref_0
                  - '2.0'
                required: true
              - name: id
                type: integer
                description: Client request identifier
                examples: &ref_1
                  - 1
                required: true
              - name: method
                type: string
                description: Subscription action
                enumValues:
                  - subscribe
                  - unsubscribe
                examples: &ref_2
                  - subscribe
                required: true
              - name: params
                type: object
                description: Channel subscription parameters
                required: true
                properties:
                  - name: channel
                    type: string
                    description: Must be fundingPayments
                    examples: &ref_3
                      - fundingPayments
                    required: true
                  - name: user
                    type: string
                    description: 'Example: 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045'
                    examples: &ref_4
                      - '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045'
                    required: true
        headers: []
        jsonPayloadSchema:
          type: object
          properties:
            jsonrpc:
              type: string
              default: '2.0'
              examples: *ref_0
              description: JSON-RPC version
              x-parser-schema-id: <anonymous-schema-163>
            id:
              type: integer
              default: 1
              examples: *ref_1
              description: Client request identifier
              x-parser-schema-id: <anonymous-schema-164>
            method:
              type: string
              enum:
                - subscribe
                - unsubscribe
              default: subscribe
              examples: *ref_2
              description: Subscription action
              x-parser-schema-id: <anonymous-schema-165>
            params:
              type: object
              properties:
                channel:
                  type: string
                  description: Must be fundingPayments
                  default: fundingPayments
                  examples: *ref_3
                  x-parser-schema-id: <anonymous-schema-167>
                user:
                  type: string
                  description: 'Example: 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045'
                  default: '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045'
                  examples: *ref_4
                  x-parser-schema-id: <anonymous-schema-168>
              required:
                - channel
                - user
              description: Channel subscription parameters
              x-parser-schema-id: <anonymous-schema-166>
          required:
            - jsonrpc
            - id
            - method
            - params
          x-parser-schema-id: <anonymous-schema-162>
        title: Subscription request
        description: Send subscribe/unsubscribe request
        example: |-
          {
            "jsonrpc": "2.0",
            "id": 1,
            "method": "subscribe",
            "params": {
              "channel": "fundingPayments",
              "user": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"
            }
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: a_subscribeRequest
    bindings: []
    extensions: &ref_5
      - id: x-parser-unique-object-id
        value: funding
  - &ref_7
    id: funding_receiveEvent
    title: Funding_receive event
    type: send
    messages:
      - &ref_9
        id: event
        contentType: application/json
        payload:
          - type: string
            description: >-
              Server-pushed JSON-RPC event (no Example Response on source page;
              shape follows other account channels).
            x-parser-schema-id: <anonymous-schema-169>
            name: Funding channel event
        headers: []
        jsonPayloadSchema:
          type: string
          description: >-
            Permissive placeholder: full frame is JSON; shown as string because
            docs omit a response example.
          x-parser-schema-id: <anonymous-schema-169>
        title: Funding channel event
        description: >-
          Server-pushed JSON-RPC event (no Example Response on source page;
          shape follows other account channels).
        example: >-
          "{\"jsonrpc\":\"2.0\",\"method\":\"event\",\"params\":{\"channel\":\"fundingPayments@0x...\",\"data\":{}}}"
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: event
    bindings: []
    extensions: *ref_5
sendOperations:
  - *ref_6
receiveOperations:
  - *ref_7
sendMessages:
  - *ref_8
receiveMessages:
  - *ref_9
extensions:
  - id: x-parser-unique-object-id
    value: funding
securitySchemes: []

````

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