Skip to content

Commit

Permalink
Inscribe with parent (#2388)
Browse files Browse the repository at this point in the history
  • Loading branch information
raphjaph authored Sep 6, 2023
1 parent 44f8b2a commit 04bc261
Show file tree
Hide file tree
Showing 13 changed files with 459 additions and 151 deletions.
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ mime = "0.3.16"
mime_guess = "2.0.4"
miniscript = "10.0.0"
mp4 = "0.14.0"
ord-bitcoincore-rpc = "0.17.0"
ord-bitcoincore-rpc = "0.17.1"
redb = "1.0.5"
regex = "1.6.0"
rss = "2.0.1"
Expand Down
2 changes: 1 addition & 1 deletion src/fee_rate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ impl TryFrom<f64> for FeeRate {
}

impl FeeRate {
pub(crate) fn fee(&self, vsize: usize) -> Amount {
pub fn fee(&self, vsize: usize) -> Amount {
#[allow(clippy::cast_possible_truncation)]
#[allow(clippy::cast_sign_loss)]
Amount::from_sat((self.0 * vsize as f64).round() as u64)
Expand Down
10 changes: 7 additions & 3 deletions src/inscription.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,11 @@ impl Inscription {
result
}

pub(crate) fn from_file(chain: Chain, path: impl AsRef<Path>) -> Result<Self, Error> {
pub(crate) fn from_file(
chain: Chain,
path: impl AsRef<Path>,
parent: Option<InscriptionId>,
) -> Result<Self, Error> {
let path = path.as_ref();

let body = fs::read(path).with_context(|| format!("io error reading {}", path.display()))?;
Expand All @@ -90,7 +94,7 @@ impl Inscription {
Ok(Self {
body: Some(body),
content_type: Some(content_type.into()),
parent: None,
parent: parent.map(|id| id.parent_value()),
unrecognized_even_field: false,
})
}
Expand Down Expand Up @@ -830,8 +834,8 @@ mod tests {
Ok(vec![Inscription {
content_type: None,
body: None,
unrecognized_even_field: true,
parent: None,
unrecognized_even_field: true,
}]),
);
}
Expand Down
1 change: 0 additions & 1 deletion src/inscription_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ pub struct InscriptionId {
}

impl InscriptionId {
#[cfg(test)]
pub(crate) fn parent_value(self) -> Vec<u8> {
let index = self.index.to_le_bytes();
let mut index_slice = index.as_slice();
Expand Down
1 change: 1 addition & 0 deletions src/subcommand/preview.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ impl Preview {
dry_run: false,
no_limit: false,
destination: None,
parent: None,
postage: Some(TransactionBuilder::TARGET_POSTAGE),
},
)),
Expand Down
Loading

0 comments on commit 04bc261

Please sign in to comment.