From fadc2ffd39fce41c44d407f5fcd043bf99b56606 Mon Sep 17 00:00:00 2001 From: Saksham Gupta Date: Tue, 18 Jun 2024 12:47:21 +0530 Subject: [PATCH 1/7] Attempt #1:Scheduler --- src/components/Jam.tsx | 39 +++++++++++++++++++++++++++++ src/components/ScheduleProgress.tsx | 12 ++++++++- 2 files changed, 50 insertions(+), 1 deletion(-) diff --git a/src/components/Jam.tsx b/src/components/Jam.tsx index de067a9c..d20fe25d 100644 --- a/src/components/Jam.tsx +++ b/src/components/Jam.tsx @@ -318,6 +318,44 @@ export default function Jam({ wallet }: JamProps) { }) } + // const startSchedule = async (values: FormikValues) => { + // if (isLoading || collaborativeOperationRunning || isOperationDisabled) { + // return + // } + + // setAlert({ variant: 'info', message: 'Starting scheduler' }) + // setIsWaitingSchedulerStart((prev) => !prev) + + // const destinations = addressValueKeys(addressCount).map((key) => values[key]) + // setUseInsecureTestingSettings((prev) => !prev) + + // const body: Api.StartSchedulerRequest = { + // destination_addresses: destinations, + // tumbler_options: { + // addrcount: addressCount, + // minmakercount: 1, + // makercountrange: [1, 0], + // mixdepthcount: addressCount, + // mintxcount: 1, + // txcountparams: [1, 0], + // timelambda: 0.025, // 0.025 minutes := 1.5 seconds + // stage1_timelambda_increase: 1.0, + // liquiditywait: 13, + // waittime: 0.0, + // }, + // } + + // const abortCtrl = new AbortController() + // return Api.postSchedulerStart({ ...wallet, signal: abortCtrl.signal }, body) + // .then((res) => (res.ok ? true : Api.Helper.throwError(res, t('scheduler.error_starting_schedule_failed')))) + // .then((_) => reloadServiceInfo({ signal: abortCtrl.signal })) + // .catch((err) => { + // if (abortCtrl.signal.aborted) return + // setAlert({ variant: 'danger', message: err.message }) + // setIsWaitingSchedulerStart(false) + // }) + // } + const stopSchedule = async () => { if (isLoading || !collaborativeOperationRunning) { return @@ -545,6 +583,7 @@ export default function Jam({ wallet }: JamProps) { >
{t('scheduler.button_start')} +
diff --git a/src/components/ScheduleProgress.tsx b/src/components/ScheduleProgress.tsx index 1c992ce3..a12dd1c2 100644 --- a/src/components/ScheduleProgress.tsx +++ b/src/components/ScheduleProgress.tsx @@ -3,7 +3,17 @@ import { Trans, useTranslation } from 'react-i18next' import styles from './ScheduleProgress.module.css' import { Schedule } from '../context/ServiceInfoContext' -const scheduleToSteps = (schedule: Schedule) => { +interface Txstep { + width: number +} + +interface Steps { + totalWaitTime: number + completedTxs: number + txs: Txstep[] +} + +const scheduleToSteps = (schedule: Schedule): Steps => { // Example Schedule: // // schedule = [ From 5c7945993672f23393d0120e397fdf6acf4386d6 Mon Sep 17 00:00:00 2001 From: Saksham Gupta Date: Tue, 2 Jul 2024 11:11:24 +0530 Subject: [PATCH 2/7] Linear Scheduler Implemented --- src/components/Jam.tsx | 57 +++++++++++++----------------------------- 1 file changed, 18 insertions(+), 39 deletions(-) diff --git a/src/components/Jam.tsx b/src/components/Jam.tsx index d20fe25d..a911561b 100644 --- a/src/components/Jam.tsx +++ b/src/components/Jam.tsx @@ -65,6 +65,7 @@ const addressValueKeys = (addressCount: number) => const isValidAddress = (candidate: any) => { return typeof candidate === 'string' && candidate !== '' } + const isAddressReused = ( walletInfo: WalletInfo, destination: Api.BitcoinAddress, @@ -283,10 +284,23 @@ export default function Jam({ wallet }: JamProps) { setAlert(undefined) setIsWaitingSchedulerStart(true) + // const destinations = addressValueKeys(addressCount).map((key) => values[key]) const destinations = addressValueKeys(addressCount).map((key) => values[key]) const body: Api.StartSchedulerRequest = { destination_addresses: destinations, + tumbler_options: { + addrcount: addressCount, + minmakercount: 1, + makercountrange: [1, 0], + mixdepthcount: addressCount, + mintxcount: 1, + txcountparams: [1, 0], + timelambda: 0.025, // 0.025 minutes := 1.5 seconds + stage1_timelambda_increase: 1.0, + liquiditywait: 13, + waittime: 0.0, + }, } // Make sure schedule testing is really only used in dev mode. @@ -318,44 +332,6 @@ export default function Jam({ wallet }: JamProps) { }) } - // const startSchedule = async (values: FormikValues) => { - // if (isLoading || collaborativeOperationRunning || isOperationDisabled) { - // return - // } - - // setAlert({ variant: 'info', message: 'Starting scheduler' }) - // setIsWaitingSchedulerStart((prev) => !prev) - - // const destinations = addressValueKeys(addressCount).map((key) => values[key]) - // setUseInsecureTestingSettings((prev) => !prev) - - // const body: Api.StartSchedulerRequest = { - // destination_addresses: destinations, - // tumbler_options: { - // addrcount: addressCount, - // minmakercount: 1, - // makercountrange: [1, 0], - // mixdepthcount: addressCount, - // mintxcount: 1, - // txcountparams: [1, 0], - // timelambda: 0.025, // 0.025 minutes := 1.5 seconds - // stage1_timelambda_increase: 1.0, - // liquiditywait: 13, - // waittime: 0.0, - // }, - // } - - // const abortCtrl = new AbortController() - // return Api.postSchedulerStart({ ...wallet, signal: abortCtrl.signal }, body) - // .then((res) => (res.ok ? true : Api.Helper.throwError(res, t('scheduler.error_starting_schedule_failed')))) - // .then((_) => reloadServiceInfo({ signal: abortCtrl.signal })) - // .catch((err) => { - // if (abortCtrl.signal.aborted) return - // setAlert({ variant: 'danger', message: err.message }) - // setIsWaitingSchedulerStart(false) - // }) - // } - const stopSchedule = async () => { if (isLoading || !collaborativeOperationRunning) { return @@ -377,9 +353,12 @@ export default function Jam({ wallet }: JamProps) { return ( <> + {' '} + { + // MARK: Scheduler Page + } {alert && {alert.message}} - {isLoading || !serviceInfo || !walletInfo || isWaitingSchedulerStart || isWaitingSchedulerStop ? ( From 91ccc66d24575848f4bdd43aef5a26a8a41eb31f Mon Sep 17 00:00:00 2001 From: Saksham Gupta Date: Tue, 2 Jul 2024 11:28:27 +0530 Subject: [PATCH 3/7] Unused Twitter Link Remove from Settings Page --- src/components/Settings.tsx | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/components/Settings.tsx b/src/components/Settings.tsx index 7ff18bd5..d570a642 100644 --- a/src/components/Settings.tsx +++ b/src/components/Settings.tsx @@ -256,12 +256,6 @@ export default function Settings({ wallet, stopWallet }: SettingsProps) { {t('settings.telegram')} - -
- - {t('settings.jam_twitter')} -
-
From 8c26bd4ed26eabe02387d871539d56aac9f8c0a8 Mon Sep 17 00:00:00 2001 From: Saksham Gupta Date: Tue, 2 Jul 2024 11:34:17 +0530 Subject: [PATCH 4/7] Revert "Unused Twitter Link Remove from Settings Page" This reverts commit 91ccc66d24575848f4bdd43aef5a26a8a41eb31f. --- src/components/Settings.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/components/Settings.tsx b/src/components/Settings.tsx index d570a642..7ff18bd5 100644 --- a/src/components/Settings.tsx +++ b/src/components/Settings.tsx @@ -256,6 +256,12 @@ export default function Settings({ wallet, stopWallet }: SettingsProps) { {t('settings.telegram')}
+ +
+ + {t('settings.jam_twitter')} +
+
From 316dca1498adf3b84bf2efb30ced01adb1cba75d Mon Sep 17 00:00:00 2001 From: Saksham Gupta Date: Tue, 2 Jul 2024 15:10:20 +0530 Subject: [PATCH 5/7] Revert "Attempt #1:Scheduler" This reverts commit fadc2ffd39fce41c44d407f5fcd043bf99b56606. --- src/components/Jam.tsx | 1 - src/components/ScheduleProgress.tsx | 12 +----------- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/src/components/Jam.tsx b/src/components/Jam.tsx index a911561b..53a493bd 100644 --- a/src/components/Jam.tsx +++ b/src/components/Jam.tsx @@ -562,7 +562,6 @@ export default function Jam({ wallet }: JamProps) { >
{t('scheduler.button_start')} -
diff --git a/src/components/ScheduleProgress.tsx b/src/components/ScheduleProgress.tsx index a12dd1c2..1c992ce3 100644 --- a/src/components/ScheduleProgress.tsx +++ b/src/components/ScheduleProgress.tsx @@ -3,17 +3,7 @@ import { Trans, useTranslation } from 'react-i18next' import styles from './ScheduleProgress.module.css' import { Schedule } from '../context/ServiceInfoContext' -interface Txstep { - width: number -} - -interface Steps { - totalWaitTime: number - completedTxs: number - txs: Txstep[] -} - -const scheduleToSteps = (schedule: Schedule): Steps => { +const scheduleToSteps = (schedule: Schedule) => { // Example Schedule: // // schedule = [ From 8f7d32c443a733b08c1e0959e6d5149bca0959f4 Mon Sep 17 00:00:00 2001 From: Saksham Gupta Date: Tue, 2 Jul 2024 15:15:54 +0530 Subject: [PATCH 6/7] Added a Right Caret and Reverted Code --- src/components/Jam.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/Jam.tsx b/src/components/Jam.tsx index 53a493bd..a911561b 100644 --- a/src/components/Jam.tsx +++ b/src/components/Jam.tsx @@ -562,6 +562,7 @@ export default function Jam({ wallet }: JamProps) { >
{t('scheduler.button_start')} +
From 40cf4d2e7c62b937f1d5ffba6fdbc564c48052fa Mon Sep 17 00:00:00 2001 From: Saksham Gupta Date: Tue, 2 Jul 2024 15:41:48 +0530 Subject: [PATCH 7/7] Removed Code not needed --- src/components/Jam.tsx | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/src/components/Jam.tsx b/src/components/Jam.tsx index a911561b..ddc07d92 100644 --- a/src/components/Jam.tsx +++ b/src/components/Jam.tsx @@ -284,23 +284,10 @@ export default function Jam({ wallet }: JamProps) { setAlert(undefined) setIsWaitingSchedulerStart(true) - // const destinations = addressValueKeys(addressCount).map((key) => values[key]) const destinations = addressValueKeys(addressCount).map((key) => values[key]) const body: Api.StartSchedulerRequest = { destination_addresses: destinations, - tumbler_options: { - addrcount: addressCount, - minmakercount: 1, - makercountrange: [1, 0], - mixdepthcount: addressCount, - mintxcount: 1, - txcountparams: [1, 0], - timelambda: 0.025, // 0.025 minutes := 1.5 seconds - stage1_timelambda_increase: 1.0, - liquiditywait: 13, - waittime: 0.0, - }, } // Make sure schedule testing is really only used in dev mode. @@ -353,10 +340,6 @@ export default function Jam({ wallet }: JamProps) { return ( <> - {' '} - { - // MARK: Scheduler Page - } {alert && {alert.message}} {isLoading || !serviceInfo || !walletInfo || isWaitingSchedulerStart || isWaitingSchedulerStop ? (