import sp_client through sdk_common
This commit is contained in:
parent
ad026a783e
commit
0d5149eb96
@ -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 = { 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_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"
|
||||||
|
@ -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_client::bitcoin::bip158::BlockFilter;
|
use sdk_common::sp_client::bitcoin::bip158::BlockFilter;
|
||||||
use sp_client::bitcoin::{
|
use sdk_common::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_client::bitcoin::{consensus::deserialize, hashes::hex::FromHex};
|
use sdk_common::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};
|
||||||
@ -328,7 +328,7 @@ impl Daemon {
|
|||||||
txid: &Txid,
|
txid: &Txid,
|
||||||
blockhash: Option<BlockHash>,
|
blockhash: Option<BlockHash>,
|
||||||
) -> Result<Value> {
|
) -> 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)?;
|
let tx = self.get_transaction(txid, blockhash)?;
|
||||||
#[derive(serde::Serialize)]
|
#[derive(serde::Serialize)]
|
||||||
|
43
src/main.rs
43
src/main.rs
@ -10,28 +10,45 @@ use std::{
|
|||||||
|
|
||||||
use bitcoincore_rpc::json::{self as bitcoin_json};
|
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 sdk_common::sp_client::bitcoin::{
|
||||||
use sdk_common::{
|
absolute::LockTime,
|
||||||
error::AnkError, network::{AnkFlag, AnkNetworkMsg, FaucetMessage, NewTxMessage}, silentpayments::create_transaction_for_address_with_shared_secret
|
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::{
|
use sdk_common::sp_client::{
|
||||||
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::{
|
|
||||||
bitcoin::secp256k1::{
|
bitcoin::secp256k1::{
|
||||||
rand::{thread_rng, Rng},
|
rand::{thread_rng, Rng},
|
||||||
Keypair, Message as Secp256k1Message, PublicKey, Secp256k1, ThirtyTwoByteHash,
|
Keypair, Message as Secp256k1Message, PublicKey, Secp256k1, ThirtyTwoByteHash,
|
||||||
},
|
},
|
||||||
spclient::SpWallet,
|
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 sdk_common::sp_client::db::{JsonFile, Storage};
|
||||||
use sp_client::silentpayments::sending::{generate_recipient_pubkeys, SilentPaymentAddress};
|
use sdk_common::sp_client::silentpayments::sending::{
|
||||||
use sp_client::silentpayments::utils::receiving::{calculate_tweak_data, get_pubkey_from_input};
|
generate_recipient_pubkeys, SilentPaymentAddress,
|
||||||
use sp_client::silentpayments::utils::sending::calculate_partial_secret;
|
};
|
||||||
use sp_client::spclient::{derive_keys_from_seed, Recipient, SpClient, SpendKey};
|
use sdk_common::sp_client::silentpayments::utils::receiving::{
|
||||||
use tokio::{net::{TcpListener, TcpStream}, time};
|
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::sync::mpsc::{unbounded_channel, UnboundedSender};
|
||||||
|
use tokio::{
|
||||||
|
net::{TcpListener, TcpStream},
|
||||||
|
time,
|
||||||
|
};
|
||||||
use tokio_stream::wrappers::UnboundedReceiverStream;
|
use tokio_stream::wrappers::UnboundedReceiverStream;
|
||||||
use tokio_tungstenite::tungstenite::Message;
|
use tokio_tungstenite::tungstenite::Message;
|
||||||
|
|
||||||
|
12
src/scan.rs
12
src/scan.rs
@ -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_client::bitcoin::bip158::BlockFilter;
|
use sdk_common::sp_client::bitcoin::bip158::BlockFilter;
|
||||||
use sp_client::bitcoin::hex::DisplayHex;
|
use sdk_common::sp_client::bitcoin::hex::DisplayHex;
|
||||||
use sp_client::bitcoin::secp256k1::{All, PublicKey, Scalar, Secp256k1, SecretKey};
|
use sdk_common::sp_client::bitcoin::secp256k1::{All, PublicKey, Scalar, Secp256k1, SecretKey};
|
||||||
use sp_client::bitcoin::{BlockHash, OutPoint, Transaction, TxOut, XOnlyPublicKey};
|
use sdk_common::sp_client::bitcoin::{BlockHash, OutPoint, Transaction, TxOut, XOnlyPublicKey};
|
||||||
use sp_client::silentpayments::receiving::Receiver;
|
use sdk_common::sp_client::silentpayments::receiving::Receiver;
|
||||||
use sp_client::spclient::{OutputSpendStatus, OwnedOutput};
|
use sdk_common::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};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user