diff --git a/src/components/settings.rs b/src/components/settings.rs index 139e9e52..0ae1c81f 100644 --- a/src/components/settings.rs +++ b/src/components/settings.rs @@ -34,7 +34,7 @@ pub fn Settings() -> Element { // MI let mut priority_fee_cap = use_priority_fee_cap(); - let mut priority_fee_cap_input = use_signal(|| priority_fee_cap.read().0.clone()); + let mut priority_fee_cap_input = use_signal(|| priority_fee_cap.read().0); let mut priority_fee_cap_error = use_signal::>(|| None); let is_priority_fee_cap_edited = priority_fee_cap.read().0.ne(&*priority_fee_cap_input.read()); @@ -315,9 +315,9 @@ pub fn Settings() -> Element { } } div { - class: "w-full flex flex-auto flex-col gap-2 justify-end", + class: "w-full flex flex-auto flex-col gap-2 justify-between", div { - class: "flex flex-row flex-shrink h-min gap-1 shrink mb-auto", + class: "w-full flex flex-row justify-end flex-shrink h-min gap-1 shrink mb-auto", input { class: "bg-transparent dark:text-white text-right px-1 mb-auto rounded font-semibold hover:bg-green-600 transition-colors", dir: "rtl", @@ -362,7 +362,7 @@ pub fn Settings() -> Element { button { class: "bg-green-500 hover:bg-green-600 active:bg-green-700 text-white rounded shrink ml-auto transition-colors px-2 py-1", onclick: move |_| { - priority_fee_cap.set(PriorityFeeCap(priority_fee_cap_input.read().clone())); + priority_fee_cap.set(PriorityFeeCap(*priority_fee_cap_input.read())); }, "Save" } diff --git a/src/hooks/use_fee_url.rs b/src/hooks/use_fee_url.rs index 583cc056..d980cfa7 100644 --- a/src/hooks/use_fee_url.rs +++ b/src/hooks/use_fee_url.rs @@ -16,6 +16,6 @@ pub fn use_fee_url() -> Signal { } pub fn use_fee_url_provider() { - let fee_url = use_persistent(KEY, || FeeUrl(FEE_URL.to_string())); - use_context_provider(|| Signal::new(fee_url.get())); + let fee_url = use_persistent(KEY, || FeeUrl(FEE_URL.to_string())).get(); + use_context_provider(|| Signal::new(fee_url)); } diff --git a/src/hooks/use_priority_fee_cap.rs b/src/hooks/use_priority_fee_cap.rs index 457a368b..a0378111 100644 --- a/src/hooks/use_priority_fee_cap.rs +++ b/src/hooks/use_priority_fee_cap.rs @@ -5,17 +5,17 @@ use crate::{gateway::PRIORITY_FEE_CAP, hooks::use_persistent::use_persistent}; const KEY: &str = "priority_fee_cap"; -#[derive(Clone, Debug, Default, Deserialize, Serialize, PartialEq)] +#[derive(Clone, Copy, Debug, Default, Deserialize, Serialize, PartialEq)] pub struct PriorityFeeCap(pub u64); pub fn use_priority_fee_cap() -> Signal { let priority_fee_cap = use_context::>(); let mut priority_fee_cap_persistent = use_persistent(KEY, || PriorityFeeCap(PRIORITY_FEE_CAP)); - use_effect(move || priority_fee_cap_persistent.set(priority_fee_cap.read().clone())); + use_effect(move || priority_fee_cap_persistent.set(*priority_fee_cap.read())); priority_fee_cap } pub fn use_priority_fee_cap_provider() { - let priority_fee_cap = use_persistent(KEY, || PriorityFeeCap(PRIORITY_FEE_CAP)); - use_context_provider(|| Signal::new(priority_fee_cap.get())); + let priority_fee_cap = use_persistent(KEY, || PriorityFeeCap(PRIORITY_FEE_CAP)).get(); + use_context_provider(|| Signal::new(priority_fee_cap)); } diff --git a/src/hooks/use_rpc.rs b/src/hooks/use_rpc.rs index d73d3da6..1aece408 100644 --- a/src/hooks/use_rpc.rs +++ b/src/hooks/use_rpc.rs @@ -16,6 +16,6 @@ pub fn use_rpc_url() -> Signal { } pub fn use_rpc_url_provider() { - let rpc = use_persistent(KEY, || RpcUrl(RPC_URL.to_string())); - use_context_provider(|| Signal::new(rpc.get())); + let rpc = use_persistent(KEY, || RpcUrl(RPC_URL.to_string())).get(); + use_context_provider(|| Signal::new(rpc)); }