cake_wallet/lib/utils/payment_request.dart
Omar Hatem 426ac99e34
Generic Fixes (#1122)
* Fix Hive issue

* Disable RobinHood for Nano

* Validate context is still mounted [skip ci]

* Disable Exolix for new exchanges
Remove duplicate ethereum case

* add nano/banano to manifest/info.plist

* fix qr code issues for nano

* Add Nano-wallet to restore form qr
Add iOS keychain accessibility config

* support app links for ethereum and nano [skip ci]

* catch exceptions from gas price and estimated gas

* Add bitcoin cash to app links
Fix restore from QR for bitcoin cash

* Fixate bottom buttons for create/restore wallet in wallet list page

---------

Co-authored-by: fosse <matt.cfosse@gmail.com>
2023-10-13 14:49:00 +03:00

36 lines
1,017 B
Dart

import 'package:cake_wallet/nano/nano.dart';
class PaymentRequest {
PaymentRequest(this.address, this.amount, this.note, this.scheme);
factory PaymentRequest.fromUri(Uri? uri) {
var address = "";
var amount = "";
var note = "";
var scheme = "";
if (uri != null) {
address = uri.path;
amount = uri.queryParameters['tx_amount'] ?? uri.queryParameters['amount'] ?? "";
note = uri.queryParameters['tx_description'] ?? uri.queryParameters['message'] ?? "";
scheme = uri.scheme;
}
if (nano != null) {
if (amount.isNotEmpty) {
if (address.contains("nano")) {
amount = nanoUtil!.getRawAsUsableString(amount, nanoUtil!.rawPerNano);
} else if (address.contains("ban")) {
amount = nanoUtil!.getRawAsUsableString(amount, nanoUtil!.rawPerBanano);
}
}
}
return PaymentRequest(address, amount, note, scheme);
}
final String address;
final String amount;
final String note;
final String scheme;
}