Skip to content

Commit

Permalink
Merge with rune changes
Browse files Browse the repository at this point in the history
  • Loading branch information
onchainguy-btc committed Dec 25, 2023
1 parent af7cc24 commit 996949c
Showing 1 changed file with 16 additions and 27 deletions.
43 changes: 16 additions & 27 deletions src/subcommand/wallet/send.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,23 @@ impl Send {
index.get_runic_outputs(&unspent_outputs.keys().cloned().collect::<Vec<OutPoint>>())?;

let satpoint = match self.outgoing {
Outgoing::Amount(amount) => match output {
OutputScript::OpReturn(_) => bail!("refusing to burn amount"),
OutputScript::PubKey(address) => {
Self::lock_non_cardinal_outputs(&client, &inscriptions, &runic_outputs, unspent_outputs)?;
let txid = Self::send_amount(&client, amount, address, self.fee_rate)?;
return Ok(Box::new(Output { transaction: txid }));
Outgoing::Amount(amount) => {
// let script = output.get_script(); // Replace with the actual method to get the Script from output

if output.is_op_return() {
bail!("refusing to burn amount");
}

let address = match chain.address_from_script(output.as_script()) {
Ok(addr) => addr,
Err(e) => {
bail!("failed to get address from script: {:?}", e);
}
};

Self::lock_non_cardinal_outputs(&client, &inscriptions, &runic_outputs, unspent_outputs)?;
let txid = Self::send_amount(&client, amount, address, self.fee_rate)?;
return Ok(Box::new(Output { transaction: txid }));
},
Outgoing::InscriptionId(id) => index
.get_inscription_satpoint_by_id(id)?
Expand Down Expand Up @@ -110,27 +120,6 @@ impl Send {

satpoint
}
Outgoing::InscriptionId(id) => index
.get_inscription_satpoint_by_id(id)?
.ok_or_else(|| anyhow!("Inscription {id} not found"))?,
Outgoing::Amount(amount) => {
// let script = output.get_script(); // Replace with the actual method to get the Script from output

if output.is_op_return() {
bail!("refusing to burn amount");
}

let address = match chain.address_from_script(output.as_script()) {
Ok(addr) => addr,
Err(e) => {
bail!("failed to get address from script: {:?}", e);
}
};

Self::lock_inscriptions(&client, inscriptions, runic_outputs, unspent_outputs)?;
let txid = Self::send_amount(&client, amount, address, self.fee_rate.n())?;
return Ok(Box::new(Output { transaction: txid }));
},
};

let change = [
Expand Down

0 comments on commit 996949c

Please sign in to comment.