move tx detail caching into sync engine, cache during history sync

- new sync-tx-details.ts: extracts tx+receipt caching from get-details.ts
- sync-tx-history: calls syncTxDetails per transfer hash during sync
- get-details: remove on-the-fly viem fetch + DB write (now handled
  by sync); returns null placeholder
- index: import syncTxDetails; simplify getTransactionDetails handler
This commit is contained in:
2026-05-22 10:18:33 +08:00
parent dd57a72e11
commit 357f707180
5 changed files with 134 additions and 93 deletions
+2 -6
View File
@@ -39,6 +39,7 @@ import {
txHistory,
evmWallets,
} from './lib/db/schema'
import { syncTxDetails } from './lib/sync/sync-tx-details'
const env = getENV()
@@ -647,12 +648,7 @@ const rpc = BrowserView.defineRPC<RPC>({
})
if (!key) return null
try {
const client = getClient(chainid, key)
const details = await getTransactionDetails(
client,
hash,
chainid,
)
const details = await getTransactionDetails(hash, chainid)
return details
} catch (error) {
console.log(error)