public static async Task <ApiResponse> RestoreWalletBackup(string filePath, string password = null) { ApiResponse response = new ApiResponse(); try { if (Path.GetExtension(filePath) == ".fcdatx" && string.IsNullOrEmpty(password)) { throw new ApiInvalidParametersException("password must not null"); } else { WalletManagement management = new WalletManagement(); await management.RestoreWalletBackup(filePath, password); } } catch (ApiCustomException ex) { Logger.Singleton.Error(ex.Message); response.Error = new ApiError(ex.ErrorCode, ex.Message); } catch (Exception ex) { Logger.Singleton.Error(ex.Message); response.Error = new ApiError(ex.HResult, ex.Message); } return(response); }
public async Task RestoreWalletBackup() { WalletManagement management = new WalletManagement(); await management.RestoreWalletBackup("D:\\wallet.dat"); }