File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change 4848- Implement ` ToNostrUri ` for ` Coordinate `
4949- Implement ` ToBech32 ` for ` CoordinateBorrow `
5050- Implement ` ToNostrUri ` for ` CoordinateBorrow `
51+ - Implement ` ToBech32 ` for ` Event `
52+ - Implement ` ToNostrUri ` for ` Event `
5153- Implement ` From<&Event> ` for ` Nip19Event `
5254- Add ` CowTag::kind ` and ` CowTag::content `
5355- Add ` Timestamp::as_secs `
Original file line number Diff line number Diff line change @@ -31,6 +31,8 @@ pub use self::kind::Kind;
3131pub use self :: tag:: { Tag , TagKind , TagStandard , Tags } ;
3232pub use self :: unsigned:: UnsignedEvent ;
3333use crate :: nips:: nip01:: CoordinateBorrow ;
34+ use crate :: nips:: nip19:: { self , Nip19Event , ToBech32 } ;
35+ use crate :: nips:: nip21:: ToNostrUri ;
3436#[ cfg( feature = "std" ) ]
3537use crate :: types:: time:: Instant ;
3638use crate :: types:: time:: TimeSupplier ;
@@ -294,6 +296,19 @@ impl JsonUtil for Event {
294296 }
295297}
296298
299+ impl ToBech32 for Event {
300+ type Err = nip19:: Error ;
301+
302+ fn to_bech32 ( & self ) -> Result < String , Self :: Err > {
303+ match self . coordinate ( ) {
304+ Some ( coordinate) => coordinate. to_bech32 ( ) ,
305+ None => Nip19Event :: from ( self ) . to_bech32 ( ) ,
306+ }
307+ }
308+ }
309+
310+ impl ToNostrUri for Event { }
311+
297312impl TryFrom < & Event > for Metadata {
298313 type Error = serde_json:: Error ;
299314
You can’t perform that action at this time.
0 commit comments