diff --git a/Cargo.lock b/Cargo.lock index bde56ff4..0e9d4fc9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -524,7 +524,7 @@ dependencies = [ "futures-lite", "parking", "polling", - "rustix 1.0.7", + "rustix 1.0.8", "slab", "tracing", "windows-sys 0.59.0", @@ -556,7 +556,7 @@ dependencies = [ "cfg-if", "event-listener", "futures-lite", - "rustix 1.0.7", + "rustix 1.0.8", "tracing", ] @@ -583,7 +583,7 @@ dependencies = [ "cfg-if", "futures-core", "futures-io", - "rustix 1.0.7", + "rustix 1.0.8", "signal-hook-registry", "slab", "windows-sys 0.59.0", @@ -777,7 +777,7 @@ dependencies = [ "serde_json", "serde_path_to_error", "serde_urlencoded", - "sync_wrapper", + "sync_wrapper 1.0.2", "tokio", "tower 0.5.2", "tower-layer", @@ -800,7 +800,7 @@ dependencies = [ "mime", "pin-project-lite", "rustversion", - "sync_wrapper", + "sync_wrapper 1.0.2", "tower-layer", "tower-service", "tracing", @@ -1096,7 +1096,7 @@ dependencies = [ "hmac", "jsonrpc_client", "rand 0.8.5", - "reqwest", + "reqwest 0.12.22", "serde", "serde_json", "sha2 0.10.9", @@ -1912,7 +1912,7 @@ dependencies = [ "bitflags 2.9.1", "core-foundation 0.10.1", "core-graphics-types", - "foreign-types", + "foreign-types 0.5.0", "libc", ] @@ -2578,6 +2578,32 @@ dependencies = [ "unicode-xid", ] +[[package]] +name = "dfx-swiss-sdk" +version = "1.0.0" +source = "git+https://github.com/eigenwallet/dfx-swiss-rs#0b7d5dc88e7c6481c527fb8fb246e863b415e45f" +dependencies = [ + "dfx-swiss-sdk-raw", + "serde", + "serde_derive", + "serde_json", + "thiserror 1.0.69", + "tokio", +] + +[[package]] +name = "dfx-swiss-sdk-raw" +version = "1.0.0" +source = "git+https://github.com/eigenwallet/dfx-swiss-rs#0b7d5dc88e7c6481c527fb8fb246e863b415e45f" +dependencies = [ + "reqwest 0.11.27", + "serde", + "serde_derive", + "serde_json", + "url", + "uuid", +] + [[package]] name = "dialoguer" version = "0.11.0" @@ -3273,6 +3299,15 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared 0.1.1", +] + [[package]] name = "foreign-types" version = "0.5.0" @@ -3280,7 +3315,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d737d9aa519fb7b749cbc3b962edcf310a8dd1f4b67c91c4f83975dbdd17d965" dependencies = [ "foreign-types-macros", - "foreign-types-shared", + "foreign-types-shared 0.3.1", ] [[package]] @@ -3294,6 +3329,12 @@ dependencies = [ "syn 2.0.104", ] +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + [[package]] name = "foreign-types-shared" version = "0.3.1" @@ -4359,6 +4400,19 @@ dependencies = [ "webpki-roots 1.0.1", ] +[[package]] +name = "hyper-tls" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" +dependencies = [ + "bytes", + "hyper 0.14.32", + "native-tls", + "tokio", + "tokio-native-tls", +] + [[package]] name = "hyper-util" version = "0.1.15" @@ -4558,7 +4612,7 @@ dependencies = [ "netlink-proto", "netlink-sys", "rtnetlink", - "system-configuration", + "system-configuration 0.6.1", "tokio", "windows 0.53.0", ] @@ -4881,7 +4935,7 @@ source = "git+https://github.com/delta1/rust-jsonrpc-client.git?rev=3b6081697cd6 dependencies = [ "async-trait", "jsonrpc_client_macro", - "reqwest", + "reqwest 0.12.22", "serde", "serde_json", "url", @@ -5972,7 +6026,7 @@ dependencies = [ "monero-rpc", "monero-sys", "rand 0.8.5", - "reqwest", + "reqwest 0.12.22", "testcontainers", "tokio", "tracing", @@ -6013,7 +6067,7 @@ dependencies = [ "monero", "monero-epee-bin-serde", "rand 0.8.5", - "reqwest", + "reqwest 0.12.22", "rust_decimal", "serde", "serde_json", @@ -6034,7 +6088,7 @@ dependencies = [ "monero-rpc", "rand 0.8.5", "regex", - "reqwest", + "reqwest 0.12.22", "serde", "serde_json", "sqlx", @@ -6165,6 +6219,23 @@ dependencies = [ "unsigned-varint 0.7.2", ] +[[package]] +name = "native-tls" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87de3442987e9dbec73158d5c715e7ad9072fda936bb03d19d7fa10e00520f0e" +dependencies = [ + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework 2.11.1", + "security-framework-sys", + "tempfile", +] + [[package]] name = "ndk" version = "0.9.0" @@ -6753,12 +6824,50 @@ dependencies = [ "pathdiff", ] +[[package]] +name = "openssl" +version = "0.10.73" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8505734d46c8ab1e19a1dce3aef597ad87dcb4c37e7188231769bd6bd51cebf8" +dependencies = [ + "bitflags 2.9.1", + "cfg-if", + "foreign-types 0.3.2", + "libc", + "once_cell", + "openssl-macros", + "openssl-sys", +] + +[[package]] +name = "openssl-macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.104", +] + [[package]] name = "openssl-probe" version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e" +[[package]] +name = "openssl-sys" +version = "0.9.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90096e2e47630d78b7d1c20952dc621f957103f8bc2c8359ec81290d75238571" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] + [[package]] name = "option-ext" version = "0.2.0" @@ -7281,7 +7390,7 @@ dependencies = [ "concurrent-queue", "hermit-abi 0.5.2", "pin-project-lite", - "rustix 1.0.7", + "rustix 1.0.8", "tracing", "windows-sys 0.59.0", ] @@ -7955,6 +8064,47 @@ dependencies = [ "bytecheck", ] +[[package]] +name = "reqwest" +version = "0.11.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd67538700a17451e7cba03ac727fb961abb7607553461627b97de0b89cf4a62" +dependencies = [ + "base64 0.21.7", + "bytes", + "encoding_rs", + "futures-core", + "futures-util", + "h2 0.3.27", + "http 0.2.12", + "http-body 0.4.6", + "hyper 0.14.32", + "hyper-tls", + "ipnet", + "js-sys", + "log", + "mime", + "mime_guess", + "native-tls", + "once_cell", + "percent-encoding", + "pin-project-lite", + "rustls-pemfile", + "serde", + "serde_json", + "serde_urlencoded", + "sync_wrapper 0.1.2", + "system-configuration 0.5.1", + "tokio", + "tokio-native-tls", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "winreg 0.50.0", +] + [[package]] name = "reqwest" version = "0.12.22" @@ -7983,7 +8133,7 @@ dependencies = [ "serde", "serde_json", "serde_urlencoded", - "sync_wrapper", + "sync_wrapper 1.0.2", "tokio", "tokio-rustls 0.26.2", "tokio-util", @@ -8234,15 +8384,15 @@ dependencies = [ [[package]] name = "rustix" -version = "1.0.7" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c71e83d6afe7ff64890ec6b71d6a69bb8a610ab78ce364b3352876bb4c801266" +checksum = "11181fbabf243db407ef8df94a6ce0b2f9a733bd8be4ad02b4eda9602296cac8" dependencies = [ "bitflags 2.9.1", "errno", "libc", "linux-raw-sys 0.9.4", - "windows-sys 0.59.0", + "windows-sys 0.60.2", ] [[package]] @@ -8321,6 +8471,15 @@ dependencies = [ "security-framework 3.2.0", ] +[[package]] +name = "rustls-pemfile" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" +dependencies = [ + "base64 0.21.7", +] + [[package]] name = "rustls-pki-types" version = "1.12.0" @@ -9264,7 +9423,7 @@ dependencies = [ "bytemuck", "cfg_aliases", "core-graphics", - "foreign-types", + "foreign-types 0.5.0", "js-sys", "log", "objc2 0.5.2", @@ -9744,6 +9903,7 @@ dependencies = [ "curve25519-dalek-ng", "data-encoding", "derive_builder", + "dfx-swiss-sdk", "dialoguer", "ecdsa_fun", "ed25519-dalek 1.0.1", @@ -9768,7 +9928,7 @@ dependencies = [ "rand 0.8.5", "rand_chacha 0.3.1", "regex", - "reqwest", + "reqwest 0.12.22", "rust_decimal", "rust_decimal_macros", "rustls 0.23.29", @@ -9911,6 +10071,12 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "sync_wrapper" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" + [[package]] name = "sync_wrapper" version = "1.0.2" @@ -9943,6 +10109,17 @@ dependencies = [ "syn 2.0.104", ] +[[package]] +name = "system-configuration" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" +dependencies = [ + "bitflags 1.3.2", + "core-foundation 0.9.4", + "system-configuration-sys 0.5.0", +] + [[package]] name = "system-configuration" version = "0.6.1" @@ -9951,7 +10128,17 @@ checksum = "3c879d448e9d986b661742763247d3693ed13609438cf3d006f51f5368a5ba6b" dependencies = [ "bitflags 2.9.1", "core-foundation 0.9.4", - "system-configuration-sys", + "system-configuration-sys 0.6.0", +] + +[[package]] +name = "system-configuration-sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" +dependencies = [ + "core-foundation-sys", + "libc", ] [[package]] @@ -10084,7 +10271,7 @@ dependencies = [ "percent-encoding", "plist", "raw-window-handle", - "reqwest", + "reqwest 0.12.22", "serde", "serde_json", "serde_repr", @@ -10356,7 +10543,7 @@ dependencies = [ "minisign-verify", "osakit", "percent-encoding", - "reqwest", + "reqwest 0.12.22", "semver", "serde", "serde_json", @@ -10480,7 +10667,7 @@ dependencies = [ "fastrand", "getrandom 0.3.3", "once_cell", - "rustix 1.0.7", + "rustix 1.0.8", "windows-sys 0.59.0", ] @@ -10707,6 +10894,16 @@ dependencies = [ "syn 2.0.104", ] +[[package]] +name = "tokio-native-tls" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" +dependencies = [ + "native-tls", + "tokio", +] + [[package]] name = "tokio-rustls" version = "0.22.0" @@ -11890,7 +12087,7 @@ dependencies = [ "futures-core", "futures-util", "pin-project-lite", - "sync_wrapper", + "sync_wrapper 1.0.2", "tokio", "tower-layer", "tower-service", @@ -12363,6 +12560,7 @@ name = "unstoppableswap-gui-rs" version = "3.0.0-beta.2" dependencies = [ "anyhow", + "dfx-swiss-sdk", "monero-rpc-pool", "rustls 0.23.29", "serde", @@ -12379,6 +12577,8 @@ dependencies = [ "tauri-plugin-single-instance", "tauri-plugin-store", "tauri-plugin-updater", + "tokio", + "tokio-util", "tracing", "uuid", "zip 4.3.0", @@ -13667,7 +13867,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af3a19837351dc82ba89f8a125e22a3c475f05aba604acc023d62b2739ae2909" dependencies = [ "libc", - "rustix 1.0.7", + "rustix 1.0.8", ] [[package]] diff --git a/src-gui/src/assets/dfx-logo.svg b/src-gui/src/assets/dfx-logo.svg new file mode 100644 index 00000000..1cb68c9d --- /dev/null +++ b/src-gui/src/assets/dfx-logo.svg @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src-gui/src/renderer/components/pages/monero/components/DFXWidget.tsx b/src-gui/src/renderer/components/pages/monero/components/DFXWidget.tsx new file mode 100644 index 00000000..d32f967e --- /dev/null +++ b/src-gui/src/renderer/components/pages/monero/components/DFXWidget.tsx @@ -0,0 +1,105 @@ +import { + Box, + Dialog, + DialogTitle, + Button, + DialogContent, + Chip, + Tooltip, +} from "@mui/material"; +import { EuroSymbol as EuroIcon } from "@mui/icons-material"; +import DFXSwissLogo from "assets/dfx-logo.svg"; +import { useState } from "react"; +import { dfxAuthenticate } from "renderer/rpc"; + +function DFXLogo({ height = 24 }: { height?: number }) { + return ( + + DFX Swiss + + ); +} + +// Component for DFX button and modal +export default function DfxButton() { + const [dfxUrl, setDfxUrl] = useState(null); + + const handleOpenDfx = async () => { + try { + // Get authentication token and URL (this will initialize DFX if needed) + const response = await dfxAuthenticate(); + setDfxUrl(response.kyc_url); + return response; + } catch (error) { + console.error("DFX authentication failed:", error); + // TODO: Show error snackbar if needed + throw error; + } + }; + + const handleCloseModal = () => { + setDfxUrl(null); + }; + + return ( + <> + + } + label="Buy Monero" + clickable + onClick={handleOpenDfx} + /> + + + + + + + + + + + {dfxUrl && ( +