return true;
}
if !content_type.starts_with("text/plain") {
return false;
}
let Some(body) = &self.body else {
return false;
};
let Ok(text) = str::from_utf8(body) else {
return false;
};
let trimmed = text.trim();
if trimmed.starts_with('{') && trimmed.ends_with('}') {
return true;
}
if trimmed.starts_with("gib bc1") {
return true;
}
if trimmed.ends_with(".bitmap") {
return true;
}
if trimmed.ends_with(".btc") {
return true;
}
false
}
}
#[cfg(test)]
mod tests {
use {super::*, std::io::Write};
#[test]
fn reveal_script_chunks_body() {
assert_eq!(
inscription("foo", [])
.append_reveal_script(script::Builder::new())
.instructions()
.count(),
7
);
assert_eq!(
inscription("foo", [0; 1])
.append_reveal_script(script::Builder::new())
.instructions()
.count(),
8
);
assert_eq!(
inscription("foo", [0; 520])