From ee5fcb49328ebefc1a5b9c04970a550700e55618 Mon Sep 17 00:00:00 2001 From: Sosthene00 <674694@protonmail.ch> Date: Wed, 17 Apr 2024 21:44:30 +0200 Subject: [PATCH] Update sp_backend to sp_client --- Cargo.toml | 2 +- src/daemon.rs | 8 ++++---- src/main.rs | 19 +++++++++---------- src/scan.rs | 12 ++++++------ 4 files changed, 20 insertions(+), 21 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index b81c47f..7513f6f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,7 +15,7 @@ sdk_common = { git = "https://git.4nkweb.com/4nk/sdk_common.git", branch = "demo serde = { version = "1.0.193", features = ["derive"]} serde_json = "1.0" serde_with = "3.6.0" -sp_backend = { git = "https://github.com/Sosthene00/sp-backend", branch = "sp_client" } +sp_client = { git = "https://github.com/Sosthene00/sp-client", branch = "sp_client" } tokio = { version = "1.0.0", features = ["io-util", "rt-multi-thread", "macros", "sync"] } tokio-stream = "0.1" tokio-tungstenite = "0.21.0" diff --git a/src/daemon.rs b/src/daemon.rs index 0e7d7a5..4e702e0 100644 --- a/src/daemon.rs +++ b/src/daemon.rs @@ -5,12 +5,12 @@ use bitcoincore_rpc::json::{ WalletCreateFundedPsbtOptions, }; use bitcoincore_rpc::{json, jsonrpc, Auth, Client, RpcApi}; -use sp_backend::bitcoin::bip158::BlockFilter; -use sp_backend::bitcoin::{ +use sp_client::bitcoin::bip158::BlockFilter; +use sp_client::bitcoin::{ block, Address, Amount, Block, BlockHash, Network, OutPoint, Psbt, ScriptBuf, Sequence, Transaction, TxIn, TxOut, Txid, }; -use sp_backend::bitcoin::{consensus::deserialize, hashes::hex::FromHex}; +use sp_client::bitcoin::{consensus::deserialize, hashes::hex::FromHex}; // use crossbeam_channel::Receiver; // use parking_lot::Mutex; use serde_json::{json, Value}; @@ -315,7 +315,7 @@ impl Daemon { txid: &Txid, blockhash: Option, ) -> Result { - use sp_backend::bitcoin::consensus::serde::{hex::Lower, Hex, With}; + use sp_client::bitcoin::consensus::serde::{hex::Lower, Hex, With}; let tx = self.get_transaction(txid, blockhash)?; #[derive(serde::Serialize)] diff --git a/src/main.rs b/src/main.rs index 0996a45..266cdb2 100644 --- a/src/main.rs +++ b/src/main.rs @@ -6,7 +6,7 @@ use bitcoincore_rpc::json::{self as bitcoin_json}; use futures_util::{future, pin_mut, stream::TryStreamExt, FutureExt, StreamExt}; use log::{debug, error}; use sdk_common::network::{AnkFlag, AnkNetworkMsg, FaucetMessage, NewTxMessage}; -use sp_backend::bitcoin::{ +use sp_client::bitcoin::{ absolute::LockTime, consensus::{deserialize, serialize}, hex::DisplayHex, @@ -17,7 +17,7 @@ use sp_backend::bitcoin::{ Amount, OutPoint, Psbt, ScriptBuf, TapSighashType, Transaction, TxIn, TxOut, Witness, XOnlyPublicKey, }; -use sp_backend::{ +use sp_client::{ bitcoin::secp256k1::{ rand::{thread_rng, Rng}, Error as Secp256k1Error, Keypair, Message as Secp256k1Message, PublicKey, Scalar, @@ -26,15 +26,14 @@ use sp_backend::{ spclient::SpWallet, }; -use sp_backend::db::{JsonFile, Storage}; -use sp_backend::silentpayments::receiving::Label; -use sp_backend::silentpayments::sending::{generate_recipient_pubkeys, SilentPaymentAddress}; -use sp_backend::silentpayments::utils::receiving::{ - calculate_shared_secret, calculate_tweak_data, get_pubkey_from_input, +use sp_client::db::{JsonFile, Storage}; +use sp_client::silentpayments::sending::{generate_recipient_pubkeys, SilentPaymentAddress}; +use sp_client::silentpayments::utils::receiving::{ + calculate_tweak_data, get_pubkey_from_input, }; -use sp_backend::silentpayments::utils::sending::calculate_partial_secret; -use sp_backend::spclient::{ - derive_keys_from_seed, OutputSpendStatus, OwnedOutput, Recipient, SpClient, SpendKey, +use sp_client::silentpayments::utils::sending::calculate_partial_secret; +use sp_client::spclient::{ + derive_keys_from_seed, Recipient, SpClient, SpendKey, }; use tokio::net::{TcpListener, TcpStream}; use tokio::sync::mpsc::{unbounded_channel, UnboundedSender}; diff --git a/src/scan.rs b/src/scan.rs index fecb05b..93f8f30 100644 --- a/src/scan.rs +++ b/src/scan.rs @@ -5,12 +5,12 @@ use std::sync::Arc; use anyhow::{Error, Result}; use electrum_client::ElectrumApi; use hex::FromHex; -use sp_backend::bitcoin::bip158::BlockFilter; -use sp_backend::bitcoin::hex::DisplayHex; -use sp_backend::bitcoin::secp256k1::{All, PublicKey, Scalar, Secp256k1, SecretKey}; -use sp_backend::bitcoin::{BlockHash, OutPoint, Transaction, TxOut, XOnlyPublicKey}; -use sp_backend::silentpayments::receiving::Receiver; -use sp_backend::spclient::{OutputSpendStatus, OwnedOutput}; +use sp_client::bitcoin::bip158::BlockFilter; +use sp_client::bitcoin::hex::DisplayHex; +use sp_client::bitcoin::secp256k1::{All, PublicKey, Scalar, Secp256k1, SecretKey}; +use sp_client::bitcoin::{BlockHash, OutPoint, Transaction, TxOut, XOnlyPublicKey}; +use sp_client::silentpayments::receiving::Receiver; +use sp_client::spclient::{OutputSpendStatus, OwnedOutput}; use tokio::time::Instant; use crate::{electrumclient, MutexExt, SharedDaemon, SilentPaymentWallet};