Update sp_backend to sp_client

This commit is contained in:
Sosthene00 2024-04-17 21:44:30 +02:00
parent a287db7cf8
commit ee5fcb4932
4 changed files with 20 additions and 21 deletions

View File

@ -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 = { version = "1.0.193", features = ["derive"]}
serde_json = "1.0" serde_json = "1.0"
serde_with = "3.6.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 = { version = "1.0.0", features = ["io-util", "rt-multi-thread", "macros", "sync"] }
tokio-stream = "0.1" tokio-stream = "0.1"
tokio-tungstenite = "0.21.0" tokio-tungstenite = "0.21.0"

View File

@ -5,12 +5,12 @@ use bitcoincore_rpc::json::{
WalletCreateFundedPsbtOptions, WalletCreateFundedPsbtOptions,
}; };
use bitcoincore_rpc::{json, jsonrpc, Auth, Client, RpcApi}; use bitcoincore_rpc::{json, jsonrpc, Auth, Client, RpcApi};
use sp_backend::bitcoin::bip158::BlockFilter; use sp_client::bitcoin::bip158::BlockFilter;
use sp_backend::bitcoin::{ use sp_client::bitcoin::{
block, Address, Amount, Block, BlockHash, Network, OutPoint, Psbt, ScriptBuf, Sequence, block, Address, Amount, Block, BlockHash, Network, OutPoint, Psbt, ScriptBuf, Sequence,
Transaction, TxIn, TxOut, Txid, 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 crossbeam_channel::Receiver;
// use parking_lot::Mutex; // use parking_lot::Mutex;
use serde_json::{json, Value}; use serde_json::{json, Value};
@ -315,7 +315,7 @@ impl Daemon {
txid: &Txid, txid: &Txid,
blockhash: Option<BlockHash>, blockhash: Option<BlockHash>,
) -> Result<Value> { ) -> Result<Value> {
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)?; let tx = self.get_transaction(txid, blockhash)?;
#[derive(serde::Serialize)] #[derive(serde::Serialize)]

View File

@ -6,7 +6,7 @@ use bitcoincore_rpc::json::{self as bitcoin_json};
use futures_util::{future, pin_mut, stream::TryStreamExt, FutureExt, StreamExt}; use futures_util::{future, pin_mut, stream::TryStreamExt, FutureExt, StreamExt};
use log::{debug, error}; use log::{debug, error};
use sdk_common::network::{AnkFlag, AnkNetworkMsg, FaucetMessage, NewTxMessage}; use sdk_common::network::{AnkFlag, AnkNetworkMsg, FaucetMessage, NewTxMessage};
use sp_backend::bitcoin::{ use sp_client::bitcoin::{
absolute::LockTime, absolute::LockTime,
consensus::{deserialize, serialize}, consensus::{deserialize, serialize},
hex::DisplayHex, hex::DisplayHex,
@ -17,7 +17,7 @@ use sp_backend::bitcoin::{
Amount, OutPoint, Psbt, ScriptBuf, TapSighashType, Transaction, TxIn, TxOut, Witness, Amount, OutPoint, Psbt, ScriptBuf, TapSighashType, Transaction, TxIn, TxOut, Witness,
XOnlyPublicKey, XOnlyPublicKey,
}; };
use sp_backend::{ use sp_client::{
bitcoin::secp256k1::{ bitcoin::secp256k1::{
rand::{thread_rng, Rng}, rand::{thread_rng, Rng},
Error as Secp256k1Error, Keypair, Message as Secp256k1Message, PublicKey, Scalar, Error as Secp256k1Error, Keypair, Message as Secp256k1Message, PublicKey, Scalar,
@ -26,15 +26,14 @@ use sp_backend::{
spclient::SpWallet, spclient::SpWallet,
}; };
use sp_backend::db::{JsonFile, Storage}; use sp_client::db::{JsonFile, Storage};
use sp_backend::silentpayments::receiving::Label; use sp_client::silentpayments::sending::{generate_recipient_pubkeys, SilentPaymentAddress};
use sp_backend::silentpayments::sending::{generate_recipient_pubkeys, SilentPaymentAddress}; use sp_client::silentpayments::utils::receiving::{
use sp_backend::silentpayments::utils::receiving::{ calculate_tweak_data, get_pubkey_from_input,
calculate_shared_secret, calculate_tweak_data, get_pubkey_from_input,
}; };
use sp_backend::silentpayments::utils::sending::calculate_partial_secret; use sp_client::silentpayments::utils::sending::calculate_partial_secret;
use sp_backend::spclient::{ use sp_client::spclient::{
derive_keys_from_seed, OutputSpendStatus, OwnedOutput, Recipient, SpClient, SpendKey, derive_keys_from_seed, Recipient, SpClient, SpendKey,
}; };
use tokio::net::{TcpListener, TcpStream}; use tokio::net::{TcpListener, TcpStream};
use tokio::sync::mpsc::{unbounded_channel, UnboundedSender}; use tokio::sync::mpsc::{unbounded_channel, UnboundedSender};

View File

@ -5,12 +5,12 @@ use std::sync::Arc;
use anyhow::{Error, Result}; use anyhow::{Error, Result};
use electrum_client::ElectrumApi; use electrum_client::ElectrumApi;
use hex::FromHex; use hex::FromHex;
use sp_backend::bitcoin::bip158::BlockFilter; use sp_client::bitcoin::bip158::BlockFilter;
use sp_backend::bitcoin::hex::DisplayHex; use sp_client::bitcoin::hex::DisplayHex;
use sp_backend::bitcoin::secp256k1::{All, PublicKey, Scalar, Secp256k1, SecretKey}; use sp_client::bitcoin::secp256k1::{All, PublicKey, Scalar, Secp256k1, SecretKey};
use sp_backend::bitcoin::{BlockHash, OutPoint, Transaction, TxOut, XOnlyPublicKey}; use sp_client::bitcoin::{BlockHash, OutPoint, Transaction, TxOut, XOnlyPublicKey};
use sp_backend::silentpayments::receiving::Receiver; use sp_client::silentpayments::receiving::Receiver;
use sp_backend::spclient::{OutputSpendStatus, OwnedOutput}; use sp_client::spclient::{OutputSpendStatus, OwnedOutput};
use tokio::time::Instant; use tokio::time::Instant;
use crate::{electrumclient, MutexExt, SharedDaemon, SilentPaymentWallet}; use crate::{electrumclient, MutexExt, SharedDaemon, SilentPaymentWallet};