{ "swagger": "2.0", "info": { "title": "proto/asset-chain.proto", "version": "version not set" }, "tags": [ { "name": "AssetChainService" } ], "consumes": [ "application/json" ], "produces": [ "application/json" ], "paths": { "/api/v1/assets": { "get": { "summary": "资产查询", "operationId": "AssetChainService_GetUserAssets", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/assetGetUserAssetsResponse" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "user_id", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "star_id", "description": "核心隔离键", "in": "query", "required": false, "type": "string", "format": "int64" }, { "name": "status", "description": "可选:按状态筛选(0=全部)\n\n - ASSET_STATUS_PENDING: 待上链\n - ASSET_STATUS_ACTIVE: 已上链激活\n - ASSET_STATUS_FAILED: 上链失败", "in": "query", "required": false, "type": "string", "enum": [ "ASSET_STATUS_UNSPECIFIED", "ASSET_STATUS_PENDING", "ASSET_STATUS_ACTIVE", "ASSET_STATUS_FAILED" ], "default": "ASSET_STATUS_UNSPECIFIED" }, { "name": "type", "description": "可选:按类型筛选(0=全部)\n\n - ASSET_TYPE_COLLECTIBLE: 藏品\n - ASSET_TYPE_BLIND_BOX: 盲盒", "in": "query", "required": false, "type": "string", "enum": [ "ASSET_TYPE_UNSPECIFIED", "ASSET_TYPE_COLLECTIBLE", "ASSET_TYPE_BLIND_BOX" ], "default": "ASSET_TYPE_UNSPECIFIED" }, { "name": "page.page", "description": "页码,从1开始", "in": "query", "required": false, "type": "integer", "format": "int32" }, { "name": "page.page_size", "description": "每页数量", "in": "query", "required": false, "type": "integer", "format": "int32" } ], "tags": [ "AssetChainService" ] } }, "/api/v1/assets/mint": { "post": { "summary": "资产铸造(异步)", "operationId": "AssetChainService_MintAsset", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/assetMintResponse" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/assetMintRequest" } } ], "tags": [ "AssetChainService" ] } }, "/api/v1/assets/{asset_id}": { "get": { "operationId": "AssetChainService_GetAsset", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/assetGetAssetResponse" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "asset_id", "in": "path", "required": true, "type": "string", "format": "int64" }, { "name": "star_id", "description": "核心隔离键(用于数据隔离验证)", "in": "query", "required": false, "type": "string", "format": "int64" } ], "tags": [ "AssetChainService" ] } }, "/api/v1/assets/{asset_id}/status": { "get": { "operationId": "AssetChainService_CheckAssetStatus", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/assetCheckAssetStatusResponse" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "asset_id", "in": "path", "required": true, "type": "string", "format": "int64" }, { "name": "star_id", "in": "query", "required": false, "type": "string", "format": "int64" } ], "tags": [ "AssetChainService" ] } } }, "definitions": { "assetAsset": { "type": "object", "properties": { "id": { "type": "string", "format": "int64" }, "owner_uid": { "type": "string", "format": "int64", "title": "当前持有人" }, "star_id": { "type": "string", "format": "int64", "title": "核心隔离键" }, "name": { "type": "string", "title": "藏品名称" }, "minio_url": { "type": "string", "title": "Web2: 图片地址" }, "file_hash": { "type": "string", "title": "Web3: 文件指纹(SHA-256)" }, "tx_hash": { "type": "string", "title": "Web3: 链上交易哈希" }, "token_id": { "type": "string", "title": "Web3: 链上Token ID" }, "status": { "$ref": "#/definitions/assetAssetStatus", "title": "状态" }, "type": { "$ref": "#/definitions/assetAssetType", "title": "类型" }, "attributes": { "$ref": "#/definitions/assetAssetAttributes", "title": "动态属性" }, "created_at": { "type": "string", "format": "int64" } }, "title": "数字资产" }, "assetAssetAttributes": { "type": "object", "properties": { "rarity": { "type": "string", "title": "稀有度(如:Common, Rare, Epic, Legendary)" }, "background_color": { "type": "string", "title": "背景色" }, "custom_attrs": { "type": "object", "additionalProperties": { "type": "string" }, "title": "自定义属性(如:buff加成等)" } }, "title": "资产属性(动态元数据,使用JSONB存储)" }, "assetAssetStatus": { "type": "string", "enum": [ "ASSET_STATUS_UNSPECIFIED", "ASSET_STATUS_PENDING", "ASSET_STATUS_ACTIVE", "ASSET_STATUS_FAILED" ], "default": "ASSET_STATUS_UNSPECIFIED", "description": "- ASSET_STATUS_PENDING: 待上链\n - ASSET_STATUS_ACTIVE: 已上链激活\n - ASSET_STATUS_FAILED: 上链失败", "title": "资产状态" }, "assetAssetType": { "type": "string", "enum": [ "ASSET_TYPE_UNSPECIFIED", "ASSET_TYPE_COLLECTIBLE", "ASSET_TYPE_BLIND_BOX" ], "default": "ASSET_TYPE_UNSPECIFIED", "description": "- ASSET_TYPE_COLLECTIBLE: 藏品\n - ASSET_TYPE_BLIND_BOX: 盲盒", "title": "资产类型" }, "assetCheckAssetStatusResponse": { "type": "object", "properties": { "base": { "$ref": "#/definitions/commonBaseResponse" }, "status": { "$ref": "#/definitions/assetAssetStatus" }, "tx_hash": { "type": "string", "title": "如果已上链,返回交易哈希" }, "error_message": { "type": "string", "title": "如果失败,返回错误信息" } }, "title": "查询资产上链状态响应" }, "assetGetAssetResponse": { "type": "object", "properties": { "base": { "$ref": "#/definitions/commonBaseResponse" }, "asset": { "$ref": "#/definitions/assetAsset" } }, "title": "获取资产详情响应" }, "assetGetUserAssetsResponse": { "type": "object", "properties": { "base": { "$ref": "#/definitions/commonBaseResponse" }, "assets": { "type": "array", "items": { "type": "object", "$ref": "#/definitions/assetAsset" } }, "page": { "$ref": "#/definitions/commonPageResponse" } }, "title": "获取用户资产列表响应" }, "assetMintRequest": { "type": "object", "properties": { "user_id": { "type": "string", "format": "int64" }, "star_id": { "type": "string", "format": "int64", "title": "核心隔离键" }, "type": { "$ref": "#/definitions/assetAssetType", "title": "资产类型(1=藏品,2=盲盒)" }, "name": { "type": "string", "title": "藏品名称(可选,AI生成时可留空)" } }, "title": "铸造请求" }, "assetMintResponse": { "type": "object", "properties": { "base": { "$ref": "#/definitions/commonBaseResponse" }, "asset_id": { "type": "string", "format": "int64", "title": "资产ID(状态为Pending)" }, "task_id": { "type": "string", "title": "异步任务ID(可选,用于追踪上链进度)" } }, "title": "铸造响应(异步返回,只返回任务ID)" }, "commonBaseResponse": { "type": "object", "properties": { "code": { "$ref": "#/definitions/commonStatusCode" }, "message": { "type": "string" }, "timestamp": { "type": "string", "format": "int64", "title": "Unix时间戳(毫秒)" } }, "title": "通用响应结构" }, "commonPageRequest": { "type": "object", "properties": { "page": { "type": "integer", "format": "int32", "title": "页码,从1开始" }, "page_size": { "type": "integer", "format": "int32", "title": "每页数量" } }, "title": "分页请求" }, "commonPageResponse": { "type": "object", "properties": { "page": { "type": "integer", "format": "int32" }, "page_size": { "type": "integer", "format": "int32" }, "total": { "type": "string", "format": "int64", "title": "总记录数" }, "total_pages": { "type": "integer", "format": "int32", "title": "总页数" } }, "title": "分页响应" }, "commonStatusCode": { "type": "string", "enum": [ "STATUS_UNSPECIFIED", "STATUS_OK", "STATUS_BAD_REQUEST", "STATUS_UNAUTHORIZED", "STATUS_FORBIDDEN", "STATUS_NOT_FOUND", "STATUS_INTERNAL_ERROR" ], "default": "STATUS_UNSPECIFIED", "title": "通用响应状态码" }, "protobufAny": { "type": "object", "properties": { "@type": { "type": "string" } }, "additionalProperties": {} }, "rpcStatus": { "type": "object", "properties": { "code": { "type": "integer", "format": "int32" }, "message": { "type": "string" }, "details": { "type": "array", "items": { "type": "object", "$ref": "#/definitions/protobufAny" } } } } } }