Skip to content

Commit

Permalink
Add nostr zap and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
223880 committed Oct 14, 2024
1 parent b1031aa commit e268fe8
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion crates/paywall.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@ use crate::Paywall;
use lnd_grpc_rust::LightningClient;
use lnd_grpc_rust::LND;
use lnd_grpc_rust::Macroon;

use nostr::Event;
use nostr::Zapper;
use nostr::WebLN;
pub struct Paywall {
pub client: LightningClient,
pub l402: bool,
pub url: String,
pub event: String,
pub zapper: String,
pub web_ln: String,
pub macroon: String,
pub paywall_id: String,
pub paywall_secret: String,
Expand All @@ -20,15 +25,38 @@ impl Paywall {
url: String,
paywall_id: String,
paywall_secret: String,
event: String,
zapper: String,
web_ln: String,
paywall_secret_hash: String,
) -> Paywall {
Paywall {
client,
l402,
url,
zapper,
web_ln,
macroon,
event,
paywall_id,
paywall_secret,
paywall_secret_hash,
}
}
}
#[cfg(test)]
mod tests {
use super::*;
use nostr::Event;
use nostr::Zapper;
use
nostr::WebLN;
use std::env;
use std::str::FromStr;
fn get_env_var(key: &str) -> String {
env::var(key).expect(&format!("{} must be set", key))
}
fn get_env_var_bool(key: &str) -> bool {
env::var(key).expect(&format!("{} must be set", key)).parse::<bool>().unwrap()
}
}

0 comments on commit e268fe8

Please sign in to comment.