encointer / encointer-wallet-flutter

Encointer mobile wallet flutter implementation
https://encointer.org
Apache License 2.0
21 stars 15 forks source link

Strongly type `pubKey` and `address` #1149

Open clangenb opened 1 year ago

clangenb commented 1 year ago

Both are just strings now, and even more confusingly, they represent the same account. It is extremely easy to mix those two up. So we should strongly type those two. I suggest using something like this:


class Pubkey {
   String value;
}

class Address {
  String value
}

Additionally, we can implement custom serializations:

// this is probably not 100% correct, but I think I can convey my idea.
String toJson() {
    self.value;
}
clangenb commented 10 months ago

We have already introduced and re-exported the Address type in the ew_polkadart package, we should switch to using it everywhere.