getMPCAccount method

Future<MPCAccountInfo> getMPCAccount({
  1. required String accountId,
  2. String path = "flutterchain",
  3. String chain = BlockChains.ethereum,
  4. String typeOfNetwork = "testnet",
  5. String? mpcPublicKey,
})

Implementation

Future<MPCAccountInfo> getMPCAccount({
  required String accountId,
  String path = "flutterchain",
  String chain = BlockChains.ethereum,
  String typeOfNetwork = "testnet",
  String? mpcPublicKey,
}) async {
  final mpcAccountInfoData = await jsVMService.callJSAsync(
    "window.generateAddressForNearMPC('$accountId', '$path', '$chain', ${mpcPublicKey != null ? "'$mpcPublicKey'" : 'undefined'}, '$typeOfNetwork')",
  );
  final mpcAccountInfo =
      json.decode(mpcAccountInfoData) as Map<String, dynamic>;
  return MPCAccountInfo(
    adress: mpcAccountInfo["address"],
    publicKey: mpcAccountInfo["publicKey"],
  );
}