From 860fa54dbac8d5969ba8a39b894ebca6c7e3f55c Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 7 Jul 2024 23:20:30 +0200 Subject: [PATCH] Update @nimiq/utils and @nimiq/vue-components for new FiatApi; and make FiatApi provider configurable The updated FiatApi supports CryptoCompare as an alternative API provider and supports bridged exchange rates for currencies not directly supported by the providers. CoinGecko is becoming increasingly strict with unauthenticated access to their API without API key. For example, wallet.nimiq.com has already been blocked from unauthenticated access, thus the Wallet has been switched to CryptoCompare as fiat api provider, while hub.nimiq.com and keyguard.nimiq.com are not currently blocked. I.e. in the Hub, we don't have to switch yet. If we switch the Hub's FiatApi provider in PaymentInfoLine, we should also switch it in the Keyguard's PaymentInfoLine, which is a bit more work though. For this reason, we keep the Hub and Keyguard on CoinGecko for now, but remove the CoinGecko proxy / custom API URL, as this one has been shut down. --- package.json | 2 +- src/components/CheckoutCard.vue | 4 +- src/components/CheckoutCardEthereum.vue | 4 +- src/components/CheckoutCardExternal.vue | 1 + src/components/CheckoutCardNimiq.vue | 1 + .../CheckoutManualPaymentDetails.vue | 4 + src/i18n/en.po | 84 +++++++++---------- src/lib/Constants.ts | 5 ++ src/lib/RequestTypes.ts | 4 +- src/views/CashlinkCreate.vue | 13 +-- src/views/SignTransactionLedger.vue | 10 ++- vue.config.js | 2 +- yarn.lock | 31 +++---- 13 files changed, 91 insertions(+), 74 deletions(-) diff --git a/package.json b/package.json index 4baf606e..bb74c2ec 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "@nimiq/oasis-api": "^1.1.1", "@nimiq/rpc": "^0.4.1", "@nimiq/style": "^0.8.2", - "@nimiq/utils": "^0.5.2", + "@nimiq/utils": "^0.11.1", "@nimiq/vue-components": "https://github.com/nimiq/vue-components#build/hub", "@opengsn/common": "^2.2.5", "@sentry/vue": "^6.0.0", diff --git a/src/components/CheckoutCard.vue b/src/components/CheckoutCard.vue index c199d8cc..5bb05c76 100644 --- a/src/components/CheckoutCard.vue +++ b/src/components/CheckoutCard.vue @@ -6,12 +6,14 @@ import { Static } from '../lib/StaticStore'; import StatusScreen from './StatusScreen.vue'; import CheckoutServerApi, { GetStateResponse } from '../lib/CheckoutServerApi'; import { PaymentInfoLine } from '@nimiq/vue-components'; -import { ERROR_REQUEST_TIMED_OUT, HISTORY_KEY_SELECTED_CURRENCY } from '../lib/Constants'; +import { ERROR_REQUEST_TIMED_OUT, HISTORY_KEY_SELECTED_CURRENCY, FIAT_API_PROVIDER } from '../lib/Constants'; import { PaymentState } from '../../client/PublicRequestTypes'; export default class CheckoutCard< Parsed extends AvailableParsedPaymentOptions, > extends Vue { + private static readonly FIAT_API_PROVIDER = FIAT_API_PROVIDER; // used in templates of child classes + protected optionTimeout: number = -1; @Prop(Object) protected paymentOptions!: Parsed; diff --git a/src/components/CheckoutCardEthereum.vue b/src/components/CheckoutCardEthereum.vue index 43d3b5d0..8e4b5e5b 100644 --- a/src/components/CheckoutCardEthereum.vue +++ b/src/components/CheckoutCardEthereum.vue @@ -1,5 +1,5 @@