2026-03-09 07:43:12 +00:00
|
|
|
use super::RpcHandler;
|
2026-06-18 12:10:07 -04:00
|
|
|
use crate::wallet::{ecash, fedimint_client, profits};
|
2026-03-09 07:43:12 +00:00
|
|
|
use anyhow::Result;
|
|
|
|
|
|
2026-06-18 12:10:07 -04:00
|
|
|
/// A Cashu token (NUT-00 `cashuA`/`cashuB`, or our legacy `cashuSend_` form)
|
|
|
|
|
/// always starts with `cashu`. Fedimint ecash notes never do, so a non-`cashu`
|
|
|
|
|
/// string is routed to the Fedimint reissue path.
|
|
|
|
|
fn is_cashu_token(token: &str) -> bool {
|
|
|
|
|
token.trim_start().starts_with("cashu")
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-09 07:43:12 +00:00
|
|
|
impl RpcHandler {
|
chore(ci): rustfmt + clippy clean-up to unblock the Rust CI job
The .github/workflows/ci.yml Rust job runs cargo fmt --check, clippy
with -D warnings, and tests. All three were failing. This commit:
- Applies rustfmt across the tree (the bulk of the diff — untouched
since the last toolchain bump, so a wide sweep was unavoidable).
- Fixes the correctness-level clippy errors:
container/bitcoin_simulator.rs wildcard-in-or-pattern
container/manifest.rs from_str rename to parse (reserved name)
container/podman_client.rs .get(0) -> .first()
container/runtime.rs manual += collapse
archipelago/src/constants.rs doc-comment → module-doc
api/rpc/package/install.rs stray /// comment above a non-item
container/docker_packages.rs redundant field init
streaming/advertisement.rs missing Metric import in tests
tests/orchestration_tests.rs `vec!` in non-Vec contexts
mesh/listener/dispatch.rs unused store_plain_message import
api/rpc/tor/mod.rs and mesh/steganography.rs: push-after-new → vec!
- Quiets wide legacy surfaces with crate-level allows in main.rs for
stylistic lints (too_many_arguments, type_complexity, doc indent,
enum variant prefix, wildcard-in-or, assertions-on-constants,
drop_non_drop, unused_io_amount, ptr_arg) — these fired in dozens
of places with no correctness payoff and have been churning every
toolchain bump.
- Tags intentional-dead-code helpers: wallet/ and streaming/ modules
are WIP, mesh::send_chunked_payload and DM_V1_MARKER are kept for
rollback compatibility, vpn::get_nostr_vpn_status is surface-area
for a not-yet-landed RPC.
cargo fmt --check, cargo clippy --all-targets --all-features
-- -D warnings, and cargo test --all-features now all pass locally.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-18 17:23:46 -04:00
|
|
|
pub(super) async fn handle_wallet_ecash_balance(&self) -> Result<serde_json::Value> {
|
2026-03-09 07:43:12 +00:00
|
|
|
let wallet = ecash::load_wallet(&self.config.data_dir).await?;
|
2026-06-20 08:13:23 -04:00
|
|
|
let cashu_sats = wallet.balance();
|
|
|
|
|
// Spendable Fedimint balance too, so callers (e.g. the pay-for-file
|
|
|
|
|
// pre-check) see funds available across BOTH backends (#3). Best-effort:
|
|
|
|
|
// if fmcd isn't installed/joined this is just 0, never an error.
|
|
|
|
|
let fedimint_sats = match fedimint_client::FedimintClient::from_node(&self.config.data_dir)
|
|
|
|
|
.await
|
|
|
|
|
{
|
|
|
|
|
Ok(client) => client.total_balance_sats().await.unwrap_or(0),
|
|
|
|
|
Err(_) => 0,
|
|
|
|
|
};
|
2026-03-09 07:43:12 +00:00
|
|
|
Ok(serde_json::json!({
|
2026-06-20 08:13:23 -04:00
|
|
|
// `balance_sats` stays Cashu-only for back-compat; `total_sats` is the
|
|
|
|
|
// spendable amount across Cashu + Fedimint.
|
|
|
|
|
"balance_sats": cashu_sats,
|
|
|
|
|
"cashu_sats": cashu_sats,
|
|
|
|
|
"fedimint_sats": fedimint_sats,
|
|
|
|
|
"total_sats": cashu_sats + fedimint_sats,
|
feat: streaming ecash payments + media playback overhaul
Cashu ecash protocol (BDHKE blind signatures, cashuA token format,
mint HTTP client) replacing the stub wallet. TollGate-inspired streaming
data payment system with step-based pricing (bytes/time/requests),
session management with incremental top-ups, usage metering, and
Nostr kind 10021 service advertisements.
13 new streaming.* RPC endpoints. Content server now verifies real
Cashu tokens. Profits tracking includes streaming revenue.
Frontend: GlobalAudioPlayer (persistent bottom bar across all pages),
video lightbox with full controls, audio in MediaLightbox, free file
previews (no blur), paid 10% audio/video previews, separated play
vs download buttons in PeerFiles.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-11 22:31:28 -04:00
|
|
|
"proof_count": wallet.proofs.iter().filter(|p| !p.spent && !p.reserved).count(),
|
|
|
|
|
"mint_url": wallet.mint_url,
|
2026-03-09 07:43:12 +00:00
|
|
|
}))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub(super) async fn handle_wallet_ecash_mint(
|
|
|
|
|
&self,
|
|
|
|
|
params: Option<serde_json::Value>,
|
|
|
|
|
) -> Result<serde_json::Value> {
|
|
|
|
|
let params = params.ok_or_else(|| anyhow::anyhow!("Missing params"))?;
|
|
|
|
|
let amount_sats = params
|
|
|
|
|
.get("amount_sats")
|
|
|
|
|
.and_then(|v| v.as_u64())
|
|
|
|
|
.ok_or_else(|| anyhow::anyhow!("Missing amount_sats"))?;
|
|
|
|
|
|
|
|
|
|
if amount_sats == 0 || amount_sats > 1_000_000 {
|
chore(ci): rustfmt + clippy clean-up to unblock the Rust CI job
The .github/workflows/ci.yml Rust job runs cargo fmt --check, clippy
with -D warnings, and tests. All three were failing. This commit:
- Applies rustfmt across the tree (the bulk of the diff — untouched
since the last toolchain bump, so a wide sweep was unavoidable).
- Fixes the correctness-level clippy errors:
container/bitcoin_simulator.rs wildcard-in-or-pattern
container/manifest.rs from_str rename to parse (reserved name)
container/podman_client.rs .get(0) -> .first()
container/runtime.rs manual += collapse
archipelago/src/constants.rs doc-comment → module-doc
api/rpc/package/install.rs stray /// comment above a non-item
container/docker_packages.rs redundant field init
streaming/advertisement.rs missing Metric import in tests
tests/orchestration_tests.rs `vec!` in non-Vec contexts
mesh/listener/dispatch.rs unused store_plain_message import
api/rpc/tor/mod.rs and mesh/steganography.rs: push-after-new → vec!
- Quiets wide legacy surfaces with crate-level allows in main.rs for
stylistic lints (too_many_arguments, type_complexity, doc indent,
enum variant prefix, wildcard-in-or, assertions-on-constants,
drop_non_drop, unused_io_amount, ptr_arg) — these fired in dozens
of places with no correctness payoff and have been churning every
toolchain bump.
- Tags intentional-dead-code helpers: wallet/ and streaming/ modules
are WIP, mesh::send_chunked_payload and DM_V1_MARKER are kept for
rollback compatibility, vpn::get_nostr_vpn_status is surface-area
for a not-yet-landed RPC.
cargo fmt --check, cargo clippy --all-targets --all-features
-- -D warnings, and cargo test --all-features now all pass locally.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-18 17:23:46 -04:00
|
|
|
return Err(anyhow::anyhow!(
|
|
|
|
|
"Amount must be between 1 and 1,000,000 sats"
|
|
|
|
|
));
|
2026-03-09 07:43:12 +00:00
|
|
|
}
|
|
|
|
|
|
feat: streaming ecash payments + media playback overhaul
Cashu ecash protocol (BDHKE blind signatures, cashuA token format,
mint HTTP client) replacing the stub wallet. TollGate-inspired streaming
data payment system with step-based pricing (bytes/time/requests),
session management with incremental top-ups, usage metering, and
Nostr kind 10021 service advertisements.
13 new streaming.* RPC endpoints. Content server now verifies real
Cashu tokens. Profits tracking includes streaming revenue.
Frontend: GlobalAudioPlayer (persistent bottom bar across all pages),
video lightbox with full controls, audio in MediaLightbox, free file
previews (no blur), paid 10% audio/video previews, separated play
vs download buttons in PeerFiles.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-11 22:31:28 -04:00
|
|
|
// Step 1: Get a mint quote (returns Lightning invoice)
|
|
|
|
|
let quote = ecash::mint_quote(&self.config.data_dir, amount_sats).await?;
|
|
|
|
|
|
|
|
|
|
Ok(serde_json::json!({
|
|
|
|
|
"quote_id": quote.quote,
|
|
|
|
|
"bolt11": quote.request,
|
|
|
|
|
"state": quote.state,
|
|
|
|
|
"amount_sats": amount_sats,
|
|
|
|
|
"message": "Pay the Lightning invoice, then call wallet.ecash-mint-claim with the quote_id",
|
|
|
|
|
}))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// Claim minted tokens after paying the Lightning invoice.
|
|
|
|
|
pub(super) async fn handle_wallet_ecash_mint_claim(
|
|
|
|
|
&self,
|
|
|
|
|
params: Option<serde_json::Value>,
|
|
|
|
|
) -> Result<serde_json::Value> {
|
|
|
|
|
let params = params.ok_or_else(|| anyhow::anyhow!("Missing params"))?;
|
|
|
|
|
let quote_id = params
|
|
|
|
|
.get("quote_id")
|
|
|
|
|
.and_then(|v| v.as_str())
|
|
|
|
|
.ok_or_else(|| anyhow::anyhow!("Missing quote_id"))?;
|
|
|
|
|
let amount_sats = params
|
|
|
|
|
.get("amount_sats")
|
|
|
|
|
.and_then(|v| v.as_u64())
|
|
|
|
|
.ok_or_else(|| anyhow::anyhow!("Missing amount_sats"))?;
|
|
|
|
|
|
|
|
|
|
let minted = ecash::mint_tokens(&self.config.data_dir, quote_id, amount_sats).await?;
|
2026-03-09 07:43:12 +00:00
|
|
|
Ok(serde_json::json!({
|
feat: streaming ecash payments + media playback overhaul
Cashu ecash protocol (BDHKE blind signatures, cashuA token format,
mint HTTP client) replacing the stub wallet. TollGate-inspired streaming
data payment system with step-based pricing (bytes/time/requests),
session management with incremental top-ups, usage metering, and
Nostr kind 10021 service advertisements.
13 new streaming.* RPC endpoints. Content server now verifies real
Cashu tokens. Profits tracking includes streaming revenue.
Frontend: GlobalAudioPlayer (persistent bottom bar across all pages),
video lightbox with full controls, audio in MediaLightbox, free file
previews (no blur), paid 10% audio/video previews, separated play
vs download buttons in PeerFiles.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-11 22:31:28 -04:00
|
|
|
"minted_sats": minted,
|
2026-03-09 07:43:12 +00:00
|
|
|
}))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub(super) async fn handle_wallet_ecash_melt(
|
|
|
|
|
&self,
|
|
|
|
|
params: Option<serde_json::Value>,
|
|
|
|
|
) -> Result<serde_json::Value> {
|
|
|
|
|
let params = params.ok_or_else(|| anyhow::anyhow!("Missing params"))?;
|
feat: streaming ecash payments + media playback overhaul
Cashu ecash protocol (BDHKE blind signatures, cashuA token format,
mint HTTP client) replacing the stub wallet. TollGate-inspired streaming
data payment system with step-based pricing (bytes/time/requests),
session management with incremental top-ups, usage metering, and
Nostr kind 10021 service advertisements.
13 new streaming.* RPC endpoints. Content server now verifies real
Cashu tokens. Profits tracking includes streaming revenue.
Frontend: GlobalAudioPlayer (persistent bottom bar across all pages),
video lightbox with full controls, audio in MediaLightbox, free file
previews (no blur), paid 10% audio/video previews, separated play
vs download buttons in PeerFiles.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-11 22:31:28 -04:00
|
|
|
let bolt11 = params
|
|
|
|
|
.get("bolt11")
|
|
|
|
|
.and_then(|v| v.as_str())
|
|
|
|
|
.ok_or_else(|| anyhow::anyhow!("Missing bolt11 (Lightning invoice)"))?;
|
|
|
|
|
|
|
|
|
|
// Step 1: Get melt quote
|
|
|
|
|
let quote = ecash::melt_quote(&self.config.data_dir, bolt11).await?;
|
|
|
|
|
|
|
|
|
|
Ok(serde_json::json!({
|
|
|
|
|
"quote_id": quote.quote,
|
|
|
|
|
"amount_sats": quote.amount,
|
|
|
|
|
"fee_reserve_sats": quote.fee_reserve,
|
|
|
|
|
"total_needed_sats": quote.amount + quote.fee_reserve,
|
|
|
|
|
"message": "Call wallet.ecash-melt-confirm with quote_id and bolt11 to execute",
|
|
|
|
|
}))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// Confirm and execute a melt (pay Lightning invoice with ecash).
|
|
|
|
|
pub(super) async fn handle_wallet_ecash_melt_confirm(
|
|
|
|
|
&self,
|
|
|
|
|
params: Option<serde_json::Value>,
|
|
|
|
|
) -> Result<serde_json::Value> {
|
|
|
|
|
let params = params.ok_or_else(|| anyhow::anyhow!("Missing params"))?;
|
|
|
|
|
let quote_id = params
|
|
|
|
|
.get("quote_id")
|
|
|
|
|
.and_then(|v| v.as_str())
|
|
|
|
|
.ok_or_else(|| anyhow::anyhow!("Missing quote_id"))?;
|
|
|
|
|
let bolt11 = params
|
|
|
|
|
.get("bolt11")
|
2026-03-09 07:43:12 +00:00
|
|
|
.and_then(|v| v.as_str())
|
feat: streaming ecash payments + media playback overhaul
Cashu ecash protocol (BDHKE blind signatures, cashuA token format,
mint HTTP client) replacing the stub wallet. TollGate-inspired streaming
data payment system with step-based pricing (bytes/time/requests),
session management with incremental top-ups, usage metering, and
Nostr kind 10021 service advertisements.
13 new streaming.* RPC endpoints. Content server now verifies real
Cashu tokens. Profits tracking includes streaming revenue.
Frontend: GlobalAudioPlayer (persistent bottom bar across all pages),
video lightbox with full controls, audio in MediaLightbox, free file
previews (no blur), paid 10% audio/video previews, separated play
vs download buttons in PeerFiles.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-11 22:31:28 -04:00
|
|
|
.ok_or_else(|| anyhow::anyhow!("Missing bolt11"))?;
|
2026-03-09 07:43:12 +00:00
|
|
|
|
feat: streaming ecash payments + media playback overhaul
Cashu ecash protocol (BDHKE blind signatures, cashuA token format,
mint HTTP client) replacing the stub wallet. TollGate-inspired streaming
data payment system with step-based pricing (bytes/time/requests),
session management with incremental top-ups, usage metering, and
Nostr kind 10021 service advertisements.
13 new streaming.* RPC endpoints. Content server now verifies real
Cashu tokens. Profits tracking includes streaming revenue.
Frontend: GlobalAudioPlayer (persistent bottom bar across all pages),
video lightbox with full controls, audio in MediaLightbox, free file
previews (no blur), paid 10% audio/video previews, separated play
vs download buttons in PeerFiles.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-11 22:31:28 -04:00
|
|
|
let melted = ecash::melt_tokens(&self.config.data_dir, quote_id, bolt11).await?;
|
2026-03-09 07:43:12 +00:00
|
|
|
Ok(serde_json::json!({
|
feat: streaming ecash payments + media playback overhaul
Cashu ecash protocol (BDHKE blind signatures, cashuA token format,
mint HTTP client) replacing the stub wallet. TollGate-inspired streaming
data payment system with step-based pricing (bytes/time/requests),
session management with incremental top-ups, usage metering, and
Nostr kind 10021 service advertisements.
13 new streaming.* RPC endpoints. Content server now verifies real
Cashu tokens. Profits tracking includes streaming revenue.
Frontend: GlobalAudioPlayer (persistent bottom bar across all pages),
video lightbox with full controls, audio in MediaLightbox, free file
previews (no blur), paid 10% audio/video previews, separated play
vs download buttons in PeerFiles.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-11 22:31:28 -04:00
|
|
|
"melted_sats": melted,
|
2026-03-09 07:43:12 +00:00
|
|
|
}))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub(super) async fn handle_wallet_ecash_send(
|
|
|
|
|
&self,
|
|
|
|
|
params: Option<serde_json::Value>,
|
|
|
|
|
) -> Result<serde_json::Value> {
|
|
|
|
|
let params = params.ok_or_else(|| anyhow::anyhow!("Missing params"))?;
|
|
|
|
|
let amount_sats = params
|
|
|
|
|
.get("amount_sats")
|
|
|
|
|
.and_then(|v| v.as_u64())
|
|
|
|
|
.ok_or_else(|| anyhow::anyhow!("Missing amount_sats"))?;
|
|
|
|
|
|
|
|
|
|
let token_str = ecash::send_token(&self.config.data_dir, amount_sats).await?;
|
|
|
|
|
Ok(serde_json::json!({
|
|
|
|
|
"token": token_str,
|
|
|
|
|
"amount_sats": amount_sats,
|
|
|
|
|
}))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub(super) async fn handle_wallet_ecash_receive(
|
|
|
|
|
&self,
|
|
|
|
|
params: Option<serde_json::Value>,
|
|
|
|
|
) -> Result<serde_json::Value> {
|
|
|
|
|
let params = params.ok_or_else(|| anyhow::anyhow!("Missing params"))?;
|
|
|
|
|
let token = params
|
|
|
|
|
.get("token")
|
|
|
|
|
.and_then(|v| v.as_str())
|
2026-06-18 12:10:07 -04:00
|
|
|
.map(str::trim)
|
|
|
|
|
.filter(|s| !s.is_empty())
|
2026-03-09 07:43:12 +00:00
|
|
|
.ok_or_else(|| anyhow::anyhow!("Missing token"))?;
|
|
|
|
|
|
2026-06-18 12:10:07 -04:00
|
|
|
// Dual-ecash: one "Receive ecash" box accepts either a Cashu token
|
|
|
|
|
// (redeemed at the mint) or Fedimint notes (reissued via the fmcd
|
|
|
|
|
// sidecar). Detect by prefix and route accordingly.
|
|
|
|
|
if is_cashu_token(token) {
|
|
|
|
|
let amount = ecash::receive_token(&self.config.data_dir, token).await?;
|
|
|
|
|
return Ok(serde_json::json!({
|
|
|
|
|
"received_sats": amount,
|
|
|
|
|
"kind": "cashu",
|
|
|
|
|
}));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let (amount, federation_id) =
|
|
|
|
|
fedimint_client::reissue_into_any(&self.config.data_dir, token).await?;
|
2026-03-09 07:43:12 +00:00
|
|
|
Ok(serde_json::json!({
|
|
|
|
|
"received_sats": amount,
|
2026-06-18 12:10:07 -04:00
|
|
|
"kind": "fedimint",
|
|
|
|
|
"federation_id": federation_id,
|
2026-03-09 07:43:12 +00:00
|
|
|
}))
|
|
|
|
|
}
|
|
|
|
|
|
chore(ci): rustfmt + clippy clean-up to unblock the Rust CI job
The .github/workflows/ci.yml Rust job runs cargo fmt --check, clippy
with -D warnings, and tests. All three were failing. This commit:
- Applies rustfmt across the tree (the bulk of the diff — untouched
since the last toolchain bump, so a wide sweep was unavoidable).
- Fixes the correctness-level clippy errors:
container/bitcoin_simulator.rs wildcard-in-or-pattern
container/manifest.rs from_str rename to parse (reserved name)
container/podman_client.rs .get(0) -> .first()
container/runtime.rs manual += collapse
archipelago/src/constants.rs doc-comment → module-doc
api/rpc/package/install.rs stray /// comment above a non-item
container/docker_packages.rs redundant field init
streaming/advertisement.rs missing Metric import in tests
tests/orchestration_tests.rs `vec!` in non-Vec contexts
mesh/listener/dispatch.rs unused store_plain_message import
api/rpc/tor/mod.rs and mesh/steganography.rs: push-after-new → vec!
- Quiets wide legacy surfaces with crate-level allows in main.rs for
stylistic lints (too_many_arguments, type_complexity, doc indent,
enum variant prefix, wildcard-in-or, assertions-on-constants,
drop_non_drop, unused_io_amount, ptr_arg) — these fired in dozens
of places with no correctness payoff and have been churning every
toolchain bump.
- Tags intentional-dead-code helpers: wallet/ and streaming/ modules
are WIP, mesh::send_chunked_payload and DM_V1_MARKER are kept for
rollback compatibility, vpn::get_nostr_vpn_status is surface-area
for a not-yet-landed RPC.
cargo fmt --check, cargo clippy --all-targets --all-features
-- -D warnings, and cargo test --all-features now all pass locally.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-18 17:23:46 -04:00
|
|
|
pub(super) async fn handle_wallet_ecash_history(&self) -> Result<serde_json::Value> {
|
2026-06-19 16:42:06 -04:00
|
|
|
// Unified history: Cashu transactions (tagged kind="cashu") + the local
|
|
|
|
|
// Fedimint transaction log (kind="fedimint"), newest first. Previously
|
|
|
|
|
// only Cashu was returned, so a Fedimint receive showed up nowhere.
|
2026-03-09 07:43:12 +00:00
|
|
|
let wallet = ecash::load_wallet(&self.config.data_dir).await?;
|
2026-06-19 16:42:06 -04:00
|
|
|
let mut transactions = wallet.transactions;
|
|
|
|
|
transactions.extend(fedimint_client::load_fedimint_txs(&self.config.data_dir).await);
|
|
|
|
|
// Sort by RFC-3339 timestamp descending (string compare is valid for
|
|
|
|
|
// same-offset RFC-3339), newest first.
|
|
|
|
|
transactions.sort_by(|a, b| b.timestamp.cmp(&a.timestamp));
|
2026-03-09 07:43:12 +00:00
|
|
|
Ok(serde_json::json!({
|
2026-06-19 16:42:06 -04:00
|
|
|
"transactions": transactions,
|
2026-03-09 07:43:12 +00:00
|
|
|
}))
|
|
|
|
|
}
|
|
|
|
|
|
chore(ci): rustfmt + clippy clean-up to unblock the Rust CI job
The .github/workflows/ci.yml Rust job runs cargo fmt --check, clippy
with -D warnings, and tests. All three were failing. This commit:
- Applies rustfmt across the tree (the bulk of the diff — untouched
since the last toolchain bump, so a wide sweep was unavoidable).
- Fixes the correctness-level clippy errors:
container/bitcoin_simulator.rs wildcard-in-or-pattern
container/manifest.rs from_str rename to parse (reserved name)
container/podman_client.rs .get(0) -> .first()
container/runtime.rs manual += collapse
archipelago/src/constants.rs doc-comment → module-doc
api/rpc/package/install.rs stray /// comment above a non-item
container/docker_packages.rs redundant field init
streaming/advertisement.rs missing Metric import in tests
tests/orchestration_tests.rs `vec!` in non-Vec contexts
mesh/listener/dispatch.rs unused store_plain_message import
api/rpc/tor/mod.rs and mesh/steganography.rs: push-after-new → vec!
- Quiets wide legacy surfaces with crate-level allows in main.rs for
stylistic lints (too_many_arguments, type_complexity, doc indent,
enum variant prefix, wildcard-in-or, assertions-on-constants,
drop_non_drop, unused_io_amount, ptr_arg) — these fired in dozens
of places with no correctness payoff and have been churning every
toolchain bump.
- Tags intentional-dead-code helpers: wallet/ and streaming/ modules
are WIP, mesh::send_chunked_payload and DM_V1_MARKER are kept for
rollback compatibility, vpn::get_nostr_vpn_status is surface-area
for a not-yet-landed RPC.
cargo fmt --check, cargo clippy --all-targets --all-features
-- -D warnings, and cargo test --all-features now all pass locally.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-18 17:23:46 -04:00
|
|
|
pub(super) async fn handle_wallet_networking_profits(&self) -> Result<serde_json::Value> {
|
2026-03-09 07:43:12 +00:00
|
|
|
let summary = profits::get_networking_profits(&self.config.data_dir).await?;
|
|
|
|
|
Ok(serde_json::json!({
|
|
|
|
|
"total_sats": summary.total_sats,
|
|
|
|
|
"content_sales_sats": summary.content_sales_sats,
|
|
|
|
|
"routing_fees_sats": summary.routing_fees_sats,
|
feat: streaming ecash payments + media playback overhaul
Cashu ecash protocol (BDHKE blind signatures, cashuA token format,
mint HTTP client) replacing the stub wallet. TollGate-inspired streaming
data payment system with step-based pricing (bytes/time/requests),
session management with incremental top-ups, usage metering, and
Nostr kind 10021 service advertisements.
13 new streaming.* RPC endpoints. Content server now verifies real
Cashu tokens. Profits tracking includes streaming revenue.
Frontend: GlobalAudioPlayer (persistent bottom bar across all pages),
video lightbox with full controls, audio in MediaLightbox, free file
previews (no blur), paid 10% audio/video previews, separated play
vs download buttons in PeerFiles.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-11 22:31:28 -04:00
|
|
|
"streaming_revenue_sats": summary.streaming_revenue_sats,
|
2026-03-09 07:43:12 +00:00
|
|
|
"recent": summary.recent,
|
|
|
|
|
}))
|
|
|
|
|
}
|
|
|
|
|
}
|