diff --git a/public/assets/locales/en/translation.json b/public/assets/locales/en/translation.json
index f56ebd6..507a571 100644
--- a/public/assets/locales/en/translation.json
+++ b/public/assets/locales/en/translation.json
@@ -250,7 +250,7 @@
"DepositTETHContentBefore": "Ropsten network ETH test Only accepted! For free download",
"DepositTETHContentAfter": "go to send a test ETH to this address. You must change your wallet Etherium network to Ropsten. This network is on the Metamask wallet network list by default. Any transaction with an amount equal to or greater than 0.001 ETH to the above address will be added to your account.",
"minDeposit": "The minimum acceptable amount {{min}} {{currency}}",
- "minDepositText": "Any transaction with a value greater than {{min}} {{currency}} will be added to your account at the following address.",
+ "minDepositText": "Any transaction will be added to your account at the following address.",
"DepositTBTCContentBefore": "Only BTC test accepted! For free download",
"DepositTBTCContentAfter": "go to any transaction with an amount equal to or greater than 0.001 BTC to the above address will be added to your account.",
"DepositTUSDTContentBefore": "Only USDT Ropsten Network Test is accepted! To learn how to get free,",
@@ -258,7 +258,9 @@
"depositTime": "* Your balance will increase {{time}} minutes after depositing to the above address.",
"securityConsiderations": "Due to security considerations, the transfer to the account may be delayed slightly. You can see the withdrawal status on the same page in the Deposit / Withdrawal Transactions section.",
"network": "Network",
- "selectNetwork": "Select Network"
+ "selectNetwork": "Select Network",
+ "gettingAddress": "Getting address...",
+ "errorGettingAddress": "Failed to get address"
},
"CallbackPage": {
"ok": "The deposit was successful.",
diff --git a/public/assets/locales/fa/translation.json b/public/assets/locales/fa/translation.json
index 9a36380..f1aced5 100644
--- a/public/assets/locales/fa/translation.json
+++ b/public/assets/locales/fa/translation.json
@@ -250,7 +250,7 @@
"DepositTETHContentBefore": "فقط ETH تستی شبکه Ropsten مورد قبول قرار می گیرد! برای دریافت رایگان به ",
"DepositTETHContentAfter": " بروید. برای ارسال ETH تستی به این آدرس، باید شبکه اتریومی کیف پول خود را به Ropsten تغییر دهید. این شبکه به طور پیش فرض در فهرست شبکه های کیف پول Metamask وجود دارد. هر تراکنشی با مقدار مساوی یا بیشتر از ۰.۰۰۱ ETH به آدرس بالا، به حساب شما افزوده می شود.",
"minDeposit": "حداقل میزان قابل قبول {{min}} {{currency}}",
- "minDepositText": "هر تراکنشی با مقدار بیشتر از {{min}} {{currency}} به آدرس زیر ، به حساب شما افزوده می شود.",
+ "minDepositText": "هر تراکنشی به آدرس زیر ، به حساب شما افزوده می شود.",
"DepositTBTCContentBefore": "فقط BTC تستی مورد قبول قرار می گیرد! برای دریافت رایگان به ",
"DepositTBTCContentAfter": " بروید. هر تراکنشی با مقدار مساوی یا بیشتر از ۰.۰۰۱ BTC به آدرس بالا، به حساب شما افزوده می شود.",
"DepositTUSDTContentBefore": "فقط USDT تستی شبکه Ropsten مورد قبول قرار می گیرد! برای آشنایی با روش دریافت رایگان به ",
@@ -258,7 +258,9 @@
"depositTime": "* موجودی شما {{time}} دقیقه بعد از واریز به آدرس بالا، افزایش پیدا می کند.",
"securityConsiderations": "باتوجه به ملاحظات امنیتی ممکن است انتقال به حساب با کمی تاخیر صورت بگیرد. می توانید وضعیت برداشت را در همین صفحه از بخش ترکنش های واریز/برداشت ببینید.",
"network": "شبکه",
- "selectNetwork": " شبکه را انتخاب کنید"
+ "selectNetwork": " شبکه را انتخاب کنید",
+ "gettingAddress": "درحال گرفتن آدرس...",
+ "errorGettingAddress": "خطا در گرفتن آدرس"
},
"CallbackPage": {
"ok": "واریز وجه با موفقیت انجام شد.",
diff --git a/src/components/TextInput/TextInput.js b/src/components/TextInput/TextInput.js
index 3e1c905..bde379c 100644
--- a/src/components/TextInput/TextInput.js
+++ b/src/components/TextInput/TextInput.js
@@ -27,7 +27,7 @@ const TextInput = (props) => {
onChange={onchange}
options={options}
classNamePrefix="select"
- className={`select ${classes.selectBox}`}
+ className={`${classes.selectBox} select`}
{...other}
/>
}
diff --git a/src/main/Mobile/Pages/UserPanel/Secttions/Content/components/Wallet/components/Deposit/Deposit.js b/src/main/Mobile/Pages/UserPanel/Secttions/Content/components/Wallet/components/Deposit/Deposit.js
index dbe4eaa..428b6bf 100644
--- a/src/main/Mobile/Pages/UserPanel/Secttions/Content/components/Wallet/components/Deposit/Deposit.js
+++ b/src/main/Mobile/Pages/UserPanel/Secttions/Content/components/Wallet/components/Deposit/Deposit.js
@@ -1,129 +1,42 @@
-import React, {useEffect, useRef} from 'react';
+import React, {useEffect, useRef, useState} from 'react';
import classes from './Deposit.module.css'
import QRCode from "react-qr-code";
import {Trans, useTranslation} from "react-i18next";
import TextInput from "../../../../../../../../../../components/TextInput/TextInput";
import {useParams} from "react-router-dom";
-import {useGetDepositAddress} from "../../../../../../../../../../queries";
+import {useGetCurrencyInfo, useGetDepositAddress} from "../../../../../../../../../../queries";
import {toast} from "react-hot-toast";
import Loading from "../../../../../../../../../../components/Loading/Loading";
import Error from "../../../../../../../../../../components/Error/Error";
import Icon from "../../../../../../../../../../components/Icon/Icon";
+import Address from "./components/Address/Address";
const Deposit = () => {
const {id} = useParams();
const {t} = useTranslation();
- const addressRef = useRef(null);
useEffect(() => {
toast.dismiss()
}, [])
- const copyToClipboard = () => {
- addressRef.current.select();
- document.execCommand("copy");
- toast.success();
- };
+ const [networkName, setNetworkName] = useState({value: 0, error: []});
- const {data: address, isLoading, error, refetch} = useGetDepositAddress(id)
+ const selectRef = useRef()
+ const {data: currencyInfo, isLoading: CILoading, error: CIError, refetch: refetchCI} = useGetCurrencyInfo(id)
useEffect(() => {
- if (id !== "IRT") refetch()
+ setNetworkName({value: 0, error: []})
+
}, [id]);
- const helpText = () => {
- if (id === "TETH") {
- return
-
{t("DepositWithdraw.important")}:
-
- {t("DepositWithdraw.DepositTETHContentBefore")}
- window.open('https://faucet.dimensions.network/')}>https://faucet.ropsten.be
- {t("DepositWithdraw.DepositTETHContentAfter")}
-
-
-
-
-
-
-
-
- }
- if (id === "TBTC") {
- return
-
{t("DepositWithdraw.important")}:
-
- {t("DepositWithdraw.DepositTBTCContentBefore")}
- window.open('https://testnet-faucet.com/btc-testnet')}>https://testnet-faucet.com/btc-testnet
- {t("DepositWithdraw.DepositTBTCContentAfter")}
-
-
-
-
-
-
-
-
- }
- if (id === "TUSDT") {
- return
-
{t("DepositWithdraw.important")}:
-
- {t("DepositWithdraw.DepositTUSDTContentBefore")}
- window.open('https://bit.ly/ROPTokens')}>https://bit.ly/ROPTokens
- {t("DepositWithdraw.DepositTUSDTContentAfter")}
-
-
-
-
-
-
-
-
- }
- }
+ useEffect(() => {
+ if (id !== "IRT") refetchCI()
+ }, [id]);
- const lowestPrice = (id) => {
+ /*const lowestPrice = (id) => {
switch (id) {
case "BTC":
return 0.001;
@@ -134,49 +47,38 @@ const Deposit = () => {
default:
return 0;
}
- };
+ };*/
// if (id === "IRT") return
if (id === "IRT") return {t("comingSoon")}
- if (isLoading) return
- if (error) return
+ if (CILoading) return
+ if (CIError) return
+
+ /**/
return (
-
-
-
- copyToClipboard()}
- customClass={`hover-text cursor-pointer`}
- />
- }
- customClass={`${classes.depositInput} my-3`}
- readOnly={true}
- type="text"
- customRef={addressRef}
- value={address.address}
- />
-
-
- { (id === "TETH" || id === "TUSDT" || id === "TBTC") && helpText() }
+
+
{
+ return {value: index, label: `${chain.network} - ${chain.currency}`}
+ })}
+ lead={t('DepositWithdraw.network')}
+ type="select"
+ value={currencyInfo?.chains[networkName.value] && {
+ value: networkName.value,
+ label: `${currencyInfo?.chains[networkName.value].network} - ${currencyInfo?.chains[networkName.value].currency}`
+ }}
+ onchange={(e) => setNetworkName({value: e?.value || 0, error: []})}
+ customRef={selectRef}
+ alerts={networkName.error}
+ customClass={`width-100 ${classes.thisInput}`}
+ />
+ { currencyInfo && }
);
};
diff --git a/src/main/Mobile/Pages/UserPanel/Secttions/Content/components/Wallet/components/Deposit/Deposit.module.css b/src/main/Mobile/Pages/UserPanel/Secttions/Content/components/Wallet/components/Deposit/Deposit.module.css
index 5307d94..29cb34c 100644
--- a/src/main/Mobile/Pages/UserPanel/Secttions/Content/components/Wallet/components/Deposit/Deposit.module.css
+++ b/src/main/Mobile/Pages/UserPanel/Secttions/Content/components/Wallet/components/Deposit/Deposit.module.css
@@ -9,4 +9,12 @@
width: 85% !important;
cursor: not-allowed;
font-family: 'Roboto', sans-serif;
+}
+
+
+.thisInput :global(.lead) {
+ width: 25%;
+}
+.thisInput :global(.select) {
+ width: 75% !important;
}
\ No newline at end of file
diff --git a/src/main/Mobile/Pages/UserPanel/Secttions/Content/components/Wallet/components/Deposit/components/Address/Address.js b/src/main/Mobile/Pages/UserPanel/Secttions/Content/components/Wallet/components/Deposit/components/Address/Address.js
new file mode 100644
index 0000000..3ef19a2
--- /dev/null
+++ b/src/main/Mobile/Pages/UserPanel/Secttions/Content/components/Wallet/components/Deposit/components/Address/Address.js
@@ -0,0 +1,69 @@
+import React, {useEffect, useRef} from 'react';
+import classes from "../../Deposit.module.css";
+import {useParams} from "react-router-dom";
+import {Trans, useTranslation} from "react-i18next";
+import {useGetDepositAddress} from "../../../../../../../../../../../../queries";
+import {toast} from "react-hot-toast";
+import TextInput from "../../../../../../../../../../../../components/TextInput/TextInput";
+import Icon from "../../../../../../../../../../../../components/Icon/Icon";
+import QRCode from "react-qr-code";
+
+const Address = ({network}) => {
+
+ const {id} = useParams();
+ const {t} = useTranslation();
+ const addressRef = useRef(null);
+
+ const copyToClipboard = () => {
+ addressRef.current.select();
+ document.execCommand("copy");
+ toast.success(
);
+ };
+
+ const {data: address, isLoading, error, refetch: refetchAddress} = useGetDepositAddress(id, network)
+
+ useEffect(() => {
+ if (id !== "IRT") {
+ refetchAddress()
+ }
+ }, [network]);
+
+ if (isLoading) return
{t('DepositWithdraw.gettingAddress')}
+ if (error) return
{t('DepositWithdraw.errorGettingAddress')}
+
+
+ return (
+
+
+
copyToClipboard()}
+ customClass={`hover-text cursor-pointer`}
+ />
+ }
+ customClass={`${classes.depositInput} my-5 width-100 fs-0-8`}
+ readOnly={true}
+ type="text"
+ customRef={addressRef}
+ value={address.address}
+ />
+
+
+
+
+ );
+};
+
+export default Address;
diff --git a/src/queries/hooks/useGetDepositAddress.js b/src/queries/hooks/useGetDepositAddress.js
index bffdfcd..535b1b5 100644
--- a/src/queries/hooks/useGetDepositAddress.js
+++ b/src/queries/hooks/useGetDepositAddress.js
@@ -1,18 +1,19 @@
import {useQuery} from "@tanstack/react-query";
import {getDepositAddress} from "js-api-client";
-export const useGetDepositAddress = (currency) => {
+export const useGetDepositAddress = (currency, network) => {
+
return useQuery(
- ['depositAddress', currency],
- () => getDepositAddressFunc(currency),
+ ['depositAddress', currency, network],
+ () => getDepositAddressFunc(currency, network),
{
retry: 1,
refetchOnMount: false,
- staleTime: 30*60*1000
+ staleTime: 30*60*1000,
});
}
-const getDepositAddressFunc = async (currency) => {
- const {data} = await getDepositAddress(currency)
+const getDepositAddressFunc = async (currency, network) => {
+ const {data} = await getDepositAddress(currency, network)
return data;
}
\ No newline at end of file
diff --git a/yarn.lock b/yarn.lock
index e02fc94..a951c50 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -6478,7 +6478,7 @@ jiti@^1.17.2:
"js-api-client@https://github.com/opexdev/js-api-client.git#develop":
version "1.0.0-beta2"
- resolved "https://github.com/opexdev/js-api-client.git#e61b9acc9419447f365a82965b40bf69cbad72dd"
+ resolved "https://github.com/opexdev/js-api-client.git#c185b3b2b61c2655592b4d31276473bed5b47a25"
js-sdsl@^4.1.4:
version "4.4.0"