Skip to content
This repository has been archived by the owner on May 7, 2024. It is now read-only.

Commit

Permalink
Bitworkr supports
Browse files Browse the repository at this point in the history
  • Loading branch information
aurexav committed Jan 15, 2024
1 parent 5c2f0a9 commit 14a68d6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
4 changes: 3 additions & 1 deletion src/electrumx/type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ pub struct Ft {
pub mint_amount: u64,
#[serde(rename = "$mint_bitworkc")]
pub mint_bitworkc: String,
#[serde(rename = "$mint_bitworkr")]
pub mint_bitworkr: Option<String>,
#[serde(rename = "$mint_height")]
pub mint_height: u64,
#[serde(rename = "$request_ticker")]
Expand All @@ -92,7 +94,7 @@ pub struct Ft {
pub subtype: String,
pub r#type: String,
}
#[derive(Clone, Debug, Deserialize)]
#[derive(Debug, Deserialize)]
pub struct Bitwork {
pub bitworkc: String,
pub bitworkr: Option<String>,
Expand Down
18 changes: 9 additions & 9 deletions src/engine/rust.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,7 @@ use bitcoin::{
use serde::Serialize;
// atomicalsir
use crate::{
electrumx::{
r#type::{Bitwork, Utxo},
Api, ElectrumX, ElectrumXBuilder,
},
electrumx::{r#type::Utxo, Api, ElectrumX, ElectrumXBuilder},
prelude::*,
util,
wallet::Wallet as RawWallet,
Expand Down Expand Up @@ -77,7 +74,8 @@ impl Miner {
let Data {
secp,
satsbyte,
bitwork,
bitworkc,
bitworkr,
additional_outputs,
reveal_script,
reveal_spend_info,
Expand Down Expand Up @@ -130,7 +128,7 @@ impl Miner {
tracing::info!("spawning thread {i} for sequence range {r:?}");

let secp = secp.clone();
let bitworkc = bitwork.bitworkc.clone();
let bitworkc = bitworkc.clone();
let funding_kp = wallet.funding.pair.tap_tweak(&secp, None).to_inner();
let funding_xpk = wallet.funding.x_only_public_key;
let input = commit_input.clone();
Expand Down Expand Up @@ -229,7 +227,7 @@ impl Miner {
// TODO: Move common code to a single function.
let reveal_hty = TapSighashType::SinglePlusAnyoneCanPay;
let reveal_lh = reveal_script.tapscript_leaf_hash();
let reveal_tx = if let Some(bitworkr) = bitwork.bitworkr {
let reveal_tx = if let Some(bitworkr) = bitworkr {
let psbt = Psbt::from_unsigned_tx(Transaction {
version: Version::ONE,
lock_time: LockTime::ZERO,
Expand Down Expand Up @@ -448,7 +446,8 @@ impl Miner {
Ok(Data {
secp,
satsbyte,
bitwork: ft.bitwork,
bitworkc: ft.mint_bitworkc,
bitworkr: ft.mint_bitworkr,
additional_outputs,
reveal_script,
reveal_spend_info,
Expand Down Expand Up @@ -596,7 +595,8 @@ pub struct Payload {
struct Data {
secp: Secp256k1<All>,
satsbyte: u64,
bitwork: Bitwork,
bitworkc: String,
bitworkr: Option<String>,
additional_outputs: Vec<TxOut>,
reveal_script: ScriptBuf,
reveal_spend_info: TaprootSpendInfo,
Expand Down

0 comments on commit 14a68d6

Please sign in to comment.