dfinity / dfinity/candid

As a CDK author and Azle developer, I want to import the automatically generated IDL objects so that I can use them in Azle

Open
#569 8 comments 0 reactions 0 assignees View on GitHub

A pull request for this has already been merged.

  • #665 by @lastmjs — merged
enhancement
Dominant language
Rust
Stars
301
Forks
85
Avg merge
1h 4m
Merged PRs (30d)
4

Description

Is your feature request related to a problem? Please describe.

Here is the context and discussion: https://forum.dfinity.org/t/automatic-javascript-idl-generation-from-candid/32692

I would like the automatically generated IDL objects (like from dfx generate) to be exported from their module so that we can import them and use them across Azle APIs. Azle's 1.0-bound syntax uses @dfinity/candid IDL objects to handle Candid serialization and deserialization. Tools like dfx generate make it easy to obtain these IDL objects for arbitrary canisters. But the generated code does not export these objects, so devs cannot currently make automatic use of these objects.

Describe the solution you'd like

Just export these objects from the generated code. They are currently not exported and stuck within a function scope I believe. Just export them with their current names.

Describe alternatives you've considered

Alternatives are to write these objects by hand, or manually edit the generated code, or write a tool that manipulates the code...the most ideal straight-forward and probably simplest solution is to just export these objects. They already exist, we just need them exported.

Additional context

Here is the context and discussion: https://forum.dfinity.org/t/automatic-javascript-idl-generation-from-candid/32692

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the JavaScript output produced by dfx generate and inspect how the @dfinity/candid IDL objects are scoped. The change is complete when those existing objects are exported with their current names and can be imported for use across Azle APIs. Check the linked discussion and merged pull request for the current implementation status.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
api
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.