diff --git a/docker/regtest/dockerfile-deps/joinmarket/directory_node/Dockerfile b/docker/regtest/dockerfile-deps/joinmarket/directory_node/Dockerfile index 852495039..37f80e6f0 100644 --- a/docker/regtest/dockerfile-deps/joinmarket/directory_node/Dockerfile +++ b/docker/regtest/dockerfile-deps/joinmarket/directory_node/Dockerfile @@ -1,7 +1,7 @@ FROM python:3.9.7-slim-bullseye RUN apt-get update \ - && apt-get install -qq --no-install-recommends tini procps vim git iproute2 supervisor \ + && apt-get install -qq --no-install-recommends gnupg tini procps vim git iproute2 supervisor \ # joinmarket dependencies curl build-essential automake pkg-config libtool python3-dev python3-pip python3-setuptools libltdl-dev \ # tor dependencies diff --git a/docker/regtest/dockerfile-deps/joinmarket/latest/Dockerfile b/docker/regtest/dockerfile-deps/joinmarket/latest/Dockerfile index f80ea0a3a..90b0d85ee 100644 --- a/docker/regtest/dockerfile-deps/joinmarket/latest/Dockerfile +++ b/docker/regtest/dockerfile-deps/joinmarket/latest/Dockerfile @@ -1,7 +1,7 @@ FROM python:3.9.7-slim-bullseye RUN apt-get update \ - && apt-get install -qq --no-install-recommends tini procps vim git iproute2 supervisor \ + && apt-get install -qq --no-install-recommends gnupg tini procps vim git iproute2 supervisor \ # joinmarket dependencies curl build-essential automake pkg-config libtool python3-dev python3-pip python3-setuptools libltdl-dev \ tor \ diff --git a/docker/regtest/init-setup.sh b/docker/regtest/init-setup.sh index 927cd3aee..5841b93a9 100755 --- a/docker/regtest/init-setup.sh +++ b/docker/regtest/init-setup.sh @@ -63,7 +63,7 @@ else ## 200 OK ## {} msg "Starting maker service for wallet $wallet_name.." - start_maker_request_payload="{\"txfee\":0,\"cjfee_a\":250,\"cjfee_r\":0.0003,\"ordertype\":\"sw0absoffer\",\"minsize\":10000}" + start_maker_request_payload="{\"txfee\":\"0\",\"cjfee_a\":\"250\",\"cjfee_r\":\"0.0003\",\"ordertype\":\"sw0absoffer\",\"minsize\":\"1\"}" start_maker_result=$(curl "$base_url/api/v1/wallet/$wallet_name/maker/start" --silent --show-error --insecure -H "$auth_header" --data "$start_maker_request_payload" | jq ".") diff --git a/src/components/EarnReport.tsx b/src/components/EarnReport.tsx index f5fb6c3bf..84c5418dd 100644 --- a/src/components/EarnReport.tsx +++ b/src/components/EarnReport.tsx @@ -17,13 +17,12 @@ const SORT_KEYS = { cjTotalAmountInSats: 'CJ_TOTAL_AMOUNT_IN_SATS', inputCount: 'INPUT_COUNT', inputAmountInSats: 'INPUT_AMOUNT_IN_SATS', - feeInSats: 'FEE_IN_SATS', earnedAmountInSats: 'EARNED_AMOUNT_IN_SATS', } const TABLE_THEME = { Table: ` - --data-table-library_grid-template-columns: 2fr 2fr 2fr 1fr 2fr 2fr 2fr; + --data-table-library_grid-template-columns: 2fr 2fr 2fr 1fr 2fr 2fr; font-size: 0.9rem; `, BaseCell: ` @@ -43,10 +42,6 @@ const TABLE_THEME = { display: flex; justify-content: end; } - &:nth-of-type(6) button { - display: flex; - justify-content: end; - } `, Cell: ` &:nth-of-type(2) { @@ -61,9 +56,6 @@ const TABLE_THEME = { &:nth-of-type(5) { text-align: right; } - &:nth-of-type(6) { - text-align: right; - } `, } @@ -156,7 +148,6 @@ const EarnReportTable = ({ tableData }: EarnReportTableProps) => { [SORT_KEYS.cjTotalAmountInSats]: (array) => array.sort((a, b) => +a.cjTotalAmount - +b.cjTotalAmount), [SORT_KEYS.inputCount]: (array) => array.sort((a, b) => +a.inputCount - +b.inputCount), [SORT_KEYS.inputAmountInSats]: (array) => array.sort((a, b) => +a.inputAmount - +b.inputAmount), - [SORT_KEYS.feeInSats]: (array) => array.sort((a, b) => +a.fee - +b.fee), }, } ) @@ -179,7 +170,6 @@ const EarnReportTable = ({ tableData }: EarnReportTableProps) => { {t('earn.report.heading_input_value')} - {t('earn.report.heading_cj_fee')} {t('earn.report.heading_notes')} @@ -211,13 +201,6 @@ const EarnReportTable = ({ tableData }: EarnReportTableProps) => { showBalance={true} /> - - - {entry.notes} ) @@ -252,10 +235,8 @@ export function EarnReport({ entries, refresh }: EarnReportProps) { entry.cjTotalAmount?.toString().includes(searchVal) || entry.inputCount?.toString().includes(searchVal) || entry.inputAmount?.toString().includes(searchVal) || - entry.fee?.toString().includes(searchVal) || entry.earnedAmount?.toString().includes(searchVal) || entry.inputCount?.toString().includes(searchVal) || - entry.confirmationDuration?.toString().includes(searchVal) || entry.notes?.toLowerCase().includes(searchVal) ) }) diff --git a/src/components/Jam.jsx b/src/components/Jam.jsx index 1f815e957..78462bc7f 100644 --- a/src/components/Jam.jsx +++ b/src/components/Jam.jsx @@ -211,7 +211,6 @@ export default function Jam() { stage1_timelambda_increase: 1.0, liquiditywait: 10, waittime: 1.0, - mixdepthsrc: 0, } } diff --git a/src/components/Orderbook.tsx b/src/components/Orderbook.tsx index 718a0c9a5..9e6d921e5 100644 --- a/src/components/Orderbook.tsx +++ b/src/components/Orderbook.tsx @@ -5,6 +5,7 @@ import * as TableTypes from '@table-library/react-table-library/types/table' import { useTheme } from '@table-library/react-table-library/theme' import * as rb from 'react-bootstrap' import { useTranslation, TFunction } from 'react-i18next' +import { Helper as ApiHelper } from '../libs/JmWalletApi' import * as ObwatchApi from '../libs/JmObwatchApi' // @ts-ignore import { useSettings } from '../context/SettingsContext' @@ -221,7 +222,7 @@ const OrderbookTable = ({ tableData }: OrderbookTableProps) => { interface OrderbookProps { orders: ObwatchApi.Order[] - refresh: (abortCtrl: AbortController) => Promise + refresh: (signal: AbortSignal) => Promise } export function Orderbook({ orders, refresh }: OrderbookProps) { @@ -274,7 +275,7 @@ export function Orderbook({ orders, refresh }: OrderbookProps) { setIsLoadingRefresh(true) const abortCtrl = new AbortController() - refresh(abortCtrl).finally(() => { + refresh(abortCtrl.signal).finally(() => { // as refreshing is fast most of the time, add a short delay to avoid flickering setTimeout(() => setIsLoadingRefresh(false), 250) }) @@ -336,16 +337,24 @@ export function OrderbookOverlay({ show, onHide }: rb.OffcanvasProps) { const [orders, setOrders] = useState(null) const refresh = useCallback( - (abortCtrl: AbortController) => { - return ObwatchApi.fetchOrderbook({ signal: abortCtrl.signal }) + (signal: AbortSignal) => { + return ObwatchApi.refreshOrderbook({ signal }) + .then((res) => { + if (!res.ok) { + // e.g. error is raised if ob-watcher is not running + return ApiHelper.throwError(res) + } + + return ObwatchApi.fetchOrderbook({ signal }) + }) .then((orders) => { - if (abortCtrl.signal.aborted) return + if (signal.aborted) return setOrders(orders) setAlert(null) }) .catch((e) => { - if (abortCtrl.signal.aborted) return + if (signal.aborted) return const message = t('orderbook.error_loading_orderbook_failed', { reason: e.message || 'Unknown reason', }) @@ -361,7 +370,7 @@ export function OrderbookOverlay({ show, onHide }: rb.OffcanvasProps) { const abortCtrl = new AbortController() setIsLoading(true) - refresh(abortCtrl).finally(() => { + refresh(abortCtrl.signal).finally(() => { if (abortCtrl.signal.aborted) return setIsLoading(false) setIsInitialized(true) diff --git a/src/i18n/locales/en/translation.json b/src/i18n/locales/en/translation.json index da88e3bfa..93ab48d4e 100644 --- a/src/i18n/locales/en/translation.json +++ b/src/i18n/locales/en/translation.json @@ -259,7 +259,6 @@ "heading_cj_amount": "Transaction Amount", "heading_input_count": "My Inputs", "heading_input_value": "My Input Amount", - "heading_cj_fee": "CoinJoin Fee", "heading_earned": "Earned", "heading_notes": "Notes" }, diff --git a/src/libs/JmObwatchApi.ts b/src/libs/JmObwatchApi.ts index 21b312f5b..9d127aabe 100644 --- a/src/libs/JmObwatchApi.ts +++ b/src/libs/JmObwatchApi.ts @@ -73,4 +73,11 @@ const fetchOrderbook = async ({ signal }: { signal: AbortSignal }) => { }).then((res) => parseOrderbook(res)) } -export { fetchOrderbook } +const refreshOrderbook = async ({ signal }: { signal: AbortSignal }) => { + return await fetch(`${basePath()}/refreshorderbook`, { + method: 'POST', + signal, + }) +} + +export { fetchOrderbook, refreshOrderbook } diff --git a/src/libs/JmWalletApi.ts b/src/libs/JmWalletApi.ts index ed40ce1ea..dd5871090 100644 --- a/src/libs/JmWalletApi.ts +++ b/src/libs/JmWalletApi.ts @@ -102,7 +102,6 @@ interface StartSchedulerRequest { } interface TumblerOptions { - mixdepthsrc?: number restart?: boolean schedulefile?: string addrcount?: number @@ -222,7 +221,14 @@ const postMakerStart = async ({ token, signal, walletName }: WalletRequestContex return await fetch(`${basePath()}/v1/wallet/${encodeURIComponent(walletName)}/maker/start`, { method: 'POST', headers: { ...Authorization(token) }, - body: JSON.stringify({ ...req, txfee: '0' }), + body: JSON.stringify({ + ...req, + // We enforce type-safety for the following properties, but their values must actually be passed as string! + cjfee_a: String(req.cjfee_a), + cjfee_r: String(req.cjfee_r), + minsize: String(req.minsize), + txfee: String(0), + }), signal, }) } @@ -243,8 +249,7 @@ const postDirectSend = async ({ token, signal, walletName }: WalletRequestContex return await fetch(`${basePath()}/v1/wallet/${encodeURIComponent(walletName)}/taker/direct-send`, { method: 'POST', headers: { ...Authorization(token) }, - // docs say "integer", but "midxdepth" must serialize as string! - body: JSON.stringify({ ...req, mixdepth: String(req.mixdepth) }), + body: JSON.stringify(req), signal, }) } @@ -253,8 +258,7 @@ const postCoinjoin = async ({ token, signal, walletName }: WalletRequestContext, return await fetch(`${basePath()}/v1/wallet/${encodeURIComponent(walletName)}/taker/coinjoin`, { method: 'POST', headers: { ...Authorization(token) }, - // docs say "integer", but "midxdepth" must serialize as string! - body: JSON.stringify({ ...req, mixdepth: String(req.mixdepth) }), + body: JSON.stringify(req), signal, }) }