From 810b763b800883954908f66dc6b1519cee8fa82d Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Wed, 1 Nov 2023 22:25:33 +0000 Subject: [PATCH] api url tweaks --- .env.sample | 3 ++- .github/workflows/ci.yml | 1 + src/features/Web3/hooks/useFetchTokens/useFetchTokens.tsx | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.env.sample b/.env.sample index ea9f4bcb..67094b9a 100644 --- a/.env.sample +++ b/.env.sample @@ -4,4 +4,5 @@ PUBLIC_TYPEKIT_ID=xxx PUBLIC_UMAMI_SCRIPT_URL=xxx PUBLIC_UMAMI_WEBSITE_ID=xxx PUBLIC_INFURA_ID=xxx -PUBLIC_WALLETCONNECT_ID="xxx" \ No newline at end of file +PUBLIC_WALLETCONNECT_ID="xxx" +PUBLIC_WEB3_API_URL="xxx" \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c2089807..20854df6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,6 +16,7 @@ env: PUBLIC_UMAMI_WEBSITE_ID: ${{ secrets.GATSBY_UMAMI_WEBSITE_ID }} PUBLIC_INFURA_ID: ${{ secrets.GATSBY_INFURA_ID }} PUBLIC_WALLETCONNECT_ID: ${{ secrets.GATSBY_WALLETCONNECT_ID }} + PUBLIC_WEB3_API_URL: ${{ secrets.PUBLIC_WEB3_API_URL }} jobs: lint: diff --git a/src/features/Web3/hooks/useFetchTokens/useFetchTokens.tsx b/src/features/Web3/hooks/useFetchTokens/useFetchTokens.tsx index 6630c3f8..a0168b0c 100644 --- a/src/features/Web3/hooks/useFetchTokens/useFetchTokens.tsx +++ b/src/features/Web3/hooks/useFetchTokens/useFetchTokens.tsx @@ -6,6 +6,7 @@ import { $setTokens } from '@features/Web3/stores/tokens' import { $setSelectedToken } from '@features/Web3/stores/selectedToken' const fetcher = (url: string) => fetch(url).then((res) => res.json()) +const apiUrl = import.meta.env.PUBLIC_WEB3_API_URL // // Wrapper for fetching user tokens with swr. @@ -24,7 +25,7 @@ export function useFetchTokens() { useEffect(() => { if (!address || !chain?.id) return - const url = `https://web3.kremalicious.com/api/balance?address=${address}&chainId=${chain?.id}` + const url = `${apiUrl}/balance?address=${address}&chainId=${chain?.id}` setUrl(url) console.log('useFetchTokens', url) }, [address, chain?.id])