Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 21 additions & 12 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 @@ -14,7 +14,7 @@ multiple_crate_versions = "allow"
[workspace.dependencies]
ring = "0.17.14"
hex = "0.4.3"
simplex = { git = "https://github.com/BlockstreamResearch/smplx.git", rev = "1a6f3bdaad58d243b4ac07b5ae57ec11a7f2c7fa", package = "smplx-std" }
smplx-std = "0.0.4"
sha2 = { version = "0.10.9", features = ["compress"] }
serde = { version = "1.0.228", features = ["derive"]}
thiserror = { version = "2.0.18" }
Expand Down
2 changes: 1 addition & 1 deletion crates/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ workspace = true
thiserror = { workspace = true }
hex = { workspace = true }
serde = { workspace = true }
simplex = { workspace = true }
smplx-std = { workspace = true }

anyhow = "1"
dotenvy = "0.15"
Expand Down
14 changes: 8 additions & 6 deletions crates/cli/src/commands/account/core.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use std::str::FromStr;

use clap::Subcommand;
use lending_contracts::transactions::core::SimplexInput;
use simplex::{
provider::ProviderTrait,
simplicityhl::elements::{Address, AssetId, OutPoint, hex::ToHex},
Expand All @@ -12,6 +11,7 @@ use crate::{cli::CliContext, commands::account::AccountCommandError};

#[derive(Debug, Subcommand)]
pub enum AccountCommand {
/// Send policy asset to another account
SendPolicyAsset {
/// Recipient address (Liquid testnet bech32m)
#[arg(long = "to-address")]
Expand All @@ -20,6 +20,7 @@ pub enum AccountCommand {
#[arg(long = "amount")]
amount: u64,
},
/// Send arbitrary asset to another account
SendAsset {
/// Recipient address (Liquid testnet bech32m)
#[arg(long = "to-address")]
Expand All @@ -31,6 +32,7 @@ pub enum AccountCommand {
#[arg(long = "amount")]
amount: u64,
},
/// Split specific UTXO to different parts
SplitUTXO {
/// UTXO to split
#[arg(long = "outpoint")]
Expand All @@ -39,7 +41,9 @@ pub enum AccountCommand {
#[arg(long = "amounts", value_delimiter = ',', num_args = 1..)]
amounts: Vec<u64>,
},
/// Show current account info
ShowAccountInfo,
/// Show account UTXOs
ShowAccountUTXOS,
}

Expand Down Expand Up @@ -96,10 +100,8 @@ impl Account {
let mut total_inputs_amount = 0;

for utxo in asset_utxos {
let input = SimplexInput::new(&utxo, RequiredSignature::NativeEcdsa);

total_inputs_amount += input.explicit_amount();
inputs.push(input);
total_inputs_amount += utxo.explicit_amount();
inputs.push((utxo, RequiredSignature::NativeEcdsa));

if total_inputs_amount >= amount {
break;
Expand All @@ -117,7 +119,7 @@ impl Account {
let mut ft = FinalTransaction::new();

for input in inputs {
ft.add_input(input.partial_input().clone(), input.required_sig().clone());
ft.add_input(PartialInput::new(input.0), input.1);
}

ft.add_output(PartialOutput::new(
Expand Down
4 changes: 4 additions & 0 deletions crates/cli/src/commands/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,22 @@ use crate::commands::{

#[derive(Debug, Subcommand)]
pub enum Command {
/// Account helper commands
Account {
#[command(subcommand)]
command: AccountCommand,
},
/// Lending offer related commands
Lending {
#[command(subcommand)]
command: LendingCommand,
},
/// Offer creation commands
PreLock {
#[command(subcommand)]
command: PreLockCommand,
},
/// Utility steps related commands
Utility {
#[command(subcommand)]
command: UtilityCommand,
Expand Down
Loading
Loading