MCPcopy Create free account
hub / github.com/evolify/dumpfun / useLaunchpadDetail

Function useLaunchpadDetail

common/hooks/api.ts:58–93  ·  view source on GitHub ↗
(launchpad: Launchpad, duration: Duration)

Source from the content-addressed store, hash-verified

56}
57
58export function useLaunchpadDetail(launchpad: Launchpad, duration: Duration) {
59 const config = LaunchpadConfig[launchpad]
60 const url = `${LaunchpadDetailUrl}/${duration}?launchpads=${config.launchpad}`
61 const { data, isLoading, isValidating, error, mutate } = useSWR(
62 url,
63 getLaunchpadDetail,
64 {
65 onSuccess: data => {
66 if (data) {
67 if (prevData.current.length > 0) {
68 data.forEach((item: PoolInfo) => {
69 if (
70 !prevData.current.some(
71 t => t.baseAsset.id === item.baseAsset.id
72 )
73 ) {
74 item.latest = true
75 }
76 })
77 }
78 prevData.current = data
79 }
80 },
81 }
82 )
83
84 const prevData = useRef<PoolInfo[]>([])
85
86 return {
87 data,
88 isLoading,
89 isValidating,
90 error,
91 mutate,
92 }
93}
94
95export function useTrending(duration: Duration) {
96 const url = `${TrendingUrl}/${duration}`

Callers 1

ListFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected