Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions console/embedded/native_css.cpp

Large diffs are not rendered by default.

194 changes: 97 additions & 97 deletions console/embedded/native_ecma.cpp

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion web/native/src/lib/api/client.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ export interface BlockchainClientConfiguration {
address: boolean;
filter: boolean;
turbo: boolean;
witness: boolean;
silent: boolean;
services: Readonly<Partial<Record<string, boolean>>>;
protocol: Readonly<Partial<Record<string, boolean>>>;
coin: string;
network?: string;
forks: string[];
Expand Down
4 changes: 3 additions & 1 deletion web/native/src/lib/api/providers/blockstream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,9 @@ export function createBlockstreamClient({ baseUrl }: BlockstreamClientOptions):
address: true,
filter: false,
turbo: false,
witness: true,
silent: false,
services: {},
protocol: {},
coin: 'bitcoin',
network: 'mainnet',
forks: [],
Expand Down
17 changes: 13 additions & 4 deletions web/native/src/lib/api/providers/libbitcoin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,9 @@ const DEFAULT_CONFIGURATION: BlockchainClientConfiguration = {
address: true,
filter: false,
turbo: true,
witness: true,
silent: false,
services: {},
protocol: {},
coin: 'bitcoin',
forks: [],
wallet: MAINNET_PARAMS,
Expand All @@ -157,8 +159,13 @@ function normalizeConfiguration(raw: unknown): BlockchainClientConfiguration {
typeof record[key] === 'boolean' ? record[key] : DEFAULT_CONFIGURATION[key];

const node = isRecord(raw.node) ? raw.node : {};
const witness =
typeof node.witness === 'boolean' ? node.witness : DEFAULT_CONFIGURATION.witness;
const peer = isRecord(raw.network) ? raw.network : {};
const flags = (source: Record<string, unknown>) =>
Object.fromEntries(
Object.entries(source).filter(
(entry): entry is [string, boolean] => typeof entry[1] === 'boolean'
)
);
const network = typeof node.network === 'string' ? node.network : undefined;
const forks = isRecord(raw.forks)
? Object.entries(raw.forks)
Expand All @@ -177,7 +184,9 @@ function normalizeConfiguration(raw: unknown): BlockchainClientConfiguration {
address: coerceBoolean('address'),
filter: coerceBoolean('filter'),
turbo: coerceBoolean('turbo'),
witness,
silent: typeof record.silent === 'number',
services: flags(node),
protocol: flags(peer),
coin: forks.includes('ltc_scrypt_proof_of_work') ? 'litecoin' : 'bitcoin',
network,
forks,
Expand Down
107 changes: 70 additions & 37 deletions web/native/src/routes/dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -213,29 +213,56 @@ export function DashboardPage() {
</p>
</div>

<div className="space-y-3">
<p className="text-accentSecondary text-xs tracking-wide uppercase">Capabilities</p>
<div className="flex flex-wrap gap-2">
<CapabilityPill label="Address Index" enabled={configuration?.address} />
<CapabilityPill label="Witness Node" enabled={configuration?.witness} />
<CapabilityPill label="Client Filters" enabled={configuration?.filter} />
</div>
</div>

{configuration && configuration.forks.length > 0 && (
<div className="space-y-3">
<p className="text-accentSecondary text-xs tracking-wide uppercase">Configured Forks</p>
<div className="flex flex-wrap gap-2">
{configuration.forks.map((fork) => (
<span
key={fork}
className="text-textPrimary bg-accentSecondary/15 rounded-full px-3 py-1 font-mono text-xs"
>
{fork}
</span>
))}
</div>
</div>
{configuration && (
<>
<ConfigGroup title="Store configuration">
<Flags
items={[
['Address index', configuration.address],
['Client filters index', configuration.filter],
['Silent payments index', configuration.silent],
['Turbo', configuration.turbo],
]}
/>
</ConfigGroup>
<ConfigGroup title="Node services">
<Flags
items={[
['Blocks', configuration.services.blocks],
['Limited', configuration.services.limited],
['Witness', configuration.services.witness],
['Filters', configuration.services.filters],
['Privacy', configuration.services.privacy],
]}
/>
</ConfigGroup>
<ConfigGroup title="Peer protocol">
<Flags
items={[
['Relay', configuration.protocol.relay],
['Compact', configuration.protocol.compact],
['Address', configuration.protocol.address],
['Witness tx', configuration.protocol.witness_tx],
['Memory pool', configuration.protocol.memory_pool],
['Not found', configuration.protocol.not_found],
['Reject', configuration.protocol.reject],
['Alert', configuration.protocol.alert],
]}
/>
</ConfigGroup>
<ConfigGroup title="Configured forks">
<div className="flex flex-wrap gap-1.5">
{configuration.forks.map((fork) => (
<span
key={fork}
className="text-textPrimary bg-accentSecondary/15 rounded-full px-2 py-0.5 font-mono text-xs"
>
{fork}
</span>
))}
</div>
</ConfigGroup>
</>
)}
</div>
</div>
Expand Down Expand Up @@ -399,21 +426,27 @@ function PanelStat({ label, value }: { label: string; value: ReactNode }) {
);
}

function CapabilityPill({ label, enabled }: { label: string; enabled?: boolean }) {
const active = enabled === true;
const stateLabel = enabled === undefined ? 'Unknown' : active ? 'On' : 'Off';
function ConfigGroup({ title, children }: { title: string; children: ReactNode }) {
return (
<section className="space-y-2">
<h3 className="text-accentSecondary text-xs tracking-wide uppercase">{title}</h3>
{children}
</section>
);
}

function Flags({ items }: { items: ReadonlyArray<readonly [string, boolean | undefined]> }) {
const reported = items.filter(([, enabled]) => enabled !== undefined);
return (
<span
className={`rounded-full px-3 py-1 text-xs tracking-wide uppercase ${
active
? 'bg-emerald-500/15 text-emerald-300'
: enabled === undefined
? 'bg-slate-500/15 text-slate-300'
: 'bg-rose-500/15 text-rose-300'
}`}
>
{label}: {stateLabel}
</span>
<div className="flex flex-wrap gap-1.5">
{reported.map(([label, enabled]) => (
<span
key={label}
className={`rounded-full border px-2 py-0.5 text-xs ${enabled ? 'border-emerald-500/50 bg-emerald-500/15 text-emerald-300' : 'text-textMuted border-slate-500/40'}`}
>
{label}
</span>
))}
</div>
);
}
Loading