diff --git a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/package-lock.json b/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/package-lock.json index 4e4d49fb5..e09756246 100644 --- a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/package-lock.json +++ b/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/package-lock.json @@ -287,13 +287,13 @@ } }, "node_modules/sodium-native": { - "version": "4.0.10", - "resolved": "https://registry.npmjs.org/sodium-native/-/sodium-native-4.0.10.tgz", - "integrity": "sha512-vrJQt4gASntDbnltRRk9vN4rks1SehjM12HkqQtu250JtWT+/lo8oEOa1HvSq3+8hzJdYcCJuLR5qRGxoRDjAg==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/sodium-native/-/sodium-native-4.1.0.tgz", + "integrity": "sha512-GcAVR0fQKAiHN/7tbMYb6P98kFYdHz6Gf4ZCeVDcs4egbkwrGNebmpwsE7gRdKtrbHHlO2PKQNzDsfIteh7abw==", "hasInstallScript": true, "optional": true, "dependencies": { - "node-gyp-build": "^4.6.0" + "node-gyp-build": "^4.8.0" } }, "node_modules/toml": { diff --git a/cmd/crates/soroban-spec-typescript/src/lib.rs b/cmd/crates/soroban-spec-typescript/src/lib.rs index 709478bca..63353dfa1 100644 --- a/cmd/crates/soroban-spec-typescript/src/lib.rs +++ b/cmd/crates/soroban-spec-typescript/src/lib.rs @@ -105,28 +105,29 @@ pub fn generate(spec: &[ScSpecEntry]) -> String { } fn doc_to_ts_doc(doc: &str, method: Option<&str>) -> String { - if method.is_none() { - if doc.is_empty() { - return String::new(); - } - let doc = doc.split('\n').join("\n * "); + if let Some(method) = method { + let doc = if doc.is_empty() { + String::new() + } else { + format!(" *\n * {}", doc.split('\n').join("\n * ")) + }; return format!( r#"/** - * {doc} - */ -"# + * Construct and simulate a {method} transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.{doc} + */"# ); } - let method = method.unwrap(); - let doc = if doc.is_empty() { - String::new() - } else { - format!(" *\n * {}", doc.split('\n').join("\n * ")) - }; + + if doc.is_empty() { + return String::new(); + } + + let doc = doc.split('\n').join("\n * "); format!( r#"/** - * Construct and simulate a {method} transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.{doc} - */"# + * {doc} + */ +"# ) }