Skip to content

Commit 112c220

Browse files
committed
do not fetch safe messages that are older than 1 week
1 parent c0cffba commit 112c220

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/libs/safe/safe.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,13 @@ export async function getLatestMessages(
341341
ordering: '-created',
342342
limit: 15
343343
})
344-
return { ...response, chainId, type: 'message' }
344+
const currentTime = new Date().getTime()
345+
const oneWeek = 7 * 24 * 60 * 60 * 1000
346+
// filter messages older than one week
347+
const finalRes = response.results.filter(
348+
(m) => new Date(m.created).getTime() + oneWeek > currentTime
349+
)
350+
return { ...response, results: finalRes, chainId, type: 'message' }
345351
}
346352

347353
export async function getTransaction(

0 commit comments

Comments
 (0)