New Dart Library! anyone want to see the https-api-specification written in 500 lines of code?

Hi, I have a dart package that i publish on ic_tools | Dart Package
It can call canisters with the dart code with update or query calls and verify the certificate with the correct specification. The source for the https-api-spec-plementation is 500 lines of the readable-dart-code and is here: ic_tools_dart/ic_tools.dart at master · levifeldman/ic_tools_dart · GitHub . The package is made for the dart and flutter on the Web and for the Dart running on a linux-machine. There is a candid-library within the package that can code backwards (bytes → candid-classes with the values) and forwards (candid-classes with the values → bytes) each kind of the candid-values (primtypes, construct-types, and reference-types). The source for the candid-lib is here: ic_tools_dart/candid.dart at master · levifeldman/ic_tools_dart · GitHub . The Documentation for the library is here: ic_tools - Dart API docs . Check out the readme and this file: ic_tools_dart/common.dart at master · levifeldman/ic_tools_dart · GitHub for some samples (check-icp-balance, send-icp). If anyone has questions, comments, or feedback, this thread (or pm here) is a good place. Good Luck!


Oh wow, certificate checking, a full Candid library… impressive! It’s too late today to review the code, but that’s great to see.

Did you see the official Candid test suite with plenty of tests that the existing libraries (Rust, Motoko, Haskell, I think also JS) use to check if they got it “right”? I suggest to hook that up to your implementation to weed out the corner cases.


Id love a code review, and you can use the certificate checking to verify certified-variables if you want. I did see the candid tests and i have used some of them in the testing but what are these bytes?: \05i and \01n|l\ here: candid/reference.test.did at 7eda836ec9eb2b2036d6116fcf263c990ccf6859 · dfinity/candid · GitHub

These tests use the same syntax as the Candid textual format, so the stuff between "…" is ASCII (actually, UTF8-unicode) with \nn escapes for raw byes. So \05i is actually two bytes, 0x05 followed by 0x66. I probably generated these test data with the Haskell Candid library which prints them that way.

Two days ago I started writing a longer blog post that explains and highlights various interesting aspects of Candid. Sounds like I’d have an audience of at least one :-).


Cool, yes for the sure.

expectedAudienceCount += 1

Btw with this candid library , no need to parse .did files to talk to a canister or to decode candid-bytes.

@nomeata have you thought bout candid as the wasm-types-standard? Seems like a perfect fit.

You mean beyond the IC? It’s not particularly Wasm-specific, so why stop at Wasm :slight_smile:

1 Like

First post available now, link and place for discussion at Candid explainer: First post published

1 Like