dfinity / embed-motoko

Embed a custom Motoko code snippet in a Medium article, blog post, or webapp.
https://embed.motoko.org
10 stars 1 forks source link

Support `to_candid` and `from_candid` in the interpreter #74

Open paulyoung opened 1 year ago

paulyoung commented 1 year ago

I realize this is probably better raised in the motoko repo but I encountered it at embed.smartcontracts.org so I figured I’d start here.

I was trying to help someone translate some Motoko code to Candid so they could call a method using dfx, and ran into mo:12.1-12.20: internal error, Invalid_argument("to do: ToCandidE")

It originates here: https://github.com/dfinity/motoko/blob/26c229ad2b6305e15740eb718aa1caf1329f9afd/src/mo_interpreter/interpret.ml#L439-L440

  | ToCandidE _ -> invalid_arg "to do: ToCandidE"
  | FromCandidE _ -> invalid_arg "to do: FromCandidE"
rvanasa commented 1 year ago

Here's the relevant issue in the motoko repository: https://github.com/dfinity/motoko/issues/3653.

It might be possible to implement this feature directly in Embed Motoko using a Wasm module, so I'll keep this issue open to track progress for this approach.