diff --git a/app/lib/app_config.dart b/app/lib/app_config.dart index 932dfe06..b9a82157 100644 --- a/app/lib/app_config.dart +++ b/app/lib/app_config.dart @@ -215,4 +215,5 @@ void setFallbackConfigs() { Globals().redoIdentityVerification = false; Globals().timeOutSeconds = 10; Globals().phoneVerification = false; + Globals().chainUrl = ''; } diff --git a/app/lib/helpers/flags.dart b/app/lib/helpers/flags.dart index 7793d123..65465994 100644 --- a/app/lib/helpers/flags.dart +++ b/app/lib/helpers/flags.dart @@ -60,6 +60,8 @@ class Flags { await Flags().hasFlagValueByFeatureName('redo-identity-verification'); Globals().phoneVerification = await Flags().hasFlagValueByFeatureName('phone-verification'); + Globals().chainUrl = + (await Flags().getFlagValueByFeatureName('chain-url'))!; } Future hasFlagValueByFeatureName(String name) async { diff --git a/app/lib/helpers/globals.dart b/app/lib/helpers/globals.dart index ba2f9142..80d35a84 100644 --- a/app/lib/helpers/globals.dart +++ b/app/lib/helpers/globals.dart @@ -54,6 +54,7 @@ class Globals { String tosUrl = ''; bool maintenance = false; bool phoneVerification = false; + String chainUrl = ''; bool isCacheClearedWallet = false; bool isCacheClearedFarmer = false; diff --git a/app/lib/services/tfchain_service.dart b/app/lib/services/tfchain_service.dart index 6bb47061..cd92ef77 100644 --- a/app/lib/services/tfchain_service.dart +++ b/app/lib/services/tfchain_service.dart @@ -1,9 +1,12 @@ +import 'package:threebotlogin/helpers/globals.dart'; import 'package:threebotlogin/services/shared_preference_service.dart'; import 'package:stellar_client/stellar_client.dart' as Stellar; import 'package:convert/convert.dart'; import 'package:tfchain_client/tfchain_client.dart' as TFChain; Future getTwinId() async { + final chainUrl = Globals().chainUrl; + if (chainUrl == '') return null; final phrase = await getPhrase(); if (phrase != null) { final wallet = await Stellar.Client.createFromMnemonic( @@ -11,9 +14,7 @@ Future getTwinId() async { final privateKey = wallet.privateKey; if (privateKey != null) { final hexSecret = hex.encode(privateKey.toList().sublist(0, 32)); - // TODO: get the chain url from flagsmith - final tfchainClient = TFChain.Client( - "wss://tfchain.dev.grid.tf/ws", '0x$hexSecret', "sr25519"); + final tfchainClient = TFChain.Client(chainUrl, '0x$hexSecret', "sr25519"); await tfchainClient.connect(); final twinId = await tfchainClient.twins.getMyTwinId(); await tfchainClient.disconnect();