meta: fixing the clippy warnings
Nothing interested, I did just what the compiler tell me to do. Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
This commit is contained in:
parent
0c99356261
commit
6809025d3b
|
@ -12,10 +12,9 @@ use clightningrpc_plugin::error;
|
|||
use clightningrpc_plugin::errors::PluginError;
|
||||
use clightningrpc_plugin::plugin::Plugin;
|
||||
|
||||
use rgb_common::bitcoin::psbt::Psbt;
|
||||
use rgb_common::bitcoin30;
|
||||
use rgb_common::core::ContractId;
|
||||
use rgb_common::lib::wallet::Balance;
|
||||
|
||||
use rgb_common::types::RgbInfo;
|
||||
|
||||
use crate::plugin::State;
|
||||
|
|
|
@ -35,6 +35,7 @@ pub struct RgbPaymentInfo {
|
|||
}
|
||||
|
||||
/// Get RgbPaymentInfo file
|
||||
#[allow(dead_code)]
|
||||
pub fn get_rgb_payment_info(payment_hash: &PaymentHash, ldk_data_dir: &PathBuf) -> RgbPaymentInfo {
|
||||
let rgb_payment_info_path = ldk_data_dir.join(hex::encode(payment_hash.0));
|
||||
parse_rgb_payment_info(&rgb_payment_info_path)
|
||||
|
@ -48,6 +49,7 @@ pub fn parse_rgb_payment_info(rgb_payment_info_path: &PathBuf) -> RgbPaymentInfo
|
|||
}
|
||||
|
||||
/// Get RgbInfo file
|
||||
#[allow(dead_code)]
|
||||
pub fn get_rgb_channel_info(
|
||||
channel_id: &[u8; 32],
|
||||
ldk_data_dir: &PathBuf,
|
||||
|
@ -59,12 +61,14 @@ pub fn get_rgb_channel_info(
|
|||
}
|
||||
|
||||
/// Write RgbInfo file
|
||||
#[allow(dead_code)]
|
||||
pub fn write_rgb_channel_info(path: &PathBuf, rgb_info: &RgbInfo) {
|
||||
let serialized_info = serde_json::to_string(&rgb_info).expect("valid rgb info");
|
||||
fs::write(path, serialized_info).expect("able to write")
|
||||
}
|
||||
|
||||
/// Rename RgbInfo file to channel_id
|
||||
#[allow(dead_code)]
|
||||
pub(crate) fn rename_rgbinfo_file(
|
||||
channel_id: &[u8; 32],
|
||||
temporary_channel_id: &[u8; 32],
|
||||
|
@ -76,6 +80,7 @@ pub(crate) fn rename_rgbinfo_file(
|
|||
}
|
||||
|
||||
/// Update RGB channel amount
|
||||
#[allow(dead_code)]
|
||||
pub(crate) fn update_rgb_channel_amount(
|
||||
channel_id: &[u8; 32],
|
||||
rgb_offered_htlc: u64,
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
//! RGB Wallet mock
|
||||
use std::collections::HashMap;
|
||||
use std::path::PathBuf;
|
||||
use std::str::FromStr;
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
@ -15,6 +14,7 @@ use crate::bitcoin::psbt::PartiallySignedTransaction;
|
|||
use crate::bitcoin::secp256k1::hashes::Hash;
|
||||
use crate::bitcoin::secp256k1::Secp256k1;
|
||||
use crate::bitcoin::Network;
|
||||
use crate::bitcoin::{ScriptBuf, TxOut};
|
||||
use crate::bitcoin30::psbt::PartiallySignedTransaction as RgbPsbt;
|
||||
use crate::core::contract::Operation;
|
||||
use crate::lib::utils::load_rgb_runtime;
|
||||
|
@ -24,7 +24,9 @@ use crate::rgb::persistence::Inventory;
|
|||
use crate::rgb::psbt::opret::OutputOpret;
|
||||
use crate::rgb::psbt::{PsbtDbc, RgbExt, RgbInExt};
|
||||
use crate::rgb_manager::STATIC_BLINDING;
|
||||
use crate::std::containers::BuilderSeal;
|
||||
use crate::std::contract::GraphSeal;
|
||||
use crate::std::interface::TypedState;
|
||||
use crate::types;
|
||||
use crate::types::RgbInfo;
|
||||
|
||||
|
@ -36,24 +38,20 @@ pub struct Wallet {
|
|||
}
|
||||
|
||||
impl Wallet {
|
||||
pub fn new(
|
||||
network: &BitcoinNetwork,
|
||||
xprv: ExtendedPrivKey,
|
||||
path: &str,
|
||||
) -> anyhow::Result<Self> {
|
||||
pub fn new(network: &Network, xprv: ExtendedPrivKey, path: &str) -> anyhow::Result<Self> {
|
||||
let btc_network = BitcoinNetwork::from_str(&network.to_string())?;
|
||||
// with rgb library tere is a new function for calculate the account key
|
||||
let account_privkey = Self::derive_account_xprv_from_mnemonic(network.clone(), &xprv)?;
|
||||
let account_privkey = Self::derive_account_xprv_from_mnemonic(btc_network, &xprv)?;
|
||||
let account_xpub = ExtendedPubKey::from_priv(&Secp256k1::new(), &account_privkey);
|
||||
let mut wallet = RgbWallet::new(WalletData {
|
||||
data_dir: path.to_owned(),
|
||||
bitcoin_network: network.clone(),
|
||||
bitcoin_network: btc_network,
|
||||
database_type: DatabaseType::Sqlite,
|
||||
max_allocations_per_utxo: 11,
|
||||
pubkey: account_xpub.to_string().to_owned(),
|
||||
mnemonic: None,
|
||||
vanilla_keychain: None,
|
||||
})?;
|
||||
let network = Network::from_str(&network.to_string())?;
|
||||
let url = match network {
|
||||
Network::Bitcoin => "https://mempool.space/api",
|
||||
Network::Testnet => "https://mempool.space/testnet/api",
|
||||
|
|
|
@ -18,6 +18,7 @@ const PROXY_TIMEOUT: u8 = 90;
|
|||
#[derive(Debug, Clone)]
|
||||
pub struct ConsignmentClient {
|
||||
inner: BlockingClient,
|
||||
#[allow(dead_code)]
|
||||
network: Network,
|
||||
pub url: String,
|
||||
}
|
||||
|
|
|
@ -3,13 +3,13 @@ use std::str::FromStr;
|
|||
use std::sync::Arc;
|
||||
|
||||
use bitcoin::bip32::ExtendedPrivKey;
|
||||
use bitcoin::Network;
|
||||
use rgb_lib::wallet::Balance;
|
||||
use rgb_lib::wallet::Recipient;
|
||||
use rgb_lib::wallet::RecipientData;
|
||||
use rgbwallet::bitcoin;
|
||||
|
||||
use crate::internal_wallet::Wallet;
|
||||
use crate::lib::BitcoinNetwork;
|
||||
use crate::proxy;
|
||||
use crate::rgb_storage as store;
|
||||
use crate::rgb_storage::RGBStorage;
|
||||
|
@ -24,6 +24,7 @@ pub struct RGBManager {
|
|||
consignment_proxy: Arc<proxy::ConsignmentClient>,
|
||||
storage: Box<dyn store::RGBStorage>,
|
||||
wallet: Arc<Wallet>,
|
||||
#[allow(dead_code)]
|
||||
path: String,
|
||||
}
|
||||
|
||||
|
@ -41,8 +42,8 @@ impl RGBManager {
|
|||
) -> anyhow::Result<Self> {
|
||||
let storage = Box::new(store::InMemoryStorage::new()?);
|
||||
let client = proxy::ConsignmentClient::new(network)?;
|
||||
let bitcoin_network = BitcoinNetwork::from_str(network)?;
|
||||
let wallet = Wallet::new(&bitcoin_network, *master_xprv, root_dir)?;
|
||||
let network = Network::from_str(network)?;
|
||||
let wallet = Wallet::new(&network, *master_xprv, root_dir)?;
|
||||
// FIXME: setting up the correct proxy client URL
|
||||
Ok(Self {
|
||||
consignment_proxy: Arc::new(client),
|
||||
|
|
|
@ -121,7 +121,7 @@ pub fn open_rgb_channel(
|
|||
serde_json::json!({
|
||||
"peer_id": getinfo2.id,
|
||||
"amount_msat": "all",
|
||||
"asset_id": "USTD",
|
||||
"asset_id": "Tether/USTD",
|
||||
}),
|
||||
)?;
|
||||
wait!(
|
||||
|
|
Loading…
Reference in New Issue