importAccount method
Import account from mnemonic/rawSeed/keystore and we get a JSON object.
param cryptoType
can be sr25519
(default) or ed25519
.
throw error if import failed.
return null if keystore password check failed.
Implementation
Future<Map?> importAccount(
Keyring keyring, {
required KeyType keyType,
required String key,
required String name,
required String password,
CryptoType cryptoType = CryptoType.sr25519,
String derivePath = '',
}) async {
final acc = await service!.importAccount(
keyType: keyType,
key: key,
name: name,
password: password,
cryptoType: cryptoType,
derivePath: derivePath,
);
if (acc == null) {
return null;
}
if (acc['error'] != null) {
throw Exception(acc['error']);
}
return acc;
}