Skip to content

Commit

Permalink
Add optional Headers param to fetchChain
Browse files Browse the repository at this point in the history
  • Loading branch information
jnsdls committed Sep 24, 2024
1 parent c145027 commit 4d89158
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/two-rings-compare.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"thirdweb": patch
---

add optional Headers param to `fetchChain`
4 changes: 4 additions & 0 deletions apps/dashboard/src/utils/fetchChain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@ import type { ChainMetadata } from "thirdweb/chains";

export async function fetchChain(
chainIdOrSlug: string | number,
headers = new Headers(),
): Promise<ChainMetadata | null> {
// always fetch from prod for chains for now
// TODO: re-visit this
const res = await fetch(
`https://api.thirdweb.com/v1/chains/${chainIdOrSlug}`,
{
headers,
},
);
if (res.ok) {
try {
Expand Down

0 comments on commit 4d89158

Please sign in to comment.