From c3f89b8006a1c2c16347bd312665979d772e0e78 Mon Sep 17 00:00:00 2001 From: SpaghettiOverload Date: Thu, 16 Feb 2023 14:15:51 +0200 Subject: [PATCH] adding faucet_url --- .env.example | 4 ++++ src/api/getFaucetTokens.ts | 4 ++-- src/containers/Faucet/components/Form/index.tsx | 2 +- src/utils/constants.tsx | 7 +++++++ 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/.env.example b/.env.example index e772014..0decfa7 100644 --- a/.env.example +++ b/.env.example @@ -1,5 +1,6 @@ # LOCAL VITE_APP_LOCAL_CAPTCHA_SITE_KEY='' +VITE_APP_LOCAL_FAUCET_URL='' VITE_APP_LOCAL_FAUCET_ADDRESS='' VITE_APP_LOCAL_BRIDGE_URL='' VITE_APP_LOCAL_GRAPHQL_URL='' @@ -13,6 +14,7 @@ VITE_APP_LOCAL_CHAIN_ID='' # DEV VITE_APP_DEV_CAPTCHA_SITE_KEY='' +VITE_APP_DEV_FAUCET_URL='' VITE_APP_DEV_FAUCET_ADDRESS='' VITE_APP_DEV_BRIDGE_URL='' VITE_APP_DEV_GRAPHQL_URL='' @@ -26,6 +28,7 @@ VITE_APP_DEV_CHAIN_ID='' # PRIVATE VITE_APP_PRIVATE_CAPTCHA_SITE_KEY='' +VITE_APP_PRIVATE_FAUCET_URL='' VITE_APP_PRIVATE_FAUCET_ADDRESS='' VITE_APP_PRIVATE_BRIDGE_URL='' VITE_APP_PRIVATE_GRAPHQL_URL='' @@ -39,6 +42,7 @@ VITE_APP_PRIVATE_CHAIN_ID='' # PUBLIC VITE_APP_PUBLIC_CAPTCHA_SITE_KEY='' +VITE_APP_PUBLIC_FAUCET_URL='' VITE_APP_PUBLIC_FAUCET_ADDRESS='' VITE_APP_PUBLIC_BRIDGE_URL='' VITE_APP_PUBLIC_GRAPHQL_UR='' diff --git a/src/api/getFaucetTokens.ts b/src/api/getFaucetTokens.ts index 8913d55..af8c459 100644 --- a/src/api/getFaucetTokens.ts +++ b/src/api/getFaucetTokens.ts @@ -1,11 +1,11 @@ import axios from 'axios' -const getFaucetTokens = async (faucetAddress: string, data: { +const getFaucetTokens = async (faucedUrl: string, data: { address: string coins: Array captchaResponse: string }) => { - return axios.post(faucetAddress, data) + return axios.post(faucedUrl, data) } export default getFaucetTokens diff --git a/src/containers/Faucet/components/Form/index.tsx b/src/containers/Faucet/components/Form/index.tsx index 5432bbd..cf27efd 100644 --- a/src/containers/Faucet/components/Form/index.tsx +++ b/src/containers/Faucet/components/Form/index.tsx @@ -85,7 +85,7 @@ const Form = () => { handleModal({ open: true, status: ModalStatus.LOADING }) const response = await getFaucetTokens( - CHAIN_DETAILS.FAUCET_ADDRESS[chosenNetwork as keyof typeof CHAIN_DETAILS.FAUCET_ADDRESS], + CHAIN_DETAILS.FAUCET_URL[chosenNetwork as keyof typeof CHAIN_DETAILS.FAUCET_URL], data ) diff --git a/src/utils/constants.tsx b/src/utils/constants.tsx index 11b6123..047087b 100644 --- a/src/utils/constants.tsx +++ b/src/utils/constants.tsx @@ -9,6 +9,13 @@ export const CHAIN_DETAILS = { PUBLIC: import.meta.env.VITE_APP_PUBLIC_CAPTCHA_SITE_KEY || process.env.VITE_APP_PUBLIC_CAPTCHA_SITE_KEY || "", MAINNET: '' }, + FAUCET_URL: { + LOCAL: import.meta.env.VITE_APP_LOCAL_FAUCET_URL || process.env.VITE_APP_LOCAL_FAUCET_URL || "", + DEV: import.meta.env.VITE_APP_DEV_FAUCET_URL || process.env.VITE_APP_DEV_FAUCET_URL || "", + PRIVATE: import.meta.env.VITE_APP_PRIVATE_FAUCET_URL || process.env.VITE_APP_PRIVATE_FAUCET_URL || "", + PUBLIC: import.meta.env.VITE_APP_PUBLIC_FAUCET_URL || process.env.VITE_APP_PUBLIC_FAUCET_URL || "", + MAINNET: '' + }, FAUCET_ADDRESS: { LOCAL: import.meta.env.VITE_APP_LOCAL_FAUCET_ADDRESS || process.env.VITE_APP_LOCAL_FAUCET_ADDRESS || "", DEV: import.meta.env.VITE_APP_DEV_FAUCET_ADDRESS || process.env.VITE_APP_DEV_FAUCET_ADDRESS || "",