(
authorization: Authorization,
fee_authorization: Option<Authorization>,
program: &str,
proving_key: Option<ProvingKey>,
verifying_key: Option<VerifyingKey>,
| 313 | /// @param edition The program edition (defaults to 1). |
| 314 | #[wasm_bindgen(js_name = executeAuthorization)] |
| 315 | pub async fn execute_authorization( |
| 316 | authorization: Authorization, |
| 317 | fee_authorization: Option<Authorization>, |
| 318 | program: &str, |
| 319 | proving_key: Option<ProvingKey>, |
| 320 | verifying_key: Option<VerifyingKey>, |
| 321 | fee_proving_key: Option<ProvingKey>, |
| 322 | fee_verifying_key: Option<VerifyingKey>, |
| 323 | imports: Option<Object>, |
| 324 | url: Option<String>, |
| 325 | query: Option<QueryOption>, |
| 326 | program_imports: Option<ProgramImports>, |
| 327 | edition: Option<u16>, |
| 328 | ) -> Result<Transaction, String> { |
| 329 | // Default to edition 1: this path calls check_valid_edition (via |
| 330 | // execute_authorization_inner), which rejects edition 0 for |
| 331 | // non-constructor programs since ConsensusVersion::V8. |
| 332 | let edition = edition.unwrap_or(1); |
| 333 | let mut owned_process; |
| 334 | let program_native; |
| 335 | let mut inner_guard; |
| 336 | let process: &mut ProcessNative = match program_imports.as_ref() { |
| 337 | Some(pi) => { |
| 338 | let (native, guard) = pi.prepare_for_execution(program, edition)?; |
| 339 | program_native = native; |
| 340 | inner_guard = guard; |
| 341 | &mut inner_guard.process |
| 342 | } |
| 343 | None => { |
| 344 | owned_process = ProcessNative::load_web().map_err(|err| err.to_string())?; |
| 345 | program_native = ProgramNative::from_str(program).map_err(|e| e.to_string())?; |
| 346 | ProgramManager::resolve_imports(&mut owned_process, imports, Some(&program_native.id().to_string()))?; |
| 347 | &mut owned_process |
| 348 | } |
| 349 | }; |
| 350 | let transaction = Self::execute_authorization_inner( |
| 351 | process, |
| 352 | authorization, |
| 353 | fee_authorization, |
| 354 | proving_key, |
| 355 | verifying_key, |
| 356 | fee_proving_key, |
| 357 | fee_verifying_key, |
| 358 | url, |
| 359 | query, |
| 360 | edition, |
| 361 | program_native, |
| 362 | ) |
| 363 | .await?; |
| 364 | Ok(transaction) |
| 365 | } |
| 366 | |
| 367 | /// Generate an execution transaction without a proof. |
| 368 | /// Intended for use with the Leo devnode tool. |
nothing calls this directly
no test coverage detected