tendermint/flutter

[Feature] [cosmos_node_client] Account derivation

Opened this issue · 1 comments

Add feature of wallet derivation to the cosmos_node_client library

Acceptance criteria

  • introduce new type Mnemonic that has the constructor Mnemonic.generate(MnemonicLength length)
enum MnemonicLength {
    words12,
    words24,
}

class Mnemonic {
 final String value;
 
 List<String> get words {} // generate list of words based on the `value`
 
 const Mnemonic._(this.value);
 
 factory Mnemonic.generate(MnemonicLength length) { ... }
  • introduce new type Account with a factory deriveFromMnemonic that accepts Mnemonic mnemonic.
class Account extends Equatable {
    static const defaultDerivationPath = "m/44'/118'/0'/0/0";
   
    final String bech32Address;
    final Uint8List publicKey;
    final Uint8List privateKey;
   
    factory Account.derive({
       required Mnemonic mnemonic, 
       String derivationPath = defaultDerivationPath,
    }) { ... }
}

Would be working on this as soon as #261 and #263 are merged