leonardocustodio / polkadart

Polkadart provides developers the ability to query a node and interact with the Polkadot based chains using Dart.
https://polkadart.dev
Apache License 2.0
39 stars 16 forks source link

Strongly type parameters of extrinsic api #406

Closed clangenb closed 9 months ago

clangenb commented 9 months ago

Currently, the outer api of the generated code for the extrinsic omits the type annotation, implicitly making it dynamic.

Example:


  /// See [`Pallet::transfer_allow_death`].
  _i10.RuntimeCall transferAllowDeath({
    required dest,
    required value,
  }) {
    final _call = _i11.Call.values.transferAllowDeath(
      dest: dest,
      value: value,
    );
    return _i10.RuntimeCall.values.balances(_call);
  }

The inner call _i11.Call.values.transferAllowDeath has explicit type annotations though, so I guess it should not be too hard to put them also in the outer api too.

It would be beneficial to strongly type the outer api too to detect type errors at compile time.

leonardocustodio commented 9 months ago

@clangenb can you give a shot in the PR and check if everything on your side continues to work?

clangenb commented 9 months ago

Yes, will do that tomorrow. Thanks for the quick fix!

clangenb commented 9 months ago

Integrated it in https://github.com/encointer/encointer-wallet-flutter/pull/1629, and it and works. Thanks, gives me some piece of mind. :)

leonardocustodio commented 9 months ago

Released under polkadart_cli 0.3.2