mirror of
https://github.com/jwinterm/grin-wallet.git
synced 2026-10-17 07:11:36 +02:00
Merge pull request #1 from mimblewimble/master
Trying to merge master 9 commits into my branch. All checks passed.
This commit is contained in:
Generated
+583
-200
File diff suppressed because it is too large
Load Diff
+5
-5
@@ -41,10 +41,10 @@ grin_wallet_util = { path = "./util", version = "5.4.0-alpha.1" }
|
|||||||
##### Grin Imports
|
##### Grin Imports
|
||||||
|
|
||||||
# For Release
|
# For Release
|
||||||
grin_core = "5.3.3"
|
grin_core = "5.4.0"
|
||||||
grin_keychain = "5.3.3"
|
grin_keychain = "5.4.0"
|
||||||
grin_util = "5.3.3"
|
grin_util = "5.4.0"
|
||||||
grin_api = "5.3.3"
|
grin_api = "5.4.0"
|
||||||
|
|
||||||
# For beta release
|
# For beta release
|
||||||
|
|
||||||
@@ -68,7 +68,7 @@ grin_api = "5.3.3"
|
|||||||
######
|
######
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
built = { version = "0.7", features = ["git2"]}
|
built = { version = "0.8.0", features = ["git2"]}
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
url = "2.1"
|
url = "2.1"
|
||||||
|
|||||||
+3
-3
@@ -30,9 +30,9 @@ grin_wallet_util = { path = "../util", version = "5.4.0-alpha.1" }
|
|||||||
##### Grin Imports
|
##### Grin Imports
|
||||||
|
|
||||||
# For Release
|
# For Release
|
||||||
grin_core = "5.3.3"
|
grin_core = "5.4.0"
|
||||||
grin_keychain = "5.3.3"
|
grin_keychain = "5.4.0"
|
||||||
grin_util = "5.3.3"
|
grin_util = "5.4.0"
|
||||||
|
|
||||||
# For beta release
|
# For beta release
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -21,8 +21,8 @@ grin_wallet_util = { path = "../util", version = "5.4.0-alpha.1" }
|
|||||||
##### Grin Imports
|
##### Grin Imports
|
||||||
|
|
||||||
# For Release
|
# For Release
|
||||||
grin_core = "5.3.3"
|
grin_core = "5.4.0"
|
||||||
grin_util = "5.3.3"
|
grin_util = "5.4.0"
|
||||||
|
|
||||||
# For beta release
|
# For beta release
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ edition = "2018"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
futures = "0.3"
|
futures = "0.3"
|
||||||
hyper = "0.13"
|
hyper = "0.14"
|
||||||
rand = "0.7"
|
rand = "0.7"
|
||||||
serde = "1"
|
serde = "1"
|
||||||
serde_derive = "1"
|
serde_derive = "1"
|
||||||
@@ -39,10 +39,10 @@ grin_wallet_config = { path = "../config", version = "5.4.0-alpha.1" }
|
|||||||
##### Grin Imports
|
##### Grin Imports
|
||||||
|
|
||||||
# For Release
|
# For Release
|
||||||
grin_core = "5.3.3"
|
grin_core = "5.4.0"
|
||||||
grin_keychain = "5.3.3"
|
grin_keychain = "5.4.0"
|
||||||
grin_util = "5.3.3"
|
grin_util = "5.4.0"
|
||||||
grin_api = "5.3.3"
|
grin_api = "5.4.0"
|
||||||
|
|
||||||
# For beta release
|
# For beta release
|
||||||
|
|
||||||
@@ -72,7 +72,7 @@ remove_dir_all = "0.7"
|
|||||||
##### Grin Imports
|
##### Grin Imports
|
||||||
|
|
||||||
# For Release
|
# For Release
|
||||||
grin_chain = "5.3.3"
|
grin_chain = "5.4.0"
|
||||||
|
|
||||||
# For beta release
|
# For beta release
|
||||||
|
|
||||||
|
|||||||
+6
-6
@@ -43,12 +43,12 @@ grin_wallet_libwallet = { path = "../libwallet", version = "5.4.0-alpha.1" }
|
|||||||
##### Grin Imports
|
##### Grin Imports
|
||||||
|
|
||||||
# For Release
|
# For Release
|
||||||
grin_core = "5.3.3"
|
grin_core = "5.4.0"
|
||||||
grin_keychain = "5.3.3"
|
grin_keychain = "5.4.0"
|
||||||
grin_chain = "5.3.3"
|
grin_chain = "5.4.0"
|
||||||
grin_util = "5.3.3"
|
grin_util = "5.4.0"
|
||||||
grin_api = "5.3.3"
|
grin_api = "5.4.0"
|
||||||
grin_store = "5.3.3"
|
grin_store = "5.4.0"
|
||||||
|
|
||||||
# For beta release
|
# For beta release
|
||||||
|
|
||||||
|
|||||||
@@ -200,9 +200,10 @@ impl HttpSlateSender {
|
|||||||
let client = if !self.use_socks {
|
let client = if !self.use_socks {
|
||||||
Client::new()
|
Client::new()
|
||||||
} else {
|
} else {
|
||||||
Client::with_socks_proxy(
|
Client::with_proxy(
|
||||||
self.socks_proxy_addr
|
self.socks_proxy_addr
|
||||||
.ok_or_else(|| ClientError::Internal("No socks proxy address set".into()))?,
|
.ok_or_else(|| ClientError::Internal("No socks proxy address set".into()))?,
|
||||||
|
"socks5h://",
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
.map_err(|_| ClientError::Internal("Unable to create http client".into()))?;
|
.map_err(|_| ClientError::Internal("Unable to create http client".into()))?;
|
||||||
|
|||||||
@@ -696,6 +696,16 @@ where
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn delete_tx_log_entry(&mut self, tx_id: u32, parent_id: &Identifier) -> Result<(), Error> {
|
||||||
|
let tx_log_key = to_key_u64(
|
||||||
|
TX_LOG_ENTRY_PREFIX,
|
||||||
|
&mut parent_id.to_bytes().to_vec(),
|
||||||
|
tx_id as u64,
|
||||||
|
);
|
||||||
|
self.db.borrow().as_ref().unwrap().delete(&tx_log_key)?;
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
fn save_acct_path(&mut self, mapping: AcctPathMapping) -> Result<(), Error> {
|
fn save_acct_path(&mut self, mapping: AcctPathMapping) -> Result<(), Error> {
|
||||||
let acct_key = to_key(
|
let acct_key = to_key(
|
||||||
ACCOUNT_PATH_MAPPING_PREFIX,
|
ACCOUNT_PATH_MAPPING_PREFIX,
|
||||||
|
|||||||
@@ -65,11 +65,11 @@ impl Client {
|
|||||||
Self::build(None)
|
Self::build(None)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_socks_proxy(socks_proxy_addr: SocketAddr) -> Result<Self, Error> {
|
pub fn with_proxy(socks_proxy_addr: SocketAddr, scheme: &'static str) -> Result<Self, Error> {
|
||||||
Self::build(Some(socks_proxy_addr))
|
Self::build(Some((socks_proxy_addr, scheme)))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn build(socks_proxy_addr: Option<SocketAddr>) -> Result<Self, Error> {
|
fn build(proxy: Option<(SocketAddr, &str)>) -> Result<Self, Error> {
|
||||||
let mut headers = HeaderMap::new();
|
let mut headers = HeaderMap::new();
|
||||||
headers.insert(USER_AGENT, HeaderValue::from_static("grin-client"));
|
headers.insert(USER_AGENT, HeaderValue::from_static("grin-client"));
|
||||||
headers.insert(ACCEPT, HeaderValue::from_static("application/json"));
|
headers.insert(ACCEPT, HeaderValue::from_static("application/json"));
|
||||||
@@ -80,8 +80,9 @@ impl Client {
|
|||||||
.use_rustls_tls()
|
.use_rustls_tls()
|
||||||
.default_headers(headers);
|
.default_headers(headers);
|
||||||
|
|
||||||
if let Some(s) = socks_proxy_addr {
|
if let Some(p) = proxy {
|
||||||
let proxy = Proxy::all(&format!("socks5h://{}:{}", s.ip(), s.port()))
|
let (addr, scheme) = p;
|
||||||
|
let proxy = Proxy::all(&format!("{}{}:{}", scheme, addr.ip(), addr.port()))
|
||||||
.map_err(|e| Error::Internal(format!("Unable to create proxy: {}", e)))?;
|
.map_err(|e| Error::Internal(format!("Unable to create proxy: {}", e)))?;
|
||||||
builder = builder.proxy(proxy);
|
builder = builder.proxy(proxy);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,17 +15,17 @@
|
|||||||
//! Client functions, implementations of the NodeClient trait
|
//! Client functions, implementations of the NodeClient trait
|
||||||
|
|
||||||
use crate::api::{self, LocatedTxKernel, OutputListing, OutputPrintable};
|
use crate::api::{self, LocatedTxKernel, OutputListing, OutputPrintable};
|
||||||
|
use crate::client_utils::{Client, RUNTIME};
|
||||||
use crate::core::core::{Transaction, TxKernel};
|
use crate::core::core::{Transaction, TxKernel};
|
||||||
|
use crate::libwallet;
|
||||||
use crate::libwallet::{NodeClient, NodeVersionInfo};
|
use crate::libwallet::{NodeClient, NodeVersionInfo};
|
||||||
|
use crate::util::secp::pedersen;
|
||||||
|
use crate::util::ToHex;
|
||||||
use futures::stream::FuturesUnordered;
|
use futures::stream::FuturesUnordered;
|
||||||
use futures::TryStreamExt;
|
use futures::TryStreamExt;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::env;
|
use std::env;
|
||||||
|
use std::net::SocketAddr;
|
||||||
use crate::client_utils::{Client, RUNTIME};
|
|
||||||
use crate::libwallet;
|
|
||||||
use crate::util::secp::pedersen;
|
|
||||||
use crate::util::ToHex;
|
|
||||||
|
|
||||||
use super::resp_types::*;
|
use super::resp_types::*;
|
||||||
use crate::client_utils::json_rpc::*;
|
use crate::client_utils::json_rpc::*;
|
||||||
@@ -46,8 +46,22 @@ impl HTTPNodeClient {
|
|||||||
node_url: &str,
|
node_url: &str,
|
||||||
node_api_secret: Option<String>,
|
node_api_secret: Option<String>,
|
||||||
) -> Result<HTTPNodeClient, libwallet::Error> {
|
) -> Result<HTTPNodeClient, libwallet::Error> {
|
||||||
|
Self::new_proxy(node_url, node_api_secret, None)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Create a new client with proxy
|
||||||
|
pub fn new_proxy(
|
||||||
|
node_url: &str,
|
||||||
|
node_api_secret: Option<String>,
|
||||||
|
proxy: Option<(SocketAddr, &'static str)>,
|
||||||
|
) -> Result<HTTPNodeClient, libwallet::Error> {
|
||||||
|
let client = if let Some((a, s)) = proxy {
|
||||||
|
Client::with_proxy(a, s)
|
||||||
|
} else {
|
||||||
|
Client::new()
|
||||||
|
};
|
||||||
Ok(HTTPNodeClient {
|
Ok(HTTPNodeClient {
|
||||||
client: Client::new().map_err(|_| libwallet::Error::Node)?,
|
client: client.map_err(|_| libwallet::Error::Node)?,
|
||||||
node_url: node_url.to_owned(),
|
node_url: node_url.to_owned(),
|
||||||
node_api_secret: node_api_secret,
|
node_api_secret: node_api_secret,
|
||||||
node_version_info: None,
|
node_version_info: None,
|
||||||
|
|||||||
@@ -46,10 +46,10 @@ grin_wallet_config = { path = "../config", version = "5.4.0-alpha.1" }
|
|||||||
##### Grin Imports
|
##### Grin Imports
|
||||||
|
|
||||||
# For Release
|
# For Release
|
||||||
grin_core = "5.3.3"
|
grin_core = "5.4.0"
|
||||||
grin_keychain = "5.3.3"
|
grin_keychain = "5.4.0"
|
||||||
grin_util = "5.3.3"
|
grin_util = "5.4.0"
|
||||||
grin_store = "5.3.3"
|
grin_store = "5.4.0"
|
||||||
|
|
||||||
# For beta release
|
# For beta release
|
||||||
|
|
||||||
|
|||||||
@@ -96,6 +96,7 @@ where
|
|||||||
/// Apply advanced filtering to resultset from retrieve_txs below
|
/// Apply advanced filtering to resultset from retrieve_txs below
|
||||||
pub fn apply_advanced_tx_list_filtering<'a, T: ?Sized, C, K>(
|
pub fn apply_advanced_tx_list_filtering<'a, T: ?Sized, C, K>(
|
||||||
wallet: &mut T,
|
wallet: &mut T,
|
||||||
|
parent_key_id: Option<&Identifier>,
|
||||||
query_args: &RetrieveTxQueryArgs,
|
query_args: &RetrieveTxQueryArgs,
|
||||||
) -> Vec<TxLogEntry>
|
) -> Vec<TxLogEntry>
|
||||||
where
|
where
|
||||||
@@ -107,6 +108,10 @@ where
|
|||||||
let txs_iter: Box<dyn Iterator<Item = TxLogEntry>> = Box::new(
|
let txs_iter: Box<dyn Iterator<Item = TxLogEntry>> = Box::new(
|
||||||
wallet
|
wallet
|
||||||
.tx_log_iter()
|
.tx_log_iter()
|
||||||
|
.filter(|tx_entry| match parent_key_id {
|
||||||
|
Some(k) => tx_entry.parent_key_id == *k,
|
||||||
|
None => true,
|
||||||
|
})
|
||||||
.filter(|tx_entry| {
|
.filter(|tx_entry| {
|
||||||
if let Some(v) = query_args.exclude_cancelled {
|
if let Some(v) = query_args.exclude_cancelled {
|
||||||
if v {
|
if v {
|
||||||
@@ -343,7 +348,7 @@ where
|
|||||||
// Adding in new transaction list query logic. If `tx_id` or `tx_slate_id`
|
// Adding in new transaction list query logic. If `tx_id` or `tx_slate_id`
|
||||||
// is provided, then `query_args` is ignored and old logic is followed.
|
// is provided, then `query_args` is ignored and old logic is followed.
|
||||||
if query_args.is_some() && tx_id.is_none() && tx_slate_id.is_none() {
|
if query_args.is_some() && tx_id.is_none() && tx_slate_id.is_none() {
|
||||||
txs = apply_advanced_tx_list_filtering(wallet, &query_args.unwrap())
|
txs = apply_advanced_tx_list_filtering(wallet, parent_key_id, &query_args.unwrap())
|
||||||
} else {
|
} else {
|
||||||
txs = wallet
|
txs = wallet
|
||||||
.tx_log_iter()
|
.tx_log_iter()
|
||||||
|
|||||||
@@ -287,6 +287,9 @@ where
|
|||||||
/// save a tx log entry
|
/// save a tx log entry
|
||||||
fn save_tx_log_entry(&mut self, t: TxLogEntry, parent_id: &Identifier) -> Result<(), Error>;
|
fn save_tx_log_entry(&mut self, t: TxLogEntry, parent_id: &Identifier) -> Result<(), Error>;
|
||||||
|
|
||||||
|
/// delete a tx log entry
|
||||||
|
fn delete_tx_log_entry(&mut self, tx_id: u32, parent_id: &Identifier) -> Result<(), Error>;
|
||||||
|
|
||||||
/// save an account label -> path mapping
|
/// save an account label -> path mapping
|
||||||
fn save_acct_path(&mut self, mapping: AcctPathMapping) -> Result<(), Error>;
|
fn save_acct_path(&mut self, mapping: AcctPathMapping) -> Result<(), Error>;
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -21,7 +21,7 @@ thiserror = "1"
|
|||||||
##### Grin Imports
|
##### Grin Imports
|
||||||
|
|
||||||
# For Release
|
# For Release
|
||||||
grin_util = "5.3.3"
|
grin_util = "5.4.0"
|
||||||
|
|
||||||
# For beta release
|
# For beta release
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user