Skip to content

Commit

Permalink
fix: Finalize for bermuda pre-launch
Browse files Browse the repository at this point in the history
  • Loading branch information
OwshenNetwork committed Jan 20, 2024
1 parent bb1f0b0 commit af4d2ca
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 33 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "owshen"
version = "0.1.0"
version = "0.1.1"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/DropDown/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const Dropdown = ({
className="absolute w-full py-2 mt-1 space-y-1 text-sm bg-blue-100 border border-blue-500 rounded-lg shadow-lg z-50 not"
aria-label="submenu"
>
{options.map(({ title, value, img }, id) => {
{options?.map(({ title, value, img }, id) => {
return (
<button
className="flex items-center justify-center w-full py-1 font-medium border-b border-blue-500 last:border-0 transition-colors duration-150 hover:text-gray-900 focus:outline-none focus:shadow-outline hover:bg-gray-100"
Expand Down
6 changes: 3 additions & 3 deletions client/src/components/Main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ const Main = ({ children }) => {
if (isTest) {
return setIsInprogress(true);
}
address ? setIsOpen(true) : toast.error("Connect your wallet first");
address ? setIsOpen(true) : toast.error("Connect your wallet first!");
};
const diveAmount = () => {
let totalAmount = 0;
Expand Down Expand Up @@ -184,10 +184,10 @@ const Main = ({ children }) => {
<button data-tooltip-id="Send" onClick={canOpenModal}>
<img src={SendIcon} />
</button>
<Tooltip id="swap" place="bottom" content="swap" />
<Tooltip id="Swap" place="bottom" content="Swap" />
<button
onClick={() => setIsInprogress(true)}
data-tooltip-id="swap"
data-tooltip-id="Swap"
// onClick={openWithdraw}
>
<img src={SwapIcon} />
Expand Down
46 changes: 25 additions & 21 deletions client/src/components/Modal/TransactionModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
setReceivedCoins,
selectReceivedCoins,
selectNetwork,
selectIsTest,
} from "../../store/containerSlice";
import { useAccount } from "wagmi";
import { getERC20Balance } from "../../utils/helper";
Expand Down Expand Up @@ -43,13 +44,16 @@ const TransactionModal = ({
const [tokenOptions, setTokenOptions] = useState([]);
const [MaxBalanceOfWithdraw, setMaxBalanceOfWithdraw] = useState("");
const [selectedContract, setSelectedContract] = useState("");
const isTest = useSelector(selectIsTest);

const walletOptions = [
{
title: "Your Ethereum Account",
value: "Your Ethereum Account",
img: MetaMaskLogo,
},
isTest
? {
title: "Your Ethereum Account",
value: "Your Ethereum Account",
img: MetaMaskLogo,
}
: {},
{ title: "Your Owshen Account", value: "Your Owshen Account", img: Logo },
];
useEffect(() => {
Expand Down Expand Up @@ -120,10 +124,10 @@ const TransactionModal = ({
return toast.error("No matching coin is found");
};
const getStealth = async () => {
if (!address) return toast.error("Connect your wallet first");
if (!destOwshenWallet) return toast.error("Enter your Destination");
if (!tokenContract) return toast.error("Select your token");
if (!tokenAmount) return toast.error("Enter amount of token");
if (!address) return toast.error("Connect your wallet first!");
if (!destOwshenWallet) return toast.error("Enter your destination!");
if (!tokenContract) return toast.error("Select your token!");
if (!tokenAmount) return toast.error("Enter amount of token!");
if (network.chainId !== chainId)
return toast.error(
`Please change your wallet network to ${network.name}`
Expand Down Expand Up @@ -169,20 +173,20 @@ const TransactionModal = ({
setIsOpen(false);
});
} catch (error) {
toast.error("Error while getting approve or deposit flow");
toast.error("Error while transferring tokens!");

console.log(error, "Error while getting approve or deposit flow");
console.log(error, "Error while transferring tokens!");
}
})
.catch((error) => {
return toast.error(`Internal server error: ${error}`);
});
};
const send = async () => {
if (!address) return toast.error("Connect your wallet first");
if (!destOwshenWallet) return toast.error("Enter your Destination");
if (!tokenContract) return toast.error("Select your token");
if (!tokenAmount) return toast.error("Enter amount of token");
if (!address) return toast.error("Connect your wallet first!");
if (!destOwshenWallet) return toast.error("Enter your destination!");
if (!tokenContract) return toast.error("Select your token!");
if (!tokenAmount) return toast.error("Enter amount of token!");
if (network.chainId !== chainId)
return toast.error(
`Please change your wallet network to ${network.name}`
Expand Down Expand Up @@ -256,8 +260,8 @@ const TransactionModal = ({
const txReceipt = await txResponse.wait();
console.log("Transaction receipt", txReceipt);
} catch (error) {
toast.error("Error while getting withdraw flow");
console.log(error, "Error while getting withdraw flow");
toast.error("Error while transferring tokens!");
console.log(error, "Error while transferring tokens!");
}
})
.catch((error) => {
Expand All @@ -267,12 +271,12 @@ const TransactionModal = ({

const callSend = async () => {
OwshenWallet.wallet === destOwshenWallet
? await getStealth()
? toast.error("You can't send to yourself!")
: await send();
};

const withdrawal = async (index, owshen, address) => {
if (!address) return toast.error("Connect your wallet first");
if (!address) return toast.error("Connect your wallet first!");
// if (tokenAmount > trueAmount(MaxBalanceOfWithdraw)) {
// return toast.error(
// "your entered amount for withdraw is grater than max value of the selected token"
Expand Down Expand Up @@ -334,7 +338,7 @@ const TransactionModal = ({
console.log("Transaction receipt", txReceipt);
setIsOpen(false);
} catch (error) {
toast.error("Error while getting withdraw flow");
toast.error("Error while transferring tokens!");
setIsOpen(false);
}
})
Expand Down Expand Up @@ -380,7 +384,7 @@ const TransactionModal = ({
<b>Token: </b>
</label>
<Dropdown
label={isDataSet ? "DIVE" : "choose your token"}
label={isDataSet ? "DIVE" : "Choose your token"}
options={tokenOptions}
select={setTokenContract}
style={`py-5 ${isDataSet ? "pointer-events-none" : ""}`}
Expand Down
3 changes: 2 additions & 1 deletion client/src/components/ReceivedCoins/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ const ReceivedCoinList = () => {
</button>

<button
onClick={() => withdrawHandler(coin)}
// onClick={() => withdrawHandler(coin)}
onClick={() => setIsInprogress(true)}
className="ml-2"
>
<img alt="" src={SwapIcon} />
Expand Down
14 changes: 8 additions & 6 deletions client/src/components/SelectNetwork/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,23 @@ const SelectNetwork = () => {
process.env.REACT_APP_OWSHEN_ENDPOINT || "http://127.0.0.1:9000";
const accountData = useAccount();
const chainId = accountData ? accountData.chainId : undefined;
const [network, setNetWork] = useState("select network");
const [network, setNetWork] = useState("Select Network");

useEffect(() => {}, []);

const isTest = useSelector(selectIsTest);
const netWorkOptions = [
isTest
? {
title: "Goerli",
value: "Goerli",
}
: {},
!isTest && {
title: "Goerli",
value: "Goerli",
},
{
title: "Sepolia",
value: "Sepolia",
},
!isTest && { title: "Localhost", value: "Localhost" },
isTest ? { title: "Localhost", value: "Localhost" } : {},
];
useEffect(() => {
checkNetwork(chainId);
Expand Down

1 comment on commit af4d2ca

@RestlessHavoc
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice

Please sign in to comment.