make init async so it won't lag

disable print starts
This commit is contained in:
Czarek Nakamoto 2024-05-12 08:18:24 +02:00
parent f6d41f318e
commit e68cae6bf4
2 changed files with 13 additions and 10 deletions

View file

@ -59,13 +59,13 @@ int getNodeHeightSync() => monero.Wallet_daemonBlockChainHeight(wptr!);
bool isConnectedSync() => monero.Wallet_connected(wptr!) != 0;
bool setupNodeSync(
Future<bool> setupNodeSync(
{required String address,
String? login,
String? password,
bool useSSL = false,
bool isLightWallet = false,
String? socksProxyAddress}) {
String? socksProxyAddress}) async {
print('''
{
wptr!,
@ -76,12 +76,15 @@ bool setupNodeSync(
daemonPassword: $password ?? ''
}
''');
monero.Wallet_init(wptr!,
daemonAddress: address,
useSsl: useSSL,
proxyAddress: socksProxyAddress ?? '',
daemonUsername: login ?? '',
daemonPassword: password ?? '');
final addr = wptr!.address;
await Isolate.run(() {
monero.Wallet_init(Pointer.fromAddress(addr),
daemonAddress: address,
useSsl: useSSL,
proxyAddress: socksProxyAddress ?? '',
daemonUsername: login ?? '',
daemonPassword: password ?? '');
});
// monero.Wallet_init3(wptr!, argv0: '', defaultLogBaseName: 'moneroc', console: true);
final status = monero.Wallet_status(wptr!);
@ -219,7 +222,7 @@ void onStartup() {}
void _storeSync(Object _) => storeSync();
bool _setupNodeSync(Map<String, Object?> args) {
Future<bool> _setupNodeSync(Map<String, Object?> args) async {
final address = args['address'] as String;
final login = (args['login'] ?? '') as String;
final password = (args['password'] ?? '') as String;

View file

@ -16,7 +16,7 @@ final monero.WalletManager wmPtr = Pointer.fromAddress((() {
// Problems with the wallet? Crashes? Lags? this will print all calls to xmr
// codebase, so it will be easier to debug what happens. At least easier
// than plugging gdb in. Especially on windows/android.
monero.printStarts = kDebugMode;
monero.printStarts = false;
_wmPtr ??= monero.WalletManagerFactory_getWalletManager();
print("ptr: $_wmPtr");
} catch (e) {