importPhrase static method

Future<ICPSigner> importPhrase(
  1. String phrase, {
  2. int index = 0,
  3. SourceType sourceType = SourceType.ii,
  4. CurveType curveType = CurveType.ed25519,
})

Implementation

static Future<ICPSigner> importPhrase(
  String phrase, {
  int index = 0,
  SourceType sourceType = SourceType.ii,
  CurveType curveType = CurveType.ed25519,
}) async {
  switch (sourceType) {
    case SourceType.ii:
      return (await ICPSigner.fromPhrase(
        phrase,
        index: hardened,
        icPath: icDerivationPath,
        curveType: curveType,
      ))
        ..setSourceType(SourceType.ii);
    case SourceType.keySmith:
      return (await ICPSigner.fromPhrase(
        phrase,
        index: index,
        icPath: icDerivationPath,
        curveType: curveType,
      ))
        ..setSourceType(SourceType.keySmith);
    case SourceType.plug:
      return (await ICPSigner.fromPhrase(
        phrase,
        index: index,
        icPath: icDerivationPath,
        curveType: curveType,
      ))
        ..setSourceType(SourceType.keySmith);
    case SourceType.base:
      return (await ICPSigner.fromPhrase(
        phrase,
        index: index,
        curveType: curveType,
      ))
        ..setSourceType(SourceType.base);
    default:
      return (await ICPSigner.fromPhrase(
        phrase,
        index: hardened,
        icPath: icDerivationPath,
        curveType: curveType,
      ))
        ..setSourceType(SourceType.ii);
  }
}