-
-
Save GrafMine/cc6ff262660f8143b9915607428c5df9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let get_provider = move || { | |
if let Some(win) = web_sys::window() { | |
if let Some(_phantom) = win.get("phantom") { | |
if let Some(phantom) = _phantom.dyn_ref::<js_sys::Object>() { | |
if let Ok(_solana) = js_sys::Reflect::get(phantom, &"solana".into()) { | |
if let Some(solana) = _solana.dyn_ref::<js_sys::Object>() { | |
if let Ok(is_phantom) = js_sys::Reflect::get(solana, &"isPhantom".into()) { | |
if is_phantom.as_bool() == Some(true) { | |
set_provider(Some(phantom.clone())); | |
} | |
} | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment