fix(service-party-app): 创建会话时添加 initiator_party_id 参数

- CreateKeygenSessionRequest 添加 initiator_party_id 和 initiator_name 字段
- 创建会话前检查是否已连接到消息路由器
- 自动获取已注册的 partyId 作为发起者

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
hailin 2025-12-29 02:54:43 -08:00
parent 19e366e0d9
commit 591dc50eb9
2 changed files with 10 additions and 0 deletions

View File

@ -192,10 +192,18 @@ function setupIpcHandlers() {
// gRPC - 创建会话 (通过 Account 服务 HTTP API)
ipcMain.handle('grpc:createSession', async (_event, params) => {
try {
// 获取当前 party ID
const partyId = grpcClient?.getPartyId();
if (!partyId) {
return { success: false, error: '请先连接到消息路由器' };
}
const result = await accountClient?.createKeygenSession({
wallet_name: params.walletName,
threshold_t: params.thresholdT,
threshold_n: params.thresholdN,
initiator_party_id: partyId,
initiator_name: params.initiatorName || '发起者',
persistent_count: 0, // 服务端 party 数量,共管钱包模式下为 0
external_count: params.thresholdN, // 所有参与方都是外部 party
expires_in_seconds: 86400, // 24 小时

View File

@ -14,6 +14,8 @@ export interface CreateKeygenSessionRequest {
wallet_name: string;
threshold_t: number;
threshold_n: number;
initiator_party_id: string;
initiator_name?: string;
persistent_count: number;
external_count: number;
expires_in_seconds?: number;