From 355d990df00645b4305a52a3b28be926c72711b7 Mon Sep 17 00:00:00 2001 From: cyan Date: Fri, 28 Jun 2024 05:50:51 +0000 Subject: [PATCH] fixes from comments --- cw_monero/lib/api/transaction_history.dart | 1 - cw_monero/lib/api/wallet.dart | 7 ++----- cw_monero/lib/api/wallet_manager.dart | 4 ++-- cw_monero/lib/monero_wallet.dart | 2 +- 4 files changed, 5 insertions(+), 9 deletions(-) diff --git a/cw_monero/lib/api/transaction_history.dart b/cw_monero/lib/api/transaction_history.dart index c349dd312..aa1e2df70 100644 --- a/cw_monero/lib/api/transaction_history.dart +++ b/cw_monero/lib/api/transaction_history.dart @@ -30,7 +30,6 @@ List getAllTransactions() { return List.generate(size, (index) => Transaction(txInfo: monero.TransactionHistory_transaction(txhistory!, index: index))); } -// TODO(mrcyjanek): ... Transaction getTransaction(String txId) { return Transaction(txInfo: monero.TransactionHistory_transactionById(txhistory!, txid: txId)); } diff --git a/cw_monero/lib/api/wallet.dart b/cw_monero/lib/api/wallet.dart index 51bd995ce..d4eb3cb91 100644 --- a/cw_monero/lib/api/wallet.dart +++ b/cw_monero/lib/api/wallet.dart @@ -43,7 +43,7 @@ String getSeed() { return legacy; } -String getAddress({int accountIndex = 0, int addressIndex = 1}) => +String getAddress({int accountIndex = 0, int addressIndex = 0}) => monero.Wallet_address(wptr!, accountIndex: accountIndex, addressIndex: addressIndex); @@ -103,9 +103,6 @@ void startRefreshSync() { monero.Wallet_startRefresh(wptr!); } -Future connectToNode() async { - return true; -} void setRefreshFromBlockHeight({required int height}) => monero.Wallet_setRefreshFromBlockHeight(wptr!, @@ -118,7 +115,7 @@ final storeMutex = Mutex(); void storeSync() async { await storeMutex.acquire(); final addr = wptr!.address; - Isolate.run(() { + await Isolate.run(() { monero.Wallet_store(Pointer.fromAddress(addr)); }); storeMutex.release(); diff --git a/cw_monero/lib/api/wallet_manager.dart b/cw_monero/lib/api/wallet_manager.dart index bb4146ac4..1873f734e 100644 --- a/cw_monero/lib/api/wallet_manager.dart +++ b/cw_monero/lib/api/wallet_manager.dart @@ -268,7 +268,7 @@ void _restoreFromSpendKey(Map args) { Future _openWallet(Map args) async => loadWallet( path: args['path'] as String, password: args['password'] as String); -Future _isWalletExist(String path) async => isWalletExistSync(path: path); +bool _isWalletExist(String path) => isWalletExistSync(path: path); void openWallet( {required String path, @@ -343,4 +343,4 @@ Future restoreFromSpendKey( 'restoreHeight': restoreHeight }); -Future isWalletExist({required String path}) => _isWalletExist(path); +bool isWalletExist({required String path}) => _isWalletExist(path); diff --git a/cw_monero/lib/monero_wallet.dart b/cw_monero/lib/monero_wallet.dart index a30c22745..5ab5c555c 100644 --- a/cw_monero/lib/monero_wallet.dart +++ b/cw_monero/lib/monero_wallet.dart @@ -452,7 +452,7 @@ abstract class MoneroWalletBase monero.CoinsInfo_unlocked(coin), ); if (unspent.hash.isNotEmpty) { - unspent.isChange = transaction_history.getTransaction(unspent.hash) == 1; + unspent.isChange = transaction_history.getTransaction(unspent.hash).isSpend == true; } unspentCoins.add(unspent); }