mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-12-22 03:29:36 +00:00
update monero_c to fix unreachable wownero git hosting (#1534)
Some checks are pending
Cache Dependencies / test (push) Waiting to run
Some checks are pending
Cache Dependencies / test (push) Waiting to run
* update monero_c commit * fix: no element in getAllUnusedSubAddresses * fix: Wallet created with empty seed and 0 as private key The error that was there is caused when wallet is being created, but it errors out, so better handling of errors should be all that's needed, as it is not an error on it's own, but rather lack of handling. * fix: create transaction multi dest function is missing * update monero_c hash * fix: receiving on 2 different addresses shows as 1
This commit is contained in:
parent
d6c5b84188
commit
c0cd68a823
8 changed files with 57 additions and 54 deletions
|
@ -3,6 +3,7 @@ import 'package:cw_core/keyable.dart';
|
|||
|
||||
abstract class TransactionInfo extends Object with Keyable {
|
||||
late String id;
|
||||
late String txhash = id;
|
||||
late int amount;
|
||||
int? fee;
|
||||
late TransactionDirection direction;
|
||||
|
|
|
@ -194,28 +194,24 @@ void loadWallet(
|
|||
wptr = openedWalletsByPath[path]!;
|
||||
return;
|
||||
}
|
||||
try {
|
||||
if (wptr == null || path != _lastOpenedWallet) {
|
||||
if (wptr != null) {
|
||||
final addr = wptr!.address;
|
||||
Isolate.run(() {
|
||||
monero.Wallet_store(Pointer.fromAddress(addr));
|
||||
});
|
||||
}
|
||||
txhistory = null;
|
||||
wptr = monero.WalletManager_openWallet(wmPtr,
|
||||
path: path, password: password);
|
||||
openedWalletsByPath[path] = wptr!;
|
||||
_lastOpenedWallet = path;
|
||||
if (wptr == null || path != _lastOpenedWallet) {
|
||||
if (wptr != null) {
|
||||
final addr = wptr!.address;
|
||||
Isolate.run(() {
|
||||
monero.Wallet_store(Pointer.fromAddress(addr));
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
print(e);
|
||||
}
|
||||
final status = monero.Wallet_status(wptr!);
|
||||
if (status != 0) {
|
||||
final err = monero.Wallet_errorString(wptr!);
|
||||
print(err);
|
||||
throw WalletOpeningException(message: err);
|
||||
txhistory = null;
|
||||
wptr = monero.WalletManager_openWallet(wmPtr,
|
||||
path: path, password: password);
|
||||
_lastOpenedWallet = path;
|
||||
final status = monero.Wallet_status(wptr!);
|
||||
if (status != 0) {
|
||||
final err = monero.Wallet_errorString(wptr!);
|
||||
print(err);
|
||||
throw WalletOpeningException(message: err);
|
||||
}
|
||||
openedWalletsByPath[path] = wptr!;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -124,7 +124,7 @@ abstract class MoneroSubaddressListBase with Store {
|
|||
Future<List<Subaddress>> _getAllUnusedAddresses(
|
||||
{required int accountIndex, required String label}) async {
|
||||
final allAddresses = subaddress_list.getAllSubaddresses();
|
||||
final lastAddress = allAddresses.last.address;
|
||||
final lastAddress = allAddresses.length == 0 ? allAddresses.last.address : Subaddress(id: -1, address: "", label: "");
|
||||
if (allAddresses.isEmpty || _usedAddresses.contains(lastAddress)) {
|
||||
final isAddressUnused = await _newSubaddress(accountIndex: accountIndex, label: label);
|
||||
if (!isAddressUnused) {
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import 'dart:math';
|
||||
|
||||
import 'package:cw_core/transaction_info.dart';
|
||||
import 'package:cw_core/monero_amount_format.dart';
|
||||
import 'package:cw_monero/api/structs/transaction_info_row.dart';
|
||||
|
@ -7,12 +9,14 @@ import 'package:cw_core/format_amount.dart';
|
|||
import 'package:cw_monero/api/transaction_history.dart';
|
||||
|
||||
class MoneroTransactionInfo extends TransactionInfo {
|
||||
MoneroTransactionInfo(this.id, this.height, this.direction, this.date,
|
||||
MoneroTransactionInfo(this.txhash, this.height, this.direction, this.date,
|
||||
this.isPending, this.amount, this.accountIndex, this.addressIndex, this.fee,
|
||||
this.confirmations);
|
||||
this.confirmations) :
|
||||
id = "${txhash}_${amount}_${accountIndex}_${addressIndex}";
|
||||
|
||||
MoneroTransactionInfo.fromMap(Map<String, Object?> map)
|
||||
: id = (map['hash'] ?? '') as String,
|
||||
: id = "${map['hash']}_${map['amount']}_${map['accountIndex']}_${map['addressIndex']}",
|
||||
txhash = map['hash'] as String,
|
||||
height = (map['height'] ?? 0) as int,
|
||||
direction = map['direction'] != null
|
||||
? parseTransactionDirectionFromNumber(map['direction'] as String)
|
||||
|
@ -34,7 +38,8 @@ class MoneroTransactionInfo extends TransactionInfo {
|
|||
}
|
||||
|
||||
MoneroTransactionInfo.fromRow(TransactionInfoRow row)
|
||||
: id = row.getHash(),
|
||||
: id = "${row.getHash()}_${row.getAmount()}_${row.subaddrAccount}_${row.subaddrIndex}",
|
||||
txhash = row.getHash(),
|
||||
height = row.blockHeight,
|
||||
direction = parseTransactionDirectionFromInt(row.direction),
|
||||
date = DateTime.fromMillisecondsSinceEpoch(row.getDatetime() * 1000),
|
||||
|
@ -53,6 +58,7 @@ class MoneroTransactionInfo extends TransactionInfo {
|
|||
}
|
||||
|
||||
final String id;
|
||||
final String txhash;
|
||||
final int height;
|
||||
final TransactionDirection direction;
|
||||
final DateTime date;
|
||||
|
|
|
@ -208,28 +208,24 @@ void loadWallet(
|
|||
wptr = openedWalletsByPath[path]!;
|
||||
return;
|
||||
}
|
||||
try {
|
||||
if (wptr == null || path != _lastOpenedWallet) {
|
||||
if (wptr != null) {
|
||||
final addr = wptr!.address;
|
||||
Isolate.run(() {
|
||||
wownero.Wallet_store(Pointer.fromAddress(addr));
|
||||
});
|
||||
}
|
||||
txhistory = null;
|
||||
wptr = wownero.WalletManager_openWallet(wmPtr,
|
||||
path: path, password: password);
|
||||
openedWalletsByPath[path] = wptr!;
|
||||
_lastOpenedWallet = path;
|
||||
if (wptr == null || path != _lastOpenedWallet) {
|
||||
if (wptr != null) {
|
||||
final addr = wptr!.address;
|
||||
Isolate.run(() {
|
||||
wownero.Wallet_store(Pointer.fromAddress(addr));
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
print(e);
|
||||
}
|
||||
final status = wownero.Wallet_status(wptr!);
|
||||
if (status != 0) {
|
||||
final err = wownero.Wallet_errorString(wptr!);
|
||||
print(err);
|
||||
throw WalletOpeningException(message: err);
|
||||
txhistory = null;
|
||||
wptr = wownero.WalletManager_openWallet(wmPtr,
|
||||
path: path, password: password);
|
||||
_lastOpenedWallet = path;
|
||||
final status = wownero.Wallet_status(wptr!);
|
||||
if (status != 0) {
|
||||
final err = wownero.Wallet_errorString(wptr!);
|
||||
print(err);
|
||||
throw WalletOpeningException(message: err);
|
||||
}
|
||||
openedWalletsByPath[path] = wptr!;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -7,12 +7,14 @@ import 'package:cw_core/format_amount.dart';
|
|||
import 'package:cw_wownero/api/transaction_history.dart';
|
||||
|
||||
class WowneroTransactionInfo extends TransactionInfo {
|
||||
WowneroTransactionInfo(this.id, this.height, this.direction, this.date,
|
||||
WowneroTransactionInfo(this.txhash, this.height, this.direction, this.date,
|
||||
this.isPending, this.amount, this.accountIndex, this.addressIndex, this.fee,
|
||||
this.confirmations);
|
||||
this.confirmations) :
|
||||
id = "${txhash}_${amount}_${accountIndex}_${addressIndex}";
|
||||
|
||||
WowneroTransactionInfo.fromMap(Map<String, Object?> map)
|
||||
: id = (map['hash'] ?? '') as String,
|
||||
: id = "${map['hash']}_${map['amount']}_${map['accountIndex']}_${map['addressIndex']}",
|
||||
txhash = map['hash'] as String,
|
||||
height = (map['height'] ?? 0) as int,
|
||||
direction = map['direction'] != null
|
||||
? parseTransactionDirectionFromNumber(map['direction'] as String)
|
||||
|
@ -34,7 +36,8 @@ class WowneroTransactionInfo extends TransactionInfo {
|
|||
}
|
||||
|
||||
WowneroTransactionInfo.fromRow(TransactionInfoRow row)
|
||||
: id = row.getHash(),
|
||||
: id = "${row.getHash()}_${row.getAmount()}_${row.subaddrAccount}_${row.subaddrIndex}",
|
||||
txhash = row.getHash(),
|
||||
height = row.blockHeight,
|
||||
direction = parseTransactionDirectionFromInt(row.direction),
|
||||
date = DateTime.fromMillisecondsSinceEpoch(row.getDatetime() * 1000),
|
||||
|
@ -53,6 +56,7 @@ class WowneroTransactionInfo extends TransactionInfo {
|
|||
}
|
||||
|
||||
final String id;
|
||||
final String txhash;
|
||||
final int height;
|
||||
final TransactionDirection direction;
|
||||
final DateTime date;
|
||||
|
|
|
@ -214,7 +214,7 @@ abstract class TransactionDetailsViewModelBase with Store {
|
|||
final addressIndex = tx.additionalInfo['addressIndex'] as int;
|
||||
final feeFormatted = tx.feeFormatted();
|
||||
final _items = [
|
||||
StandartListItem(title: S.current.transaction_details_transaction_id, value: tx.id),
|
||||
StandartListItem(title: S.current.transaction_details_transaction_id, value: tx.txhash),
|
||||
StandartListItem(
|
||||
title: S.current.transaction_details_date, value: dateFormat.format(tx.date)),
|
||||
StandartListItem(title: S.current.transaction_details_height, value: '${tx.height}'),
|
||||
|
@ -455,7 +455,7 @@ abstract class TransactionDetailsViewModelBase with Store {
|
|||
final addressIndex = tx.additionalInfo['addressIndex'] as int;
|
||||
final feeFormatted = tx.feeFormatted();
|
||||
final _items = [
|
||||
StandartListItem(title: S.current.transaction_details_transaction_id, value: tx.id),
|
||||
StandartListItem(title: S.current.transaction_details_transaction_id, value: tx.txhash),
|
||||
StandartListItem(
|
||||
title: S.current.transaction_details_date, value: dateFormat.format(tx.date)),
|
||||
StandartListItem(title: S.current.transaction_details_height, value: '${tx.height}'),
|
||||
|
|
|
@ -8,7 +8,7 @@ if [[ ! -d "monero_c" ]];
|
|||
then
|
||||
git clone https://github.com/mrcyjanek/monero_c --branch rewrite-wip
|
||||
cd monero_c
|
||||
git checkout eaa7bdb8be3479418445ddb18bf33d453f64afcf
|
||||
git checkout d1e246aaf4c53b60ff9e4ab4a4ac3ae4a1f94a33
|
||||
git reset --hard
|
||||
git submodule update --init --force --recursive
|
||||
./apply_patches.sh monero
|
||||
|
|
Loading…
Reference in a new issue