addressFromMnemonic method
Future<AddressIconData>
addressFromMnemonic(
- int ss58, {
- CryptoType cryptoType = CryptoType.sr25519,
- String derivePath = '',
- required String mnemonic,
get address and avatar from mnemonic.
Implementation
Future<AddressIconData> addressFromMnemonic(int ss58,
{CryptoType cryptoType = CryptoType.sr25519,
String derivePath = '',
required String mnemonic}) async {
final String crypto = cryptoType.toString().split('.')[1];
final isAvatarSupport = (await serviceRoot.webView!.evalJavascript(
'keyring.addressFromMnemonic ? {}:null',
wrapPromise: false)) !=
null;
final dynamic acc = isAvatarSupport
? (await serviceRoot.webView!.evalJavascript(
'keyring.addressFromMnemonic("$mnemonic",$ss58,"$crypto","$derivePath")'))
: {};
return AddressIconData.fromJson(Map<String, dynamic>.from(acc));
}