Importing ledger in motoko

Hi, I have troubles when I use this import:

image

The ledger canister is correctly installed, I have followed this tutorial.

This is the ledger in my dfx.json:

image

Am I missing something? Or should I use a different import method?

What happens if you do dfx build? Does the build fail as well? I’ve had it happen before that the IDE claimed that there’s a problem but there actually was none.

Yes, I tried but it fails. It’s not like the terminal is showing any errors, but the build just stop suddenly during the deployment of the motoko file in which there is the import.

Like so:

the file is sale.mo

Your setup looks identical to what I have on a working project form what I can tell. Time to check the really basic things:

  • The files referenced in dfx.json are relative paths. Are the files in the same folder as dfx.json?
  • Is your sale.mo file in the same project? (Probably yes from the screenshots but better to double-check)
  • What version of dfx and the VSCode Motoko plugin are you running?
  • Yes, they are. And no they’re not in the same folder as dfx.json

  • Yes is in the same project.

  • My dfx version is “0.11.2” and the motoko plugin is the “0.4.8”

Sorry, I was not as precise as I should have been. I am only talking about ledger.wasm and ledger.public.did. If those two files are not in the same folder as dfx.json then you’ll have to update the fields that describe where those can be found.

Yeah they are on the same folder, anyway for the moment I’m following the example at this project here that uses a Ledger motoko file.

Relevant GitHub issue:

It’s currently necessary to run “dfx deploy” for the VS Code extension to pick up on canister: imports. Let me know if this doesn’t work, and I’ll do my best to help you continue to debug.