Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ edition = "2021"


[dependencies]
iced = { git = "https://github.com/iced-rs/iced.git", features = ["debug", "image", "tokio"]}
iced = { git = "https://github.com/iced-rs/iced.git", features = ["debug", "image", "tokio", "wgpu"] }
tokio = { version = "1.40.0", features = ["fs"] }
rfd = { version = "0.15.0" }
solana-cli-config = "^2.1.6"
Expand Down
6 changes: 2 additions & 4 deletions src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pub enum Error {
InvalidProgramLen,
UnexpectedError,
ProgramAccountNotLoaded,
TransactionConfirmationStatusFailed,

InsufficientSolBalance,
UndefinedNewBufferAuthority,
}
Expand Down Expand Up @@ -46,9 +46,7 @@ impl Clone for Error {
Error::InvalidProgramLen => Error::InvalidProgramLen,
Error::UnexpectedError => Error::UnexpectedError,
Error::ProgramAccountNotLoaded => Error::ProgramAccountNotLoaded,
Error::TransactionConfirmationStatusFailed => {
Error::TransactionConfirmationStatusFailed
}

Error::InsufficientSolBalance => Error::InsufficientSolBalance,
Error::UndefinedNewBufferAuthority => Error::UndefinedNewBufferAuthority,
}
Expand Down
17 changes: 15 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use components::error;
use iced::{
clipboard,
widget::{column, container},
Element, Subscription, Task, Theme,
Element, Settings, Subscription, Task, Theme,
};
use programs::{get_program_bytes, LPrograms, Progress};
use settings::{keypair_balance, LSettings};
Expand All @@ -25,9 +25,22 @@ use files::{default_keypair_path, pick_file, FileType};
use keypair::load_keypair_from_file;

fn main() -> iced::Result {
// Force software rendering on Wayland to avoid GPU compatibility issues
std::env::set_var("WGPU_BACKEND", "gl");
std::env::set_var("WGPU_POWER_PREF", "low");

// Disable DRI3 to avoid DMABuf issues
std::env::set_var("LIBGL_DRI3_DISABLE", "1");

let settings = Settings {
antialiasing: false,
..Settings::default()
};

iced::application(LichDeployer::title, LichDeployer::update, LichDeployer::view)
.theme(LichDeployer::theme)
.subscription(LichDeployer::subscription)
.settings(settings)
.run_with(LichDeployer::new)
}

Expand Down Expand Up @@ -240,7 +253,7 @@ impl LichDeployer {
}
}

fn view(&self) -> Element<Message> {
fn view(&self) -> Element<'_, Message> {
let settings = self.settings.view(&self.programs);
let is_data_writed = self.programs.deployed_message_element();
let deploy_btn = self.programs.deploy_or_upgrade_btn();
Expand Down
12 changes: 6 additions & 6 deletions src/programs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ impl LPrograms {

// ------> UI COMPONENTS <------ //

pub fn deployed_message_element(&self) -> Element<Message> {
pub fn deployed_message_element(&self) -> Element<'_, Message> {
let is_data_writed = if self.is_data_writed {
text("Data written successfully").size(14)
} else {
Expand All @@ -319,7 +319,7 @@ impl LPrograms {
is_data_writed.into()
}

pub fn buffer_address(&self) -> Element<Message> {
pub fn buffer_address(&self) -> Element<'_, Message> {
let buffer_str = self.buffer_account.pubkey().to_string();
let label = text(format!("Buffer Address: ",))
.size(14)
Expand All @@ -334,7 +334,7 @@ impl LPrograms {
container.into()
}

pub fn write_data_btn(&self) -> Element<Message> {
pub fn write_data_btn(&self) -> Element<'_, Message> {
let write_data_btn = button("Write data").on_press(Message::WriteData);
write_data_btn.into()
}
Expand All @@ -352,7 +352,7 @@ impl LPrograms {
container.into()
}

pub fn deploy_or_upgrade_btn(&self) -> Element<Message> {
pub fn deploy_or_upgrade_btn(&self) -> Element<'_, Message> {
if self.is_data_writed {
let deploy = button("Deploy").on_press(Message::DeployProgram);
deploy.into()
Expand All @@ -363,7 +363,7 @@ impl LPrograms {
}
}

pub fn set_new_buffer_auth_items(&self) -> Element<Message> {
pub fn set_new_buffer_auth_items(&self) -> Element<'_, Message> {
if self.is_data_writed {
let new_buffer_auth_input_label = text(format!("New Buffer Authority: ",))
.size(14)
Expand Down Expand Up @@ -395,7 +395,7 @@ impl LPrograms {
}
}

pub fn signature_text_with_copy(&self) -> Element<Message> {
pub fn signature_text_with_copy(&self) -> Element<'_, Message> {
if let Some(signature) = self.signature {
let signature_text = text(format!("tx: {}", signature.to_string()));
let copy_btn = copy_to_cliboard_btn(&signature.to_string());
Expand Down
1 change: 0 additions & 1 deletion src/transactions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ pub async fn send_tx_and_verify_status(
solana_transaction_status::TransactionConfirmationStatus::Processed => continue,
solana_transaction_status::TransactionConfirmationStatus::Confirmed
| solana_transaction_status::TransactionConfirmationStatus::Finalized => break,
_ => return Err(Error::TransactionConfirmationStatusFailed),
};
}
time::sleep(Duration::from_millis(500)).await
Expand Down