From f5e519e296a951d40230f98c132a6bb69692e464 Mon Sep 17 00:00:00 2001 From: dorianvp Date: Tue, 14 Apr 2026 18:32:20 +0100 Subject: [PATCH 1/3] wip: fixes & server list --- app/LoadingApp/LoadingApp.tsx | 1 + .../components/ServerListScreen.tsx | 6 ++++- app/utils/Utils.ts | 4 +++ .../Staking/Finalizers/FinalizerPosition.tsx | 5 +--- components/Staking/components/Redelegate.tsx | 26 ++++++------------- components/Staking/components/Unstake.tsx | 6 ++--- 6 files changed, 22 insertions(+), 26 deletions(-) diff --git a/app/LoadingApp/LoadingApp.tsx b/app/LoadingApp/LoadingApp.tsx index 597ef0551..a22679362 100644 --- a/app/LoadingApp/LoadingApp.tsx +++ b/app/LoadingApp/LoadingApp.tsx @@ -1661,6 +1661,7 @@ export class LoadingAppClass extends Component< setIndexerServer={this.setIndexerServer} checkIndexerServer={this.checkIndexerServer} closeServers={this.closeServers} + previousServer={} /> )} {screen === 1 && ( diff --git a/app/LoadingApp/components/ServerListScreen.tsx b/app/LoadingApp/components/ServerListScreen.tsx index 7f7128d5d..e1081ba7f 100644 --- a/app/LoadingApp/components/ServerListScreen.tsx +++ b/app/LoadingApp/components/ServerListScreen.tsx @@ -38,6 +38,7 @@ export type ServerListScreenProps = { indexerList: IndexerList; closeServers: () => void; goBack: () => void; + previousServer?: Indexer; }; export const ServerListScreen: React.FC = ({ @@ -46,12 +47,15 @@ export const ServerListScreen: React.FC = ({ indexerList, closeServers, goBack, + previousServer, }) => { const { colors } = useTheme() as unknown as ThemeType; // TODO: FIX const insets = useSafeAreaInsets(); const { clear } = useToast(); - const [selectedServer, setSelectedServer] = useState(null); + const [selectedServer, setSelectedServer] = useState( + previousServer ? previousServer : null, + ); const [connected, setConnected] = useState(null); const [borderColor, setBorderColor] = useState('transparent'); const [isTestingSelected, setIsTestingSelected] = useState(false); diff --git a/app/utils/Utils.ts b/app/utils/Utils.ts index 851b26925..cea88dc69 100644 --- a/app/utils/Utils.ts +++ b/app/utils/Utils.ts @@ -596,3 +596,7 @@ export async function getIndexerList(): Promise { console.log('json', json.data.indexers); return json.data.indexers; } + +export function formatAmount(value: number) { + return `${value.toFixed(2)} cTAZ`; +} diff --git a/components/Staking/Finalizers/FinalizerPosition.tsx b/components/Staking/Finalizers/FinalizerPosition.tsx index 08d63dcbe..881897e5a 100644 --- a/components/Staking/Finalizers/FinalizerPosition.tsx +++ b/components/Staking/Finalizers/FinalizerPosition.tsx @@ -9,6 +9,7 @@ import { ViewStyle, } from 'react-native'; import { WalletBondsStatusEnum } from '../../../app/AppState/enums/WalletBondsStatusEnum'; +import { formatAmount } from '../../../app/utils/Utils'; export default interface WalletBondsType { txid: string; @@ -37,10 +38,6 @@ type WalletBondCardProps = { secondaryButtonStyle?: StyleProp; }; -function formatAmount(value: number) { - return `${value.toFixed(2)} cTAZ`; -} - function truncateMiddle(value: string, start = 10, end = 8) { if (!value) return ''; if (value.length <= start + end + 3) return value; diff --git a/components/Staking/components/Redelegate.tsx b/components/Staking/components/Redelegate.tsx index da3a33965..ff68e27c6 100644 --- a/components/Staking/components/Redelegate.tsx +++ b/components/Staking/components/Redelegate.tsx @@ -42,6 +42,7 @@ import Refresh from '../../../assets/icons/refresh.svg'; import RegText from '../../Components/RegText'; import { WalletBondsStatusEnum } from '../../../app/AppState/enums/WalletBondsStatusEnum'; import ZecAmount from '../../Components/ZecAmount'; +import { ChevronRight } from 'lucide-react-native'; type ModalState = 'idle' | 'sending' | 'success'; @@ -322,18 +323,6 @@ const Redelegate: React.FC = ({ route }) => { }} /> - - Finalizers addresses - = ({ route }) => { alignItems: 'center', borderRadius: 20, marginBottom: 10, - backgroundColor: colors.secondary, padding: 16, marginHorizontal: 10, + marginTop: 20, borderWidth: 0.5, - borderColor: colors.text, + borderColor: '#575757', }} > = ({ route }) => { {!!stakedFromNumber && ( {`Staked: ${stakedFromNumber.toFixed(5)} ${info.currencyName}`} )} @@ -470,11 +459,12 @@ const Redelegate: React.FC = ({ route }) => { alignItems: 'center', borderRadius: 20, marginBottom: 10, - backgroundColor: colors.secondary, + backgroundColor: '#161616', + padding: 16, marginHorizontal: 10, borderWidth: 0.5, - borderColor: colors.text, + borderColor: '#575757', marginTop: -15, }} > @@ -552,7 +542,7 @@ const Redelegate: React.FC = ({ route }) => { )} - navigation.navigate(RouteEnum.Finalizers, { setFinalizer: (f: string, s: number) => { diff --git a/components/Staking/components/Unstake.tsx b/components/Staking/components/Unstake.tsx index e85ad90be..16e83f6bd 100644 --- a/components/Staking/components/Unstake.tsx +++ b/components/Staking/components/Unstake.tsx @@ -335,11 +335,11 @@ const Unstake: React.FC = ({ route }) => { alignItems: 'center', borderRadius: 20, marginBottom: 10, - backgroundColor: colors.secondary, + backgroundColor: '#161616', padding: 16, marginHorizontal: 10, borderWidth: 0.5, - borderColor: colors.text, + borderColor: '#575757', }} > = ({ route }) => { {!!stakedFromNumber && ( {`Staked: ${stakedFromNumber.toFixed(5)} ${info.currencyName}`} )} From 7edbde3e134e820039ec9c2f15dfe3e477966b93 Mon Sep 17 00:00:00 2001 From: dorianvp Date: Tue, 14 Apr 2026 20:51:53 +0100 Subject: [PATCH 2/3] chore: select current server --- app/LoadingApp/LoadingApp.tsx | 2 +- app/LoadingApp/components/ServerListScreen.tsx | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/LoadingApp/LoadingApp.tsx b/app/LoadingApp/LoadingApp.tsx index a22679362..6c337992f 100644 --- a/app/LoadingApp/LoadingApp.tsx +++ b/app/LoadingApp/LoadingApp.tsx @@ -1661,7 +1661,7 @@ export class LoadingAppClass extends Component< setIndexerServer={this.setIndexerServer} checkIndexerServer={this.checkIndexerServer} closeServers={this.closeServers} - previousServer={} + previousServer={this.state.indexerServer.uri} /> )} {screen === 1 && ( diff --git a/app/LoadingApp/components/ServerListScreen.tsx b/app/LoadingApp/components/ServerListScreen.tsx index e1081ba7f..5cb8e7089 100644 --- a/app/LoadingApp/components/ServerListScreen.tsx +++ b/app/LoadingApp/components/ServerListScreen.tsx @@ -38,7 +38,7 @@ export type ServerListScreenProps = { indexerList: IndexerList; closeServers: () => void; goBack: () => void; - previousServer?: Indexer; + previousServer?: string; }; export const ServerListScreen: React.FC = ({ @@ -53,8 +53,12 @@ export const ServerListScreen: React.FC = ({ const insets = useSafeAreaInsets(); const { clear } = useToast(); + const prevIndexer = indexerList.find( + indexer => indexer.url === previousServer, + ); + const [selectedServer, setSelectedServer] = useState( - previousServer ? previousServer : null, + prevIndexer ? prevIndexer : null, ); const [connected, setConnected] = useState(null); const [borderColor, setBorderColor] = useState('transparent'); From 22e59ba941207a22885d02b1eed009a3f94eaf75 Mon Sep 17 00:00:00 2001 From: JC Date: Tue, 14 Apr 2026 15:49:31 -0600 Subject: [PATCH 3/3] fix: custom server fix --- app/LoadingApp/components/ConnectIndexer.tsx | 23 ++++++++++++------- app/LoadingApp/components/SelectNetwork.tsx | 2 +- .../components/ServerListScreen.tsx | 1 - 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/app/LoadingApp/components/ConnectIndexer.tsx b/app/LoadingApp/components/ConnectIndexer.tsx index 3c880b4af..53358f729 100644 --- a/app/LoadingApp/components/ConnectIndexer.tsx +++ b/app/LoadingApp/components/ConnectIndexer.tsx @@ -82,7 +82,14 @@ const ConnectIndexer: React.FunctionComponent = ({ const custom: boolean = serverUris().filter(s => s.uri === indexerServerContext.uri).length === 0; - const { base, port } = parseUri(indexerServerContext.uri); + const { base, port } = parseUri( + `${ + !indexerServerContext.uri.toLowerCase().startsWith(GlobalConst.http) && + !indexerServerContext.uri.toLowerCase().startsWith(GlobalConst.https) + ? GlobalConst.http + '//' + indexerServerContext.uri + : indexerServerContext.uri + }`, + ); const [indexerServerUriLocal, setIndexerServerUriLocal] = useState( custom ? base : '', @@ -116,7 +123,13 @@ const ConnectIndexer: React.FunctionComponent = ({ : (translate('info.unknown') as string) + ' (' + chain + ')'; }; - //console.log('Render Servers', insets); + console.log( + 'Render Servers', + indexerServerContext, + indexerServerUriLocal, + indexerServerPortLocal, + indexerServerChainNameLocal, + ); return ( @@ -523,12 +536,6 @@ const ConnectIndexer: React.FunctionComponent = ({ setConnected(null); setBorderColor('transparent'); // add http if it not have it - if ( - !indexerServerUriLocal - .toLowerCase() - .startsWith(GlobalConst.http) - ) { - } const { result: _connected, indexerServerUriParsed: _indexerServerUri, diff --git a/app/LoadingApp/components/SelectNetwork.tsx b/app/LoadingApp/components/SelectNetwork.tsx index c0b3db6ee..c66a6119d 100644 --- a/app/LoadingApp/components/SelectNetwork.tsx +++ b/app/LoadingApp/components/SelectNetwork.tsx @@ -77,7 +77,7 @@ const SelectNetwork: React.FunctionComponent = ({ }; }, []); - console.log('Render Select Network', indexerServerContext); + console.log('Render Select Network', fromSettings); return ( diff --git a/app/LoadingApp/components/ServerListScreen.tsx b/app/LoadingApp/components/ServerListScreen.tsx index 5cb8e7089..93f12f6d6 100644 --- a/app/LoadingApp/components/ServerListScreen.tsx +++ b/app/LoadingApp/components/ServerListScreen.tsx @@ -124,7 +124,6 @@ export const ServerListScreen: React.FC = ({ title="Connect to indexer" goBack={() => { clear(); - goBack(); }} />