@@ -530,60 +530,64 @@ export class Recovery implements RecoveryInterface {
530530
531531 for ( const signer of signers ) {
532532 for ( const { chainId, provider } of providers ) {
533- const totalPayloads = await Extensions . Recovery . totalQueuedPayloads (
534- provider ,
535- this . shared . sequence . extensions . recovery ,
536- wallet ,
537- signer . address ,
538- )
539-
540- for ( let i = 0n ; i < totalPayloads ; i ++ ) {
541- const payloadHash = await Extensions . Recovery . queuedPayloadHashOf (
533+ try {
534+ const totalPayloads = await Extensions . Recovery . totalQueuedPayloads (
542535 provider ,
543536 this . shared . sequence . extensions . recovery ,
544537 wallet ,
545538 signer . address ,
546- i ,
547539 )
548540
549- const timestamp = await Extensions . Recovery . timestampForQueuedPayload (
550- provider ,
551- this . shared . sequence . extensions . recovery ,
552- wallet ,
553- signer . address ,
554- payloadHash ,
555- )
556-
557- const payload = await this . shared . sequence . stateProvider . getPayload ( payloadHash )
541+ for ( let i = 0n ; i < totalPayloads ; i ++ ) {
542+ const payloadHash = await Extensions . Recovery . queuedPayloadHashOf (
543+ provider ,
544+ this . shared . sequence . extensions . recovery ,
545+ wallet ,
546+ signer . address ,
547+ i ,
548+ )
549+
550+ const timestamp = await Extensions . Recovery . timestampForQueuedPayload (
551+ provider ,
552+ this . shared . sequence . extensions . recovery ,
553+ wallet ,
554+ signer . address ,
555+ payloadHash ,
556+ )
557+
558+ const payload = await this . shared . sequence . stateProvider . getPayload ( payloadHash )
559+
560+ // If ready, we need to check if it was executed already
561+ // for this, we check if the wallet nonce for the given space
562+ // is greater than the nonce in the payload
563+ if ( timestamp < Date . now ( ) / 1000 && payload && Payload . isCalls ( payload . payload ) ) {
564+ const nonce = await this . shared . modules . wallets . getNonce ( chainId , wallet , payload . payload . space )
565+ if ( nonce > i ) {
566+ continue
567+ }
568+ }
558569
559- // If ready, we need to check if it was executed already
560- // for this, we check if the wallet nonce for the given space
561- // is greater than the nonce in the payload
562- if ( timestamp < Date . now ( ) / 1000 && payload && Payload . isCalls ( payload . payload ) ) {
563- const nonce = await this . shared . modules . wallets . getNonce ( chainId , wallet , payload . payload . space )
564- if ( nonce > i ) {
565- continue
570+ // The id is the index + signer address + chainId + wallet address
571+ const id = `${ i } -${ signer . address } -${ chainId } -${ wallet } `
572+
573+ // Create a new payload
574+ const payloadEntry : QueuedRecoveryPayload = {
575+ id,
576+ index : i ,
577+ recoveryModule : this . shared . sequence . extensions . recovery ,
578+ wallet : wallet ,
579+ signer : signer . address ,
580+ chainId,
581+ startTimestamp : timestamp ,
582+ endTimestamp : timestamp + signer . requiredDeltaTime ,
583+ payloadHash,
584+ payload : payload ?. payload ,
566585 }
567- }
568586
569- // The id is the index + signer address + chainId + wallet address
570- const id = `${ i } -${ signer . address } -${ chainId } -${ wallet } `
571-
572- // Create a new payload
573- const payloadEntry : QueuedRecoveryPayload = {
574- id,
575- index : i ,
576- recoveryModule : this . shared . sequence . extensions . recovery ,
577- wallet : wallet ,
578- signer : signer . address ,
579- chainId,
580- startTimestamp : timestamp ,
581- endTimestamp : timestamp + signer . requiredDeltaTime ,
582- payloadHash,
583- payload : payload ?. payload ,
587+ payloads . push ( payloadEntry )
584588 }
585-
586- payloads . push ( payloadEntry )
589+ } catch ( err ) {
590+ console . error ( 'Recovery.fetchQueuedPayloads error' , err )
587591 }
588592 }
589593 }
0 commit comments