22
33use std:: sync:: Arc ;
44
5- use anyhow:: { anyhow, Result } ;
65use c509_certificate:: {
76 extensions:: { alt_name:: GeneralNamesOrText , extension:: ExtensionValue } ,
87 general_names:: general_name:: { GeneralNameTypeRegistry , GeneralNameValue } ,
98 C509ExtensionType ,
109} ;
1110use der_parser:: der:: parse_der_sequence;
12- use pallas:: ledger:: traverse:: MultiEraTx ;
1311use tracing:: debug;
1412use x509_cert:: der:: { oid:: db:: rfc5912:: ID_CE_SUBJECT_ALT_NAME , Decode } ;
1513
@@ -38,19 +36,13 @@ pub struct Cip0134UriList {
3836
3937impl Cip0134UriList {
4038 /// Creates a new `Cip0134UriList` instance from the given `Cip509`.
41- ///
42- /// # Errors
43- /// - Unsupported transaction era.
44- pub fn new ( cip509 : & Cip509 , tx : & MultiEraTx ) -> Result < Self > {
45- if !matches ! ( tx, MultiEraTx :: Conway ( _) ) {
46- return Err ( anyhow ! ( "Unsupported transaction era ({})" , tx. era( ) ) ) ;
47- }
48-
39+ #[ must_use]
40+ pub fn new ( cip509 : & Cip509 ) -> Self {
4941 let metadata = & cip509. x509_chunks . 0 ;
5042 let mut uris = process_x509_certificates ( metadata) ;
5143 uris. extend ( process_c509_certificates ( metadata) ) ;
5244
53- Ok ( Self { uris : uris. into ( ) } )
45+ Self { uris : uris. into ( ) }
5446 }
5547
5648 /// Returns an iterator over the contained Cip0134 URIs.
@@ -183,7 +175,7 @@ mod tests {
183175 codec:: utils:: Nullable ,
184176 ledger:: {
185177 addresses:: { Address , Network } ,
186- traverse:: MultiEraBlock ,
178+ traverse:: { MultiEraBlock , MultiEraTx } ,
187179 } ,
188180 } ;
189181
@@ -202,7 +194,7 @@ mod tests {
202194 let tx = & block. txs ( ) [ 3 ] ;
203195 let cip509 = cip509 ( tx) ;
204196
205- let list = Cip0134UriList :: new ( & cip509, tx ) . unwrap ( ) ;
197+ let list = Cip0134UriList :: new ( & cip509) ;
206198 assert_eq ! ( list. as_slice( ) . len( ) , 1 ) ;
207199 // cSpell:disable
208200 assert_eq ! (
0 commit comments