mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-11-16 09:17:35 +00:00
Changed monero dependencies path for android. Changed scripts for generation of secrets.
This commit is contained in:
parent
fd2cf98e51
commit
db75167302
16 changed files with 246 additions and 71 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -87,6 +87,7 @@ cw_monero/cw_monero/android/.cxx/
|
||||||
android/key.properties
|
android/key.properties
|
||||||
|
|
||||||
**/tool/.secrets-prod.json
|
**/tool/.secrets-prod.json
|
||||||
|
**/tool/.secrets-config.json
|
||||||
**/lib/.secrets.g.dart
|
**/lib/.secrets.g.dart
|
||||||
|
|
||||||
vendor/
|
vendor/
|
||||||
|
|
|
@ -17,7 +17,7 @@ set(EXTERNAL_LIBS_DIR ${CMAKE_SOURCE_DIR}/../ios/External/android)
|
||||||
|
|
||||||
add_library(sodium STATIC IMPORTED)
|
add_library(sodium STATIC IMPORTED)
|
||||||
set_target_properties(sodium PROPERTIES IMPORTED_LOCATION
|
set_target_properties(sodium PROPERTIES IMPORTED_LOCATION
|
||||||
${EXTERNAL_LIBS_DIR}/libsodium/lib/${ANDROID_ABI}/libsodium.a)
|
${EXTERNAL_LIBS_DIR}/${ANDROID_ABI}/lib/libsodium.a)
|
||||||
|
|
||||||
############
|
############
|
||||||
# OpenSSL
|
# OpenSSL
|
||||||
|
@ -25,11 +25,11 @@ set_target_properties(sodium PROPERTIES IMPORTED_LOCATION
|
||||||
|
|
||||||
add_library(crypto STATIC IMPORTED)
|
add_library(crypto STATIC IMPORTED)
|
||||||
set_target_properties(crypto PROPERTIES IMPORTED_LOCATION
|
set_target_properties(crypto PROPERTIES IMPORTED_LOCATION
|
||||||
${EXTERNAL_LIBS_DIR}/openssl/lib/${ANDROID_ABI}/libcrypto.a)
|
${EXTERNAL_LIBS_DIR}/${ANDROID_ABI}/lib/libcrypto.a)
|
||||||
|
|
||||||
add_library(ssl STATIC IMPORTED)
|
add_library(ssl STATIC IMPORTED)
|
||||||
set_target_properties(ssl PROPERTIES IMPORTED_LOCATION
|
set_target_properties(ssl PROPERTIES IMPORTED_LOCATION
|
||||||
${EXTERNAL_LIBS_DIR}/openssl/lib/${ANDROID_ABI}/libssl.a)
|
${EXTERNAL_LIBS_DIR}/${ANDROID_ABI}/lib/libssl.a)
|
||||||
|
|
||||||
############
|
############
|
||||||
# Boost
|
# Boost
|
||||||
|
@ -37,39 +37,39 @@ set_target_properties(ssl PROPERTIES IMPORTED_LOCATION
|
||||||
|
|
||||||
add_library(boost_chrono STATIC IMPORTED)
|
add_library(boost_chrono STATIC IMPORTED)
|
||||||
set_target_properties(boost_chrono PROPERTIES IMPORTED_LOCATION
|
set_target_properties(boost_chrono PROPERTIES IMPORTED_LOCATION
|
||||||
${EXTERNAL_LIBS_DIR}/boost/lib/${ANDROID_ABI}/libboost_chrono.a)
|
${EXTERNAL_LIBS_DIR}/${ANDROID_ABI}/lib/libboost_chrono.a)
|
||||||
|
|
||||||
add_library(boost_date_time STATIC IMPORTED)
|
add_library(boost_date_time STATIC IMPORTED)
|
||||||
set_target_properties(boost_date_time PROPERTIES IMPORTED_LOCATION
|
set_target_properties(boost_date_time PROPERTIES IMPORTED_LOCATION
|
||||||
${EXTERNAL_LIBS_DIR}/boost/lib/${ANDROID_ABI}/libboost_date_time.a)
|
${EXTERNAL_LIBS_DIR}/${ANDROID_ABI}/lib/libboost_date_time.a)
|
||||||
|
|
||||||
add_library(boost_filesystem STATIC IMPORTED)
|
add_library(boost_filesystem STATIC IMPORTED)
|
||||||
set_target_properties(boost_filesystem PROPERTIES IMPORTED_LOCATION
|
set_target_properties(boost_filesystem PROPERTIES IMPORTED_LOCATION
|
||||||
${EXTERNAL_LIBS_DIR}/boost/lib/${ANDROID_ABI}/libboost_filesystem.a)
|
${EXTERNAL_LIBS_DIR}/${ANDROID_ABI}/lib/libboost_filesystem.a)
|
||||||
|
|
||||||
add_library(boost_program_options STATIC IMPORTED)
|
add_library(boost_program_options STATIC IMPORTED)
|
||||||
set_target_properties(boost_program_options PROPERTIES IMPORTED_LOCATION
|
set_target_properties(boost_program_options PROPERTIES IMPORTED_LOCATION
|
||||||
${EXTERNAL_LIBS_DIR}/boost/lib/${ANDROID_ABI}/libboost_program_options.a)
|
${EXTERNAL_LIBS_DIR}/${ANDROID_ABI}/lib/libboost_program_options.a)
|
||||||
|
|
||||||
add_library(boost_regex STATIC IMPORTED)
|
add_library(boost_regex STATIC IMPORTED)
|
||||||
set_target_properties(boost_regex PROPERTIES IMPORTED_LOCATION
|
set_target_properties(boost_regex PROPERTIES IMPORTED_LOCATION
|
||||||
${EXTERNAL_LIBS_DIR}/boost/lib/${ANDROID_ABI}/libboost_regex.a)
|
${EXTERNAL_LIBS_DIR}/${ANDROID_ABI}/lib/libboost_regex.a)
|
||||||
|
|
||||||
add_library(boost_serialization STATIC IMPORTED)
|
add_library(boost_serialization STATIC IMPORTED)
|
||||||
set_target_properties(boost_serialization PROPERTIES IMPORTED_LOCATION
|
set_target_properties(boost_serialization PROPERTIES IMPORTED_LOCATION
|
||||||
${EXTERNAL_LIBS_DIR}/boost/lib/${ANDROID_ABI}/libboost_serialization.a)
|
${EXTERNAL_LIBS_DIR}/${ANDROID_ABI}/lib/libboost_serialization.a)
|
||||||
|
|
||||||
add_library(boost_system STATIC IMPORTED)
|
add_library(boost_system STATIC IMPORTED)
|
||||||
set_target_properties(boost_system PROPERTIES IMPORTED_LOCATION
|
set_target_properties(boost_system PROPERTIES IMPORTED_LOCATION
|
||||||
${EXTERNAL_LIBS_DIR}/boost/lib/${ANDROID_ABI}/libboost_system.a)
|
${EXTERNAL_LIBS_DIR}/${ANDROID_ABI}/lib/libboost_system.a)
|
||||||
|
|
||||||
add_library(boost_thread STATIC IMPORTED)
|
add_library(boost_thread STATIC IMPORTED)
|
||||||
set_target_properties(boost_thread PROPERTIES IMPORTED_LOCATION
|
set_target_properties(boost_thread PROPERTIES IMPORTED_LOCATION
|
||||||
${EXTERNAL_LIBS_DIR}/boost/lib/${ANDROID_ABI}/libboost_thread.a)
|
${EXTERNAL_LIBS_DIR}/${ANDROID_ABI}/lib/libboost_thread.a)
|
||||||
|
|
||||||
add_library(boost_wserialization STATIC IMPORTED)
|
add_library(boost_wserialization STATIC IMPORTED)
|
||||||
set_target_properties(boost_wserialization PROPERTIES IMPORTED_LOCATION
|
set_target_properties(boost_wserialization PROPERTIES IMPORTED_LOCATION
|
||||||
${EXTERNAL_LIBS_DIR}/boost/lib/${ANDROID_ABI}/libboost_wserialization.a)
|
${EXTERNAL_LIBS_DIR}/${ANDROID_ABI}/lib/libboost_wserialization.a)
|
||||||
|
|
||||||
#############
|
#############
|
||||||
# Monero
|
# Monero
|
||||||
|
@ -77,101 +77,111 @@ set_target_properties(boost_wserialization PROPERTIES IMPORTED_LOCATION
|
||||||
|
|
||||||
add_library(wallet_api STATIC IMPORTED)
|
add_library(wallet_api STATIC IMPORTED)
|
||||||
set_target_properties(wallet_api PROPERTIES IMPORTED_LOCATION
|
set_target_properties(wallet_api PROPERTIES IMPORTED_LOCATION
|
||||||
${EXTERNAL_LIBS_DIR}/monero/lib/${ANDROID_ABI}/libwallet_api.a)
|
${EXTERNAL_LIBS_DIR}/${ANDROID_ABI}/lib/monero/libwallet_api.a)
|
||||||
|
|
||||||
add_library(wallet STATIC IMPORTED)
|
add_library(wallet STATIC IMPORTED)
|
||||||
set_target_properties(wallet PROPERTIES IMPORTED_LOCATION
|
set_target_properties(wallet PROPERTIES IMPORTED_LOCATION
|
||||||
${EXTERNAL_LIBS_DIR}/monero/lib/${ANDROID_ABI}/libwallet.a)
|
${EXTERNAL_LIBS_DIR}/${ANDROID_ABI}/lib/monero/libwallet.a)
|
||||||
|
|
||||||
add_library(cryptonote_core STATIC IMPORTED)
|
add_library(cryptonote_core STATIC IMPORTED)
|
||||||
set_target_properties(cryptonote_core PROPERTIES IMPORTED_LOCATION
|
set_target_properties(cryptonote_core PROPERTIES IMPORTED_LOCATION
|
||||||
${EXTERNAL_LIBS_DIR}/monero/lib/${ANDROID_ABI}/libcryptonote_core.a)
|
${EXTERNAL_LIBS_DIR}/${ANDROID_ABI}/lib/monero/libcryptonote_core.a)
|
||||||
|
|
||||||
add_library(cryptonote_basic STATIC IMPORTED)
|
add_library(cryptonote_basic STATIC IMPORTED)
|
||||||
set_target_properties(cryptonote_basic PROPERTIES IMPORTED_LOCATION
|
set_target_properties(cryptonote_basic PROPERTIES IMPORTED_LOCATION
|
||||||
${EXTERNAL_LIBS_DIR}/monero/lib/${ANDROID_ABI}/libcryptonote_basic.a)
|
${EXTERNAL_LIBS_DIR}/${ANDROID_ABI}/lib/monero/libcryptonote_basic.a)
|
||||||
|
|
||||||
add_library(mnemonics STATIC IMPORTED)
|
add_library(mnemonics STATIC IMPORTED)
|
||||||
set_target_properties(mnemonics PROPERTIES IMPORTED_LOCATION
|
set_target_properties(mnemonics PROPERTIES IMPORTED_LOCATION
|
||||||
${EXTERNAL_LIBS_DIR}/monero/lib/${ANDROID_ABI}/libmnemonics.a)
|
${EXTERNAL_LIBS_DIR}/${ANDROID_ABI}/lib/monero/libmnemonics.a)
|
||||||
|
|
||||||
add_library(common STATIC IMPORTED)
|
add_library(common STATIC IMPORTED)
|
||||||
set_target_properties(common PROPERTIES IMPORTED_LOCATION
|
set_target_properties(common PROPERTIES IMPORTED_LOCATION
|
||||||
${EXTERNAL_LIBS_DIR}/monero/lib/${ANDROID_ABI}/libcommon.a)
|
${EXTERNAL_LIBS_DIR}/${ANDROID_ABI}/lib/monero/libcommon.a)
|
||||||
|
|
||||||
add_library(cncrypto STATIC IMPORTED)
|
add_library(cncrypto STATIC IMPORTED)
|
||||||
set_target_properties(cncrypto PROPERTIES IMPORTED_LOCATION
|
set_target_properties(cncrypto PROPERTIES IMPORTED_LOCATION
|
||||||
${EXTERNAL_LIBS_DIR}/monero/lib/${ANDROID_ABI}/libcncrypto.a)
|
${EXTERNAL_LIBS_DIR}/${ANDROID_ABI}/lib/monero/libcncrypto.a)
|
||||||
|
|
||||||
add_library(ringct STATIC IMPORTED)
|
add_library(ringct STATIC IMPORTED)
|
||||||
set_target_properties(ringct PROPERTIES IMPORTED_LOCATION
|
set_target_properties(ringct PROPERTIES IMPORTED_LOCATION
|
||||||
${EXTERNAL_LIBS_DIR}/monero/lib/${ANDROID_ABI}/libringct.a)
|
${EXTERNAL_LIBS_DIR}/${ANDROID_ABI}/lib/monero/libringct.a)
|
||||||
|
|
||||||
add_library(ringct_basic STATIC IMPORTED)
|
add_library(ringct_basic STATIC IMPORTED)
|
||||||
set_target_properties(ringct_basic PROPERTIES IMPORTED_LOCATION
|
set_target_properties(ringct_basic PROPERTIES IMPORTED_LOCATION
|
||||||
${EXTERNAL_LIBS_DIR}/monero/lib/${ANDROID_ABI}/libringct_basic.a)
|
${EXTERNAL_LIBS_DIR}/${ANDROID_ABI}/lib/monero/libringct_basic.a)
|
||||||
|
|
||||||
add_library(blockchain_db STATIC IMPORTED)
|
add_library(blockchain_db STATIC IMPORTED)
|
||||||
set_target_properties(blockchain_db PROPERTIES IMPORTED_LOCATION
|
set_target_properties(blockchain_db PROPERTIES IMPORTED_LOCATION
|
||||||
${EXTERNAL_LIBS_DIR}/monero/lib/${ANDROID_ABI}/libblockchain_db.a)
|
${EXTERNAL_LIBS_DIR}/${ANDROID_ABI}/lib/monero/libblockchain_db.a)
|
||||||
|
|
||||||
add_library(lmdb STATIC IMPORTED)
|
add_library(lmdb STATIC IMPORTED)
|
||||||
set_target_properties(lmdb PROPERTIES IMPORTED_LOCATION
|
set_target_properties(lmdb PROPERTIES IMPORTED_LOCATION
|
||||||
${EXTERNAL_LIBS_DIR}/monero/lib/${ANDROID_ABI}/liblmdb.a)
|
${EXTERNAL_LIBS_DIR}/${ANDROID_ABI}/lib/monero/liblmdb.a)
|
||||||
|
|
||||||
add_library(easylogging STATIC IMPORTED)
|
add_library(easylogging STATIC IMPORTED)
|
||||||
set_target_properties(easylogging PROPERTIES IMPORTED_LOCATION
|
set_target_properties(easylogging PROPERTIES IMPORTED_LOCATION
|
||||||
${EXTERNAL_LIBS_DIR}/monero/lib/${ANDROID_ABI}/libeasylogging.a)
|
${EXTERNAL_LIBS_DIR}/${ANDROID_ABI}/lib/monero/libeasylogging.a)
|
||||||
|
|
||||||
add_library(unbound STATIC IMPORTED)
|
add_library(unbound STATIC IMPORTED)
|
||||||
set_target_properties(unbound PROPERTIES IMPORTED_LOCATION
|
set_target_properties(unbound PROPERTIES IMPORTED_LOCATION
|
||||||
${EXTERNAL_LIBS_DIR}/monero/lib/${ANDROID_ABI}/libunbound.a)
|
${EXTERNAL_LIBS_DIR}/${ANDROID_ABI}/lib/monero/libunbound.a)
|
||||||
|
|
||||||
add_library(epee STATIC IMPORTED)
|
add_library(epee STATIC IMPORTED)
|
||||||
set_target_properties(epee PROPERTIES IMPORTED_LOCATION
|
set_target_properties(epee PROPERTIES IMPORTED_LOCATION
|
||||||
${EXTERNAL_LIBS_DIR}/monero/lib/${ANDROID_ABI}/libepee.a)
|
${EXTERNAL_LIBS_DIR}/${ANDROID_ABI}/lib/monero/libepee.a)
|
||||||
|
|
||||||
add_library(blocks STATIC IMPORTED)
|
add_library(blocks STATIC IMPORTED)
|
||||||
set_target_properties(blocks PROPERTIES IMPORTED_LOCATION
|
set_target_properties(blocks PROPERTIES IMPORTED_LOCATION
|
||||||
${EXTERNAL_LIBS_DIR}/monero/lib/${ANDROID_ABI}/libblocks.a)
|
${EXTERNAL_LIBS_DIR}/${ANDROID_ABI}/lib/monero/libblocks.a)
|
||||||
|
|
||||||
add_library(checkpoints STATIC IMPORTED)
|
add_library(checkpoints STATIC IMPORTED)
|
||||||
set_target_properties(checkpoints PROPERTIES IMPORTED_LOCATION
|
set_target_properties(checkpoints PROPERTIES IMPORTED_LOCATION
|
||||||
${EXTERNAL_LIBS_DIR}/monero/lib/${ANDROID_ABI}/libcheckpoints.a)
|
${EXTERNAL_LIBS_DIR}/${ANDROID_ABI}/lib/monero/libcheckpoints.a)
|
||||||
|
|
||||||
add_library(device STATIC IMPORTED)
|
add_library(device STATIC IMPORTED)
|
||||||
set_target_properties(device PROPERTIES IMPORTED_LOCATION
|
set_target_properties(device PROPERTIES IMPORTED_LOCATION
|
||||||
${EXTERNAL_LIBS_DIR}/monero/lib/${ANDROID_ABI}/libdevice.a)
|
${EXTERNAL_LIBS_DIR}/${ANDROID_ABI}/lib/monero/libdevice.a)
|
||||||
|
|
||||||
add_library(device_trezor STATIC IMPORTED)
|
add_library(device_trezor STATIC IMPORTED)
|
||||||
set_target_properties(device_trezor PROPERTIES IMPORTED_LOCATION
|
set_target_properties(device_trezor PROPERTIES IMPORTED_LOCATION
|
||||||
${EXTERNAL_LIBS_DIR}/monero/lib/${ANDROID_ABI}/libdevice_trezor.a)
|
${EXTERNAL_LIBS_DIR}/${ANDROID_ABI}/lib/monero/libdevice_trezor.a)
|
||||||
|
|
||||||
add_library(multisig STATIC IMPORTED)
|
add_library(multisig STATIC IMPORTED)
|
||||||
set_target_properties(multisig PROPERTIES IMPORTED_LOCATION
|
set_target_properties(multisig PROPERTIES IMPORTED_LOCATION
|
||||||
${EXTERNAL_LIBS_DIR}/monero/lib/${ANDROID_ABI}/libmultisig.a)
|
${EXTERNAL_LIBS_DIR}/${ANDROID_ABI}/lib/monero/libmultisig.a)
|
||||||
|
|
||||||
add_library(version STATIC IMPORTED)
|
add_library(version STATIC IMPORTED)
|
||||||
set_target_properties(version PROPERTIES IMPORTED_LOCATION
|
set_target_properties(version PROPERTIES IMPORTED_LOCATION
|
||||||
${EXTERNAL_LIBS_DIR}/monero/lib/${ANDROID_ABI}/libversion.a)
|
${EXTERNAL_LIBS_DIR}/${ANDROID_ABI}/lib/monero/libversion.a)
|
||||||
|
|
||||||
add_library(net STATIC IMPORTED)
|
add_library(net STATIC IMPORTED)
|
||||||
set_target_properties(net PROPERTIES IMPORTED_LOCATION
|
set_target_properties(net PROPERTIES IMPORTED_LOCATION
|
||||||
${EXTERNAL_LIBS_DIR}/monero/lib/${ANDROID_ABI}/libnet.a)
|
${EXTERNAL_LIBS_DIR}/${ANDROID_ABI}/lib/monero/libnet.a)
|
||||||
|
|
||||||
add_library(hardforks STATIC IMPORTED)
|
add_library(hardforks STATIC IMPORTED)
|
||||||
set_target_properties(hardforks PROPERTIES IMPORTED_LOCATION
|
set_target_properties(hardforks PROPERTIES IMPORTED_LOCATION
|
||||||
${EXTERNAL_LIBS_DIR}/monero/lib/${ANDROID_ABI}/libhardforks.a)
|
${EXTERNAL_LIBS_DIR}/${ANDROID_ABI}/lib/monero/libhardforks.a)
|
||||||
|
|
||||||
add_library(randomx STATIC IMPORTED)
|
add_library(randomx STATIC IMPORTED)
|
||||||
set_target_properties(randomx PROPERTIES IMPORTED_LOCATION
|
set_target_properties(randomx PROPERTIES IMPORTED_LOCATION
|
||||||
${EXTERNAL_LIBS_DIR}/monero/lib/${ANDROID_ABI}/librandomx.a)
|
${EXTERNAL_LIBS_DIR}/${ANDROID_ABI}/lib/monero/librandomx.a)
|
||||||
|
|
||||||
add_library(rpc_base STATIC IMPORTED)
|
add_library(rpc_base STATIC IMPORTED)
|
||||||
set_target_properties(rpc_base PROPERTIES IMPORTED_LOCATION
|
set_target_properties(rpc_base PROPERTIES IMPORTED_LOCATION
|
||||||
${EXTERNAL_LIBS_DIR}/monero/lib/${ANDROID_ABI}/librpc_base.a)
|
${EXTERNAL_LIBS_DIR}/${ANDROID_ABI}/lib/monero/librpc_base.a)
|
||||||
|
|
||||||
include_directories( ${EXTERNAL_LIBS_DIR}/monero/include )
|
add_library(wallet-crypto STATIC IMPORTED)
|
||||||
|
set_target_properties(wallet-crypto PROPERTIES IMPORTED_LOCATION
|
||||||
|
${EXTERNAL_LIBS_DIR}/${ANDROID_ABI}/lib/monero/libwallet-crypto.a)
|
||||||
|
|
||||||
|
set(WALLET_CRYPTO "")
|
||||||
|
|
||||||
|
if(${ANDROID_ABI} STREQUAL "x86_64")
|
||||||
|
set(WALLET_CRYPTO "wallet-crypto")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
include_directories( ${EXTERNAL_LIBS_DIR}/${ANDROID_ABI}/include )
|
||||||
|
|
||||||
target_link_libraries( cw_monero
|
target_link_libraries( cw_monero
|
||||||
|
|
||||||
|
@ -199,6 +209,7 @@ target_link_libraries( cw_monero
|
||||||
randomx
|
randomx
|
||||||
hardforks
|
hardforks
|
||||||
rpc_base
|
rpc_base
|
||||||
|
${WALLET_CRYPTO}
|
||||||
|
|
||||||
boost_chrono
|
boost_chrono
|
||||||
boost_date_time
|
boost_date_time
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include "thread"
|
#include "thread"
|
||||||
#include "CwWalletListener.h"
|
#include "CwWalletListener.h"
|
||||||
#include "../External/android/monero/include/wallet2_api.h"
|
#include "../External/android/x86/include/wallet2_api.h"
|
||||||
|
|
||||||
using namespace std::chrono_literals;
|
using namespace std::chrono_literals;
|
||||||
|
|
||||||
|
|
12
lib/di.dart
12
lib/di.dart
|
@ -104,6 +104,7 @@ import 'package:cake_wallet/store/templates/send_template_store.dart';
|
||||||
import 'package:cake_wallet/store/templates/exchange_template_store.dart';
|
import 'package:cake_wallet/store/templates/exchange_template_store.dart';
|
||||||
import 'package:cake_wallet/entities/template.dart';
|
import 'package:cake_wallet/entities/template.dart';
|
||||||
import 'package:cake_wallet/exchange/exchange_template.dart';
|
import 'package:cake_wallet/exchange/exchange_template.dart';
|
||||||
|
import 'package:cake_wallet/.secrets.g.dart' as secrets;
|
||||||
|
|
||||||
final getIt = GetIt.instance;
|
final getIt = GetIt.instance;
|
||||||
|
|
||||||
|
@ -134,10 +135,14 @@ Future setup(
|
||||||
|
|
||||||
if (!_isSetupFinished) {
|
if (!_isSetupFinished) {
|
||||||
getIt.registerSingletonAsync<SharedPreferences>(
|
getIt.registerSingletonAsync<SharedPreferences>(
|
||||||
() => SharedPreferences.getInstance());
|
() => SharedPreferences.getInstance());
|
||||||
}
|
}
|
||||||
|
|
||||||
final settingsStore = await SettingsStoreBase.load(nodeSource: _nodeSource);
|
final isBitcoinBuyEnabled = (secrets.wyreSecretKey?.isNotEmpty ?? false) &&
|
||||||
|
(secrets.wyreApiKey?.isNotEmpty ?? false) &&
|
||||||
|
(secrets.wyreAccountId?.isNotEmpty ?? false);
|
||||||
|
final settingsStore = await SettingsStoreBase.load(
|
||||||
|
nodeSource: _nodeSource, isBitcoinBuyEnabled: isBitcoinBuyEnabled);
|
||||||
|
|
||||||
if (_isSetupFinished) {
|
if (_isSetupFinished) {
|
||||||
return;
|
return;
|
||||||
|
@ -219,7 +224,8 @@ Future setup(
|
||||||
appStore: getIt.get<AppStore>(),
|
appStore: getIt.get<AppStore>(),
|
||||||
tradesStore: getIt.get<TradesStore>(),
|
tradesStore: getIt.get<TradesStore>(),
|
||||||
tradeFilterStore: getIt.get<TradeFilterStore>(),
|
tradeFilterStore: getIt.get<TradeFilterStore>(),
|
||||||
transactionFilterStore: getIt.get<TransactionFilterStore>()));
|
transactionFilterStore: getIt.get<TransactionFilterStore>(),
|
||||||
|
settingsStore: settingsStore));
|
||||||
|
|
||||||
getIt.registerFactory<AuthService>(() => AuthService(
|
getIt.registerFactory<AuthService>(() => AuthService(
|
||||||
secureStorage: getIt.get<FlutterSecureStorage>(),
|
secureStorage: getIt.get<FlutterSecureStorage>(),
|
||||||
|
|
|
@ -25,7 +25,7 @@ class ChangeNowExchangeProvider extends ExchangeProvider {
|
||||||
.toList());
|
.toList());
|
||||||
|
|
||||||
static const apiUri = 'https://changenow.io/api/v1';
|
static const apiUri = 'https://changenow.io/api/v1';
|
||||||
static const apiKey = secrets.change_now_api_key;
|
static const apiKey = secrets.changeNowApiKey;
|
||||||
static const _exchangeAmountUriSufix = '/exchange-amount/';
|
static const _exchangeAmountUriSufix = '/exchange-amount/';
|
||||||
static const _transactionsUriSufix = '/transactions/';
|
static const _transactionsUriSufix = '/transactions/';
|
||||||
static const _minAmountUriSufix = '/min-amount/';
|
static const _minAmountUriSufix = '/min-amount/';
|
||||||
|
|
|
@ -38,6 +38,7 @@ abstract class SettingsStoreBase with Store {
|
||||||
@required Map<WalletType, Node> nodes,
|
@required Map<WalletType, Node> nodes,
|
||||||
@required TransactionPriority initialBitcoinTransactionPriority,
|
@required TransactionPriority initialBitcoinTransactionPriority,
|
||||||
@required TransactionPriority initialMoneroTransactionPriority,
|
@required TransactionPriority initialMoneroTransactionPriority,
|
||||||
|
@required this.isBitcoinBuyEnabled,
|
||||||
this.actionlistDisplayMode}) {
|
this.actionlistDisplayMode}) {
|
||||||
fiatCurrency = initialFiatCurrency;
|
fiatCurrency = initialFiatCurrency;
|
||||||
balanceDisplayMode = initialBalanceDisplayMode;
|
balanceDisplayMode = initialBalanceDisplayMode;
|
||||||
|
@ -144,8 +145,11 @@ abstract class SettingsStoreBase with Store {
|
||||||
|
|
||||||
Node getCurrentNode(WalletType walletType) => nodes[walletType];
|
Node getCurrentNode(WalletType walletType) => nodes[walletType];
|
||||||
|
|
||||||
|
bool isBitcoinBuyEnabled;
|
||||||
|
|
||||||
static Future<SettingsStore> load(
|
static Future<SettingsStore> load(
|
||||||
{@required Box<Node> nodeSource,
|
{@required Box<Node> nodeSource,
|
||||||
|
@required bool isBitcoinBuyEnabled,
|
||||||
FiatCurrency initialFiatCurrency = FiatCurrency.usd,
|
FiatCurrency initialFiatCurrency = FiatCurrency.usd,
|
||||||
MoneroTransactionPriority initialMoneroTransactionPriority =
|
MoneroTransactionPriority initialMoneroTransactionPriority =
|
||||||
MoneroTransactionPriority.slow,
|
MoneroTransactionPriority.slow,
|
||||||
|
@ -212,6 +216,7 @@ abstract class SettingsStoreBase with Store {
|
||||||
WalletType.bitcoin: bitcoinElectrumServer
|
WalletType.bitcoin: bitcoinElectrumServer
|
||||||
},
|
},
|
||||||
appVersion: packageInfo.version,
|
appVersion: packageInfo.version,
|
||||||
|
isBitcoinBuyEnabled: isBitcoinBuyEnabled,
|
||||||
initialFiatCurrency: currentFiatCurrency,
|
initialFiatCurrency: currentFiatCurrency,
|
||||||
initialBalanceDisplayMode: currentBalanceDisplayMode,
|
initialBalanceDisplayMode: currentBalanceDisplayMode,
|
||||||
initialSaveRecipientAddress: shouldSaveRecipientAddress,
|
initialSaveRecipientAddress: shouldSaveRecipientAddress,
|
||||||
|
|
|
@ -13,6 +13,7 @@ import 'package:cake_wallet/entities/transaction_direction.dart';
|
||||||
import 'package:cake_wallet/entities/transaction_info.dart';
|
import 'package:cake_wallet/entities/transaction_info.dart';
|
||||||
import 'package:cake_wallet/exchange/exchange_provider_description.dart';
|
import 'package:cake_wallet/exchange/exchange_provider_description.dart';
|
||||||
import 'package:cake_wallet/exchange/trade.dart';
|
import 'package:cake_wallet/exchange/trade.dart';
|
||||||
|
import 'package:cake_wallet/store/settings_store.dart';
|
||||||
import 'package:cake_wallet/utils/mobx.dart';
|
import 'package:cake_wallet/utils/mobx.dart';
|
||||||
import 'package:cake_wallet/view_model/dashboard/balance_view_model.dart';
|
import 'package:cake_wallet/view_model/dashboard/balance_view_model.dart';
|
||||||
import 'package:cake_wallet/view_model/dashboard/filter_item.dart';
|
import 'package:cake_wallet/view_model/dashboard/filter_item.dart';
|
||||||
|
@ -41,7 +42,8 @@ abstract class DashboardViewModelBase with Store {
|
||||||
this.appStore,
|
this.appStore,
|
||||||
this.tradesStore,
|
this.tradesStore,
|
||||||
this.tradeFilterStore,
|
this.tradeFilterStore,
|
||||||
this.transactionFilterStore}) {
|
this.transactionFilterStore,
|
||||||
|
this.settingsStore}) {
|
||||||
filterItems = {
|
filterItems = {
|
||||||
S.current.transactions: [
|
S.current.transactions: [
|
||||||
FilterItem(
|
FilterItem(
|
||||||
|
@ -193,6 +195,8 @@ abstract class DashboardViewModelBase with Store {
|
||||||
|
|
||||||
AppStore appStore;
|
AppStore appStore;
|
||||||
|
|
||||||
|
SettingsStore settingsStore;
|
||||||
|
|
||||||
TradesStore tradesStore;
|
TradesStore tradesStore;
|
||||||
|
|
||||||
TradeFilterStore tradeFilterStore;
|
TradeFilterStore tradeFilterStore;
|
||||||
|
@ -201,6 +205,8 @@ abstract class DashboardViewModelBase with Store {
|
||||||
|
|
||||||
Map<String, List<FilterItem>> filterItems;
|
Map<String, List<FilterItem>> filterItems;
|
||||||
|
|
||||||
|
bool get isBuyEnabled => settingsStore.isBitcoinBuyEnabled;
|
||||||
|
|
||||||
ReactionDisposer _reaction;
|
ReactionDisposer _reaction;
|
||||||
|
|
||||||
ReactionDisposer _onMoneroAccountChangeReaction;
|
ReactionDisposer _onMoneroAccountChangeReaction;
|
||||||
|
|
|
@ -188,6 +188,8 @@ abstract class SettingsViewModelBase with Store {
|
||||||
@computed
|
@computed
|
||||||
ThemeBase get theme => _settingsStore.currentTheme;
|
ThemeBase get theme => _settingsStore.currentTheme;
|
||||||
|
|
||||||
|
bool get isBitcoinBuyEnabled => _settingsStore.isBitcoinBuyEnabled;
|
||||||
|
|
||||||
final Map<String, String> itemHeaders;
|
final Map<String, String> itemHeaders;
|
||||||
List<List<SettingsListItem>> sections;
|
List<List<SettingsListItem>> sections;
|
||||||
final SettingsStore _settingsStore;
|
final SettingsStore _settingsStore;
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
{
|
|
||||||
"salt": "",
|
|
||||||
"keychainSalt": "",
|
|
||||||
"key": "",
|
|
||||||
"walletSalt": "",
|
|
||||||
"shortKey": "",
|
|
||||||
"change_now_api_key": ""
|
|
||||||
}
|
|
12
tool/generate_new_secrets.dart
Normal file
12
tool/generate_new_secrets.dart
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
import 'generate_secrets_config.dart';
|
||||||
|
import 'import_secrets_config.dart';
|
||||||
|
|
||||||
|
const configPath = 'tool/.secrets-config.json';
|
||||||
|
const outputPath = 'lib/.secrets.g.dart';
|
||||||
|
|
||||||
|
Future<void> main(List<String> args) async => generateSecrets(args);
|
||||||
|
|
||||||
|
Future<void> generateSecrets(List<String> args) async {
|
||||||
|
await generateSecretsConfig(args);
|
||||||
|
await importSecretsConfig();
|
||||||
|
}
|
49
tool/generate_secrets_config.dart
Normal file
49
tool/generate_secrets_config.dart
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
import 'dart:convert';
|
||||||
|
import 'dart:io';
|
||||||
|
import 'utils/secret_key.dart';
|
||||||
|
import 'utils/utils.dart';
|
||||||
|
|
||||||
|
const configPath = 'tool/.secrets-config.json';
|
||||||
|
|
||||||
|
Future<void> main(List<String> args) async => generateSecretsConfig(args);
|
||||||
|
|
||||||
|
Future<void> generateSecretsConfig(List<String> args) async {
|
||||||
|
final extraInfo =
|
||||||
|
args.fold(<String, dynamic>{}, (Map<String, dynamic> acc, String arg) {
|
||||||
|
final parts = arg.split('=');
|
||||||
|
final key = normalizeKeyName(parts[0]);
|
||||||
|
acc[key] = acc[key] = parts.length > 1 ? parts[1] : 1;
|
||||||
|
return acc;
|
||||||
|
});
|
||||||
|
|
||||||
|
final configFile = File(configPath);
|
||||||
|
final secrets = <String, dynamic>{};
|
||||||
|
|
||||||
|
secrets.addAll(extraInfo);
|
||||||
|
secrets.removeWhere((key, dynamic value) {
|
||||||
|
if (key.contains('--')) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
if (configFile.existsSync()) {
|
||||||
|
if (extraInfo['--force'] == 1) {
|
||||||
|
await configFile.delete();
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SecretKey.base.forEach((sec) {
|
||||||
|
if (secrets[sec.name] != null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
secrets[sec.name] = sec.generate();
|
||||||
|
});
|
||||||
|
|
||||||
|
final secretsJson = JsonEncoder.withIndent(' ').convert(secrets);
|
||||||
|
await configFile.writeAsString(secretsJson);
|
||||||
|
}
|
23
tool/import_secrets_config.dart
Normal file
23
tool/import_secrets_config.dart
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
import 'dart:convert';
|
||||||
|
import 'dart:io';
|
||||||
|
import 'utils/utils.dart';
|
||||||
|
|
||||||
|
const configPath = 'tool/.secrets-config.json';
|
||||||
|
const outputPath = 'lib/.secrets.g.dart';
|
||||||
|
|
||||||
|
Future<void> main(List<String> args) async => importSecretsConfig();
|
||||||
|
|
||||||
|
Future<void> importSecretsConfig() async {
|
||||||
|
final outputFile = File(outputPath);
|
||||||
|
final input = json.decode(File(configPath).readAsStringSync())
|
||||||
|
as Map<String, dynamic> ??
|
||||||
|
<String, dynamic>{};
|
||||||
|
final output = input.keys
|
||||||
|
.fold('', (String acc, String val) => acc + generateConst(val, input));
|
||||||
|
|
||||||
|
if (outputFile.existsSync()) {
|
||||||
|
await outputFile.delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
await outputFile.writeAsString(output);
|
||||||
|
}
|
|
@ -1,20 +0,0 @@
|
||||||
import 'dart:convert';
|
|
||||||
import 'dart:io';
|
|
||||||
|
|
||||||
const secretsProdPath = 'tool/.secrets-prod.json';
|
|
||||||
const secretsTestPath = 'tool/.secrets-test.json';
|
|
||||||
const outputPath = 'lib/.secrets.g.dart';
|
|
||||||
|
|
||||||
Future<void> main() async {
|
|
||||||
final inputPath = FileSystemEntity.typeSync(secretsProdPath) !=
|
|
||||||
FileSystemEntityType.notFound
|
|
||||||
? secretsProdPath
|
|
||||||
: secretsTestPath;
|
|
||||||
|
|
||||||
final inoutContent = File(inputPath).readAsStringSync();
|
|
||||||
final config = json.decode(inoutContent) as Map<String, dynamic>;
|
|
||||||
final output =
|
|
||||||
'const salt = \'${config["salt"]}\';const keychainSalt = \'${config["keychainSalt"]}\';\nconst key = \'${config["key"]}\';\nconst walletSalt = \'${config["walletSalt"]}\';\nconst shortKey = \'${config["shortKey"]}\';\nconst change_now_api_key = \'${config["change_now_api_key"]}\';';
|
|
||||||
|
|
||||||
await File(outputPath).writeAsString(output);
|
|
||||||
}
|
|
47
tool/update_secrets.dart
Normal file
47
tool/update_secrets.dart
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
import 'dart:convert';
|
||||||
|
import 'dart:io';
|
||||||
|
import 'generate_new_secrets.dart';
|
||||||
|
import 'import_secrets_config.dart';
|
||||||
|
import 'utils/utils.dart';
|
||||||
|
|
||||||
|
const configPath = 'tool/.secrets-config.json';
|
||||||
|
|
||||||
|
Future<void> main(List<String> args) async {
|
||||||
|
await updateSecretsConfig(args);
|
||||||
|
await importSecretsConfig();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> updateSecretsConfig(List<String> args) async {
|
||||||
|
final extraInfo =
|
||||||
|
args.fold(<String, dynamic>{}, (Map<String, dynamic> acc, String arg) {
|
||||||
|
final parts = arg.split('=');
|
||||||
|
final key = normalizeKeyName(parts[0]);
|
||||||
|
acc[key] = parts.length > 1 ? parts[1] : 1;
|
||||||
|
return acc;
|
||||||
|
});
|
||||||
|
|
||||||
|
final configFile = File(configPath);
|
||||||
|
final secrets = <String, dynamic>{};
|
||||||
|
|
||||||
|
secrets.addAll(extraInfo);
|
||||||
|
secrets.removeWhere((key, dynamic value) {
|
||||||
|
if (key.contains('--')) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
final fileConfig =
|
||||||
|
json.decode(configFile.readAsStringSync()) as Map<String, dynamic> ??
|
||||||
|
<String, dynamic>{};
|
||||||
|
fileConfig.forEach((key, dynamic value) {
|
||||||
|
if (secrets[key] == null) {
|
||||||
|
secrets[key] = value;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
final secretsJson = JsonEncoder.withIndent(' ').convert(secrets);
|
||||||
|
await configFile.writeAsString(secretsJson);
|
||||||
|
await generateSecrets(args);
|
||||||
|
}
|
28
tool/utils/secret_key.dart
Normal file
28
tool/utils/secret_key.dart
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
import 'package:encrypt/encrypt.dart' as encrypt;
|
||||||
|
import 'package:convert/convert.dart';
|
||||||
|
|
||||||
|
class SecretKey {
|
||||||
|
const SecretKey(this.name, this.generate);
|
||||||
|
|
||||||
|
static final base = [
|
||||||
|
SecretKey('salt', () => hex.encode(encrypt.Key.fromSecureRandom(16).bytes)),
|
||||||
|
SecretKey('keychainSalt',
|
||||||
|
() => hex.encode(encrypt.Key.fromSecureRandom(12).bytes)),
|
||||||
|
SecretKey('key', () => hex.encode(encrypt.Key.fromSecureRandom(16).bytes)),
|
||||||
|
SecretKey(
|
||||||
|
'walletSalt', () => hex.encode(encrypt.Key.fromSecureRandom(4).bytes)),
|
||||||
|
SecretKey(
|
||||||
|
'shortKey', () => hex.encode(encrypt.Key.fromSecureRandom(12).bytes)),
|
||||||
|
SecretKey(
|
||||||
|
'backupSalt', () => hex.encode(encrypt.Key.fromSecureRandom(8).bytes)),
|
||||||
|
SecretKey('backupKeychainSalt',
|
||||||
|
() => hex.encode(encrypt.Key.fromSecureRandom(12).bytes)),
|
||||||
|
SecretKey('changeNowApiKey', () => ''),
|
||||||
|
SecretKey('wyreSecretKey', () => ''),
|
||||||
|
SecretKey('wyreApiKey', () => ''),
|
||||||
|
SecretKey('wyreAccountId', () => ''),
|
||||||
|
];
|
||||||
|
|
||||||
|
final String name;
|
||||||
|
final String Function() generate;
|
||||||
|
}
|
13
tool/utils/utils.dart
Normal file
13
tool/utils/utils.dart
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
import 'package:intl/intl.dart';
|
||||||
|
|
||||||
|
String normalizeKeyName(String key) {
|
||||||
|
final parts = key.split('_');
|
||||||
|
final firstWord = parts.removeAt(0);
|
||||||
|
final capitalized = parts
|
||||||
|
.map((e) => toBeginningOfSentenceCase(e))
|
||||||
|
.fold('', (String acc, String word) => acc + word);
|
||||||
|
return firstWord + capitalized;
|
||||||
|
}
|
||||||
|
|
||||||
|
String generateConst(String name, Map<String, dynamic> config) =>
|
||||||
|
'const $name = \'${config["$name"]}\';\n';
|
Loading…
Reference in a new issue