Compare commits

...

5 Commits

Author SHA1 Message Date
Jędrzej Stuczyński 666ce5e368 fixed paths 2025-04-04 10:41:39 +01:00
Tommy Verrall dbb65259ed lint 2025-04-02 15:44:10 +02:00
Tommy Verrall 38896e6959 Merge branch 'develop' into feature/v2-test 2025-04-02 15:40:06 +02:00
Tommy Verrall 9a4293a5b9 add the base points back in
- now i've reverted back to the original two here, as the compiler is failing around `tauri::api::path` however, looking into the new design for the path resolver in tower this tasks, requires pratically changing the whole wallet_strorage and config set up
- it seems pretty straight forward https://v2.tauri.app/start/migrate/from-tauri-1/#migrate-path-to-tauri-manager - however, I would need a second set of eyes on this
2025-04-02 08:53:40 +02:00
Tommy Verrall cdddb44099 migrate to v2
- lots to check and do
2025-04-01 17:06:21 +02:00
24 changed files with 7311 additions and 2796 deletions
+8 -8
View File
@@ -667,9 +667,9 @@ dependencies = [
[[package]] [[package]]
name = "deranged" name = "deranged"
version = "0.3.11" version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" checksum = "28cfac68e08048ae1883171632c2aef3ebc555621ae56fbccce1cbf22dd7f058"
dependencies = [ dependencies = [
"powerfmt", "powerfmt",
] ]
@@ -1851,9 +1851,9 @@ dependencies = [
[[package]] [[package]]
name = "time" name = "time"
version = "0.3.39" version = "0.3.41"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dad298b01a40a23aac4580b67e3dbedb7cc8402f3592d7f49469de2ea4aecdd8" checksum = "8a7619e19bc266e0f9c5e6686659d394bc57973859340060a69221e57dbc0c40"
dependencies = [ dependencies = [
"deranged", "deranged",
"itoa", "itoa",
@@ -1868,15 +1868,15 @@ dependencies = [
[[package]] [[package]]
name = "time-core" name = "time-core"
version = "0.1.3" version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "765c97a5b985b7c11d7bc27fa927dc4fe6af3a6dfb021d28deb60d3bf51e76ef" checksum = "c9e9a38711f559d9e3ce1cdb06dd7c5b8ea546bc90052da6d06bb76da74bb07c"
[[package]] [[package]]
name = "time-macros" name = "time-macros"
version = "0.2.20" version = "0.2.22"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e8093bc3e81c3bc5f7879de09619d06c9a5a5e45ca44dfeeb7225bae38005c5c" checksum = "3526739392ec93fd8b359c8e98514cb3e8e021beb4e5f597b00a0221f8ed8a49"
dependencies = [ dependencies = [
"num-conv", "num-conv",
"time-core", "time-core",
+2323 -814
View File
File diff suppressed because it is too large Load Diff
+7 -3
View File
@@ -21,6 +21,7 @@
"webpack:prod": "yarn webpack --progress --config webpack.prod.js" "webpack:prod": "yarn webpack --progress --config webpack.prod.js"
}, },
"dependencies": { "dependencies": {
"@babel/helper-simple-access": "^7.25.9",
"@emotion/react": "^11.7.0", "@emotion/react": "^11.7.0",
"@emotion/styled": "^11.6.0", "@emotion/styled": "^11.6.0",
"@hookform/resolvers": "^2.8.0", "@hookform/resolvers": "^2.8.0",
@@ -33,7 +34,10 @@
"@nymproject/react": "^1.0.0", "@nymproject/react": "^1.0.0",
"@nymproject/types": "^1.0.0", "@nymproject/types": "^1.0.0",
"@storybook/react": "^6.5.15", "@storybook/react": "^6.5.15",
"@tauri-apps/api": "^1.2.0", "@tauri-apps/api": "^2.4.0",
"@tauri-apps/cli": "^2.4.0",
"@tauri-apps/plugin-clipboard-manager": "^2.2.2",
"@tauri-apps/plugin-updater": "^2.0.0",
"@tauri-apps/tauri-forage": "^1.0.0-beta.2", "@tauri-apps/tauri-forage": "^1.0.0-beta.2",
"big.js": "^6.2.1", "big.js": "^6.2.1",
"bs58": "^4.0.1", "bs58": "^4.0.1",
@@ -67,7 +71,7 @@
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.4", "@pmmmwh/react-refresh-webpack-plugin": "^0.5.4",
"@storybook/react": "^6.5.15", "@storybook/react": "^6.5.15",
"@svgr/webpack": "^6.1.1", "@svgr/webpack": "^6.1.1",
"@tauri-apps/cli": "^1.0.5", "@tauri-apps/cli": "^2.4.0",
"@testing-library/jest-dom": "^5.14.1", "@testing-library/jest-dom": "^5.14.1",
"@testing-library/react": "^12.0.0", "@testing-library/react": "^12.0.0",
"@types/big.js": "^6.1.6", "@types/big.js": "^6.1.6",
@@ -125,4 +129,4 @@
"webpack-merge": "^5.8.0" "webpack-merge": "^5.8.0"
}, },
"private": false "private": false
} }
+12 -3
View File
@@ -13,17 +13,21 @@ rust-version = "1.76"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[build-dependencies] [build-dependencies]
tauri-build = { version = "=1.2.1", features = [] } tauri-build = { version = "2", features = [] }
tauri-codegen = "=1.2.1" tauri-codegen = "=1.2.1"
tauri-macros = "=1.2.1" tauri-macros = "=1.2.1"
[dependencies] [dependencies]
async-trait = "0.1.68" async-trait = "0.1.68"
tauri-plugin-updater = "2"
tauri-plugin-clipboard-manager = "2"
tauri-plugin-shell = "2"
tauri-plugin-process = "2"
bip39 = { version = "2.0.0", features = ["zeroize", "rand"] } bip39 = { version = "2.0.0", features = ["zeroize", "rand"] }
cfg-if = "1.0.0" cfg-if = "1.0.0"
colored = "2.0" colored = "2.0"
dirs = "4.0" dirs = "6.0"
dotenvy = "0.15.6" dotenvy = "0.15.6"
eyre = "0.6.5" eyre = "0.6.5"
fern = { version = "0.6.1", features = ["colored"] } fern = { version = "0.6.1", features = ["colored"] }
@@ -38,7 +42,7 @@ serde_json = "1.0"
serde_repr = "0.1" serde_repr = "0.1"
strum = { version = "0.23", features = ["derive"] } strum = { version = "0.23", features = ["derive"] }
tap = "1" tap = "1"
tauri = { version = "=1.2.3", features = ["clipboard-all", "shell-open", "updater", "window-maximize", "window-print"] } tauri = { version = "2", features = [] }
#tendermint-rpc = "0.23.0" #tendermint-rpc = "0.23.0"
time = { version = "0.3.30", features = ["local-offset"] } time = { version = "0.3.30", features = ["local-offset"] }
thiserror = "1.0" thiserror = "1.0"
@@ -63,6 +67,11 @@ nym-types = { path = "../../common/types" }
nym-wallet-types = { path = "../nym-wallet-types" } nym-wallet-types = { path = "../nym-wallet-types" }
nym-store-cipher = { path = "../../common/store-cipher", features = ["json"] } nym-store-cipher = { path = "../../common/store-cipher", features = ["json"] }
# https://github.com/ebarnard/rust-plist/issues/151#issuecomment-2746645171
# https://github.com/jhpratt/deranged/issues/18
deranged = "=0.4.0"
[dev-dependencies] [dev-dependencies]
nym-crypto = { path = "../../common/crypto", features = ["rand"] } nym-crypto = { path = "../../common/crypto", features = ["rand"] }
rand_chacha = "0.3" rand_chacha = "0.3"
@@ -0,0 +1,11 @@
{
"identifier": "migrated",
"description": "permissions that were migrated from v1",
"local": true,
"windows": [
"main"
],
"permissions": [
"core:default"
]
}
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
{"migrated":{"identifier":"migrated","description":"permissions that were migrated from v1","local":true,"windows":["main"],"permissions":["core:default"]}}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+11 -1
View File
@@ -105,7 +105,17 @@ impl NetworkConfig {
impl Config { impl Config {
fn root_directory() -> PathBuf { fn root_directory() -> PathBuf {
tauri::api::path::config_dir().expect("Failed to get config directory") // tauri v1 (via `tauri::api::path::config_dir()`) was internally calling `dirs_next::config_dir()`
// which ultimately was getting resolved to
// - **Linux:** Resolves to `$XDG_CONFIG_HOME` or `$HOME/.config`.
// - **macOS:** Resolves to `$HOME/Library/Application Support`.
// - **Windows:** Resolves to `{FOLDERID_RoamingAppData}`.
//
// tauri v2 calls `dirs::config_dir().ok_or(Error::UnknownPath)` which ultimately does the same thing,
// however, it changed its API so that it's called on a `PathResolver`.
// but, to instantiate one here would be a hassle as we don't need those specific functionalities,
// so let's just recreate tauri's behaviour
dirs::config_dir().expect("Failed to get config directory")
} }
fn config_directory() -> PathBuf { fn config_directory() -> PathBuf {
+2 -2
View File
@@ -3,7 +3,7 @@ use std::str::FromStr;
use fern::colors::{Color, ColoredLevelConfig}; use fern::colors::{Color, ColoredLevelConfig};
use serde::Serialize; use serde::Serialize;
use serde_repr::{Deserialize_repr, Serialize_repr}; use serde_repr::{Deserialize_repr, Serialize_repr};
use tauri::Manager; use tauri::Emitter;
use time::{format_description, OffsetDateTime}; use time::{format_description, OffsetDateTime};
fn formatted_time() -> String { fn formatted_time() -> String {
@@ -61,7 +61,7 @@ pub fn setup_logging(app_handle: tauri::AppHandle) -> Result<(), log::SetLoggerE
message: record.args().to_string(), message: record.args().to_string(),
level: record.level().into(), level: record.level().into(),
}; };
app_handle.emit_all("log://log", msg).unwrap(); app_handle.emit("log://log", msg).unwrap();
})); }));
base_config base_config
+26 -8
View File
@@ -3,11 +3,11 @@
windows_subsystem = "windows" windows_subsystem = "windows"
)] )]
use tauri::{Manager, Menu};
use nym_mixnet_contract_common::{Gateway, MixNode}; use nym_mixnet_contract_common::{Gateway, MixNode};
use tauri::menu::{MenuBuilder, MenuItemBuilder, SubmenuBuilder};
use tauri::Manager;
use crate::menu::AddDefaultSubmenus; use crate::menu::SHOW_LOG_WINDOW;
use crate::operations::app; use crate::operations::app;
use crate::operations::help; use crate::operations::help;
use crate::operations::mixnet; use crate::operations::mixnet;
@@ -210,13 +210,31 @@ fn main() {
app::react::set_react_state, app::react::set_react_state,
app::react::get_react_state, app::react::get_react_state,
]) ])
.menu(Menu::os_default(&context.package_info().name).add_default_app_submenus()) .menu(|app| {
.on_menu_event(|event| { // Create a menu builder
if event.menu_item_id() == menu::SHOW_LOG_WINDOW { let menu_builder = MenuBuilder::new(app);
let _r = help::log::help_log_toggle_window(event.window().app_handle()); if ::std::env::var("NYM_WALLET_ENABLE_LOG").is_ok() {
let help_text = MenuItemBuilder::with_id(SHOW_LOG_WINDOW, "Show logs")
.build(app)
.expect("Failed to create menu item");
let submenu = SubmenuBuilder::new(app, "Help")
.items(&[&help_text])
.build()
.expect("Failed to create help submenu");
menu_builder.item(&submenu).build()
} else {
// Build a default menu without the submenu
menu_builder.build()
} }
}) })
.setup(|app| Ok(log::setup_logging(app.app_handle())?)) .on_menu_event(|app, event| {
if event.id() == SHOW_LOG_WINDOW {
let _r = help::log::help_log_toggle_window(app.app_handle().clone());
}
})
.setup(|app| Ok(log::setup_logging(app.app_handle().clone())?))
.run(context) .run(context)
.expect("error while running tauri application"); .expect("error while running tauri application");
} }
+32 -19
View File
@@ -1,22 +1,35 @@
use tauri::Menu; // use tauri::menu::Menu;
use tauri::{CustomMenuItem, Submenu}; // use tauri::menu::{MenuBuilder, MenuItemBuilder, SubmenuBuilder};
pub const SHOW_LOG_WINDOW: &str = "show_log_window"; pub const SHOW_LOG_WINDOW: &str = "show_log_window";
pub trait AddDefaultSubmenus { // pub trait AddDefaultSubmenus {
fn add_default_app_submenus(self) -> Self; // fn add_default_app_submenus(self) -> Self;
} // }
//
impl AddDefaultSubmenus for Menu { // impl<R: tauri::Runtime> AddDefaultSubmenus for Menu<R> {
#[allow(dead_code)] // #[allow(dead_code)]
fn add_default_app_submenus(self) -> Self { // fn add_default_app_submenus(self) -> Self {
if ::std::env::var("NYM_WALLET_ENABLE_LOG").is_ok() { // if ::std::env::var("NYM_WALLET_ENABLE_LOG").is_ok() {
let submenu = Submenu::new( // let app_handle = self.app_handle();
"Help", //
Menu::new().add_item(CustomMenuItem::new(SHOW_LOG_WINDOW, "Show logs")), // let help_text = MenuItemBuilder::with_id(SHOW_LOG_WINDOW, "Show logs")
); // .build(app_handle)
return self.add_submenu(submenu); // .expect("Failed to create menu item");
} //
self // let submenu = SubmenuBuilder::new(app_handle, "Help")
} // .items(&[&help_text])
} // .build()
// .expect("Failed to create help submenu");
//
// let menu_builder = MenuBuilder::new(app_handle);
//
// match menu_builder.item(&submenu).build() {
// Ok(new_menu) => new_menu,
// Err(_) => self,
// }
// } else {
// self
// }
// }
// }
@@ -3,27 +3,46 @@
use crate::error::BackendError; use crate::error::BackendError;
use nym_wallet_types::app::AppVersion; use nym_wallet_types::app::AppVersion;
use tauri_plugin_updater::UpdaterExt;
#[tauri::command] #[tauri::command]
pub async fn check_version(handle: tauri::AppHandle) -> Result<AppVersion, BackendError> { pub async fn check_version(handle: tauri::AppHandle) -> Result<AppVersion, BackendError> {
log::info!(">>> Getting app version info"); log::info!(">>> Getting app version info");
let res = tauri::updater::builder(handle)
.check() let updater = handle.updater().map_err(|e| {
.await log::error!("Failed to get updater: {}", e);
.map(|u| AppVersion { BackendError::CheckAppVersionError
current_version: u.current_version().to_string(), })?;
latest_version: u.latest_version().to_owned(),
is_update_available: u.is_update_available(), // Then check for updates
let update_info = updater.check().await.map_err(|e| {
log::error!("An error occurred while checking for app update {}", e);
BackendError::CheckAppVersionError
})?;
// Process the result
if let Some(update) = update_info {
log::debug!(
"<<< update available: [true], current version {}, latest version {}",
update.current_version,
update.version
);
Ok(AppVersion {
current_version: update.current_version.to_string(),
latest_version: update.version,
is_update_available: true,
}) })
.map_err(|e| { } else {
log::error!("An error ocurred while checking for app update {}", e); // No update available
BackendError::CheckAppVersionError let current_version = handle.package_info().version.to_string();
})?; log::debug!(
log::debug!( "<<< update available: [false], current version {}",
"<<< update available: [{}], current version {}, latest version {}", current_version
res.is_update_available, );
res.current_version, Ok(AppVersion {
res.latest_version current_version: current_version.clone(),
); latest_version: current_version,
Ok(res) is_update_available: false,
})
}
} }
@@ -26,10 +26,10 @@ async fn create_window(
) -> Result<(), BackendError> { ) -> Result<(), BackendError> {
// create the new window first, to stop the app process from exiting // create the new window first, to stop the app process from exiting
log::info!("Creating {} window...", new_window_label); log::info!("Creating {} window...", new_window_label);
match tauri::WindowBuilder::new( match tauri::WebviewWindowBuilder::new(
&app_handle, &app_handle,
new_window_label, "main",
tauri::WindowUrl::App(new_window_url.into()), tauri::WebviewUrl::App(new_window_url.into()),
) )
.title("Nym Wallet") .title("Nym Wallet")
.build() .build()
@@ -49,7 +49,7 @@ async fn create_window(
} }
// close the old window // close the old window
match app_handle.windows().get(try_close_window_label) { match app_handle.get_webview_window(try_close_window_label) {
Some(try_close_window) => { Some(try_close_window) => {
if let Err(err) = try_close_window.close() { if let Err(err) = try_close_window.close() {
log::error!("Could not close window: {err}") log::error!("Could not close window: {err}")
@@ -3,7 +3,7 @@ use tauri::Manager;
#[tauri::command] #[tauri::command]
pub fn help_log_toggle_window(app_handle: tauri::AppHandle) -> Result<(), BackendError> { pub fn help_log_toggle_window(app_handle: tauri::AppHandle) -> Result<(), BackendError> {
if let Some(current_log_window) = app_handle.windows().get("log") { if let Some(current_log_window) = app_handle.get_webview_window("log") {
log::info!("Closing log window..."); log::info!("Closing log window...");
if let Err(err) = current_log_window.close() { if let Err(err) = current_log_window.close() {
log::error!("Unable to close log window: {err}"); log::error!("Unable to close log window: {err}");
@@ -12,9 +12,13 @@ pub fn help_log_toggle_window(app_handle: tauri::AppHandle) -> Result<(), Backen
} }
log::info!("Creating log window..."); log::info!("Creating log window...");
match tauri::WindowBuilder::new(&app_handle, "log", tauri::WindowUrl::App("log.html".into())) match tauri::WebviewWindowBuilder::new(
.title("Nym Wallet Logs") &app_handle,
.build() "log",
tauri::WebviewUrl::App("log.html".into()),
)
.title("Nym Wallet Logs")
.build()
{ {
Ok(window) => { Ok(window) => {
if let Err(err) = window.set_focus() { if let Err(err) = window.set_focus() {
+11 -1
View File
@@ -38,7 +38,17 @@ pub(crate) const DEFAULT_LOGIN_ID: &str = "default";
pub(crate) const DEFAULT_FIRST_ACCOUNT_NAME: &str = "Account 1"; pub(crate) const DEFAULT_FIRST_ACCOUNT_NAME: &str = "Account 1";
fn get_storage_directory() -> Result<PathBuf, BackendError> { fn get_storage_directory() -> Result<PathBuf, BackendError> {
tauri::api::path::local_data_dir() // tauri v1 (via `tauri::api::path::local_data_dir()`) was internally calling `dirs_next::data_local_dir()`
// which ultimately was getting resolved to
// - **Linux:** Resolves to `$XDG_DATA_HOME` or `$HOME/.local/share`.
// - **macOS:** Resolves to `$HOME/Library/Application Support`.
// - **Windows:** Resolves to `{FOLDERID_LocalAppData}`.
//
// tauri v2 calls `dirs::data_local_dir().ok_or(Error::UnknownPath)` which ultimately does the same thing,
// however, it changed its API so that it's called on a `PathResolver`.
// but, to instantiate one here would be a hassle as we don't need those specific functionalities,
// so let's just recreate tauri's behaviour
dirs::data_local_dir()
.map(|dir| dir.join(STORAGE_DIR_NAME)) .map(|dir| dir.join(STORAGE_DIR_NAME))
.ok_or(BackendError::UnknownStorageDirectory) .ok_or(BackendError::UnknownStorageDirectory)
} }
+52 -61
View File
@@ -1,78 +1,69 @@
{ {
"package": { "bundle": {
"productName": "nym-wallet", "active": true,
"version": "1.2.16" "targets": "all",
}, "windows": {
"build": { "certificateThumbprint": "6DB77B1F529A0804FE0E6843A3EB8A8CECFFD408",
"distDir": "../dist", "digestAlgorithm": "sha256",
"devPath": "http://localhost:9000", "timestampUrl": "http://timestamp.comodoca.com"
"beforeDevCommand": "", },
"beforeBuildCommand": "" "icon": [
}, "icons/32x32.png",
"tauri": { "icons/128x128.png",
"bundle": { "icons/128x128@2x.png",
"active": true, "icons/icon.icns",
"targets": "all", "icons/icon.ico"
"identifier": "net.nymtech.wallet", ],
"icon": [ "resources": [],
"icons/32x32.png", "externalBin": [],
"icons/128x128.png", "copyright": "Copyright © 2021-2025 Nym Technologies SA",
"icons/128x128@2x.png", "category": "Business",
"icons/icon.icns", "shortDescription": "Nym desktop wallet allows you to manage your NYM tokens",
"icons/icon.ico" "longDescription": "",
], "macOS": {
"resources": [], "frameworks": [],
"externalBin": [], "minimumSystemVersion": "",
"copyright": "Copyright © 2021-2023 Nym Technologies SA", "exceptionDomain": "",
"category": "Business", "signingIdentity": "Developer ID Application: Nym Technologies SA (VW5DZLFHM5)",
"shortDescription": "Nym desktop wallet allows you to manage your NYM tokens", "entitlements": null
"longDescription": "", },
"linux": {
"deb": { "deb": {
"depends": [] "depends": []
},
"macOS": {
"frameworks": [],
"minimumSystemVersion": "",
"exceptionDomain": "",
"signingIdentity": "Developer ID Application: Nym Technologies SA (VW5DZLFHM5)",
"entitlements": null
},
"windows": {
"certificateThumbprint": "6DB77B1F529A0804FE0E6843A3EB8A8CECFFD408",
"digestAlgorithm": "sha256",
"timestampUrl": "http://timestamp.comodoca.com"
} }
}, },
"createUpdaterArtifacts": "v1Compatible"
},
"build": {
"beforeBuildCommand": "",
"frontendDist": "../dist",
"beforeDevCommand": "",
"devUrl": "http://localhost:9000"
},
"productName": "nym-wallet",
"mainBinaryName": "nym-wallet",
"version": "1.2.15",
"identifier": "net.nymtech.wallet",
"plugins": {
"updater": { "updater": {
"active": true, "pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IENCNzQ2M0E5N0VFODE2NApSV1JrZ2U2WE9rYTNETTg1OTBKdE5uWUEra0hML2syOVUvQ2lxZmFZRzZ1T3NWbGM0eVRzUTVhVwo=",
"endpoints": [ "endpoints": [
"https://nymtech.net/.wellknown/wallet/updater.json" "https://nymtech.net/.wellknown/wallet/updater.json"
], ]
"dialog": true, }
"pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IENCNzQ2M0E5N0VFODE2NApSV1JrZ2U2WE9rYTNETTg1OTBKdE5uWUEra0hML2syOVUvQ2lxZmFZRzZ1T3NWbGM0eVRzUTVhVwo=" },
}, "app": {
"allowlist": { "security": {
"window": { "csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self' img-src: 'self'; connect-src ipc: http://ipc.localhost"
"maximize": true,
"print": true
},
"clipboard": {
"all": true
},
"shell": {
"open": true
}
}, },
"windows": [ "windows": [
{ {
"title": "Nym Wallet", "title": "Nym Wallet",
"width": 1268, "width": 1268,
"height": 768, "height": 768,
"resizable": true "resizable": true,
"useHttpsScheme": true
} }
], ]
"security": {
"csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self' img-src: 'self'"
}
} }
} }
@@ -1,7 +1,7 @@
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import { Button, IconButton, Tooltip } from '@mui/material'; import { Button, IconButton, Tooltip } from '@mui/material';
import { Check, ContentCopy } from '@mui/icons-material'; import { Check, ContentCopy } from '@mui/icons-material';
import { clipboard } from '@tauri-apps/api'; import { writeText } from '@tauri-apps/plugin-clipboard-manager';
import { Console } from '../utils/console'; import { Console } from '../utils/console';
export const CopyToClipboard = ({ text = '', iconButton }: { text?: string; iconButton?: boolean }) => { export const CopyToClipboard = ({ text = '', iconButton }: { text?: string; iconButton?: boolean }) => {
@@ -9,7 +9,7 @@ export const CopyToClipboard = ({ text = '', iconButton }: { text?: string; icon
const handleCopy = async (_text: string) => { const handleCopy = async (_text: string) => {
try { try {
await clipboard.writeText(_text); await writeText(_text);
setCopied(true); setCopied(true);
} catch (e) { } catch (e) {
Console.error(`failed to copy: ${e}`); Console.error(`failed to copy: ${e}`);
@@ -1,6 +1,6 @@
import React, { useContext, useEffect, useState } from 'react'; import React, { useContext, useEffect, useState } from 'react';
import { Button, Stack, Typography } from '@mui/material'; import { Button, Stack, Typography } from '@mui/material';
import { checkUpdate } from '@tauri-apps/api/updater'; import { check } from '@tauri-apps/plugin-updater';
import { AppContext } from '../../context'; import { AppContext } from '../../context';
import { checkVersion } from '../../requests'; import { checkVersion } from '../../requests';
import { Console } from '../../utils/console'; import { Console } from '../../utils/console';
@@ -28,7 +28,7 @@ const AppVersion = () => {
try { try {
// despite the name, this will spawn an external native window with // despite the name, this will spawn an external native window with
// an embedded "download and update the Wallet" flow // an embedded "download and update the Wallet" flow
checkUpdate(); check();
} catch (e) { } catch (e) {
Console.error(e); Console.error(e);
} }
@@ -1,7 +1,7 @@
/* eslint-disable react/destructuring-assignment */ /* eslint-disable react/destructuring-assignment */
import React from 'react'; import React from 'react';
import { Button, Card, CardContent, TextField } from '@mui/material'; import { Button, Card, CardContent, TextField } from '@mui/material';
import { invoke } from '@tauri-apps/api'; import { invoke } from '@tauri-apps/api/core';
interface DocEntryProps { interface DocEntryProps {
function: FunctionDef; function: FunctionDef;
+1 -1
View File
@@ -1,4 +1,4 @@
import { invoke } from '@tauri-apps/api'; import { invoke } from '@tauri-apps/api/core';
import { config } from '../config'; import { config } from '../config';
import { Console } from '../utils/console'; import { Console } from '../utils/console';
+3 -1
View File
@@ -1,4 +1,4 @@
import { appWindow } from '@tauri-apps/api/window'; import { getCurrentWebviewWindow } from '@tauri-apps/api/webviewWindow';
import bs58 from 'bs58'; import bs58 from 'bs58';
import Big from 'big.js'; import Big from 'big.js';
import { valid } from 'semver'; import { valid } from 'semver';
@@ -15,6 +15,8 @@ import {
} from '../requests'; } from '../requests';
import { Console } from './console'; import { Console } from './console';
const appWindow = getCurrentWebviewWindow();
export const validateKey = (key: string, bytesLength: number): boolean => { export const validateKey = (key: string, bytesLength: number): boolean => {
// it must be a valid base58 key // it must be a valid base58 key
try { try {
+198 -1843
View File
File diff suppressed because it is too large Load Diff