ICPAccount.fromSeed constructor

ICPAccount.fromSeed(
  1. Uint8List seed, {
  2. int? index,
  3. CurveType curveType = CurveType.ed25519,
})

Implementation

factory ICPAccount.fromSeed(
  Uint8List seed, {
  int? index,
  CurveType curveType = CurveType.ed25519,
}) {
  ECKeys keys = fromSeed(seed, index: index ?? 0);
  Ed25519KeyIdentity? identity = curveType == CurveType.secp256k1
      ? null
      : Ed25519KeyIdentity.generate(seed);
  Secp256k1KeyIdentity? ecIdentity = curveType == CurveType.ed25519
      ? null
      : Secp256k1KeyIdentity.fromSecretKey(keys.ecPrivateKey!);
  return ICPAccount(curveType: curveType)
    .._ecKeys = keys
    .._identity = identity
    .._ecIdentity = ecIdentity
    .._phrase = '';
}