@@ -215,21 +215,39 @@ impl CompileCmd {
215
215
out_dir. display( )
216
216
) ;
217
217
218
- {
219
- println ! ( "[info ] Patching cosmos.staking.v1beta1.rs..." ) ;
218
+ const PATCHES : & [ ( & str , & [ ( & str , & str ) ] ) ] = & [
219
+ (
220
+ "cosmos.staking.v1beta1.rs" ,
221
+ & [
222
+ ( "pub struct Validators" , "pub struct ValidatorsVec" ) ,
223
+ ( "AllowList(Validators)" , "AllowList(ValidatorsVec)" ) ,
224
+ ( "DenyList(Validators)" , "DenyList(ValidatorsVec)" ) ,
225
+ ] ,
226
+ ) ,
227
+ (
228
+ "ibc.applications.transfer.v1.rs" ,
229
+ & [ (
230
+ "The denomination trace (\\ [port_id]/[channel_id])+/[denom\\ ]" ,
231
+ "The denomination trace `(\\ [port_id]/[channel_id])+/[denom\\ ]`" ,
232
+ ) ] ,
233
+ ) ,
234
+ ] ;
235
+
236
+ for ( file, patches) in PATCHES {
237
+ println ! ( "[info ] Patching {file}..." ) ;
220
238
221
- let path = out_dir. join ( "cosmos.staking.v1beta1.rs" ) ;
222
- let contents = std:: fs:: read_to_string ( & path) ?;
239
+ let path = out_dir. join ( file) ;
240
+ let original = std:: fs:: read_to_string ( & path) ?;
241
+ let mut patched = original. clone ( ) ;
223
242
224
- let patched_contents = contents
225
- . replace ( "pub struct Validators" , "pub struct ValidatorsVec" )
226
- . replace ( "AllowList(Validators)" , "AllowList(ValidatorsVec)" )
227
- . replace ( "DenyList(Validators)" , "DenyList(ValidatorsVec)" ) ;
243
+ for ( before, after) in patches. iter ( ) {
244
+ patched = patched. replace ( before, after) ;
245
+ }
228
246
229
- let diff = TextDiff :: from_lines ( & contents , & patched_contents ) ;
247
+ let diff = TextDiff :: from_lines ( & original , & patched ) ;
230
248
println ! ( "{}" , diff. unified_diff( ) . context_radius( 3 ) ) ;
231
249
232
- std:: fs:: write ( & path, patched_contents ) ?;
250
+ std:: fs:: write ( & path, patched ) ?;
233
251
}
234
252
235
253
Ok ( ( ) )
0 commit comments