Skip to content

Commit

Permalink
bindings: fix compilation issues
Browse files Browse the repository at this point in the history
Signed-off-by: Yuki Kishimoto <[email protected]>
  • Loading branch information
yukibtc committed Dec 16, 2024
1 parent 45f8ebf commit 184763b
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions bindings/nostr-sdk-ffi/src/protocol/event/tag/standard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@ impl TryFrom<TagStandard> for tag::TagStandard {
}),
TagStandard::Reference { reference } => Ok(Self::Reference(reference)),
TagStandard::RelayMetadataTag { relay_url, rw } => Ok(Self::RelayMetadata {
relay_url: RelayUrl::parse(relay_url)?,
relay_url: RelayUrl::parse(&relay_url)?,
metadata: rw.map(|rw| rw.into()),
}),
TagStandard::Hashtag { hashtag } => Ok(Self::Hashtag(hashtag)),
Expand Down Expand Up @@ -632,7 +632,7 @@ impl TryFrom<TagStandard> for tag::TagStandard {
kind: kind.into(),
uppercase,
}),
TagStandard::RelayUrl { relay_url } => Ok(Self::Relay(RelayUrl::parse(relay_url)?)),
TagStandard::RelayUrl { relay_url } => Ok(Self::Relay(RelayUrl::parse(&relay_url)?)),
TagStandard::POW { nonce, difficulty } => Ok(Self::POW {
nonce: nonce.parse()?,
difficulty,
Expand Down
2 changes: 1 addition & 1 deletion bindings/nostr-sdk-ffi/src/protocol/nips/nip01.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ impl Coordinate {
// TODO: propagate error
relays: relays
.into_iter()
.filter_map(|u| RelayUrl::parse(u).ok())
.filter_map(|u| RelayUrl::parse(&u).ok())
.collect(),
},
}
Expand Down
6 changes: 3 additions & 3 deletions bindings/nostr-sdk-ffi/src/protocol/nips/nip53.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ impl TryFrom<LiveEventHost> for nip53::LiveEventHost {
Ok(Self {
public_key: **value.public_key,
relay_url: match value.relay_url {
Some(url) => Some(RelayUrl::parse(url)?),
Some(url) => Some(RelayUrl::parse(&url)?),
None => None,
},
proof: match value.proof {
Expand Down Expand Up @@ -169,12 +169,12 @@ impl TryFrom<LiveEvent> for nip53::LiveEvent {
speakers: value
.speakers
.into_iter()
.map(|s| (**s.public_key, s.url.and_then(|u| RelayUrl::parse(u).ok())))
.map(|s| (**s.public_key, s.url.and_then(|u| RelayUrl::parse(&u).ok())))
.collect(),
participants: value
.participants
.into_iter()
.map(|s| (**s.public_key, s.url.and_then(|u| RelayUrl::parse(u).ok())))
.map(|s| (**s.public_key, s.url.and_then(|u| RelayUrl::parse(&u).ok())))
.collect(),
})
}
Expand Down
2 changes: 1 addition & 1 deletion bindings/nostr-sdk-ffi/src/protocol/types/contact.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ impl Contact {
#[uniffi::constructor(default(relay_url = None, alias = None))]
pub fn new(pk: &PublicKey, relay_url: Option<String>, alias: Option<String>) -> Result<Self> {
let relay_url = match relay_url {
Some(url) => Some(RelayUrl::parse(url)?),
Some(url) => Some(RelayUrl::parse(&url)?),
None => None,
};
Ok(Self {
Expand Down
2 changes: 1 addition & 1 deletion bindings/nostr-sdk-ffi/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub fn parse_optional_relay_url(relay_url: Option<String>) -> Result<Option<Rela
return Ok(None);
}

Ok(Some(RelayUrl::parse(url)?))
Ok(Some(RelayUrl::parse(&url)?))
}
None => Ok(None),
}
Expand Down
6 changes: 3 additions & 3 deletions bindings/nostr-sdk-js/src/protocol/event/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ impl JsEventBuilder {
pub fn relay_list(relays: Vec<JsRelayListItem>) -> Result<JsEventBuilder> {
let mut list = Vec::with_capacity(relays.len());
for JsRelayListItem { url, metadata } in relays.into_iter() {
let relay_url: RelayUrl = RelayUrl::parse(url).map_err(into_err)?;
let relay_url: RelayUrl = RelayUrl::parse(&url).map_err(into_err)?;
let metadata = metadata.map(|m| m.into());
list.push((relay_url, metadata))
}
Expand Down Expand Up @@ -722,7 +722,7 @@ impl JsEventBuilder {
// TODO: return error if invalid url
Self {
inner: EventBuilder::search_relays(
relays.into_iter().filter_map(|u| RelayUrl::parse(u).ok()),
relays.into_iter().filter_map(|u| RelayUrl::parse(&u).ok()),
),
}
}
Expand Down Expand Up @@ -766,7 +766,7 @@ impl JsEventBuilder {
Self {
inner: EventBuilder::relay_set(
identifier,
relays.into_iter().filter_map(|u| RelayUrl::parse(u).ok()),
relays.into_iter().filter_map(|u| RelayUrl::parse(&u).ok()),
),
}
}
Expand Down
2 changes: 1 addition & 1 deletion bindings/nostr-sdk-js/src/protocol/nips/nip01.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ impl JsCoordinate {
relays: relays
.unwrap_or_default()
.into_iter()
.filter_map(|u| RelayUrl::parse(u).ok())
.filter_map(|u| RelayUrl::parse(&u).ok())
.collect(),
},
}
Expand Down
2 changes: 1 addition & 1 deletion bindings/nostr-sdk-js/src/protocol/types/contact.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ impl JsContact {
alias: Option<String>,
) -> Result<JsContact> {
let relay_url = match relay_url {
Some(url) => Some(RelayUrl::parse(url).map_err(into_err)?),
Some(url) => Some(RelayUrl::parse(&url).map_err(into_err)?),
None => None,
};
Ok(Self {
Expand Down
2 changes: 1 addition & 1 deletion bindings/nostr-sdk-js/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub fn parse_optional_relay_url(relay_url: Option<String>) -> Result<Option<Rela
return Ok(None);
}

Ok(Some(RelayUrl::parse(url).map_err(into_err)?))
Ok(Some(RelayUrl::parse(&url).map_err(into_err)?))
}
None => Ok(None),
}
Expand Down

0 comments on commit 184763b

Please sign in to comment.