mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-19 05:58:50 +02:00
feat: Add solana to Open Crypto Pay (#2417)
This commit is contained in:
@@ -12,6 +12,9 @@ class OpenCryptoPayService {
|
||||
value.toLowerCase().contains("lightning=lnurl") ||
|
||||
value.toLowerCase().startsWith("lnurl");
|
||||
|
||||
static bool requiresClientCommit(CryptoCurrency currency) =>
|
||||
[CryptoCurrency.xmr, CryptoCurrency.sol].contains(currency) || currency.tag == "SOL";
|
||||
|
||||
Future<String> commitOpenCryptoPayRequest(
|
||||
String txHex, {
|
||||
required String txId,
|
||||
@@ -39,7 +42,7 @@ class OpenCryptoPayService {
|
||||
throw OpenCryptoPayException(body.toString());
|
||||
}
|
||||
throw OpenCryptoPayException(
|
||||
"Unexpected status code ${response.statusCode} ${response}");
|
||||
"Unexpected status code ${response.statusCode} ${response.body}");
|
||||
}
|
||||
|
||||
Future<void> cancelOpenCryptoPayRequest(OpenCryptoPayRequest request) async {
|
||||
@@ -162,6 +165,10 @@ class OpenCryptoPayService {
|
||||
return "Ethereum";
|
||||
case "POL":
|
||||
return "Polygon";
|
||||
case "TRX":
|
||||
return "Tron";
|
||||
case "SOL":
|
||||
return "Solana";
|
||||
default:
|
||||
return asset.fullName!;
|
||||
}
|
||||
|
||||
@@ -560,7 +560,7 @@ abstract class SendViewModelBase extends WalletChangeListenerViewModel with Stor
|
||||
|
||||
if (ocpRequest != null) {
|
||||
state = TransactionCommitting();
|
||||
if (selectedCryptoCurrency == CryptoCurrency.xmr) {
|
||||
if (OpenCryptoPayService.requiresClientCommit(selectedCryptoCurrency)) {
|
||||
await pendingTransaction!.commit();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user