You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
mod my_module {pubstructTestRecord{id:String,}#[ic_cdk_macros::update]fntest() -> TestRecord{TestRecord{id:"hello".to_string(),}}}
I get these errors:
error[E0412]: cannot find type `TestRecord` in this scope
--> src/src/lib.rs:3192:1
|
3192 | candid::export_service!();
| ^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope
|
= note: this error originates in the macro `candid::export_service` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider importing this struct
|
2 | use crate::my_module::TestRecord;
|
This is a minimally reproducible example of an issue we're running into in Azle (TypeScript CDK). A simple one-off solution is to add a fully qualified path to TestRecord in the method return type, such as crate::my_module::TestRecord. This is difficult for us to do in a generalized fashion for Azle though.
It would be ideal if the export_service! macro could fully handle methods defined within their own modules inside of the main canister crate.
The text was updated successfully, but these errors were encountered:
Is it possible to move the test function to the top-level? We are thinking of only allowing endpoint functions at the top level, or as an impl of a struct.
Defining endpoint functions in a module has security risks: when other people import this module, they suddenly get the same endpoint without notice. So while it's currently possible, it's not a recommended style.
When I run this code:
I get these errors:
This is a minimally reproducible example of an issue we're running into in Azle (TypeScript CDK). A simple one-off solution is to add a fully qualified path to
TestRecord
in the method return type, such ascrate::my_module::TestRecord
. This is difficult for us to do in a generalized fashion for Azle though.It would be ideal if the
export_service!
macro could fully handle methods defined within their own modules inside of the main canister crate.The text was updated successfully, but these errors were encountered: