app: folder reorg + tradingview notice

This commit is contained in:
k
2024-08-08 17:11:58 +02:00
parent 597a750fff
commit 6ebd9320db
57 changed files with 738 additions and 706 deletions
+9 -2
View File
@@ -9,13 +9,20 @@
- Changed the block iterator from a custom version of [bitcoin-explorer](https://crates.io/crates/bitcoin-explorer) to the homemade [biter](https://crates.io/crates/biter) which allows the parser to run alongside `bitcoind`
- Added datasets compression thanks to [zstd](https://crates.io/crates/zstd) to reduce disk usage
- Use the Bitcoin RPC server for various calls instead of running cli commands and then parsing the JSON from the output
- Important database changes that will need a full rescan:
- Split txid_to_tx_data database in 4096 chunks (from 256)
- **Important database changes that will need a full rescan**:
- Changed databases page size from 1MB to 4KB for improved disk usage
- Split txid_to_tx_data database in 4096 chunks (from 256) for improved disk usage
- Split address_index_to_X databases to chunks of 25_000 instead of 50_000
- Removed local Multisig database
- Updated the config, run with `-h` to see possible args
- Moved outputs from `/target/outputs` to `/out` to allow to run commands like `cargo clean` without side effects
- Various first run fixes
- Added to `-h` which arguments are saved, which is all of them at the time of writing
### App
- Made the app runable without needing to run the server first to generate `types.d.ts`
- Added Trading View attribution link to the settings frame and file in the lightweight charts folder
### Server
+8 -8
View File
@@ -21,27 +21,27 @@
"@solid-primitives/intersection-observer": "^2.1.6",
"@solid-primitives/resize-observer": "^2.0.26",
"lean-qr": "^2.3.4",
"lightweight-charts": "^4.1.7",
"lightweight-charts": "^4.2.0",
"solid-js": "^1.8.19"
},
"devDependencies": {
"@ianvs/prettier-plugin-sort-imports": "^4.3.1",
"@iconify-json/tabler": "^1.1.118",
"@iconify-json/tabler": "^1.1.119",
"@tailwindcss/container-queries": "^0.1.1",
"autoprefixer": "^10.4.19",
"postcss": "^8.4.40",
"autoprefixer": "^10.4.20",
"postcss": "^8.4.41",
"prettier": "^3.3.3",
"prettier-plugin-tailwindcss": "^0.6.5",
"pwa-asset-generator": "^6.3.1",
"rollup-plugin-visualizer": "^5.12.0",
"tailwindcss": "^3.4.7",
"tailwindcss": "^3.4.8",
"typescript": "^5.5.4",
"unplugin-auto-import": "^0.18.2",
"unplugin-icons": "^0.19.0",
"vite": "^5.3.5",
"unplugin-icons": "^0.19.2",
"vite": "^5.4.0",
"vite-plugin-pwa": "^0.20.1",
"vite-plugin-solid": "^2.10.2",
"workbox-window": "^7.1.0",
"wrangler": "^3.67.0"
"wrangler": "^3.69.1"
}
}
+637 -638
View File
File diff suppressed because it is too large Load Diff
@@ -1,29 +0,0 @@
import { Anchor } from "./anchor";
export function AnchorAPI() {
return (
<Anchor
title="API"
icon={
() => IconTablerApi
// () => (
// <svg
// width="20"
// height="20"
// viewBox="0 0 20 20"
// fill="none"
// xmlns="http://www.w3.org/2000/svg"
// >
// <path
// fill-rule="evenodd"
// clip-rule="evenodd"
// d="M5.13468 2.41153C3.88395 3.0478 3.37143 3.79772 3.37143 4.4186C3.37143 5.03949 3.88395 5.78941 5.13468 6.42568C6.3444 7.04109 8.06359 7.44186 10 7.44186C11.9364 7.44186 13.6556 7.04109 14.8653 6.42568C16.1161 5.78941 16.6286 5.03949 16.6286 4.4186C16.6286 3.79772 16.1161 3.0478 14.8653 2.41153C13.6556 1.79612 11.9364 1.39535 10 1.39535C8.06359 1.39535 6.3444 1.79612 5.13468 2.41153ZM16.6286 6.93694C16.2841 7.21648 15.8934 7.46274 15.4786 7.67372C14.0411 8.40502 12.1032 8.83721 10 8.83721C7.89684 8.83721 5.95889 8.40502 4.52136 7.67372C4.10664 7.46274 3.71588 7.21648 3.37143 6.93694V10C3.37143 10.6209 3.88395 11.3708 5.13468 12.0071C6.3444 12.6225 8.06359 13.0233 10 13.0233C11.9364 13.0233 13.6556 12.6225 14.8653 12.0071C16.1161 11.3708 16.6286 10.6209 16.6286 10V6.93694ZM18 4.4186C18 2.98447 16.8752 1.87393 15.4786 1.16349C14.0411 0.432186 12.1032 0 10 0C7.89684 0 5.95889 0.432186 4.52136 1.16349C3.12484 1.87393 2 2.98447 2 4.4186V15.5814C2 17.0155 3.12484 18.1261 4.52136 18.8365C5.95889 19.5678 7.89684 20 10 20C12.1032 20 14.0411 19.5678 15.4786 18.8365C16.8752 18.1261 18 17.0155 18 15.5814V4.4186ZM16.6286 12.5183C16.2841 12.7979 15.8934 13.0441 15.4786 13.2551C14.0411 13.9864 12.1032 14.4186 10 14.4186C7.89684 14.4186 5.95889 13.9864 4.52136 13.2551C4.10664 13.0441 3.71588 12.7979 3.37143 12.5183V15.5814C3.37143 16.2023 3.88395 16.9522 5.13468 17.5885C6.3444 18.2039 8.06359 18.6047 10 18.6047C11.9364 18.6047 13.6556 18.2039 14.8653 17.5885C16.1161 16.9522 16.6286 16.2023 16.6286 15.5814V12.5183ZM6.34285 10C6.34285 10.5138 5.93351 10.9302 5.42857 10.9302C4.92362 10.9302 4.51428 10.5138 4.51428 10C4.51428 9.48625 4.92362 9.06977 5.42857 9.06977C5.93351 9.06977 6.34285 9.48625 6.34285 10ZM9.0857 11.8605C9.59065 11.8605 9.99999 11.444 9.99999 10.9302C9.99999 10.4165 9.59065 10 9.0857 10C8.58076 10 8.17142 10.4165 8.17142 10.9302C8.17142 11.444 8.58076 11.8605 9.0857 11.8605ZM6.34285 15.5814C6.34285 16.0951 5.93351 16.5116 5.42857 16.5116C4.92362 16.5116 4.51428 16.0951 4.51428 15.5814C4.51428 15.0676 4.92362 14.6512 5.42857 14.6512C5.93351 14.6512 6.34285 15.0676 6.34285 15.5814ZM9.0857 17.4419C9.59065 17.4419 9.99999 17.0254 9.99999 16.5116C9.99999 15.9979 9.59065 15.5814 9.0857 15.5814C8.58076 15.5814 8.17142 15.9979 8.17142 16.5116C8.17142 17.0254 8.58076 17.4419 9.0857 17.4419Z"
// fill="currentColor"
// ></path>
// </svg>
// )
}
href="https://api.satonomics.xyz"
/>
);
}
-1
View File
@@ -1 +0,0 @@
type UserConfig = ReturnType<typeof import("./user").createUserConfig>;
@@ -3,7 +3,7 @@ import { createRWS } from "/src/solid/rws";
import { standalone } from "../env";
import { createDatasets } from "../scripts/datasets";
import { createPresets } from "../scripts/presets";
import { createSL } from "../scripts/utils/selectableList/static";
import { createUserConfig } from "../scripts/user/config";
import { sleep } from "../scripts/utils/sleep";
import {
readBooleanFromStorage,
@@ -12,16 +12,14 @@ import {
import { readBooleanURLParam, writeURLParam } from "../scripts/utils/urlParams";
import { webSockets } from "../scripts/ws";
import { classPropToString } from "../solid/classes";
import { createPreferredColorSchemeAccessor } from "../solid/prefferedColorScheme";
import { Background } from "./components/background";
import { ChartFrame } from "./components/frames/chart";
import { FavoritesFrame } from "./components/frames/favorites";
import { FoldersFrame } from "./components/frames/folders";
import { HistoryFrame } from "./components/frames/history";
import { SettingsFrame } from "./components/frames/settings";
import { StripDesktop, StripMobile } from "./components/strip";
import { Update } from "./components/update";
import { createUserConfig } from "./scripts/user";
import { Background } from "./background";
import { ChartFrame } from "./frames/chart";
import { FavoritesFrame } from "./frames/favorites";
import { FoldersFrame } from "./frames/folders";
import { HistoryFrame } from "./frames/history";
import { SettingsFrame } from "./frames/settings";
import { StripDesktop, StripMobile } from "./strip";
import { Update } from "./update";
const LOCAL_STORAGE_BAR_KEY = "bar-width";
const LOCAL_STORAGE_FULLSCREEN = "fullscrenn";
@@ -149,13 +147,13 @@ export function App() {
onCleanup(() => document.removeEventListener("keydown", documentOnKeyDown));
const SearchFrame = lazy(() =>
import("./components/frames/search").then((d) => ({
import("./frames/search").then((d) => ({
default: d.SearchFrame,
})),
);
const Qrcode = lazy(() =>
import("./components/qrcode").then((d) => ({
import("./qrcode").then((d) => ({
default: d.Qrcode,
})),
);
@@ -1,8 +1,8 @@
import { GENESIS_DAY } from "/src/scripts/lightweightCharts/whitespace";
import { ONE_DAY_IN_MS } from "/src/scripts/utils/time";
import { classPropToString } from "/src/solid/classes";
import { createRWS } from "/src/solid/rws";
import { GENESIS_DAY } from "../../../../../scripts/lightweightCharts/whitespace";
import { Box } from "../../box";
import { Scrollable } from "../../scrollable";
@@ -4,7 +4,7 @@ import { createVisibilityObserver } from "@solid-primitives/intersection-observe
import { scrollIntoView } from "/src/scripts/utils/scroll";
import { createRWS } from "/src/solid/rws";
import { INPUT_PRESET_SEARCH_ID } from "../..";
import { INPUT_PRESET_SEARCH_ID } from "../app";
import { Box } from "./box";
import { Button, ButtonRandomChart } from "./button";
import { Line } from "./line";
@@ -229,6 +229,23 @@ export function SettingsFrame({
</div>
</div>
<p class="p-4 text-center">
<span class="opacity-50">Charts are displayed via </span>{" "}
<a href="https://www.tradingview.com" target="_blank">
Trading View
</a>
<span class="opacity-50">'s</span>{" "}
<a
href="https://www.tradingview.com/lightweight-charts/"
target="_blank"
>
Lightweight Charts
</a>{" "}
<span class="opacity-50">library</span>
</p>
<hr class="border-lighter -mx-4 border-t" />
<p class="pb-[10vh] pt-4 text-center">
<span class="opacity-50">Version:</span>{" "}
<a
@@ -0,0 +1,39 @@
import { Anchor } from "./anchor";
export function AnchorAPI() {
return (
<Anchor
title="API"
icon={() => () => (
<svg
width="20"
height="20"
viewBox="0 0 20 20"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M4.24703 1.18097C2.76813 1.92042 2.16211 2.79195 2.16211 3.51351C2.16211 4.23508 2.76813 5.10661 4.24703 5.84606C5.67744 6.56126 7.71027 7.02703 9.99995 7.02703C12.2896 7.02703 14.3225 6.56126 15.7529 5.84606C17.2318 5.10661 17.8378 4.23508 17.8378 3.51351C17.8378 2.79195 17.2318 1.92042 15.7529 1.18097C14.3225 0.465762 12.2896 0 9.99995 0C7.71027 0 5.67744 0.465762 4.24703 1.18097Z"
fill="currentColor"
></path>
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M2.16211 6.44023V10C2.16211 10.7216 2.76813 11.5931 4.24703 12.3325C5.67744 13.0477 7.71027 13.5135 9.99995 13.5135C12.2896 13.5135 14.3225 13.0477 15.7529 12.3325C17.2318 11.5931 17.8378 10.7216 17.8378 10V6.44023C17.4305 6.7651 16.9684 7.0513 16.4781 7.29648C14.7783 8.14638 12.4868 8.64865 9.99995 8.64865C7.51311 8.64865 5.22161 8.14638 3.52182 7.29648C3.03145 7.0513 2.5694 6.7651 2.16211 6.44023ZM5.67562 10C5.67562 10.5971 5.19161 11.0811 4.59454 11.0811C3.99748 11.0811 3.51346 10.5971 3.51346 10C3.51346 9.40294 3.99748 8.91892 4.59454 8.91892C5.19161 8.91892 5.67562 9.40294 5.67562 10ZM8.91887 12.1622C9.51593 12.1622 9.99995 11.6781 9.99995 11.0811C9.99995 10.484 9.51593 10 8.91887 10C8.3218 10 7.83778 10.484 7.83778 11.0811C7.83778 11.6781 8.3218 12.1622 8.91887 12.1622Z"
fill="currentColor"
></path>
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M2.16211 12.9267V16.4865C2.16211 17.208 2.76813 18.0796 4.24703 18.819C5.67744 19.5342 7.71027 20 9.99995 20C12.2896 20 14.3225 19.5342 15.7529 18.819C17.2318 18.0796 17.8378 17.208 17.8378 16.4865V12.9267C17.4305 13.2516 16.9684 13.5378 16.4781 13.783C14.7783 14.6329 12.4868 15.1351 9.99995 15.1351C7.51311 15.1351 5.22161 14.6329 3.52182 13.783C3.03145 13.5378 2.5694 13.2516 2.16211 12.9267ZM5.67562 16.4865C5.67562 17.0835 5.19161 17.5676 4.59454 17.5676C3.99748 17.5676 3.51346 17.0835 3.51346 16.4865C3.51346 15.8894 3.99748 15.4054 4.59454 15.4054C5.19161 15.4054 5.67562 15.8894 5.67562 16.4865ZM8.91887 18.6486C9.51593 18.6486 9.99995 18.1646 9.99995 17.5676C9.99995 16.9705 9.51593 16.4865 8.91887 16.4865C8.3218 16.4865 7.83778 16.9705 7.83778 17.5676C7.83778 18.1646 8.3218 18.6486 8.91887 18.6486Z"
fill="currentColor"
></path>
</svg>
)}
href="https://api-bkp.satonomics.xyz"
// TODO: Change back once server bought: href="https://api-bkp.satonomics.xyz"
/>
);
}
@@ -4,17 +4,19 @@ export function AnchorNostr() {
return (
<Anchor
title="Nostr"
icon={() => (props: { class?: string }) => (
icon={() => () => (
<svg
width="20"
height="20"
viewBox="0 0 20 20"
fill="currentColor"
fill="none"
xmlns="http://www.w3.org/2000/svg"
class={props.class}
>
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M13.7502 1.5C13.3359 1.5 13.0002 1.83579 13.0002 2.25C13.0002 2.44257 13.0717 2.61663 13.191 2.74981C13.2963 2.86751 13.4367 2.95067 13.5937 2.98382C13.6435 2.99433 13.6958 3 13.7502 3C14.1644 3 14.5002 2.66421 14.5002 2.25C14.5002 1.83579 14.1644 1.5 13.7502 1.5ZM11.5002 2.25C11.5002 1.00736 12.5075 0 13.7502 0C14.7298 0 15.5632 0.626106 15.8721 1.5H17.2502C17.6644 1.5 18.0002 1.83579 18.0002 2.25C18.0002 2.66421 17.6644 3 17.2502 3H15.8721C15.7646 3.30433 15.5934 3.5786 15.3746 3.80685C15.8823 4.15684 16.2746 4.56859 16.5559 5.03129C17.0977 5.92273 17.1689 6.90747 16.9843 7.79359C16.803 8.66356 16.4559 9.21659 16.076 9.55603C16.0407 9.58759 16.0055 9.61689 15.9707 9.64408C15.9901 9.86441 15.987 10.0911 15.961 10.3234C15.8963 11.095 15.7248 11.9737 14.9635 12.7682C14.447 13.3072 13.7758 13.6448 13.2782 13.8437C13.0474 13.936 12.8402 14.0039 12.6813 14.0508C12.5887 14.2176 12.4689 14.451 12.3551 14.7243C12.1564 15.2017 11.999 15.7473 12.0002 16.2484C12.0011 16.664 12.1111 17.3476 12.2365 17.9768C12.2743 18.1665 12.3122 18.3447 12.3464 18.5001H13.2502C13.6644 18.5001 14.0002 18.8359 14.0002 19.2501C14.0002 19.6643 13.6644 20.0001 13.2502 20.0001H9.50017C9.15558 20.0001 8.85533 19.7653 8.77228 19.4308L9.50017 19.2501C8.77228 19.4308 8.77228 19.4308 8.77228 19.4308L8.77052 19.4237L8.76601 19.4053L8.74947 19.337C8.73534 19.2781 8.71532 19.1935 8.69136 19.0891C8.64351 18.8806 8.5796 18.5917 8.51548 18.2701C8.39148 17.6482 8.25146 16.8318 8.25017 16.2518C8.24854 15.5227 8.455 14.8065 8.6849 14.2341C8.16639 14.1203 7.6883 13.9364 7.28499 13.7003C6.8511 13.4462 6.41419 13.0729 6.17829 12.5938H2.75029C2.4353 12.5938 2.15363 12.3969 2.04556 12.1011C1.93749 11.8052 2.0258 11.4733 2.26663 11.2703L3.18599 10.4953C2.80831 10.4564 2.51374 10.1372 2.51374 9.74926C2.51374 8.4257 3.50881 7.51335 4.62109 6.95581C5.76228 6.38377 7.24656 6.05918 8.72722 5.97699C10.2102 5.89468 11.7615 6.05149 13.0442 6.50251C13.9451 6.81927 14.793 7.31253 15.3456 8.03745C15.4073 7.89899 15.4675 7.71949 15.5158 7.48766C15.6401 6.89125 15.5786 6.31137 15.2741 5.81039C14.9722 5.31375 14.3741 4.8005 13.2451 4.44292C12.7831 4.33682 12.3768 4.0893 12.0732 3.75019C11.7174 3.35262 11.5002 2.82579 11.5002 2.25ZM10.8948 14.3362C10.6852 14.3506 10.4759 14.3595 10.2686 14.3634C10.0228 14.8666 9.74868 15.5834 9.75016 16.2484C9.75109 16.664 9.86108 17.3476 9.98652 17.9768C10.0243 18.1665 10.0622 18.3447 10.0964 18.5001H10.8124C10.7969 18.4258 10.7812 18.349 10.7655 18.2701C10.6415 17.6482 10.5015 16.8318 10.5002 16.2518C10.4986 15.5522 10.6874 14.8745 10.8948 14.3362Z"
fill="currentColor"
></path>
</svg>
)}
+1 -1
View File
@@ -3,7 +3,7 @@ import { render } from "solid-js/web";
import "./styles.css";
import { App } from "./app";
import { App } from "./components/app";
const root = document.getElementById("root");
+2
View File
@@ -0,0 +1,2 @@
TradingView Lightweight Charts™
Copyright (с) 2023 TradingView, Inc. https://www.tradingview.com/
@@ -25,6 +25,7 @@ export function createChart({
fontFamily: "Lexend",
background: { color: "transparent" },
fontSize: 14,
attributionLogo: false,
},
grid: {
vertLines: { visible: false },
@@ -8,13 +8,9 @@ export const PRICE_SCALE_MOMENTUM_ID = "momentum";
export const createHistogramSeries = ({
chart,
// dark,
// color,
options,
}: {
chart: IChartApi;
// dark: Accessor<boolean>;
// color: Color;
options?: HistogramOptions;
}) => {
const seriesOptions: HistogramOptions = {
+1
View File
@@ -0,0 +1 @@
type UserConfig = ReturnType<typeof import("./config").createUserConfig>;
+5 -5
View File
@@ -6,23 +6,23 @@ use serde::{Deserialize, Serialize};
#[derive(Parser, Debug, Clone, Default, Serialize, Deserialize)]
#[command(version, about, long_about = None)]
pub struct Config {
/// Bitcoin data directory path
/// Bitcoin data directory path, saved
#[arg(long, value_name = "DIR")]
pub datadir: Option<String>,
/// Bitcoin RPC port, default: 8332
/// Bitcoin RPC port, default: 8332, saved
#[arg(long, value_name = "PORT")]
pub rpcport: Option<u16>,
/// Bitcoin RPC username
/// Bitcoin RPC username, saved
#[arg(long, value_name = "USERNAME")]
pub rpcuser: Option<String>,
/// Bitcoin RPC password
/// Bitcoin RPC password, saved
#[arg(long, value_name = "PASSWORD")]
pub rpcpassword: Option<String>,
/// Delay between runs, default: 0
/// Delay between runs, default: 0, saved
#[arg(long, value_name = "SECONDS")]
pub delay: Option<u64>,
}