From fca1d193a46eba17255b5372adffac2396e48c04 Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Fri, 19 Jul 2024 20:47:30 +0100 Subject: feat(send): add relay hints to link to proposal which is displayed at the end of the functon --- src/repo_ref.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/repo_ref.rs') diff --git a/src/repo_ref.rs b/src/repo_ref.rs index 3e1fd22..5d754f2 100644 --- a/src/repo_ref.rs +++ b/src/repo_ref.rs @@ -191,6 +191,25 @@ impl RepoRef { } res } + + /// coordinates without relay hints + pub fn coordinate_with_hint(&self) -> Coordinate { + Coordinate { + kind: Kind::Custom(REPO_REF_KIND), + public_key: *self + .maintainers + .first() + .context("no maintainers in repo ref") + .unwrap(), + identifier: self.identifier.clone(), + relays: if let Some(relay) = self.relays.first() { + vec![relay.to_string()] + } else { + vec![] + }, + } + } + /// coordinates without relay hints pub fn coordinates_with_timestamps(&self) -> Vec<(Coordinate, Option)> { self.coordinates() -- cgit v1.2.3