mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-12-22 11:39:22 +00:00
CW-653-Migrate-Tron-And-Solana-To-NowNodes (#1492)
Some checks failed
Cache Dependencies / test (push) Has been cancelled
Some checks failed
Cache Dependencies / test (push) Has been cancelled
* chore: Setup * feat: Add NowNodes for Tron Wallet and switch it to be the default node for Tron * feat: Add NowNodes for Solana Wallet and switch it to be the default node for Solana * fix: Add nownodes entry to secrets * fix: Remove pubspec.lock in shared external * fix conflicts with main * change secrets names * feat: Remove Solana NowNodes config * feat: Remove Solana NowNodes config * feat: Revert commented out code --------- Co-authored-by: OmarHatem <omarh.ismail1@gmail.com>
This commit is contained in:
parent
ac9e473ef5
commit
a319e10156
9 changed files with 51 additions and 8 deletions
1
.github/workflows/pr_test_build.yml
vendored
1
.github/workflows/pr_test_build.yml
vendored
|
@ -158,6 +158,7 @@ jobs:
|
||||||
echo "const quantexExchangeMarkup = '${{ secrets.QUANTEX_EXCHANGE_MARKUP }}';" >> lib/.secrets.g.dart
|
echo "const quantexExchangeMarkup = '${{ secrets.QUANTEX_EXCHANGE_MARKUP }}';" >> lib/.secrets.g.dart
|
||||||
echo "const nano2ApiKey = '${{ secrets.NANO2_API_KEY }}';" >> cw_nano/lib/.secrets.g.dart
|
echo "const nano2ApiKey = '${{ secrets.NANO2_API_KEY }}';" >> cw_nano/lib/.secrets.g.dart
|
||||||
echo "const tronGridApiKey = '${{ secrets.TRON_GRID_API_KEY }}';" >> cw_tron/lib/.secrets.g.dart
|
echo "const tronGridApiKey = '${{ secrets.TRON_GRID_API_KEY }}';" >> cw_tron/lib/.secrets.g.dart
|
||||||
|
echo "const tronNowNodesApiKey = '${{ secrets.TRON_NOW_NODES_API_KEY }}';" >> cw_tron/lib/.secrets.g.dart
|
||||||
|
|
||||||
- name: Rename app
|
- name: Rename app
|
||||||
run: |
|
run: |
|
||||||
|
|
|
@ -4,5 +4,9 @@
|
||||||
useSSL: true
|
useSSL: true
|
||||||
-
|
-
|
||||||
uri: api.trongrid.io
|
uri: api.trongrid.io
|
||||||
|
is_default: false
|
||||||
|
useSSL: true
|
||||||
|
-
|
||||||
|
uri: trx.nownodes.io
|
||||||
is_default: true
|
is_default: true
|
||||||
useSSL: true
|
useSSL: true
|
|
@ -20,6 +20,7 @@ class TronHTTPProvider implements TronServiceProvider {
|
||||||
final response = await client.get(Uri.parse(params.url(url)), headers: {
|
final response = await client.get(Uri.parse(params.url(url)), headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
if (url.contains("trongrid")) 'TRON-PRO-API-KEY': secrets.tronGridApiKey,
|
if (url.contains("trongrid")) 'TRON-PRO-API-KEY': secrets.tronGridApiKey,
|
||||||
|
if (url.contains("nownodes")) 'api-key': secrets.tronNowNodesApiKey,
|
||||||
}).timeout(timeout ?? defaultRequestTimeout);
|
}).timeout(timeout ?? defaultRequestTimeout);
|
||||||
final data = json.decode(response.body) as Map<String, dynamic>;
|
final data = json.decode(response.body) as Map<String, dynamic>;
|
||||||
return data;
|
return data;
|
||||||
|
@ -32,6 +33,7 @@ class TronHTTPProvider implements TronServiceProvider {
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
if (url.contains("trongrid")) 'TRON-PRO-API-KEY': secrets.tronGridApiKey,
|
if (url.contains("trongrid")) 'TRON-PRO-API-KEY': secrets.tronGridApiKey,
|
||||||
|
if (url.contains("nownodes")) 'api-key': secrets.tronNowNodesApiKey,
|
||||||
},
|
},
|
||||||
body: params.toRequestBody())
|
body: params.toRequestBody())
|
||||||
.timeout(timeout ?? defaultRequestTimeout);
|
.timeout(timeout ?? defaultRequestTimeout);
|
||||||
|
|
1
devtools_options.yaml
Normal file
1
devtools_options.yaml
Normal file
|
@ -0,0 +1 @@
|
||||||
|
extensions:
|
|
@ -164,7 +164,7 @@
|
||||||
97C146E61CF9000F007C117D /* Project object */ = {
|
97C146E61CF9000F007C117D /* Project object */ = {
|
||||||
isa = PBXProject;
|
isa = PBXProject;
|
||||||
attributes = {
|
attributes = {
|
||||||
LastUpgradeCheck = 1300;
|
LastUpgradeCheck = 1510;
|
||||||
ORGANIZATIONNAME = "";
|
ORGANIZATIONNAME = "";
|
||||||
TargetAttributes = {
|
TargetAttributes = {
|
||||||
97C146ED1CF9000F007C117D = {
|
97C146ED1CF9000F007C117D = {
|
||||||
|
@ -355,7 +355,7 @@
|
||||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
|
||||||
MTL_ENABLE_DEBUG_INFO = NO;
|
MTL_ENABLE_DEBUG_INFO = NO;
|
||||||
SDKROOT = iphoneos;
|
SDKROOT = iphoneos;
|
||||||
SUPPORTED_PLATFORMS = iphoneos;
|
SUPPORTED_PLATFORMS = iphoneos;
|
||||||
|
@ -449,7 +449,7 @@
|
||||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
|
||||||
MTL_ENABLE_DEBUG_INFO = YES;
|
MTL_ENABLE_DEBUG_INFO = YES;
|
||||||
ONLY_ACTIVE_ARCH = YES;
|
ONLY_ACTIVE_ARCH = YES;
|
||||||
SDKROOT = iphoneos;
|
SDKROOT = iphoneos;
|
||||||
|
@ -499,7 +499,7 @@
|
||||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
|
||||||
MTL_ENABLE_DEBUG_INFO = NO;
|
MTL_ENABLE_DEBUG_INFO = NO;
|
||||||
SDKROOT = iphoneos;
|
SDKROOT = iphoneos;
|
||||||
SUPPORTED_PLATFORMS = iphoneos;
|
SUPPORTED_PLATFORMS = iphoneos;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<Scheme
|
<Scheme
|
||||||
LastUpgradeVersion = "1300"
|
LastUpgradeVersion = "1510"
|
||||||
version = "1.3">
|
version = "1.3">
|
||||||
<BuildAction
|
<BuildAction
|
||||||
parallelizeBuildables = "YES"
|
parallelizeBuildables = "YES"
|
||||||
|
|
|
@ -37,7 +37,7 @@ const cakeWalletBitcoinCashDefaultNodeUri = 'bitcoincash.stackwallet.com:50002';
|
||||||
const nanoDefaultNodeUri = 'rpc.nano.to';
|
const nanoDefaultNodeUri = 'rpc.nano.to';
|
||||||
const nanoDefaultPowNodeUri = 'rpc.nano.to';
|
const nanoDefaultPowNodeUri = 'rpc.nano.to';
|
||||||
const solanaDefaultNodeUri = 'rpc.ankr.com';
|
const solanaDefaultNodeUri = 'rpc.ankr.com';
|
||||||
const tronDefaultNodeUri = 'api.trongrid.io';
|
const tronDefaultNodeUri = 'trx.nownodes.io';
|
||||||
const newCakeWalletBitcoinUri = 'btc-electrum.cakewallet.com:50002';
|
const newCakeWalletBitcoinUri = 'btc-electrum.cakewallet.com:50002';
|
||||||
|
|
||||||
Future<void> defaultSettingsMigration(
|
Future<void> defaultSettingsMigration(
|
||||||
|
@ -234,7 +234,11 @@ Future<void> defaultSettingsMigration(
|
||||||
await changeTronCurrentNodeToDefault(sharedPreferences: sharedPreferences, nodes: nodes);
|
await changeTronCurrentNodeToDefault(sharedPreferences: sharedPreferences, nodes: nodes);
|
||||||
break;
|
break;
|
||||||
case 37:
|
case 37:
|
||||||
|
await replaceTronDefaultNode(sharedPreferences: sharedPreferences, nodes: nodes);
|
||||||
|
break;
|
||||||
|
case 38:
|
||||||
await fixBtcDerivationPaths(walletInfoSource);
|
await fixBtcDerivationPaths(walletInfoSource);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1142,3 +1146,29 @@ Future<void> changeTronCurrentNodeToDefault(
|
||||||
|
|
||||||
await sharedPreferences.setInt(PreferencesKey.currentTronNodeIdKey, nodeId);
|
await sharedPreferences.setInt(PreferencesKey.currentTronNodeIdKey, nodeId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> replaceTronDefaultNode({
|
||||||
|
required SharedPreferences sharedPreferences,
|
||||||
|
required Box<Node> nodes,
|
||||||
|
}) async {
|
||||||
|
// Get the currently active node
|
||||||
|
final currentTronNodeId = sharedPreferences.getInt(PreferencesKey.currentTronNodeIdKey);
|
||||||
|
final currentTronNode =
|
||||||
|
nodes.values.firstWhereOrNull((Node node) => node.key == currentTronNodeId);
|
||||||
|
|
||||||
|
//Confirm if this node is part of the default nodes from CakeWallet
|
||||||
|
final tronDefaultNodeList = [
|
||||||
|
'tron-rpc.publicnode.com:443',
|
||||||
|
'api.trongrid.io',
|
||||||
|
];
|
||||||
|
bool needsToBeReplaced =
|
||||||
|
currentTronNode == null ? true : tronDefaultNodeList.contains(currentTronNode.uriRaw);
|
||||||
|
|
||||||
|
// If it's a custom node, return. We don't want to switch users from their custom nodes
|
||||||
|
if (!needsToBeReplaced) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If it's not, we switch user to the new default node: NowNodes
|
||||||
|
await changeTronCurrentNodeToDefault(sharedPreferences: sharedPreferences, nodes: nodes);
|
||||||
|
}
|
|
@ -202,7 +202,7 @@ Future<void> initializeAppConfigs() async {
|
||||||
transactionDescriptions: transactionDescriptions,
|
transactionDescriptions: transactionDescriptions,
|
||||||
secureStorage: secureStorage,
|
secureStorage: secureStorage,
|
||||||
anonpayInvoiceInfo: anonpayInvoiceInfo,
|
anonpayInvoiceInfo: anonpayInvoiceInfo,
|
||||||
initialMigrationVersion: 37,
|
initialMigrationVersion: 38,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,10 @@ class SecretKey {
|
||||||
SecretKey('moralisApiKey', () => ''),
|
SecretKey('moralisApiKey', () => ''),
|
||||||
SecretKey('ankrApiKey', () => ''),
|
SecretKey('ankrApiKey', () => ''),
|
||||||
SecretKey('quantexExchangeMarkup', () => ''),
|
SecretKey('quantexExchangeMarkup', () => ''),
|
||||||
|
SecretKey('testCakePayApiKey', () => ''),
|
||||||
|
SecretKey('cakePayApiKey', () => ''),
|
||||||
|
SecretKey('CSRFToken', () => ''),
|
||||||
|
SecretKey('authorization', () => ''),
|
||||||
];
|
];
|
||||||
|
|
||||||
static final evmChainsSecrets = [
|
static final evmChainsSecrets = [
|
||||||
|
@ -57,6 +61,7 @@ class SecretKey {
|
||||||
|
|
||||||
static final tronSecrets = [
|
static final tronSecrets = [
|
||||||
SecretKey('tronGridApiKey', () => ''),
|
SecretKey('tronGridApiKey', () => ''),
|
||||||
|
SecretKey('tronNowNodesApiKey', () => ''),
|
||||||
];
|
];
|
||||||
|
|
||||||
final String name;
|
final String name;
|
||||||
|
|
Loading…
Reference in a new issue