fix(transfer): pass sessionId and participants to executeSign

- Add signSessionId state to store the session ID from createSignSession
- Add ParticipantInfo interface and participants field to ShareInfo
- Build participants list from share data for executeSign call
- Fix "Party not found in participants list" error

🤖 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-30 06:57:59 -08:00
parent 32362b0ac2
commit 1bf7f57e12
1 changed files with 17 additions and 3 deletions

View File

@ -16,12 +16,18 @@ import {
} from '../utils/transaction';
import { deriveEvmAddress, formatAddress } from '../utils/address';
interface ParticipantInfo {
partyId: string;
name?: string;
}
interface ShareInfo {
id: string;
walletName: string;
publicKey: string;
sessionId: string;
threshold: { t: number; n: number };
participants?: ParticipantInfo[];
evmAddress?: string;
balance?: string;
}
@ -52,6 +58,7 @@ export default function Transfer() {
// 签名会话
const [inviteCode, setInviteCode] = useState('');
const [signSessionId, setSignSessionId] = useState('');
// 错误信息
const [error, setError] = useState('');
@ -206,6 +213,7 @@ export default function Transfer() {
}
setInviteCode(result.inviteCode || '');
setSignSessionId(result.sessionId || '');
setTxHash(messageHash);
// 显示邀请码,等待用户通知其他参与方
@ -219,17 +227,23 @@ export default function Transfer() {
// 执行签名并广播
const handleExecuteAndBroadcast = async () => {
if (!txParams || !share || !txHash) return;
if (!txParams || !share || !txHash || !signSessionId) return;
try {
// 构建 participants 列表
const participants = (share.participants || []).map((p, index) => ({
partyId: p.partyId,
partyIndex: index,
}));
// 执行 TSS 签名
if (window.electronAPI) {
const signResult = await window.electronAPI.grpc.executeSign({
sessionId: '', // 将从邀请码获取
sessionId: signSessionId,
shareId: share.id,
password,
messageHash: txHash.slice(2),
participants: [], // 将从会话获取
participants,
threshold: share.threshold,
});