From 1d46c7fe600246f92c26d4586ad874b597b739bc Mon Sep 17 00:00:00 2001 From: Joses Gabriel Date: Tue, 4 Feb 2025 14:27:20 +0800 Subject: [PATCH] chore(core): update folder structure --- lib/configs/web3_config.dart | 3 ++- lib/core/application/service/cubit/web3_cubit.dart | 7 +------ .../infrastructures}/contracts/staging/greeter.abi.json | 0 lib/core/module/home/interfaces/screens/home_screen.dart | 1 + lib/internal/enums.dart | 5 +++++ pubspec.yaml | 2 +- 6 files changed, 10 insertions(+), 8 deletions(-) rename lib/{ => core/infrastructures}/contracts/staging/greeter.abi.json (100%) create mode 100644 lib/internal/enums.dart diff --git a/lib/configs/web3_config.dart b/lib/configs/web3_config.dart index 653288b..d36bd9c 100644 --- a/lib/configs/web3_config.dart +++ b/lib/configs/web3_config.dart @@ -4,7 +4,8 @@ import 'package:web3dart/web3dart.dart'; /// Get deployed greeter contract Future get deployedGreeterContract async { - const String abiDirectory = 'lib/contracts/staging/greeter.abi.json'; + const String abiDirectory = + 'lib/core/infrastructures/contracts/staging/greeter.abi.json'; final String contractAddress = dotenv.get('GREETER_CONTRACT_ADDRESS'); final String contractABI = await rootBundle.loadString(abiDirectory); diff --git a/lib/core/application/service/cubit/web3_cubit.dart b/lib/core/application/service/cubit/web3_cubit.dart index 6eb7639..5c85282 100644 --- a/lib/core/application/service/cubit/web3_cubit.dart +++ b/lib/core/application/service/cubit/web3_cubit.dart @@ -3,16 +3,11 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:reown_appkit/reown_appkit.dart'; import 'package:sophon/configs/web3_config.dart'; +import 'package:sophon/internal/enums.dart'; import 'package:sophon/internal/web3_contract.dart'; part 'web3_state.dart'; -enum HomeScreenActionButton { - upgradeWallet, - writeToContract, - connectWallet, -} - class Web3Cubit extends Cubit { Web3Cubit() : super(const Web3State()); diff --git a/lib/contracts/staging/greeter.abi.json b/lib/core/infrastructures/contracts/staging/greeter.abi.json similarity index 100% rename from lib/contracts/staging/greeter.abi.json rename to lib/core/infrastructures/contracts/staging/greeter.abi.json diff --git a/lib/core/module/home/interfaces/screens/home_screen.dart b/lib/core/module/home/interfaces/screens/home_screen.dart index 1296a7d..6f65106 100644 --- a/lib/core/module/home/interfaces/screens/home_screen.dart +++ b/lib/core/module/home/interfaces/screens/home_screen.dart @@ -13,6 +13,7 @@ import 'package:sophon/configs/themes.dart'; import 'package:sophon/core/application/service/cubit/web3_cubit.dart'; import 'package:sophon/core/module/auth/interfaces/screens/authentication_screen.dart'; import 'package:sophon/gen/fonts.gen.dart'; +import 'package:sophon/internal/enums.dart'; import 'package:url_launcher/url_launcher.dart'; class HomeScreen extends StatefulWidget { diff --git a/lib/internal/enums.dart b/lib/internal/enums.dart new file mode 100644 index 0000000..d7b0232 --- /dev/null +++ b/lib/internal/enums.dart @@ -0,0 +1,5 @@ +enum HomeScreenActionButton { + upgradeWallet, + writeToContract, + connectWallet, +} diff --git a/pubspec.yaml b/pubspec.yaml index ea6822c..1de849b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -42,7 +42,7 @@ flutter: assets: - .env - - lib/contracts/staging/greeter.abi.json + - lib/core/infrastructures/contracts/staging/greeter.abi.json - assets/images/