Compare commits
1 Commits
drazen/lp-dev
...
tracing
| Author | SHA1 | Date | |
|---|---|---|---|
| 1060888945 |
Generated
+1953
-694
File diff suppressed because it is too large
Load Diff
@@ -66,6 +66,14 @@ vesting-contract = { path = "../../contracts/vesting" }
|
||||
nym-types = { path = "../../common/types" }
|
||||
nym-wallet-types = { path = "../nym-wallet-types" }
|
||||
|
||||
# Tracing
|
||||
tracing = "0.1.37"
|
||||
tracing-subscriber = { version = "0.3.16", features = ["env-filter"] }
|
||||
tracing-tree = "0.2.2"
|
||||
opentelemetry = "0.18.0"
|
||||
opentelemetry-jaeger = { version = "0.17.0", features = ["full"] }
|
||||
tracing-opentelemetry = "0.18.0"
|
||||
|
||||
[dev-dependencies]
|
||||
tempfile = "3.3.0"
|
||||
ts-rs = "6.1.2"
|
||||
|
||||
@@ -4,47 +4,68 @@ use fern::colors::ColoredLevelConfig;
|
||||
use serde::Serialize;
|
||||
use serde_repr::{Deserialize_repr, Serialize_repr};
|
||||
use tauri::Manager;
|
||||
use tracing_subscriber::EnvFilter;
|
||||
use tracing_subscriber::Registry;
|
||||
use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt};
|
||||
use tracing_tree::HierarchicalLayer;
|
||||
|
||||
pub fn setup_logging(app_handle: tauri::AppHandle) -> Result<(), log::SetLoggerError> {
|
||||
let colors = ColoredLevelConfig::new();
|
||||
let base_config = fern::Dispatch::new()
|
||||
.level(global_level())
|
||||
.filter_lowlevel_external_components()
|
||||
.show_operations();
|
||||
let tracer = opentelemetry_jaeger::new_agent_pipeline()
|
||||
.with_service_name("nym-wallet")
|
||||
.install_simple()
|
||||
.unwrap();
|
||||
|
||||
let stdout_config = fern::Dispatch::new()
|
||||
.format(move |out, message, record| {
|
||||
out.finish(format_args!(
|
||||
"{}[{}][{}] {}",
|
||||
chrono::Local::now().format("[%Y-%m-%d][%H:%M:%S]"),
|
||||
record.target(),
|
||||
colors.color(record.level()),
|
||||
message,
|
||||
))
|
||||
})
|
||||
.chain(std::io::stdout());
|
||||
let telemetry = tracing_opentelemetry::layer().with_tracer(tracer);
|
||||
|
||||
let tauri_event_config = fern::Dispatch::new()
|
||||
.format(move |out, message, record| {
|
||||
out.finish(format_args!(
|
||||
"{}[{}] {}",
|
||||
chrono::Local::now().format("[%Y-%m-%d][%H:%M:%S]"),
|
||||
record.target(),
|
||||
message,
|
||||
))
|
||||
})
|
||||
.chain(fern::Output::call(move |record| {
|
||||
let msg = LogMessage {
|
||||
message: record.args().to_string(),
|
||||
level: record.level().into(),
|
||||
};
|
||||
app_handle.emit_all("log://log", msg).unwrap();
|
||||
}));
|
||||
Registry::default()
|
||||
.with(EnvFilter::from_default_env())
|
||||
.with(
|
||||
HierarchicalLayer::new(4)
|
||||
.with_targets(true)
|
||||
.with_bracketed_fields(true),
|
||||
)
|
||||
.with(telemetry)
|
||||
.init();
|
||||
// let colors = ColoredLevelConfig::new();
|
||||
// let base_config = fern::Dispatch::new()
|
||||
// .level(global_level())
|
||||
// .filter_lowlevel_external_components()
|
||||
// .show_operations();
|
||||
|
||||
base_config
|
||||
.chain(stdout_config)
|
||||
.chain(tauri_event_config)
|
||||
.apply()
|
||||
// let stdout_config = fern::Dispatch::new()
|
||||
// .format(move |out, message, record| {
|
||||
// out.finish(format_args!(
|
||||
// "{}[{}][{}] {}",
|
||||
// chrono::Local::now().format("[%Y-%m-%d][%H:%M:%S]"),
|
||||
// record.target(),
|
||||
// colors.color(record.level()),
|
||||
// message,
|
||||
// ))
|
||||
// })
|
||||
// .chain(std::io::stdout());
|
||||
|
||||
// let tauri_event_config = fern::Dispatch::new()
|
||||
// .format(move |out, message, record| {
|
||||
// out.finish(format_args!(
|
||||
// "{}[{}] {}",
|
||||
// chrono::Local::now().format("[%Y-%m-%d][%H:%M:%S]"),
|
||||
// record.target(),
|
||||
// message,
|
||||
// ))
|
||||
// })
|
||||
// .chain(fern::Output::call(move |record| {
|
||||
// let msg = LogMessage {
|
||||
// message: record.args().to_string(),
|
||||
// level: record.level().into(),
|
||||
// };
|
||||
// app_handle.emit_all("log://log", msg).unwrap();
|
||||
// }));
|
||||
|
||||
// base_config
|
||||
// .chain(stdout_config)
|
||||
// .chain(tauri_event_config)
|
||||
// .apply()
|
||||
Ok(())
|
||||
}
|
||||
|
||||
trait FernExt {
|
||||
|
||||
@@ -172,4 +172,6 @@ fn main() {
|
||||
.setup(|app| Ok(log::setup_logging(app.app_handle())?))
|
||||
.run(context)
|
||||
.expect("error while running tauri application");
|
||||
|
||||
opentelemetry::global::shutdown_tracer_provider();
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ pub async fn connect_with_mnemonic(
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state))]
|
||||
pub async fn get_balance(state: tauri::State<'_, WalletState>) -> Result<Balance, BackendError> {
|
||||
let guard = state.read().await;
|
||||
let client = guard.current_client()?;
|
||||
@@ -48,16 +49,19 @@ pub async fn get_balance(state: tauri::State<'_, WalletState>) -> Result<Balance
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument]
|
||||
pub fn create_new_mnemonic() -> String {
|
||||
random_mnemonic().to_string()
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(mnemonic))]
|
||||
pub fn validate_mnemonic(mnemonic: &str) -> bool {
|
||||
Mnemonic::from_str(mnemonic).is_ok()
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state))]
|
||||
pub async fn switch_network(
|
||||
state: tauri::State<'_, WalletState>,
|
||||
network: WalletNetwork,
|
||||
@@ -77,16 +81,19 @@ pub async fn switch_network(
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state))]
|
||||
pub async fn logout(state: tauri::State<'_, WalletState>) -> Result<(), BackendError> {
|
||||
state.write().await.logout();
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tracing::instrument()]
|
||||
fn random_mnemonic() -> Mnemonic {
|
||||
let mut rng = rand::thread_rng();
|
||||
Mnemonic::generate_in_with(&mut rng, Language::English, 24).unwrap()
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip(state, mnemonic))]
|
||||
async fn _connect_with_mnemonic(
|
||||
mnemonic: Mnemonic,
|
||||
state: tauri::State<'_, WalletState>,
|
||||
@@ -169,6 +176,7 @@ async fn _connect_with_mnemonic(
|
||||
account_for_default_network
|
||||
}
|
||||
|
||||
#[tracing::instrument]
|
||||
async fn run_connection_test(
|
||||
untested_nymd_urls: HashMap<WalletNetwork, Vec<Url>>,
|
||||
untested_api_urls: HashMap<WalletNetwork, Vec<Url>>,
|
||||
@@ -197,6 +205,7 @@ async fn run_connection_test(
|
||||
.await
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip(mnemonic))]
|
||||
fn create_clients(
|
||||
nymd_urls: &HashMap<NymNetworkDetails, Vec<(Url, bool)>>,
|
||||
api_urls: &HashMap<NymNetworkDetails, Vec<(Url, bool)>>,
|
||||
@@ -258,6 +267,7 @@ fn create_clients(
|
||||
Ok(clients)
|
||||
}
|
||||
|
||||
#[tracing::instrument()]
|
||||
fn select_random_responding_url(
|
||||
urls: &HashMap<NymNetworkDetails, Vec<(Url, bool)>>,
|
||||
network: WalletNetwork,
|
||||
@@ -283,6 +293,7 @@ fn select_first_responding_url(
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument]
|
||||
pub fn does_password_file_exist() -> Result<bool, BackendError> {
|
||||
log::info!("Checking wallet file");
|
||||
let file = wallet_storage::wallet_login_filepath()?;
|
||||
@@ -296,6 +307,7 @@ pub fn does_password_file_exist() -> Result<bool, BackendError> {
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(mnemonic, password))]
|
||||
pub fn create_password(mnemonic: &str, password: String) -> Result<(), BackendError> {
|
||||
if does_password_file_exist()? {
|
||||
return Err(BackendError::WalletFileAlreadyExists);
|
||||
@@ -311,6 +323,7 @@ pub fn create_password(mnemonic: &str, password: String) -> Result<(), BackendEr
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state, password))]
|
||||
pub async fn sign_in_with_password(
|
||||
password: String,
|
||||
state: tauri::State<'_, WalletState>,
|
||||
@@ -330,6 +343,7 @@ pub async fn sign_in_with_password(
|
||||
_connect_with_mnemonic(mnemonic, state).await
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip(stored_login))]
|
||||
fn extract_first_mnemonic(
|
||||
stored_login: &wallet_storage::StoredLogin,
|
||||
) -> Result<Mnemonic, BackendError> {
|
||||
@@ -350,6 +364,7 @@ fn extract_first_mnemonic(
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state, password))]
|
||||
pub async fn sign_in_with_password_and_account_id(
|
||||
account_id: &str,
|
||||
password: &str,
|
||||
@@ -371,6 +386,7 @@ pub async fn sign_in_with_password_and_account_id(
|
||||
_connect_with_mnemonic(mnemonic, state).await
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip(stored_login))]
|
||||
fn extract_mnemonic(
|
||||
stored_login: &wallet_storage::StoredLogin,
|
||||
account_id: &wallet_storage::AccountId,
|
||||
@@ -389,6 +405,7 @@ fn extract_mnemonic(
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument]
|
||||
pub fn remove_password() -> Result<(), BackendError> {
|
||||
log::info!("Removing password");
|
||||
let login_id = wallet_storage::LoginId::new(DEFAULT_LOGIN_ID.to_string());
|
||||
@@ -396,11 +413,13 @@ pub fn remove_password() -> Result<(), BackendError> {
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument]
|
||||
pub fn archive_wallet_file() -> Result<(), BackendError> {
|
||||
wallet_storage::archive_wallet_file()
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state, mnemonic, password))]
|
||||
pub async fn add_account_for_password(
|
||||
mnemonic: &str,
|
||||
password: &str,
|
||||
@@ -444,6 +463,7 @@ pub async fn add_account_for_password(
|
||||
}
|
||||
|
||||
// The first `AccoundId` when converting is the `LoginId` for the entry that was loaded.
|
||||
#[tracing::instrument(skip(state, stored_login))]
|
||||
async fn set_state_with_all_accounts(
|
||||
stored_login: wallet_storage::StoredLogin,
|
||||
first_id_when_converting: wallet_storage::AccountId,
|
||||
@@ -489,6 +509,7 @@ async fn set_state_with_all_accounts(
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state, password))]
|
||||
pub async fn remove_account_for_password(
|
||||
password: &str,
|
||||
account_id: &str,
|
||||
@@ -509,6 +530,7 @@ pub async fn remove_account_for_password(
|
||||
set_state_with_all_accounts(stored_login, first_account_id_when_converting, state).await
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip(mnemonic, prefix))]
|
||||
fn derive_address(
|
||||
mnemonic: bip39::Mnemonic,
|
||||
prefix: &str,
|
||||
@@ -522,6 +544,7 @@ fn derive_address(
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state))]
|
||||
pub async fn list_accounts(
|
||||
state: tauri::State<'_, WalletState>,
|
||||
) -> Result<Vec<AccountEntry>, BackendError> {
|
||||
@@ -545,6 +568,7 @@ pub async fn list_accounts(
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(password))]
|
||||
pub fn show_mnemonic_for_account_in_password(
|
||||
account_id: String,
|
||||
password: String,
|
||||
@@ -557,6 +581,7 @@ pub fn show_mnemonic_for_account_in_password(
|
||||
Ok(mnemonic.to_string())
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip(password))]
|
||||
fn _show_mnemonic_for_account_in_password(
|
||||
login_id: &wallet_storage::LoginId,
|
||||
account_id: &wallet_storage::AccountId,
|
||||
|
||||
@@ -10,6 +10,7 @@ use validator_client::nymd::traits::{MixnetQueryClient, MixnetSigningClient};
|
||||
use validator_client::nymd::Fee;
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state))]
|
||||
pub async fn get_contract_settings(
|
||||
state: tauri::State<'_, WalletState>,
|
||||
) -> Result<TauriContractStateParams, BackendError> {
|
||||
@@ -26,6 +27,7 @@ pub async fn get_contract_settings(
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state))]
|
||||
pub async fn update_contract_settings(
|
||||
params: TauriContractStateParams,
|
||||
fee: Option<Fee>,
|
||||
|
||||
@@ -23,6 +23,7 @@ pub struct NodeDescription {
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state))]
|
||||
pub async fn bond_gateway(
|
||||
gateway: Gateway,
|
||||
pledge: DecCoin,
|
||||
@@ -54,6 +55,7 @@ pub async fn bond_gateway(
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state))]
|
||||
pub async fn unbond_gateway(
|
||||
fee: Option<Fee>,
|
||||
state: tauri::State<'_, WalletState>,
|
||||
@@ -70,6 +72,7 @@ pub async fn unbond_gateway(
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state))]
|
||||
pub async fn bond_mixnode(
|
||||
mixnode: MixNode,
|
||||
cost_params: MixNodeCostParams,
|
||||
@@ -103,6 +106,7 @@ pub async fn bond_mixnode(
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state))]
|
||||
pub async fn pledge_more(
|
||||
fee: Option<Fee>,
|
||||
additional_pledge: DecCoin,
|
||||
@@ -130,6 +134,7 @@ pub async fn pledge_more(
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state))]
|
||||
pub async fn unbond_mixnode(
|
||||
fee: Option<Fee>,
|
||||
state: tauri::State<'_, WalletState>,
|
||||
@@ -146,6 +151,7 @@ pub async fn unbond_mixnode(
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state))]
|
||||
pub async fn update_mixnode_cost_params(
|
||||
new_costs: MixNodeCostParams,
|
||||
fee: Option<Fee>,
|
||||
@@ -173,6 +179,7 @@ pub async fn update_mixnode_cost_params(
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state))]
|
||||
pub async fn update_mixnode_config(
|
||||
update: MixNodeConfigUpdate,
|
||||
fee: Option<Fee>,
|
||||
@@ -198,6 +205,7 @@ pub async fn update_mixnode_config(
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state))]
|
||||
pub async fn get_mixnode_avg_uptime(
|
||||
state: tauri::State<'_, WalletState>,
|
||||
) -> Result<Option<u8>, BackendError> {
|
||||
@@ -224,6 +232,7 @@ pub async fn get_mixnode_avg_uptime(
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state))]
|
||||
pub async fn mixnode_bond_details(
|
||||
state: tauri::State<'_, WalletState>,
|
||||
) -> Result<Option<MixNodeDetails>, BackendError> {
|
||||
@@ -252,6 +261,7 @@ pub async fn mixnode_bond_details(
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state))]
|
||||
pub async fn gateway_bond_details(
|
||||
state: tauri::State<'_, WalletState>,
|
||||
) -> Result<Option<GatewayBond>, BackendError> {
|
||||
@@ -278,6 +288,7 @@ pub async fn gateway_bond_details(
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state))]
|
||||
pub async fn get_pending_operator_rewards(
|
||||
address: String,
|
||||
state: tauri::State<'_, WalletState>,
|
||||
@@ -315,6 +326,7 @@ pub async fn get_pending_operator_rewards(
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state))]
|
||||
pub async fn get_number_of_mixnode_delegators(
|
||||
mix_id: MixId,
|
||||
state: tauri::State<'_, WalletState>,
|
||||
@@ -328,6 +340,7 @@ pub async fn get_number_of_mixnode_delegators(
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument]
|
||||
pub async fn get_mix_node_description(
|
||||
host: &str,
|
||||
port: u16,
|
||||
@@ -343,6 +356,7 @@ pub async fn get_mix_node_description(
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state))]
|
||||
pub async fn get_mixnode_uptime(
|
||||
mix_id: MixId,
|
||||
state: tauri::State<'_, WalletState>,
|
||||
|
||||
@@ -144,6 +144,7 @@ pub async fn undelegate_all_from_mixnode(
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state))]
|
||||
pub async fn get_all_mix_delegations(
|
||||
state: tauri::State<'_, WalletState>,
|
||||
) -> Result<Vec<DelegationWithEverything>, BackendError> {
|
||||
|
||||
@@ -5,6 +5,7 @@ use validator_client::nymd::traits::MixnetSigningClient;
|
||||
use validator_client::nymd::Fee;
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state))]
|
||||
pub async fn create_family(
|
||||
signature: String,
|
||||
label: String,
|
||||
@@ -24,6 +25,7 @@ pub async fn create_family(
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state))]
|
||||
pub async fn join_family(
|
||||
signature: String,
|
||||
family_head: String,
|
||||
@@ -43,6 +45,7 @@ pub async fn join_family(
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state))]
|
||||
pub async fn leave_family(
|
||||
signature: String,
|
||||
family_head: String,
|
||||
@@ -62,6 +65,7 @@ pub async fn leave_family(
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state))]
|
||||
pub async fn kick_family_member(
|
||||
signature: String,
|
||||
member: String,
|
||||
|
||||
@@ -9,6 +9,7 @@ use nym_wallet_types::interval::Interval;
|
||||
use validator_client::nymd::traits::MixnetQueryClient;
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state))]
|
||||
pub async fn get_current_interval(
|
||||
state: tauri::State<'_, WalletState>,
|
||||
) -> Result<Interval, BackendError> {
|
||||
@@ -19,6 +20,7 @@ pub async fn get_current_interval(
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state))]
|
||||
pub async fn get_pending_epoch_events(
|
||||
state: tauri::State<'_, WalletState>,
|
||||
) -> Result<Vec<PendingEpochEvent>, BackendError> {
|
||||
@@ -38,6 +40,7 @@ pub async fn get_pending_epoch_events(
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state))]
|
||||
pub async fn get_pending_interval_events(
|
||||
state: tauri::State<'_, WalletState>,
|
||||
) -> Result<Vec<PendingIntervalEvent>, BackendError> {
|
||||
|
||||
@@ -7,6 +7,7 @@ use validator_client::nymd::traits::{MixnetQueryClient, MixnetSigningClient};
|
||||
use validator_client::nymd::Fee;
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state))]
|
||||
pub async fn claim_operator_reward(
|
||||
fee: Option<Fee>,
|
||||
state: tauri::State<'_, WalletState>,
|
||||
@@ -28,6 +29,7 @@ pub async fn claim_operator_reward(
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state))]
|
||||
pub async fn claim_delegator_reward(
|
||||
mix_id: MixId,
|
||||
fee: Option<Fee>,
|
||||
@@ -49,6 +51,7 @@ pub async fn claim_delegator_reward(
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state))]
|
||||
pub async fn claim_locked_and_unlocked_delegator_reward(
|
||||
mix_id: MixId,
|
||||
fee: Option<Fee>,
|
||||
@@ -97,6 +100,7 @@ pub async fn claim_locked_and_unlocked_delegator_reward(
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state))]
|
||||
pub async fn get_current_rewarding_parameters(
|
||||
state: tauri::State<'_, WalletState>,
|
||||
) -> Result<RewardingParams, BackendError> {
|
||||
|
||||
@@ -6,6 +6,7 @@ use std::str::FromStr;
|
||||
use validator_client::nymd::{AccountId, Fee};
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state))]
|
||||
pub async fn send(
|
||||
address: &str,
|
||||
amount: DecCoin,
|
||||
|
||||
@@ -12,6 +12,7 @@ use validator_client::models::{
|
||||
};
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state))]
|
||||
pub async fn mixnode_core_node_status(
|
||||
mix_id: MixId,
|
||||
since: Option<i64>,
|
||||
@@ -23,6 +24,7 @@ pub async fn mixnode_core_node_status(
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state))]
|
||||
pub async fn gateway_core_node_status(
|
||||
identity: IdentityKeyRef<'_>,
|
||||
since: Option<i64>,
|
||||
@@ -34,6 +36,7 @@ pub async fn gateway_core_node_status(
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state))]
|
||||
pub async fn gateway_report(
|
||||
identity: IdentityKeyRef<'_>,
|
||||
state: tauri::State<'_, WalletState>,
|
||||
@@ -42,6 +45,7 @@ pub async fn gateway_report(
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state))]
|
||||
pub async fn mixnode_status(
|
||||
mix_id: MixId,
|
||||
state: tauri::State<'_, WalletState>,
|
||||
@@ -50,6 +54,7 @@ pub async fn mixnode_status(
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state))]
|
||||
pub async fn mixnode_reward_estimation(
|
||||
mix_id: MixId,
|
||||
state: tauri::State<'_, WalletState>,
|
||||
@@ -60,6 +65,7 @@ pub async fn mixnode_reward_estimation(
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state))]
|
||||
pub async fn compute_mixnode_reward_estimation(
|
||||
mix_id: u32,
|
||||
performance: Option<Performance>,
|
||||
@@ -83,6 +89,7 @@ pub async fn compute_mixnode_reward_estimation(
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state))]
|
||||
pub async fn mixnode_stake_saturation(
|
||||
mix_id: MixId,
|
||||
state: tauri::State<'_, WalletState>,
|
||||
@@ -93,6 +100,7 @@ pub async fn mixnode_stake_saturation(
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state))]
|
||||
pub async fn mixnode_inclusion_probability(
|
||||
mix_id: MixId,
|
||||
state: tauri::State<'_, WalletState>,
|
||||
|
||||
@@ -17,6 +17,7 @@ pub struct SignatureOutputJson {
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state))]
|
||||
pub async fn sign(
|
||||
message: String,
|
||||
state: tauri::State<'_, WalletState>,
|
||||
@@ -42,6 +43,7 @@ pub async fn sign(
|
||||
Ok(output_json)
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip(state))]
|
||||
async fn get_pubkey_from_account_address(
|
||||
address: &AccountId,
|
||||
state: &tauri::State<'_, WalletState>,
|
||||
@@ -74,6 +76,7 @@ enum VerifyInputKind {
|
||||
impl TryFrom<Option<String>> for VerifyInputKind {
|
||||
type Error = BackendError;
|
||||
|
||||
#[tracing::instrument]
|
||||
fn try_from(value: Option<String>) -> Result<Self, Self::Error> {
|
||||
let key = match value {
|
||||
Some(key) => key,
|
||||
@@ -100,6 +103,7 @@ impl TryFrom<Option<String>> for VerifyInputKind {
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state))]
|
||||
pub async fn verify(
|
||||
public_key_as_json_or_account_address: Option<String>,
|
||||
signature_as_hex: String,
|
||||
|
||||
@@ -8,6 +8,7 @@ use mixnet_contract_common::{ContractStateParams, ExecuteMsg};
|
||||
use nym_wallet_types::admin::TauriContractStateParams;
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state))]
|
||||
pub async fn simulate_update_contract_settings(
|
||||
params: TauriContractStateParams,
|
||||
state: tauri::State<'_, WalletState>,
|
||||
|
||||
@@ -9,6 +9,7 @@ use std::str::FromStr;
|
||||
use validator_client::nymd::{AccountId, MsgSend};
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state))]
|
||||
pub async fn simulate_send(
|
||||
address: &str,
|
||||
amount: DecCoin,
|
||||
|
||||
@@ -9,6 +9,7 @@ use mixnet_contract_common::{ExecuteMsg, Gateway, MixId, MixNode};
|
||||
use nym_types::currency::DecCoin;
|
||||
use nym_types::mixnode::MixNodeCostParams;
|
||||
|
||||
#[tracing::instrument(skip(state))]
|
||||
async fn simulate_mixnet_operation(
|
||||
msg: ExecuteMsg,
|
||||
raw_funds: Option<DecCoin>,
|
||||
@@ -36,6 +37,7 @@ async fn simulate_mixnet_operation(
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state))]
|
||||
pub async fn simulate_bond_gateway(
|
||||
gateway: Gateway,
|
||||
pledge: DecCoin,
|
||||
@@ -54,6 +56,7 @@ pub async fn simulate_bond_gateway(
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state))]
|
||||
pub async fn simulate_unbond_gateway(
|
||||
state: tauri::State<'_, WalletState>,
|
||||
) -> Result<FeeDetails, BackendError> {
|
||||
@@ -61,6 +64,7 @@ pub async fn simulate_unbond_gateway(
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state))]
|
||||
pub async fn simulate_bond_mixnode(
|
||||
mixnode: MixNode,
|
||||
cost_params: MixNodeCostParams,
|
||||
@@ -85,6 +89,7 @@ pub async fn simulate_bond_mixnode(
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state))]
|
||||
pub async fn simulate_pledge_more(
|
||||
additional_pledge: DecCoin,
|
||||
state: tauri::State<'_, WalletState>,
|
||||
@@ -93,6 +98,7 @@ pub async fn simulate_pledge_more(
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state))]
|
||||
pub async fn simulate_unbond_mixnode(
|
||||
state: tauri::State<'_, WalletState>,
|
||||
) -> Result<FeeDetails, BackendError> {
|
||||
@@ -100,6 +106,7 @@ pub async fn simulate_unbond_mixnode(
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state))]
|
||||
pub async fn simulate_update_mixnode_cost_params(
|
||||
new_costs: MixNodeCostParams,
|
||||
state: tauri::State<'_, WalletState>,
|
||||
@@ -117,6 +124,7 @@ pub async fn simulate_update_mixnode_cost_params(
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state))]
|
||||
pub async fn simulate_update_mixnode_config(
|
||||
update: MixNodeConfigUpdate,
|
||||
state: tauri::State<'_, WalletState>,
|
||||
@@ -130,6 +138,7 @@ pub async fn simulate_update_mixnode_config(
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state))]
|
||||
pub async fn simulate_delegate_to_mixnode(
|
||||
mix_id: MixId,
|
||||
amount: DecCoin,
|
||||
@@ -144,6 +153,7 @@ pub async fn simulate_delegate_to_mixnode(
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state))]
|
||||
pub async fn simulate_undelegate_from_mixnode(
|
||||
mix_id: MixId,
|
||||
state: tauri::State<'_, WalletState>,
|
||||
@@ -152,6 +162,7 @@ pub async fn simulate_undelegate_from_mixnode(
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state))]
|
||||
pub async fn simulate_claim_operator_reward(
|
||||
state: tauri::State<'_, WalletState>,
|
||||
) -> Result<FeeDetails, BackendError> {
|
||||
@@ -159,6 +170,7 @@ pub async fn simulate_claim_operator_reward(
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state))]
|
||||
pub async fn simulate_claim_delegator_reward(
|
||||
mix_id: MixId,
|
||||
state: tauri::State<'_, WalletState>,
|
||||
|
||||
@@ -24,6 +24,7 @@ pub(crate) struct SimulateResult {
|
||||
}
|
||||
|
||||
impl SimulateResult {
|
||||
#[tracing::instrument]
|
||||
pub fn new(
|
||||
gas_info: Option<GasInfo>,
|
||||
gas_price: GasPrice,
|
||||
|
||||
@@ -10,6 +10,7 @@ use nym_types::currency::DecCoin;
|
||||
use nym_types::mixnode::MixNodeCostParams;
|
||||
use vesting_contract_common::ExecuteMsg;
|
||||
|
||||
#[tracing::instrument(skip(state))]
|
||||
async fn simulate_vesting_operation(
|
||||
msg: ExecuteMsg,
|
||||
raw_funds: Option<DecCoin>,
|
||||
@@ -37,6 +38,7 @@ async fn simulate_vesting_operation(
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state))]
|
||||
pub async fn simulate_vesting_bond_gateway(
|
||||
gateway: Gateway,
|
||||
pledge: DecCoin,
|
||||
@@ -59,6 +61,7 @@ pub async fn simulate_vesting_bond_gateway(
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state))]
|
||||
pub async fn simulate_vesting_unbond_gateway(
|
||||
state: tauri::State<'_, WalletState>,
|
||||
) -> Result<FeeDetails, BackendError> {
|
||||
@@ -66,6 +69,7 @@ pub async fn simulate_vesting_unbond_gateway(
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state))]
|
||||
pub async fn simulate_vesting_bond_mixnode(
|
||||
mixnode: MixNode,
|
||||
cost_params: MixNodeCostParams,
|
||||
@@ -92,6 +96,7 @@ pub async fn simulate_vesting_bond_mixnode(
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state))]
|
||||
pub async fn simulate_vesting_pledge_more(
|
||||
additional_pledge: DecCoin,
|
||||
state: tauri::State<'_, WalletState>,
|
||||
@@ -105,6 +110,7 @@ pub async fn simulate_vesting_pledge_more(
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state))]
|
||||
pub async fn simulate_vesting_unbond_mixnode(
|
||||
state: tauri::State<'_, WalletState>,
|
||||
) -> Result<FeeDetails, BackendError> {
|
||||
@@ -112,6 +118,7 @@ pub async fn simulate_vesting_unbond_mixnode(
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state))]
|
||||
pub async fn simulate_vesting_update_mixnode_cost_params(
|
||||
new_costs: MixNodeCostParams,
|
||||
state: tauri::State<'_, WalletState>,
|
||||
@@ -129,6 +136,7 @@ pub async fn simulate_vesting_update_mixnode_cost_params(
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state))]
|
||||
pub async fn simulate_vesting_update_mixnode_config(
|
||||
update: MixNodeConfigUpdate,
|
||||
state: tauri::State<'_, WalletState>,
|
||||
@@ -142,6 +150,7 @@ pub async fn simulate_vesting_update_mixnode_config(
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state))]
|
||||
pub async fn simulate_vesting_delegate_to_mixnode(
|
||||
mix_id: MixId,
|
||||
amount: DecCoin,
|
||||
@@ -159,6 +168,7 @@ pub async fn simulate_vesting_delegate_to_mixnode(
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state))]
|
||||
pub async fn simulate_vesting_undelegate_from_mixnode(
|
||||
mix_id: MixId,
|
||||
state: tauri::State<'_, WalletState>,
|
||||
@@ -167,6 +177,7 @@ pub async fn simulate_vesting_undelegate_from_mixnode(
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state))]
|
||||
pub async fn simulate_withdraw_vested_coins(
|
||||
amount: DecCoin,
|
||||
state: tauri::State<'_, WalletState>,
|
||||
@@ -177,6 +188,7 @@ pub async fn simulate_withdraw_vested_coins(
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state))]
|
||||
pub async fn simulate_vesting_claim_operator_reward(
|
||||
state: tauri::State<'_, WalletState>,
|
||||
) -> Result<FeeDetails, BackendError> {
|
||||
@@ -184,6 +196,7 @@ pub async fn simulate_vesting_claim_operator_reward(
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state))]
|
||||
pub async fn simulate_vesting_claim_delegator_reward(
|
||||
mix_id: MixId,
|
||||
state: tauri::State<'_, WalletState>,
|
||||
|
||||
@@ -10,6 +10,7 @@ use nym_types::transaction::TransactionExecuteResult;
|
||||
use validator_client::nymd::{Fee, VestingSigningClient};
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state))]
|
||||
pub async fn vesting_bond_gateway(
|
||||
gateway: Gateway,
|
||||
pledge: DecCoin,
|
||||
@@ -41,6 +42,7 @@ pub async fn vesting_bond_gateway(
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state))]
|
||||
pub async fn vesting_unbond_gateway(
|
||||
fee: Option<Fee>,
|
||||
state: tauri::State<'_, WalletState>,
|
||||
@@ -60,6 +62,7 @@ pub async fn vesting_unbond_gateway(
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state))]
|
||||
pub async fn vesting_bond_mixnode(
|
||||
mixnode: MixNode,
|
||||
cost_params: MixNodeCostParams,
|
||||
@@ -94,6 +97,7 @@ pub async fn vesting_bond_mixnode(
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state))]
|
||||
pub async fn vesting_pledge_more(
|
||||
fee: Option<Fee>,
|
||||
additional_pledge: DecCoin,
|
||||
@@ -121,6 +125,7 @@ pub async fn vesting_pledge_more(
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state))]
|
||||
pub async fn vesting_unbond_mixnode(
|
||||
fee: Option<Fee>,
|
||||
state: tauri::State<'_, WalletState>,
|
||||
@@ -144,6 +149,7 @@ pub async fn vesting_unbond_mixnode(
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state))]
|
||||
pub async fn withdraw_vested_coins(
|
||||
amount: DecCoin,
|
||||
fee: Option<Fee>,
|
||||
@@ -172,6 +178,7 @@ pub async fn withdraw_vested_coins(
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state))]
|
||||
pub async fn vesting_update_mixnode_cost_params(
|
||||
new_costs: MixNodeCostParams,
|
||||
fee: Option<Fee>,
|
||||
@@ -200,6 +207,7 @@ pub async fn vesting_update_mixnode_cost_params(
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state))]
|
||||
pub async fn vesting_update_mixnode_config(
|
||||
update: MixNodeConfigUpdate,
|
||||
fee: Option<Fee>,
|
||||
|
||||
@@ -9,6 +9,7 @@ use nym_types::transaction::TransactionExecuteResult;
|
||||
use validator_client::nymd::{Fee, VestingSigningClient};
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state))]
|
||||
pub async fn vesting_delegate_to_mixnode(
|
||||
mix_id: MixId,
|
||||
amount: DecCoin,
|
||||
@@ -39,6 +40,7 @@ pub async fn vesting_delegate_to_mixnode(
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state))]
|
||||
pub async fn vesting_undelegate_from_mixnode(
|
||||
mix_id: MixId,
|
||||
fee: Option<Fee>,
|
||||
|
||||
@@ -173,6 +173,7 @@ pub async fn delegated_free(
|
||||
|
||||
/// Returns the total amount of delegated tokens that have vested
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state))]
|
||||
pub async fn delegated_vesting(
|
||||
block_time: Option<u64>,
|
||||
vesting_account_address: &str,
|
||||
@@ -196,6 +197,7 @@ pub async fn delegated_vesting(
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state))]
|
||||
pub async fn vesting_get_mixnode_pledge(
|
||||
address: &str,
|
||||
state: tauri::State<'_, WalletState>,
|
||||
@@ -217,6 +219,7 @@ pub async fn vesting_get_mixnode_pledge(
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state))]
|
||||
pub async fn vesting_get_gateway_pledge(
|
||||
address: &str,
|
||||
state: tauri::State<'_, WalletState>,
|
||||
@@ -238,6 +241,7 @@ pub async fn vesting_get_gateway_pledge(
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state))]
|
||||
pub async fn get_current_vesting_period(
|
||||
address: &str,
|
||||
state: tauri::State<'_, WalletState>,
|
||||
@@ -251,6 +255,7 @@ pub async fn get_current_vesting_period(
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state))]
|
||||
pub async fn get_account_info(
|
||||
address: &str,
|
||||
state: tauri::State<'_, WalletState>,
|
||||
|
||||
@@ -8,6 +8,7 @@ use nym_types::transaction::TransactionExecuteResult;
|
||||
use validator_client::nymd::Fee;
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state))]
|
||||
pub async fn vesting_claim_operator_reward(
|
||||
fee: Option<Fee>,
|
||||
state: tauri::State<'_, WalletState>,
|
||||
@@ -28,6 +29,7 @@ pub async fn vesting_claim_operator_reward(
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[tracing::instrument(skip(state))]
|
||||
pub async fn vesting_claim_delegator_reward(
|
||||
mix_id: MixId,
|
||||
fee: Option<Fee>,
|
||||
|
||||
Reference in New Issue
Block a user