import { InputGroup } from 'react-bootstrap' import { Input } from './form' import { useMe } from './me' import { useEffect, useState } from 'react' import { isNumber } from '@/lib/validate' import Link from 'next/link' function autoWithdrawThreshold ({ me }) { return isNumber(me?.privates?.autoWithdrawThreshold) ? me?.privates?.autoWithdrawThreshold : 10000 } export function autowithdrawInitial ({ me }) { return { autoWithdrawThreshold: autoWithdrawThreshold({ me }), autoWithdrawMaxFeePercent: isNumber(me?.privates?.autoWithdrawMaxFeePercent) ? me?.privates?.autoWithdrawMaxFeePercent : 1, autoWithdrawMaxFeeTotal: isNumber(me?.privates?.autoWithdrawMaxFeeTotal) ? me?.privates?.autoWithdrawMaxFeeTotal : 1 } } export function AutowithdrawSettings () { const { me } = useMe() const threshold = autoWithdrawThreshold({ me }) const [sendThreshold, setSendThreshold] = useState(Math.max(Math.floor(threshold / 10), 1)) useEffect(() => { setSendThreshold(Math.max(Math.floor(threshold / 10), 1)) }, [autoWithdrawThreshold]) return ( <>

desired balance

applies globally to all autowithdraw methods
{ const value = e.target.value setSendThreshold(Math.max(Math.floor(value / 10), 1)) }} hint={isNumber(sendThreshold) ? `will attempt auto-withdraw when your balance exceeds ${sendThreshold * 11} sats` : undefined} append={sats} required />

network fees

we'll use whichever setting is higher during{' '} pathfinding
%} required /> sats} required />
) }