diff --git a/components/multi-step-form.js b/components/multi-step-form.js
index 797b917f33..e7e1152725 100644
--- a/components/multi-step-form.js
+++ b/components/multi-step-form.js
@@ -203,6 +203,17 @@ export function useStep () {
return steps[stepIndex]
}
+export function useIsFirstStep () {
+ const stepIndex = useStepIndex()
+ return stepIndex === 0
+}
+
+export function useIsLastStep () {
+ const maxSteps = useMaxSteps()
+ const stepIndex = useStepIndex()
+ return stepIndex === maxSteps - 1
+}
+
export function useNext () {
const { next } = useContext(MultiStepFormContext)
return next
diff --git a/pages/wallets/index.js b/pages/wallets/index.js
index 57c9098273..0f8cc466ff 100644
--- a/pages/wallets/index.js
+++ b/pages/wallets/index.js
@@ -115,6 +115,8 @@ export default function Wallet () {
use real bitcoin
wallet logs
+
•
+
settings
{showPassphrase && (
<>
•
diff --git a/pages/wallets/settings.js b/pages/wallets/settings.js
new file mode 100644
index 0000000000..94fd6150d3
--- /dev/null
+++ b/pages/wallets/settings.js
@@ -0,0 +1,213 @@
+import { useCallback } from 'react'
+import InputGroup from 'react-bootstrap/InputGroup'
+import { useField } from 'formik'
+import { useRouter } from 'next/router'
+import { useMutation, useQuery } from '@apollo/client'
+import { Checkbox, Form, Input, SubmitButton } from '@/components/form'
+import Info from '@/components/info'
+import { useToast } from '@/components/toast'
+import AccordianItem from '@/components/accordian-item'
+import { isNumber } from '@/lib/format'
+import { walletSettingsSchema } from '@/lib/validate'
+import { SET_WALLET_SETTINGS, WALLET_SETTINGS } from '@/wallets/client/fragments'
+import { WalletLayout, WalletLayoutHeader } from '@/wallets/client/components'
+
+export default function WalletSettings () {
+ const { data } = useQuery(WALLET_SETTINGS)
+ const [setSettings] = useMutation(SET_WALLET_SETTINGS)
+ const toaster = useToast()
+ const router = useRouter()
+
+ const onSubmit = useCallback(async (settings) => {
+ try {
+ await setSettings({
+ variables: { settings },
+ update: (cache, { data }) => {
+ cache.writeQuery({
+ query: WALLET_SETTINGS,
+ data: {
+ walletSettings: {
+ __typename: 'WalletSettings',
+ ...data?.setWalletSettings
+ }
+ }
+ })
+ }
+ })
+ router.push('/wallets')
+ } catch (err) {
+ console.error(err)
+ toaster.danger('failed to save wallet')
+ }
+ }, [setSettings, toaster, router])
+
+ const initial = {
+ receiveCreditsBelowSats: data?.walletSettings?.receiveCreditsBelowSats ?? 10,
+ sendCreditsBelowSats: data?.walletSettings?.sendCreditsBelowSats ?? 10,
+ autoWithdrawThreshold: data?.walletSettings?.autoWithdrawThreshold ?? 10000,
+ autoWithdrawMaxFeePercent: data?.walletSettings?.autoWithdrawMaxFeePercent ?? 1,
+ autoWithdrawMaxFeeTotal: data?.walletSettings?.autoWithdrawMaxFeeTotal ?? 1,
+ proxyReceive: data?.walletSettings?.proxyReceive ?? true
+ }
+
+ return (
+
+
+
+ )
+}
+
+function Settings () {
+ return (
+ <>
+
+
+
+
+ >
+ }
+ />
+ >
+ )
+}
+
+function AutowithdrawSettings () {
+ const [{ value: threshold }] = useField('autoWithdrawThreshold')
+ const sendThreshold = Math.max(Math.floor(threshold / 10), 1)
+
+ return (
+ <>
+ sats}
+ required
+ type='number'
+ min={0}
+ groupClassName='mb-2'
+ />
+
+ max fee rate
+
+
+ - configure fee budget for autowithdrawals
+ - if max fee total is higher for a withdrawal, we will use it instead to find a route
+ - higher fee settings increase the likelihood of successful withdrawals
+
+
+
+ }
+ name='autoWithdrawMaxFeePercent'
+ append={