Merge branch 'master' into contracts

Bring the contracts feature branch up to current master, which has since
landed rust 1.80 support (#722), the canonical mwixnet onion code (#726),
and node-client proxy support (#738).

Conflict resolution:
- libwallet/src/mwixnet/*: take master's (#726), dropping the contracts
  branch's older divergent copy. owner.rs::create_mwixnet_req updated to
  master's API (use_test_rng) and master's flat re-export imports.
- Cargo manifests/lock/.cargo: master's deps & version; re-add serde_with
  for Slate v5; keep contracts' .cargo/config.toml (Windows static-CRT).
- lib.rs: keep serde_derive AND serde_with macro_use; single mwixnet decl.
- error.rs: union of master + contracts variants; flat mwixnet re-exports.
- api/libwallet owner.rs: master's #738 + create_mwixnet_req plus the
  contract_* entry points; drop duplicate older create_mwixnet_req method.
- slatepack/armor.rs, node_clients/resp_types.rs: take master's.

Workspace builds; libwallet lib tests pass (34/34). The Slate version()
bug, issue #729 fix, and de-panicking follow in subsequent commits.
This commit is contained in:
jwinterm
2026-06-02 18:26:08 -04:00
30 changed files with 1152 additions and 675 deletions
+2 -1
View File
@@ -204,9 +204,10 @@ impl HttpSlateSender {
let client = if !self.use_socks {
Client::new()
} else {
Client::with_socks_proxy(
Client::with_proxy(
self.socks_proxy_addr
.ok_or_else(|| ClientError::Internal("No socks proxy address set".into()))?,
"socks5h://",
)
}
.map_err(|_| ClientError::Internal("Unable to create http client".into()))?;
+6 -5
View File
@@ -65,11 +65,11 @@ impl Client {
Self::build(None)
}
pub fn with_socks_proxy(socks_proxy_addr: SocketAddr) -> Result<Self, Error> {
Self::build(Some(socks_proxy_addr))
pub fn with_proxy(socks_proxy_addr: SocketAddr, scheme: &'static str) -> Result<Self, Error> {
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();
headers.insert(USER_AGENT, HeaderValue::from_static("grin-client"));
headers.insert(ACCEPT, HeaderValue::from_static("application/json"));
@@ -80,8 +80,9 @@ impl Client {
.use_rustls_tls()
.default_headers(headers);
if let Some(s) = socks_proxy_addr {
let proxy = Proxy::all(&format!("socks5h://{}:{}", s.ip(), s.port()))
if let Some(p) = proxy {
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)))?;
builder = builder.proxy(proxy);
}
+20 -6
View File
@@ -15,17 +15,17 @@
//! Client functions, implementations of the NodeClient trait
use crate::api::{self, LocatedTxKernel, OutputListing, OutputPrintable};
use crate::client_utils::{Client, RUNTIME};
use crate::core::core::{Transaction, TxKernel};
use crate::libwallet;
use crate::libwallet::{NodeClient, NodeVersionInfo};
use crate::util::secp::pedersen;
use crate::util::ToHex;
use futures::stream::FuturesUnordered;
use futures::TryStreamExt;
use std::collections::HashMap;
use std::env;
use crate::client_utils::{Client, RUNTIME};
use crate::libwallet;
use crate::util::secp::pedersen;
use crate::util::ToHex;
use std::net::SocketAddr;
use super::resp_types::*;
use crate::client_utils::json_rpc::*;
@@ -46,8 +46,22 @@ impl HTTPNodeClient {
node_url: &str,
node_api_secret: Option<String>,
) -> 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 {
client: Client::new().map_err(|_| libwallet::Error::Node)?,
client: client.map_err(|_| libwallet::Error::Node)?,
node_url: node_url.to_owned(),
node_api_secret: node_api_secret,
node_version_info: None,
+1
View File
@@ -14,6 +14,7 @@
// Derived from https://github.com/apoelstra/rust-jsonrpc
//! JSON RPC Types for V2 node client
#[allow(dead_code)]
#[derive(Debug, Deserialize)]
pub struct GetTipResp {