Răsfoiți Sursa

wallet: get p2p + zk darkfi compiling in the app

darkfi 2 ani în urmă
părinte
comite
90f2958cd2

+ 2 - 1
Cargo.toml

@@ -30,6 +30,7 @@ members = [
     "bin/genev/genevd",
     "bin/genev/genev-cli",
     "bin/darkirc",
+    #"bin/darkwallet",
     "bin/tau/taud",
     "bin/vanityaddr",
     "bin/lilith",
@@ -57,7 +58,7 @@ thiserror = "1.0.61"
 
 # async-runtime
 async-recursion = {version = "1.1.1", optional = true}
-async-trait = {version = "0.1.81", optional = true}
+async-trait = {version = "0.1", optional = true}
 futures = {version = "0.3.30", optional = true}
 smol = {version = "2.0.0", optional = true}
 pin-project-lite = {version = "0.2.14", optional = true}

+ 11 - 6
bin/darkwallet/Cargo.toml

@@ -1,11 +1,12 @@
 [package]
 name = "darkwallet"
+description = "Wallet UI"
 version = "0.1.0"
 edition = "2021"
-
-# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
-
-[workspace]
+authors = ["Dyne.org foundation <foundation@dyne.org>"]
+license = "AGPL-3.0-only"
+homepage = "https://dark.fi"
+repository = "https://codeberg.org/darkrenaissance/darkfi"
 
 [dependencies]
 miniquad = { git = "https://github.com/not-fl3/miniquad" }
@@ -22,8 +23,9 @@ glam = "0.28.0"
 #zmq = "0.10.0"
 #async_zmq = "0.4.0"
 zeromq = { version = "0.4.0", default-features = false, features = ["async-std-runtime", "all-transport"] }
-darkfi-serial = { git = "https://codeberg.org/darkrenaissance/darkfi" }
-darkfi = { git = "https://codeberg.org/darkrenaissance/darkfi", features = ["system"] }
+darkfi = {path = "../../", features = ["async-daemonize", "event-graph", "net", "util", "system", "zk"]}
+#darkfi-sdk = {path = "../../src/sdk", features = ["async"]}
+darkfi-serial = {path = "../../src/serial", features = ["async"]}
 thiserror = "1.0.61"
 smol = "2.0.0"
 atomic_float = "1.0.0"
@@ -40,6 +42,9 @@ sled = "0.34.7"
 [patch.crates-io]
 freetype-rs = { git = "https://github.com/narodnik/freetype-rs" }
 freetype-sys = { git = "https://github.com/narodnik/freetype-sys" }
+# I'm so confused why this is needed
+halo2_proofs = {git="https://github.com/parazyd/halo2", branch="v4"}
+halo2_gadgets = {git="https://github.com/parazyd/halo2", branch="v4"}
 
 [target.'cfg(target_os = "android")'.dependencies]
 android_logger = "0.13.3"

+ 3 - 1
bin/darkwallet/src/expr.rs

@@ -20,7 +20,9 @@ use crate::{
     error::{Error, Result},
     //prop::{Property, PropertySubType, PropertyType, PropertySExprValue},
 };
-use darkfi_serial::{Decodable, Encodable, ReadExt, SerialDecodable, SerialEncodable};
+use darkfi_serial::{
+    async_trait, Decodable, Encodable, FutAsyncWriteExt, ReadExt, SerialDecodable, SerialEncodable,
+};
 use std::io::{Read, Write};
 
 #[derive(Clone, Debug, PartialEq, SerialEncodable, SerialDecodable)]

+ 3 - 1
bin/darkwallet/src/gfx2.rs

@@ -16,7 +16,9 @@
  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
  */
 
-use darkfi_serial::{SerialDecodable, SerialEncodable};
+use darkfi_serial::{
+    async_trait, Decodable, Encodable, FutAsyncWriteExt, ReadExt, SerialDecodable, SerialEncodable,
+};
 use log::debug;
 use miniquad::{
     conf, window, Backend, Bindings, BlendFactor, BlendState, BlendValue, BufferId, BufferLayout,

+ 10 - 0
bin/darkwallet/src/main.rs

@@ -33,6 +33,7 @@ extern crate log;
 use log::LevelFilter;
 
 mod app;
+mod darkirc;
 //mod chatapp;
 //mod chatview;
 //mod editbox;
@@ -64,6 +65,15 @@ fn panic_hook(panic_info: &std::panic::PanicInfo) {
     std::process::exit(1);
 }
 
+fn newmain() {
+    let ex = Arc::new(smol::Executor::new());
+    smol::block_on(async {
+        let mut p2p_settings: darkfi::net::Settings = Default::default();
+        //p2p_settings.app_version = semver::Version::parse(env!("CARGO_PKG_VERSION")).unwrap();
+        let p2p = darkfi::net::P2p::new(p2p_settings, ex.clone()).await.unwrap();
+    });
+}
+
 fn main() {
     // Exit the application on panic right away
     std::panic::set_hook(Box::new(panic_hook));

+ 4 - 1
bin/darkwallet/src/net.rs

@@ -17,7 +17,10 @@
  */
 
 use async_lock::Mutex;
-use darkfi_serial::{deserialize, Decodable, Encodable, SerialDecodable, VarInt};
+use darkfi_serial::{
+    async_trait, deserialize, Decodable, Encodable, FutAsyncWriteExt, ReadExt, SerialDecodable,
+    SerialEncodable, VarInt,
+};
 use std::{
     io::Cursor,
     sync::{mpsc, Arc},

+ 4 - 1
bin/darkwallet/src/prop/mod.rs

@@ -17,7 +17,10 @@
  */
 
 use crate::error::{Error, Result};
-use darkfi_serial::{Encodable, SerialDecodable, SerialEncodable};
+use darkfi_serial::{
+    async_trait, deserialize, Decodable, Encodable, FutAsyncWriteExt, ReadExt, SerialDecodable,
+    SerialEncodable, VarInt,
+};
 use std::{
     io::Write,
     sync::{Arc, Mutex},

+ 4 - 1
bin/darkwallet/src/scene.rs

@@ -18,7 +18,10 @@
 
 use async_channel::Sender;
 use async_lock::Mutex;
-use darkfi_serial::{SerialDecodable, SerialEncodable};
+use darkfi_serial::{
+    async_trait, deserialize, Decodable, Encodable, FutAsyncWriteExt, ReadExt, SerialDecodable,
+    SerialEncodable, VarInt,
+};
 use futures::{stream::FuturesUnordered, StreamExt};
 use std::{fmt, str::FromStr, sync::Arc};
 

+ 4 - 1
bin/darkwallet/src/ui/chatview.rs

@@ -19,7 +19,10 @@
 use async_lock::Mutex as AsyncMutex;
 use atomic_float::AtomicF32;
 use darkfi::system::{msleep, CondVar};
-use darkfi_serial::{deserialize, Decodable, Encodable, SerialDecodable, SerialEncodable};
+use darkfi_serial::{
+    async_trait, deserialize, Decodable, Encodable, FutAsyncWriteExt, ReadExt, SerialDecodable,
+    SerialEncodable, VarInt,
+};
 use miniquad::{KeyCode, KeyMods, TouchPhase};
 use rand::{rngs::OsRng, Rng};
 use std::{