Skip to content

Commit

Permalink
Add etching to example batchfile (#3407)
Browse files Browse the repository at this point in the history
  • Loading branch information
casey committed Mar 29, 2024
1 parent fb6a2b2 commit 23fdd59
Show file tree
Hide file tree
Showing 3 changed files with 117 additions and 8 deletions.
31 changes: 29 additions & 2 deletions batch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,33 @@ reinscribe: true
# sat to inscribe on, can only be used with `same-sat`:
# sat: 5000000000

# rune to etch (optional)
etching:
# rune name
rune: THE•BEST•RUNE
# allow subdividing super-unit into `10^divisibility` sub-units
divisibility: 2
# premine
premine: 1000.00
# total supply, must be equal to `premine + terms.cap * terms.amount`
supply: 10000.00
# currency symbol
symbol: $
# mint terms (optional)
terms:
# amount per mint
amount: 100.00
# maximum number of mints
cap: 90
# mint start and end absolute block height (optional)
height:
start: 840000
end: 850000
# mint start and end block height relative to etching height (optional)
offset:
start: 1000
end: 9000

# inscriptions to inscribe
inscriptions:
# path to inscription content
Expand All @@ -36,10 +63,10 @@ inscriptions:
metus est et odio. Nullam venenatis, urna et molestie vestibulum, orci
mi efficitur risus, eu malesuada diam lorem sed velit. Nam fermentum
dolor et luctus euismod.
# inscription metaprotocol (optional)
metaprotocol: DOPEPROTOCOL-42069
- file: token.json
# inscription metaprotocol (optional)
metaprotocol: DOPEPROTOCOL-42069

- file: tulip.png
destination: bc1pdqrcrxa8vx6gy75mfdfj84puhxffh4fq46h3gkp6jxdd0vjcsdyspfxcv6
Expand Down
5 changes: 0 additions & 5 deletions src/subcommand/wallet/batch_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,9 +250,4 @@ inscriptions:
.to_string()
.contains("unknown field `unknown`"));
}

#[test]
fn example_batchfile_deserializes_successfully() {
batch::File::load(Path::new("batch.yaml")).unwrap();
}
}
89 changes: 88 additions & 1 deletion src/wallet/batch/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ impl File {

#[cfg(test)]
mod tests {
use super::*;
use {super::*, pretty_assertions::assert_eq};

#[test]
fn batchfile_not_sat_and_satpoint() {
Expand Down Expand Up @@ -359,4 +359,91 @@ inscriptions:
"duplicate satpoint bc4c30829a9564c0d58e6287195622b53ced54a25711d1b86be7cd3a70ef61ed:0:0"
);
}

#[test]
fn example_batchfile_deserializes_successfully() {
assert_eq!(
batch::File::load(Path::new("batch.yaml")).unwrap(),
batch::File {
mode: batch::Mode::SeparateOutputs,
parent: Some(
"6ac5cacb768794f4fd7a78bf00f2074891fce68bd65c4ff36e77177237aacacai0"
.parse()
.unwrap()
),
postage: Some(12345),
reinscribe: true,
sat: None,
satpoint: None,
etching: Some(Etching {
rune: "THE•BEST•RUNE".parse().unwrap(),
divisibility: 2,
premine: "1000.00".parse().unwrap(),
supply: "10000.00".parse().unwrap(),
symbol: '$',
terms: Some(batch::Terms {
amount: "100.00".parse().unwrap(),
cap: 90,
height: Some(batch::Range {
start: Some(840000),
end: Some(850000),
}),
offset: Some(batch::Range {
start: Some(1000),
end: Some(9000),
}),
}),
}),
inscriptions: vec![
batch::Entry {
file: "mango.avif".into(),
delegate: Some(
"6ac5cacb768794f4fd7a78bf00f2074891fce68bd65c4ff36e77177237aacacai0"
.parse()
.unwrap()
),
destination: Some(
"bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4"
.parse()
.unwrap()
),
metadata: Some(serde_yaml::Value::Mapping({
let mut mapping = serde_yaml::Mapping::new();
mapping.insert("title".into(), "Delicious Mangos".into());
mapping.insert(
"description".into(),
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam semper, \
ligula ornare laoreet tincidunt, odio nisi euismod tortor, vel blandit \
metus est et odio. Nullam venenatis, urna et molestie vestibulum, orci \
mi efficitur risus, eu malesuada diam lorem sed velit. Nam fermentum \
dolor et luctus euismod.\n"
.into(),
);
mapping
})),
..default()
},
batch::Entry {
file: "token.json".into(),
metaprotocol: Some("DOPEPROTOCOL-42069".into()),
..default()
},
batch::Entry {
file: "tulip.png".into(),
destination: Some(
"bc1pdqrcrxa8vx6gy75mfdfj84puhxffh4fq46h3gkp6jxdd0vjcsdyspfxcv6"
.parse()
.unwrap()
),
metadata: Some(serde_yaml::Value::Mapping({
let mut mapping = serde_yaml::Mapping::new();
mapping.insert("author".into(), "Satoshi Nakamoto".into());
mapping
})),
..default()
},
],
}
);
}
}

0 comments on commit 23fdd59

Please sign in to comment.