mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-12-05 12:44:09 +01:00
add tx_description to notes field
This commit is contained in:
@@ -3,10 +3,15 @@ import 'package:cw_core/wallet_type.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class OpenaliasRecord {
|
||||
OpenaliasRecord({this.address, this.name});
|
||||
OpenaliasRecord({
|
||||
this.address,
|
||||
this.name,
|
||||
this.description,
|
||||
});
|
||||
|
||||
final String name;
|
||||
final String address;
|
||||
final String description;
|
||||
|
||||
static String formatDomainName(String name) {
|
||||
String formattedName = name;
|
||||
@@ -24,6 +29,7 @@ class OpenaliasRecord {
|
||||
}) async {
|
||||
String address = formattedName;
|
||||
String name = formattedName;
|
||||
String note = '';
|
||||
|
||||
if (formattedName.contains(".")) {
|
||||
try {
|
||||
@@ -60,6 +66,17 @@ class OpenaliasRecord {
|
||||
name = recipientName.replaceAll("recipient_name=", "");
|
||||
}
|
||||
|
||||
final description = dataList
|
||||
.where((item) => (item.contains("tx_description")))
|
||||
.toString()
|
||||
.replaceAll("(", "")
|
||||
.replaceAll(")", "")
|
||||
.trim();
|
||||
|
||||
if (description.isNotEmpty) {
|
||||
note = description.replaceAll("tx_description=", "");
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -69,6 +86,6 @@ class OpenaliasRecord {
|
||||
}
|
||||
}
|
||||
|
||||
return OpenaliasRecord(address: address, name: name);
|
||||
return OpenaliasRecord(address: address, name: name, description: note);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,6 +63,7 @@ Future<ParsedAddress> parseAddressFromDomain(
|
||||
return ParsedAddress(
|
||||
addresses: [record.address],
|
||||
name: record.name,
|
||||
description: record.description,
|
||||
parseFrom: ParseFrom.openAlias);
|
||||
} catch (e) {
|
||||
print(e.toString());
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
enum ParseFrom {unstoppableDomains, openAlias, yatRecord, notParsed}
|
||||
enum ParseFrom { unstoppableDomains, openAlias, yatRecord, notParsed }
|
||||
|
||||
class ParsedAddress {
|
||||
ParsedAddress({
|
||||
this.addresses,
|
||||
this.name = '',
|
||||
this.parseFrom = ParseFrom.notParsed});
|
||||
this.description = '',
|
||||
this.parseFrom = ParseFrom.notParsed,
|
||||
});
|
||||
|
||||
final List<String> addresses;
|
||||
final String name;
|
||||
final String description;
|
||||
final ParseFrom parseFrom;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user