mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-01-05 10:29:23 +00:00
CAKE-192 | added verification of open alias and unstoppable domains in exchange_page.dart and send_page.dart
This commit is contained in:
parent
37f326e21f
commit
7ddbc6b8f4
4 changed files with 39 additions and 19 deletions
|
@ -778,15 +778,22 @@ class ExchangePage extends BasePage {
|
||||||
|
|
||||||
Future<String> applyUnstoppableDomainAddress(BuildContext context,
|
Future<String> applyUnstoppableDomainAddress(BuildContext context,
|
||||||
String domain, String ticker) async {
|
String domain, String ticker) async {
|
||||||
try {
|
const topLevelDomain = 'crypto';
|
||||||
final address =
|
|
||||||
await exchangeViewModel.getUnstoppableDomainAddress(domain, ticker);
|
if (domain.contains('.')) {
|
||||||
if ((address != null)&&address.isNotEmpty) {
|
final name = domain.split('.').last;
|
||||||
unstoppableDomainAddressAlert(context, domain);
|
if (name.isNotEmpty && (name == topLevelDomain)) {
|
||||||
return address;
|
try {
|
||||||
|
final address =
|
||||||
|
await exchangeViewModel.getUnstoppableDomainAddress(domain, ticker);
|
||||||
|
if ((address != null)&&address.isNotEmpty) {
|
||||||
|
unstoppableDomainAddressAlert(context, domain);
|
||||||
|
return address;
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
print(e.toString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (e) {
|
|
||||||
print(e.toString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return domain;
|
return domain;
|
||||||
|
|
|
@ -38,10 +38,9 @@ class SendPage extends BasePage {
|
||||||
_cryptoAmountFocus = FocusNode(),
|
_cryptoAmountFocus = FocusNode(),
|
||||||
_fiatAmountFocus = FocusNode(),
|
_fiatAmountFocus = FocusNode(),
|
||||||
_addressFocusNode = FocusNode() {
|
_addressFocusNode = FocusNode() {
|
||||||
_addressFocusNode.addListener(() async {
|
_addressFocusNode.addListener(() {
|
||||||
if (!_addressFocusNode.hasFocus && _addressController.text.isNotEmpty) {
|
if (!_addressFocusNode.hasFocus && _addressController.text.isNotEmpty) {
|
||||||
await getOpenaliasRecord(_addressFocusNode.context);
|
applyOpenaliasOrUnstoppableDomains(_addressFocusNode.context);
|
||||||
await applyUnstoppableDomainAddress(_addressFocusNode.context);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -174,9 +173,8 @@ class SendPage extends BasePage {
|
||||||
.headline
|
.headline
|
||||||
.decorationColor),
|
.decorationColor),
|
||||||
validator: sendViewModel.addressValidator,
|
validator: sendViewModel.addressValidator,
|
||||||
onPushPasteButton: (context) async {
|
onPushPasteButton: (context) {
|
||||||
await getOpenaliasRecord(context);
|
applyOpenaliasOrUnstoppableDomains(context);
|
||||||
await applyUnstoppableDomainAddress(context);
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
Observer(
|
Observer(
|
||||||
|
@ -518,13 +516,12 @@ class SendPage extends BasePage {
|
||||||
to: template.name,
|
to: template.name,
|
||||||
amount: template.amount,
|
amount: template.amount,
|
||||||
from: template.cryptoCurrency,
|
from: template.cryptoCurrency,
|
||||||
onTap: () async {
|
onTap: () {
|
||||||
_addressController.text =
|
_addressController.text =
|
||||||
template.address;
|
template.address;
|
||||||
_cryptoAmountController.text =
|
_cryptoAmountController.text =
|
||||||
template.amount;
|
template.amount;
|
||||||
await getOpenaliasRecord(context);
|
applyOpenaliasOrUnstoppableDomains(context);
|
||||||
await applyUnstoppableDomainAddress(context);
|
|
||||||
},
|
},
|
||||||
onRemove: () {
|
onRemove: () {
|
||||||
showPopUp<void>(
|
showPopUp<void>(
|
||||||
|
@ -792,4 +789,20 @@ class SendPage extends BasePage {
|
||||||
print(e.toString());
|
print(e.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void applyOpenaliasOrUnstoppableDomains(BuildContext context) async {
|
||||||
|
const topLevelDomain = 'crypto';
|
||||||
|
final address = _addressController.text;
|
||||||
|
|
||||||
|
if (address.contains('.')) {
|
||||||
|
final name = address.split('.').last;
|
||||||
|
if (name.isNotEmpty) {
|
||||||
|
if (name == topLevelDomain) {
|
||||||
|
await applyUnstoppableDomainAddress(context);
|
||||||
|
} else {
|
||||||
|
await getOpenaliasRecord(context);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -480,7 +480,7 @@
|
||||||
"moonpay_alert_text" : "Der Wert des Betrags muss größer oder gleich sein ${minAmount} ${fiatCurrency}",
|
"moonpay_alert_text" : "Der Wert des Betrags muss größer oder gleich sein ${minAmount} ${fiatCurrency}",
|
||||||
|
|
||||||
"outdated_electrum_wallet_receive_warning": "Wenn diese Brieftasche einen 12-Wort-Seed hat und in Cake erstellt wurde, zahlen Sie KEINE Bitcoins in diese Brieftasche ein. Alle auf diese Wallet übertragenen BTC können verloren gehen. Erstellen Sie eine neue 24-Wort-Wallet (tippen Sie auf das Menü oben rechts, wählen Sie Wallets, wählen Sie Create New Wallet und dann Bitcoin) und verschieben Sie Ihre BTC SOFORT dorthin. Neue (24 Wörter) BTC-Wallets von Cake sind sicher",
|
"outdated_electrum_wallet_receive_warning": "Wenn diese Brieftasche einen 12-Wort-Seed hat und in Cake erstellt wurde, zahlen Sie KEINE Bitcoins in diese Brieftasche ein. Alle auf diese Wallet übertragenen BTC können verloren gehen. Erstellen Sie eine neue 24-Wort-Wallet (tippen Sie auf das Menü oben rechts, wählen Sie Wallets, wählen Sie Create New Wallet und dann Bitcoin) und verschieben Sie Ihre BTC SOFORT dorthin. Neue (24 Wörter) BTC-Wallets von Cake sind sicher",
|
||||||
"do_not_show_me": "Zeig mir das nicht noch einmal"
|
"do_not_show_me": "Zeig mir das nicht noch einmal",
|
||||||
"outdated_electrum_wallet_description" : "Neue Bitcoin-Geldbörsen, die in Cake erstellt wurden, haben jetzt einen Startwert von 24 Wörtern. Es ist obligatorisch, dass Sie eine neue Bitcoin-Brieftasche erstellen, Ihr gesamtes Geld in die neue 24-Wörter-Brieftasche überweisen und keine Brieftaschen mit einem 12-Wörter-Startwert mehr verwenden. Bitte tun Sie dies sofort, um Ihr Geld zu sichern.",
|
"outdated_electrum_wallet_description" : "Neue Bitcoin-Geldbörsen, die in Cake erstellt wurden, haben jetzt einen Startwert von 24 Wörtern. Es ist obligatorisch, dass Sie eine neue Bitcoin-Brieftasche erstellen, Ihr gesamtes Geld in die neue 24-Wörter-Brieftasche überweisen und keine Brieftaschen mit einem 12-Wörter-Startwert mehr verwenden. Bitte tun Sie dies sofort, um Ihr Geld zu sichern.",
|
||||||
"understand" : "Ich verstehe",
|
"understand" : "Ich verstehe",
|
||||||
|
|
||||||
|
|
|
@ -483,7 +483,7 @@
|
||||||
"moonpay_alert_text" : "Value of the amount must be more or equal to ${minAmount} ${fiatCurrency}",
|
"moonpay_alert_text" : "Value of the amount must be more or equal to ${minAmount} ${fiatCurrency}",
|
||||||
|
|
||||||
"outdated_electrum_wallet_receive_warning": "If this wallet has a 12-word seed and was created in Cake, DO NOT deposit Bitcoin into this wallet. Any BTC transferred to this wallet may be lost. Create a new 24-word wallet (tap the menu at the top right, select Wallets, choose Create New Wallet, then select Bitcoin) and IMMEDIATELY move your BTC there. New (24-word) BTC wallets from Cake are secure",
|
"outdated_electrum_wallet_receive_warning": "If this wallet has a 12-word seed and was created in Cake, DO NOT deposit Bitcoin into this wallet. Any BTC transferred to this wallet may be lost. Create a new 24-word wallet (tap the menu at the top right, select Wallets, choose Create New Wallet, then select Bitcoin) and IMMEDIATELY move your BTC there. New (24-word) BTC wallets from Cake are secure",
|
||||||
"do_not_show_me": "Do not show me this again"
|
"do_not_show_me": "Do not show me this again",
|
||||||
|
|
||||||
"address_detected" : "Address detected",
|
"address_detected" : "Address detected",
|
||||||
"address_from_domain" : "You got address from unstoppable domain ${domain}"
|
"address_from_domain" : "You got address from unstoppable domain ${domain}"
|
||||||
|
|
Loading…
Reference in a new issue