diff --git a/src/actions/simplicity/pset/create.rs b/src/actions/simplicity/pset/create.rs index 20bb4db..22b02ba 100644 --- a/src/actions/simplicity/pset/create.rs +++ b/src/actions/simplicity/pset/create.rs @@ -29,6 +29,9 @@ pub enum PsetCreateError { #[error("confidential addresses are not yet supported")] ConfidentialAddressNotSupported, + + #[error("invalid OP_RETURN hex data: {0}")] + OpReturnHexParse(String), } #[derive(Deserialize)] @@ -127,6 +130,16 @@ pub fn pset_create(inputs_json: &str, outputs_json: &str) -> Result elements::Script::new(), + x if x.starts_with("data:") => { + // OP_RETURN output: "data:HEXDATA" + let hex_data = &x[5..]; + let data = hex::decode(hex_data) + .map_err(|e| PsetCreateError::OpReturnHexParse(e.to_string()))?; + elements::script::Builder::new() + .push_opcode(elements::opcodes::all::OP_RETURN) + .push_slice(&data) + .into_script() + } x => { let addr = x.parse::
().map_err(PsetCreateError::AddressParse)?; if addr.is_blinded() {