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