Skip to content

Commit

Permalink
feat(forc): add "organization" field in forc manifest (FuelLabs#631)
Browse files Browse the repository at this point in the history
* feat: add "organization" field in forc manifest

* feat: make organization field optional in Forc.toml manifest

* test: don't put organization field in default Forc.toml file
  • Loading branch information
iqdecay authored Jan 16, 2022
1 parent 18092db commit 34e5b7e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion forc/src/utils/defaults.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ license = "Apache-2.0"
core = {{ git = "http://github.com/FuelLabs/sway-lib-core" }}
std = {{ git = "http://github.com/FuelLabs/sway-lib-std" }}
"#,
project_name, real_name,
project_name, real_name
)
}

Expand Down
4 changes: 4 additions & 0 deletions forc/src/utils/manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ fn construct_output_from_input((idx, input): (usize, &fuel_tx::Input)) -> Option
_ => None,
}
}

/// This struct exists and is converted into a [fuel_tx::Input] because of limitations
/// of our toml library. It doesn't support directly deserializing [fuel_tx::Input].
///
Expand Down Expand Up @@ -90,6 +91,7 @@ fn try_parse_bytes32(raw: &Option<String>, name: &str) -> Result<fuel_tx::Bytes3
)
.unwrap())
}

fn try_parse_contract_id(raw: &Option<String>) -> Result<fuel_tx::ContractId, String> {
let mut raw = if let Some(raw) = raw {
raw.to_string()
Expand All @@ -111,6 +113,7 @@ fn try_parse_contract_id(raw: &Option<String>) -> Result<fuel_tx::ContractId, St
)
.unwrap())
}

impl TxInput {
pub fn to_input(&self) -> Result<fuel_tx::Input, String> {
match self.r#type.to_lowercase().as_ref() {
Expand All @@ -134,6 +137,7 @@ impl TxInput {
pub struct Project {
pub author: String,
pub name: String,
pub organization: Option<String>,
pub license: String,
#[serde(default = "default_entry")]
pub entry: String,
Expand Down

0 comments on commit 34e5b7e

Please sign in to comment.