diff --git a/src/components/Buy/BuyComponent.tsx b/src/components/Buy/BuyComponent.tsx index 9aedd5c8..e21765fb 100644 --- a/src/components/Buy/BuyComponent.tsx +++ b/src/components/Buy/BuyComponent.tsx @@ -1,5 +1,5 @@ import React, { useEffect, useState } from 'react' -import { CircularProgress } from '@mui/material' +import { CircularProgress, Skeleton } from '@mui/material' import { setTrustline } from '@soroban-react/contracts' import { useSorobanReact } from '@soroban-react/core' import BuyModal from './BuyModal' @@ -49,7 +49,7 @@ const anchors: anchor[] = [ }, { name: 'Anclap', - home_domain: 'api.anclap.com', + home_domain: 'api-stage.anclap.ar', currency: 'ARS/PEN' }, ]; @@ -67,19 +67,23 @@ function BuyComponent() { anchorModal: { visible: boolean, selectedAnchor: anchor | undefined, + isLoading: boolean }, assetModal: { visible: boolean, selectedAsset: anchor | undefined, + isLoading: boolean }, }>({ anchorModal: { visible: false, selectedAnchor: undefined, + isLoading: false, }, assetModal: { visible: false, selectedAsset: undefined, + isLoading: false, } }); @@ -234,7 +238,7 @@ function BuyComponent() { clearInterval(popupCheckInterval); } } - let popupCheckInterval = setInterval(checkPopupClosed, 500); + let popupCheckInterval = setInterval(checkPopupClosed, 200); } catch (error: any) { setDepositError(error.toString()); console.error(error); @@ -316,9 +320,23 @@ function BuyComponent() { const fetchCurrencies = async () => { setIsLoading(true); + setModalState({ + ...modalState, + assetModal: { + ...modalState.assetModal, + isLoading: true, + } + }) const currencies = await getCurrencies(selectedAnchor?.home_domain!); setCurrencies(currencies); setIsLoading(false); + setModalState({ + ...modalState, + assetModal: { + ...modalState.assetModal, + isLoading: false, + } + }) handleOpen('asset'); } @@ -327,16 +345,18 @@ function BuyComponent() { setModalState({ ...modalState, anchorModal: { + ...modalState.anchorModal, visible: true, - selectedAnchor: modalState.anchorModal.selectedAnchor + selectedAnchor: modalState.anchorModal.selectedAnchor, } }); } else if (modal == 'asset') { setModalState({ ...modalState, assetModal: { + ...modalState.assetModal, visible: true, - selectedAsset: modalState.assetModal.selectedAsset + selectedAsset: modalState.assetModal.selectedAsset, } }); } @@ -347,16 +367,18 @@ function BuyComponent() { setModalState({ ...modalState, anchorModal: { + ...modalState.anchorModal, visible: false, - selectedAnchor: modalState.anchorModal.selectedAnchor + selectedAnchor: modalState.anchorModal.selectedAnchor, } }); } else if (modal == 'asset') { setModalState({ ...modalState, assetModal: { + ...modalState.assetModal, visible: false, - selectedAsset: modalState.anchorModal.selectedAnchor + selectedAsset: modalState.anchorModal.selectedAnchor, } }); } @@ -425,19 +447,38 @@ function BuyComponent() {
Recieve:
- fetchCurrencies()} disabled={!!!selectedAnchor}> - + fetchCurrencies()} disabled={!!!selectedAnchor}> + + {selectedAsset ? selectedAsset.code : 'Select asset'} + + {} + + + )} + {!modalState.assetModal.isLoading && ( + fetchCurrencies()} disabled={!!!selectedAnchor}> + - {selectedAsset ? selectedAsset.code : 'Select asset'} - - {} - + > + {selectedAsset ? selectedAsset.code : 'Select asset'} + + {} + + )} diff --git a/src/components/Buy/BuyStatusModal.tsx b/src/components/Buy/BuyStatusModal.tsx index 83501a3e..9f8ee175 100644 --- a/src/components/Buy/BuyStatusModal.tsx +++ b/src/components/Buy/BuyStatusModal.tsx @@ -86,11 +86,13 @@ function BuyStatusModal({ ) : ((depositError === '') ? ( - - Requesting authorization + + + Requesting authorization + - Please, confirm the transaction in your wallet to allow Soroswap send your addres to anchor. + Please, confirm the transaction in your wallet to allow Soroswap send your addres to anchor. @@ -98,10 +100,12 @@ function BuyStatusModal({ - Fill the interactive deposit + + Fill the interactive deposit + - Please, fill the requested information in the new window and wait for the deposit + Please, fill the requested information in the new window and wait for the deposit @@ -109,10 +113,12 @@ function BuyStatusModal({ - Await for the deposit: + + Await for the deposit: + - Everything is handled on our end. Please relax and take a break. Your funds should update automatically once the anchor completes the deposit. + Everything is handled on our end. Please relax and take a break. Your funds should update automatically once the anchor completes the deposit.