diff --git a/src/components/Earn.tsx b/src/components/Earn.tsx index 2b958647..bafdf729 100644 --- a/src/components/Earn.tsx +++ b/src/components/Earn.tsx @@ -454,10 +454,14 @@ export default function Earn({ wallet }: EarnProps) { return currentWalletInfo?.fidelityBondSummary.fbOutputs || [] }, [currentWalletInfo]) - console.log(fidelityBonds) const [moveToJarFidelityBondId, setMoveToJarFidelityBondId] = useState() const [renewFidelityBondId, setRenewFidelityBondId] = useState() + const reset = () => { + setTimelockedAddress(undefined) + setLockDate(null) + } + const isSufficientFundsAvailable = useMemo( () => (currentWalletInfo?.balanceSummary.calculatedAvailableBalanceInSats ?? 0) > 0, [currentWalletInfo], @@ -741,6 +745,7 @@ export default function Earn({ wallet }: EarnProps) { setLockDate={(date) => setLockDate(date)} setAmount={(amount) => setAmount(amount)} setIsCreatingFB={(input) => setIsCreatingFB(input)} + resetThisAsWell={() => reset()} /> ) : ( diff --git a/src/components/fb2/CreateFidelityBond.tsx b/src/components/fb2/CreateFidelityBond.tsx index aa2bbb0b..29d45194 100644 --- a/src/components/fb2/CreateFidelityBond.tsx +++ b/src/components/fb2/CreateFidelityBond.tsx @@ -63,6 +63,7 @@ interface CreateFidelityBondProps { setLockDate: (date: Api.Lockdate | null) => void setAmount: (amount: Api.AmountSats) => void setIsCreatingFB: (input: boolean) => void + resetThisAsWell: () => void } const CreateFidelityBond2 = ({ @@ -76,6 +77,7 @@ const CreateFidelityBond2 = ({ setLockDate, setAmount, setIsCreatingFB, + resetThisAsWell, }: CreateFidelityBondProps) => { const { t } = useTranslation() const reloadCurrentWalletInfo = useReloadCurrentWalletInfo() @@ -115,8 +117,8 @@ const CreateFidelityBond2 = ({ setStep(steps.selectDate) setSelectedJar(undefined) setSelectedUtxos([]) - setLockDate(null) - setTimelockedAddress(undefined) + // setLockDate(null) + // setTimelockedAddress(undefined) setAlert(undefined) } @@ -281,6 +283,7 @@ const CreateFidelityBond2 = ({ if (nextStep(step) === steps.failed) { reset() + resetThisAsWell() return } @@ -288,6 +291,7 @@ const CreateFidelityBond2 = ({ const abortCtrl = new AbortController() const requestContext = { ...wallet, signal: abortCtrl.signal } reset() + resetThisAsWell() setIsCreatingFB(true) await spendUtxosWithDirectSend( requestContext, @@ -317,6 +321,7 @@ const CreateFidelityBond2 = ({ setStep(next) } else { reset() + resetThisAsWell() setStep(0) } } @@ -383,26 +388,6 @@ const CreateFidelityBond2 = ({ )} - {/* { - setCreatingFidelityBond(false)} - > - - {t('earn.fidelity_bond.create_fidelity_bond.title')} - - -
-
-
-
- } */}
- {index === 3 ? : index + 1} + {index === 3 ? : index + 1}
{tab}
diff --git a/src/components/fb2/ExistingFidelityBond.tsx b/src/components/fb2/ExistingFidelityBond.tsx index 8b37a496..b63374ea 100644 --- a/src/components/fb2/ExistingFidelityBond.tsx +++ b/src/components/fb2/ExistingFidelityBond.tsx @@ -110,7 +110,7 @@ interface CreatingFidelityBondProps { const CreatingFidelityBond = ({ timelockedAddress, lockDate, amount }: CreatingFidelityBondProps) => { const settings = useSettings() - const { t, i18n } = useTranslation() + const { t } = useTranslation() // const humanReadableLockDuration = useMemo(() => { // const locktime = fb.utxo.getLocktime(fidelityBond)