Breaking Change: Update to latest XO-Engine #2
@@ -63,7 +63,7 @@ const actionItems: ListItemData<string>[] = [
|
|||||||
{ key: 'accept', label: 'Accept & Join', value: 'accept' },
|
{ key: 'accept', label: 'Accept & Join', value: 'accept' },
|
||||||
{ key: 'fill', label: 'Fill Requirements', value: 'fill' },
|
{ key: 'fill', label: 'Fill Requirements', value: 'fill' },
|
||||||
{ key: 'sign', label: 'Sign Transaction', value: 'sign' },
|
{ key: 'sign', label: 'Sign Transaction', value: 'sign' },
|
||||||
{ key: 'transaction', label: 'View Transaction', value: 'transaction' },
|
{ key: 'broadcast', label: 'Broadcast Transaction', value: 'broadcast' },
|
||||||
{ key: 'copy', label: 'Copy Invitation ID', value: 'copy' },
|
{ key: 'copy', label: 'Copy Invitation ID', value: 'copy' },
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -332,6 +332,30 @@ export function InvitationScreen(): React.ReactElement {
|
|||||||
}
|
}
|
||||||
}, [selectedInvitation, showInfo, showError, setStatus]);
|
}, [selectedInvitation, showInfo, showError, setStatus]);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Broadcast transaction.
|
||||||
|
*/
|
||||||
|
const broadcastTransaction = useCallback(async () => {
|
||||||
|
if (!selectedInvitation) return;
|
||||||
|
|
||||||
|
setIsLoading(true);
|
||||||
|
setStatus('Broadcasting transaction...');
|
||||||
|
|
||||||
|
try {
|
||||||
|
await selectedInvitation.broadcast();
|
||||||
|
showInfo(
|
||||||
|
`Transaction Broadcast Successful!\n\n` +
|
||||||
|
`The transaction has been submitted to the network.`
|
||||||
|
);
|
||||||
|
setStatus('Ready');
|
||||||
|
} catch (error) {
|
||||||
|
showError(`Failed to broadcast: ${error instanceof Error ? error.message : String(error)}`);
|
||||||
|
} finally {
|
||||||
|
setIsLoading(false);
|
||||||
|
setStatus('Ready');
|
||||||
|
}
|
||||||
|
}, [selectedInvitation, showInfo, showError, setStatus]);
|
||||||
|
|
||||||
const copyId = useCallback(async () => {
|
const copyId = useCallback(async () => {
|
||||||
if (!selectedInvitation) {
|
if (!selectedInvitation) {
|
||||||
showError('No invitation selected');
|
showError('No invitation selected');
|
||||||
@@ -489,13 +513,11 @@ export function InvitationScreen(): React.ReactElement {
|
|||||||
case 'sign':
|
case 'sign':
|
||||||
signInvitation();
|
signInvitation();
|
||||||
break;
|
break;
|
||||||
case 'transaction':
|
case 'broadcast':
|
||||||
if (selectedInvitation) {
|
broadcastTransaction();
|
||||||
navigate('transaction', { invitationId: selectedInvitation.data.invitationIdentifier });
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}, [selectedInvitation, copyId, acceptInvitation, fillRequirements, signInvitation, navigate]);
|
}, [selectedInvitation, copyId, acceptInvitation, fillRequirements, signInvitation, broadcastTransaction, navigate]);
|
||||||
|
|
||||||
const handleListItemActivate = useCallback((item: InvitationListItem, _index: number) => {
|
const handleListItemActivate = useCallback((item: InvitationListItem, _index: number) => {
|
||||||
if (item.key === 'import') {
|
if (item.key === 'import') {
|
||||||
|
|||||||
Reference in New Issue
Block a user