Skip to content

Commit

Permalink
Updated backend
Browse files Browse the repository at this point in the history
  • Loading branch information
girogio committed Feb 17, 2024
1 parent a513870 commit 6929359
Show file tree
Hide file tree
Showing 46 changed files with 3,278 additions and 1,622 deletions.
26 changes: 13 additions & 13 deletions backend/Cargo.lock

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

17 changes: 8 additions & 9 deletions backend/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "avail_wallet"
version = "0.0.2"
version = "0.0.1"
description = "A Tauri App"
authors = ["Avail"]
license = ""
Expand All @@ -19,8 +19,8 @@ tauri-build = { version = "2.0.0-alpha.11", features = [] }

[dependencies]
app_dirs = { package = "app_dirs2", version = "2.5" }
avail-common = { git = "https://github.com/availx/avail-lib", tag = "v0.3.0", features = [
"tauri",
avail-common = { git = "https://github.com/availx/avail-lib", tag = "v0.5.0", features = [
"snarkvm",
] }
bs58 = "0.5.0"
chrono = "0.4.26"
Expand Down Expand Up @@ -50,6 +50,11 @@ tokio = { version = "1.29.1", features = ["full"] }
ureq = { version = "2.7.1", features = ["json"] }
uuid = { version = "1.4.1", features = ["v4", "serde"] }
whoami = "1.4.1"
zeroize = { version = "1.7.0", features = [
"aarch64",
"zeroize_derive",
"alloc",
] }

[target.'cfg(any(target_os = "macos", target_os = "ios"))'.dependencies]
keyring = "2.0.5"
Expand All @@ -60,7 +65,6 @@ tid-rs = { git = "https://github.com/Zack-Xb/tid-rs" }


[profile.release]
strip = true
opt-level = 3
lto = "thin"
incremental = true
Expand All @@ -79,11 +83,6 @@ lto = "thin"
incremental = true

[profile.test]
opt-level = 2
lto = "thin"
incremental = true
debug = true
debug-assertions = true

[features]
# this feature is used for production builds or when `devPath` points to the filesystem
Expand Down
Binary file modified backend/icons/128x128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified backend/icons/32x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified backend/icons/icon.ico
Binary file not shown.
6 changes: 6 additions & 0 deletions backend/package-lock.json

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

7 changes: 5 additions & 2 deletions backend/src/api/aleo_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,15 @@ pub fn setup_local_client<N: Network>() -> AleoAPIClient<N> {
}

pub fn setup_client<N: Network>() -> AvailResult<AleoAPIClient<N>> {
//let network = get_network()?;
dotenv::dotenv().ok();

let node_api_obscura = match std::env::var("TESTNET_API_OBSCURA") {
Ok(val) => val,
Err(_e) => "".to_string(),
};

println!("Node API Obscura: {:?}", node_api_obscura);

let base_url = format!(
"https://aleo-testnet3.obscura.build/v1/{}",
node_api_obscura
Expand Down Expand Up @@ -134,7 +137,7 @@ pub static ALEO_CLIENT: Lazy<RwLock<AleoClient<Testnet3>>> =

#[test]
fn test_new_client() {
let api_client = setup_local_client::<Testnet3>();
let api_client = setup_client::<Testnet3>().unwrap();
let height = api_client.latest_height().unwrap();

println!("Height: {:?}", height);
Expand Down
14 changes: 11 additions & 3 deletions backend/src/api/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ pub fn get_rm_client_with_session(
method: reqwest::Method,
path: &str,
) -> AvailResult<reqwest::RequestBuilder> {
dotenv::dotenv().ok();

let api = env!("API");

let client = reqwest::Client::new();
let cookie_name = "id";

Expand All @@ -25,7 +29,8 @@ pub fn get_rm_client_with_session(
};

let cookie_value = format!("{}={}", cookie_name, session);
let url = format!("http://{}:8001/{}", HOST, path);
let url = format!("{}/encrypted_data/{}", api, path);

let request = client
.request(method, url)
.header(reqwest::header::COOKIE, cookie_value);
Expand All @@ -36,6 +41,10 @@ pub fn get_um_client_with_session(
method: reqwest::Method,
path: &str,
) -> AvailResult<reqwest::RequestBuilder> {
dotenv::dotenv().ok();

let api = env!("API");

let client = reqwest::Client::new();
let cookie_name = "id";

Expand All @@ -52,8 +61,7 @@ pub fn get_um_client_with_session(

let cookie_value = format!("{}={}", cookie_name, session);

let url = format!("http://{}:8000/{}", HOST, path);
println!("URL: {}", url);
let url = format!("{}/{}", api, path);
let request = client
.request(method, url)
.header(reqwest::header::COOKIE, cookie_value);
Expand Down
Loading

0 comments on commit 6929359

Please sign in to comment.