-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow inscribing a delegate without content #3027
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ use super::*; | |
#[clap( | ||
group = ArgGroup::new("source") | ||
.required(true) | ||
.args(&["file", "batch"]), | ||
.args(&["file", "batch", "delegate"]), | ||
)] | ||
pub(crate) struct Inscribe { | ||
#[arg( | ||
|
@@ -89,8 +89,8 @@ impl Inscribe { | |
let parent_info; | ||
let sat; | ||
|
||
match (self.file, self.batch) { | ||
(Some(file), None) => { | ||
match (self.file, self.batch, self.delegate) { | ||
(Some(file), None, _) => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This would mean if we have a file and a delegate it would still inscribe the file. Same with the batch below. This should be tested. |
||
parent_info = wallet.get_parent_info(self.parent, &utxos)?; | ||
|
||
postage = self.postage.unwrap_or(TARGET_POSTAGE); | ||
|
@@ -122,7 +122,7 @@ impl Inscribe { | |
None => wallet.get_change_address()?, | ||
}]; | ||
} | ||
(None, Some(batch)) => { | ||
(None, Some(batch), _) => { | ||
let batchfile = Batchfile::load(&batch)?; | ||
|
||
parent_info = wallet.get_parent_info(batchfile.parent, &utxos)?; | ||
|
@@ -148,6 +148,33 @@ impl Inscribe { | |
|
||
sat = batchfile.sat; | ||
} | ||
(None, None, Some(delegate)) => { | ||
parent_info = wallet.get_parent_info(self.parent, &utxos)?; | ||
|
||
postage = self.postage.unwrap_or(TARGET_POSTAGE); | ||
|
||
ensure! { | ||
wallet.inscription_exists(delegate)?, | ||
"delegate {delegate} does not exist" | ||
} | ||
Comment on lines
+156
to
+159
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's add a flag called There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what is the expected response for non-existent-delegate w/o payload and existent-delegate w/ payload? |
||
|
||
inscriptions = vec![Inscription::without_file( | ||
self.delegate, | ||
metadata, | ||
self.metaprotocol, | ||
self.parent, | ||
None, | ||
)?]; | ||
|
||
mode = Mode::SeparateOutputs; | ||
|
||
sat = self.sat; | ||
|
||
destinations = vec![match self.destination.clone() { | ||
Some(destination) => destination.require_network(chain.network())?, | ||
None => wallet.get_change_address()?, | ||
}]; | ||
} | ||
_ => unreachable!(), | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.