MCPcopy Create free account
hub / github.com/wevm/viem / fetchTokenlist

Function fetchTokenlist

scripts/generateTokenlist.ts:206–216  ·  view source on GitHub ↗
(uri: string)

Source from the content-addressed store, hash-verified

204}
205
206async function fetchTokenlist(uri: string): Promise<Tokenlist> {
207 const response = await fetch(uri)
208 if (!response.ok)
209 throw new Error(
210 `Failed to fetch ${uri}: ${response.status} ${response.statusText}`,
211 )
212
213 const tokenlist = (await response.json()) as unknown
214 assertTokenlist(tokenlist, uri)
215 return tokenlist
216}
217
218async function getChainTargetById(chainIds: Set<number>) {
219 const chainExports = getChainExports()

Callers 1

getTokenlistTokensFunction · 0.85

Calls 2

fetchFunction · 0.85
assertTokenlistFunction · 0.85

Tested by

no test coverage detected