import 'dart:ffi'; import 'package:ffi/ffi.dart'; import 'package:cw_nano/api/signatures.dart'; import 'package:cw_nano/api/types.dart'; import 'package:cw_nano/api/monero_api.dart'; import 'package:cw_nano/api/structs/account_row.dart'; import 'package:flutter/foundation.dart'; import 'package:cw_nano/api/wallet.dart'; // final accountSizeNative = moneroApi // .lookup>('account_size') // .asFunction(); // final accountRefreshNative = moneroApi // .lookup>('account_refresh') // .asFunction(); // final accountGetAllNative = moneroApi // .lookup>('account_get_all') // .asFunction(); // final accountAddNewNative = moneroApi // .lookup>('account_add_row') // .asFunction(); // final accountSetLabelNative = moneroApi // .lookup>('account_set_label_row') // .asFunction(); bool isUpdating = false; void refreshAccounts() { // try { // isUpdating = true; // accountRefreshNative(); // isUpdating = false; // } catch (e) { // isUpdating = false; // rethrow; // } } List getAllAccount() { // final size = accountSizeNative(); // final accountAddressesPointer = accountGetAllNative(); // final accountAddresses = accountAddressesPointer.asTypedList(size); // return accountAddresses // .map((addr) => Pointer.fromAddress(addr).ref) // .toList(); return []; } void addAccountSync({required String label}) { // final labelPointer = label.toNativeUtf8(); // accountAddNewNative(labelPointer); // calloc.free(labelPointer); } void setLabelForAccountSync({required int accountIndex, required String label}) { // final labelPointer = label.toNativeUtf8(); // accountSetLabelNative(accountIndex, labelPointer); // calloc.free(labelPointer); } void _addAccount(String label) => addAccountSync(label: label); void _setLabelForAccount(Map args) { // final label = args['label'] as String; // final accountIndex = args['accountIndex'] as int; // setLabelForAccountSync(label: label, accountIndex: accountIndex); } Future addAccount({required String label}) async { // await compute(_addAccount, label); // await store(); } Future setLabelForAccount({required int accountIndex, required String label}) async { // await compute(_setLabelForAccount, {'accountIndex': accountIndex, 'label': label}); // await store(); }