diff --git a/lib/pages/tabs/ethereum/ethereum_rpc_tab_page.dart b/lib/pages/tabs/ethereum/ethereum_rpc_tab_page.dart new file mode 100644 index 00000000..c4804e75 --- /dev/null +++ b/lib/pages/tabs/ethereum/ethereum_rpc_tab_page.dart @@ -0,0 +1,31 @@ +import 'package:auto_route/auto_route.dart'; +import 'package:flutter/material.dart'; +import 'package:get_it/get_it.dart'; +import 'package:sail_ui/sail_ui.dart'; +import 'package:sidesail/console.dart'; +import 'package:sidesail/routing/router.dart'; + +@RoutePage() +class EthereumRPCTabPage extends StatelessWidget { + AppRouter get router => GetIt.I.get(); + + const EthereumRPCTabPage({super.key}); + + @override + Widget build(BuildContext context) { + return const SailPage( + scrollable: true, + title: 'Ethereum RPC', + subtitle: + 'Here you can call eth rpcs directly to the eth-sidechain. Try typing in "eth_blockNumber" in the input below.', + body: Padding( + padding: EdgeInsets.only(bottom: SailStyleValues.padding30), + child: Column( + children: [ + RPCWidget(), + ], + ), + ), + ); + } +} diff --git a/lib/pages/tabs/home_page.dart b/lib/pages/tabs/home_page.dart index a2a3b73f..8eafa805 100644 --- a/lib/pages/tabs/home_page.dart +++ b/lib/pages/tabs/home_page.dart @@ -1,4 +1,5 @@ import 'package:auto_route/auto_route.dart' as auto_router; +import 'package:auto_route/auto_route.dart'; import 'package:flutter/material.dart'; import 'package:get_it/get_it.dart'; import 'package:logger/logger.dart'; @@ -13,7 +14,7 @@ import 'package:sidesail/rpc/rpc_sidechain.dart'; import 'package:sidesail/widgets/containers/chain_overview_card.dart'; import 'package:stacked/stacked.dart'; -@auto_router.RoutePage() +@RoutePage() class HomePage extends StatelessWidget { SidechainRPC get _sideRPC => GetIt.I.get(); @@ -34,7 +35,7 @@ class HomePage extends StatelessWidget { body: SideNav( child: children[tabsRouter.activeIndex], // assume settings tab is final tab! - navigateToSettings: () => tabsRouter.setActiveIndex(routes.length - 1), + navigateToSettings: () => tabsRouter.setActiveIndex(routes.length - 2), ), ); }, @@ -59,11 +60,13 @@ class HomePage extends StatelessWidget { const WithdrawalBundleTabRoute(), const BlindMergedMiningTabRoute(), ]; + break; case SidechainType.ethereum: chainRoutes = [ - const DashboardTabRoute(), + const EthereumRPCTabRoute(), ]; + break; } return [ diff --git a/lib/routing/router.dart b/lib/routing/router.dart index 13784908..f2439680 100644 --- a/lib/routing/router.dart +++ b/lib/routing/router.dart @@ -1,6 +1,7 @@ import 'package:auto_route/auto_route.dart'; import 'package:flutter/widgets.dart'; import 'package:sidesail/pages/tabs/dashboard_tab_page.dart'; +import 'package:sidesail/pages/tabs/ethereum/ethereum_rpc_tab_page.dart'; import 'package:sidesail/pages/tabs/home_page.dart'; import 'package:sidesail/pages/tabs/settings/node_settings_tab.dart'; import 'package:sidesail/pages/tabs/settings/theme_settings_tab.dart'; @@ -50,6 +51,9 @@ class AppRouter extends _$AppRouter { AutoRoute( page: BlindMergedMiningTabRoute.page, ), + AutoRoute( + page: EthereumRPCTabRoute.page, + ), AutoRoute( page: NodeSettingsTabRoute.page, ), diff --git a/lib/routing/router.gr.dart b/lib/routing/router.gr.dart index 27101602..ceae0fdb 100644 --- a/lib/routing/router.gr.dart +++ b/lib/routing/router.gr.dart @@ -27,6 +27,12 @@ abstract class _$AppRouter extends RootStackRouter { child: const DashboardTabPage(), ); }, + EthereumRPCTabRoute.name: (routeData) { + return AutoRoutePage( + routeData: routeData, + child: const EthereumRPCTabPage(), + ); + }, HomeRoute.name: (routeData) { return AutoRoutePage( routeData: routeData, @@ -104,6 +110,20 @@ class DashboardTabRoute extends PageRouteInfo { static const PageInfo page = PageInfo(name); } +/// generated route for +/// [EthereumRPCTabPage] +class EthereumRPCTabRoute extends PageRouteInfo { + const EthereumRPCTabRoute({List? children}) + : super( + EthereumRPCTabRoute.name, + initialChildren: children, + ); + + static const String name = 'EthereumRPCTabRoute'; + + static const PageInfo page = PageInfo(name); +} + /// generated route for /// [HomePage] class HomeRoute extends PageRouteInfo {