I am working on an “integration” project and one of the features is that the user choose what canister, method and args to pass into the backend, and the backend will make an intercanister call based on these input:
the issue here is that the return value of the ICC is not known to me since its not something I can know because it can be any canister and method specified by the user.
is there a way to use a generic type for the return value of the ICC? I tried using serde_json’s Value but thats giving me an error
the trait bound `Value: CandidType` is not satisfied
the following other types implement trait `CandidType`:
bool
isize
i8
i16
i32
i64
i128
usize
and 139 others
required for `(Value,)` to implement `for<'a> ArgumentDecoder<'a>`
also dont think Value of a good choice here, since it woud be a Result, Option etc…
so when I execute this call it returns an error: failed to decode canister response as (alloc::string::String,): Fail to decode argument 0 from table0 to text.
would that mean I need to send back a Vec<u8> to the front end? What I actually want as the next step is to send back the response as a “preview” response back to the front end and show the response
thats what I have been trying, sending back the Vec<u8> to the front end and decode it, but without success. Also, I need the Vec<u8> to be “real” data futher along in the process. I looked into the decode_args from candid but that required a tuple type which I dont have
So the flow is:
receive data
fetch data from another canister (canisterId etc supplied by user)
use the fetched data futher in the process, add, combine data with other flows