Skip to content

Commit

Permalink
fix: add pub fields back to client structs
Browse files Browse the repository at this point in the history
  • Loading branch information
lsunsi committed Dec 11, 2023
1 parent 7103438 commit 64d1c04
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 35 deletions.
4 changes: 2 additions & 2 deletions src/core/channel/client.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#[derive(Clone, Debug)]
pub struct Response {
callback: url::Url,
pub callback: url::Url,
pub uri: String,
k1: String,
pub k1: String,
}

impl std::str::FromStr for Response {
Expand Down
2 changes: 1 addition & 1 deletion src/core/pay/client.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#[derive(Clone, Debug)]
pub struct Response {
callback: url::Url,
pub callback: url::Url,
pub metadata_raw: String,
pub short_description: String,
pub long_description: Option<String>,
Expand Down
4 changes: 2 additions & 2 deletions src/core/withdraw/client.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#[derive(Clone, Debug)]
pub struct Response {
k1: String,
callback: url::Url,
pub k1: String,
pub callback: url::Url,
pub description: String,
pub min: u64,
pub max: u64,
Expand Down
1 change: 1 addition & 0 deletions src/core/withdraw/server.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#[derive(Clone, Debug)]
pub struct Response {
pub k1: String,
pub callback: url::Url,
Expand Down
54 changes: 24 additions & 30 deletions tests/real.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ mod pay_request {
panic!("parse");
};

assert_eq!(
pr.callback.as_str(),
"https://getalby.com/lnurlp/lorenzo/callback"
);
assert_eq!(pr.short_description, "Sats for lorenzo");
assert!(pr.long_description.is_none());

Expand All @@ -16,11 +20,6 @@ mod pay_request {

assert!(pr.jpeg.is_none());
assert!(pr.png.is_none());

assert_eq!(
pr.callback(314, None).to_string(),
"https://getalby.com/lnurlp/lorenzo/callback?amount=314"
);
}

#[test]
Expand All @@ -31,6 +30,10 @@ mod pay_request {
panic!("parse");
};

assert_eq!(
pr.callback.as_str(),
"https://pay.mainnet.galoy.io/lnurlp/lorenzo/callback"
);
assert_eq!(pr.short_description, "Payment to lorenzo");
assert!(pr.long_description.is_none());

Expand All @@ -40,11 +43,6 @@ mod pay_request {

assert!(pr.jpeg.is_none());
assert!(pr.png.is_none());

assert_eq!(
pr.callback(314, None).to_string(),
"https://pay.mainnet.galoy.io/lnurlp/lorenzo/callback?amount=314"
);
}

#[test]
Expand All @@ -55,6 +53,10 @@ mod pay_request {
panic!("parse");
};

assert_eq!(
pr.callback.as_str(),
"https://api.bipa.app/ln/request/invoice/kenu/1701784379/50n3BjOSWb1ZrxE9WmRcqlk2ylDzUJ1Q_GHN0pk_Q7Q/P6IMTO82jj6W21mUvXNgIlGmqGibx8MiaWfSjQ2wI88"
);
assert_eq!(pr.short_description, "$kenu ⚡ bipa.app");
assert!(pr.long_description.is_none());

Expand All @@ -64,11 +66,6 @@ mod pay_request {

assert!(pr.jpeg.is_none());
assert_eq!(pr.png.as_ref().unwrap().len(), 54697);

assert_eq!(
pr.callback(314, None).to_string(),
"https://api.bipa.app/ln/request/invoice/kenu/1701784379/50n3BjOSWb1ZrxE9WmRcqlk2ylDzUJ1Q_GHN0pk_Q7Q/P6IMTO82jj6W21mUvXNgIlGmqGibx8MiaWfSjQ2wI88?amount=314"
);
}

#[test]
Expand All @@ -79,6 +76,10 @@ mod pay_request {
panic!("parse");
};

assert_eq!(
pr.callback.as_str(),
"https://app.pouch.ph/api/v2/lnurl/pay/ethan"
);
assert_eq!(pr.short_description, "Lightning payment to ethan@pouch.ph");
assert!(pr.long_description.is_none());

Expand All @@ -88,11 +89,6 @@ mod pay_request {

assert!(pr.jpeg.is_none());
assert!(pr.png.is_none());

assert_eq!(
pr.callback(314, None).to_string(),
"https://app.pouch.ph/api/v2/lnurl/pay/ethan?amount=314"
);
}

#[test]
Expand All @@ -103,6 +99,10 @@ mod pay_request {
panic!("parse");
};

assert_eq!(
pr.callback.as_str(),
"https://livingroomofsatoshi.com/api/v1/lnurl/payreq/0e7f30e3-e74d-410d-bf86-50d101715e81"
);
assert_eq!(
pr.short_description,
"Pay to Wallet of Satoshi user: wailingcity51"
Expand All @@ -115,11 +115,6 @@ mod pay_request {

assert!(pr.jpeg.is_none());
assert!(pr.png.is_none());

assert_eq!(
pr.callback(314, None).to_string(),
"https://livingroomofsatoshi.com/api/v1/lnurl/payreq/0e7f30e3-e74d-410d-bf86-50d101715e81?amount=314"
);
}

#[test]
Expand All @@ -130,6 +125,10 @@ mod pay_request {
panic!("parse");
};

assert_eq!(
pr.callback.as_str(),
"https://api.zebedee.io/v0/process-static-charges/8d648ac7-09f6-400c-8479-d05ac4d9d61d"
);
assert_eq!(pr.short_description, "luhack - Welcome to my zbd.gg page!");
assert!(pr.long_description.is_none());

Expand All @@ -139,10 +138,5 @@ mod pay_request {

assert!(pr.jpeg.is_none());
assert_eq!(pr.png.as_ref().unwrap().len(), 3993);

assert_eq!(
pr.callback(314, None).to_string(),
"https://api.zebedee.io/v0/process-static-charges/8d648ac7-09f6-400c-8479-d05ac4d9d61d?amount=314"
);
}
}

0 comments on commit 64d1c04

Please sign in to comment.