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