-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1518 from multiversx/fix-proxy
Fix proxy
- Loading branch information
Showing
15 changed files
with
649 additions
and
598 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,4 @@ | ||
pub mod proxy_crate_gen; | ||
pub mod proxy_gen_main; | ||
pub mod proxy_gen_struct_enum; | ||
mod proxy_generator; | ||
mod proxy_naming; | ||
pub mod proxy_sc_functions_gen; | ||
pub mod proxy_template_gen; |
38 changes: 10 additions & 28 deletions
38
framework/meta/src/cmd/contract/generate_proxy/proxy_gen_main.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,21 @@ | ||
use std::fs::File; | ||
|
||
use multiversx_sc::abi::ContractAbi; | ||
|
||
use super::{ | ||
super::meta_config::MetaConfig, | ||
proxy_crate_gen::create_file, | ||
proxy_gen_struct_enum::write_types, | ||
proxy_sc_functions_gen::write_content, | ||
proxy_template_gen::{ | ||
write_header, write_impl_for_tx_proxy, write_struct_tx_proxy_methods, | ||
write_tx_proxy_type_def, | ||
}, | ||
super::meta_config::MetaConfig, proxy_crate_gen::create_file, proxy_generator::ProxyGenerator, | ||
}; | ||
|
||
const OUTPUT_PROXY_PATH: &str = "/output/proxy.rs"; | ||
|
||
impl MetaConfig { | ||
pub fn generate_proxy(&self) { | ||
write_proxy_with_explicit_path(OUTPUT_PROXY_PATH, &self.original_contract_abi); | ||
for path in &self.sc_config.proxy_paths { | ||
write_proxy_with_explicit_path(path, &self.original_contract_abi); | ||
pub fn generate_proxy(&mut self) { | ||
write_proxy_with_explicit_path(OUTPUT_PROXY_PATH, self); | ||
let proxy_paths = self.sc_config.proxy_paths.clone(); | ||
for path in proxy_paths { | ||
write_proxy_with_explicit_path(&path, self); | ||
} | ||
} | ||
} | ||
|
||
fn write_proxy_with_explicit_path(path: &str, abi: &ContractAbi) { | ||
let file = create_file(path); | ||
write_proxy_to_file(file, abi); | ||
} | ||
|
||
fn write_proxy_to_file(mut file: File, abi: &ContractAbi) { | ||
write_header(&mut file); | ||
write_tx_proxy_type_def(&mut file, &abi.name); | ||
write_impl_for_tx_proxy(&mut file, &abi.name); | ||
write_struct_tx_proxy_methods(&mut file, &abi.name); | ||
write_content(&mut file, abi.clone()); | ||
write_types(&mut file, &abi.type_descriptions); | ||
fn write_proxy_with_explicit_path(path: &str, meta_config: &mut MetaConfig) { | ||
let mut file = create_file(path); | ||
let mut proxy_generator = ProxyGenerator::new(meta_config, &mut file); | ||
proxy_generator.write_proxy_to_file(); | ||
} |
135 changes: 0 additions & 135 deletions
135
framework/meta/src/cmd/contract/generate_proxy/proxy_gen_struct_enum.rs
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.