fromPhrase static method
Implementation
static ICPAccount fromPhrase(
String phrase, {
String passphase = "",
int? index,
List<int>? icPath = IC_BASE_PATH,
CurveType curveType = CurveType.ed25519,
}) {
ECKeys? keys = curveType == CurveType.ed25519
? null
: getECKeys(phrase,
passphase: passphase,
index: index != null
? index != HARDENED
? index
: 0
: 0);
var path = List<int>.from(icPath ?? IC_BASE_PATH);
Ed25519KeyIdentity? identity = curveType == CurveType.secp256k1
? null
: fromMnemonicWithoutValidation(
phrase,
path,
offset: index ?? HARDENED,
);
Secp256k1KeyIdentity? ecIdentity = curveType == CurveType.ed25519
? null
: Secp256k1KeyIdentity.fromSecretKey(keys!.ecPrivateKey!);
return ICPAccount(curveType: curveType)
.._ecKeys = keys
.._identity = identity
.._ecIdentity = ecIdentity
.._phrase = phrase;
}