@@ -24,6 +24,10 @@ import {
2424 type FinalizedClaimProof ,
2525} from "@/lib/genlayer-claim" ;
2626import {
27+ CURRENT_DEPLOYMENT_ANCHOR ,
28+ } from "@/lib/deployment-anchor" ;
29+ import {
30+ isTransactionHash ,
2731 observeExternalDelivery ,
2832 persistClaimTransaction ,
2933 readPersistedClaimTransaction ,
@@ -84,6 +88,12 @@ export function ClaimMissionFlow({
8488 wallet . address ,
8589 ) ,
8690 ) ;
91+ const [ claimTransactionId , setClaimTransactionId ] = useState ( ( ) =>
92+ readPersistedClaimTransaction (
93+ initialMissionId ,
94+ wallet . address ,
95+ ) ?. transactionId ?? "" ,
96+ ) ;
8797 const [
8898 delivery ,
8999 setDelivery ,
@@ -101,6 +111,11 @@ export function ClaimMissionFlow({
101111 && claimRecord . beneficiary . toLowerCase ( ) === wallet . address . toLowerCase ( )
102112 ? claimRecord
103113 : null ;
114+ const activeParentClaimTransactionId = isTransactionHash (
115+ claimTransactionId . trim ( ) ,
116+ )
117+ ? claimTransactionId . trim ( )
118+ : null ;
104119
105120 function resetReview ( ) {
106121 setQuote ( null ) ;
@@ -162,6 +177,7 @@ export function ClaimMissionFlow({
162177 transactionId : txId ,
163178 amount : quote . snapshot . missionClaimable ,
164179 } ) ;
180+ setClaimTransactionId ( txId ) ;
165181 persistClaimTransaction (
166182 quote . snapshot . mission . missionId ,
167183 quote . snapshot . beneficiary ,
@@ -181,6 +197,8 @@ export function ClaimMissionFlow({
181197 wallet . client ,
182198 txId ,
183199 {
200+ coordinator : CURRENT_DEPLOYMENT_ANCHOR . contractAddress ,
201+ missionId : quote . snapshot . mission . missionId ,
184202 recipient : quote . snapshot . beneficiary ,
185203 amount : quote . snapshot . missionClaimable ,
186204 } ,
@@ -215,10 +233,7 @@ export function ClaimMissionFlow({
215233 }
216234
217235 async function refreshDelivery ( ) {
218- if (
219- activeClaimRecord === null
220- || deliveryBusy
221- ) {
236+ if ( activeParentClaimTransactionId === null || deliveryBusy ) {
222237 return ;
223238 }
224239
@@ -228,17 +243,19 @@ export function ClaimMissionFlow({
228243 setDelivery (
229244 await observeExternalDelivery (
230245 wallet . client ,
231- activeClaimRecord . transactionId ,
246+ activeParentClaimTransactionId ,
232247 {
248+ coordinator : CURRENT_DEPLOYMENT_ANCHOR . contractAddress ,
249+ missionId,
233250 recipient : wallet . address ,
234- amount : activeClaimRecord . amount ,
251+ amount : activeClaimRecord ? .amount ,
235252 } ,
236253 ) ,
237254 ) ;
238255 } catch ( caught : unknown ) {
239256 setDelivery (
240257 unverifiedExternalDelivery (
241- activeClaimRecord . transactionId ,
258+ activeParentClaimTransactionId ,
242259 caught instanceof Error
243260 ? caught . message
244261 : "The delivery observation could not be completed. No delivery outcome is claimed." ,
@@ -254,8 +271,8 @@ export function ClaimMissionFlow({
254271 ) : string {
255272 return phase === "DELIVERED"
256273 ? "DELIVERED"
257- : phase === "FAILED "
258- ? "FAILED — NO AUTOMATIC RETRY "
274+ : phase === "FINALIZED_ERROR "
275+ ? "FINALIZED EXECUTION ERROR — DELIVERY UNRESOLVED "
259276 : phase === "PENDING"
260277 ? "PENDING"
261278 : "UNVERIFIED" ;
@@ -285,19 +302,33 @@ export function ClaimMissionFlow({
285302 setMissionId (
286303 nextMissionId ,
287304 ) ;
288- setClaimRecord (
289- readPersistedClaimTransaction (
290- nextMissionId ,
291- wallet . address ,
292- ) ,
305+ const persisted = readPersistedClaimTransaction (
306+ nextMissionId ,
307+ wallet . address ,
293308 ) ;
309+ setClaimRecord ( persisted ) ;
310+ setClaimTransactionId ( persisted ?. transactionId ?? "" ) ;
294311 resetReview ( ) ;
295312 } }
296313 placeholder = "Mission ID"
297314 maxLength = { 512 }
298315 />
299316 </ label >
300317
318+ < label className = "claim-mission-input" >
319+ < span > Parent claim transaction (optional recovery)</ span >
320+ < input
321+ value = { claimTransactionId }
322+ onChange = { ( event ) => {
323+ setClaimTransactionId ( event . target . value ) ;
324+ setDelivery ( null ) ;
325+ setError ( null ) ;
326+ } }
327+ placeholder = "0x… paste a finalized claim transaction"
328+ spellCheck = { false }
329+ />
330+ </ label >
331+
301332 < div className = "claim-rule-grid" >
302333 < div >
303334 < ShieldCheck
@@ -522,7 +553,7 @@ export function ClaimMissionFlow({
522553 </ div >
523554 ) : null }
524555
525- { activeClaimRecord !== null ? (
556+ { activeParentClaimTransactionId !== null ? (
526557 < div className = "claim-delivery" >
527558 < div className = "claim-delivery-heading" >
528559 < div >
@@ -559,7 +590,16 @@ export function ClaimMissionFlow({
559590 < dl >
560591 < div >
561592 < dt > Parent claim</ dt >
562- < dd > { activeClaimRecord . transactionId } </ dd >
593+ < dd > { activeParentClaimTransactionId } </ dd >
594+ </ div >
595+ < div >
596+ < dt > Outbound message</ dt >
597+ < dd >
598+ { delivery ?. outboundMessage === null
599+ || delivery ?. outboundMessage === undefined
600+ ? "Not verified"
601+ : `${ delivery . outboundMessage . recipient } · ${ delivery . outboundMessage . amount . toString ( ) } wei` }
602+ </ dd >
563603 </ div >
564604 < div >
565605 < dt > Triggered child</ dt >
@@ -587,8 +627,9 @@ export function ClaimMissionFlow({
587627 < small > { delivery . reason } </ small >
588628 ) : (
589629 < small >
590- Select “Observe child transaction” to read the exact child
591- transaction. No delivery outcome is assumed before then.
630+ Select “Observe child transaction” to verify the parent claim,
631+ outbound message, and any exact child transaction exposed by
632+ Studio Next. No delivery outcome is assumed before then.
592633 </ small >
593634 ) }
594635 </ div >
0 commit comments