@layerzerolabs/stellar-ts-bindings-gen 1.2.16 → 1.2.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/src/main.rs +20 -24
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@layerzerolabs/stellar-ts-bindings-gen",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.17",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Generates TypeScript bindings from Stellar Soroban contract WASM files",
|
|
6
6
|
"license": "MIT",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"tsx": "^4.21.0",
|
|
12
|
-
"@layerzerolabs/vm-tooling-stellar": "1.2.
|
|
12
|
+
"@layerzerolabs/vm-tooling-stellar": "1.2.17"
|
|
13
13
|
},
|
|
14
14
|
"publishConfig": {
|
|
15
15
|
"access": "public",
|
package/src/main.rs
CHANGED
|
@@ -186,9 +186,23 @@ fn main() -> Result<()> {
|
|
|
186
186
|
config.contracts.len()
|
|
187
187
|
);
|
|
188
188
|
|
|
189
|
-
|
|
189
|
+
// Validate all WASM files exist before writing any outputs, so a missing
|
|
190
|
+
// contract cannot leave the output directory in a partial state.
|
|
191
|
+
let mut missing_wasm = Vec::new();
|
|
192
|
+
for entry in &config.contracts {
|
|
193
|
+
let wasm_path = wasm_base.join(format!("{}.wasm", entry.wasm_name));
|
|
194
|
+
if !wasm_path.exists() {
|
|
195
|
+
missing_wasm.push(format!(
|
|
196
|
+
"WASM file not found: {}\n Build the contract package first with `pnpm build`.",
|
|
197
|
+
wasm_path.display()
|
|
198
|
+
));
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
if !missing_wasm.is_empty() {
|
|
202
|
+
anyhow::bail!("{}", missing_wasm.join("\n"));
|
|
203
|
+
}
|
|
190
204
|
|
|
191
|
-
|
|
205
|
+
fs::create_dir_all(output_dir)?;
|
|
192
206
|
|
|
193
207
|
for entry in &config.contracts {
|
|
194
208
|
let wasm_path = wasm_base.join(format!("{}.wasm", entry.wasm_name));
|
|
@@ -198,16 +212,6 @@ fn main() -> Result<()> {
|
|
|
198
212
|
println!(" WASM: {}", wasm_path.display());
|
|
199
213
|
println!(" Output: {}", output_file.display());
|
|
200
214
|
|
|
201
|
-
if !wasm_path.exists() {
|
|
202
|
-
eprintln!(" WASM file not found: {}", wasm_path.display());
|
|
203
|
-
eprintln!(
|
|
204
|
-
" Skipping {}. Build the contract first with:",
|
|
205
|
-
entry.wasm_name
|
|
206
|
-
);
|
|
207
|
-
eprintln!(" stellar contract build -p {}\n", entry.wasm_name);
|
|
208
|
-
continue;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
215
|
let wasm_bytes = fs::read(&wasm_path)?;
|
|
212
216
|
println!(
|
|
213
217
|
" WASM size: {} bytes ({:.2} KB)",
|
|
@@ -227,23 +231,15 @@ fn main() -> Result<()> {
|
|
|
227
231
|
let complete_code = format!("{}{}{}", IMPORTS_HEADER, wasm_embed, ts_code);
|
|
228
232
|
fs::write(&output_file, &complete_code)?;
|
|
229
233
|
println!(" Generated: {}", output_file.display());
|
|
230
|
-
|
|
231
|
-
let module_name = entry.output_name.trim_end_matches(".ts");
|
|
232
|
-
generated.push(module_name.to_string());
|
|
233
234
|
}
|
|
234
235
|
|
|
235
236
|
println!(
|
|
236
237
|
"\nTypeScript binding generation complete! Generated {} contract(s) with embedded WASM",
|
|
237
|
-
|
|
238
|
+
config.contracts.len()
|
|
238
239
|
);
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
println!("
|
|
242
|
-
} else {
|
|
243
|
-
println!("\nGenerated files in {}:", output_dir.display());
|
|
244
|
-
for name in &generated {
|
|
245
|
-
println!(" - {}.ts", name);
|
|
246
|
-
}
|
|
240
|
+
println!("\nGenerated files in {}:", output_dir.display());
|
|
241
|
+
for entry in &config.contracts {
|
|
242
|
+
println!(" - {}", entry.output_name);
|
|
247
243
|
}
|
|
248
244
|
|
|
249
245
|
Ok(())
|