mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-11 05:04:35 +00:00
WIP: fix transactionAddress for incoming transactions + epicTransaction json
This commit is contained in:
parent
848d45ad72
commit
ed80a50432
2 changed files with 12 additions and 7 deletions
|
@ -54,7 +54,7 @@ class EpicTransaction {
|
|||
return EpicTransaction(
|
||||
parentKeyId: json['parent_key_id'] as String,
|
||||
id: int.parse(json!['id'].toString()),
|
||||
txSlateId: json['tx_slate_id'].toString(),
|
||||
txSlateId: json['tx_slate_id'] as String?,
|
||||
txType: EpicTransactionType.values.byName(json['tx_type'] as String),
|
||||
creationTs: json['creation_ts'].toString(),
|
||||
confirmationTs: json['confirmation_ts'].toString(),
|
||||
|
@ -65,10 +65,14 @@ class EpicTransaction {
|
|||
amountDebited: json['amount_debited'].toString(),
|
||||
fee: json['fee'].toString(),
|
||||
ttlCutoffHeight: json['ttl_cutoff_height'].toString(),
|
||||
messages: json['messages'] != null ? Messages.fromJson(json['messages'] as Map<String, dynamic>) : null,
|
||||
messages: json['messages'] != null
|
||||
? Messages.fromJson(json['messages'] as Map<String, dynamic>)
|
||||
: null,
|
||||
storedTx: json['stored_tx'].toString(),
|
||||
kernelExcess: json['kernel_excess'].toString(),
|
||||
kernelLookupMinHeight: json['kernel_lookup_min_height'] == null? null : int.parse(json['kernel_lookup_min_height'].toString()),
|
||||
kernelLookupMinHeight: json['kernel_lookup_min_height'] == null
|
||||
? null
|
||||
: int.parse(json['kernel_lookup_min_height'].toString()),
|
||||
paymentProof: json['payment_proof'].toString(),
|
||||
);
|
||||
}
|
||||
|
@ -81,7 +85,9 @@ class Messages {
|
|||
|
||||
factory Messages.fromJson(Map<String, dynamic> json) {
|
||||
final messageList = json['messages'] as List<dynamic>;
|
||||
final messages = messageList.map((message) => Message.fromJson(message as Map<String, dynamic>)).toList();
|
||||
final messages = messageList
|
||||
.map((message) => Message.fromJson(message as Map<String, dynamic>))
|
||||
.toList();
|
||||
return Messages(messages: messages);
|
||||
}
|
||||
}
|
||||
|
@ -109,7 +115,6 @@ class Message {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
enum EpicTransactionType {
|
||||
//Use Epic transaction type here
|
||||
TxReceived,
|
||||
|
|
|
@ -1255,7 +1255,7 @@ class EpicCashWallet extends CoinServiceAPI
|
|||
|
||||
DateTime dt = DateTime.parse(tx.creationTs);
|
||||
|
||||
String? slateId = tx.txSlateId == "null" ? null : tx.txSlateId;
|
||||
String? slateId = tx.txSlateId;
|
||||
String address = slatesToCommits[slateId]
|
||||
?[tx.txType == EpicTransactionType.TxReceived ? "from" : "to"]
|
||||
as String? ??
|
||||
|
@ -1308,7 +1308,7 @@ class EpicCashWallet extends CoinServiceAPI
|
|||
.valueEqualTo(address)
|
||||
.findFirst();
|
||||
|
||||
if (transactionAddress!.value.isEmpty) {
|
||||
if (transactionAddress == null || transactionAddress!.value.isEmpty) {
|
||||
if (isIncoming) {
|
||||
//Use current receiving address as address
|
||||
String receivingAddress = await currentReceivingAddress;
|
||||
|
|
Loading…
Reference in a new issue