diff --git a/.gitignore b/.gitignore index 31708a2..f5507e3 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,8 @@ .cxx local.properties *.so +keystore +keystore.properties # Added by cargo /target diff --git a/Cargo.lock b/Cargo.lock index 508d8e3..6c6ca53 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -184,6 +184,12 @@ dependencies = [ "memchr", ] +[[package]] +name = "aligned-vec" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4aa90d7ce82d4be67b64039a3d588d38dbcc6736577de4a847025ce5b0c468d1" + [[package]] name = "allocator-api2" version = "0.2.18" @@ -250,6 +256,18 @@ dependencies = [ "libc", ] +[[package]] +name = "anyhow" +version = "1.0.82" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f538837af36e6f6a9be0faa67f9a314f8119e4e4b5867c6ab40ed60360142519" + +[[package]] +name = "arbitrary" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d5a26814d8dcb93b0e5a0ff3c6d80a8843bafb21b39e8e18a6f05471870e110" + [[package]] name = "arboard" version = "3.3.2" @@ -258,7 +276,7 @@ checksum = "a2041f1943049c7978768d84e6d0fd95de98b76d6c4727b09e78ec253d29fa58" dependencies = [ "clipboard-win", "core-graphics", - "image", + "image 0.24.9", "log", "objc", "objc-foundation", @@ -281,6 +299,17 @@ version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "69f7f8c3906b62b754cd5326047894316021dcfe5a194c8ea52bdd94934a3457" +[[package]] +name = "arg_enum_proc_macro" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ae92a5119aa49cdbcf6b9f893fe4e1d98b04ccbf82ee0584ad948a44a734dea" +dependencies = [ + "proc-macro2 1.0.79", + "quote 1.0.36", + "syn 2.0.58", +] + [[package]] name = "arrayref" version = "0.3.7" @@ -572,6 +601,29 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80" +[[package]] +name = "av1-grain" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6678909d8c5d46a42abcf571271e15fdbc0a225e3646cf23762cd415046c78bf" +dependencies = [ + "anyhow", + "arrayvec 0.7.4", + "log", + "nom", + "num-rational 0.4.1", + "v_frame", +] + +[[package]] +name = "avif-serialize" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "876c75a42f6364451a033496a14c44bffe41f5f4a8236f697391f11024e596d2" +dependencies = [ + "arrayvec 0.7.4", +] + [[package]] name = "backtrace" version = "0.3.71" @@ -648,6 +700,12 @@ version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" +[[package]] +name = "bit_field" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc827186963e592360843fb5ba4b973e145841266c1357f7180c43526f2e5b61" + [[package]] name = "bitflags" version = "0.9.1" @@ -666,6 +724,12 @@ version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" +[[package]] +name = "bitstream-io" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06c9989a51171e2e81038ab168b6ae22886fe9ded214430dbb4f41c28cf176da" + [[package]] name = "blake2-rfc" version = "0.2.18" @@ -902,6 +966,16 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c" +[[package]] +name = "cfg-expr" +version = "0.15.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d067ad48b8650848b989a59a86c6c36a995d02d2bf778d45c3c5d57bc2718f02" +dependencies = [ + "smallvec", + "target-lexicon", +] + [[package]] name = "cfg-if" version = "0.1.10" @@ -1225,6 +1299,12 @@ version = "0.8.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345" +[[package]] +name = "crunchy" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" + [[package]] name = "crypto-common" version = "0.1.6" @@ -1489,7 +1569,7 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a6368dbd2c6685fb84fc6e6a4749917ddc98905793fd06341c7e11a2504f2724" dependencies = [ - "heck", + "heck 0.3.3", "proc-macro2 0.4.30", "quote 0.6.13", "syn 0.15.44", @@ -1544,7 +1624,7 @@ dependencies = [ "glow", "glutin", "glutin-winit", - "image", + "image 0.24.9", "js-sys", "log", "objc", @@ -1621,7 +1701,7 @@ checksum = "1b78779f35ded1a853786c9ce0b43fe1053e10a21ea3b23ebea411805ce41593" dependencies = [ "egui", "enum-map", - "image", + "image 0.24.9", "log", "mime_guess2", "serde", @@ -1847,6 +1927,22 @@ dependencies = [ "pin-project-lite 0.2.14", ] +[[package]] +name = "exr" +version = "1.72.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "887d93f60543e9a9362ef8a21beedd0a833c5d9610e18c67abe15a5963dcb1a4" +dependencies = [ + "bit_field", + "flume", + "half", + "lebe", + "miniz_oxide", + "rayon-core", + "smallvec", + "zune-inflate", +] + [[package]] name = "fake-simd" version = "0.1.2" @@ -1940,6 +2036,15 @@ dependencies = [ "thiserror", ] +[[package]] +name = "flume" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55ac459de2512911e4b674ce33cf20befaba382d05b62b008afc1c8b57cbf181" +dependencies = [ + "spin 0.9.8", +] + [[package]] name = "fnv" version = "1.0.7" @@ -2209,6 +2314,16 @@ dependencies = [ "wasi 0.11.0+wasi-snapshot-preview1", ] +[[package]] +name = "gif" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fb2d69b19215e18bb912fa30f7ce15846e301408695e44e0ef719f1da9e19f2" +dependencies = [ + "color_quant", + "weezl", +] + [[package]] name = "gimli" version = "0.28.1" @@ -2426,6 +2541,7 @@ dependencies = [ "grin_wallet_impls", "grin_wallet_libwallet", "grin_wallet_util", + "image 0.25.1", "jni", "lazy_static", "local-ip-address", @@ -2532,7 +2648,7 @@ dependencies = [ "log", "lru-cache", "num", - "num-bigint", + "num-bigint 0.2.6", "rand 0.6.5", "serde", "serde_derive", @@ -2823,7 +2939,7 @@ dependencies = [ "grin_wallet_util", "lazy_static", "log", - "num-bigint", + "num-bigint 0.2.6", "rand 0.6.5", "regex", "secrecy 0.6.0", @@ -2873,6 +2989,16 @@ dependencies = [ "tracing-futures", ] +[[package]] +name = "half" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dd08c532ae367adf81c312a4580bc67f1d0fe8bc9c460520283f4c0ff277888" +dependencies = [ + "cfg-if 1.0.0", + "crunchy", +] + [[package]] name = "hashbrown" version = "0.12.3" @@ -2913,6 +3039,12 @@ dependencies = [ "unicode-segmentation", ] +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + [[package]] name = "hermit-abi" version = "0.3.9" @@ -3008,7 +3140,7 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "df004cfca50ef23c36850aaaa59ad52cc70d0e90243c3c7737a4dd32dc7a3c4f" dependencies = [ - "quick-error", + "quick-error 1.2.3", ] [[package]] @@ -3243,6 +3375,45 @@ dependencies = [ "tiff", ] +[[package]] +name = "image" +version = "0.25.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd54d660e773627692c524beaad361aca785a4f9f5730ce91f42aabe5bce3d11" +dependencies = [ + "bytemuck", + "byteorder", + "color_quant", + "exr", + "gif", + "image-webp", + "num-traits 0.2.18", + "png", + "qoi", + "ravif", + "rayon", + "rgb", + "tiff", + "zune-core", + "zune-jpeg", +] + +[[package]] +name = "image-webp" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a84a25dcae3ac487bc24ef280f9e20c79c9b1a3e5e32cbed3041d1c514aa87c" +dependencies = [ + "byteorder", + "thiserror", +] + +[[package]] +name = "imgref" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44feda355f4159a7c757171a77de25daf6411e217b4cabd03bd6650690468126" + [[package]] name = "indexmap" version = "1.9.3" @@ -3272,6 +3443,17 @@ dependencies = [ "cfg-if 1.0.0", ] +[[package]] +name = "interpolate_name" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c34819042dc3d3971c46c2190835914dfbe0c3c13f61449b2997f4e9722dfa60" +dependencies = [ + "proc-macro2 1.0.79", + "quote 1.0.36", + "syn 2.0.58", +] + [[package]] name = "intl-memoizer" version = "0.5.1" @@ -3328,6 +3510,15 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "itertools" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" +dependencies = [ + "either", +] + [[package]] name = "itoa" version = "0.4.8" @@ -3441,12 +3632,29 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +[[package]] +name = "lebe" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03087c2bad5e1034e8cace5926dec053fb3790248370865f5117a7d0213354c8" + [[package]] name = "libc" version = "0.2.153" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" +[[package]] +name = "libfuzzer-sys" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a96cfd5557eb82f2b83fed4955246c988d331975a002961b07c81584d107e7f7" +dependencies = [ + "arbitrary", + "cc", + "once_cell", +] + [[package]] name = "libgit2-sys" version = "0.16.2+1.7.2" @@ -3629,6 +3837,15 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "loop9" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fae87c125b03c1d2c0150c90365d7d6bcc53fb73a9acaef207d2d065860f062" +dependencies = [ + "imgref", +] + [[package]] name = "lru-cache" version = "0.1.2" @@ -3647,6 +3864,16 @@ dependencies = [ "libc", ] +[[package]] +name = "maybe-rayon" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ea1f30cedd69f0a2954655f7188c6a834246d2bcf1e315e2ac40c4b24dc9519" +dependencies = [ + "cfg-if 1.0.0", + "rayon", +] + [[package]] name = "memchr" version = "2.7.2" @@ -3926,6 +4153,12 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "new_debug_unreachable" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086" + [[package]] name = "nix" version = "0.26.4" @@ -3960,6 +4193,12 @@ dependencies = [ "minimal-lexical", ] +[[package]] +name = "noop_proc_macro" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0676bb32a98c1a483ce53e500a81ad9c3d5b3f7c920c28c24e9cb0980d0b5bc8" + [[package]] name = "normpath" version = "1.2.0" @@ -3984,11 +4223,11 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b8536030f9fea7127f841b45bb6243b27255787fb4eb83958aa1ef9d2fdc0c36" dependencies = [ - "num-bigint", + "num-bigint 0.2.6", "num-complex", "num-integer", "num-iter", - "num-rational", + "num-rational 0.2.4", "num-traits 0.2.18", ] @@ -4003,6 +4242,17 @@ dependencies = [ "num-traits 0.2.18", ] +[[package]] +name = "num-bigint" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" +dependencies = [ + "autocfg 1.2.0", + "num-integer", + "num-traits 0.2.18", +] + [[package]] name = "num-complex" version = "0.2.4" @@ -4013,6 +4263,17 @@ dependencies = [ "num-traits 0.2.18", ] +[[package]] +name = "num-derive" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" +dependencies = [ + "proc-macro2 1.0.79", + "quote 1.0.36", + "syn 2.0.58", +] + [[package]] name = "num-integer" version = "0.1.46" @@ -4040,7 +4301,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c000134b5dbf44adc5cb772486d335293351644b801551abe8f75c84cfa4aef" dependencies = [ "autocfg 1.2.0", - "num-bigint", + "num-bigint 0.2.6", + "num-integer", + "num-traits 0.2.18", +] + +[[package]] +name = "num-rational" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" +dependencies = [ + "autocfg 1.2.0", + "num-bigint 0.4.4", "num-integer", "num-traits 0.2.18", ] @@ -4617,6 +4890,28 @@ name = "profiling" version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "43d84d1d7a6ac92673717f9f6d1518374ef257669c24ebc5ac25d5033828be58" +dependencies = [ + "profiling-procmacros", +] + +[[package]] +name = "profiling-procmacros" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8021cf59c8ec9c432cfc2526ac6b8aa508ecaf29cd415f271b8406c1b851c3fd" +dependencies = [ + "quote 1.0.36", + "syn 2.0.58", +] + +[[package]] +name = "qoi" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f6d64c71eb498fe9eae14ce4ec935c555749aef511cca85b5568910d6e48001" +dependencies = [ + "bytemuck", +] [[package]] name = "qr_code" @@ -4630,6 +4925,12 @@ version = "1.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" +[[package]] +name = "quick-error" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3" + [[package]] name = "quick-xml" version = "0.31.0" @@ -4847,6 +5148,56 @@ dependencies = [ "rand_core 0.3.1", ] +[[package]] +name = "rav1e" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd87ce80a7665b1cce111f8a16c1f3929f6547ce91ade6addf4ec86a8dda5ce9" +dependencies = [ + "arbitrary", + "arg_enum_proc_macro", + "arrayvec 0.7.4", + "av1-grain", + "bitstream-io", + "built", + "cfg-if 1.0.0", + "interpolate_name", + "itertools", + "libc", + "libfuzzer-sys", + "log", + "maybe-rayon", + "new_debug_unreachable", + "noop_proc_macro", + "num-derive", + "num-traits 0.2.18", + "once_cell", + "paste", + "profiling", + "rand 0.8.5", + "rand_chacha 0.3.1", + "simd_helpers", + "system-deps", + "thiserror", + "v_frame", + "wasm-bindgen", +] + +[[package]] +name = "ravif" +version = "0.11.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc13288f5ab39e6d7c9d501759712e6969fcc9734220846fc9ed26cae2cc4234" +dependencies = [ + "avif-serialize", + "imgref", + "loop9", + "quick-error 2.0.1", + "rav1e", + "rayon", + "rgb", +] + [[package]] name = "raw-window-handle" version = "0.5.2" @@ -4998,6 +5349,15 @@ dependencies = [ "winreg", ] +[[package]] +name = "rgb" +version = "0.8.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05aaa8004b64fd573fc9d002f4e632d51ad4f026c2b5ba95fcb6c2f32c2c47d8" +dependencies = [ + "bytemuck", +] + [[package]] name = "ring" version = "0.16.20" @@ -5007,7 +5367,7 @@ dependencies = [ "cc", "libc", "once_cell", - "spin", + "spin 0.5.2", "untrusted", "web-sys", "winapi 0.3.9", @@ -5526,6 +5886,15 @@ version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe" +[[package]] +name = "simd_helpers" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95890f873bec569a0362c235787f3aca6e1e887302ba4840839bcc6459c42da6" +dependencies = [ + "quote 1.0.36", +] + [[package]] name = "siphasher" version = "0.3.11" @@ -5638,6 +6007,15 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" +[[package]] +name = "spin" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" +dependencies = [ + "lock_api 0.4.11", +] + [[package]] name = "spirv" version = "0.3.0+sdk-1.3.268.0" @@ -5677,7 +6055,7 @@ version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "87c85aa3f8ea653bfd3ddf25f7ee357ee4d204731f6aa9ad04002306f6e2774c" dependencies = [ - "heck", + "heck 0.3.3", "proc-macro2 1.0.79", "quote 1.0.36", "syn 1.0.109", @@ -5752,6 +6130,25 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "system-deps" +version = "6.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3e535eb8dded36d55ec13eddacd30dec501792ff23a0b1682c38601b8cf2349" +dependencies = [ + "cfg-expr", + "heck 0.5.0", + "pkg-config", + "toml 0.8.12", + "version-compare", +] + +[[package]] +name = "target-lexicon" +version = "0.12.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1fc403891a21bcfb7c37834ba66a547a8f402146eba7265b5a6d88059c9ff2f" + [[package]] name = "tempfile" version = "3.10.1" @@ -6366,12 +6763,29 @@ dependencies = [ "serde", ] +[[package]] +name = "v_frame" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6f32aaa24bacd11e488aa9ba66369c7cd514885742c9fe08cfe85884db3e92b" +dependencies = [ + "aligned-vec", + "num-traits 0.2.18", + "wasm-bindgen", +] + [[package]] name = "vcpkg" version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" +[[package]] +name = "version-compare" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "852e951cb7832cb45cb1169900d19760cfa39b82bc0ea9c0e5a14ae88411c98b" + [[package]] name = "version_check" version = "0.9.4" @@ -7380,6 +7794,30 @@ dependencies = [ "thiserror", ] +[[package]] +name = "zune-core" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f423a2c17029964870cfaabb1f13dfab7d092a62a29a89264f4d36990ca414a" + +[[package]] +name = "zune-inflate" +version = "0.2.54" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73ab332fe2f6680068f3582b16a24f90ad7096d5d39b974d1c0aff0125116f02" +dependencies = [ + "simd-adler32", +] + +[[package]] +name = "zune-jpeg" +version = "0.4.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec866b44a2a1fd6133d363f073ca1b179f438f99e7e5bfb1e33f7181facfe448" +dependencies = [ + "zune-core", +] + [[package]] name = "zvariant" version = "3.15.2" diff --git a/Cargo.toml b/Cargo.toml index 30de838..4efef2d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -47,8 +47,9 @@ toml = "0.8.2" serde = "1.0.170" local-ip-address = "0.6.1" url = "2.4.0" +image = "0.25.1" -# stratum server +## stratum server serde_derive = "1.0.197" serde_json = "1.0.115" tokio = {version = "1.29.1", features = ["full"] } diff --git a/app/build.gradle b/app/build.gradle index 1431656..db59bf7 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -2,6 +2,10 @@ plugins { id 'com.android.application' } +def keystorePropertiesFile = rootProject.file("keystore.properties") +def keystoreProperties = new Properties() +keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) + android { compileSdk 33 ndkVersion '26.0.10792818' @@ -14,10 +18,20 @@ android { versionName "0.1.0" } + signingConfigs { + release { + keyAlias keystoreProperties['keyAlias'] + keyPassword keystoreProperties['keyPassword'] + storeFile file(keystoreProperties['storeFile']) + storePassword keystoreProperties['storePassword'] + } + } + buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + signingConfig signingConfigs.release } debug { minifyEnabled false diff --git a/img/icon.png b/img/icon.png new file mode 100644 index 0000000..eab6886 Binary files /dev/null and b/img/icon.png differ diff --git a/locales/en.yml b/locales/en.yml index bc5287a..67fa5c7 100644 --- a/locales/en.yml +++ b/locales/en.yml @@ -48,6 +48,7 @@ wallets: loading: Loading closing: Closing checking: Checking + default_wallet: Default wallet wallet_loading: Loading wallet wallet_closing: Closing wallet wallet_checking: Checking wallet diff --git a/locales/ru.yml b/locales/ru.yml index 40bffd5..1427e5f 100644 --- a/locales/ru.yml +++ b/locales/ru.yml @@ -48,6 +48,7 @@ wallets: loading: Загружается closing: Закрывается checking: Проверяется + default_wallet: Стандартный кошелёк wallet_loading: Загрузка кошелька wallet_closing: Закрытие кошелька wallet_checking: Проверка кошелька diff --git a/src/config.rs b/src/config.rs index 880489c..93b72b0 100644 --- a/src/config.rs +++ b/src/config.rs @@ -18,11 +18,11 @@ use crate::node::NodeConfig; use crate::Settings; use crate::wallet::ConnectionsConfig; -/// Application configuration. +/// Application configuration, stored at toml file. #[derive(Serialize, Deserialize)] pub struct AppConfig { /// Run node server on startup. - pub auto_start_node: bool, + pub(crate) auto_start_node: bool, /// Chain type for node and wallets. pub(crate) chain_type: ChainTypes, @@ -30,8 +30,19 @@ pub struct AppConfig { show_wallets_at_dual_panel: bool, /// Flag to show all connections at network panel or integrated node info. show_connections_network_panel: bool, + + /// Width of the desktop window. + width: f32, + /// Height of the desktop window. + height: f32, + + /// Position of the desktop window. + x: Option, y: Option } +pub const DEFAULT_WIDTH: f32 = 1200.0; +pub const DEFAULT_HEIGHT: f32 = 720.0; + impl Default for AppConfig { fn default() -> Self { Self { @@ -39,6 +50,10 @@ impl Default for AppConfig { chain_type: ChainTypes::default(), show_wallets_at_dual_panel: false, show_connections_network_panel: false, + width: DEFAULT_WIDTH, + height: DEFAULT_HEIGHT, + x: None, + y: None, } } } @@ -124,4 +139,35 @@ impl AppConfig { w_app_config.show_connections_network_panel = !show; w_app_config.save(); } + + /// Save desktop window width and height. + pub fn save_window_size(w: f32, h: f32) { + let mut w_app_config = Settings::app_config_to_update(); + w_app_config.width = w; + w_app_config.height = h; + w_app_config.save(); + } + + /// Get desktop window width and height. + pub fn window_size() -> (f32, f32) { + let r_config = Settings::app_config_to_read(); + (r_config.width, r_config.height) + } + + /// Save desktop window position. + pub fn save_window_pos(x: f32, y: f32) { + let mut w_app_config = Settings::app_config_to_update(); + w_app_config.x = Some(x); + w_app_config.y = Some(y); + w_app_config.save(); + } + + /// Get desktop window position. + pub fn window_pos() -> Option<(f32, f32)> { + let r_config = Settings::app_config_to_read(); + if r_config.x.is_some() && r_config.y.is_some() { + return Some((r_config.x.unwrap(), r_config.y.unwrap())) + } + None + } } \ No newline at end of file diff --git a/src/gui/app.rs b/src/gui/app.rs index 93e81d1..c59d242 100644 --- a/src/gui/app.rs +++ b/src/gui/app.rs @@ -17,6 +17,7 @@ use std::sync::atomic::{AtomicBool, Ordering}; use egui::{Context, Modifiers}; use lazy_static::lazy_static; +use crate::AppConfig; use crate::gui::Colors; use crate::gui::platform::PlatformCallbacks; use crate::gui::views::Root; @@ -59,6 +60,15 @@ impl eframe::App for PlatformApp { if !self.root.exit_allowed { ctx.send_viewport_cmd(egui::ViewportCommand::CancelClose); Root::show_exit_modal(); + } else { + ctx.input(|i| { + if let Some(rect) = i.viewport().inner_rect { + AppConfig::save_window_size(rect.width(), rect.height()); + } + if let Some(rect) = i.viewport().outer_rect { + AppConfig::save_window_pos(rect.left(), rect.top()); + } + }); } } diff --git a/src/gui/views/root.rs b/src/gui/views/root.rs index b91598c..fba6d4f 100644 --- a/src/gui/views/root.rs +++ b/src/gui/views/root.rs @@ -22,6 +22,7 @@ use crate::gui::platform::PlatformCallbacks; use crate::gui::views::{Modal, NetworkContent, View, WalletsContent}; use crate::gui::views::types::ModalContainer; use crate::node::Node; +use crate::AppConfig; lazy_static! { /// Global state to check if [`NetworkContent`] panel is open. @@ -200,6 +201,11 @@ impl Root { ui.columns(2, |columns| { columns[0].vertical_centered_justified(|ui| { + View::button(ui, t!("modal.cancel"), Colors::WHITE, || { + modal.close(); + }); + }); + columns[1].vertical_centered_justified(|ui| { View::button_ui(ui, t!("modal_exit.exit"), Colors::WHITE, |ui| { if !Node::is_running() { self.exit_allowed = true; @@ -212,11 +218,6 @@ impl Root { } }); }); - columns[1].vertical_centered_justified(|ui| { - View::button(ui, t!("modal.cancel"), Colors::WHITE, || { - modal.close(); - }); - }); }); ui.add_space(6.0); }); diff --git a/src/gui/views/views.rs b/src/gui/views/views.rs index 01a8894..05924c5 100644 --- a/src/gui/views/views.rs +++ b/src/gui/views/views.rs @@ -18,7 +18,7 @@ use std::sync::{Arc, RwLock}; use lazy_static::lazy_static; use egui::{Align, Button, CursorIcon, Layout, PointerState, Rect, Response, RichText, Sense, Spinner, TextBuffer, TextStyle, Widget}; -use egui::epaint::{CircleShape, Color32, FontId, RectShape, Rounding, Stroke}; +use egui::epaint::{Color32, FontId, RectShape, Rounding, Stroke}; use egui::epaint::text::TextWrapping; use egui::os::OperatingSystem; use egui::text::{LayoutJob, TextFormat}; @@ -271,46 +271,6 @@ impl View { }); } - /// Draw circle [`Button`] with icon. - pub fn circle_button(ui: &mut egui::Ui, icon: &'static str, action: impl FnOnce()) { - ui.scope(|ui| { - // Setup colors. - ui.visuals_mut().widgets.inactive.bg_fill = Colors::GOLD; - ui.visuals_mut().widgets.hovered.bg_fill = Colors::GOLD; - ui.visuals_mut().widgets.active.bg_fill = Colors::YELLOW; - - // Setup radius. - let mut r = 44.0 * 0.5; - let size = egui::Vec2::splat(2.0 * r + 5.0); - let (rect, mut br) = ui.allocate_at_least(size, Sense::click_and_drag()); - br = br.on_hover_cursor(CursorIcon::PointingHand); - - let mut icon_color = Colors::TEXT; - - // Increase radius and change icon size and color on-hover. - if br.hovered() { - r = r * 1.04; - icon_color = Colors::TITLE; - } - - let visuals = ui.style().interact(&br); - ui.painter().add(CircleShape { - center: rect.center(), - radius: r, - fill: visuals.bg_fill, - stroke: Self::DEFAULT_STROKE - }); - ui.allocate_ui_at_rect(rect, |ui| { - ui.centered_and_justified(|ui| { - ui.label(RichText::new(icon).color(icon_color).size(25.0)); - }); - }); - if Self::touched(ui, br) { - (action)(); - } - }); - } - /// Default height of [`egui::TextEdit`] view. const TEXT_EDIT_HEIGHT: f32 = 37.0; @@ -524,7 +484,7 @@ impl View { pub fn center_content(ui: &mut egui::Ui, height: f32, content: impl FnOnce(&mut egui::Ui)) { ui.vertical_centered(|ui| { let mut rect = ui.available_rect_before_wrap(); - let side_margin = 24.0; + let side_margin = 28.0; rect.min += egui::emath::vec2(side_margin, ui.available_height() / 2.0 - height / 2.0); rect.max -= egui::emath::vec2(side_margin, 0.0); ui.allocate_ui_at_rect(rect, |ui| { diff --git a/src/gui/views/wallets/content.rs b/src/gui/views/wallets/content.rs index 2024329..a520b03 100644 --- a/src/gui/views/wallets/content.rs +++ b/src/gui/views/wallets/content.rs @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -use egui::{Align, Align2, Id, Layout, Margin, RichText, Rounding, ScrollArea, Widget}; +use egui::{Align, Id, Layout, Margin, RichText, Rounding, ScrollArea, Widget}; use crate::AppConfig; use crate::gui::Colors; @@ -159,13 +159,43 @@ impl WalletsContent { } }); + // Flag to check if wallet list is hidden on the screen. + let list_hidden = content_width == 0.0 + || (dual_panel && show_wallet && !self.show_wallets_at_dual_panel) + || (!dual_panel && show_wallet); + + // Setup flag to show wallets bottom panel if wallet is not showing + // at non-dual panel mode and network is no open or showing at dual panel mode. + let show_bottom_panel = + (!show_wallet && !dual_panel && !Root::is_network_panel_open()) || + (dual_panel && show_wallet); + + // Show wallets bottom panel. + egui::TopBottomPanel::bottom("wallets_bottom_panel") + .frame(egui::Frame { + fill: Colors::FILL, + stroke: View::DEFAULT_STROKE, + inner_margin: Margin { + left: View::get_left_inset() + 4.0, + right: View::far_right_inset_margin(ui) + 4.0, + top: 4.0, + bottom: View::get_bottom_inset() + 4.0, + }, + ..Default::default() + }) + .show_animated_inside(ui, !list_hidden && show_bottom_panel, |ui| { + // Setup vertical padding inside buttons. + ui.style_mut().spacing.button_padding = egui::vec2(10.0, 4.0); + + ui.vertical_centered(|ui| { + View::tab_button(ui, PLUS, false, || { + self.creation_content.show_name_pass_modal(cb); + }); + }); + }); + // Show non-empty list if wallet is not creating. if !empty_list && !create_wallet { - // Flag to check if wallet list is hidden on the screen. - let list_hidden = content_width == 0.0 - || (dual_panel && show_wallet && !self.show_wallets_at_dual_panel) - || (!dual_panel && show_wallet); - // Show wallet list panel. egui::CentralPanel::default() .frame(egui::Frame { @@ -192,23 +222,8 @@ impl WalletsContent { if list_hidden { return; } - - // Setup flag to show wallet creation button if wallet is not showing - // at non-dual panel mode or showing at dual panel mode. - let show_creation_button - = (!show_wallet && !dual_panel) || (dual_panel && show_wallet); - // Show list of wallets. - let scroll = - self.wallet_list_ui(ui, dual_panel, show_creation_button, cb); - - if show_creation_button { - // Setup right margin for button. - let mut right_margin = if dual_panel { wallet_panel_width } else { 0.0 }; - if scroll { right_margin += 6.0 } - // Show wallet creation button. - self.create_wallet_btn_ui(ui, right_margin, cb); - } + self.wallet_list_ui(ui, dual_panel, cb); }); } } @@ -309,13 +324,11 @@ impl WalletsContent { } } - /// Draw list of wallets. Returns `true` if scroller is showing. + /// Draw list of wallets. fn wallet_list_ui(&mut self, ui: &mut egui::Ui, dual_panel: bool, - show_creation_btn: bool, - cb: &dyn PlatformCallbacks) -> bool { - let mut scroller_showing = false; + cb: &dyn PlatformCallbacks) { ui.scope(|ui| { // Setup scroll bar color. ui.style_mut().visuals.widgets.inactive.bg_fill = Colors::ITEM_HOVER; @@ -344,22 +357,14 @@ impl WalletsContent { self.wallets.select(Some(wallet.get_config().id)); self.show_open_wallet_modal(cb); } - // Draw wallet list item. self.wallet_item_ui(ui, wallet, cb); ui.add_space(5.0); } - // Add space for wallet creation button. - if show_creation_btn { - ui.add_space(52.0); - } }); }); }); - // Scroller is showing if content size is larger than content on the screen. - scroller_showing = scroll.content_size.y > scroll.inner_rect.size().y; }); - scroller_showing } /// Draw wallet list item. @@ -485,24 +490,6 @@ impl WalletsContent { }); } - /// Draw floating button to show wallet creation [`Modal`]. - fn create_wallet_btn_ui(&mut self, - ui: &mut egui::Ui, - right_margin: f32, - cb: &dyn PlatformCallbacks) { - egui::Window::new("create_wallet_button") - .title_bar(false) - .resizable(false) - .collapsible(false) - .anchor(Align2::RIGHT_BOTTOM, egui::Vec2::new(-6.0 - right_margin, -6.0)) - .frame(egui::Frame::default()) - .show(ui.ctx(), |ui| { - View::circle_button(ui, PLUS, || { - self.creation_content.show_name_pass_modal(cb); - }); - }); - } - /// Show [`Modal`] to open selected wallet. pub fn show_open_wallet_modal(&mut self, cb: &dyn PlatformCallbacks) { // Reset modal values. @@ -599,8 +586,14 @@ impl WalletsContent { let can_go_back = self.creation_content.can_go_back(); if can_go_back { self.creation_content.back(); + return false + } else { + if self.wallets.is_selected_open() { + self.wallets.select(None); + return false + } } - !can_go_back + true } } diff --git a/src/gui/views/wallets/creation/creation.rs b/src/gui/views/wallets/creation/creation.rs index 9795a74..793ec22 100644 --- a/src/gui/views/wallets/creation/creation.rs +++ b/src/gui/views/wallets/creation/creation.rs @@ -75,8 +75,8 @@ impl WalletCreation { stroke: View::DEFAULT_STROKE, fill: Colors::FILL_DARK, inner_margin: Margin { - left: View::far_left_inset_margin(ui) + 4.0, - right: View::get_right_inset() + 4.0, + left: View::far_left_inset_margin(ui) + 6.0, + right: View::get_right_inset() + 6.0, top: 4.0, bottom: View::get_bottom_inset() + 4.0, }, @@ -180,7 +180,7 @@ impl WalletCreation { self.copy_or_paste_button_ui(ui, cb); } else { // Setup spacing between buttons. - ui.spacing_mut().item_spacing = egui::Vec2::new(6.0, 0.0); + ui.spacing_mut().item_spacing = egui::Vec2::new(8.0, 0.0); ui.columns(2, |columns| { // Show copy or paste button for mnemonic phrase step. @@ -239,7 +239,6 @@ impl WalletCreation { (text, Colors::WHITE) }; - // Show next step button. View::button(ui, next_text.to_uppercase(), color, || { self.step = if let Some(step) = &self.step { @@ -297,10 +296,10 @@ impl WalletCreation { match &self.step { None => { // Show wallet creation message if step is empty. - View::center_content(ui, 415.0 + View::get_bottom_inset(), |ui| { + View::center_content(ui, 350.0 + View::get_bottom_inset(), |ui| { ui.add( egui::Image::new(egui::include_image!("../../../../../img/logo.png")) - .fit_to_exact_size(vec2(200.0, 200.0)) + .fit_to_exact_size(vec2(180.0, 180.0)) ); ui.add_space(-15.0); ui.label(RichText::new("GRIM") @@ -362,7 +361,7 @@ impl WalletCreation { pub fn show_name_pass_modal(&mut self, cb: &dyn PlatformCallbacks) { // Reset modal values. self.modal_just_opened = true; - self.name_edit = String::from(""); + self.name_edit = t!("wallets.default_wallet"); self.pass_edit = String::from(""); // Show modal. Modal::new(Self::NAME_PASS_MODAL) diff --git a/src/gui/views/wallets/wallet/content.rs b/src/gui/views/wallets/wallet/content.rs index 24bdb9a..27f2b91 100644 --- a/src/gui/views/wallets/wallet/content.rs +++ b/src/gui/views/wallets/wallet/content.rs @@ -210,7 +210,7 @@ impl WalletContent { ui.vertical(|ui| { ui.add_space(3.0); // Show spendable amount. - let amount = amount_to_hr_string(data.info.amount_currently_spendable, false); + let amount = amount_to_hr_string(data.info.amount_currently_spendable, true); let amount_text = format!("{} {}", amount, GRIN); ui.label(RichText::new(amount_text).size(18.0).color(Colors::BLACK)); ui.add_space(-2.0); diff --git a/src/gui/views/wallets/wallet/info.rs b/src/gui/views/wallets/wallet/info.rs index 0b40c06..c43af07 100644 --- a/src/gui/views/wallets/wallet/info.rs +++ b/src/gui/views/wallets/wallet/info.rs @@ -79,7 +79,7 @@ impl WalletInfo { // Show non-zero awaiting confirmation amount. if amount_awaiting_conf != 0 { - let awaiting_conf = amount_to_hr_string(amount_awaiting_conf, false); + let awaiting_conf = amount_to_hr_string(amount_awaiting_conf, true); let rounding = if amount_awaiting_fin != 0 || amount_locked != 0 { [false, false, false, false] } else { @@ -93,7 +93,7 @@ impl WalletInfo { // Show non-zero awaiting finalization amount. if amount_awaiting_fin != 0 { - let awaiting_conf = amount_to_hr_string(amount_awaiting_fin, false); + let awaiting_conf = amount_to_hr_string(amount_awaiting_fin, true); let rounding = if amount_locked != 0 { [false, false, false, false] } else { @@ -107,7 +107,7 @@ impl WalletInfo { // Show non-zero locked amount. if amount_locked != 0 { - let awaiting_conf = amount_to_hr_string(amount_locked, false); + let awaiting_conf = amount_to_hr_string(amount_locked, true); View::rounded_box(ui, format!("{} ツ", awaiting_conf), t!("wallets.locked_amount"), diff --git a/src/lib.rs b/src/lib.rs index 7260520..dad94d5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -122,8 +122,10 @@ pub fn setup_visuals(ctx: &Context) { let mut style = (*ctx.style()).clone(); // Setup spacing for buttons. style.spacing.button_padding = egui::vec2(12.0, 8.0); - // Make scroll-bar thinner. + // Make scroll-bar thinner and lighter. style.spacing.scroll.bar_width = 4.0; + style.spacing.scroll.bar_outer_margin = -2.0; + style.spacing.scroll.foreground_color = false; // Disable spacing between items. style.spacing.item_spacing = egui::vec2(0.0, 0.0); // Setup radio button/checkbox size and spacing. diff --git a/src/main.rs b/src/main.rs index 06c73db..3133bb8 100644 --- a/src/main.rs +++ b/src/main.rs @@ -12,6 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. +use std::sync::Arc; +use egui::{IconData, pos2}; +use grim::AppConfig; + pub fn main() { #[allow(dead_code)] #[cfg(not(target_os = "android"))] @@ -31,8 +35,29 @@ fn real_main() { use grim::gui::PlatformApp; let platform = Desktop::default(); + + // Desktop window size. + let (width, height) = AppConfig::window_size(); + + // Setup an icon. + let icon = image::open("img/icon.png").expect("Failed to open icon path").to_rgba8(); + let (icon_width, icon_height) = icon.dimensions(); + + let mut viewport = egui::ViewportBuilder::default() + .with_inner_size([width, height]) + .with_icon(Arc::new(IconData { + rgba: icon.into_raw(), + width: icon_width, + height: icon_height, + })); + + // Desktop window position. + if let Some((x, y)) = AppConfig::window_pos() { + viewport = viewport.with_position(pos2(x, y)); + } + let options = eframe::NativeOptions { - viewport: egui::ViewportBuilder::default().with_inner_size([1200.0, 720.0]), + viewport, ..Default::default() }; grim::start(options, grim::app_creator(PlatformApp::new(platform))); diff --git a/src/wallet/wallet.rs b/src/wallet/wallet.rs index 2c505a9..c1a4131 100644 --- a/src/wallet/wallet.rs +++ b/src/wallet/wallet.rs @@ -62,7 +62,7 @@ pub struct Wallet { reopen: Arc, /// Flag to check if wallet is open. is_open: Arc, - /// Flag to check if wallet is loading. + /// Flag to check if wallet is closing. closing: Arc, /// Flag to check if wallet was deleted to remove it from the list. deleted: Arc, @@ -306,7 +306,7 @@ impl Wallet { } } - /// Check if wallet was open. + /// Check if wallet is open. pub fn is_open(&self) -> bool { self.is_open.load(Ordering::Relaxed) }