diff --git a/src/app/slinks/page.tsx b/src/app/slinks/page.tsx index c4267f7..d81112e 100755 --- a/src/app/slinks/page.tsx +++ b/src/app/slinks/page.tsx @@ -52,6 +52,11 @@ function GetCardSimple(strat: StrategyInfo) { return balance; }, [balance]); + // Function to reset the input fields to their initial state + const resetDepositForm = () => { + setAmount(MyNumber.fromZero()); + }; + return ( diff --git a/src/components/Deposit.tsx b/src/components/Deposit.tsx index 8e5d573..9d04e01 100755 --- a/src/components/Deposit.tsx +++ b/src/components/Deposit.tsx @@ -78,6 +78,13 @@ export default function Deposit(props: DepositProps) { }; }, [amount, props]); + // Function to reset the input fields to their initial state + const resetDepositForm = () => { + setAmount(MyNumber.fromEther('0', selectedMarket.decimals)); + setRawAmount(''); + setDirty(false); + }; + // constructs tx calls const { calls, actions } = useMemo(() => { const actions = props.callsInfo(amount, address || '0x0', provider); @@ -310,6 +317,7 @@ export default function Deposit(props: DepositProps) { }} selectedMarket={selectedMarket} strategy={props.strategy} + resetDepositForm={resetDepositForm} /> diff --git a/src/components/TxButton.tsx b/src/components/TxButton.tsx index ff5cfdd..e6866df 100755 --- a/src/components/TxButton.tsx +++ b/src/components/TxButton.tsx @@ -35,6 +35,7 @@ interface TxButtonProps { justDisableIfNoWalletConnect?: boolean; selectedMarket?: TokenInfo; strategy?: IStrategyProps; + resetDepositForm: () => void; } export default function TxButton(props: TxButtonProps) { @@ -60,6 +61,7 @@ export default function TxButton(props: TxButtonProps) { useEffect(() => { if (data && data.transaction_hash) { + props.resetDepositForm(); // initiates a toast and adds the tx to tx history if successful monitorNewTx({ txHash: data.transaction_hash,