Ok(Some(cbor)) } else if let Some(path) = json { let value: serde_json::Value = serde_json::from_reader(File::open(path)?).context("failed to parse JSON metadata")?; let mut cbor = Vec::new(); ciborium::into_writer(&value, &mut cbor)?; Ok(Some(cbor)) } else { Ok(None) } } fn get_parent_info( parent: Option, index: &Index, utxos: &BTreeMap, client: &Client, chain: Chain, ) -> Result> { if let Some(parent_id) = parent { if let Some(satpoint) = index.get_inscription_satpoint_by_id(parent_id)? { if !utxos.contains_key(&satpoint.outpoint) { return Err(anyhow!(format!("parent {parent_id} not in wallet"))); } Ok(Some(ParentInfo { destination: get_change_address(client, chain)?, id: parent_id, location: satpoint, tx_out: index .get_transaction(satpoint.outpoint.txid)? .expect("parent transaction not found in index")