Skip to content

Commit

Permalink
revert to debank api (#151)
Browse files Browse the repository at this point in the history
  • Loading branch information
domechn authored Nov 8, 2023
1 parent 3104402 commit a446714
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ Thanks for these platform who provide powerful APIs without API Key. Fuck API Ke
- https://blockchain.info
- https://blockcypher.com
- https://ethplorer.io
- https://debank.com
- https://dogechain.info
- https://phantom.app
- https://coingecko.com
38 changes: 38 additions & 0 deletions src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,42 @@ async fn get_polybase_namespace(handle: tauri::AppHandle) -> Result<String, Stri
}
}

#[cfg_attr(
all(not(debug_assertions), target_os = "windows"),
windows_subsystem = "windows"
)]
#[tauri::command]
async fn open_debank_window_in_background(handle: tauri::AppHandle, address: String) {
let debank_window = tauri::WindowBuilder::new(
&handle,
"debank-refresh", /* the unique window label */
tauri::WindowUrl::External(
format!("https://debank.com/profile/{address}") // eth contract address
.parse()
.unwrap(),
),
)
.inner_size(0.0, 0.0)
.build();

if let Ok(debank_window) = debank_window {
debank_window.hide().unwrap();
}
}

#[cfg_attr(
all(not(debug_assertions), target_os = "windows"),
windows_subsystem = "windows"
)]
#[tauri::command]
async fn close_debank_window(handle: tauri::AppHandle) {
// get window
let debank_window = handle.get_window("debank-refresh");
if let Some(debank_window) = debank_window {
debank_window.close().unwrap();
}
}

fn main() {
tauri::Builder::default()
.plugin(tauri_plugin_sql::Builder::default().build())
Expand Down Expand Up @@ -199,6 +235,8 @@ fn main() {
md5,
get_polybase_namespace,
download_coins_logos,
open_debank_window_in_background,
close_debank_window,
])
.run(tauri::generate_context!())
.expect("error while running tauri application");
Expand Down

0 comments on commit a446714

Please sign in to comment.