From 9c99269fd756cdec661c540f161be18cd25a2d15 Mon Sep 17 00:00:00 2001 From: iAmKeralis1131f Date: Sat, 28 Mar 2026 23:13:06 +0530 Subject: [PATCH] update readme and other nits --- README.md | 24 ++++++------- api1.js | 29 ++++++++++++--- docs/usage.md | 10 +++--- src/components/market/Market.js | 18 +++++++++- src/components/receive/Receive.js | 25 +++++-------- src/components/swap/Swap.js | 25 +++++++++++-- src/components/swap/SwapHistory.js | 57 ++++++++++++++++++++++++++---- src/components/swap/SwapReport.js | 21 ++++++++--- src/styles/output.css | 16 +++++++++ 9 files changed, 173 insertions(+), 52 deletions(-) diff --git a/README.md b/README.md index 13e784d..649ae7c 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ Unlike traditional Bitcoin transactions that create an on-chain trail, coinswaps The Taker app requires the following components to operate: -1. **Bitcoin Core (Mutinynet)** - A fully synced Mutinynet node with proper RPC and ZMQ configuration +1. **Bitcoin Core (Mutinynet)** - A fully synced Mutinynet node with proper RPC, REST, and ZMQ configuration - See the [Bitcoin Core setup guide](https://github.com/citadel-tech/coinswap/blob/master/docs/bitcoind.md) for detailed instructions 2. **Tor** - Required for anonymous maker discovery and privacy @@ -117,30 +117,30 @@ npm run dist ``` This creates production-ready packages in the `dist/` directory: -- `TakerApp-1.0.0.AppImage` - Portable executable for all Linux distributions -- `taker-app_1.0.0_amd64.snap` - Optional snap package +- `CoinswapTaker-0.2.1.AppImage` - Portable executable for Linux distributions +- `coinswaptaker_0.2.1_amd64.snap` - Optional snap package ### Using the AppImage ```bash # Make executable (one-time) -chmod +x dist/TakerApp-1.0.0.AppImage +chmod +x dist/CoinswapTaker-0.2.1.AppImage # Run directly -./dist/TakerApp-1.0.0.AppImage +./dist/CoinswapTaker-0.2.1.AppImage ``` **Optional desktop integration:** ```bash # Integrate with application menu -./dist/TakerApp-1.0.0.AppImage --appimage-integrate +./dist/CoinswapTaker-0.2.1.AppImage --appimage-integrate # Remove integration -./dist/TakerApp-1.0.0.AppImage --appimage-unintegrate +./dist/CoinswapTaker-0.2.1.AppImage --appimage-unintegrate ``` **Extract and inspect:** ```bash -./dist/TakerApp-1.0.0.AppImage --appimage-extract +./dist/CoinswapTaker-0.2.1.AppImage --appimage-extract cd squashfs-root ./TakerApp ``` @@ -186,8 +186,8 @@ which fusermount sudo apt install fuse libfuse2 # Or extract and run directly -./TakerApp-1.0.0.AppImage --appimage-extract -./squashfs-root/TakerApp +./CoinswapTaker-0.2.1.AppImage --appimage-extract +./squashfs-root/coinswap-taker ``` **Error: Cannot find module 'coinswap-napi'** @@ -228,7 +228,7 @@ Report security issues on our [Discord](https://discord.gg/Wz42hVmrrK) or email ## License -Dual-licensed under MIT or Apache 2.0 at your option. +Licensed under Apache 2.0. See [LICENSE](LICENSE). ## Community @@ -238,4 +238,4 @@ Dual-licensed under MIT or Apache 2.0 at your option. --- -**⚠️ Warning**: Experimental software under active development. Mainnet use is **NOT recommended**. \ No newline at end of file +**⚠️ Warning**: Experimental software under active development. Mainnet use is **NOT recommended**. diff --git a/api1.js b/api1.js index 03937b4..e9b69a3 100644 --- a/api1.js +++ b/api1.js @@ -111,6 +111,18 @@ function toNumber(value, fallback = 0) { return Number.isFinite(normalized) ? normalized : fallback; } +function normalizeTimestamp(value, fallback = null) { + if (value == null || value === '') return fallback; + + const numeric = Number(value); + if (Number.isFinite(numeric)) { + return numeric < 1e12 ? numeric * 1000 : numeric; + } + + const parsed = new Date(value).getTime(); + return Number.isFinite(parsed) ? parsed : fallback; +} + function getOfferbookSnapshot() { const offerbookPath = path.join(api1State.DATA_DIR, 'offerbook.json'); const snapshot = { @@ -249,6 +261,7 @@ function inferTaprootFromReport(rawReport = {}) { } function buildSwapReportRecord(filePath, rawReport) { + const fileStats = fs.statSync(filePath); const fileName = path.basename(filePath, '.json'); const nativeSwapId = rawReport.nativeSwapId || @@ -293,10 +306,16 @@ function buildSwapReportRecord(filePath, rawReport) { rawReport.report?.endTimestamp || rawReport.report?.end_timestamp || null; - const completedAt = - Number.isFinite(Number(rawCompletedAt)) && Number(rawCompletedAt) < 1e12 - ? Number(rawCompletedAt) * 1000 - : rawCompletedAt; + const completedAt = normalizeTimestamp(rawCompletedAt, fileStats.mtimeMs); + const startedAt = normalizeTimestamp( + rawReport.startedAt || + rawReport.started_at || + rawReport.report?.startedAt || + rawReport.report?.started_at || + rawReport.report?.startTimestamp || + rawReport.report?.start_timestamp, + null + ); const isTaproot = inferTaprootFromReport(rawReport); const protocol = normalizeSwapProtocol( rawReport.protocol || nestedReport.protocol, @@ -316,7 +335,9 @@ function buildSwapReportRecord(filePath, rawReport) { nativeSwapId, appSwapId, status: normalizedStatus, + startedAt, completedAt, + fileModifiedAt: fileStats.mtimeMs, filePath, fileName, isCoreReport, diff --git a/docs/usage.md b/docs/usage.md index 46b9c37..f32d41f 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -16,14 +16,14 @@ This guide covers all features and functionality of the Coinswap Taker App. ## Setup and Connection -On each launch, the app loads your configuration: +On launch, the app walks through setup and connection configuration: 1. **Bitcoin Core Connection** - Configure RPC credentials and port 2. **Tor Configuration** - Set control and SOCKS ports (defaults: 9051, 9050) -3. **Wallet Loading** - Opens your existing encrypted wallet, prompts creation, or allows restoration from seed -4. **ZMQ Setup** - Configure real-time block and transaction notifications +3. **Wallet Loading** - Opens your existing encrypted wallet, prompts creation, or allows restoration from backup JSON +4. **ZMQ Setup** - Configure real-time block and transaction notifications as part of the Bitcoin endpoint setup -The setup page allows you to review and update your configuration at any time. +The setup page allows you to review and update your configuration. ## Wallet Page @@ -102,7 +102,7 @@ Configure app and Bitcoin Core connection: - **Wallet Backup** - Create encrypted wallet backups - **Connection Testing** - Verify Bitcoin Core and Tor connectivity -Settings are persisted locally and can be updated at any time without restarting the app. +Settings can be reviewed and updated from the app, though the current development build may require re-running setup on launch. ## Log Page diff --git a/src/components/market/Market.js b/src/components/market/Market.js index f8aa8b8..74c6388 100644 --- a/src/components/market/Market.js +++ b/src/components/market/Market.js @@ -36,6 +36,22 @@ export function Market(container) { } } + function formatTorEndpoint(address, start = 14, end = 16) { + if (!address || typeof address !== 'string') return 'unknown'; + + const separatorIndex = address.lastIndexOf(':'); + if (separatorIndex === -1) return address; + + const host = address.slice(0, separatorIndex); + const port = address.slice(separatorIndex + 1); + + if (host.length <= start + end + 3) { + return `${host}:${port}`; + } + + return `${host.slice(0, start)}...${host.slice(-end)}:${port}`; + } + // Check sync state every second function startSyncStateMonitor() { if (syncCheckInterval) return; @@ -754,7 +770,7 @@ export function Market(container) { ${protocolBadge.icon} ${protocolBadge.label} -
${maker.address.substring(0, 18)}...
+
${formatTorEndpoint(maker.address)}
${maker.baseFee}
${maker.volumeFee}%
${maker.timeFee}%
diff --git a/src/components/receive/Receive.js b/src/components/receive/Receive.js index b733539..9f9278e 100644 --- a/src/components/receive/Receive.js +++ b/src/components/receive/Receive.js @@ -17,9 +17,9 @@ export function ReceiveComponent(container) {
-
-
-

Generating address...

+
+

No address loaded

+

Click the button below to generate a receive address.

@@ -28,7 +28,7 @@ export function ReceiveComponent(container) {
- Loading... + No address loaded
-