{
  "openapi": "3.1.0",
  "info": {
    "title": "AUCTION API",
    "description": "<div><h3>Quick Start</h3>welcome</div>",
    "version": "0.1#1038"
  },
  "servers": [
    {
      "url": "https://api.catfee.io",
      "description": "Generated server url"
    }
  ],
  "security": [
    {
      "API_KEY": [],
      "API_SIGN": [],
      "API_TIMESTAMP": []
    }
  ],
  "tags": [
    {
      "name": "API SERVICE",
      "description": "API SERVICE"
    }
  ],
  "paths": {
    "/v1/reclaim/{id}": {
      "post": {
        "tags": ["API SERVICE"],
        "summary": "Reclaim order \n回收订单",
        "operationId": "reclaim",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Order ID \n订单ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "CF-ACCESS-KEY",
            "in": "header",
            "description": "The API Access key as a string \nAPI所使用的KEY",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "your api key"
          },
          {
            "name": "CF-ACCESS-SIGN",
            "in": "header",
            "description": "The Base64-encoded signature (see signing messages subsection for details) \n使用HMAC SHA256哈希函数获得哈希值，再使用Base-64编码（请参阅签名）",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "signature"
          },
          {
            "name": "CF-ACCESS-TIMESTAMP",
            "in": "header",
            "description": "The UTC timestamp of your request .e.g : 2008-08-08T08:08:08.888Z \n发起请求的时间（UTC），如：2008-08-08T08:08:08.888Z",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/XOrderPayload"
                }
              }
            }
          }
        }
      }
    },
    "/v1/order": {
      "post": {
        "tags": ["API SERVICE"],
        "summary": "Buy energy \n创建订单,购买能量",
        "operationId": "order",
        "parameters": [
          {
            "name": "quantity",
            "in": "query",
            "description": "delegation energy quantity,must >= 65000 \n购买的能量数,不小于65000",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "receiver",
            "in": "query",
            "description": "Address to receive the resource \n接收能量的地址",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "duration",
            "in": "query",
            "description": "Duration of the order: allowed values are 1h \n代理能量的最大持续时间，允许的值：1h",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "client_order_id",
            "in": "query",
            "description": "客户自定义订单ID（长度小于等于64），保持唯一性，传入之前的客户订单号，将不创建新订单",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "activate",
            "in": "query",
            "description": "Whether activation is required. Defaults to true.\nIf set to false and the recipient address is not activated, an error will be returned. \n是否需要激活，默认为true，如果为false且接受能量地址未激活，则返回错误信息。",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": true
            }
          },
          {
            "name": "CF-ACCESS-KEY",
            "in": "header",
            "description": "The API Access key as a string \nAPI所使用的KEY",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "your api key"
          },
          {
            "name": "CF-ACCESS-SIGN",
            "in": "header",
            "description": "The Base64-encoded signature (see signing messages subsection for details) \n使用HMAC SHA256哈希函数获得哈希值，再使用Base-64编码（请参阅签名）",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "signature"
          },
          {
            "name": "CF-ACCESS-TIMESTAMP",
            "in": "header",
            "description": "The UTC timestamp of your request .e.g : 2008-08-08T08:08:08.888Z \n发起请求的时间（UTC），如：2008-08-08T08:08:08.888Z",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/XOrderPayload"
                }
              }
            }
          }
        }
      }
    },
    "/v1/order/{id}": {
      "get": {
        "tags": ["API SERVICE"],
        "summary": "Get order detail \n获取订单详情",
        "operationId": "order_1",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Order ID \n订单ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "CF-ACCESS-KEY",
            "in": "header",
            "description": "The API Access key as a string \nAPI所使用的KEY",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "your api key"
          },
          {
            "name": "CF-ACCESS-SIGN",
            "in": "header",
            "description": "The Base64-encoded signature (see signing messages subsection for details) \n使用HMAC SHA256哈希函数获得哈希值，再使用Base-64编码（请参阅签名）",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "signature"
          },
          {
            "name": "CF-ACCESS-TIMESTAMP",
            "in": "header",
            "description": "The UTC timestamp of your request .e.g : 2008-08-08T08:08:08.888Z \n发起请求的时间（UTC），如：2008-08-08T08:08:08.888Z",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/XOrderPayload"
                }
              }
            }
          }
        }
      }
    },
    "/v1/market": {
      "get": {
        "tags": ["API SERVICE"],
        "summary": "获取市场行情",
        "operationId": "market",
        "parameters": [
          {
            "name": "CF-ACCESS-KEY",
            "in": "header",
            "description": "The API Access key as a string \nAPI所使用的KEY",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "your api key"
          },
          {
            "name": "CF-ACCESS-SIGN",
            "in": "header",
            "description": "The Base64-encoded signature (see signing messages subsection for details) \n使用HMAC SHA256哈希函数获得哈希值，再使用Base-64编码（请参阅签名）",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "signature"
          },
          {
            "name": "CF-ACCESS-TIMESTAMP",
            "in": "header",
            "description": "The UTC timestamp of your request .e.g : 2008-08-08T08:08:08.888Z \n发起请求的时间（UTC），如：2008-08-08T08:08:08.888Z",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/XMarketPayload"
                }
              }
            }
          }
        }
      }
    },
    "/v1/estimate": {
      "get": {
        "tags": ["API SERVICE"],
        "summary": "Estimated order amount \n预估订单价格",
        "operationId": "estimate",
        "parameters": [
          {
            "name": "quantity",
            "in": "query",
            "description": "delegation energy quantity,must >= 65000 \n购买能量的数量,不小于65000",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 60000
            }
          },
          {
            "name": "duration",
            "in": "query",
            "description": "Duration of the order: allowed values are 1h \n代理能量的最大持续时间，允许的值：1h",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "CF-ACCESS-KEY",
            "in": "header",
            "description": "The API Access key as a string \nAPI所使用的KEY",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "your api key"
          },
          {
            "name": "CF-ACCESS-SIGN",
            "in": "header",
            "description": "The Base64-encoded signature (see signing messages subsection for details) \n使用HMAC SHA256哈希函数获得哈希值，再使用Base-64编码（请参阅签名）",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "signature"
          },
          {
            "name": "CF-ACCESS-TIMESTAMP",
            "in": "header",
            "description": "The UTC timestamp of your request .e.g : 2008-08-08T08:08:08.888Z \n发起请求的时间（UTC），如：2008-08-08T08:08:08.888Z",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/XLong"
                }
              }
            }
          }
        }
      }
    },
    "/v1/account": {
      "get": {
        "tags": ["API SERVICE"],
        "summary": "Get account for current member \n获取账户信息",
        "operationId": "account",
        "parameters": [
          {
            "name": "CF-ACCESS-KEY",
            "in": "header",
            "description": "The API Access key as a string \nAPI所使用的KEY",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "your api key"
          },
          {
            "name": "CF-ACCESS-SIGN",
            "in": "header",
            "description": "The Base64-encoded signature (see signing messages subsection for details) \n使用HMAC SHA256哈希函数获得哈希值，再使用Base-64编码（请参阅签名）",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "signature"
          },
          {
            "name": "CF-ACCESS-TIMESTAMP",
            "in": "header",
            "description": "The UTC timestamp of your request .e.g : 2008-08-08T08:08:08.888Z \n发起请求的时间（UTC），如：2008-08-08T08:08:08.888Z",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/XMemberAccountPayload"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "OrderPayload": {
        "properties": {
          "id": {
            "type": "string",
            "description": "Order ID, you can get order details by id \n订单ID,接口订单详情(/api/v1/order/{id})的必要参数"
          },
          "client_order_id": {
            "type": "string",
            "description": "Custom order id \n客户自定义订单ID"
          },
          "resource_type": {
            "type": "string",
            "description": "Resource type ENERGY or BANDWIDTH \n类型：能量(ENERGY) 或 带宽(BANDWIDTH)",
            "enum": ["ENERGY", "BANDWIDTH"]
          },
          "billing_type": {
            "type": "string",
            "deprecated": true,
            "description": "Billing type NORMAL | SUBSCRIBE | PERMISSION \n 订单类型：NORMAL | SUBSCRIBE | PERMISSION",
            "enum": ["TRANSFER", "DAPP", "BALANCE", "API", "BOT"]
          },
          "source_type": {
            "type": "string",
            "description": "Source type TRANSFER | DAPP | BALANCE | API | BOT \n 订单来源类型：TRANSFER | DAPP | BALANCE | API | BOT",
            "enum": ["TRANSFER", "DAPP", "BALANCE", "API", "BOT"]
          },
          "pay_timestamp": {
            "type": "integer",
            "format": "int64",
            "description": "Payment timestamp \n订单付款的时间戳"
          },
          "receiver": {
            "type": "string",
            "description": "Resource receiving address \n能量接收地址"
          },
          "delegate_hash": {
            "type": "string",
            "description": "Delegation hash \n代理能量的HASH值"
          },
          "delegate_timestamp": {
            "type": "integer",
            "format": "int64",
            "description": "Delegation timestamp \n代理能量的时间戳"
          },
          "reclaim_hash": {
            "type": "string",
            "description": "Reclaim hash \n回收能量的HASH值"
          },
          "reclaim_timestamp": {
            "type": "integer",
            "format": "int64",
            "description": "Reclaim timestamp \n回收能量的时间戳"
          },
          "pay_amount_sun": {
            "type": "integer",
            "format": "int64",
            "description": "Payment amount(unit:sun) \n支付金额(SUN)"
          },
          "activate_amount_sun": {
            "type": "integer",
            "format": "int64",
            "description": "Activate amount(unit:sun) \n激活费用(SUN)"
          },
          "quantity": {
            "type": "integer",
            "format": "int32",
            "description": "Resource quantity \n购买的能量数量"
          },
          "staked_sun": {
            "type": "integer",
            "format": "int64",
            "description": "Resource staked amount(unit:sun) \n获取资源需要质押的金额(SUN)"
          },
          "duration": {
            "type": "integer",
            "format": "int32",
            "description": "Delegation duration(minute) \n代理最大可用时长(分钟)"
          },
          "expired_timestamp": {
            "type": "integer",
            "format": "int64",
            "description": "Resource expired timestamp \n过期时间戳，过期自动回收"
          },
          "status": {
            "type": "string",
            "description": "Order status \n订单状态",
            "enum": [
              "PAYMENT_SUCCESS",
              "DELEGATE_SUCCESS",
              "DELEGATE_FAIL",
              "INSUFFICIENT_BALANCE",
              "QUANTITY_TOO_HIGH",
              "QUANTITY_TOO_LOW",
              "ADDRESS_NOT_ACTIVATED",
              "INVALID_ADDRESS",
              "UNKNOWN"
            ]
          },
          "activate_status": {
            "type": "string",
            "description": "Activate status \n激活状态",
            "enum": ["DEACTIVATE", "ACTIVATE", "ACTIVATED", "ALREADY_ACTIVATED"]
          },
          "confirm_status": {
            "type": "string",
            "description": "Confirmation status \n链上确认状态",
            "enum": [
              "UNCONFIRMED",
              "DELEGATION_CONFIRMED",
              "DELEGATION_CONFIRMED_FAIL"
            ]
          },
          "balance": {
            "type": "integer",
            "format": "int64",
            "description": "Current user balance(unit:SUN) \n用户余额(单位SUN)"
          }
        }
      },
      "XOrderPayload": {
        "properties": {
          "code": {
            "type": "integer",
            "format": "int32",
            "description": "成功返回0，其他均为错误"
          },
          "msg": {
            "type": "string",
            "description": "发生错误时候返回的消息"
          },
          "sub_code": {
            "type": "string"
          },
          "sub_msg": {
            "type": "string"
          },
          "data": {
            "$ref": "#/components/schemas/OrderPayload"
          }
        }
      },
      "MarketPayload": {
        "properties": {
          "available_energy": {
            "type": "integer",
            "format": "int64",
            "description": "当前系统可售能量数量（单位：能量）"
          },
          "energy_price_per_hour": {
            "type": "integer",
            "format": "int64",
            "description": "能量每小时租赁价格（单位：SUN）"
          },
          "energy_flash_price": {
            "type": "integer",
            "format": "int64",
            "description": "能量闪充价格（单位：SUN）"
          },
          "bandwidth_flash_price": {
            "type": "integer",
            "format": "int64",
            "description": "带宽闪充价格（单位：SUN）"
          }
        }
      },
      "XMarketPayload": {
        "properties": {
          "code": {
            "type": "integer",
            "format": "int32",
            "description": "成功返回0，其他均为错误"
          },
          "msg": {
            "type": "string",
            "description": "发生错误时候返回的消息"
          },
          "sub_code": {
            "type": "string"
          },
          "sub_msg": {
            "type": "string"
          },
          "data": {
            "$ref": "#/components/schemas/MarketPayload"
          }
        }
      },
      "XLong": {
        "properties": {
          "code": {
            "type": "integer",
            "format": "int32",
            "description": "成功返回0，其他均为错误"
          },
          "msg": {
            "type": "string",
            "description": "发生错误时候返回的消息"
          },
          "sub_code": {
            "type": "string"
          },
          "sub_msg": {
            "type": "string"
          },
          "data": {
            "type": "integer",
            "format": "int64"
          }
        }
      },
      "MemberAccountPayload": {
        "properties": {
          "wallet": {
            "type": "string",
            "description": "wallet \n钱包"
          },
          "api_key": {
            "type": "string",
            "description": "API access key"
          },
          "api_secret": {
            "type": "string",
            "description": "API secret"
          },
          "email": {
            "type": "string",
            "description": "email \n邮箱"
          },
          "telegram_id": {
            "type": "integer",
            "format": "int64",
            "description": "telegram \n电报ID"
          },
          "recharge_address": {
            "type": "string",
            "description": "Exclusive recharge address(sun) \n专属充值地址"
          },
          "total_recharge": {
            "type": "integer",
            "format": "int64",
            "description": "Total recharge amount(sun) \n总充值金额"
          },
          "total_recharge_usdt": {
            "type": "integer",
            "format": "int64",
            "description": "Total recharge amount(usdt) \n总充值金额U"
          },
          "total_hour_consume": {
            "type": "integer",
            "format": "int64",
            "description": "Total hour consumption amount(sun) \n1小时内订单消费总金额(SUN)"
          },
          "total_day_consume": {
            "type": "integer",
            "format": "int64",
            "description": "Total day consumption amount(sun) \n1天订单消费总金额(SUN)"
          },
          "total_multiday_consume": {
            "type": "integer",
            "format": "int64",
            "description": "Total multiday consumption amount(sun) \n多天订单消费总金额(SUN)"
          },
          "total_flash_consume": {
            "type": "integer",
            "format": "int64",
            "description": "Total flash consumption amount(sun) \n速冲订单消费总金额(SUN)"
          },
          "total_activate_consume": {
            "type": "integer",
            "format": "int64",
            "description": "Total activate consumption amount(sun) \n激活总金额(SUN)"
          },
          "total_permission_consume": {
            "type": "integer",
            "format": "int64",
            "description": "Total permission consumption amount(sun) \n授权订单消费总金额(SUN)"
          },
          "total_subscribe_consume": {
            "type": "integer",
            "format": "int64",
            "description": "Total subscribe consumption amount(sun) \n订阅订单消费总金额(SUN)"
          },
          "total_bandwidth_consume": {
            "type": "integer",
            "format": "int64",
            "description": "Total bandwidth consumption amount(sun) \n带宽订单消费总金额(SUN)"
          },
          "total_premium_consume": {
            "type": "integer",
            "format": "int64",
            "description": "Total telegram premium consumption amount(sun) \n电报会员订单消费总金额(SUN)"
          },
          "total_node_consume": {
            "type": "integer",
            "format": "int64",
            "description": "Total node consumption amount(sun) \n节点消费总金额(SUN)"
          },
          "total_monitor_consume": {
            "type": "integer",
            "format": "int64",
            "description": "Total node consumption amount(sun) \n监控API消费总金额(SUN)"
          },
          "total_security_consume": {
            "type": "integer",
            "format": "int64",
            "description": "Total security consumption amount(sun) \n地址检测消费(SUN)"
          },
          "total_swap_consume": {
            "type": "integer",
            "format": "int64",
            "description": "Total swap consumption amount(sun) \n兑换消费(SUN)"
          },
          "total_swap_usdt_consume": {
            "type": "integer",
            "format": "int64",
            "description": "Total swap usdt consumption amount \n兑换消费usdt"
          },
          "total_refund": {
            "type": "integer",
            "format": "int64",
            "description": "Total refund amount(sun) \n用户总退款(SUN)"
          },
          "total_refund_usdt": {
            "type": "integer",
            "format": "int64",
            "description": "Total refund usdt amount \n用户总退款USDT"
          },
          "whitelist": {
            "type": "string",
            "description": "Whitelist \n白名单"
          },
          "balance": {
            "type": "integer",
            "format": "int64",
            "description": "余额(SUN)"
          },
          "balance_usdt": {
            "type": "integer",
            "format": "int64",
            "description": "余额(USDT)"
          }
        }
      },
      "XMemberAccountPayload": {
        "properties": {
          "code": {
            "type": "integer",
            "format": "int32",
            "description": "成功返回0，其他均为错误"
          },
          "msg": {
            "type": "string",
            "description": "发生错误时候返回的消息"
          },
          "sub_code": {
            "type": "string"
          },
          "sub_msg": {
            "type": "string"
          },
          "data": {
            "$ref": "#/components/schemas/MemberAccountPayload"
          }
        }
      }
    },
    "securitySchemes": {
      "API_KEY": {
        "type": "apiKey",
        "name": "CF-ACCESS-KEY",
        "in": "header"
      },
      "API_SIGN": {
        "type": "apiKey",
        "name": "CF-ACCESS-SIGN",
        "in": "header"
      },
      "API_TIMESTAMP": {
        "type": "apiKey",
        "name": "CF-ACCESS-TIMESTAMP",
        "in": "header"
      }
    }
  }
}
