mirror of
https://github.com/aljazceru/cdk.git
synced 2025-12-24 08:05:02 +01:00
feat(wallet): token v4
feat(wallet): receive is single mint and unit
This commit is contained in:
committed by
thesimplekid
parent
4637b050d6
commit
22e7c41491
@@ -127,7 +127,7 @@ async fn receive_token(
|
||||
preimage: &[String],
|
||||
) -> Result<Amount> {
|
||||
let token = Token::from_str(token_str)?;
|
||||
let mint_url = token.token.first().unwrap().mint.clone();
|
||||
let mint_url = token.proofs().iter().next().unwrap().0.clone();
|
||||
|
||||
let wallet = match wallets.get(&mint_url) {
|
||||
Some(wallet) => wallet.clone(),
|
||||
|
||||
@@ -5,7 +5,7 @@ use std::str::FromStr;
|
||||
|
||||
use anyhow::{bail, Result};
|
||||
use cdk::amount::SplitTarget;
|
||||
use cdk::nuts::{Conditions, PublicKey, SpendingConditions};
|
||||
use cdk::nuts::{Conditions, PublicKey, SpendingConditions, Token};
|
||||
use cdk::wallet::Wallet;
|
||||
use cdk::{Amount, UncheckedUrl};
|
||||
use clap::Args;
|
||||
@@ -32,6 +32,9 @@ pub struct SendSubCommand {
|
||||
/// Refund keys that can be used after locktime
|
||||
#[arg(long, action = clap::ArgAction::Append)]
|
||||
refund_keys: Vec<String>,
|
||||
/// Token as V3 token
|
||||
#[arg(short, long)]
|
||||
v3: bool,
|
||||
}
|
||||
|
||||
pub async fn send(
|
||||
@@ -152,7 +155,16 @@ pub async fn send(
|
||||
)
|
||||
.await?;
|
||||
|
||||
println!("{}", token);
|
||||
match sub_command_args.v3 {
|
||||
true => {
|
||||
let token = Token::from_str(&token)?;
|
||||
|
||||
println!("{}", token.to_v3_string());
|
||||
}
|
||||
false => {
|
||||
println!("{}", token);
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user