Nat.fromText doesn't exist

Try to use Nat.fromText, but got error as below snapshot, anyone has idea about it? I am using the latest dfx 0.13.1

Ah, sorry, we need to update the moc_js interpreter used on doc web site, I think.

Thanks, same as I use it in local env

Ok, so the problem is that the doc web site is describing version 0.8.3 (because someone updated it by mistake), but the interpreter used for the examples wasn’t updated and is still on 0.7.6.

And the most recent version of dfx only ships with moc 0.7.6.

The fromText function doesn’t actually exist in 0.7.6.

We’ve fixed the interpeter on the web site, but that won’t help you with dfx.

Although there documentation is now too fresh, we thought that might still be better since it now include many examples that weren’t in the 0.7.6 documentation. Hopefully dfx will ship with moc 0.8.3 reasonably soon.

1 Like

If you want to use the latest Motoko version, have a look over here for instructions

1 Like

Why isn’t a new release of dfx always including the most recent Motoko by default? As a user, I would probably be so naive to expect that.

1 Like

dfx ships like once a month. We release more often. And we delayed the release of 0.8.x because of worries about introducing breaking changes during the SNS launch.

I’m wondering if this problem still exists, since I’m getting the same error when I want to use Nat.fromText().

Well there is no official implementation yet i guess. But you can use this : game-launcher/src/game_launcher_backend/utils/Helpers.mo at 483ce08caebeedb116f5fe94c88d9e1bd755cee4 · BoomDAO/game-launcher · GitHub