@@ -11,12 +11,12 @@ fn default_version() -> soroban_sdk::String {
1111 to_string ( "0.0.0" )
1212}
1313
14- stellar_registry:: import_contract_client!( stellar_registry_contract ) ;
14+ stellar_registry:: import_contract_client!( registry ) ;
1515// Equivalent to:
1616
17- // mod stellar_registry_contract {
17+ // mod registry {
1818// use super::soroban_sdk;
19- // soroban_sdk::contractimport!(file = "../../../../target/stellar/stellar_registry_contract .wasm");
19+ // soroban_sdk::contractimport!(file = "../../../../target/stellar/registry .wasm");
2020// }
2121
2222fn init ( ) -> ( SorobanContractClient < ' static > , Address ) {
@@ -26,11 +26,7 @@ fn init() -> (SorobanContractClient<'static>, Address) {
2626 let address = Address :: generate ( env) ;
2727 let client = SorobanContractClient :: new (
2828 env,
29- & env. register_at (
30- & contract_id,
31- stellar_registry_contract:: WASM ,
32- ( address. clone ( ) , ) ,
33- ) ,
29+ & env. register_at ( & contract_id, registry:: WASM , ( address. clone ( ) , ) ) ,
3430 ) ;
3531 ( client, address)
3632}
@@ -46,16 +42,14 @@ fn handle_error_cases() {
4642 Ok ( Error :: NoSuchContractPublished )
4743 ) ;
4844
49- let wasm_hash = env
50- . deployer ( )
51- . upload_contract_wasm ( stellar_registry_contract:: WASM ) ;
45+ let wasm_hash = env. deployer ( ) . upload_contract_wasm ( registry:: WASM ) ;
5246
5347 assert_matches ! (
5448 client. try_fetch_hash( name, & None ) . unwrap_err( ) ,
5549 Ok ( Error :: NoSuchContractPublished )
5650 ) ;
5751
58- let bytes = Bytes :: from_slice ( env, stellar_registry_contract :: WASM ) ;
52+ let bytes = Bytes :: from_slice ( env, registry :: WASM ) ;
5953 env. mock_all_auths ( ) ;
6054 let version = default_version ( ) ;
6155 client. publish ( name, address, & bytes, & version) ;
@@ -81,14 +75,12 @@ fn returns_most_recent_version() {
8175 let env = env ( ) ;
8276 let name = & to_string ( "publisher" ) ;
8377 // client.register_name(address, name);
84- let bytes = Bytes :: from_slice ( env, stellar_registry_contract :: WASM ) ;
78+ let bytes = Bytes :: from_slice ( env, registry :: WASM ) ;
8579 env. mock_all_auths ( ) ;
8680 let version = default_version ( ) ;
8781 client. publish ( name, address, & bytes, & version) ;
8882 let fetched_hash = client. fetch_hash ( name, & None ) ;
89- let wasm_hash = env
90- . deployer ( )
91- . upload_contract_wasm ( stellar_registry_contract:: WASM ) ;
83+ let wasm_hash = env. deployer ( ) . upload_contract_wasm ( registry:: WASM ) ;
9284 assert_eq ! ( fetched_hash, wasm_hash) ;
9385
9486 let second_hash: BytesN < 32 > = BytesN :: random ( env) ;
@@ -137,16 +129,21 @@ fn validate_version() {
137129 let ( client, address) = & init ( ) ;
138130 let env = env ( ) ;
139131 let name = & to_string ( "registry" ) ;
140- let bytes = Bytes :: from_slice ( env, stellar_registry_contract :: WASM ) ;
132+ let bytes = Bytes :: from_slice ( env, registry :: WASM ) ;
141133 env. mock_all_auths ( ) ;
142134 let version = default_version ( ) ;
143135 client. publish ( name, address, & bytes, & version) ;
144136 assert_eq ! (
145- client. try_publish( name, address, & bytes, & to_string ( "0.0.0" ) , ) ,
137+ client. try_publish( name, address, & bytes, & version ) ,
146138 Err ( Ok ( Error :: VersionMustBeGreaterThanCurrent ) )
147139 ) ;
148140 assert_eq ! (
149141 client. try_publish( name, address, & bytes, & to_string( "0. 0.0" ) , ) ,
150142 Err ( Ok ( Error :: InvalidVersion ) )
151143 ) ;
144+ client. publish ( name, address, & bytes, & to_string ( "0.0.1" ) ) ;
145+ assert_eq ! (
146+ client. try_publish( name, address, & bytes, & version) ,
147+ Err ( Ok ( Error :: VersionMustBeGreaterThanCurrent ) )
148+ ) ;
152149}
0 commit comments