fix escrow handling and fetching

This commit is contained in:
thesn10
2026-06-26 20:01:36 +02:00
parent 02c26e186f
commit 0c86751d51
7 changed files with 212 additions and 26 deletions

View File

@@ -0,0 +1,18 @@
import { useQuery } from '@tanstack/react-query'
import { useCluster } from '@solana/connector/react'
import { createSolanaRpc } from '@solana/kit'
import { fetchOrderByEscrow } from '@solisting/sdk'
import type { Address } from '@solana/kit'
export function useOrderByEscrow(escrowPda: Address) {
const { cluster } = useCluster()
return useQuery({
queryKey: ['orderByEscrow', escrowPda, cluster?.id],
queryFn: () => {
const rpc = createSolanaRpc(cluster!.url)
return fetchOrderByEscrow(rpc, escrowPda)
},
enabled: !!cluster && !!escrowPda,
refetchInterval: 30_000,
})
}