I don’t know enough about these functions to make any solid suggestions. But in general we now suggest using ic-cdk-bindgen like this to generate canister bindings. Not sure it’s worth migrating for you, but maybe you want to have a look into that crate’s source
In this use case, you cannot use ic-cdk because the code needs to be generated for the frontend, not within a canister.
Therefore, you need a structure similar to the Actor in JavaScript, which contains an ic-agent::Agent instance and methods for interacting with canisters.
To achieve this, you can follow the source code of the code_generator in ic-cdk-bindgen and the @dfinity/agent library in JavaScript. However, considering the complexity, it would be better to separate this functionality into a dedicated library in the future, perhaps with a name like ic-agent-bindgen.
Alternatively, you can simply specify the method name as an argument when making calls with the Agent.
i am doing a similar thing in a different project and it works fine .
i have updated my project too where i am using Agent using ic_auth_client( a crate provided by @wiyota ) which works fine in the other project:
i have also checked the build files inside target/…/out/…
and the builds for candid files are generated correctly in my new project where i am struggling to import the methods from did file
@wiyota@Severin could you check please whats wrong in my project as it works in the other project .