import sp_client through sdk_common

This commit is contained in:
Sosthene 2024-05-28 11:10:48 +02:00
parent ad026a783e
commit 0d5149eb96
4 changed files with 40 additions and 24 deletions

View File

@ -15,7 +15,6 @@ 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_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"

View File

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

View File

@ -10,28 +10,45 @@ use std::{
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::{
error::AnkError, network::{AnkFlag, AnkNetworkMsg, FaucetMessage, NewTxMessage}, silentpayments::create_transaction_for_address_with_shared_secret
use sdk_common::sp_client::bitcoin::{
absolute::LockTime,
consensus::{deserialize, serialize},
hex::{DisplayHex, FromHex},
key::TapTweak,
script::PushBytesBuf,
sighash::{Prevouts, SighashCache},
taproot::Signature,
transaction::Version,
Amount, Network, OutPoint, Psbt, ScriptBuf, TapSighashType, Transaction, TxIn, TxOut, Witness,
XOnlyPublicKey,
};
use sp_client::bitcoin::{
absolute::LockTime, consensus::{deserialize, serialize}, hex::{DisplayHex, FromHex}, key::TapTweak, script::PushBytesBuf, sighash::{Prevouts, SighashCache}, taproot::Signature, transaction::Version, Amount, OutPoint, Psbt, ScriptBuf, TapSighashType, Transaction, TxIn, TxOut, Witness, XOnlyPublicKey
};
use sp_client::{
use sdk_common::sp_client::{
bitcoin::secp256k1::{
rand::{thread_rng, Rng},
Keypair, Message as Secp256k1Message, PublicKey, Secp256k1, ThirtyTwoByteHash,
},
spclient::SpWallet,
};
use sdk_common::{
error::AnkError,
network::{AnkFlag, AnkNetworkMsg, FaucetMessage, NewTxMessage},
silentpayments::create_transaction_for_address_with_shared_secret,
};
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_client::silentpayments::utils::sending::calculate_partial_secret;
use sp_client::spclient::{derive_keys_from_seed, Recipient, SpClient, SpendKey};
use tokio::{net::{TcpListener, TcpStream}, time};
use sdk_common::sp_client::db::{JsonFile, Storage};
use sdk_common::sp_client::silentpayments::sending::{
generate_recipient_pubkeys, SilentPaymentAddress,
};
use sdk_common::sp_client::silentpayments::utils::receiving::{
calculate_tweak_data, get_pubkey_from_input,
};
use sdk_common::sp_client::silentpayments::utils::sending::calculate_partial_secret;
use sdk_common::sp_client::spclient::{derive_keys_from_seed, Recipient, SpClient, SpendKey};
use tokio::sync::mpsc::{unbounded_channel, UnboundedSender};
use tokio::{
net::{TcpListener, TcpStream},
time,
};
use tokio_stream::wrappers::UnboundedReceiverStream;
use tokio_tungstenite::tungstenite::Message;

View File

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