AstroX
November 5, 2021, 11:38am
1
Hello everyone!
AstroX is releasing a bounty for Dart developers to enhance agent_dart and related tooling.
The goal is to build a candid builder for agent_dart.
Candid is used to describe IDL for canister functions.
Candid builder is used to transform candid files to usable functions/classes for agent clients in different languages.
For dart language, all interfaces are classes. To make a workable builder, like we do json decoding classes, the candid builder should also transform all those interfaces into classes.
Check out the GitHub link for more info!
opened 05:37PM - 04 Nov 21 UTC
enhancement
help wanted
bounty
# Description
To build a candid builder for agent dart
## Context
Candid is… used to describe IDL for canister functions.
Candid builder is used to transform candid files to usable functions/classes for agent clients in different languages.
For dart language, all interfaces are classes. To make a workable builder, like we do json decoding classes, candid builder should also transform all those interfaces into classes.
Candid files are trans-compiled into typescript and javascript using `didc`, link is [here](https://github.com/dfinity/candid/tree/master/tools/didc)
There are repos maintained by community for other languages:
1. [Kotlin](https://github.com/seniorjoinu/candid-kt)
2. [Haskell](https://github.com/nomeata/haskell-candid)
3. [AssemblyScript](https://github.com/rckprtr/cdk-as/tree/master/packages/cdk/assembly/candid)
4. [elm](https://github.com/chenyan2002/ic-elm/)
Since agent_dart is ported agains `agent-js`, all IDL interfaces and styles are very similar to javascript/typescript.
for example , in generarted javascript:
```javascript
const Purpose = IDL.Variant({
'authentication' : IDL.Null,
'recovery' : IDL.Null,
});
const CredentialId = IDL.Vec(IDL.Nat8);
```
in agent_dart, we can almost simply copy paste
```dart
final Purpose = IDL.Variant({
'authentication' : IDL.Null,
'recovery' : IDL.Null,
});
final CredentialId = IDL.Vec(IDL.Nat8);
```
So we might be able to :
1. modify and use `didc` to generate those `idl`,
2. THEN write classes using dart builder
To see working classes in dart, please refer to [wallet/ledger.dart](https://github.com/AstroxNetwork/agent_dart/blob/main/lib/wallet/ledger.dart)
# Acceptance Criteria
* [ ] modify and combine `didc` to builder to generate `idl`s
* [ ] use dart builder to generate artifacts in dart classes
* [ ] tests and working examples, published to other repo.
# Reward
30 ICPs
4 Likes