diff --git a/backend/mpc-system/services/account/adapters/input/http/co_managed_handler.go b/backend/mpc-system/services/account/adapters/input/http/co_managed_handler.go index a70dceb6..7097cddc 100644 --- a/backend/mpc-system/services/account/adapters/input/http/co_managed_handler.go +++ b/backend/mpc-system/services/account/adapters/input/http/co_managed_handler.go @@ -616,6 +616,13 @@ func (h *CoManagedHTTPHandler) GetSignSessionStatus(c *gin.Context) { return } + // Get invite_code from database + var inviteCode string + if h.db != nil { + row := h.db.QueryRowContext(ctx, `SELECT invite_code FROM mpc_sessions WHERE id = $1`, sessionID) + row.Scan(&inviteCode) // Ignore error, invite_code is optional + } + result := gin.H{ "session_id": sessionID, "status": resp.Status, @@ -626,6 +633,11 @@ func (h *CoManagedHTTPHandler) GetSignSessionStatus(c *gin.Context) { "total_parties": resp.TotalParties, } + // Add invite_code if available + if inviteCode != "" { + result["invite_code"] = inviteCode + } + // Add signature if sign completed if resp.SessionType == "sign" && len(resp.Signature) > 0 { result["signature"] = hex.EncodeToString(resp.Signature) diff --git a/backend/mpc-system/services/service-party-app/electron/main.ts b/backend/mpc-system/services/service-party-app/electron/main.ts index 4db29935..b706031a 100644 --- a/backend/mpc-system/services/service-party-app/electron/main.ts +++ b/backend/mpc-system/services/service-party-app/electron/main.ts @@ -1839,6 +1839,7 @@ function setupIpcHandlers() { sessionId: result?.session_id, status: result?.status, joinedCount: result?.joined_count, + inviteCode: (result as { invite_code?: string })?.invite_code || '', threshold: { t: result?.threshold_t || activeCoSignSession?.threshold?.t || 0, n: result?.threshold_n || activeCoSignSession?.threshold?.n || 0, diff --git a/backend/mpc-system/services/service-party-app/src/pages/CoSignSession.tsx b/backend/mpc-system/services/service-party-app/src/pages/CoSignSession.tsx index 150aa313..f1ae52d7 100644 --- a/backend/mpc-system/services/service-party-app/src/pages/CoSignSession.tsx +++ b/backend/mpc-system/services/service-party-app/src/pages/CoSignSession.tsx @@ -26,6 +26,7 @@ interface SessionState { sessionId: string; walletName: string; messageHash: string; + inviteCode?: string; threshold: { t: number; n: number }; status: 'waiting' | 'ready' | 'processing' | 'completed' | 'failed'; participants: Participant[]; @@ -59,6 +60,7 @@ export default function CoSignSession() { sessionId: result.session.sessionId || sessionId, walletName: result.session.walletName || '', messageHash: result.session.messageHash || '', + inviteCode: result.session.inviteCode || '', threshold: result.session.threshold || { t: 0, n: 0 }, status: mapStatus(result.session.status), participants: (result.session.participants || []).map(p => ({ @@ -341,6 +343,31 @@ export default function CoSignSession() {
+ {/* 邀请码 - 等待状态时显示 */} + {session.inviteCode && session.status === 'waiting' && ( +
+

邀请码

+
+ {session.inviteCode} + +
+

+ 将此邀请码分享给其他参与方,他们可以使用此码加入签名 +

+
+ )} + {/* 消息哈希 */} {session.messageHash && (