mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-19 05:58:50 +02:00
feat: add Zano support to Open CryptoPay (#2475)
Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com>
This commit is contained in:
co-authored by
Omar Hatem
parent
1a47ded016
commit
7d67d2ffc7
@@ -44,7 +44,7 @@ class PendingZanoTransaction with PendingTransaction {
|
||||
|
||||
@override
|
||||
Future<void> commit() async {
|
||||
await zanoWallet.transfer(destinations, fee, comment);
|
||||
transferResult = await zanoWallet.transfer(destinations, fee, comment);
|
||||
zanoWallet.fetchTransactions();
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,8 @@ class OpenCryptoPayService {
|
||||
value.toLowerCase().startsWith("lnurl");
|
||||
|
||||
static bool requiresClientCommit(CryptoCurrency currency) =>
|
||||
[CryptoCurrency.xmr, CryptoCurrency.sol].contains(currency) || currency.tag == "SOL";
|
||||
[CryptoCurrency.xmr, CryptoCurrency.zano, CryptoCurrency.sol].contains(currency) ||
|
||||
currency.tag == "SOL";
|
||||
|
||||
Future<String> commitOpenCryptoPayRequest(
|
||||
String txHex, {
|
||||
@@ -28,12 +29,11 @@ class OpenCryptoPayService {
|
||||
queryParams['quote'] = request.quote;
|
||||
queryParams['asset'] = asset.title;
|
||||
queryParams['method'] = _getMethod(asset);
|
||||
queryParams['hex'] = txHex;
|
||||
queryParams['tx'] = txId;
|
||||
if (txHex.isNotEmpty) queryParams['hex'] = txHex;
|
||||
|
||||
final response =
|
||||
await ProxyWrapper().get(clearnetUri: Uri.https(uri.authority, uri.path, queryParams));
|
||||
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
final body = jsonDecode(response.body) as Map;
|
||||
@@ -76,7 +76,6 @@ class OpenCryptoPayService {
|
||||
Future<(_OpenCryptoPayQuote, Map<String, List<OpenCryptoPayQuoteAsset>>)>
|
||||
_getOpenCryptoPayParams(Uri uri) async {
|
||||
final response = await ProxyWrapper().get(clearnetUri: uri);
|
||||
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
final responseBody = jsonDecode(response.body) as Map;
|
||||
@@ -122,8 +121,8 @@ class OpenCryptoPayService {
|
||||
queryParams['asset'] = asset.title;
|
||||
queryParams['method'] = _getMethod(asset);
|
||||
|
||||
final response = await ProxyWrapper().get(clearnetUri: Uri.https(uri.authority, uri.path, queryParams));
|
||||
|
||||
final response =
|
||||
await ProxyWrapper().get(clearnetUri: Uri.https(uri.authority, uri.path, queryParams));
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
final responseBody = jsonDecode(response.body) as Map;
|
||||
@@ -181,11 +180,9 @@ class _OpenCryptoPayQuote {
|
||||
final String id;
|
||||
final DateTime expiration;
|
||||
|
||||
_OpenCryptoPayQuote(
|
||||
this.callbackUrl, this.displayName, this.id, this.expiration);
|
||||
_OpenCryptoPayQuote(this.callbackUrl, this.displayName, this.id, this.expiration);
|
||||
|
||||
_OpenCryptoPayQuote.fromJson(
|
||||
this.callbackUrl, this.displayName, Map<String, dynamic> json)
|
||||
_OpenCryptoPayQuote.fromJson(this.callbackUrl, this.displayName, Map<String, dynamic> json)
|
||||
: id = json['id'] as String,
|
||||
expiration = DateTime.parse(json['expiration'] as String);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user