in typescript we use this for asset manager:
import { AssetManager } from “@dfinity /assets”;
i want to implement the Assetmanager in rust frontend:
to interact with asset canister from rust frontend , do we have some crate for asset manager in rust or some other way?
my current implementation for asset manager:
// asset_manager.rs
use candid::Principal;
use candid::{CandidType, Deserialize};
use candid::{Decode, Encode};
use ic_agent::Agent;
use serde::Serialize;
pub struct AssetManager<'a> {
upload_canister_id: Principal,
// asset_canister_id: Principal,
agent: &'a Agent,
}
#[derive(Serialize, Deserialize, CandidType)]
struct StoreResponse {
success: bool,
key: Option<String>,
error: Option<String>,
}
This file has been truncated. show original
Severin
November 25, 2024, 11:59am
2
dfx uses ic-asset
to interact with the asset canister. Have a look at that. It is pretty opinionated, so no guarantees that it is useful for you…
tried it ,
just adding it to toml file gives me this error in trunk serve:
error: failed to run custom build command for libloading v0.5.2
i cheked my xcode dependencies are installed
Severin
November 25, 2024, 12:17pm
5
libloading is a dependency of a dependency of a dependency. I don’t think I can help with that. Is your setup somehow weird? I would expect that if target_os is set to something sensible that it would compile nicely
1 Like
thanks it worked when i use it like this:
[target.‘cfg(not(target_arch = “wasm32”))’.dependencies]
@Severin as mentioned in my question ,the implementation of assetmanager is correct i guess , as i get this error which is backend related and my call is able to reach the backend , am i correct?
or do i have to use ic-asset , i am not sure about it if i have to ?
Severin
November 25, 2024, 1:27pm
9
Yes, correct, this is an error with the backend. assetmanager is making a call and receives back an error from the backend
1 Like
no need for ic-asset then