diff --git a/package.json b/package.json
index 7d07c60..94c20bd 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "ghost-dao-interface",
"private": true,
- "version": "0.5.42",
+ "version": "0.5.43",
"type": "module",
"scripts": {
"dev": "vite",
diff --git a/src/containers/Dex/Dex.jsx b/src/containers/Dex/Dex.jsx
index 82fa6bd..06c61df 100644
--- a/src/containers/Dex/Dex.jsx
+++ b/src/containers/Dex/Dex.jsx
@@ -55,6 +55,8 @@ const Dex = ({ chainId, address, connect }) => {
const [secondsToWait, setSecondsToWait] = useState(localStorage.getItem("dex-deadline") || "60");
const [slippage, setSlippage] = useState(localStorage.getItem("dex-slippage") || "5");
const [formatDecimals, setFormatDecimals] = useState(localStorage.getItem("dex-decimals") || "5");
+ const [actualDestinationAddress, setActualDestinationAddress] = useState(localStorage.getItem("dex-destination"));
+ const [destinationAddress, setDestinationAddress] = useState(actualDestinationAddress);
const [tokenAddressTop, setTokenAddressTop] = useState(RESERVE_ADDRESSES[chainId]);
const [tokenAddressBottom, setTokenAddressBottom] = useState(FTSO_ADDRESSES[chainId]);
@@ -162,6 +164,24 @@ const Dex = ({ chainId, address, connect }) => {
}
}
+ const setDestinationAddressInner = (value) => {
+ const cleanedValue = value.trim();
+ const isEvmAddress = /^0x[a-fA-F0-9]{40}$/.test(cleanedValue);
+ if (isEvmAddress) {
+ localStorage.setItem("dex-destination", value);
+ setActualDestinationAddress(value);
+ } else if (!isEvmAddress && actualDestinationAddress) {
+ localStorage.removeItem("dex-destination");
+ setActualDestinationAddress(undefined);
+ }
+ setDestinationAddress(value);
+ }
+
+ const handleCloseSetting = () => {
+ setDestinationAddress(undefined);
+ handleSettingsOpen(false);
+ }
+
return (
@@ -203,7 +223,7 @@ const Dex = ({ chainId, address, connect }) => {
minHeight="200px"
open={settingsOpen}
headerText={"Settings"}
- onClose={() => handleSettingsOpen(false)}
+ onClose={() => handleCloseSetting()}
>
Slippage
@@ -267,6 +287,31 @@ const Dex = ({ chainId, address, connect }) => {
+
+
+
+ {`${actualDestinationAddress ? "Custom" : "Default"} destination address`}
+
+
+
+ setDestinationAddressInner(event.currentTarget.value)}
+ />
+
+
+
+
+ Recipient address of swapped assets and liquidity tokens
+
+
+
{
dexAddresses={dexAddresses}
connect={connect}
slippage={slippage}
+ destination={actualDestinationAddress ? actualDestinationAddress : address}
secondsToWait={secondsToWait}
setTopTokenListOpen={setTopTokenListOpen}
setBottomTokenListOpen={setBottomTokenListOpen}
@@ -338,6 +384,7 @@ const Dex = ({ chainId, address, connect }) => {
dexAddresses={dexAddresses}
connect={connect}
slippage={slippage}
+ destination={actualDestinationAddress ? actualDestinationAddress : address}
secondsToWait={secondsToWait}
setTopTokenListOpen={setTopTokenListOpen}
setBottomTokenListOpen={setBottomTokenListOpen}
diff --git a/src/containers/Dex/PoolContainer.jsx b/src/containers/Dex/PoolContainer.jsx
index fcd0cfc..b6cbacd 100644
--- a/src/containers/Dex/PoolContainer.jsx
+++ b/src/containers/Dex/PoolContainer.jsx
@@ -23,6 +23,7 @@ const PoolContainer = ({
dexAddresses,
connect,
slippage,
+ destination,
secondsToWait,
setTopTokenListOpen,
setBottomTokenListOpen,
@@ -129,8 +130,6 @@ const PoolContainer = ({
setIsPending(true);
const deadline = Math.floor(Date.now() / 1000) + secondsToWait;
- const destination = address;
-
const shares = 100000;
const one = BigInt(shares * 100);
const floatSlippage = slippage === "" ? 0 : parseFloat(slippage);
diff --git a/src/containers/Dex/SwapContainer.jsx b/src/containers/Dex/SwapContainer.jsx
index 6594316..180de50 100644
--- a/src/containers/Dex/SwapContainer.jsx
+++ b/src/containers/Dex/SwapContainer.jsx
@@ -27,6 +27,7 @@ const SwapContainer = ({
setTopTokenListOpen,
setBottomTokenListOpen,
slippage,
+ destination,
secondsToWait,
setIsSwap,
formatDecimals
@@ -108,8 +109,6 @@ const SwapContainer = ({
setIsPending(true);
const deadline = Math.floor(Date.now() / 1000) + secondsToWait;
- const destination = address;
-
const shares = 100000;
const one = BigInt(shares * 100);
const floatSlippage = slippage === "" ? 0 : parseFloat(slippage);