From 7cd4e6583c6c5d1980762ccaf699f78ffb5fd2f6 Mon Sep 17 00:00:00 2001 From: Justin Ehrenhofer Date: Fri, 31 Mar 2023 13:22:51 -0500 Subject: [PATCH] Add `fiatApiKey` (#858) --- .github/workflows/pr_test_build.yml | 1 + lib/core/fiat_conversion_service.dart | 3 +++ tool/utils/secret_key.dart | 4 +++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pr_test_build.yml b/.github/workflows/pr_test_build.yml index 0ea93f4f3..2ab9283ad 100644 --- a/.github/workflows/pr_test_build.yml +++ b/.github/workflows/pr_test_build.yml @@ -114,6 +114,7 @@ jobs: echo "const trocadorApiKey = '${{ secrets.TROCADOR_API_KEY }}';" >> lib/.secrets.g.dart echo "const trocadorExchangeMarkup = '${{ secrets.TROCADOR_EXCHANGE_MARKUP }}';" >> lib/.secrets.g.dart echo "const anonPayReferralCode = '${{ secrets.ANON_PAY_REFERRAL_CODE }}';" >> lib/.secrets.g.dart + echo "const fiatApiKey = '${{ secrets.FIAT_API_KEY }}';" >> lib/.secrets.g.dart - name: Rename app run: echo -e "id=com.cakewallet.test\nname=$GITHUB_HEAD_REF" > /opt/android/cake_wallet/android/app.properties diff --git a/lib/core/fiat_conversion_service.dart b/lib/core/fiat_conversion_service.dart index 66997675d..11aef1374 100644 --- a/lib/core/fiat_conversion_service.dart +++ b/lib/core/fiat_conversion_service.dart @@ -3,6 +3,8 @@ import 'package:cake_wallet/entities/fiat_currency.dart'; import 'dart:convert'; import 'package:flutter/foundation.dart'; import 'package:http/http.dart'; +import 'package:cake_wallet/.secrets.g.dart' as secrets; + const _fiatApiClearNetAuthority = 'fiat-api.cakewallet.com'; const _fiatApiOnionAuthority = 'n4z7bdcmwk2oyddxvzaap3x2peqcplh3pzdy7tpkk5ejz5n4mhfvoxqd.onion'; @@ -17,6 +19,7 @@ Future _fetchPrice(Map args) async { 'interval_count': '1', 'base': crypto.toString(), 'quote': fiat.toString(), + 'key' : secrets.fiatApiKey, }; double price = 0.0; diff --git a/tool/utils/secret_key.dart b/tool/utils/secret_key.dart index 3b5d822d9..54463af2e 100644 --- a/tool/utils/secret_key.dart +++ b/tool/utils/secret_key.dart @@ -27,7 +27,9 @@ class SecretKey { SecretKey('trocadorApiKey', () => ''), SecretKey('trocadorExchangeMarkup', () => ''), SecretKey('twitterBearerToken', () => ''), - SecretKey('anonPayReferralCode', () => '') + SecretKey('anonPayReferralCode', () => ''), + SecretKey('fiatApiKey', () => '') + ]; final String name;